From 34c25ddf37a3eb8da9efb04efedad089f13efe83 Mon Sep 17 00:00:00 2001 From: ludc Date: 星期三, 24 七月 2024 18:20:27 +0800 Subject: [PATCH] 部门导入调整,按照部门名称/实现层级关系。枚举导入功能接口上传,属性池添加新增、查询、修改、导出、查看应用范围等接口。业务类型、链接类型、枚举类型增加等接口属性是否产生数据检查、根据属性名修改业务类型和连接类型中对应属性方法,以及属性池中需要的一些下拉查询接口。 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java | 201 ++++-- 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 | 54 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/OsAttributeServiceI.java | 47 + Source/plt-web/plt-web-parent/plt-web/src/main/resources/properties/usedNames.properties | 2 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 | 23 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsEnumServiceImpl.java | 61 + 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 | 542 ++++++++++++++++++ Source/plt-web/plt-web-parent/plt-poi/src/main/java/com/vci/starter/poi/bo/WriteExcelData.java | 4 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 | 16 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsLinkTypeController.java | 26 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 | 4 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 | 9 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/WebEnumController.java | 22 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/OsAttributeController.java | 154 +++++ Source/plt-web/plt-web-ui/src/api/user.js | 91 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/OsLinkTypeServiceImpl.java | 82 ++ 32 files changed, 1,371 insertions(+), 330 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 9d534fe..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 @@ -141,7 +141,7 @@ } /** - * 鏋勯�犳柟娉� + * 鏋勯�犳柟娉�-鏄惁灞呬腑 * @param row 琛� * @param col 鍒� * @param obj 鍊� @@ -154,7 +154,7 @@ } /** - * 鏋勯�犳柟娉� + * 鏋勯�犳柟娉�-鍚堝苟锛屽眳涓弬鏁� * @param row 琛� * @param rowTo 鍚堝苟琛� * @param merged 鏄惁鍚堝苟鍗曞厓鏍� 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..0f50ec0 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; - /** * 浣跨敤鏋氫妇鑻辨枃鍚嶇О */ @@ -85,7 +84,6 @@ */ private Integer scaleLength; - /** * 鍙栧�艰寖鍥� */ @@ -96,6 +94,58 @@ */ private Date ts; + /** + * 鍒涘缓浜� + */ + private String creator; + + /** + * 鍒涘缓鏃堕棿 + */ + private Date createTime; + + /** + * 鏈�鍚庝慨鏀逛汉 + */ + private String lastModifier; + + /** + * 鏈�鍚庝慨鏀规椂闂达紝鏍煎紡鏄痽yyy-MM-dd HH:mm:ss + */ + private Date lastModifyTime; + + 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..8df8068 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; - /** * 鍙傜収鐨勪笟鍔$被鍨嬬紪鍙� */ @@ -96,7 +95,12 @@ private String range; /** - * 涓氬姟绫诲瀷鍚嶇О,鏄�艰繖鏉℃暟鎹殑涓氬姟绫诲瀷锛屼笉鏄睘鎬ф墍灞炵殑涓氬姟绫诲瀷 + * 瀛楁涓哄弬鐓ф椂鍙傜収鐨勭浉鍏冲睘鎬� + */ + private String other; + + /** + * 涓氬姟绫诲瀷鍚嶇О,鏄�艰繖鏉℃暟鎹殑涓氬姟绫诲瀷锛屼笉鏄睘鎬ф墍灞炵殑涓氬姟绫诲瀷锛屽簲璇ユ槸涓氬姟绫诲瀷涓哄睘鎬ф睜 */ private String btmname; @@ -130,6 +134,14 @@ */ private Date ts; + public String getOther() { + return other; + } + + public void setOther(String other) { + this.other = other; + } + public String getOid() { return oid; } 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-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 6393e9f..637ca30 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 @@ -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())){ @@ -707,19 +743,8 @@ //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; } /** @@ -732,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"; @@ -785,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(); @@ -840,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 @@ -901,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 cf9ee4b..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 @@ -763,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..a8fb24f 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,25 @@ package com.vci.web.controller; +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.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.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 javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.Date; +import java.util.List; /** * 灞炴�ф帶鍒跺櫒 @@ -25,12 +37,142 @@ 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") + 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 = "娣诲姞灞炴��") + @VciUnCheckRight + 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 = "淇敼灞炴��") + 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 = "瀵煎嚭鏋氫妇绫诲瀷") + @VciUnCheckRight + 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(); + } + } + } + + } 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..2ab88b8 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 @@ -3,11 +3,15 @@ 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; @@ -34,6 +38,11 @@ private OsLinkTypeServiceI linkTypeService; /** + * 鏃ュ織 + */ + private Logger logger = LoggerFactory.getLogger(getClass()); + + /** * 閾炬帴绫诲瀷鐨勫垪琛� * @param baseQueryObject 鏌ヨ瀵硅薄 * @return 閾炬帴绫诲瀷鐨勬樉绀哄璞� @@ -44,6 +53,23 @@ } /** + * 鏌ヨ鎵�鏈夌殑閾炬帴绫诲瀷鍚嶇О锛屽彲鐢ㄤ簬灞炴�ф睜鐨勮繛鎺ョ被鍨嬮�夋嫨鏃剁殑瀵硅瘽妗� + * @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); + } + } + + /** * 鑾峰彇閾炬帴绫诲瀷鍖呭惈鐨勫睘鎬� * @param linkTypeOid 閾炬帴绫诲瀷鐨勪富閿� * @param baseQueryObject 鏌ヨ瀵硅薄 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 d9a5837..e5c3025 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 @@ -29,6 +29,7 @@ import java.io.IOException; import java.util.Date; import java.util.List; +import java.util.Map; /** @@ -58,7 +59,6 @@ * @return 鏋氫妇鐨勪笅鎷夊�� */ @VciBusinessLog(notStore=true,operateName="鑾峰彇鏋氫妇") - @VciUnCheckRight @GetMapping("/getEnum") public BaseResult<List<KeyValue>> getEnum(String comboxKey){ return BaseResult.success(enumService.getEnum(comboxKey)); @@ -96,6 +96,24 @@ @GetMapping("/getDataEnum") public BaseResult<List<KeyValue>> getDataEnum(String oid,String btmname){ return BaseResult.success(enumService.getDataEnum(oid,btmname)); + } + + /** + * 鏍规嵁鏋氫妇绫诲瀷鑾峰彇鏋氫妇 + * @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); + } } /** @@ -196,7 +214,6 @@ */ @GetMapping( "/exportEnumTypes") @VciBusinessLog(operateName = "瀵煎嚭鏋氫妇绫诲瀷") - @VciUnCheckRight public void exportEnumTypes(String exportFileName,String enumNames, HttpServletResponse response){ try { String excelPath = enumService.exportEnumTypes(exportFileName,enumNames); @@ -220,7 +237,6 @@ */ @GetMapping( "/downloadEnumTemplate") @VciBusinessLog(operateName = "瀵煎嚭鏋氫妇绫诲瀷") - @VciUnCheckRight public void downloadEnumTemplate(String exportFileName, HttpServletResponse response){ try { String excelPath = enumService.downloadEnumTemplate(exportFileName); 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..5931650 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,6 +1,8 @@ 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.DataGrid; import com.vci.pagemodel.OsAttributeVO; @@ -15,6 +17,7 @@ * @date 2021-2-15 */ public interface OsAttributeServiceI extends OsBaseServiceI{ + /** * 鑾峰彇榛樿鐨勫睘鎬� * @return 榛樿鐨勫睘鎬у垪琛� @@ -32,6 +35,7 @@ * @return 榛樿鐨勫睘鎬ф槧灏� */ Map<String, OsAttributeVO> getDefaultAttributeVOMap(); + /** * 璁剧疆榛樿鐨勫睘鎬х殑鏄犲皠 * @param defaultAttributeVOMap 榛樿鐨勫睘鎬ф槧灏� @@ -49,6 +53,13 @@ * @return key鏄睘鎬х殑鑻辨枃鍚嶇О灏忓啓锛寁alue鏄睘鎬х殑鏄剧ず瀵硅薄 */ Map<String,OsAttributeVO> selectAllAttributeMap(); + + /** + * 鏍规嵁澶氫釜灞炴�у悕绉版煡璇㈠睘鎬� + * @param attrNames + * @return + */ + List<OsAttributeVO> getByAttributeNames(String[] attrNames) throws PLException; /** * 灞炴�х殑鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� @@ -104,6 +115,41 @@ */ 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; /** * 鏄惁榛樿鐨勫睘鎬� @@ -111,4 +157,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 615269e..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 @@ -11,6 +11,7 @@ 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; @@ -203,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..4ed9866 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,5 +1,6 @@ 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.DataGrid; @@ -19,6 +20,28 @@ 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; + + /** * 鏌ヨ鎵�鏈夌殑閾炬帴绫诲瀷 * @return 閾炬帴绫诲瀷瀵硅薄 */ 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..b2d484d 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,16 +1,33 @@ 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.omd.dataType.VTDataType; +import com.vci.pagemodel.OsEnumItemVO; +import com.vci.pagemodel.OsEnumVO; +import com.vci.pagemodel.OsUsedAttributeVO; +import com.vci.starter.poi.bo.WriteExcelData; +import com.vci.starter.poi.bo.WriteExcelOption; +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.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; @@ -21,7 +38,11 @@ import org.springframework.stereotype.Service; import org.springframework.util.CollectionUtils; +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 +73,35 @@ @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; /** * 榛樿鐨勫睘鎬� @@ -126,6 +176,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],1,1); + if(Func.isNotEmpty(attributeDefs)){ + Arrays.stream(attributeDefs).forEach(attributeDef -> { + osAttributeVOS.add(attributeDO2VO(attributeDef)); + }); + } + } + return osAttributeVOS; + } + + /** * 灞炴�х殑鏁版嵁瀵硅薄杞崲涓烘樉绀哄璞� * * @param attribItems 鏁版嵁瀵硅薄 @@ -167,6 +237,8 @@ attributeVO.setAttributeDataTypeText(VciFieldTypeEnum.getTextByValue(attribItem.vtDataType)); attributeVO.setDefaultValue(attribItem.defValue); attributeVO.setRange(attribItem.rage); + attributeVO.setOther(attribItem.other); + //澶勭悊鍙傜収鐩稿叧灞炴�� if(StringUtils.isNotBlank(attribItem.other)) { if (isReferAttr(attribItem.other)) { //璇存槑杩欎釜鐨勭‘鏄弬鐓у瓧娈� @@ -364,6 +436,459 @@ } /** + * 娣诲姞鍗曟潯灞炴�� + * @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瀵硅薄杞崲涓哄瓨鍌ㄦ墍闇�瀵硅薄 + 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 = 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.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(); + attributeDef.rage = Func.isBlank(osAttributeDTO.getRange()) ? "" : osAttributeDTO.getRange(); + attributeDef.creator = Func.isBlank(osAttributeDTO.getCreator()) ? WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId():osAttributeDTO.getCreator(); + attributeDef.ts = Func.format((Func.isNotEmpty(osAttributeDTO.getTs()) ? osAttributeDTO.getTs():new Date()),VciDateUtil.DateTimeMillFormat); + attributeDef.createTime = Func.isEmpty(osAttributeDTO.getCreateTime()) ? System.currentTimeMillis():osAttributeDTO.getCreateTime().getTime(); + attributeDef.modifier = 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(";"); + //閾炬帴绫诲瀷鏆傛椂涓嶆敮鎸� + } + 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[]{"娉ㄦ剰锛氬睘鎬у悕鍙兘涓鸿嫳鏂囧瓧姣�!"+ NAME_MAX_LENGTH}); + } + + 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.getPrecisionLength())); + excelDataList.add(new WriteExcelData(i+1,12, osAttributeVO.getScaleLength())); + excelDataList.add(new WriteExcelData(i+1,13, osAttributeVO.getRange())); + excelDataList.add(new WriteExcelData(i+1,14, osAttributeVO.getCreateTime())); + } + } + WriteExcelOption excelOption = new WriteExcelOption(excelDataList); + ExcelUtil.writeDataToFile(excelPath, excelOption); + return excelPath; + } + + /** * 鏄惁榛樿鐨勫睘鎬� * * @param attr 灞炴�х紪鍙� @@ -396,7 +921,6 @@ return false; } - /** * 鏄惁涓烘灇涓剧殑灞炴�� * @param other 閰嶇疆鐨勫唴瀹� @@ -416,7 +940,6 @@ return false; } - /** * 娓呴櫎缂撳瓨 */ @@ -424,4 +947,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 05f3a5c..e81815d 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 @@ -2,17 +2,14 @@ import com.alibaba.fastjson.JSON; import com.vci.corba.common.PLException; -import com.vci.corba.common.data.UserEntityInfo; import com.vci.corba.omd.data.BusinessObject; import com.vci.corba.omd.etm.EnumItem; import com.vci.corba.omd.etm.EnumType; import com.vci.dto.OsEnumDTO; import com.vci.dto.OsEnumItemDTO; -import com.vci.dto.SmUserDTO; import com.vci.omd.utils.ObjectTool; import com.vci.pagemodel.*; import com.vci.po.OsEnumPO; -import com.vci.po.SmUserPO; import com.vci.starter.poi.bo.ReadExcelOption; import com.vci.starter.poi.bo.WriteExcelData; import com.vci.starter.poi.bo.WriteExcelOption; @@ -253,18 +250,18 @@ if(Func.isBlank(enumName)){ throw new PLException("500",new String[]{"璇烽�夋嫨瑕佹煡璇㈠簲鐢ㄨ寖鍥寸殑鏋氫妇!"}); } - String[] attrubyteNames = platformClientUtil.getAttributeService().getAttrubyteNamesByEMName(enumName); - if(Func.isEmpty(attrubyteNames)){ + String[] attrubuteNames = platformClientUtil.getAttributeService().getAttrubyteNamesByEMName(enumName); + if(Func.isEmpty(attrubuteNames)){ return new ArrayList<>(); } - List<Map<String,String>> attrubyteMapList = new ArrayList<>(); - Arrays.stream(attrubyteNames).forEach(attrName->{ + 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); - attrubyteMapList.add(itemMap); + attrubuteMapList.add(itemMap); }); - return attrubyteMapList; + return attrubuteMapList; } /** @@ -362,12 +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 + "銆�,宸茶寮曠敤锛�"}); + throw new PLException("500",new String[]{"鍒犻櫎鐨勬灇涓句腑锛屾灇涓惧悕绉颁负锛氥��" + name + "銆�,宸茶寮曠敤锛�"}); } EnumType enumType = new EnumType(); enumType.oid = oid; @@ -617,12 +614,6 @@ return BaseResult.success("鏋氫妇瀵煎叆鎴愬姛锛�"); } - /* private OsEnumVO getTestJson(int i){ - String testJosn = "[{\"createTime\":\"2024-07-17 17:06:30.170\",\"creator\":\"developer\",\"enumValueDataType\":\"String\",\"enumValueDataTypeText\":\"瀛楃涓瞈",\"id\":\"test\",\"items\":[{\"description\":\"\",\"name\":\"1\",\"value\":\"11\"},{\"description\":\"\",\"name\":\"1\",\"value\":\"11\"}],\"lastModifier\":\"developer\",\"lastModifyTime\":\"2024-07-17 17:06:30.170\",\"length\":2,\"name\":\"test1\",\"oid\":\"4F9B4094-A4F5-E3CD-AC7C-1F33AA65F1E7\",\"ts\":\"2024-07-18 09:40:52.512\"},{\"createTime\":\"2024-07-17 09:49:31.592\",\"creator\":\"developer\",\"description\":null,\"enumValueDataType\":\"String\",\"enumValueDataTypeText\":\"瀛楃涓瞈",\"id\":\"testString\",\"items\":[{\"description\":\"11\",\"name\":\"11\",\"value\":\"11\"},{\"description\":\"\",\"name\":\"test1\",\"value\":\"1\"},,{\"description\":\"\",\"name\":\"test1\",\"value\":\"1\"}],\"lastModifier\":\"developer\",\"lastModifyTime\":\"2024-07-17 09:49:31.592\",\"length\":6,\"name\":\"testString\",\"oid\":\"AB3A7718-55C6-555E-A1FD-934763ACA3F2\",\"ts\":\"2024-07-17 16:47:33.038\"}]"; - List<OsEnumVO> OsEnumVOs = JSON.parseArray(testJosn,OsEnumVO.class); - return OsEnumVOs.get(i); - }*/ - /** * 鑾峰彇瀵煎叆妯℃澘鐨勭ず渚嬫暟鎹� * @return @@ -671,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(); @@ -937,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..53145ae 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; @@ -327,4 +328,85 @@ 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 1744e78..abfa562 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