From 889842eb8b64a0b72c449ce23ff21e4e8c935cae Mon Sep 17 00:00:00 2001
From: 田源 <lastanimals@163.com>
Date: 星期五, 26 七月 2024 16:06:49 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java | 2
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java | 206 ++-
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java | 2
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java | 80 +
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java | 65 +
Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/usedNames.properties | 2
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java | 4
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java | 26
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java | 10
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java | 2
Source/plt-web/plt-web-ui/src/api/system/menu.js | 92 -
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java | 11
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/properties/UsedNames.java | 38
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java | 37
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java | 351 ++++++
Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/wrapper/VciQueryWrapperForDO.java | 9
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigCorbaReader.java | 4
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java | 722 ++++++++++++++
Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java | 35
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java | 28
Source/plt-web/plt-web-ui/src/api/treeMyMenu.js | 2
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/OsAttributeDO.java | 5
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java | 84 +
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OrgDepartmentVO.java | 37
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java | 42
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/SmUserPO.java | 2
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java | 70 +
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OrgDeptPO.java | 10
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java | 34
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java | 3
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java | 38
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java | 111 ++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java | 205 ++++
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsEnumPO.java | 81 +
Source/plt-web/plt-web-ui/src/api/user.js | 91 -
Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java | 118 ++
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java | 162 +++
37 files changed, 2,467 insertions(+), 354 deletions(-)
diff --git a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java
index 34ab1ba..f49580e 100644
--- a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java
+++ b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java
@@ -1,8 +1,5 @@
package com.vci.starter.poi.bo;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Font;
-
import java.util.List;
/**
@@ -107,7 +104,6 @@
*/
private Integer width;
-
public String getFontColor() {
return fontColor;
}
@@ -145,6 +141,37 @@
}
/**
+ * 鏋勯�犳柟娉�-鏄惁灞呬腑
+ * @param row 琛�
+ * @param col 鍒�
+ * @param obj 鍊�
+ */
+ public WriteExcelData(int row, int col, boolean center, Object obj){
+ this.row = row;
+ this.col = col;
+ this.center = center;
+ this.obj = obj;
+ }
+
+ /**
+ * 鏋勯�犳柟娉�-鍚堝苟锛屽眳涓弬鏁�
+ * @param row 琛�
+ * @param rowTo 鍚堝苟琛�
+ * @param merged 鏄惁鍚堝苟鍗曞厓鏍�
+ * @param center 鏄惁灞呬腑
+ * @param col 鍒�
+ * @param obj 鍊�
+ */
+ public WriteExcelData(int row,int rowTo,boolean merged,boolean center, int col, Object obj){
+ this.row = row;
+ this.rowTo = rowTo;
+ this.merged = merged;
+ this.center = center;
+ this.col = col;
+ this.obj = obj;
+ }
+
+ /**
* 鍐欏叕寮�
* @param row 琛屽彿 浠�0 寮�濮�
* @param col 鍒楀彿浠�0寮�濮�
diff --git a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
index aedbcdf..2ed445e 100644
--- a/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
+++ b/Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/util/ExcelUtil.java
@@ -1,5 +1,6 @@
package com.vci.starter.poi.util;
+import cn.hutool.core.collection.CollUtil;
import com.vci.starter.poi.annotation.ExcelColumn;
import com.vci.starter.poi.annotation.ExcelTitle;
import com.vci.starter.poi.bo.*;
@@ -630,6 +631,8 @@
//鍐欏��
setCellValue(cell, value);
}
+ //璁剧疆鑷�傚簲鍒楀
+ sheet.autoSizeColumn(ed.getCol());
if(ed.getWidth()!=null && ed.getWidth()>0){
sheet.setColumnWidth(cell.getColumnIndex(),(int)(ed.getWidth() + 0.72)*256);
}
@@ -855,6 +858,7 @@
if (ed.getColTo() < ed.getCol()) {
ed.setColTo(ed.getCol());
}
+ List<CellRangeAddress> cellRangeAddressList = sheet.getMergedRegions();
sheet.addMergedRegion(new CellRangeAddress(ed.getRow(), ed.getRowTo(), ed.getCol(), ed.getColTo()));
});
}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java
index 9f8a1ce..3731204 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/OsAttributeDTO.java
@@ -49,7 +49,6 @@
*/
private String defaultValue;
-
/**
* 浣跨敤鏋氫妇鑻辨枃鍚嶇О
*/
@@ -71,6 +70,16 @@
private String btmTypeName;
/**
+ * 鍙傜収鐨勯摼鎺ョ被鍨嬪悕绉�
+ */
+ private String linkTypeName;
+
+ /**
+ * 閫夋嫨浜嗛摼鎺ョ被鍨嬫椂閫夋嫨鐨勭増鏈�
+ */
+ private Integer version;
+
+ /**
* 灞炴�х殑闀垮害
*/
private Integer attrLength;
@@ -85,7 +94,6 @@
*/
private Integer scaleLength;
-
/**
* 鍙栧�艰寖鍥�
*/
@@ -96,6 +104,74 @@
*/
private Date ts;
+ /**
+ * 鍒涘缓浜�
+ */
+ private String creator;
+
+ /**
+ * 鍒涘缓鏃堕棿
+ */
+ private Date createTime;
+
+ /**
+ * 鏈�鍚庝慨鏀逛汉
+ */
+ private String lastModifier;
+
+ /**
+ * 鏈�鍚庝慨鏀规椂闂达紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss
+ */
+ private Date lastModifyTime;
+
+ public String getLinkTypeName() {
+ return linkTypeName;
+ }
+
+ public void setLinkTypeName(String linkTypeName) {
+ this.linkTypeName = linkTypeName;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+
+ public Integer getVersion() {
+ return version;
+ }
+
+ public void setCreator(String creator) {
+ this.creator = creator;
+ }
+
+ public void setCreateTime(Date createTime) {
+ this.createTime = createTime;
+ }
+
+ public void setLastModifier(String lastModifier) {
+ this.lastModifier = lastModifier;
+ }
+
+ public void setLastModifyTime(Date lastModifyTime) {
+ this.lastModifyTime = lastModifyTime;
+ }
+
+ public String getCreator() {
+ return creator;
+ }
+
+ public Date getCreateTime() {
+ return createTime;
+ }
+
+ public String getLastModifier() {
+ return lastModifier;
+ }
+
+ public Date getLastModifyTime() {
+ return lastModifyTime;
+ }
+
public String getOid() {
return oid;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/OsAttributeDO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/OsAttributeDO.java
index 27d1f3e..58a91e4 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/OsAttributeDO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/model/OsAttributeDO.java
@@ -40,21 +40,25 @@
/**
* 鎻忚堪
*/
+ @Column(name = "description")
private String description;
/**
* 鏃堕棿鎴�
*/
+ @Column(name = "ts")
private Date ts;
/**
* 鍒涘缓浜�
*/
+ @Column(name = "creator")
private String creator;
/**
* 鍒涘缓鏃堕棿
*/
+ @Column(name = "createtime")
private Date createTime;
/**
@@ -73,6 +77,7 @@
* 鍐呭
*/
@XmlType
+ @Column(name = "content")
private String content;
public String getOid() {
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OrgDepartmentVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OrgDepartmentVO.java
index 6040f84..da14c67 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OrgDepartmentVO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OrgDepartmentVO.java
@@ -22,7 +22,7 @@
/**
* 闄ら儴闂ㄤ富閿鐨勫敮涓�鏍囪瘑锛岄暱搴︿负8浣嶏紝鍙�氳繃璇ュ弬鏁板弽鎺ㄥ洖閮ㄩ棬涓婚敭;涓昏鐢ㄤ簬瀵煎叆閮ㄩ棬鏃朵娇鐢�
*/
- private String uniqueId;
+ //private String uniqueId;
/**
* 閮ㄩ棬鍚嶇О
@@ -99,7 +99,34 @@
*/
private String tel;
+ /**
+ * 閮ㄩ棬鍚嶇О缁勬垚鐨勫叏璺緞锛歞ept1/dept2/dept3
+ */
+ private String fullDeptNamePath;
+
+ /**
+ * 閮ㄩ棬灞傜骇
+ */
private int treelevel;
+
+ public OrgDepartmentVO() {
+ }
+
+ public OrgDepartmentVO(String id, String name, Short status, String fullDeptNamePath, int treelevel) {
+ this.id = id;
+ this.name = name;
+ this.status = status;
+ this.fullDeptNamePath = fullDeptNamePath;
+ this.treelevel = treelevel;
+ }
+
+ public String getFullDeptNamePath() {
+ return fullDeptNamePath;
+ }
+
+ public void setFullDeptNamePath(String fullDeptNamePath) {
+ this.fullDeptNamePath = fullDeptNamePath;
+ }
public String getCode() {
return code;
@@ -133,13 +160,13 @@
return statusText;
}
- public String getUniqueId() {
+ /*public String getUniqueId() {
return uniqueId;
- }
+ }*/
- public void setUniqueId(String uniqueId) {
+ /*public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
- }
+ }*/
@Override
public String getId() {
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java
index fcaacaa..1cad6e4 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/pagemodel/OsAttributeVO.java
@@ -64,7 +64,6 @@
*/
private String enumName;
-
/**
* 鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�
*/
@@ -74,6 +73,16 @@
* 鍙傜収鐨勪笟鍔$被鍨嬪悕绉�
*/
private String btmTypeName;
+
+ /**
+ * 鍙傜収鐨勯摼鎺ョ被鍨嬪悕绉�
+ */
+ private String linkTypeName;
+
+ /**
+ * 閫夋嫨浜嗛摼鎺ョ被鍨嬫椂閫夋嫨鐨勭増鏈�
+ */
+ private Integer version;
/**
* 灞炴�х殑闀垮害
@@ -96,7 +105,12 @@
private String range;
/**
- * 涓氬姟绫诲瀷鍚嶇О,鏄�艰繖鏉℃暟鎹殑涓氬姟绫诲瀷锛屼笉鏄睘鎬ф墍灞炵殑涓氬姟绫诲瀷
+ * 瀛楁涓哄弬鐓ф椂鍙傜収鐨勭浉鍏冲睘鎬�
+ */
+ private String other;
+
+ /**
+ * 涓氬姟绫诲瀷鍚嶇О,鏄�艰繖鏉℃暟鎹殑涓氬姟绫诲瀷锛屼笉鏄睘鎬ф墍灞炵殑涓氬姟绫诲瀷锛屽簲璇ユ槸涓氬姟绫诲瀷涓哄睘鎬ф睜
*/
private String btmname;
@@ -129,6 +143,14 @@
* 鏃堕棿鎴筹紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss.SSS
*/
private Date ts;
+
+ public String getOther() {
+ return other;
+ }
+
+ public void setOther(String other) {
+ this.other = other;
+ }
public String getOid() {
return oid;
@@ -226,6 +248,22 @@
this.btmTypeName = btmTypeName;
}
+ public String getLinkTypeName() {
+ return linkTypeName;
+ }
+
+ public void setLinkTypeName(String linkTypeName) {
+ this.linkTypeName = linkTypeName;
+ }
+
+ public Integer getVersion() {
+ return version;
+ }
+
+ public void setVersion(Integer version) {
+ this.version = version;
+ }
+
public Integer getAttrLength() {
return attrLength;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OrgDeptPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OrgDeptPO.java
index 7d16413..27c5001 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OrgDeptPO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OrgDeptPO.java
@@ -28,12 +28,6 @@
private String rowIndex;
/**
- * 涓婚敭
- */
- @ExcelColumn(value="ID")
- private String id;
-
- /**
* 閮ㄩ棬鍚嶇О
*/
@ExcelColumn(value="鍚嶇О",nullable = false)
@@ -60,8 +54,8 @@
/**
* 鐖秈d
*/
- @ExcelColumn(value="鐖禝D锛堥儴闂ㄥ敮涓�鏍囪瘑ID锛�")
- private String parentId;
+ @ExcelColumn(value="鐖堕儴闂ㄥ悕绉板叏璺緞锛�/闂撮殧锛�")
+ private String parentFullNamePath;
/**
* 鎻忚堪
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java
new file mode 100644
index 0000000..71aa533
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsAttributePO.java
@@ -0,0 +1,118 @@
+package com.vci.po;
+
+import com.vci.dto.OsEnumItemDTO;
+import com.vci.starter.poi.annotation.ExcelColumn;
+import com.vci.starter.web.pagemodel.BaseModelVO;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 灞炴�ф睜瀵煎叆瀵硅薄
+ * @author ludc
+ * @date 2024/7/19 11:11
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OsAttributePO extends BaseModelVO {
+
+ /**
+ * 绂佹淇敼杩欎釜鍊�
+ */
+ private static final long serialVersionUID = -2239512786206928201L;
+
+ /**
+ * 鎵�鍦ㄦ暟鎹
+ */
+ @ExcelColumn(rowIndexColumn = true,value = "")
+ private String rowIndex;
+
+ /**
+ * 灞炴�ц嫳鏂囧悕绉�
+ */
+ @ExcelColumn(value="灞炴�у悕",nullable = false)
+ private String id;
+
+ /**
+ * 鏍囩
+ */
+ @ExcelColumn(value="鏍囩")
+ private String name;
+
+ /**
+ * 鎻忚堪
+ */
+ @ExcelColumn(value="鎻忚堪")
+ private String description;
+
+ /**
+ * 灞炴�х被鍨�
+ */
+ @ExcelColumn(value="灞炴�х被鍨�",nullable = false)
+ private String attributeDataType;
+
+ /**
+ * 鍏佽涓虹┖
+ */
+ @ExcelColumn(value="鍏佽涓虹┖(鏄�/鍚�)")
+ private String nullableFlag;
+
+ /**
+ * 榛樿鍊�
+ */
+ @ExcelColumn(value="榛樿鍊�")
+ private String defaultValue;
+
+ /**
+ * 鏋氫妇鍚�
+ */
+ @ExcelColumn(value="浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�")
+ private String enumId;
+
+ /**
+ * 鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�
+ */
+ @ExcelColumn(value="鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�")
+ private String btmTypeId;
+
+ /**
+ * 鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�
+ */
+ @ExcelColumn(value="鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�")
+ private String linkTypeName;
+
+ /**
+ * 鐗堟湰
+ */
+ @ExcelColumn(value="鐗堟湰鐗堟")
+ private Integer version;
+
+ /**
+ * 灞炴�ч暱搴�
+ */
+ @ExcelColumn(value="灞炴�ч暱搴�")
+ private Integer attrLength;
+
+ /**
+ * 灏忔暟杩涘害浣嶆暟
+ */
+ @ExcelColumn(value="灏忔暟绮惧害浣嶆暟")
+ private Integer precisionLength;
+
+ /**
+ * 灞炴�ч暱搴�
+ */
+ @ExcelColumn(value="灏忔暟鍒诲害浣嶆暟")
+ private Integer scaleLength;
+
+ /**
+ * 灞炴�ч暱搴�
+ */
+ @ExcelColumn(value="鍙栧�艰寖鍥�")
+ private String range;
+
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsEnumPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsEnumPO.java
new file mode 100644
index 0000000..4bab322
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/OsEnumPO.java
@@ -0,0 +1,81 @@
+package com.vci.po;
+
+import com.vci.dto.OsEnumItemDTO;
+import com.vci.starter.poi.annotation.ExcelColumn;
+import com.vci.starter.web.pagemodel.BaseModelVO;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 鏋氫妇瀵煎叆瀵硅薄
+ * @author ludc
+ * @date 2024/7/19 11:11
+ */
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class OsEnumPO extends BaseModelVO {
+
+ /**
+ * 绂佹淇敼杩欎釜鍊�
+ */
+ private static final long serialVersionUID = -2239512786206928201L;
+
+ /**
+ * 鎵�鍦ㄦ暟鎹
+ */
+ @ExcelColumn(rowIndexColumn = true,value = "")
+ private String rowIndex;
+
+ /**
+ * 灞炴�ц嫳鏂囧悕绉�
+ */
+ @ExcelColumn(value="鏋氫妇鍚嶇О",nullable = false)
+ private String id;
+
+ /**
+ * 鏍囩
+ */
+ @ExcelColumn(value="鏍囩")
+ private String name;
+
+ /**
+ * 杩斿洖绫诲瀷
+ */
+ @ExcelColumn(value="杩斿洖绫诲瀷",nullable = false)
+ private String enumValueDataType;
+
+ /**
+ * 闀垮害
+ */
+ @ExcelColumn(value="闀垮害",nullable = false)
+ private Integer length;
+
+ /**
+ * 鏋氫妇椤瑰悕
+ */
+ @ExcelColumn(value="鏋氫妇椤瑰悕绉�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)",nullable = false)
+ private String enumItemName;
+
+ /**
+ * 鏋氫妇鍊�
+ */
+ @ExcelColumn(value="鏋氫妇鍊�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)",nullable = false)
+ private String value;
+
+ /**
+ * 鎻忚堪
+ */
+ @ExcelColumn(value="鎻忚堪")
+ private String description;
+
+ /**
+ * 鐢ㄤ簬鏁寸悊鎴�1瀵瑰鍏崇郴鏃朵娇鐢紝涓嶉拡瀵瑰鍏ヤ娇鐢�
+ */
+ private List<OsEnumItemDTO> items = new ArrayList<>();
+
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/SmUserPO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/SmUserPO.java
index 192eda0..7376c81 100644
--- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/SmUserPO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/po/SmUserPO.java
@@ -7,7 +7,7 @@
import lombok.NoArgsConstructor;
/**
- * 鐢ㄦ埛鐨勫鍏ュ鍑哄璞�
+ * 鐢ㄦ埛鐨勫鍏ュ璞�
* @author ludc
* @date 2024/7/1 16:53
*/
diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java
index 6d17c4f..1b3525c 100644
--- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java
+++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/util/VciBaseUtil.java
@@ -57,7 +57,7 @@
* @param e
* @return
*/
- public static String getExceptionMessage(Exception e){
+ public static String getExceptionMessage(Throwable e){
String exceptionStr = VciExceptionTool.getExceptionStr(e);
if(exceptionStr.contains("VciBaseException")){
return e.getMessage();
diff --git a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/wrapper/VciQueryWrapperForDO.java b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/wrapper/VciQueryWrapperForDO.java
index 2d2ce8e..5f8f765 100644
--- a/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/wrapper/VciQueryWrapperForDO.java
+++ b/Source/plt-web/plt-web-parent/plt-web-base/src/main/java/com/vci/starter/web/wrapper/VciQueryWrapperForDO.java
@@ -54,7 +54,6 @@
*/
public static final String USER_TABLE_COMPATIBILITY_FIELD_SEP = "${vcicomplibitysep}";
-
/**
* 鏌ヨ鏉′欢
*/
@@ -111,7 +110,7 @@
private PageHelper pageHelper;
/**
- * 鎵�鏈夌殑瀛楁鍚嶇О,key鏄璞″睘鎬т腑鐨勫瓧娈碉紝value鏄暟鎹簱閲岀殑瀛楁
+ * 鎵�鏈夌殑瀛楁鍚嶇О,key鏄暟鎹簱閲岀殑瀛楁锛寁alue鏄璞″睘鎬т腑鐨勫瓧娈�
*/
private Map<String,String> allFieldNameMap;
@@ -1428,9 +1427,10 @@
public Map<String,String> switchConditionMap(){
Map<String,String> queryMap = new HashMap<>();
if(!CollectionUtils.isEmpty(this.conditionMap)){
- this.conditionMap.forEach((key,value)->{
+ //TODO: 杞崲鍓嶇殑瀛楁鍜岃浆鎹㈠悗鐨勫瓧娈典笉搴旇鍚屾椂瀛樺湪锛屽簲璇ラ兘缁熶竴浣跨敤杞崲鍚庣殑瀛楁鍋氭煡璇㈡潯浠�
+ /*this.conditionMap.forEach((key,value)->{
queryMap.put(key,value);
- });
+ });*/
//鎴戜滑杞崲涓�涓嬶紝鐩存帴set锛屽鏋滆繕鏈夐噸澶嶇殑灏卞彧鑳借嚜琛岃В鍐�
this.allFieldNameMap.forEach((dbField,field)->{
if(conditionMap.containsKey(field)){
@@ -1452,7 +1452,6 @@
public void setLinkTableSql(String linkTableSql) {
this.linkTableSql = linkTableSql;
}
-
/**
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java
index ae07c6b..e09c8d2 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/OrgDeptQueryServiceI.java
@@ -27,13 +27,20 @@
OrgDepartmentVO getDeptByDeptOid(String deptOid) throws VciBaseException;
/**
- * 鏍规嵁鐖堕儴闂ㄤ富閿幏鍙栧拰閮ㄩ棬鍚嶇О閮ㄩ棬鐨勪俊鎭�
+ * 鏍规嵁鐖堕儴闂ㄤ富閿幏鍙栧拰閮ㄩ棬鍚嶇О閮ㄩ棬鐨勪俊鎭紙涓昏鐢ㄤ簬鏂板鍜屼慨鏀规煡閲嶏級
* @param parentDeptOid 鐖堕儴闂ㄤ富閿�
* @param conditionMap 鏌ヨ鏉′欢
* @return 閮ㄩ棬鐨勬樉绀哄璞★紝濡傛灉閮ㄩ棬涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯�
* @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
- List<OrgDepartmentVO> getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException;
+ List<OrgDepartmentVO> getDeptByDeptpOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException;
+
+ /**
+ * 鏍规嵁鐖堕儴闂ㄥ悕绉拌矾寰勮幏鍙栧拰閮ㄩ棬鍚嶇О閮ㄩ棬鐨勪俊鎭紙涓昏鐢ㄤ簬瀵煎叆鏃舵牴鎹儴闂ㄥ懡浠ゅ叏璺緞鍜屽悕绉版垨缂栧彿鏌ラ噸锛�
+ * @return 閮ㄩ棬鐨勬樉绀哄璞★紝濡傛灉閮ㄩ棬涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯�
+ * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ List<OrgDepartmentVO> getDeptAllFullName() throws VciBaseException;
/**
* 鎵归噺鑾峰彇閮ㄩ棬鐨勪俊鎭� 锛堟牴鎹儴闂ㄤ富閿級
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java
index edaa600..bbffffa 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java
@@ -70,7 +70,7 @@
/**
* 蹇呭~鍒�
*/
- private ArrayList<Integer> ColumnNameisRed = new ArrayList<Integer>();
+ private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
/**
* 鏃ュ織
@@ -99,14 +99,14 @@
}
/**
- * 鏍规嵁鐖堕儴闂ㄤ富閿幏鍙栧拰閮ㄩ棬鍚嶇О閮ㄩ棬鐨勪俊鎭�
+ * 鏍规嵁鐖堕儴闂ㄤ富閿幏鍙栭儴闂ㄥ悕绉伴儴闂ㄧ殑淇℃伅
* @param parentDeptOid 鐖堕儴闂ㄤ富閿�
* @param conditionMap 閮ㄩ棬鍚嶇О
* @return 閮ㄩ棬鐨勬樉绀哄璞★紝濡傛灉閮ㄩ棬涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯�
* @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父
*/
@Override
- public List<OrgDepartmentVO> getDeptByDeptPOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException {
+ public List<OrgDepartmentVO> getDeptByDeptpOidAndCondition(String parentDeptOid,Map<String,String> conditionMap) throws VciBaseException {
if(Func.isEmpty(conditionMap)){
conditionMap = new HashMap();
}
@@ -122,6 +122,42 @@
return null;
}
return deptDO2VOs(roleForPlatform1s);
+ }
+
+ /**
+ * 鏍规嵁鐖堕儴闂ㄥ悕绉拌矾寰勮幏鍙栧拰閮ㄩ棬鍚嶇О閮ㄩ棬鐨勪俊鎭紙涓昏鐢ㄤ簬瀵煎叆鏃舵牴鎹儴闂ㄥ懡浠ゅ叏璺緞鍜屽悕绉版垨缂栧彿鏌ラ噸锛�
+ * @return 閮ㄩ棬鐨勬樉绀哄璞★紝濡傛灉閮ㄩ棬涓嶅瓨鍦ㄥ垯杩斿洖null锛屼笉浼氭姏鍑哄紓甯�
+ * @throws VciBaseException 鍙傛暟涓虹┖鎴栬�呮暟鎹簱瀛樺湪闂鐨勬椂鍊欎細鎶涘嚭寮傚父
+ */
+ @Override
+ public List<OrgDepartmentVO> getDeptAllFullName() throws VciBaseException {
+ //鏌ヨ閮ㄩ棬淇℃伅锛屼富瑕佹煡璇㈤儴闂ㄥ悕绉扮粍鎴愬叏璺緞
+ String sql = "SELECT PLUID, PLNAME, PLNUM, PLSTATUS, level, substr(sys_connect_by_path(PLNAME, '/'), 2) AS FULL_NAME_PATH " +
+ "FROM PLDEPT " +
+ "START WITH PLPARENTUID IS NULL " +
+ "CONNECT BY PRIOR PLUID = PLPARENTUID";
+ List<BusinessObject> cbos = boService.queryByOnlySql(sql);
+ List<OrgDepartmentVO> departmentVOList = new ArrayList<>();
+ if(!CollectionUtils.isEmpty(cbos)){
+ cbos.stream().forEach(cbo->{
+ //閮ㄩ棬涓婚敭
+ String deptOid = ObjectTool.getNewBOAttributeValue(cbo,"PLUID");
+ //閮ㄩ棬鍚嶇О
+ String deptName = ObjectTool.getNewBOAttributeValue(cbo, "PLNAME");
+ //閮ㄩ棬缂栧彿
+ String deptNum = ObjectTool.getNewBOAttributeValue(cbo, "PLNUM");
+ //閮ㄩ棬灞傜骇
+ String deptLevel = ObjectTool.getNewBOAttributeValue(cbo, "level");
+ //閮ㄩ棬鍚嶇О鍏ㄨ矾寰�
+ String fullDeptNamePath = ObjectTool.getNewBOAttributeValue(cbo, "FULL_NAME_PATH");
+ //閮ㄩ棬鐘舵��
+ String deptStatus = ObjectTool.getNewBOAttributeValue(cbo, "PLSTATUS");
+ OrgDepartmentVO orgDepartmentVO = new OrgDepartmentVO(deptNum,deptName,Short.valueOf(deptStatus),fullDeptNamePath,Integer.valueOf(deptLevel));
+ orgDepartmentVO.setOid(deptOid);
+ departmentVOList.add(orgDepartmentVO);
+ });
+ }
+ return departmentVOList;
}
/**
@@ -147,7 +183,7 @@
if(deptForPlatform1!=null){
departmentVO.setOid(deptForPlatform1.getPluid());
// 闄ら儴闂ㄤ富閿鐨勫敮涓�鏍囪瘑锛岄暱搴︿负Dept:+8浣嶅彲閫氳繃璇ュ弬鏁板弽鎺ㄥ洖閮ㄩ棬涓婚敭鐨刪ash缂栫爜
- departmentVO.setUniqueId("Dept:"+Func.oidEnHash(deptForPlatform1.getPluid()));
+ //departmentVO.setUniqueId("Dept:"+Func.oidEnHash(deptForPlatform1.getPluid()));
departmentVO.setId(deptForPlatform1.getPlnum());
departmentVO.setName(deptForPlatform1.getPlname());
departmentVO.setStatus(deptForPlatform1.getPlstatus());
@@ -552,7 +588,7 @@
}
/**
- * 淇濆瓨閮ㄩ棬瑙掕壊鍏宠仈淇℃伅锛屽甫鏌ラ噸鍔熻兘
+ * 淇濆瓨閮ㄩ棬鐢ㄦ埛鍏宠仈淇℃伅锛屽甫鏌ラ噸鍔熻兘
* @param userOIds 鐢ㄦ埛id
* @param deptId 閮ㄩ棬id
* @return
@@ -602,7 +638,7 @@
if(Func.isNotBlank(orgDepartmentDTO.getId())){
conditionMap.put("plnum",QueryOptionConstant.OR + orgDepartmentDTO.getId());
}
- List<OrgDepartmentVO> departmentVOS = getDeptByDeptPOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
+ List<OrgDepartmentVO> departmentVOS = getDeptByDeptpOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
if(Func.isNotEmpty(departmentVOS)){
throw new VciBaseException("鍚屼竴鐖惰妭鐐逛笅璇ラ儴闂ㄥ悕绉版垨缂栧彿宸茬粡瀛樺湪,璇蜂慨鏀�!");
}
@@ -647,7 +683,7 @@
if(Func.isNotBlank(orgDepartmentDTO.getId())){
conditionMap.put("plnum",QueryOptionConstant.OR + orgDepartmentDTO.getId());
}
- List<OrgDepartmentVO> repeatDepartmentVOS = getDeptByDeptPOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
+ List<OrgDepartmentVO> repeatDepartmentVOS = getDeptByDeptpOidAndCondition(orgDepartmentDTO.getPkFatherDepartment(), conditionMap);
repeatDepartmentVOS = repeatDepartmentVOS.stream().filter(item -> {
if((item.getName().equals(orgDepartmentDTO.getName()) || item.getId().equals(orgDepartmentDTO.getId())) &&
!item.getOid().equals(orgDepartmentDTO.getOid())){
@@ -703,22 +739,12 @@
@Override
public boolean deleteDept(String[] ids) throws PLException {
VciBaseUtil.alertNotNull(ids,"瑕佸垹闄ょ殑閮ㄩ棬涓婚敭");
- //TODO: 搴旇鏄笉鍏峰杩炲甫鍒犻櫎鐨勫姛鑳斤紝绛栫暐鍒犻櫎鍚庣敤鎴峰叧鑱旂殑鏃犵敤閮ㄩ棬杩樺湪,鑰冭檻鍚庢湡鏄惁闇�瑕佸仛锛屾暟鎹噺涓嶅ぇ鍙互涓嶅仛杩炲甫鍒犻櫎
+ //TODO:鑰冭檻鏄惁闇�瑕佹坊鍔犲垹闄ゅ墠鍒ゆ柇閮ㄩ棬涓嬫槸鍚﹂厤缃湁鐢ㄦ埛锛岃繖绉嶆儏鍐靛簲璇ヤ笉鍏佽鍒犻櫎
+ //TODO: 搴旇鏄笉鍏峰杩炲甫鍒犻櫎鐨勫姛鑳斤紝閮ㄩ棬鍒犻櫎鍚庣敤鎴峰叧鑱旂殑鏃犵敤閮ㄩ棬杩樺湪,鑰冭檻鍚庢湡鏄惁闇�瑕佸仛锛屾暟鎹噺涓嶅ぇ鍙互涓嶅仛杩炲甫鍒犻櫎
return platformClientUtil.getFrameworkService().deleteDepartment(
ids,
- new UserEntityInfo("developer"/*WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId()*/, null)
+ new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(), null)
);
- }
-
- /**
- * 鑾峰彇鎵�鏈夐儴闂ㄧ殑淇℃伅
- * @return key锛氶儴闂ㄧ敱鍚嶇О缁勬垚鐨勮矾寰勶紙/闂撮殧锛夛紝value瀵瑰簲鏈�灏忓眰绾х殑閮ㄩ棬淇℃伅
- */
- @Override
- public Map<String, OrgDepartmentVO> getDeptAllTreeMap() {
- List<OrgDepartmentVO> orgDepartmentVOList = listAllLevelChildrenDeptByParentOid(null, null);
- Map<String, OrgDepartmentVO> stringOrgDepartmentVOMap = convertToMap(orgDepartmentVOList);
- return stringOrgDepartmentVOMap;
}
/**
@@ -731,10 +757,10 @@
//鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ悕绉�
downloadFileName = Func.isBlank(downloadFileName) ? "閮ㄩ棬瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):downloadFileName;
// 璁剧疆琛ㄥ崟鍒楀悕
- List<String> columns = new ArrayList<>(Arrays.asList("ID", "鍚嶇О", "缂栧彿", "浠e彿", "涓撲笟", "鐖禝D锛堥儴闂ㄥ敮涓�鏍囪瘑ID锛�", "鎻忚堪"));
+ List<String> columns = new ArrayList<>(Arrays.asList("鍚嶇О", "缂栧彿", "浠e彿", "涓撲笟", "鐖堕儴闂ㄥ悕绉板叏璺緞锛�/闂撮殧锛�", "鎻忚堪"));
//璁剧疆蹇呭~鍒�
ColumnNameisRed.clear();
- //ColumnNameisRed.add(0);
+ ColumnNameisRed.add(0);
ColumnNameisRed.add(1);
//鍐檈xcel
String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + downloadFileName + ".xls";
@@ -784,53 +810,56 @@
if(CollectionUtils.isEmpty(poList)){
return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
}
- /*閮ㄩ棬瀵煎叆鍑犱釜姣旇緝閲嶈鐨勬儏鏅細
- 1銆佸綋鍓嶅鍏ョ殑鏁版嵁鏄竴涓儴闂ㄦ爲缁撴瀯(瑕佸垽鏂敤鎴锋墜杈撶殑ID鏄惁瀛樺湪閲嶅锛岃緭浜嗗氨瑕佸垽鏂槸鍚﹀湪褰撳墠琛ㄦ牸涓噸澶嶏紝
- 骞朵笖淇濆瓨鏃朵笉鑳戒娇鐢ㄧ敤鎴锋墜杈撶殑ID锛岃鏍规嵁鎵嬭緭ID鍜屽疄闄呭瓨鍌∣ID鍋氬搴旀槧灏勶紝
- 骞朵笖涓嶇牬鍧忚〃鏍间腑閮ㄩ棬鏍戠粨鏋勶紝濡傛灉娌℃墜杈揑D灏卞彧闇�瑕佸叧娉╬arentId杩欎釜灞炴�э紝
- 骞朵笖闇�瑕佹敞鎰忓鏋滄湁鐨処D鏈夛紝鏈夌殑娌℃湁閭e氨闇�瑕佹敞鎰忥紝鏃㈠瓨鍦ㄥ拰绯荤粺涓紝
- 鍏宠仈鐨勯儴闂ㄦ爲锛屽張瀛樺湪鍜屽綋鍓嶈〃鏍间腑鍏宠仈鐨勯儴闂ㄦ爲)銆�
- 2銆佸綋鍓嶅鍏ョ殑鏁版嵁鐖秈d鍏宠仈浜嗗凡瀛樺湪鐨勯儴闂╫id(瑕佹煡璇㈢埗id杩欎釜閮ㄩ棬鏄惁瀛樺湪锛�)
- 瑙e喅鎬濊矾锛氭渶濂芥槸灏嗚〃鏍间腑鍙兘鏄儴闂ㄦ爲鐨勭粰閬嶅巻鎴愭爲锛岀劧鍚庡啀鍋氭煡閲嶅暐鐨勫鐞�
- */
+
//2銆佸繀濉垽绌恒�佸垽閲嶏紙鏁版嵁搴撳垽閲嶅拰excel涓垽閲嶏級锛岀粍瑁呮垚淇濆瓨鐢ㄧ殑鏁版嵁瀵硅薄
List<DeptInfo> deptInfoList = new ArrayList<>();
- //2.1銆佺敤浠ュ瓨鍌╡xcel涓噸澶嶇殑鏁版嵁锛屼笁涓笉鍙噸澶嶇殑瀛楁锛夛紙Name涓嶈兘涓虹┖锛孨ame銆丆ode鍚屼竴鐖堕儴闂ㄤ笅鍞竴锛�
- List<String> repeatIdList = new ArrayList<>();
+ //2.1銆佺敤浠ュ瓨鍌╡xcel涓噸澶嶇殑鏁版嵁锛屼袱涓笉鍙噸澶嶇殑瀛楁锛夛紙Name涓嶈兘涓虹┖锛孨ame銆丆ode鍚屼竴鐖堕儴闂ㄤ笅鍞竴锛�
Map<String,String> repeatNameMap = new HashMap<>();
Map<String,String> repeatNumMap = new HashMap<>();
Map<String,String> indexMap = new HashMap<>();
//2.2銆佸瓨鍌ㄧ敤鎴锋墜杈撶殑oid鍜屽疄闄呭瓨鍌╫id鐨勬槧灏勫叧绯�
Map<String, String> oidMap = new HashMap<>();
+ //鏌ヨ绯荤粺涓儴闂紝鍏朵腑鍖呭惈浜嗛儴闂ㄥ悕绉版爲灞炴��
+ List<OrgDepartmentVO> dbOrgDepartmentVOList = this.getDeptAllFullName();
+ //閬嶅巻鎴恗ap瀵硅薄锛歬ey涓篋eptName鐨勫叏璺緞锛歷alue涓篋ept瀵硅薄(鐢ㄦ埛澶勭悊閮ㄩ棬鐖剁粍浠�)
+ Map<String, String> dbOrgDepartFullNameOidMap = dbOrgDepartmentVOList.stream().collect(Collectors.toMap(OrgDepartmentVO::getFullDeptNamePath, OrgDepartmentVO::getOid));
+ //鐢ㄦ潵鍒ゆ柇澶刾arentName鏃笉鍦ㄥ簱涓瓨鍦紝鍙堜笉鍦╬oNames瀛樺湪鐨勬儏鍐�
+ List<String> poNames = poList.stream().map(OrgDeptPO::getName).collect(Collectors.toList());
poList.stream().forEach(po->{
- String parentId = Func.isBlank(po.getParentId()) ? "":po.getParentId();
+ String parentFullNamePath = Func.isBlank(po.getParentFullNamePath()) ? "":po.getParentFullNamePath();
//閮ㄩ棬鍚嶇О鍒ょ┖锛岄�氬父閫氳繃po涓殑娉ㄨВ灏卞彲瀹炵幇
- if(Func.isEmpty(po.getName())){
+ if(Func.isBlank(po.getName())){
throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒epterror,Reason:Name cannot be empty");
- }else if(parentId.equals(repeatNameMap.getOrDefault(po.getName(), null))/*excel涓悓涓�閮ㄩ棬涓婲ame鐩哥瓑*/){
+ }else if(parentFullNamePath.equals(repeatNameMap.getOrDefault(po.getName(), null))/*excel涓悓涓�閮ㄩ棬涓婲ame鐩哥瓑*/){
//鍚屼竴閮ㄩ棬涓嬪悕绉板垽閲�
throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptnameerror,Reason: Names under the same department cannot be duplicated");
- }else if(Func.isNotEmpty(po.getId()) && repeatIdList.equals(po.getId())){
- throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptiderror,Reason: The primary key cannot be duplicated");
- }else if(Func.isNotEmpty(po.getNum()) && parentId.equals(repeatNumMap.getOrDefault(po.getNum(),null))/*excel涓悓涓�閮ㄩ棬涓嬬紪鍙峰瓨鍦� */){
+ }else if(Func.isNotBlank(po.getNum()) && parentFullNamePath.equals(repeatNumMap.getOrDefault(po.getNum(),null))/*excel涓悓涓�閮ㄩ棬涓嬬紪鍙峰瓨鍦� */){
throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptnumerror,Reason: The number cannot be duplicated");
}else{
- //2.2銆佹煡璇㈡暟鎹簱涓殑鏁版嵁锛堟煡閲岻D鍜孨UM锛夛紝姣旇緝楹荤儲闇�瑕佹牴鎹甈arentID鏌ヨ锛堟墍鏈夊彧鑳藉崟鏉℃煡璇㈣繘琛屽垽閲嶏級
- //缁勮鏌ラ噸鏉′欢:鍚屼竴閮ㄩ棬涓�(parentId鐩哥瓑)锛宯ame鎴栬�卬um鐩哥瓑
- HashMap<String, String> conditionMap = new HashMap<>();
- conditionMap.put("plname",QueryOptionConstant.OR + po.getName());
- conditionMap.put("plnum",QueryOptionConstant.OR + po.getNum());
- String pId = Func.isBlank(po.getParentId()) ? null:po.getParentId();
- List<OrgDepartmentVO> repeatOrgDept = this.getDeptByDeptPOidAndCondition(pId, conditionMap);
+ //2.2銆佹煡璇㈡暟鎹簱涓殑鏁版嵁锛堟煡閲岻D鍜孨UM锛夛紝姣旇緝楹荤儲闇�瑕佹牴鎹甈arentName鍏ㄨ矾寰勬煡璇紙鎵�鏈夊彧鑳藉崟鏉℃煡璇㈣繘琛屽垽閲嶏級
+ //鍚屼竴閮ㄩ棬涓�(parentName鐩哥瓑)锛宯ame鎴栬�卬um鐩哥瓑
+ List<OrgDepartmentVO> repeatOrgDept = dbOrgDepartmentVOList.stream().filter(item -> {
+ //鍚屼竴閮ㄩ棬鍚嶇О鍏ㄨ矾寰勪笅锛岄儴闂ㄥ悕绉扮浉绛夈�侀儴闂ㄧ紪鍙蜂笉涓虹┖骞朵笖鍜岀郴缁熶腑瀛樺湪鐩哥瓑鐨勭紪鍙�
+ boolean isNameOrNumRepeat = po.getName().equals(item.getName()) || (Func.isNotBlank(po.getNum()) && po.getNum().equals(item.getId()));
+ /*褰損arentFullNamePath涓�""鏃秈tem.getFullDeptNamePath().contains(parentFullNamePath)姘歌繙涓簍rue锛�
+ 鎵�浠ラ渶瑕佺壒娈婂鐞嗙洿鎺ュ垽鏂《灞傜殑閮ㄩ棬鏄惁瀛樺湪閲嶅*/
+ if(((Func.isBlank(parentFullNamePath) && item.getTreelevel() == 1)
+ || (Func.isNotBlank(parentFullNamePath) && item.getFullDeptNamePath().contains(parentFullNamePath)))
+ && isNameOrNumRepeat) {
+ return true;
+ }
+ return false;
+ }).collect(Collectors.toList());
//鍙涓嶄负绌哄氨璇存槑褰撳墠琛屾暟鎹湪绯荤粺涓噸澶�
if(Func.isNotEmpty(repeatOrgDept)){
throw new VciBaseException("绗��"+po.getRowIndex()+"銆戣锛宒eptname or deptnum error,Reason: The name or number already exists in the system");
}
}
//瀛樺偍鏍¢獙閫氳繃鐨勬暟鎹紝浠ヤ究鍚庣画excel鏌ラ噸
- repeatNameMap.put(po.getName(),Func.isBlank(po.getParentId()) ? "":po.getParentId());
- repeatIdList.add(po.getId());
- repeatNumMap.put(po.getNum(),po.getParentId());
+ repeatNameMap.put(po.getName(),parentFullNamePath);
+ if(Func.isNotBlank(po.getNum())){
+ repeatNumMap.put(po.getNum(),parentFullNamePath);
+ }
indexMap.put(po.getName(),po.getRowIndex());
//鏍¢獙鏁版嵁灏辫缁勮鎴怐TO鏁版嵁瀵硅薄浜�
OrgDepartmentDTO dto = new OrgDepartmentDTO();
@@ -839,48 +868,51 @@
dto.setId(po.getNum());
dto.setDescription(po.getDesc());
dto.setSpecialties(po.getSpecialties());
- dto.setPkFatherDepartment(po.getParentId());
dto.setCreateTime(new Date());
dto.setCreator(loginUserId);
dto.setLastModifier(loginUserId);
dto.setStatus((short) 0);
- //2.2銆佽繃绋嬩腑澶勭悊涓婚敭杞崲闂鏈�濂芥槸涓�鏉′竴鏉$殑澶勭悊ID鏄惁瀛樺湪杩樻湁ParentID鏄惁瀛樺湪鐨勯棶棰�
- //鍏堝垽鏂槸宸插瓨鍦ㄧ殑閮ㄩ棬ID锛岃繕鏄笉瀛樺湪鐨勯儴闂↖D锛屽凡瀛樺湪绯荤粺涓殑ID灏辨槸涓篋ept:寮�澶寸殑
- String pId = Func.isBlank(dto.getPkFatherDepartment()) ? "":dto.getPkFatherDepartment();
- //鏄凡瀛樺湪绯荤粺涓殑閮ㄩ棬id
- if(pId.contains("Dept:")){
- //瑙f瀽鍑虹湡瀹炵殑oid
- String deParentId = Func.oidDeHash(pId.replace("Dept:", "").trim());
- //瑙f瀽鍑烘潵鐨刣eParentId蹇呴』寰楀湪搴撲腑瀛樺湪
- if(Func.isBlank(deParentId) || Func.isEmpty(this.getDeptByDeptOid(deParentId))){
- throw new VciBaseException("绗��"+ po.getRowIndex() +"銆戣锛宒eptparentiderror,Reason:Parent ID resolution error or does not exist in the system");
+ //缁欏鍏ョ殑鏁版嵁璁剧疆鐨勪富閿�
+ String oid = VciBaseUtil.getPk().toUpperCase(Locale.ROOT);
+ dto.setOid(oid);
+ /*澶勭悊閮ㄩ棬鍚嶇О鍏ㄨ矾寰勮浆鎹负PkFatherDepartment锛堥儴闂ㄤ富閿級锛�
+ 鎯呭喌1銆佺洿灞炵埗閮ㄩ棬鏄郴缁熶腑宸插瓨鍦紙鍒ゆ柇鏂瑰紡锛氶儴闂ㄥ悕绉板叏璺緞鍦╠bOrgDepartmentVOList涓瓨鍦紝fullDeptNamePath鍏ㄧ瓑浜巔arentFullNamePath锛夈��
+ 鎯呭喌2銆佺洿灞炵埗閮ㄩ棬涓嶆槸绯荤粺涓凡瀛樺湪鐨�,浣嗘槸鐩村睘鐖堕儴闂ㄧ殑鐨勪笂绾ч儴闂ㄦ槸绯荤粺涓凡瀛樺湪鐨�(娑夊強鍒皁id鍜宲arentoid瀵瑰簲鍏崇郴澶勭悊姣旇緝楹荤儲)銆�
+ 鎯呭喌3銆佺洿灞炵埗閮ㄩ棬鍜屽叾涓婄骇閮ㄩ棬閮芥槸excel涓柊鏋勫缓鐨勩��(娑夊強鍒皁id鍜宲arentoid瀵瑰簲鍏崇郴澶勭悊姣旇緝楹荤儲)*/
+ String dbDeptoid = dbOrgDepartFullNameOidMap.getOrDefault(parentFullNamePath, null);
+ //鎯呭喌1鍙互鐩存帴璁剧疆parentOid銆�
+ if(Func.isNotEmpty(dbDeptoid) || "".equals(parentFullNamePath)){
+ //璁剧疆鐖堕儴闂ㄤ富閿�
+ dto.setPkFatherDepartment(dbDeptoid);
+ }else{
+ //澶勭悊鐖惰矾寰勫悕鏃笉瀛樺湪浜庢暟鎹簱鍙堜笉瀛樺湪浜庡綋鍓峞xcel
+ String lastParentFullName = parentFullNamePath.substring(parentFullNamePath.lastIndexOf("/") + 1);//鐖惰矾寰勫悕鐨勬渶鍚庝竴涓儴闂ㄥ悕绉�
+ if(Func.isBlank(dbOrgDepartFullNameOidMap.getOrDefault(parentFullNamePath,null))
+ && !poNames.contains(lastParentFullName)
+ ){
+ throw new VciBaseException("褰撳墠瀵煎叆鐨勯儴闂ㄦ暟鎹腑锛岀銆�" + indexMap.get(po.getName()) + "銆戣锛岀埗閮ㄩ棬璁剧疆瀛樺湪闂锛�");
}
- //鏇挎崲鎺変复鏃朵娇鐢ㄧ殑閮ㄩ棬鍞竴鏍囪瘑锛屼絾鏄负浜嗘柟渚垮悗缁垽鏂紝杩樻槸闇�瑕佸姞涓奃ept:鏍囪瘑
- dto.setPkFatherDepartment("Dept:"+deParentId);
+ //鎯呭喌2鍜�3闇�瑕侀�氳繃鏄犲皠鍏崇郴璁剧疆parentoid锛屾墍浠ヨ繖閲屽厛鏍囪鍚庣画鍐嶅仛澶勭悊銆�
+ dto.setPkFatherDepartment("Pending:" + parentFullNamePath);
}
- //鐢ㄦ埛鎵嬭緭浜嗛儴闂╫id锛屼絾鏄伩鍏峯id涓嶈鑼冮渶瑕侊紝鐢ㄨ鑼僶id杩涜鏇挎崲锛屽鏋滄病杈撳叆淇濆瓨鏃朵細鑷姩鐢熸垚oid
- String excelOid = dto.getOid();
- if(Func.isNotBlank(excelOid)){
- String pkOid = VciBaseUtil.getPk().toUpperCase(Locale.ROOT);
- dto.setOid(pkOid);
- //oid鏄犲皠鍏崇郴锛屽悗缁敤鏉ユ洿鏂皃arentId
- oidMap.put(excelOid,pkOid);
- }
+ //瀛樺偍parentOid:oid鏄犲皠鍏崇郴
+ String key = Func.isBlank(parentFullNamePath) ? po.getName():parentFullNamePath + "/"+po.getName();
+ oidMap.put(key,oid);
+
DeptInfo deptInfo = this.changeOrgDeptDTOToDeptInfo(dto);
deptInfoList.add(deptInfo);
});
- //3銆佸鐞唅d鍜宲arentId鐨勬槧灏勫叧绯�:灏嗙敤鎴锋墜杈撶殑鐖禝D杞崲鎴愬疄闄呭瓨鍌ㄧ殑ID骞朵繚瀛樿繘搴�
+ //3銆佸鐞唎id鍜宲arentOid鐨勬槧灏勫叧绯�:閽堝鏂板姞鐨勬暟鎹槸鐖堕儴闂�
deptInfoList.stream().forEach(info -> {
- //3.1銆佸鏈�缁堝鐞嗗ソ鐨勯儴闂ㄦ暟鎹繚瀛�
try {
- //parentId涓嶄负绌哄苟涓旀病鏈塂ept:鐩稿叧鐨勫瓧绗︿覆,璇存槑鏄敤鎴锋墜杈撶殑ParentId(瀵煎叆鐨勬暟鎹氨鏄竴涓爲缁撴瀯)
- if (Func.isNotBlank(info.parentId) && !info.parentId.contains("Dept:")) {
- //杞崲ParentId涓哄疄闄呰瀛樺偍鐨勯儴闂↖D
- info.parentId = oidMap.get(info.parentId);
- }else if(info.parentId.contains("Dept:")){
+ //parentId涓嶄负绌哄苟涓旀病鏈塒ending:鐩稿叧鐨勫瓧绗︿覆,璇存槑鏄渶瑕佸鐞唎id鏄犲皠parentOid鐨�
+ if (info.parentId.contains("Pending:")){
//绯荤粺涓凡瀛樺湪鐨勭埗閮ㄩ棬OID锛岄渶瑕佺Щ闄ゆ帀Dept:鏍囪瘑
- info.parentId = info.parentId.replace("Dept:","");
+ String key = info.parentId.replace("Pending:","");
+ String parentId = oidMap.get(key);
+ info.parentId = parentId;
}
+ //4銆佷繚瀛樻搷浣�
platformClientUtil.getFrameworkService().saveDepartment(
info,
userEntityInfo
@@ -900,7 +932,23 @@
return BaseResult.success("閮ㄩ棬瀵煎叆鎴愬姛锛�");
}
- public Map<String, OrgDepartmentVO> convertToMap(List<OrgDepartmentVO> orgDepartmentVOList) {
+ /**
+ * 鑾峰彇鎵�鏈夐儴闂ㄧ殑淇℃伅
+ * @return key锛氶儴闂ㄧ敱鍚嶇О缁勬垚鐨勮矾寰勶紙/闂撮殧锛夛紝value瀵瑰簲鏈�灏忓眰绾х殑閮ㄩ棬淇℃伅
+ */
+ @Override
+ public Map<String, OrgDepartmentVO> getDeptAllTreeMap() {
+ List<OrgDepartmentVO> orgDepartmentVOList = listAllLevelChildrenDeptByParentOid(null, null);
+ Map<String, OrgDepartmentVO> stringOrgDepartmentVOMap = convertToMap(orgDepartmentVOList);
+ return stringOrgDepartmentVOMap;
+ }
+
+ /**
+ * 鑾峰彇閮ㄩ棬鐢卞悕绉扮粍鎴愮殑璺緞锛�/闂撮殧锛夛紝value瀵瑰簲鏈�灏忓眰绾х殑閮ㄩ棬淇℃伅
+ * @param orgDepartmentVOList
+ * @return
+ */
+ private Map<String, OrgDepartmentVO> convertToMap(List<OrgDepartmentVO> orgDepartmentVOList) {
Map<String, OrgDepartmentVO> map = new HashMap<>();
for (OrgDepartmentVO orgDepartmentVO : orgDepartmentVOList) {
String key = buildKey(orgDepartmentVO, orgDepartmentVOList);
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
index 2320280..1c44f0d 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmRoleQueryServiceImpl.java
@@ -8,9 +8,11 @@
import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI;
import com.vci.constant.FrameWorkBtmTypeConstant;
import com.vci.dto.SmRoleDTO;
+import com.vci.frameworkcore.compatibility.SmUserQueryServiceI;
import com.vci.frameworkcore.enumpck.RoleClassifyEnum;
import com.vci.frameworkcore.enumpck.RoleControlAreaEnum;
import com.vci.model.SmRoleForPlatform1;
+import com.vci.pagemodel.SmUserVO;
import com.vci.po.SmRolePO;
import com.vci.pagemodel.SmRoleVO;
import com.vci.omd.utils.ObjectTool;
@@ -34,6 +36,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@@ -56,6 +59,13 @@
*/
@Autowired
private WebBoServiceI boService;
+
+ /**
+ * 鐢ㄦ埛鏌ヨ鏈嶅姟
+ */
+ @Autowired
+ @Lazy
+ private SmUserQueryServiceI smUserQueryServiceI;
/**
* 骞冲彴璋冪敤瀹㈡埛绔�
@@ -679,11 +689,31 @@
@Override
public boolean deleteRole(String[] ids) throws PLException {
VciBaseUtil.alertNotNull(ids,"瑕佸垹闄ょ殑瑙掕壊涓婚敭");
+ //浣跨敤涓婚敭鍒ゆ柇瑙掕壊鏄惁琚敤鎴峰紩鐢�
+ for (int i = 0; i < ids.length; i++) {
+ String roleName = this.checkIsUsed(ids[i]);
+ if(Func.isNotBlank(roleName)){
+ throw new PLException("500",new String[]{"褰撳墠閫変腑瑕佸垹闄ょ殑瑙掕壊涓瓨鍦ㄣ��"+roleName+"銆戣寮曠敤!"});
+ }
+ }
//鍏峰杩炲甫鍒犻櫎鐨勫姛鑳斤紝濡傝鑹茶彍鍗曟巿鏉冭〃閲岄潰鐨勬巿鏉冧俊鎭�
return platformClientUtil.getFrameworkService().deleteRole(
ids,
new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(), null)
);
+ }
+
+ /**
+ * 妫�鏌ヨ鑹叉槸鍚︽湁鍦ㄥ紩鐢�
+ * @param roleOid
+ * @return
+ */
+ private String checkIsUsed(String roleOid){
+ List<SmUserVO> smUserVOS = smUserQueryServiceI.listUserByRoleOid(roleOid, null);
+ if (Func.isNotEmpty(smUserVOS)) {
+ return this.getRoleNameByRoleOid(roleOid);
+ }
+ return null;
}
/**
@@ -733,8 +763,8 @@
try {
SmRoleDTO smRoleDTO = new SmRoleDTO();
BeanUtil.copy(smRolePO,smRoleDTO);
- //SessionInfo loginUser = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
- String userId = "developer";//loginUser.getUserId();
+ SessionInfo loginUser = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
+ String userId = loginUser.getUserId();
//瑙掕壊绫诲瀷锛岃繖閲岃缃簡浼氬湪changeRoleObjectToRoleInfo涓浆鎹�
if(UserTypeEnum.SUPPER_ADMIN.getValue().equals("0")){
smRoleDTO.setRoleClassify(RoleClassifyEnum.MANAGE.getValue());
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
index e56db37..d08bcbb 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java
@@ -16,7 +16,7 @@
import com.vci.pagemodel.OrgDepartmentVO;
import com.vci.pagemodel.SmPasswordStrategyVO;
import com.vci.pagemodel.SmRoleVO;
-import com.vci.frameworkcore.properties.ConfigReader;
+import com.vci.frameworkcore.properties.ConfigCorbaReader;
import com.vci.omd.utils.ObjectTool;
import com.vci.starter.poi.bo.ReadExcelOption;
import com.vci.starter.poi.bo.WriteExcelData;
@@ -1322,7 +1322,7 @@
// 璁剧疆琛ㄥ崟鍒楀悕
List<String> columns = new ArrayList<>(Arrays.asList("璐﹀彿", "瀵嗙爜", "濮撳悕", "鐢靛瓙閭", "涓撲笟", "鎻忚堪", "閮ㄩ棬(涓婁笅绾ч儴闂ㄤ箣闂翠互鍙嶆枩鏉犻殧寮�(/))"));
//鑾峰彇鏄惁瀵煎嚭瀵嗙骇閰嶇疆椤�
- String flag = ConfigReader.getConfigValue("exportSecretGrade");
+ String flag = ConfigCorbaReader.getConfigValue("exportSecretGrade");
if (flag != null && flag.equalsIgnoreCase("true")) {
columns = new ArrayList<>(Arrays.asList("璐﹀彿", "瀵嗙爜", "濮撳悕", "鐢靛瓙閭", "涓撲笟", "鎻忚堪", "閮ㄩ棬(涓婁笅绾ч儴闂ㄤ箣闂翠互鍙嶆枩鏉犻殧寮�(/))" ,"瀵嗙骇"));
}
@@ -1374,7 +1374,7 @@
String loginUserId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
UserEntityInfo userEntityInfo = new UserEntityInfo(loginUserId,null);
//鏄惁瀵煎叆瀵嗙骇閰嶇疆
- boolean exportSecretGrade = Boolean.parseBoolean(ConfigReader.getConfigValue("exportSecretGrade"));
+ boolean exportSecretGrade = Boolean.parseBoolean(ConfigCorbaReader.getConfigValue("exportSecretGrade"));
List<SmUserPO> poList = ExcelUtil.readDataObjectFromExcel(file, SmUserPO.class,excelOption,(value, po, fieldName)->{
Integer secretValue = UserSecretEnum.getSecretValueByText(po.getSecretGradeText());
//鏄惁蹇呴』瀵煎叆瀵嗙骇
@@ -1398,7 +1398,9 @@
//褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氳处鍙凤紝value锛氳鍙凤級
Map<String, String> excelReapeat = new HashMap<>();
//鍏堣幏鍙栧叏閮ㄩ儴闂ㄥ悕绉扮殑鐖跺瓙瀵瑰簲鍏崇郴锛歬ey涓洪儴闂ㄥ瓙鐖剁骇鍚嶇О璺緞锛寁alue涓洪儴闂ㄤ俊鎭�
- Map<String,OrgDepartmentVO> deptVOMap = orgDeptQueryService.getDeptAllTreeMap();
+ List<OrgDepartmentVO> orgDepartmentVOList = orgDeptQueryService.getDeptAllFullName();
+ Map<String, OrgDepartmentVO> deptVOMap = orgDepartmentVOList.stream().collect(Collectors.toMap(OrgDepartmentVO::getFullDeptNamePath, s->s));
+ //Map<String,OrgDepartmentVO> deptVOMap = orgDeptQueryService.getDeptAllTreeMap();
//鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫
List<String> finalRepeatUserId = repeatUserId;
poList.stream().forEach(smUserPO -> {
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java
index 05821b2..cbb2b54 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/OrgDepartmentQueryController.java
@@ -4,6 +4,7 @@
import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI;
import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.pagemodel.OrgDepartmentVO;
+import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.*;
import com.vci.starter.web.util.ControllerUtil;
@@ -177,6 +178,7 @@
* @return
*/
@RequestMapping(value = "/importDept",method = RequestMethod.POST)
+ @VciUnCheckRight
public BaseResult importUser(MultipartFile file){
String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
File file1 = new File(excelFileName);
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java
index f0b45cc..df34042 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmPwdStrategyQueryController.java
@@ -46,7 +46,6 @@
* @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父锛屽鏋滄槸鑰佺殑椤圭洰閲屼笉鎶涘嚭寮傚父
*/
@RequestMapping(value = "/refDataGrid",method = RequestMethod.GET)
- @VciUnCheckRight
public BaseResult<SmPasswordStrategyVO> refDataGrid(BaseQueryObject queryObject) throws VciBaseException {
try {
DataGrid<SmPasswordStrategyVO> pwdStrategyVODataGrid = pwdStrategyQueryService.refDataGrid(queryObject.getConditionMap(),queryObject.getPageHelper());
@@ -66,7 +65,6 @@
* @throws VciBaseException
*/
@RequestMapping(value = "/selectPwdStrategyMap",method = RequestMethod.GET)
- @VciUnCheckRight
public BaseResult<List<Map<String,String>>> selectPwdStrategyMap(BaseQueryObject queryObject) throws VciBaseException {
try {
List<Map<String,String>> pwdStrategyVODataGrid = pwdStrategyQueryService.selectPwdStrategyMap(queryObject.getConditionMap());
@@ -140,7 +138,6 @@
* @return
*/
@RequestMapping(value = "/delPasswordStrateg",method = RequestMethod.DELETE)
- @VciUnCheckRight
public BaseResult delPasswordStrateg(String[] pwdIds){
try {
return pwdStrategyQueryService.delPasswordStrateg(pwdIds)
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigReader.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigCorbaReader.java
similarity index 80%
rename from Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigReader.java
rename to Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigCorbaReader.java
index f5c2186..ac08739 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigReader.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/properties/ConfigCorbaReader.java
@@ -9,13 +9,13 @@
* @author ludc
* @date 2024/6/28 23:11
*/
-public class ConfigReader {
+public class ConfigCorbaReader {
private static Properties properties;
static {
properties = new Properties();
- try (InputStream input = ConfigReader.class.getClassLoader().getResourceAsStream("properties/corba.properties")) {
+ try (InputStream input = ConfigCorbaReader.class.getClassLoader().getResourceAsStream("properties/corba.properties")) {
if (input == null) {
System.err.println("Unable to find corba.properties");
} else {
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
index 5a65bfe..f33a04a 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java
@@ -1,13 +1,30 @@
package com.vci.web.controller;
+import com.vci.constant.FrameWorkLangCodeConstant;
+import com.vci.dto.OsAttributeDTO;
+import com.vci.starter.web.annotation.controller.VciUnCheckRight;
+import com.vci.starter.web.annotation.log.VciBusinessLog;
+import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
-import com.vci.starter.web.pagemodel.DataGrid;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.pagemodel.OsAttributeVO;
+import com.vci.starter.web.util.ControllerUtil;
+import com.vci.starter.web.util.LocalFileUtil;
+import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsAttributeServiceI;
+import com.vci.web.util.Func;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
/**
* 灞炴�ф帶鍒跺櫒
@@ -25,12 +42,188 @@
private OsAttributeServiceI attributeService;
/**
+ * 鏃ュ織
+ */
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ /**
* 灞炴�у垪琛�
* @param baseQueryObject 鏌ヨ瀵硅薄
* @return 灞炴�х殑鏄剧ず瀵硅薄
*/
@GetMapping("/gridAttribute")
- public DataGrid<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject){
- return attributeService.gridAttribute(baseQueryObject);
+ @VciUnCheckRight
+ public BaseResult<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject){
+ try {
+ return BaseResult.dataGrid(attributeService.gridAttribute(baseQueryObject));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "灞炴�х鐞嗗垪琛ㄦ煡璇㈡椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
}
+
+ /**
+ * 鏍规嵁澶氫釜灞炴�у悕绉版煡璇㈠睘鎬�
+ * @param attrNames
+ * @return
+ */
+ @GetMapping("/getByAttributeNames")
+ @VciBusinessLog(operateName = "鏍规嵁澶氫釜灞炴�у悕绉版煡璇㈠睘鎬�")
+ public BaseResult getByAttributeNames(String[] attrNames){
+ try {
+ return BaseResult.dataList(attributeService.getByAttributeNames(attrNames));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "灞炴�у悕鏌ヨ灞炴�ф椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 娣诲姞鍗曟潯灞炴�у埌灞炴�ф睜
+ * @param osAttributeDTO
+ * @return 鍒楄〃鐨勫唴瀹�
+ */
+ @PostMapping( "/addAttribute")
+ @VciBusinessLog(operateName = "娣诲姞灞炴��")
+ public BaseResult addAttribute(@RequestBody OsAttributeDTO osAttributeDTO) {
+ try {
+ return attributeService.addAttribute(osAttributeDTO) ? BaseResult.success("灞炴�ф坊鍔犳垚鍔燂紒"):BaseResult.fail("灞炴�ф坊鍔犲け璐ワ紒");
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "澧炲姞灞炴�ф椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 淇敼鍗曟潯灞炴��
+ * @param osAttributeDTO
+ * @return 鍒楄〃鐨勫唴瀹�
+ */
+ @PutMapping( "/updateAttribute")
+ @VciBusinessLog(operateName = "淇敼灞炴��")
+ @VciUnCheckRight
+ public BaseResult updateAttribute(@RequestBody OsAttributeDTO osAttributeDTO) {
+ try {
+ return attributeService.updateAttribute(osAttributeDTO) ? BaseResult.success("灞炴�т慨鏀规垚鍔燂紒"):BaseResult.fail("灞炴�т慨鏀瑰け璐ワ紒");
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "淇敼灞炴�ф椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 鍒犻櫎灞炴��
+ * @param osAttributeDTOS
+ * @return 鍒楄〃鐨勫唴瀹�
+ */
+ @DeleteMapping( "/deleteAttributes")
+ @VciBusinessLog(operateName = "鍒犻櫎灞炴��")
+ public BaseResult deleteAttributes(@RequestBody List<OsAttributeDTO> osAttributeDTOS) {
+ try {
+ return attributeService.deleteAttributes(osAttributeDTOS) ? BaseResult.success("灞炴�у垹闄ゆ垚鍔燂紒"):BaseResult.fail("灞炴�у垹闄ゅけ璐ワ紒");
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鍒犻櫎灞炴�ф椂鍑虹幇閿欒锛屽師鍥狅細" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 鏌ョ湅灞炴�х殑浣跨敤鑼冨洿
+ * @param attributeName 灞炴�у悕绉�
+ * @return map瀵硅薄
+ */
+ @GetMapping( "/getUsedAttributeList")
+ @VciBusinessLog(operateName = "鏌ョ湅灞炴�х殑浣跨敤鑼冨洿")
+ public BaseResult getUsedAttributeList(String attributeName) {
+ try {
+ return BaseResult.dataList(attributeService.getUsedAttributeList(attributeName));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鑾峰彇灞炴�х殑浣跨敤鑼冨洿鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
+ * 瀵煎嚭閫変腑鐨勫睘鎬�
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param attrNames 闇�瑕佸鍑虹殑灞炴�ц嫳鏂囧悕绉�
+ * @param response
+ */
+ @GetMapping( "/exportAttributes")
+ @VciBusinessLog(operateName = "瀵煎嚭灞炴��")
+ public void exportAttributes(String exportFileName,String attrNames, HttpServletResponse response){
+ try {
+ String excelPath = attributeService.exportAttributes(exportFileName,attrNames);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ } catch (Exception e) {
+ String msg = "瀵煎嚭鏋氫妇鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ try {
+ //鍑洪敊鏃�
+ e.printStackTrace();
+ ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 涓嬭浇灞炴�у鍏ユā鏉�
+ * @param exportFileName
+ * @param response
+ */
+ @GetMapping( "/downloadAttributeTemplate")
+ @VciBusinessLog(operateName = "瀵煎嚭灞炴��")
+ public void downloadAttributeTemplate(String exportFileName, HttpServletResponse response){
+ try {
+ String excelPath = attributeService.downloadAttributeTemplate(exportFileName);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ } catch (Exception e) {
+ String msg = "涓嬭浇鏋氫妇瀵煎叆妯℃澘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ try {
+ //鍑洪敊鏃�
+ e.printStackTrace();
+ ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 瀵煎叆灞炴��
+ * @param file
+ * @return
+ */
+ @PostMapping("/importAttributes")
+ @VciUnCheckRight
+ public BaseResult importAttributes(MultipartFile file){
+ String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
+ File file1 = new File(excelFileName);
+ try {
+ file.transferTo(new File(excelFileName));
+ if (file != null) {
+ return attributeService.importAttributes(file1);
+ } else {
+ return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
+ }
+ }catch (Throwable e) {
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+ }finally {
+ file1.delete();
+ }
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
index 9308325..8b592a7 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java
@@ -1,20 +1,24 @@
package com.vci.web.controller;
+import com.vci.corba.common.PLException;
+import com.vci.corba.omd.ltm.LinkType;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeVO;
+import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
+import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsLinkTypeServiceI;
import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
+import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -34,6 +38,11 @@
private OsLinkTypeServiceI linkTypeService;
/**
+ * 鏃ュ織
+ */
+ private Logger logger = LoggerFactory.getLogger(getClass());
+
+ /**
* 閾炬帴绫诲瀷鐨勫垪琛�
* @param baseQueryObject 鏌ヨ瀵硅薄
* @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
@@ -41,6 +50,23 @@
@GetMapping("/gridLinkType")
public DataGrid<OsLinkTypeVO> gridLinkType(BaseQueryObject baseQueryObject){
return linkTypeService.gridLinkType(baseQueryObject);
+ }
+
+ /**
+ * 鏌ヨ鎵�鏈夌殑閾炬帴绫诲瀷鍚嶇О锛屽彲鐢ㄤ簬灞炴�ф睜鐨勮繛鎺ョ被鍨嬮�夋嫨鏃剁殑瀵硅瘽妗�
+ * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
+ */
+ @GetMapping("/getAllLtName")
+ @VciUnCheckRight
+ public BaseResult getAllLtName(){
+ try {
+ return BaseResult.dataList(linkTypeService.getAllLtName());
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "閾炬帴绫诲瀷鍒楄〃鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
}
/**
@@ -93,4 +119,40 @@
return BaseResult.success();
}
}
+
+
+ /**
+ * 閾炬帴绫诲瀷鐨勫垪琛�
+ *
+ * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
+ */
+ @GetMapping("/gridLink")
+ public BaseResult<List<LinkType>> gridLink(){
+ try {
+ return linkTypeService.gridLink();
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
+
+ /**
+ * 閾炬帴绫诲瀷淇濆瓨
+ * linkType 閾炬帴绫诲瀷鐨勪繚瀛樺璞�
+ * addFlag 鏄惁涓烘柊澧� true鏂板锛宖alse淇敼
+ * @return 淇濆瓨缁撴灉
+ */
+ @GetMapping("/addAndEditLink")
+ public BaseResult addAndEditLink(@RequestBody LinkType linkType, Boolean addFlag){
+ try {
+ return linkTypeService.addAndEditLink(linkType, addFlag);
+ } catch (PLException e) {
+ BaseResult objectBaseResult = new BaseResult<>();
+ objectBaseResult.setCode(Integer.parseInt(e.code));
+ objectBaseResult.setMsg(Arrays.toString(e.messages));
+ return objectBaseResult;
+ }
+ }
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
index 81d0ddd..e460f8f 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebBtmTypeController.java
@@ -1,5 +1,7 @@
package com.vci.web.controller;
+import com.vci.corba.common.PLException;
+import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.annotation.log.VciBusinessLog;
import com.vci.starter.web.enumpck.BooleanEnum;
import com.vci.starter.web.exception.VciBaseException;
@@ -17,6 +19,8 @@
import com.vci.web.service.OsBtmServiceI;
import com.vci.web.service.WebBtmIOServiceI;
import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.*;
@@ -26,6 +30,7 @@
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@@ -40,6 +45,11 @@
@VciBusinessLog(modelName="涓氬姟绫诲瀷")
@RestController
public class WebBtmTypeController {
+
+ /**
+ * 鏃ュ織
+ */
+ private Logger logger = LoggerFactory.getLogger(getClass());
/**
* 涓氬姟绫诲瀷鐨勬湇鍔�
@@ -71,6 +81,24 @@
return btmService.referDataGrid(baseQueryObject.getConditionMap(),baseQueryObject.getPageHelper());
}
+ /**
+ * 鑾峰彇鍚嶅瓧浠ilter寮�濮嬬殑涓氬姟绫诲瀷(for 鏌ヨ)锛屼富瑕佺敤浜庡睘鎬ф睜鐨勪笟鍔$被鍨嬮�夋嫨瀵硅瘽妗�
+ * @param btmName 鏌ヨ鏉′欢
+ * @return 鍒楄〃鐨勫唴瀹�
+ */
+ @GetMapping( "/getBizTypes")
+ @VciBusinessLog(operateName = "涓氬姟绫诲瀷鍒楄〃(涓昏鐢ㄤ簬瀵硅瘽妗嗕娇鐢�)")
+ @VciUnCheckRight
+ public BaseResult getBizTypes(String btmName){
+ try {
+ return BaseResult.dataList(Arrays.asList(btmService.getBizTypes(btmName)));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鑾峰彇涓氬姟绫诲瀷鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
/**
* 鍙傜収鐨勪笟鍔$被鍨�
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java
index e8beb3e..a8048f4 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java
@@ -1,22 +1,35 @@
package com.vci.web.controller;
+import com.vci.constant.FrameWorkLangCodeConstant;
import com.vci.dto.OsEnumDTO;
import com.vci.starter.web.annotation.controller.VciUnCheckRight;
import com.vci.starter.web.annotation.log.VciBusinessLog;
+import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.pagemodel.KeyValue;
import com.vci.pagemodel.OsEnumItemVO;
import com.vci.pagemodel.OsEnumVO;
+import com.vci.starter.web.util.ControllerUtil;
+import com.vci.starter.web.util.LangBaseUtil;
+import com.vci.starter.web.util.LocalFileUtil;
import com.vci.starter.web.util.VciBaseUtil;
import com.vci.web.service.OsEnumServiceI;
+import com.vci.web.util.Func;
+import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
+import java.util.Date;
import java.util.List;
+import java.util.Map;
/**
@@ -46,7 +59,6 @@
* @return 鏋氫妇鐨勪笅鎷夊��
*/
@VciBusinessLog(notStore=true,operateName="鑾峰彇鏋氫妇")
- @VciUnCheckRight
@GetMapping("/getEnum")
public BaseResult<List<KeyValue>> getEnum(String comboxKey){
return BaseResult.success(enumService.getEnum(comboxKey));
@@ -87,13 +99,30 @@
}
/**
+ * 鏍规嵁鏋氫妇绫诲瀷鑾峰彇鏋氫妇
+ * @param enumType 鏌ヨ鏉′欢name
+ * @return 鍒楄〃鐨勫唴瀹�
+ */
+ @GetMapping( "/getEnumMapByType")
+ @VciBusinessLog(operateName = "鏋氫妇鍒楄〃")
+ public BaseResult getEnumMapByType(String enumType) {
+ try {
+ return BaseResult.dataList(enumService.getEnumMapByType(enumType));
+ }catch (Exception e) {
+ e.printStackTrace();
+ String exceptionMessage = "鏋氫妇绠$悊鍒楄〃鏌ヨ鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ logger.error(exceptionMessage);
+ return BaseResult.fail(exceptionMessage);
+ }
+ }
+
+ /**
* 鏋氫妇鍒楄〃
* @param enumName 鏌ヨ鏉′欢name
* @return 鍒楄〃鐨勫唴瀹�
*/
@GetMapping( "/getEnumTypeList")
@VciBusinessLog(operateName = "鏋氫妇鍒楄〃")
- @VciUnCheckRight
public BaseResult<List<OsEnumVO>> getEnumTypeList(String enumName) {
try {
return BaseResult.dataList(enumService.getEnumTypeList(enumName));
@@ -112,7 +141,6 @@
*/
@PostMapping( "/addEnumType")
@VciBusinessLog(operateName = "娣诲姞鏋氫妇")
- @VciUnCheckRight
public BaseResult addEnumType(@RequestBody OsEnumDTO osEnumDTO) {
try {
return enumService.addEnumType(osEnumDTO) ? BaseResult.success("鏋氫妇绫诲瀷娣诲姞鎴愬姛锛�"):BaseResult.fail("鏋氫妇绫诲瀷娣诲姞澶辫触锛�");
@@ -131,7 +159,6 @@
*/
@PutMapping( "/updateEnumType")
@VciBusinessLog(operateName = "淇敼鏋氫妇")
- @VciUnCheckRight
public BaseResult updateEnumType(@RequestBody OsEnumDTO osEnumDTO) {
try {
return enumService.updateEnumType(osEnumDTO) ? BaseResult.success("鏋氫妇绫诲瀷淇敼鎴愬姛锛�"):BaseResult.fail("鏋氫妇绫诲瀷淇敼澶辫触锛�");
@@ -150,7 +177,6 @@
*/
@DeleteMapping( "/deleteEnumTypes")
@VciBusinessLog(operateName = "鍒犻櫎鏋氫妇")
- @VciUnCheckRight
public BaseResult deleteEnumTypes(@RequestBody List<OsEnumDTO> osEnumDTOS) {
try {
return enumService.deleteEnumTypes(osEnumDTOS) ? BaseResult.success("鏋氫妇绫诲瀷鍒犻櫎鎴愬姛锛�"):BaseResult.fail("鏋氫妇绫诲瀷鍒犻櫎澶辫触锛�");
@@ -164,12 +190,11 @@
/**
* 鏌ョ湅鏋氫妇鐨勪娇鐢ㄨ寖鍥�
- * @param enumName
- * @return 鍒楄〃鐨勫唴瀹�
+ * @param enumName 鏋氫妇鍚嶇О
+ * @return map瀵硅薄
*/
@GetMapping( "/getUsedEnumList")
@VciBusinessLog(operateName = "鏌ョ湅鏋氫妇鐨勪娇鐢ㄨ寖鍥�")
- @VciUnCheckRight
public BaseResult getUsedEnumList(String enumName) {
try {
return BaseResult.dataList(enumService.getUsedEnumList(enumName));
@@ -181,4 +206,74 @@
}
}
+ /**
+ * 瀵煎嚭閫変腑鐨勬灇涓剧被鍨�
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param enumNames 闇�瑕佸鍑虹殑鏋氫妇鍚嶇О
+ * @param response
+ */
+ @GetMapping( "/exportEnumTypes")
+ @VciBusinessLog(operateName = "瀵煎嚭鏋氫妇绫诲瀷")
+ public void exportEnumTypes(String exportFileName,String enumNames, HttpServletResponse response){
+ try {
+ String excelPath = enumService.exportEnumTypes(exportFileName,enumNames);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ } catch (Exception e) {
+ String msg = "瀵煎嚭鏋氫妇鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ try {
+ //鍑洪敊鏃�
+ e.printStackTrace();
+ ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 涓嬭浇瀵煎叆妯℃澘
+ * @param exportFileName
+ * @param response
+ */
+ @GetMapping( "/downloadEnumTemplate")
+ @VciBusinessLog(operateName = "瀵煎嚭鏋氫妇绫诲瀷")
+ public void downloadEnumTemplate(String exportFileName, HttpServletResponse response){
+ try {
+ String excelPath = enumService.downloadEnumTemplate(exportFileName);
+ ControllerUtil.writeFileToResponse(response,excelPath);
+ } catch (Exception e) {
+ String msg = "涓嬭浇鏋氫妇瀵煎叆妯℃澘鏃跺嚭鐜伴敊璇紝鍘熷洜锛�" + VciBaseUtil.getExceptionMessage(e);
+ try {
+ //鍑洪敊鏃�
+ e.printStackTrace();
+ ControllerUtil.writeDataToResponse(response,"error_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss") + ".txt", StringUtils.isNotBlank(msg)?msg.getBytes():new byte[0],null);
+ } catch (IOException ioException) {
+ ioException.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * 瀵煎叆鏋氫妇
+ * @param file
+ * @return
+ */
+ @RequestMapping(value = "/importEnumTypes",method = RequestMethod.POST)
+ public BaseResult importEnumTypes(MultipartFile file){
+ String excelFileName = LocalFileUtil.getDefaultTempFolder() + File.separator + LocalFileUtil.getFileNameForIE(file.getOriginalFilename());
+ File file1 = new File(excelFileName);
+ try {
+ file.transferTo(new File(excelFileName));
+ if (file != null) {
+ return enumService.importEnumTypes(file1);
+ } else {
+ return BaseResult.fail(FrameWorkLangCodeConstant.IMPORT_FAIL, new String[]{"鏃犲鍏ョ殑鏂囦欢"});
+ }
+ }catch (Throwable e) {
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e),new String[0],e);
+ }finally {
+ file1.delete();
+ }
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/properties/UsedNames.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/properties/UsedNames.java
new file mode 100644
index 0000000..bda0410
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/properties/UsedNames.java
@@ -0,0 +1,38 @@
+package com.vci.web.properties;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.PropertyResourceBundle;
+
+import com.vci.client.common.ClientLog4j;
+
+public class UsedNames {
+ private static PropertyResourceBundle resourceBundle = null;
+
+ static{
+ try{
+ if(resourceBundle == null){
+ InputStream ins = UsedNames.class.getClassLoader().getResourceAsStream("properties/usedNames.properties");
+ if(ins != null){
+ resourceBundle = new PropertyResourceBundle(ins);
+ }
+ }
+ }catch(IOException e){
+ //e.printStackTrace();
+ ClientLog4j.logger.error(e);
+ }catch(Exception e){
+ //e.printStackTrace();
+ ClientLog4j.logger.error(e);
+ }
+ }
+
+ public static String getProperty(String strKey){
+ try{
+ return resourceBundle.getString(strKey);
+ }catch(Exception e){
+ //e.printStackTrace();
+ ClientLog4j.logger.error(e);
+ return "";
+ }
+ }
+}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
index 5326c44..b1e782f 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java
@@ -1,10 +1,15 @@
package com.vci.web.service;
+import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
+import com.vci.dto.OsAttributeDTO;
import com.vci.starter.web.pagemodel.BaseQueryObject;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.pagemodel.OsAttributeVO;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -15,6 +20,7 @@
* @date 2021-2-15
*/
public interface OsAttributeServiceI extends OsBaseServiceI{
+
/**
* 鑾峰彇榛樿鐨勫睘鎬�
* @return 榛樿鐨勫睘鎬у垪琛�
@@ -32,6 +38,7 @@
* @return 榛樿鐨勫睘鎬ф槧灏�
*/
Map<String, OsAttributeVO> getDefaultAttributeVOMap();
+
/**
* 璁剧疆榛樿鐨勫睘鎬х殑鏄犲皠
* @param defaultAttributeVOMap 榛樿鐨勫睘鎬ф槧灏�
@@ -49,6 +56,13 @@
* @return key鏄睘鎬х殑鑻辨枃鍚嶇О灏忓啓锛寁alue鏄睘鎬х殑鏄剧ず瀵硅薄
*/
Map<String,OsAttributeVO> selectAllAttributeMap();
+
+ /**
+ * 鏍规嵁澶氫釜灞炴�у悕绉版煡璇㈠睘鎬�
+ * @param attrNames
+ * @return
+ */
+ List<OsAttributeVO> getByAttributeNames(String[] attrNames) throws PLException;
/**
* 灞炴�х殑鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
@@ -104,6 +118,56 @@
*/
DataGrid<OsAttributeVO> gridAttribute(BaseQueryObject baseQueryObject);
+ /**
+ * 娣诲姞鍗曟潯灞炴��
+ * @param osAttributeDTO
+ * @return true鎴愬姛锛宖alse澶辫触
+ */
+ boolean addAttribute(OsAttributeDTO osAttributeDTO) throws PLException;
+
+ /**
+ * 淇敼鍗曟潯灞炴��
+ * @param osAttributeDTO
+ * @return true鎴愬姛锛宖alse澶辫触
+ */
+ boolean updateAttribute(OsAttributeDTO osAttributeDTO) throws PLException;
+
+ /**
+ * 鍒犻櫎灞炴��
+ * @param osAttributeDTOS
+ * @return true鎴愬姛锛宖alse澶辫触
+ */
+ boolean deleteAttributes(List<OsAttributeDTO> osAttributeDTOS) throws PLException;
+
+ /**
+ * 鏌ョ湅灞炴�х殑浣跨敤鑼冨洿
+ * @param attributeName
+ * @return key:灞炴�� 锛寁alue浣跨敤璇ュ睘鎬х殑涓氬姟绫诲瀷
+ */
+ List<Map<String,String>> getUsedAttributeList(String attributeName) throws PLException;
+
+ /**
+ * 瀵煎嚭閫変腑鐨勫睘鎬�
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param attrNames 闇�瑕佸鍑虹殑灞炴�у悕绉�
+ * @return
+ */
+ String exportAttributes(String exportFileName,String attrNames) throws PLException;
+
+ /**
+ * 涓嬭浇灞炴�у鍏ユā鏉�
+ * @param exportFileName
+ * @return
+ * @throws PLException
+ */
+ String downloadAttributeTemplate(String exportFileName) throws Exception;
+
+ /**
+ * 瀵煎叆灞炴��
+ * @param file
+ * @return
+ */
+ BaseResult importAttributes(File file) throws Exception;
/**
* 鏄惁榛樿鐨勫睘鎬�
@@ -111,4 +175,5 @@
* @return true琛ㄧず鏄粯璁ゅ睘鎬�
*/
boolean isDefaultAttr(String attr);
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java
index 4fbf26c..841f993 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBaseServiceI.java
@@ -1,5 +1,6 @@
package com.vci.web.service;
+import com.vci.corba.common.PLException;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.starter.web.pagemodel.BaseQueryObject;
import com.vci.starter.web.pagemodel.DataGrid;
@@ -142,6 +143,5 @@
}
return dataGrid;
}
-
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
index 85b5146..141ddf0 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsBtmServiceI.java
@@ -1,5 +1,6 @@
package com.vci.web.service;
+import com.vci.corba.common.PLException;
import com.vci.corba.omd.btm.BizType;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsBtmTypeVO;
@@ -20,12 +21,37 @@
public interface OsBtmServiceI extends OsBaseServiceI{
/**
+ * 淇敼涓氬姟绫诲瀷涓搴斿睘鎬у悕鐨勫睘鎬�
+ * @param apName
+ * @return
+ * @throws PLException
+ */
+ boolean alterAp(String apName) throws PLException;
+
+ /**
+ * 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪涓氬姟绫诲瀷涓骇鐢熶簡鏁版嵁
+ * @param abName
+ * @return
+ * @throws PLException
+ */
+ boolean hasInstance(String abName) throws PLException;
+
+ /**
* 鏌ヨ鎵�鏈夌殑涓氬姟绫诲瀷
* @return 涓氬姟绫诲瀷瀵硅薄
*/
List<OsBtmTypeVO> selectAllBtm();
/**
+ * 鑾峰彇鍚嶅瓧浠ilter寮�濮嬬殑涓氬姟绫诲瀷(for 鏌ヨ)锛屼富瑕佺敤浜庡睘鎬ф睜鐨勪笟鍔$被鍨嬮�夋嫨瀵硅瘽妗�
+ * 鑾峰彇鍏ㄩ儴涓氬姟绫诲瀷锛屼紶鍙俧ilter涓�""
+ * @param btmName
+ * @return
+ * @throws PLException
+ */
+ BizType[] getBizTypes(String btmName) throws PLException;
+
+ /**
* 鏌ヨ鎵�鏈夌殑涓氬姟绫诲瀷鏄犲皠
* @return key 鏄笟鍔$殑鑻辨枃鍚嶇О鐨勫皬鍐�
*/
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java
index 21881ba..7d53a23 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsEnumServiceI.java
@@ -3,12 +3,15 @@
import com.vci.corba.omd.etm.EnumType;
import com.vci.dto.OsEnumDTO;
import com.vci.starter.web.exception.VciBaseException;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
import com.vci.pagemodel.KeyValue;
import com.vci.pagemodel.OsEnumItemVO;
import com.vci.pagemodel.OsEnumVO;
+import java.io.File;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@@ -69,11 +72,11 @@
/**
* 鏌ョ湅鏋氫妇鐨勪娇鐢ㄨ寖鍥�
- * @param enumName
+ * @param enumName 鏋氫妇鍚嶇О
* @return
* @throws PLException
*/
- List<OsEnumVO> getUsedEnumList(String enumName) throws PLException;
+ List<Map<String,String>> getUsedEnumList(String enumName) throws PLException;
/**
* 鏍规嵁鏋氫妇鑻辨枃鍚嶇О鑾峰彇鏋氫妇绫诲瀷
@@ -102,6 +105,29 @@
* @return
*/
boolean deleteEnumTypes(List<OsEnumDTO> osEnumDTOS) throws PLException;
+
+ /**
+ * 瀵煎嚭鏋氫妇绫诲瀷
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param enumNames 闇�瑕佸鍑虹殑鏋氫妇鍚嶇О
+ * @return
+ */
+ String exportEnumTypes(String exportFileName,String enumNames) throws PLException;
+
+ /**
+ * 瀵煎叆鏋氫妇
+ * @param file
+ * @return
+ * @throws Exception
+ */
+ BaseResult importEnumTypes(File file) throws Exception;
+
+ /**
+ * 涓嬭浇瀵煎叆妯℃澘
+ * @param exportFileName
+ * @return
+ */
+ String downloadEnumTemplate(String exportFileName);
/**
* 鏌ヨ鎵�鏈夌殑鏋氫妇鏄犲皠
@@ -178,4 +204,12 @@
* @return 鏋氫妇閫夐」
*/
DataGrid<OsEnumItemVO> gridEnumItemByOid(String pkEnum);
+
+ /**
+ * 鏍规嵁鏋氫妇绫诲瀷鏌ヨ鏋氫妇锛氭灇涓惧悕 , 鏋氫妇
+ * @param enumType锛歋tring, Integer
+ * @return
+ */
+ List<Map<String,List<String>>> getEnumMapByType(String enumType);
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
index 3c8d7ca..fd64b1b 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsLinkTypeServiceI.java
@@ -1,7 +1,9 @@
package com.vci.web.service;
+import com.vci.corba.common.PLException;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.starter.web.pagemodel.BaseQueryObject;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.pagemodel.OsBtmTypeAttributeVO;
import com.vci.pagemodel.OsLinkTypeAttributeVO;
@@ -17,6 +19,28 @@
* @date 2021-2-15
*/
public interface OsLinkTypeServiceI extends OsBaseServiceI{
+
+ /**
+ * 淇敼涓氬姟绫诲瀷涓搴斿睘鎬у悕鐨勫睘鎬�
+ * @param apName
+ * @return
+ * @throws PLException
+ */
+ boolean alterAp(String apName) throws PLException;
+
+ /**
+ * 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪閾炬帴绫诲瀷涓骇鐢熶簡鏁版嵁
+ * @param abName
+ * @return
+ * @throws PLException
+ */
+ boolean hasInstance(String abName) throws PLException;
+
+ /**
+ * 鑾峰彇杩炴帴绫诲瀷鍚嶇О闆嗗悎
+ * @return
+ */
+ List<String> getAllLtName() throws PLException;
/**
* 鏌ヨ鎵�鏈夌殑閾炬帴绫诲瀷
@@ -85,4 +109,17 @@
* @return 鏈夐敊璇殑灞炴��
*/
List<OsBtmTypeAttributeVO> checkAttributeTypeDifferent(String linkTypeOid);
+ /**
+ * 閾炬帴绫诲瀷鐨勫垪琛�
+ *
+ * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
+ */
+ BaseResult<List<LinkType>> gridLink() throws PLException;
+ /**
+ * 閾炬帴绫诲瀷淇濆瓨
+ * linkType 閾炬帴绫诲瀷鐨勪繚瀛樺璞�
+ * addFlag 鏄惁涓烘柊澧� true鏂板锛宖alse淇敼
+ * @return 淇濆瓨缁撴灉
+ */
+ BaseResult addAndEditLink(LinkType linkType, Boolean addFlag) throws PLException;
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
index 6f33a37..2d0e461 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsAttributeServiceImpl.java
@@ -1,27 +1,57 @@
package com.vci.web.service.impl;
+import com.vci.client.common.datatype.VTDouble;
+import com.vci.client.common.datatype.VTInteger;
+import com.vci.client.common.datatype.VTLong;
+import com.vci.client.common.datatype.VTString;
+import com.vci.client.mw.ClientSessionUtility;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.atm.AttributeDef;
+import com.vci.dto.OsAttributeDTO;
+import com.vci.dto.OsEnumDTO;
+import com.vci.dto.OsEnumItemDTO;
+import com.vci.omd.dataType.VTDataType;
+import com.vci.pagemodel.OsEnumItemVO;
+import com.vci.pagemodel.OsEnumVO;
+import com.vci.pagemodel.OsUsedAttributeVO;
+import com.vci.po.OsAttributePO;
+import com.vci.po.OsEnumPO;
+import com.vci.starter.poi.bo.ReadExcelOption;
+import com.vci.starter.poi.bo.WriteExcelData;
+import com.vci.starter.poi.bo.WriteExcelOption;
+import com.vci.starter.poi.constant.ExcelLangCodeConstant;
+import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.VciFieldTypeEnum;
+import com.vci.starter.web.exception.VciBaseException;
import com.vci.starter.web.pagemodel.BaseQueryObject;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
-import com.vci.starter.web.util.VciBaseUtil;
-import com.vci.starter.web.util.VciDateUtil;
+import com.vci.starter.web.util.*;
import com.vci.model.OsAttributeDO;
import com.vci.pagemodel.OsAttributeVO;
+import com.vci.web.properties.UsedNames;
import com.vci.web.service.OsAttributeServiceI;
+import com.vci.web.service.OsBaseServiceI;
+import com.vci.web.service.OsLinkTypeServiceI;
+import com.vci.web.util.Func;
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.util.HSSFColor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
+import javax.swing.*;
+import java.awt.*;
+import java.io.File;
import java.util.*;
+import java.util.List;
import java.util.stream.Collectors;
//import static com.vci.client.omd.attribpool.ui.VTDataTypePanel.*;
@@ -52,6 +82,40 @@
@Autowired(required = false)
@Lazy
private OsAttributeServiceI self;
+
+ /**
+ * 灞炴�у悕绉版渶澶ч暱搴�
+ */
+ private Integer NAME_MAX_LENGTH = 28;
+
+ /**
+ * 绯荤粺涓彉閲忛厤缃枃浠朵腑閰嶇疆鐨刱ey
+ */
+ private final String SYSUSEDNAMES = "sysUsedNames";
+
+ /**
+ * 鏁版嵁搴撲腑鍏抽敭瀛楅厤缃枃浠朵腑閰嶇疆鐨刱ey
+ */
+ private final String DATABASEUSEDNAMES = "dataBaseUsedNames";
+
+ /**
+ * 閾炬帴绫诲瀷鏈嶅姟
+ */
+ @Autowired(required = false)
+ @Lazy
+ private OsLinkTypeServiceI osLinkTypeServiceI;
+
+ /**
+ * 涓氬姟绫诲瀷鏈嶅姟
+ */
+ @Autowired(required = false)
+ @Lazy
+ private OsBtmServiceImpl osBtmService;
+
+ /**
+ * 蹇呭~鍒�
+ */
+ private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
/**
* 榛樿鐨勫睘鎬�
@@ -126,6 +190,26 @@
}
/**
+ * 鏍规嵁澶氫釜灞炴�у悕绉版煡璇㈠睘鎬�
+ * @param attrNames
+ * @return
+ */
+ @Override
+ public List<OsAttributeVO> getByAttributeNames(String[] attrNames) throws PLException {
+ VciBaseUtil.alertNotNull(attrNames,"灞炴�у悕");
+ List<OsAttributeVO> osAttributeVOS = new ArrayList<>();
+ for (int i = 0; i < attrNames.length; i++) {
+ AttributeDef[] attributeDefs = platformClientUtil.getAttributeService().getAttributeDefs(attrNames[i].toLowerCase(Locale.ROOT),1,1);
+ if(Func.isNotEmpty(attributeDefs)){
+ Arrays.stream(attributeDefs).forEach(attributeDef -> {
+ osAttributeVOS.add(attributeDO2VO(attributeDef));
+ });
+ }
+ }
+ return osAttributeVOS;
+ }
+
+ /**
* 灞炴�х殑鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞�
*
* @param attribItems 鏁版嵁瀵硅薄
@@ -154,8 +238,8 @@
attributeVO.setId(attribItem.name);
attributeVO.setCreator(attribItem.creator);
try {
- attributeVO.setCreateTime(VciDateUtil.str2Date(String.valueOf(attribItem.createTime),VciDateUtil.DateTimeFormat));
- attributeVO.setLastModifyTime(VciDateUtil.str2Date(String.valueOf(attribItem.modifyTime),VciDateUtil.DateTimeFormat));
+ attributeVO.setCreateTime(new Date(attribItem.createTime));
+ attributeVO.setLastModifyTime(new Date(attribItem.modifyTime));
attributeVO.setTs(VciDateUtil.str2Date(attribItem.ts,VciDateUtil.DateTimeMillFormat));
}catch (Throwable e){
@@ -166,7 +250,13 @@
attributeVO.setAttributeDataType(attribItem.vtDataType);
attributeVO.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(attribItem.vtDataType));
attributeVO.setDefaultValue(attribItem.defValue);
- attributeVO.setRange(attribItem.rage);
+ if(Func.isNotBlank(attribItem.rage)){
+ attributeVO.setRange(attribItem.rage.replace("<","<"));
+ }else{
+ attributeVO.setRange(attribItem.rage);
+ }
+ attributeVO.setOther(attribItem.other);
+ //澶勭悊鍙傜収鐩稿叧灞炴��
if(StringUtils.isNotBlank(attribItem.other)) {
if (isReferAttr(attribItem.other)) {
//璇存槑杩欎釜鐨勭‘鏄弬鐓у瓧娈�
@@ -176,6 +266,12 @@
attributeVO.setBtmTypeId(s.split("=")[1].trim());
}
//閾炬帴绫诲瀷涓嶆敮鎸�
+ if (s.toLowerCase().contains("link") && s.split("=").length > 1) {//蹇呴』瑕佸垽鏂暱搴︼紝鍥犱负鏋氫妇鐨勬椂鍊欎篃鏄寘鍚繖涓猙tm鐨�
+ attributeVO.setLinkTypeName(s.split("=")[1].trim());
+ }
+ if (s.toLowerCase().contains("version") && s.split("=").length > 1) {//蹇呴』瑕佸垽鏂暱搴︼紝鍥犱负鏋氫妇鐨勬椂鍊欎篃鏄寘鍚繖涓猙tm鐨�
+ attributeVO.setVersion(WebUtil.getInt(s.split("=")[1].trim()));
+ }
}
}
//蹇呰緭鍜岄暱搴�
@@ -364,6 +460,605 @@
}
/**
+ * 娣诲姞鍗曟潯灞炴��
+ * @param osAttributeDTO
+ * @return true鎴愬姛锛宖alse澶辫触
+ */
+ @Override
+ public boolean addAttribute(OsAttributeDTO osAttributeDTO) throws PLException {
+ //鍒ょ┖
+ VciBaseUtil.alertNotNull(
+ osAttributeDTO,"鍒涘缓鐨勫睘鎬у璞�",
+ osAttributeDTO.getId(),"灞炴�у悕绉�",
+ osAttributeDTO.getAttributeDataType(),"灞炴�х被鍨�"
+ );
+ //灞炴�ц嫳鏂囧悕绉版牎楠岋紙鍒ょ┖銆佺郴缁熶腑鍒ら噸銆佹槸鍚﹀叧閿瓧銆佹槸鍚﹀悎瑙勭瓑锛�
+ checkName(osAttributeDTO.getId());
+ //妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
+ checkDefValue(osAttributeDTO);
+ //dto瀵硅薄杞崲涓哄瓨鍌ㄦ墍闇�瀵硅薄
+ osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
+ AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO);
+ return platformClientUtil.getAttributeService().addAttributeDef(attributeDef);
+ }
+
+ /**
+ * 淇敼鍗曟潯灞炴��
+ * @param osAttributeDTO
+ * @return true鎴愬姛锛宖alse澶辫触
+ */
+ @Override
+ public boolean updateAttribute(OsAttributeDTO osAttributeDTO) throws PLException {
+ //鍒ょ┖
+ VciBaseUtil.alertNotNull(
+ osAttributeDTO,"淇敼鐨勫睘鎬у璞�",
+ osAttributeDTO.getId(),"灞炴�у悕绉�",
+ osAttributeDTO.getTs(),"浜嬪姟TS",
+ osAttributeDTO.getAttributeDataType(),"灞炴�х被鍨�"
+ );
+
+ //鍚嶇О涓嶅厑璁镐慨鏀规墍浠ヤ笉鐢ㄦ煡閲�
+ //浣嗘槸闇�瑕佹鏌ュ睘鎬ф槸鍚﹀瓨鍦�
+ OsAttributeVO osAttributeVO = getByAttributeNames(new String[]{osAttributeDTO.getId()}).get(0);
+ if(Func.isEmpty(osAttributeVO) || Func.isBlank(osAttributeVO.getOid())){
+ throw new PLException("500",new String[]{"灞炴�у湪绯荤粺涓笉瀛樺湪锛岃鍒锋柊鍚庨噸璇曪紒"});
+ }
+ //妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
+ checkDefValue(osAttributeDTO);
+ boolean compatible = isCompatible(osAttributeVO,osAttributeDTO);
+ boolean hasInstance = hasInstance(osAttributeDTO.getName());
+ //浜х敓鏁版嵁, 骞朵笖涓嶅吋瀹�
+ if(hasInstance && !compatible){
+ throw new PLException("500",new String[]{"鏃犳晥鍙樻洿, 涓嶅吋瀹瑰凡浜х敓鐨勬暟鎹紒"});
+ }
+ String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
+ osAttributeDTO.setLastModifier(userId);
+ osAttributeDTO.setCreator(osAttributeVO.getCreator());
+ osAttributeDTO.setCreateTime(osAttributeVO.getCreateTime());
+ osAttributeDTO.setLastModifyTime(new Date());
+
+ try {
+ AttributeDef attributeDef = this.osAttributeDTO2AttributeDef(osAttributeDTO);
+ boolean mdSuccess = platformClientUtil.getAttributeService().modifyAttributeDef(attributeDef);
+ if(!mdSuccess){
+ return false;
+ }
+
+ //灞炴�т慨鏀规垚鍔�,淇敼涓氬姟绫诲瀷, 閾炬帴绫诲瀷涓灞炴�у瓧娈�
+ boolean alterApBoolean = this.alterAp(attributeDef.name);
+ if(!alterApBoolean){
+ logger.error("灞炴�т慨鏀瑰畬鎴愶紝浣嗗湪璋冩暣涓氬姟绫诲瀷鎴栭摼鎺ョ被鍨嬩腑瀵瑰簲灞炴�у悕鐨勫睘鎬ф椂鍑虹幇閿欒锛�");
+ throw new PLException("500",new String[]{"灞炴�т慨鏀瑰畬鎴愶紝浣嗗湪璋冩暣涓氬姟绫诲瀷鎴栭摼鎺ョ被鍨嬩腑瀵瑰簲灞炴�у悕鐨勫睘鎬ф椂鍑虹幇閿欒锛�"});
+ }
+ return true;
+ } catch (PLException e1) {
+ e1.printStackTrace();
+ }
+ return false;
+ }
+
+ /**
+ * DTO瀵硅薄杞疄闄呭瓨鍌ㄦ墍闇�鐨凙ttributeDef瀵硅薄
+ * @param osAttributeDTO
+ * @return
+ */
+ private AttributeDef osAttributeDTO2AttributeDef(OsAttributeDTO osAttributeDTO) {
+ AttributeDef attributeDef = new AttributeDef();
+ attributeDef.oid = osAttributeDTO.getOid();
+ attributeDef.name = osAttributeDTO.getId().toLowerCase().replaceAll(" ", "");
+ attributeDef.label = osAttributeDTO.getName();
+ attributeDef.description = osAttributeDTO.getDescription();
+ attributeDef.vtDataType = (String)osAttributeDTO.getAttributeDataType();
+ attributeDef.defValue = Func.isBlank(osAttributeDTO.getDefaultValue()) ? "" : osAttributeDTO.getDefaultValue();
+ if(Func.isBlank(osAttributeDTO.getRange())){
+ attributeDef.rage = "";
+ }else{
+ //鐗规畩瀛楃澶勭悊锛岀洿鎺ュ瓨鍌�<浼氭姤閿�
+ attributeDef.rage = osAttributeDTO.getRange().replace("<","<");
+ }
+ attributeDef.ts = Func.format((Func.isNotEmpty(osAttributeDTO.getTs()) ? osAttributeDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat);
+ attributeDef.creator = "developer";//Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator();
+ attributeDef.createTime = Func.isEmpty(osAttributeDTO.getCreateTime()) ? System.currentTimeMillis():osAttributeDTO.getCreateTime().getTime();
+ attributeDef.modifier = "developer";//Func.isBlank(osAttributeDTO.getLastModifier()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getLastModifier();
+ attributeDef.modifyTime = System.currentTimeMillis();
+ //other闇�瑕佽嚜琛屽鐞�
+ StringBuffer sb = new StringBuffer();
+ sb.append(ALLOWNULL).append(" = ").append(osAttributeDTO.isNullableFlag() ? "yes" : "no").append(";");
+ VciFieldTypeEnum fieldTypeEnum = VciFieldTypeEnum.valueOf(osAttributeDTO.getAttributeDataType());
+ String[] otherInfos = attributeDef.other.split(";");
+ int length = 0;
+ if(otherInfos!=null&& otherInfos.length > 0){
+ for(String s : otherInfos){
+ if(s.contains(LENGTH+" =") || s.contains(LENGTH+"=")){
+ length = VciBaseUtil.getInt(s.split("=")[1]);
+ break;
+ }
+ }
+ }
+ switch (fieldTypeEnum) {
+ case VTDouble:
+ if(osAttributeDTO.getAttrLength() == null){
+ osAttributeDTO.setAttrLength(20);
+ }
+ if(osAttributeDTO.getPrecisionLength() == null){
+ osAttributeDTO.setPrecisionLength(2);
+ }
+ sb.append(ACCURACY).append(" = ").append(osAttributeDTO.getPrecisionLength()).append(";");
+ sb.append(LENGTH).append(" = ").append(length > osAttributeDTO.getAttrLength()?length:osAttributeDTO.getAttrLength()).append(";");
+
+ break;
+ case VTInteger:
+ if (StringUtils.isNotBlank(osAttributeDTO.getEnumId())) {
+ sb.append(ENUMNAME).append(" = ").append(osAttributeDTO.getEnumId()).append(";");
+ }
+ break;
+ case VTString:
+ if (StringUtils.isNotBlank(osAttributeDTO.getBtmTypeId())) {
+ //鍙傜収涓氬姟绫诲瀷
+ sb.append(BTM).append(" = ").append(osAttributeDTO.getBtmTypeId()).append(";");
+ }
+ if(StringUtils.isNotBlank(osAttributeDTO.getLinkTypeName())){
+ //鍙傜収閾炬帴绫诲瀷
+ sb.append(LINKTYPENAME).append(" = ").append(osAttributeDTO.getLinkTypeName()).append(";");
+ }
+ sb.append(LENGTH).append(" = ").append(length > osAttributeDTO.getAttrLength()?length:osAttributeDTO.getAttrLength()).append(";");
+ if (StringUtils.isNotBlank(osAttributeDTO.getEnumId())) {
+ sb.append(ENUMNAME).append(" = ").append(osAttributeDTO.getEnumId()).append(";");
+ }
+ break;
+ default:
+ //涓嶉渶瑕佸鐞�
+ break;
+ }
+ attributeDef.other = sb.toString();
+ if (attributeDef.other.endsWith(";")) {
+ attributeDef.other = attributeDef.other.substring(0, attributeDef.other.length() - 1);
+ }
+ return attributeDef;
+ }
+
+ /**
+ * 淇敼灞炴�ф椂, 鍒ゆ柇褰撳墠杈撳叆鐨勫睘鎬ф槸鍚﹁兘鍏煎涔嬪墠鐨勫睘鎬�
+ * @param osAttributeVO 鏁版嵁搴撲腑瀛樺偍鐨�
+ * @param osAttributeDTO 淇敼鍚庣殑鍐呭
+ * @return
+ */
+ private boolean isCompatible(OsAttributeVO osAttributeVO/*鏁版嵁搴撲腑瀛樺偍鐨�*/,OsAttributeDTO osAttributeDTO/*淇敼鍚庣殑鍐呭*/){
+ String dataType = osAttributeVO.getAttributeDataType();
+ //String other = osAttributeVO.getOther();
+ //String newOther = abItem.other == null ? "" : abItem.other;
+ String newType = osAttributeDTO.getAttributeDataType();
+ if(newType.equals(VTDataType.VTSTRING)){
+ if(dataType.equals(VTDataType.VTINTEGER) || dataType.equals(VTDataType.VTLONG)){
+ return true;
+ }
+ if(dataType.equals(VTDataType.VTSTRING)){
+ int length = osAttributeVO.getAttrLength();//Integer.valueOf(getOtherValueByType(other, "length"));
+ int newLen = osAttributeDTO.getAttrLength();//Integer.valueOf(getOtherValueByType(newOther, "length"));
+ if(length <= newLen){
+ return true;
+ }else{
+ return false;
+ }
+ }
+ }
+
+ if(newType.equals(dataType)){
+ return true;
+ }
+
+ return false;
+ }
+
+ /**
+ * 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪涓氬姟绫诲瀷涓�, 鎴栬�呴摼鎺ョ被鍨嬩腑浜х敓浜嗘暟鎹�
+ * @param abName
+ * @return
+ */
+ private boolean hasInstance(String abName) throws PLException {
+ return osBtmService.hasInstance(abName) && osLinkTypeServiceI.hasInstance(abName);
+ }
+
+ /**
+ * 妫�鏌ュ睘鎬у悕绉版槸鍚︾鍚堣鑼�
+ * @param attributeName
+ * @return 娌℃湁杩斿洖鍊硷紝瀛樺湪闂鐩存帴鎶涘嚭閿欒
+ */
+ private void checkName(String attributeName) throws PLException {
+ if(attributeName.equals("")){
+ throw new PLException("500",new String[]{"娉ㄦ剰,灞炴�у悕涓嶈兘涓虹┖!"});
+ }
+
+ if(!attributeName.matches("[a-z A-Z]*")){
+ throw new PLException("500",new String[]{"娉ㄦ剰锛氬睘鎬у悕鍙兘涓鸿嫳鏂囧瓧姣�!"});
+ }
+
+ int length = attributeName.length();
+ if(length > NAME_MAX_LENGTH){
+ throw new PLException("500",new String[]{"灞炴�у悕杩囬暱,灞炴�у悕闀垮害涓嶈兘瓒呰繃"+ NAME_MAX_LENGTH});
+ }
+
+ String abName = attributeName.toLowerCase();
+ //妫�鏌ュ睘鎬у悕鏄惁鏄负绯荤粺鍩虹灞炴�э紝濡俢reateTime,ts,oid绛�
+ if(usedBySystem(abName)){
+ throw new PLException("500",new String[]{"灞炴�у悕鏃犳晥,鍘熷洜锛氬睘鎬у悕宸茶绯荤粺灞炴�т娇鐢�!"});
+ }
+ //妫�鏌ュ睘鎬у悕鏄惁鏄叧閿瓧
+ if(usedByDataBase(abName)){
+ throw new PLException("500",new String[]{"灞炴�у悕鏃犳晥,鍘熷洜锛氬睘鎬у悕鏄暟鎹簱鍏抽敭瀛�!"});
+ }
+ //妫�鏌ュ睘鎬у悕鏄惁宸插瓨鍦ㄤ笌绯荤粺涓�
+ if(platformClientUtil.getAttributeService().checkRowIsExists(abName)){
+ throw new PLException("500",new String[]{"灞炴�у悕绉板湪绯荤粺涓凡瀛樺湪!"});
+ }
+ }
+
+ /**
+ * 妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
+ * @param osAttributeDTO
+ * @return
+ */
+ private void checkDefValue(OsAttributeDTO osAttributeDTO) throws PLException {
+ String defValue = osAttributeDTO.getDefaultValue();
+ String vtType = osAttributeDTO.getAttributeDataType();
+ String rages = osAttributeDTO.getRange();
+ if(defValue != null && !defValue.equals("")){
+ if(vtType.equals(VTDataType.VTSTRING)){
+ try{
+ String.valueOf(defValue);
+ }catch(Exception e){
+ throw new PLException("500",new String[]{"璇疯緭鍏tring绫诲瀷鐨勯粯璁ゅ�硷紒"});
+ }
+ if(rages == null || rages.equals("")){
+ return;
+ }
+ VTString obj = new VTString(String.valueOf(defValue));
+ boolean flag = obj.checkRageValueByRage(rages);
+ if(!flag){
+ throw new PLException("500",new String[]{"榛樿鍊间笌鍊煎煙鍐茬獊锛�"});
+ }
+ }else if(vtType.equals(VTDataType.VTINTEGER)){
+ try{
+ Integer.valueOf(defValue);
+ }catch(Exception e){
+ throw new PLException("500",new String[]{"璇疯緭鍏nteger绫诲瀷鐨勯粯璁ゅ�硷紒"});
+ }
+ if(rages == null || rages.equals("")){
+ return;
+ }
+ VTInteger obj = new VTInteger(Integer.valueOf(defValue));
+ boolean flag = obj.checkRageValueByRage(rages);
+ if(!flag){
+ throw new PLException("500",new String[]{"榛樿鍊间笌鍊煎煙鍐茬獊锛�"});
+ }
+ }else if(vtType.equals(VTDataType.VTLONG)){
+ try{
+ Long.valueOf(defValue);
+ }catch(Exception e){
+ throw new PLException("500",new String[]{"璇疯緭鍏ong绫诲瀷鐨勯粯璁ゅ�硷紒"});
+ }
+ if(rages == null || rages.equals("")){
+ return;
+ }
+ VTLong obj = new VTLong(Long.valueOf(defValue));
+ boolean flag = obj.checkRageValueByRage(rages);
+ if(!flag){
+ throw new PLException("500",new String[]{"榛樿鍊间笌鍊煎煙鍐茬獊锛�"});
+ }
+ }else if(vtType.equals(VTDataType.VTDOUBLE)){
+ try{
+ Double.valueOf(defValue);
+ }catch(Exception e){
+ throw new PLException("500",new String[]{"璇疯緭鍏ouble绫诲瀷鐨勯粯璁ゅ�硷紒"});
+ }
+ if(rages == null || rages.equals("")){
+ return;
+ }
+ VTDouble obj = new VTDouble(Double.valueOf(defValue));
+ boolean flag = obj.checkRageValueByRage(rages);
+ if(!flag){
+ throw new PLException("500",new String[]{"榛樿鍊间笌鍊煎煙鍐茬獊锛�"});
+ }
+ }
+ }
+ }
+
+ /**
+ * 妫�鏌ヨ灞炴�у悕鏄惁琚郴缁熷睘鎬т娇鐢�
+ * @param abName
+ * @return
+ */
+ private boolean usedBySystem(String abName) {
+ boolean flag = false;
+ String[] names = UsedNames.getProperty(SYSUSEDNAMES).toUpperCase().split(",");
+ List<String> nameList = Arrays.asList(names);
+ if(nameList.contains(abName.toUpperCase())){
+ flag = true;
+ }
+ return flag;
+ }
+
+ /**
+ * 妫�鏌ヨ灞炴�у悕鏄惁灞炰簬鏁版嵁搴撳叧閿瓧
+ * @param abName
+ * @return
+ */
+ private boolean usedByDataBase(String abName){
+ boolean flag = false;
+ String[] names = UsedNames.getProperty(DATABASEUSEDNAMES).toUpperCase().split(",");
+ List<String> nameList = Arrays.asList(names);
+ if(nameList.contains(abName.toUpperCase())){
+ flag = true;
+ }
+ return flag;
+ }
+
+ /**
+ * 鍒犻櫎灞炴��
+ * @param osAttributeDTOS
+ * @return true鎴愬姛锛宖alse澶辫触
+ */
+ @Override
+ public boolean deleteAttributes(List<OsAttributeDTO> osAttributeDTOS) throws PLException {
+ VciBaseUtil.alertNotNull(osAttributeDTOS,"寰呭垹闄ょ殑灞炴�у垪琛�");
+ //骞冲彴鐨刣eleteEnumTypes鏂规硶蹇呬紶涓変釜鍙傛暟锛宱id銆乶ame鍜宼s
+ List<AttributeDef> attributeDefs = new ArrayList<>();
+ for(OsAttributeDTO osAttributeDTO : osAttributeDTOS){
+ //oid鍜宼s鍒ょ┖
+ String oid = osAttributeDTO.getOid();
+ //name涓昏鐢ㄦ潵瀵圭紦瀛樻暟鎹垹闄�
+ String name = osAttributeDTO.getName();
+ Date ts = osAttributeDTO.getTs();
+ if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
+ throw new PLException("500",new String[]{"寰呭垹闄ょ殑灞炴�у垪琛ㄤ腑涓婚敭銆恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佸睘鎬у悕銆恘ame銆戜笉鑳戒负绌猴紒"});
+ }
+ //鍒ゆ柇鏋氫妇鏄惁鏈夎寮曠敤
+ List<Map<String, String>> usedAttrList = this.getUsedAttributeList(name);
+ if(Func.isNotEmpty(usedAttrList)){
+ throw new PLException("500",new String[]{"鍒犻櫎鐨勫睘鎬т腑锛屽睘鎬у悕绉颁负锛氥��" + name + "銆�,宸茶寮曠敤锛�"});
+ }
+ AttributeDef attributeDef = new AttributeDef();
+ attributeDef.oid = oid;
+ attributeDef.name = name;
+ attributeDef.ts = Func.format(ts,VciDateUtil.DateTimeMillFormat);
+ attributeDefs.add(attributeDef);
+ }
+ if(Func.isEmpty(attributeDefs)){
+ return false;
+ }
+ return platformClientUtil.getAttributeService().deleteAttributeDefs(attributeDefs.toArray(new AttributeDef[attributeDefs.size()]));
+ }
+
+ /**
+ * 鏌ョ湅灞炴�х殑浣跨敤鑼冨洿
+ * @param attributeName
+ * @return key:灞炴�� 锛寁alue浣跨敤璇ュ睘鎬х殑涓氬姟绫诲瀷
+ */
+ @Override
+ public List<Map<String, String>> getUsedAttributeList(String attributeName) throws PLException {
+ if(Func.isBlank(attributeName)){
+ throw new PLException("500",new String[]{"璇烽�夋嫨瑕佹煡璇㈠簲鐢ㄨ寖鍥寸殑灞炴��!"});
+ }
+ String[] btNames = platformClientUtil.getBtmService().getBTNamesByAPName(attributeName);
+ if(Func.isEmpty(btNames)){
+ return new ArrayList<>();
+ }
+ List<Map<String,String>> btmNameMapList = new ArrayList<>();
+ Arrays.stream(btNames).forEach(btName->{
+ Map<String, String> itemMap = new HashMap<>();
+ itemMap.put("attributeName",attributeName);
+ itemMap.put("source",btName);
+ btmNameMapList.add(itemMap);
+ });
+ return btmNameMapList;
+ }
+
+ /**
+ * 瀵煎嚭閫変腑鐨勫睘鎬�
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param attrNames 闇�瑕佸鍑虹殑灞炴�у悕绉�
+ * @return
+ */
+ @Override
+ public String exportAttributes(String exportFileName, String attrNames) throws PLException {
+ if(Func.isBlank(attrNames)){
+ throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勫睘鎬�!"});
+ }
+ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+ exportFileName = Func.isBlank(exportFileName) ? "灞炴�ф睜涓睘鎬у鍑篲" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+ //璁剧疆鍒楀悕
+ List<String> columns = new ArrayList<>(
+ Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪",
+ "灞炴�х被鍨�", "鍏佽涓虹┖", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�(鏋氫妇鍚�)",
+ "浣跨敤鐨勬灇涓句腑鏂囧悕绉�(鏍囩)", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�", "鍙傜収鐨勪笟鍔$被鍨嬪悕绉�",
+ "鍙傜収鐨勯摼鎺ョ被鍨嬪悕绉�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�","鍒涘缓鏃堕棿")
+ );
+
+ //鍐檈xcel
+ String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
+ try {
+ new File(excelPath).createNewFile();
+ } catch (Throwable e) {
+ throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+ }
+ //璁剧疆鍒�
+ List<WriteExcelData> excelDataList = new ArrayList<>();
+ //璁剧疆鍒楀ご
+ for (int index = 0; index < columns.size(); index++) {
+ excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+ }
+ //鎸夌収灞炴�у悕鏌ヨ灞炴�э紝鐒跺悗澶勭悊灞炴�у鍑�
+ List<String> enumNameList = Func.toStrList(attrNames);
+ List<OsAttributeVO> osAttributeVOS = this.listAttrByIds(enumNameList);
+ if(Func.isEmpty(osAttributeVOS)){
+ excelDataList.add(new WriteExcelData(1,1, "鏍规嵁灞炴�у悕绉版湭鏌ヨ鍒板睘鎬т俊鎭紝璇峰埛鏂板悗灏濊瘯閲嶆柊瀵煎嚭锛�"));
+ }else{
+ //鍏堟寜鐓у睘鎬х被鍨嬫帓搴忥紝涓嶅悓灞炴�х被鍨嬪鍑虹殑鏁版嵁涔辩殑鏁堟灉
+ osAttributeVOS.sort(Comparator.comparing(OsAttributeVO::getAttributeDataType));
+ for (int i = 0; i < osAttributeVOS.size(); i++) {
+ OsAttributeVO osAttributeVO = osAttributeVOS.get(i);
+ excelDataList.add(new WriteExcelData(i+1,0, osAttributeVO.getId()));
+ excelDataList.add(new WriteExcelData(i+1,1, osAttributeVO.getName()));
+ excelDataList.add(new WriteExcelData(i+1,2, osAttributeVO.getDescription()));
+ excelDataList.add(new WriteExcelData(i+1,3, osAttributeVO.getAttributeDataTypeText()+"("+osAttributeVO.getAttributeDataType()+")"));
+ excelDataList.add(new WriteExcelData(i+1,4, osAttributeVO.isNullableFlag()));
+ excelDataList.add(new WriteExcelData(i+1,5, osAttributeVO.getDefaultValue()));
+ excelDataList.add(new WriteExcelData(i+1,6, osAttributeVO.getEnumId()));
+ excelDataList.add(new WriteExcelData(i+1,7, osAttributeVO.getEnumName()));
+ excelDataList.add(new WriteExcelData(i+1,8, osAttributeVO.getBtmTypeId()));
+ excelDataList.add(new WriteExcelData(i+1,9, osAttributeVO.getBtmTypeName()));
+ excelDataList.add(new WriteExcelData(i+1,10, osAttributeVO.getAttrLength()));
+ excelDataList.add(new WriteExcelData(i+1,11, osAttributeVO.getLinkTypeName()));
+ excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getVersion()));
+ excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getPrecisionLength()));
+ excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getScaleLength()));
+ excelDataList.add(new WriteExcelData(i+1,15, osAttributeVO.getRange()));
+ excelDataList.add(new WriteExcelData(i+1,16, osAttributeVO.getCreateTime()));
+ }
+ }
+ WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+ ExcelUtil.writeDataToFile(excelPath, excelOption);
+ return excelPath;
+ }
+
+ /**
+ * 涓嬭浇灞炴�у鍏ユā鏉�
+ * @param exportFileName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public String downloadAttributeTemplate(String exportFileName) throws Exception {
+ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+ exportFileName = Func.isBlank(exportFileName) ? "灞炴�ф睜瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+ //璁剧疆鍒楀悕
+ List<String> columns = new ArrayList<>(
+ Arrays.asList("灞炴�у悕", "鏍囩", "鎻忚堪",
+ "灞炴�х被鍨�", "鍏佽涓虹┖(鏄�/鍚�)", "榛樿鍊�", "浣跨敤鐨勬灇涓捐嫳鏂囧悕绉�", "鍙傜収鐨勪笟鍔$被鍨嬬紪鍙�",
+ "鍙傜収鐨勯摼鎺ョ被鍨嬬紪鍙�","鐗堟湰鐗堟","灞炴�ч暱搴�", "灏忔暟绮惧害浣嶆暟","灏忔暟鍒诲害浣嶆暟","鍙栧�艰寖鍥�")
+ );
+ //璁剧疆蹇呭~鍒�
+ ColumnNameisRed.clear();
+ ColumnNameisRed.add(0);
+ ColumnNameisRed.add(3);
+ ColumnNameisRed.add(10);
+
+ //鍐檈xcel
+ String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
+ try {
+ new File(excelPath).createNewFile();
+ } catch (Throwable e) {
+ throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+ }
+ //璁剧疆鍒�
+ List<WriteExcelData> excelDataList = new ArrayList<>();
+ //璁剧疆鍒楀ご
+ for (int index = 0; index < columns.size(); index++) {
+ //鍒ゆ柇鏄惁涓哄繀濉垪锛岀粰蹇呭~鍒楄缃鑹�
+ if(ColumnNameisRed.contains(index)){
+ WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index));
+ excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex()));
+ excelDataList.add(excelData);
+ }else{
+ excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+ }
+ }
+ WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+ ExcelUtil.writeDataToFile(excelPath, excelOption);
+ return excelPath;
+ }
+
+ /**
+ * 瀵煎叆灞炴��
+ * @param file
+ * @return
+ */
+ @Override
+ public BaseResult importAttributes(File file) throws Exception{
+ VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
+ if(!file.exists()){
+ throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
+ }
+ try{
+ //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞�
+ ReadExcelOption excelOption = new ReadExcelOption();
+ List<OsAttributePO> poList = ExcelUtil.readDataObjectFromExcel(file, OsAttributePO.class,excelOption,(value, po, fieldName)->{});
+ //鍘婚櫎閮芥槸绌虹殑鎯呭喌
+ if(CollectionUtils.isEmpty(poList)){
+ return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
+ }
+ //excel鍒ら噸锛屾暟鎹牎楠岋紝dto瀵硅薄杞崲锛屽瓨鍌ㄥ璞¤浆鎹紝鎵ц淇濆瓨
+ List<OsAttributeDTO> dtoList = new ArrayList<>();
+ //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
+ Map<String, String> excelReapeat = new HashMap<>();
+ //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫
+ poList.stream().forEach(osAttributePO -> {
+ if(Func.isBlank(osAttributePO.getId())){//灞炴�у悕鍒ょ┖
+ throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宔numnameerror");
+ }else if(Func.isBlank(osAttributePO.getAttributeDataType())){
+ throw new VciBaseException("绗��"+osAttributePO.getRowIndex()+"銆戣锛宼ypeerror");
+ }else if(excelReapeat.containsKey(osAttributePO.getId())){//灞炴�у悕琛ㄦ牸涓垽閲�
+ throw new VciBaseException("绗��"+excelReapeat.get(osAttributePO.getId())+"銆戣鍜岀銆�"+osAttributePO.getRowIndex()+"銆戣鏁版嵁锛屽睘鎬у悕閲嶅");
+ }
+ //灞炴�у悕鏍¢獙
+ try {
+ checkName(osAttributePO.getId());
+ } catch (PLException e) {
+ e.printStackTrace();
+ throw new VciBaseException(VciBaseUtil.getExceptionMessage(e));
+ }
+ //灞炴�у悕excel涓垽閲嶅鐞�
+ excelReapeat.put(osAttributePO.getId(),osAttributePO.getRowIndex());
+ OsAttributeDTO osAttributeDTO = new OsAttributeDTO();
+ osAttributeDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
+ osAttributeDTO.setId(osAttributePO.getId());
+ osAttributeDTO.setName(osAttributePO.getName());
+ osAttributeDTO.setDescription(osAttributePO.getDescription());
+ osAttributeDTO.setDefaultValue(osAttributePO.getDefaultValue());
+ osAttributeDTO.setAttrLength(osAttributePO.getAttrLength());
+ osAttributeDTO.setAttributeDataType(osAttributePO.getAttributeDataType());
+ osAttributeDTO.setBtmTypeId(osAttributePO.getBtmTypeId());
+ //osAttributeDTO.setBtmTypeName(osAttributePO.getBtmname());
+ osAttributeDTO.setLinkTypeName(osAttributePO.getLinkTypeName());
+ osAttributeDTO.setVersion(osAttributePO.getVersion());
+ osAttributeDTO.setEnumId(osAttributePO.getEnumId());
+ //osAttributeDTO.setEnumName(osAttributePO.getEnumId());
+ osAttributeDTO.setPrecisionLength(osAttributePO.getPrecisionLength());
+ osAttributeDTO.setScaleLength(osAttributePO.getScaleLength());
+ osAttributeDTO.setRange(osAttributePO.getRange());
+ osAttributeDTO.setNullableFlag("鏄�".equals(osAttributePO.getNullableFlag()) ? true:false);
+ try {
+ //妫�鏌ラ粯璁ゅ�间笌灞炴�х被鍨嬫槸鍚﹀尮閰�
+ checkDefValue(osAttributeDTO);
+ } catch (PLException e) {
+ e.printStackTrace();
+ throw new VciBaseException(e.getMessage());
+ }
+ dtoList.add(osAttributeDTO);
+ });
+ //鎵ц淇濆瓨鎿嶄綔
+ dtoList.stream().forEach(dto->{
+ try {
+ boolean b = platformClientUtil.getAttributeService().addAttributeDef(osAttributeDTO2AttributeDef(dto));
+ if(!b){
+ throw new VciBaseException("save and return false");
+ }
+ } catch (PLException e) {
+ e.printStackTrace();
+ throw new VciBaseException("鎵ц淇濆瓨鏃跺嚭鐜伴敊璇紝閿欒灞炴�у璞″悕涓猴細銆�" + dto.getId() + "銆戯紝鍘熷洜锛�"+e.getMessage());
+ }
+ });
+ }catch (Exception e){
+ if(logger.isErrorEnabled()){
+ logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
+ }
+ e.printStackTrace();
+ return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
+ }
+ return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�");
+ }
+
+ /**
* 鏄惁榛樿鐨勫睘鎬�
*
* @param attr 灞炴�х紪鍙�
@@ -384,18 +1079,17 @@
*/
private boolean isReferAttr(String other){
if(StringUtils.isNotBlank(other)
- && (other.toLowerCase().contains("btm") || other.toLowerCase().contains("ltm"))){
+ && (other.toLowerCase().contains("btm") || other.toLowerCase().contains("link"))){
//杩樹笉鑳界‘瀹氾紝鍥犱负鏋氫妇鐨勬椂鍊欎篃浼氳缃産tm
String[] temp = other.split(";");
for(String s : temp){
- if((s.contains("btm") || s.contains("ltm")) && s.split("=").length>1){
+ if((s.contains("btm") || s.contains("link")) && s.split("=").length>1){
return true;
}
}
}
return false;
}
-
/**
* 鏄惁涓烘灇涓剧殑灞炴��
@@ -416,7 +1110,6 @@
return false;
}
-
/**
* 娓呴櫎缂撳瓨
*/
@@ -424,4 +1117,15 @@
public void clearCache() {
}
+
+ /**
+ * 璋冪敤淇敼涓氬姟绫诲瀷鍜岃繛鎺ョ被鍨嬩腑瀵瑰簲灞炴�у悕鐨勫睘鎬�
+ * @param apName
+ * @return
+ * @throws PLException
+ */
+ private boolean alterAp(String apName) throws PLException {
+ return osBtmService.alterAp(apName) && osLinkTypeServiceI.alterAp(apName);
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
index 66cdd49..ef49c4b 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsBtmServiceImpl.java
@@ -1,7 +1,9 @@
package com.vci.web.service.impl;
import com.vci.corba.common.PLException;
+import com.vci.corba.omd.atm.AttributeDef;
import com.vci.corba.omd.btm.BizType;
+import com.vci.corba.omd.ltm.LinkType;
import com.vci.pagemodel.*;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.BooleanEnum;
@@ -336,6 +338,88 @@
}
/**
+ * 淇敼涓氬姟绫诲瀷涓搴斿睘鎬у悕鐨勫睘鎬�
+ * @param apName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public boolean alterAp(String apName) throws PLException {
+ String[] btmNames = null;
+ List<String> btmNameList = new ArrayList<String>();
+ AttributeDef abItem = null;
+ try {
+ abItem = platformClientUtil.getAttributeService().getAttributeDefByName(apName);
+ } catch (PLException e1) {
+ e1.printStackTrace();
+ }
+ if(abItem == null || abItem.equals("")){
+ return true;
+ }
+ try {
+ btmNames = platformClientUtil.getBtmService().getBTNamesByAPName(apName);
+ } catch (PLException e) {
+ e.printStackTrace();
+ }
+ if(btmNames == null || btmNames.length <= 0){
+ return true;
+ }
+
+ btmNameList = Arrays.asList(btmNames);
+ for(Iterator<String> i = btmNameList.iterator(); i.hasNext();){
+ String btmName = i.next();
+ try {
+ platformClientUtil.getBtmService().modifyBTAttribute(btmName, apName);
+ } catch (PLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ String erreMsg = "璋冩暣涓氬姟绫诲瀷涓��"+apName+"銆戝睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細"+e.getMessage();
+ logger.error(erreMsg);
+ throw new PLException("500",new String[]{erreMsg});
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪涓氬姟绫诲瀷涓骇鐢熶簡鏁版嵁
+ * @param abName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public boolean hasInstance(String abName) throws PLException {
+ String[] btmNames = platformClientUtil.getBtmService().getBTNamesByAPName(abName);
+ if(btmNames == null || btmNames.length == 0){
+ return false;
+ }
+ for(int i = 0; i < btmNames.length; i++){
+ String btmName = btmNames[i];
+ boolean flag;
+ flag = platformClientUtil.getBtmService().hasData(btmName);
+ if(flag){
+ return flag;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 鑾峰彇鍚嶅瓧浠ilter寮�濮嬬殑涓氬姟绫诲瀷(for 鏌ヨ)锛屼富瑕佺敤浜庡睘鎬ф睜鐨勪笟鍔$被鍨嬮�夋嫨瀵硅瘽妗�
+ * 鑾峰彇鍏ㄩ儴涓氬姟绫诲瀷锛屼紶鍙俧ilter涓�""
+ * @param btmName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public BizType[] getBizTypes(String btmName) throws PLException {
+ if(null == btmName){
+ btmName = "";
+ }
+ return platformClientUtil.getBtmService().getBizTypes(btmName);
+ }
+
+ /**
* 鍙傜収涓氬姟绫诲瀷
*
* @param conditionMap 鏌ヨ鏉′欢
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
index 2173b0a..97f5267 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java
@@ -1,5 +1,6 @@
package com.vci.web.service.impl;
+import com.alibaba.fastjson.JSON;
import com.vci.corba.common.PLException;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.etm.EnumItem;
@@ -7,19 +8,21 @@
import com.vci.dto.OsEnumDTO;
import com.vci.dto.OsEnumItemDTO;
import com.vci.omd.utils.ObjectTool;
+import com.vci.pagemodel.*;
+import com.vci.po.OsEnumPO;
+import com.vci.starter.poi.bo.ReadExcelOption;
+import com.vci.starter.poi.bo.WriteExcelData;
+import com.vci.starter.poi.bo.WriteExcelOption;
+import com.vci.starter.poi.constant.ExcelLangCodeConstant;
+import com.vci.starter.poi.util.ExcelUtil;
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.UserSecretEnum;
import com.vci.starter.web.exception.VciBaseException;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.pagemodel.PageHelper;
-import com.vci.starter.web.util.VciBaseUtil;
-import com.vci.starter.web.util.VciDateUtil;
+import com.vci.starter.web.util.*;
import com.vci.constant.EnumIdConstant;
-import com.vci.pagemodel.KeyValue;
-import com.vci.pagemodel.OsEnumItemVO;
-import com.vci.pagemodel.OsEnumVO;
-import com.vci.pagemodel.OsStatusVO;
-import com.vci.starter.web.util.WebThreadLocalUtil;
import com.vci.web.service.OsEnumServiceI;
import com.vci.web.service.OsLifeCycleServiceI;
import com.vci.web.service.WebBoServiceI;
@@ -27,6 +30,7 @@
import com.vci.web.util.PlatformClientUtil;
import com.vci.web.util.WebUtil;
import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.hssf.util.HSSFColor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,6 +39,7 @@
import org.springframework.util.CollectionUtils;
import org.springframework.web.util.HtmlUtils;
+import java.io.File;
import java.util.*;
import java.util.stream.Collectors;
@@ -72,16 +77,21 @@
private WebBoServiceI boService;
/**
- * 鏃ュ織
- */
- private Logger logger = LoggerFactory.getLogger(getClass());
-
- /**
* 鍔犺浇鑷韩
*/
@Autowired(required = false)
@Lazy
private OsEnumServiceI self;
+
+ /**
+ * 蹇呭~鍒�
+ */
+ private List<Integer> ColumnNameisRed = new ArrayList<Integer>();
+
+ /**
+ * 鏃ュ織
+ */
+ private Logger logger = LoggerFactory.getLogger(getClass());
/**
* 浣跨敤缂栧彿鑾峰彇鏋氫妇鏄庣粏
@@ -231,13 +241,27 @@
/**
* 鏌ョ湅鏋氫妇鐨勪娇鐢ㄨ寖鍥�
- * @param enumName
+ * @param enumName 鏋氫妇鍚嶇О
* @return
* @throws PLException
*/
@Override
- public List<OsEnumVO> getUsedEnumList(String enumName) throws PLException {
- return null;
+ public List<Map<String,String>> getUsedEnumList(String enumName) throws PLException {
+ if(Func.isBlank(enumName)){
+ throw new PLException("500",new String[]{"璇烽�夋嫨瑕佹煡璇㈠簲鐢ㄨ寖鍥寸殑鏋氫妇!"});
+ }
+ String[] attrubuteNames = platformClientUtil.getAttributeService().getAttrubyteNamesByEMName(enumName);
+ if(Func.isEmpty(attrubuteNames)){
+ return new ArrayList<>();
+ }
+ List<Map<String,String>> attrubuteMapList = new ArrayList<>();
+ Arrays.stream(attrubuteNames).forEach(attrName->{
+ Map<String, String> itemMap = new HashMap<>();
+ itemMap.put("enumName",enumName);
+ itemMap.put("source",attrName);
+ attrubuteMapList.add(itemMap);
+ });
+ return attrubuteMapList;
}
/**
@@ -279,8 +303,10 @@
//鏋氫妇椤瑰悕绉板垽閲嶇瓑鎿嶄綔
checkOsEnumItem(osEnumDTO);
//榛樿鍊煎鐞�
- String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
+ String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
osEnumDTO.setCreator(userId);
+ //鎵嬪姩璁剧疆涓婚敭锛屽惁鍒欏钩鍙扮洿鎺ョ敤娌℃湁涓婚敭鐨勬灇涓炬斁杩涗簡缂撳瓨涓紝瀵艰嚧鍚庣画鏌ヨ鐨勬暟鎹病鏈塷id
+ osEnumDTO.setOid(VciBaseUtil.getPk().toUpperCase(Locale.ROOT));
osEnumDTO.setLastModifier(userId);
return platformClientUtil.getEnumService().addEnumType(this.osEnumDTO2EnumType(osEnumDTO));
}
@@ -308,7 +334,7 @@
//3銆佹灇涓鹃」鍒ら噸锛屽拰闀垮害绛夋牎楠�
checkOsEnumItem(osEnumDTO);
//灏唎sEnumVO涓殑榛樿鍊艰祴鍊肩粰osEnumDTO瀵硅薄
- String userId = "developer";//WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
+ String userId = WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId();
osEnumDTO.setLastModifier(userId);
osEnumDTO.setCreator(osEnumVO.getCreator());
osEnumDTO.setCreateTime(osEnumVO.getCreateTime());
@@ -333,7 +359,12 @@
String name = osEnumDTO.getName();
Date ts = osEnumDTO.getTs();
if(Func.isBlank(oid) || Func.isBlank(name) || Func.isEmpty(ts)){
- throw new PLException("500",new String[]{"寰呭垹闄ょ殑鏋氫妇鍒楄〃涓富閿�恛id銆戝拰璋冩暣鏃堕棿銆恡s銆戜笉鑳戒负绌猴紒"});
+ throw new PLException("500",new String[]{"寰呭垹闄ょ殑鏋氫妇鍒楄〃涓富閿�恛id銆戙�佽皟鏁存椂闂淬�恡s銆戙�佸睘鎬у悕銆恘ame銆戜笉鑳戒负绌猴紒"});
+ }
+ //鍒ゆ柇鏋氫妇鏄惁鏈夎寮曠敤
+ List<Map<String, String>> usedEnumList = this.getUsedEnumList(name);
+ if(Func.isNotEmpty(usedEnumList)){
+ throw new PLException("500",new String[]{"鍒犻櫎鐨勬灇涓句腑锛屾灇涓惧悕绉颁负锛氥��" + name + "銆�,宸茶寮曠敤锛�"});
}
EnumType enumType = new EnumType();
enumType.oid = oid;
@@ -348,6 +379,252 @@
}
/**
+ * 瀵煎嚭鏋氫妇绫诲瀷
+ * @param exportFileName 瀵煎嚭鐨勬枃浠跺悕
+ * @param enumNames 闇�瑕佸鍑虹殑鏋氫妇鍚嶇О
+ * @return
+ */
+ @Override
+ public String exportEnumTypes(String exportFileName,String enumNames) throws PLException {
+ if(Func.isBlank(enumNames)){
+ throw new PLException("500",new String[]{"璇峰嬀閫夎瀵煎嚭鐨勬灇涓�!"});
+ }
+ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+ exportFileName = Func.isBlank(exportFileName) ? "鏋氫妇绫诲瀷瀵煎嚭_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+ //璁剧疆鍒楀悕
+ List<String> columns = new ArrayList<>(Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害", "鏋氫妇椤瑰悕绉�", "鏋氫妇鍊�", "鎻忚堪"));
+
+ //鍐檈xcel
+ String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
+ try {
+ new File(excelPath).createNewFile();
+ } catch (Throwable e) {
+ throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+ }
+ //璁剧疆鍒�
+ List<WriteExcelData> excelDataList = new ArrayList<>();
+ //璁剧疆鍒楀ご
+ for (int index = 0; index < columns.size(); index++) {
+ excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+ }
+ //鎸夌収鏋氫妇鍚嶆煡璇㈡灇涓撅紝鐒跺悗澶勭悊鏋氫妇瀵煎嚭
+ List<String> enumNameList = Func.toStrList(enumNames);
+ int startRow = 1;
+ for (int i = 0; i < enumNameList.size(); i++) {
+ //鏍规嵁鏋氫妇鍚嶇О鏌ヨ鏋氫妇鍜屾灇涓鹃」
+ OsEnumVO osEnumVO = this.getEnumTypeById(enumNameList.get(i));
+ //OsEnumVO osEnumVO = getTestJson(i);
+ //鏌ヨ缁撴灉涓嶅簲璇ヤ负绌�
+ if(Func.isEmpty(osEnumVO) && Func.isBlank(osEnumVO.getOid())){
+ throw new PLException("500",new String[]{"鏈煡璇㈠埌鏋氫妇鍚嶄负銆�" + enumNameList.get(i) + "銆戠殑鏋氫妇锛岃鍒锋柊鍚庨噸鏂板鍑�!"});
+ }
+ //鏋氫妇椤逛笉涓虹┖鏃堕渶瑕佽�冭檻鍚堝苟琛岄棶棰�
+ List<OsEnumItemVO> enumVOItems = osEnumVO.getItems();
+ //鏋氫妇椤逛笉涓虹┖鏃堕渶瑕佽繘琛屽悎骞惰澶勭悊
+ if(Func.isNotEmpty(enumVOItems) || enumVOItems.size() > 1){
+ //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getOid()));
+ excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,0, osEnumVO.getId()));
+ excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,1, osEnumVO.getName()));
+ excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,2, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")"));
+ excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,3, osEnumVO.getLength()));
+ //excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,5, osEnumVO.getCreator()));
+ excelDataList.add(new WriteExcelData(startRow,(enumVOItems.size()+startRow)-1,true,true,4, Func.format(osEnumVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss")));
+
+ //澶勭悊鏋氫妇椤瑰啓鍏�
+ for (int j = 0; j < enumVOItems.size(); j++) {
+ OsEnumItemVO osEnumItemVO = enumVOItems.get(j);
+ excelDataList.add(new WriteExcelData(startRow+j,7, true,osEnumItemVO.getName()));
+ excelDataList.add(new WriteExcelData(startRow+j,8, true, osEnumItemVO.getValue()));
+ excelDataList.add(new WriteExcelData(startRow+j,9, true, osEnumItemVO.getDescription()));
+ }
+
+ startRow += enumVOItems.size();
+ }else{
+ //鏋氫妇椤逛负绌烘椂灏变笉闇�瑕佸悎骞惰
+ //excelDataList.add(new WriteExcelData(startRow,0, true,osEnumVO.getOid()));
+ excelDataList.add(new WriteExcelData(startRow,0, true, osEnumVO.getId()));
+ excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getName()));
+ excelDataList.add(new WriteExcelData(startRow,1, true, osEnumVO.getEnumValueDataType()+"("+osEnumVO.getEnumValueDataTypeText()+")"));
+ excelDataList.add(new WriteExcelData(startRow,3, true, osEnumVO.getLength()));
+ //excelDataList.add(new WriteExcelData(startRow,5, true, osEnumVO.getCreator()));
+ excelDataList.add(new WriteExcelData(startRow,4, true, Func.format(osEnumVO.getCreateTime(),"yyyy骞碝M鏈坉d鏃� hh:mm:ss")));
+ }
+ //璁板綍涓嬩笂涓�缁勬暟鎹粨鏉熸椂鐨勮鍙凤紝鏂逛究鐢ㄥ仛鍚堝苟琛岀殑璧峰琛�
+ startRow += 1;
+ }
+ WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+ ExcelUtil.writeDataToFile(excelPath, excelOption);
+ return excelPath;
+ }
+
+ /**
+ * 涓嬭浇瀵煎叆妯℃澘
+ * @param exportFileName
+ * @return
+ */
+ @Override
+ public String downloadEnumTemplate(String exportFileName) {
+ //鐣岄潰娌′紶鍚嶇О锛屼娇鐢ㄩ粯璁ゅ鍑哄悕绉�
+ exportFileName = Func.isBlank(exportFileName) ? "鏋氫妇瀵煎叆妯℃澘_" + Func.format(new Date(),"yyyy-MM-dd HHmmss.sss"):exportFileName;
+ //璁剧疆鍒楀悕
+ List<String> columns = new ArrayList<>(Arrays.asList("鏋氫妇鍚嶇О", "鏍囩", "杩斿洖绫诲瀷", "闀垮害", "鏋氫妇椤瑰悕绉�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)", "鏋氫妇鍊�(褰撳墠鏋氫妇涓嬫湁鏋氫妇椤规椂蹇呭~)", "鎻忚堪","*娉ㄦ剰*:绗簩琛屽紑濮嬬殑鏁版嵁涓虹ず渚嬫暟鎹紝瀵煎叆鍓嶈灏嗗叾鍒犻櫎锛屽綋瀵煎叆鐨勬灇涓句笅鍏峰澶氫釜鏋氫妇椤规椂锛屽簲鎸夌収绀轰緥enum2鐨勫啓娉�"));
+ //鍐檈xcel
+ String excelPath = LocalFileUtil.getDefaultTempFolder() + File.separator + exportFileName + ".xls";
+ //璁剧疆蹇呭~鍒�
+ ColumnNameisRed.clear();
+ ColumnNameisRed.add(0);
+ ColumnNameisRed.add(2);
+ ColumnNameisRed.add(3);
+ ColumnNameisRed.add(4);
+ ColumnNameisRed.add(5);
+ try {
+ new File(excelPath).createNewFile();
+ } catch (Throwable e) {
+ throw new VciBaseException(LangBaseUtil.getErrorMsg(e), new String[]{excelPath}, e);
+ }
+ //璁剧疆鍒�
+ List<WriteExcelData> excelDataList = new ArrayList<>();
+ //璁剧疆鍒楀ご
+ for (int index = 0; index < columns.size(); index++) {
+ //鍒ゆ柇鏄惁涓哄繀濉垪锛岀粰蹇呭~鍒楄缃鑹�
+ if(ColumnNameisRed.contains(index)){
+ WriteExcelData excelData = new WriteExcelData(0, index, columns.get(index));
+ excelData.setFontColor(String.valueOf(HSSFColor.HSSFColorPredefined.RED.getIndex()));
+ excelDataList.add(excelData);
+ }else{
+ excelDataList.add(new WriteExcelData(0,index, columns.get(index)));
+ }
+ }
+ List<OsEnumVO> exportEnumTempExample = this.getExportEnumTempExample();
+ for (int i = 0; i < exportEnumTempExample.size(); i++) {
+ OsEnumVO osEnumVO = exportEnumTempExample.get(i);
+ List<OsEnumItemVO> enumVOItems = osEnumVO.getItems();
+ for (int j = 0; j < enumVOItems.size(); j++) {
+ OsEnumItemVO osEnumItemVO = enumVOItems.get(j);
+ excelDataList.add(new WriteExcelData(i+j+1,0, osEnumVO.getId()));
+ excelDataList.add(new WriteExcelData(i+j+1,1, osEnumVO.getName()));
+ excelDataList.add(new WriteExcelData(i+j+1,2, osEnumVO.getEnumValueDataType()));
+ excelDataList.add(new WriteExcelData(i+j+1,3, osEnumVO.getLength()));
+
+ excelDataList.add(new WriteExcelData(i+j+1,4,osEnumItemVO.getName()));
+ excelDataList.add(new WriteExcelData(i+j+1,5, osEnumItemVO.getValue()));
+ excelDataList.add(new WriteExcelData(i+j+1,6, osEnumItemVO.getDescription()));
+ }
+ }
+ WriteExcelOption excelOption = new WriteExcelOption(excelDataList);
+ ExcelUtil.writeDataToFile(excelPath, excelOption);
+ return excelPath;
+ }
+
+ /**
+ * 瀵煎叆鏋氫妇
+ * @param file
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public BaseResult importEnumTypes(File file) throws Exception {
+ VciBaseUtil.alertNotNull(file,"excel鏂囦欢");
+ if(!file.exists()){
+ throw new VciBaseException("瀵煎叆鐨別xcel鏂囦欢涓嶅瓨鍦�,{0}",new String[]{file.getPath()});
+ }
+ try{
+ //1銆佽鍙杄xcel涓殑鏁版嵁锛岀粍鎴愬璞�
+ ReadExcelOption excelOption = new ReadExcelOption();
+ List<OsEnumPO> poList = ExcelUtil.readDataObjectFromExcel(file, OsEnumPO.class,excelOption,(value, po, fieldName)->{});
+ //鍘婚櫎閮芥槸绌虹殑鎯呭喌
+ if(CollectionUtils.isEmpty(poList)){
+ return BaseResult.fail(ExcelLangCodeConstant.IMPORT_CONTENT_NULL,new String[]{});
+ }
+ //灏嗘灇涓惧拰鏋氫妇椤瑰鐞嗘垚涓�瀵瑰鍏崇郴鐨勫璞�
+ Map<String, OsEnumPO> groupPOMap = new HashMap<>();
+ for (OsEnumPO po : poList) {
+ //鎷兼帴鐢ㄦ潵浣滀负鍒嗙粍鐨刱ey
+ String key = po.getId() + "_" + po.getName() + "_" + po.getEnumValueDataType() + "_" + po.getLength();
+ OsEnumPO group = groupPOMap.get(key);
+ if (group == null) {
+ group = new OsEnumPO();
+ //鎷垮嚭鐜扮殑棣栬鍋氬悗缁殑鎻愮ず琛�
+ group.setRowIndex(po.getRowIndex());
+ group.setId(po.getId());
+ group.setName(po.getName());
+ group.setEnumValueDataType(po.getEnumValueDataType());
+ group.setLength(po.getLength());
+ groupPOMap.put(key, group);
+ }
+
+ OsEnumItemDTO itemDTO = new OsEnumItemDTO();
+ itemDTO.setName(po.getEnumItemName());
+ itemDTO.setValue(po.getValue());
+ itemDTO.setDescription(po.getDescription());
+
+ group.getItems().add(itemDTO);
+ }
+ Collection<OsEnumPO> newPOList = groupPOMap.values();
+ //鏁版嵁搴撴煡璇㈡槸鍚︽湁宸插瓨鍦ㄧ殑鏋氫妇鍚嶏紝鏂逛究鍚庣画鍋氬垽閲嶅鐞�
+ List<OsEnumVO> osEnumVOList = this.listEnumByIdCollection(poList.stream().map(OsEnumPO::getId).collect(Collectors.toSet()));
+ List<String> repeatEnumId = new ArrayList<>();
+ if(Func.isNotEmpty(osEnumVOList)){
+ repeatEnumId = osEnumVOList.stream().map(OsEnumVO::getId).collect(Collectors.toList());
+ }
+ //褰撳墠excel涓槸鍚﹂噸澶嶇敤鐨勫垽閲峂ap:锛坘ey锛氬垽閲嶅睘鎬э紝value锛氳鍙凤級
+ Map<String, String> excelReapeat = new HashMap<>();
+ //鍒ゆ柇蹇呭~灞炴�ф槸鍚︿负绌猴紝鐢ㄦ埛鏄惁宸插瓨鍦紝浠ュ強閮ㄩ棬鏄惁濉敊绛夋牎楠岄�昏緫
+ List<String> finalRepeatEnumId = repeatEnumId;
+ newPOList.stream().forEach(osEnumPO -> {
+ if(Func.isBlank(osEnumPO.getId())){//鏋氫妇鍚�
+ throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣锛宔numnameerror");
+ }else if(Func.isBlank(osEnumPO.getEnumValueDataType())){
+ throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣锛宼ypeerror");
+ }else if(Func.isEmpty(osEnumPO.getLength())){
+ throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣锛宭engtherror");
+ }else if(!osEnumPO.getId().matches("^[A-Za-z]+$")){
+ throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣鏁版嵁锛屾灇涓惧悕绉板彧鑳戒负鑻辨枃瀛楁瘝");
+ }else if(excelReapeat.containsKey(osEnumPO.getId())){//鏋氫妇鍚嶈〃鏍间腑鍒ら噸
+ throw new VciBaseException("绗��"+excelReapeat.get(osEnumPO.getId())+"銆戣鍜岀銆�"+osEnumPO.getRowIndex()+"銆戣鏁版嵁锛屾灇涓惧悕閲嶅");
+ }else if (Func.isNotEmpty(osEnumVOList) && finalRepeatEnumId.contains(osEnumPO.getId())){//2銆佸垽鏂灇涓惧悕鏄惁涓庣郴缁熶腑閲嶅
+ throw new VciBaseException("绗��"+osEnumPO.getRowIndex()+"銆戣锛屾灇涓惧悕鍦ㄧ郴缁熶腑宸茬粡瀛樺湪,璇蜂慨鏀�!");
+ }
+ //鍏堝鏋氫妇鍚峞xcel涓渶瑕佸垽閲嶅鐞�
+ excelReapeat.put(osEnumPO.getId(),osEnumPO.getRowIndex());
+ });
+ //淇濆瓨閫昏緫
+ for (OsEnumPO osEnumPO : newPOList) {
+ OsEnumDTO osEnumDTO = new OsEnumDTO();
+ //鐢熸垚瀛樺偍鐨凞TO瀵硅薄
+ osEnumDTO.setId(osEnumPO.getId());
+ osEnumDTO.setName(osEnumPO.getName());
+ osEnumDTO.setEnumValueDataType(osEnumPO.getEnumValueDataType());
+ osEnumDTO.setLength(osEnumPO.getLength());
+ osEnumDTO.setItems(osEnumPO.getItems());
+
+ //璋冪敤鏂板鏋氫妇鏂规硶
+ boolean addBoolean = this.addEnumType(osEnumDTO);
+ if(!addBoolean){
+ throw new PLException("500",new String[]{"淇濆瓨鏋氫妇鍚嶄负銆�" + osEnumDTO.getId() + "銆戠殑鏁版嵁鏃跺嚭鐜伴敊璇�!"});
+ }
+ }
+ }catch (Exception e){
+ if(logger.isErrorEnabled()){
+ logger.error("璇诲彇excel鍐呭鏃舵垨淇濆瓨鐢ㄦ埛淇℃伅鏃跺嚭鐜颁簡閿欒锛屽叿浣撳師鍥狅細",VciBaseUtil.getExceptionMessage(e));
+ }
+ e.printStackTrace();
+ return BaseResult.fail(VciBaseUtil.getExceptionMessage(e),new String[]{},e);
+ }
+ return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�");
+ }
+
+ /**
+ * 鑾峰彇瀵煎叆妯℃澘鐨勭ず渚嬫暟鎹�
+ * @return
+ */
+ private List<OsEnumVO> getExportEnumTempExample(){
+ String testJosn = "[{\"enumValueDataType\":\"String\",\"id\":\"enum1\",\"items\":[{\"description\":\"enumitem1.1\",\"name\":\"enumitem1.1\",\"value\":\"1\"},{\"description\":\"enumitem1.2\",\"name\":\"enumitem1.2\",\"value\":\"2\"}],\"length\":2,\"name\":\"enum1\"},{\"enumValueDataType\":\"String\",\"id\":\"enum2\",\"items\":[{\"description\":\"enumitem2.1\",\"name\":\"enumitem2.1\",\"value\":\"1\"},{\"description\":\"enumitem2.2\",\"name\":\"enumitem2.2\",\"value\":\"2\"},{\"description\":\"enumitem2.3\",\"name\":\"enumitem2.3\",\"value\":\"3\"}],\"length\":6,\"name\":\"enum2\"}]";
+ List<OsEnumVO> OsEnumVOs = JSON.parseArray(testJosn,OsEnumVO.class);
+ return OsEnumVOs;
+ }
+
+ /**
* 鏋氫妇椤规牎楠�
* @param osEnumDTO
* @return 鏍¢獙澶辫触鐩存帴鎶涘嚭寮傚父锛屽惁鍒欎笉浼氬仛浠讳綍杩斿洖
@@ -356,7 +633,7 @@
List<OsEnumItemDTO> items = osEnumDTO.getItems();
if (Func.isNotEmpty(items)) {
//鑾峰彇姝e垯锛屼富瑕佹槸閽堝Integer绫诲瀷鐨勬椂鍊�
- String regular = "Integer".equals(osEnumDTO.getEnumValueDataType()) ? "^[0-9]+$" : "";
+ String regular = "Integer".equals(osEnumDTO.getEnumValueDataType()) ? "^-?\\d+$" : "";
//鍒╃敤set鐨刟dd杩斿洖鍊艰繘琛宯ame鍒ら噸
Set<String> uniqueNames = new HashSet<>();
for (OsEnumItemDTO item : items) {
@@ -385,7 +662,8 @@
private EnumType osEnumDTO2EnumType(OsEnumDTO osEnumDTO){
EnumType enumType = new EnumType();
enumType.oid = osEnumDTO.getOid();
- enumType.name = osEnumDTO.getId();
+ //鏋氫妇鍚嶇粺涓�杞垚灏忓啓锛岄伩鍏嶅悗鏈熷嚭鐜板叾浠栭棶棰�
+ enumType.name = osEnumDTO.getId().toLowerCase(Locale.ROOT);
enumType.label = osEnumDTO.getName();
enumType.length = osEnumDTO.getLength();
enumType.creator = osEnumDTO.getCreator();
@@ -651,6 +929,39 @@
}
/**
+ * 鏍规嵁鏋氫妇绫诲瀷鏌ヨ鏋氫妇锛氭灇涓惧悕 , 鏋氫妇
+ * @param enumType锛歋tring, Integer
+ * @return
+ */
+ public List<Map<String,List<String>>> getEnumMapByType(String enumType){
+ List<Map<String,List<String>>> enumMapList = new ArrayList<>();
+ EnumType[] emArray = null;
+ try {
+ emArray = platformClientUtil.getEnumService().getEnumTypesByType(enumType);
+ } catch (PLException e) {
+ e.printStackTrace();
+ }
+ if(emArray == null || emArray.length == 0){
+ return null;
+ }
+ EnumType emItem;
+ for(int i = 0; i < emArray.length; i++){
+ emItem = emArray[i];
+ EnumItem[] emChildren = emItem.items;
+ ArrayList<String> valueList = new ArrayList<String>();
+ for(int k = 0; k < emChildren.length; k++){
+ EnumItem emChild = emChildren[k];
+ String value = emChild.value;
+ valueList.add(value);
+ }
+ Map<String, List<String>> enumMap = new HashMap<>();
+ enumMap.put(emItem.name, valueList);
+ enumMapList.add(enumMap);
+ }
+ return enumMapList;
+ }
+
+ /**
* 娓呴櫎缂撳瓨
*/
@Override
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
index 7065900..d785735 100644
--- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java
@@ -1,6 +1,7 @@
package com.vci.web.service.impl;
import com.vci.corba.common.PLException;
+import com.vci.corba.omd.atm.AttributeDef;
import com.vci.corba.omd.data.BusinessObject;
import com.vci.corba.omd.ltm.LinkType;
import com.vci.omd.utils.ObjectTool;
@@ -8,6 +9,7 @@
import com.vci.starter.web.annotation.log.VciUnLog;
import com.vci.starter.web.enumpck.VciFieldTypeEnum;
import com.vci.starter.web.pagemodel.BaseQueryObject;
+import com.vci.starter.web.pagemodel.BaseResult;
import com.vci.starter.web.pagemodel.DataGrid;
import com.vci.starter.web.util.BeanUtil;
import com.vci.starter.web.util.VciBaseUtil;
@@ -321,10 +323,170 @@
}
/**
+ * 閾炬帴绫诲瀷鐨勫垪琛�
+ *
+ * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞�
+ */
+ @Override
+ public BaseResult<List<LinkType>> gridLink() throws PLException {
+
+ LinkType[] linkTypes = platformClientUtil.getLinkTypeService().getLinkTypes();
+ return BaseResult.dataList(Arrays.asList(linkTypes));
+ }
+ /**
+ * 閾炬帴绫诲瀷淇濆瓨
+ * linkType 閾炬帴绫诲瀷鐨勪繚瀛樺璞�
+ * addFlag 鏄惁涓烘柊澧� true鏂板锛宖alse淇敼
+ * @return 淇濆瓨缁撴灉
+ */
+ @Override
+ public BaseResult addAndEditLink(LinkType linkType, Boolean addFlag) throws PLException {
+ VciBaseUtil.alertNotNull(linkType.name,"璇疯緭鍏ラ摼鎺ョ被鍨嬪悕绉�",linkType.btmItemsFrom,"From绔笟鍔$被鍨嬩笉鑳戒负绌�!",
+ linkType.btmItemsTo,"To绔被鍨嬪潎涓嶈兘涓虹┖!");
+ int maxLength = platformClientUtil.getLinkTypeService().getLTNameMaxLength();
+ if(linkType.name.length() > maxLength){
+ throw new PLException("500",new String[] {"閾炬帴绫诲瀷鍚嶉暱搴︿笉鑳借秴杩�" + maxLength});
+ }
+ if(!linkType.name.matches("^[A-Za-z]+$")){
+ throw new PLException("500",new String[] {"閾炬帴绫诲瀷鍚嶇О鍙兘涓鸿嫳鏂囧瓧姣�"});
+ }
+ LinkType historyLink = platformClientUtil.getLinkTypeService().getLinkType(linkType.name);
+ if(historyLink != null && !historyLink.name.equals("") && addFlag){
+ throw new PLException("500",new String[] {"璇ラ摼鎺ョ被鍨嬪悕绉板凡缁忓瓨鍦�"});
+ }
+ linkType.modifier = WebUtil.getCurrentUserId();
+ if(addFlag){
+ linkType.creator = WebUtil.getCurrentUserId();
+ platformClientUtil.getLinkTypeService().addLinkType(linkType);
+ return BaseResult.success(null,"淇濆瓨鎴愬姛锛�");
+ }
+ ArrayList<String> removeAbList = getRemovedApList(historyLink, linkType);
+ if(removeAbList.size() > 0 && platformClientUtil.getLinkTypeService().hasData(linkType.name)){
+ linkType.attributes = historyLink.attributes;
+ platformClientUtil.getLinkTypeService().modifyLinkType(linkType);
+ throw new PLException("500",new String[] {"绫诲瀷宸叉湁瀹炰緥, 涓嶈繘琛岀Щ闄ゆ搷浣�"});
+ }
+ platformClientUtil.getLinkTypeService().modifyLinkType(linkType);
+ return BaseResult.success(null,"淇濆瓨鎴愬姛锛�");
+ }
+
+
+ /**
+ * 鑾峰彇淇敼閾炬帴绫诲瀷鏃� 鍑忓皯鐨勫睘鎬�
+ * @param oldLt
+ * @param newLt
+ * @return
+ */
+ private ArrayList<String> getRemovedApList(LinkType oldLt,
+ LinkType newLt) {
+ String[] oldAbInfo = oldLt.attributes;
+ ArrayList<String> oldNameList = new ArrayList<String>();
+ for(int i = 0; i < oldAbInfo.length; i++){
+ oldNameList.add(oldAbInfo[i]);
+ }
+ String[] newAbInfo = newLt.attributes;
+ ArrayList<String> newNameList = new ArrayList<String>();
+ for(int i = 0; i < newAbInfo.length; i++){
+ newNameList.add(newAbInfo[i]);
+ }
+
+ ArrayList<String> removedApList = new ArrayList<String>();
+
+ for(Iterator<String> iterator = oldNameList.iterator(); iterator.hasNext();){
+ String oldName = iterator.next();
+ if(!newNameList.contains(oldName)){
+ removedApList.add(oldName);
+ }
+ }
+ return removedApList;
+ }
+
+ /**
* 娓呴櫎缂撳瓨
*/
@Override
public void clearCache() {
}
+
+ /**
+ * 淇敼閾炬帴绫诲瀷涓搴斿睘鎬у悕鐨勫睘鎬�
+ * @param apName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public boolean alterAp(String apName) throws PLException {
+ String[] linkNames = null;
+ List<String> linkNameList = new ArrayList<String>();
+ AttributeDef abItem = null;
+ try {
+ abItem = platformClientUtil.getAttributeService().getAttributeDefByName(apName);
+ } catch (PLException e1) {
+ e1.printStackTrace();
+ }
+ if(abItem == null || abItem.equals("")){
+ return true;
+ }
+ try {
+ linkNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(apName);
+ } catch (PLException e) {
+ e.printStackTrace();
+ }
+ if(linkNames == null || linkNames.length <= 0){
+ return true;
+ }
+
+ linkNameList = Arrays.asList(linkNames);
+ for(Iterator<String> i = linkNameList.iterator(); i.hasNext();){
+ String linkName = i.next();
+ try {
+ platformClientUtil.getLinkTypeService().modifyLTAttribute(linkName, apName);
+ } catch (PLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ String erreMsg = "璋冩暣閾炬帴绫诲瀷涓��"+apName+"銆戝睘鎬ф椂鍑虹幇閿欒锛屽師鍥狅細"+e.getMessage();
+ logger.error(erreMsg);
+ throw new PLException("500",new String[]{erreMsg});
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 鍒ゆ柇璇ュ睘鎬ф槸鍚﹀凡缁忓湪閾炬帴绫诲瀷涓骇鐢熶簡鏁版嵁
+ * @param abName
+ * @return
+ * @throws PLException
+ */
+ @Override
+ public boolean hasInstance(String abName) throws PLException {
+ String[] btmNames = platformClientUtil.getLinkTypeService().getLTNamesByAPName(abName);
+ if(btmNames == null || btmNames.length == 0){
+ return false;
+ }
+ for(int i = 0; i < btmNames.length; i++){
+ String btmName = btmNames[i];
+ boolean flag;
+ flag = platformClientUtil.getLinkTypeService().hasData(btmName);
+ if(flag){
+ return flag;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * 鑾峰彇杩炴帴绫诲瀷鍚嶇О闆嗗悎
+ * @return
+ */
+ @Override
+ public List<String> getAllLtName() throws PLException {
+ LinkType[] linkTypes = platformClientUtil.getLinkTypeService().getLinkTypes();
+ if(null != linkTypes && linkTypes.length > 0){
+ return Arrays.stream(linkTypes).map(linkType -> linkType.name).collect(Collectors.toList());
+ }
+ return null;
+ }
+
}
diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/usedNames.properties b/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/usedNames.properties
new file mode 100644
index 0000000..222da11
--- /dev/null
+++ b/Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/usedNames.properties
@@ -0,0 +1,2 @@
+sysUsedNames = OID,REVISIONOID,NAMEOID,BtmName,ISLastR,ISFirstR,ISLastV,ISFirstV,Creator,CreateTime,LastModifier,LastModifyTime,RevisionRule,VersionRule,RevisionSeq,RevisionValue,VersionSeq,VersionValue,LCTID,LCStatus,TS,ID,NAME,DESCRIPTION,OWNER,CHECKINBY,CHECKINTIME,CHECKOUTBY,CHECKOUTTIME,COPYFROMVERSION,NEWOID,NEWREVISIONOID
+dataBaseUsedNames = ACCESS,ADD,ALL,ALTER,AND,ANY,AS,ASC,AUDIT,BETWEEN,BY,CHAR,CHECK,CLUSTER,COLUMN,COMMENT,COMPRESS,CONNECT,CREATE,CURRENT,DATE,DECIMAL,DEFAULT,DELETE,DESC,DISTINCT,DROP,ELSE,EXCLUSIVE,EXISTS,FILE,FLOAT,FOR,FROM,GRANT,GROUP,HAVING,IDENTIFIED,IMMEDIATE,IN,INCREMENT,INDEX,INITIAL,INSERT,INTEGER,INTERSECT,INTO,IS,LEVEL,LIKE,LOCK,LONG,MAXEXTENTS,MINUS,MLSLABEL,MODE,MODIFY,NOAUDIT,NOCOMPRESS,NOT,NOWAIT,NULL,NUMBER,OF,OFFLINE,ON,ONLINE,OPTION,OR,ORDER,P,CTFREE,PRIOR,PRIVILEGES,PUBLIC,RAW,RENAME,RESOURCE,REVOKE,ROW,ROWID,ROWNUM,ROWS,SELECT,SESSION,SET,SHARE,SIZE,SMALLINT,START,SUCCESSFUL,SYNONYM,SYSDATE,TABLE,THEN,TO,TRIGGER,UID,UNION,UNIQUE,UPDATE,USER,VALIDATE,VALUES,VARCHAR,VARCHAR2,VIEW,WHENEVER,WHERE,WITH
\ No newline at end of file
diff --git a/Source/plt-web/plt-web-ui/src/api/system/menu.js b/Source/plt-web/plt-web-ui/src/api/system/menu.js
index 23b0ee5..a192a27 100644
--- a/Source/plt-web/plt-web-ui/src/api/system/menu.js
+++ b/Source/plt-web/plt-web-ui/src/api/system/menu.js
@@ -1,97 +1,5 @@
import request from '@/router/axios';
-export const getList = (current, size, params) => {
- return request({
- url: '/api/blade-system/menu/list',
- method: 'get',
- params: {
- ...params,
- current,
- size,
- }
- })
-}
-
-export const getLazyList = (parentId, params) => {
- return request({
- url: '/api/blade-system/menu/lazy-list',
- method: 'get',
- params: {
- ...params,
- parentId
- }
- })
-}
-
-export const getLazyMenuList = (parentId, params) => {
- return request({
- url: '/api/blade-system/menu/lazy-menu-list',
- method: 'get',
- params: {
- ...params,
- parentId
- }
- })
-}
-
-export const getMenuList = (current, size, params) => {
- return request({
- url: '/api/blade-system/menu/menu-list',
- method: 'get',
- params: {
- ...params,
- current,
- size,
- }
- })
-}
-
-export const getMenuTree = (tenantId) => {
- return request({
- url: '/api/blade-system/menu/tree',
- method: 'get',
- params: {
- tenantId,
- }
- })
-}
-
-export const remove = (ids) => {
- return request({
- url: '/api/blade-system/menu/remove',
- method: 'post',
- params: {
- ids,
- }
- })
-}
-
-export const add = (row) => {
- return request({
- url: '/api/blade-system/menu/submit',
- method: 'post',
- data: row
- })
-}
-
-export const update = (row) => {
- return request({
- url: '/api/blade-system/menu/submit',
- method: 'post',
- data: row
- })
-}
-
-export const getMenu = (id) => {
- return request({
- url: '/api/blade-system/menu/detail',
- method: 'get',
- params: {
- id,
- }
- })
-}
-
export const getTopMenu = () => request({
url: '/api/smFunctionController/top-menu',
method: 'get'
diff --git a/Source/plt-web/plt-web-ui/src/api/treeMyMenu.js b/Source/plt-web/plt-web-ui/src/api/treeMyMenu.js
index ea7fd6f..f8d0f3a 100644
--- a/Source/plt-web/plt-web-ui/src/api/treeMyMenu.js
+++ b/Source/plt-web/plt-web-ui/src/api/treeMyMenu.js
@@ -5,7 +5,7 @@
*/
export const treeMenu = (parentOid) => {
return request({
- url: 'api/smFunctionController/treeMyMenu',
+ url: '/api/smFunctionController/treeMyMenu',
method: 'get',
params:{
parentOid
diff --git a/Source/plt-web/plt-web-ui/src/api/user.js b/Source/plt-web/plt-web-ui/src/api/user.js
index 0a7fed7..405e08d 100644
--- a/Source/plt-web/plt-web-ui/src/api/user.js
+++ b/Source/plt-web/plt-web-ui/src/api/user.js
@@ -19,100 +19,9 @@
}
});
-export const loginBySocial = (tenantId, source, state) => request({
- url: '/api/blade-auth/oauth/token',
- method: 'post',
- headers: {
- 'Tenant-Id': tenantId
- },
- params: {
- tenantId,
- source,
- state,
- grant_type: "social",
- scope: "all",
- }
-})
-
-export const loginBySso = (state) => request({
- url: '/api/blade-auth/oauth/token',
- method: 'post',
- headers: {
- 'Tenant-Id': state
- },
- params: {
- tenantId: state,
- grant_type: "authorization_code",
- scope: "all",
- redirect_uri: website.redirectUri,
- }
-})
-
-export const refreshToken = (refresh_token, tenantId, deptId, roleId) => request({
- url: '/api/blade-auth/oauth/token',
- method: 'post',
- headers: {
- 'Tenant-Id': tenantId,
- 'Dept-Id': (website.switchMode ? deptId : ''),
- 'Role-Id': (website.switchMode ? roleId : '')
- },
- params: {
- tenantId,
- refresh_token,
- grant_type: "refresh_token",
- scope: "all",
- }
-});
-
-export const registerGuest = (form, oauthId) => request({
- url: '/api/blade-user/register-guest',
- method: 'post',
- params: {
- tenantId: form.tenantId,
- name: form.name,
- account: form.account,
- password: form.password,
- oauthId
- }
-});
-
-export const getButtons = () => request({
- url: '/api/blade-system/menu/buttons',
- method: 'get'
-});
-
-export const getCaptcha = () => request({
- url: '/api/blade-auth/oauth/captcha',
- method: 'get',
- authorization: false
-});
-
-export const logout = () => request({
- url: '/api/blade-auth/oauth/logout',
- method: 'get',
- authorization: false
-});
-
export const getUserInfo = () => request({
url: '/api/framework/loginController/getSessionInfo',
method: 'post'
-});
-
-export const sendLogs = (list) => request({
- url: '/api/blade-auth/oauth/logout',
- method: 'post',
- data: list
-});
-
-export const clearCache = () => request({
- url: '/api/blade-auth/oauth/clear-cache',
- method: 'get',
- authorization: false
-});
-
-export const selcetList = () => request({
- url: '/api/blade-system/tenant/tenant-map',
- method: 'get',
});
// 淇敼瀵嗙爜
--
Gitblit v1.9.3