From b8d0022a3c40c59322661e8eee568643fdeb9c50 Mon Sep 17 00:00:00 2001 From: xiejun <xiejun@vci-tech.com> Date: 星期五, 13 九月 2024 10:25:12 +0800 Subject: [PATCH] 人员选择接口添加 --- Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/RoleRightDTO.java | 12 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java | 2 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java | 9 Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/SmUserQueryServiceImpl.java | 167 ++++++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/data.s.json | 94 +++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java | 15 + Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/enumpck/OrgTypeEnum.java | 112 ++++++++ Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java | 347 ++++++++++++++++++-------- 8 files changed, 646 insertions(+), 112 deletions(-) diff --git a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/RoleRightDTO.java b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/RoleRightDTO.java index 4e3b571..9e12631 100644 --- a/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/RoleRightDTO.java +++ b/Source/plt-web/plt-web-parent/plt-web-api/src/main/java/com/vci/dto/RoleRightDTO.java @@ -36,10 +36,10 @@ /**鏂板鏁版嵁鍒涘缓鑰咃紝淇敼鑰咃紝鍒涘缓鏃堕棿锛屼慨鏀规椂闂达紝鎺堟潈鑰�***/ private String createUser = ""; - private Date createTime = new Date(); + private String createTime= ""; private String licensor = ""; private String modifyUser = ""; - private Date modifyTime = new Date(); + private String modifyTime = ""; public String getId() { return id; @@ -89,11 +89,11 @@ this.createUser = createUser; } - public Date getCreateTime() { + public String getCreateTime() { return createTime; } - public void setCreateTime(Date createTime) { + public void setCreateTime(String createTime) { this.createTime = createTime; } @@ -113,11 +113,11 @@ this.modifyUser = modifyUser; } - public Date getModifyTime() { + public String getModifyTime() { return modifyTime; } - public void setModifyTime(Date modifyTime) { + public void setModifyTime(String modifyTime) { this.modifyTime = modifyTime; } } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java index 139b5d8..38889a2 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/SmUserQueryServiceI.java @@ -160,6 +160,15 @@ */ List<Tree> refTreeUsers(TreeQueryObject treeQueryObject) throws VciBaseException; + /*** + * 浜哄憳鏉冮檺閫夋嫨鏍� + * @param treeQueryObject + * @return + * @throws VciBaseException + */ + List<Tree> refPersonOrgTree(TreeQueryObject treeQueryObject) throws VciBaseException; + + /** * 鏍¢獙瀵嗙爜鏄惁鐩稿悓锛屽湪鏂板钩鍙颁腑瀛樺偍鐨勫瘑鐮佹槸涓ゆmd5 * @param userOid 鐢ㄦ埛涓婚敭 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 6a52208..3357a53 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 @@ -1,5 +1,7 @@ package com.vci.frameworkcore.compatibility.impl; +import com.vci.corba.framework.data.DeptInfo; +import com.vci.corba.framework.data.RoleInfo; import com.vci.dto.SmUserDTO; import com.vci.common.util.ThreeDES; import com.vci.corba.common.PLException; @@ -10,6 +12,7 @@ import com.vci.frameworkcore.compatibility.SmPwdStrategyQueryServiceI; import com.vci.frameworkcore.compatibility.SmRoleQueryServiceI; import com.vci.frameworkcore.compatibility.SmUserQueryServiceI; +import com.vci.frameworkcore.enumpck.OrgTypeEnum; import com.vci.model.SmUserDO; import com.vci.pagemodel.SmUserVO; import com.vci.po.SmUserPO; @@ -36,6 +39,7 @@ import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; import org.apache.poi.hssf.util.HSSFColor; +import org.apache.poi.ss.formula.functions.T; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -942,7 +946,168 @@ return treeList; } - /** + /** + * 鑾峰彇瑙掕壊鏁版嵁 + * @param treeQueryObject + * @return + * @throws VciBaseException + */ + @Override + public List<Tree> refPersonOrgTree(TreeQueryObject treeQueryObject) throws VciBaseException { + List<Tree> rootTreeList=new ArrayList<>(); + Map<String,String> conditionMap=treeQueryObject.getConditionMap(); + if(CollectionUtils.isEmpty(conditionMap)) { + conditionMap = new HashMap<>(); + } + String dataType=StringUtils.isNotBlank(conditionMap.get("dataType"))?conditionMap.get("dataType"):"";//鏁版嵁绫诲瀷 + String parentId=StringUtils.isNotBlank(conditionMap.get("parentId"))?conditionMap.get("parentId"):"";//鐖惰妭鐐� + String orgType=StringUtils.isNotBlank(conditionMap.get("orgType"))?conditionMap.get("orgType"):"";//鎺ュ彛鏌ヨ鍖呭惈鐨勭被鍨� + try { + initChildTree(dataType,orgType,parentId,rootTreeList); + } catch (PLException e) { + throw new VciBaseException("鐢ㄦ埛鏉冮檺閫夋嫨鏍戝姞杞藉け璐�:"+e.getMessage()); + } + return rootTreeList; + } + + /*** + * + * @param dataType + * @param orgType + * @param parentId + */ + private void initChildTree(String dataType,String orgType, String parentId, List<Tree>rootTreeList) throws PLException { + if(StringUtils.isBlank(parentId)){ + Tree rootTree=new Tree("root","浜哄憳缁勭粐","root"); + rootTree.setParentBtmName("root"); + rootTree.setExpanded(true); + List<Tree> childList=new ArrayList<>(); + if(OrgTypeEnum.ORG_TYPE_USER.getValue().equals(orgType)){//濡傛灉鏄汉鍛� + Tree userTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_USER.getValue(),"鐢ㄦ埛",OrgTypeEnum.ORG_TYPE_USER.getValue(),OrgTypeEnum.ORG_TYPE_USER.getValue(),rootTree); + childList.add(userTree); + }else if(OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(orgType)){//濡傛灉鏄儴闂� + Tree departmentTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_DEPT.getValue(),"閮ㄩ棬",OrgTypeEnum.ORG_TYPE_DEPT.getValue(),OrgTypeEnum.ORG_TYPE_DEPT.getValue(),rootTree); + childList.add(departmentTree); + }else if(OrgTypeEnum.ORG_TYPE_ROLE.getValue().equals(orgType)){//濡傛灉鏄鑹� + Tree roleTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_ROLE.getValue(),"瑙掕壊",OrgTypeEnum.ORG_TYPE_ROLE.getValue(),OrgTypeEnum.ORG_TYPE_ROLE.getValue(),rootTree); + childList.add(roleTree); + }else{ + Tree userTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_USER.getValue(),"鐢ㄦ埛",OrgTypeEnum.ORG_TYPE_USER.getValue(),OrgTypeEnum.ORG_TYPE_USER.getValue(),rootTree); + childList.add(userTree); + Tree departmentTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_DEPT.getValue(),"閮ㄩ棬",OrgTypeEnum.ORG_TYPE_DEPT.getValue(),OrgTypeEnum.ORG_TYPE_DEPT.getValue(),rootTree); + childList.add(departmentTree); + Tree roleTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_ROLE.getValue(),"瑙掕壊",OrgTypeEnum.ORG_TYPE_ROLE.getValue(),OrgTypeEnum.ORG_TYPE_ROLE.getValue(),rootTree); + childList.add(roleTree); + } + if(childList.size()>0){ + rootTree.setExpanded(true); + rootTree.setChildren(childList); + } + rootTreeList.add(rootTree); + }else{ + if(OrgTypeEnum.ORG_TYPE_ROOT.getValue().equals(dataType)){//濡傛灉鐖惰妭鐐规湁鍊硷紝鍒欓渶瑕佸垽鏂槸鍔犺浇浠�涔堣妭鐐� + Tree rootTree=new Tree("root","浜哄憳缁勭粐","root"); + rootTree.setParentBtmName("root"); + rootTree.setExpanded(true); + if(OrgTypeEnum.ORG_TYPE_USER.getValue().equals(orgType)){//濡傛灉鏄汉鍛� + Tree userTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_USER.getValue(),"鐢ㄦ埛",OrgTypeEnum.ORG_TYPE_USER.getValue(),OrgTypeEnum.ORG_TYPE_USER.getValue(),rootTree); + rootTreeList.add(userTree); + }else if(OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(orgType)){//濡傛灉鏄儴闂� + Tree departmentTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_DEPT.getValue(),"閮ㄩ棬",OrgTypeEnum.ORG_TYPE_DEPT.getValue(),OrgTypeEnum.ORG_TYPE_DEPT.getValue(),rootTree); + rootTreeList.add(departmentTree); + }else if(OrgTypeEnum.ORG_TYPE_ROLE.getValue().equals(orgType)){//濡傛灉鏄鑹� + Tree roleTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_ROLE.getValue(),"瑙掕壊",OrgTypeEnum.ORG_TYPE_ROLE.getValue(),OrgTypeEnum.ORG_TYPE_ROLE.getValue(),rootTree); + rootTreeList.add(roleTree); + }else{ + Tree userTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_USER.getValue(),"鐢ㄦ埛",OrgTypeEnum.ORG_TYPE_USER.getValue(),OrgTypeEnum.ORG_TYPE_USER.getValue(),rootTree); + rootTreeList.add(userTree); + Tree departmentTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_DEPT.getValue(),"閮ㄩ棬",OrgTypeEnum.ORG_TYPE_DEPT.getValue(),OrgTypeEnum.ORG_TYPE_DEPT.getValue(),rootTree); + rootTreeList.add(departmentTree); + Tree roleTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_ROLE.getValue(),"瑙掕壊",OrgTypeEnum.ORG_TYPE_ROLE.getValue(),OrgTypeEnum.ORG_TYPE_ROLE.getValue(),rootTree); + rootTreeList.add(roleTree); + } + }else if(OrgTypeEnum.ORG_TYPE_USER.getValue().equals(dataType)) {//濡傛灉浼犺繘鏉ョ殑鏄痷ser鑺傜偣 + if(OrgTypeEnum.ORG_TYPE_USER.getValue().equals(parentId)) { + Tree userTree = initDataTreeNode(OrgTypeEnum.ORG_TYPE_USER.getValue(), "鐢ㄦ埛", OrgTypeEnum.ORG_TYPE_USER.getValue(), OrgTypeEnum.ORG_TYPE_USER.getValue(), null); + UserInfo[] infos = platformClientUtil.getFrameworkService().fetchUserInfo(); + Arrays.stream(infos).forEach(info -> { + Tree childTree = initDataTreeNode(info.id, info.trueName + "(" + info.userName + ")", info, OrgTypeEnum.ORG_TYPE_USER.getValue(), userTree); + rootTreeList.add(childTree); + }); + } + }else if(OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(dataType)) {//濡傛灉鏄儴闂� + DeptInfo[] deptInfos=new DeptInfo[]{}; + Tree departmentTree=new Tree(); + if(OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(parentId)) { + departmentTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_DEPT.getValue(),"閮ㄩ棬",OrgTypeEnum.ORG_TYPE_DEPT.getValue(),OrgTypeEnum.ORG_TYPE_DEPT.getValue(),null); + deptInfos = platformClientUtil.getFrameworkService().fetchDepartmentInfo(); + }else{ + deptInfos=platformClientUtil.getFrameworkService().fetchDepartmentInfoByParentId(parentId); + DeptInfo deptInfo=platformClientUtil.getFrameworkService().fetchDepartmentInfoById(parentId); + departmentTree=initDataTreeNode(deptInfo.id,deptInfo.name,deptInfo,OrgTypeEnum.ORG_TYPE_DEPT.getValue(),null); + } + if(!CollectionUtils.isEmpty(Arrays.asList(deptInfos))){ + Tree finalDepartmentTree = departmentTree; + Arrays.stream(deptInfos).forEach(deptInfo -> { + Tree childTree=initDataTreeNode(deptInfo.id,deptInfo.name,deptInfo,OrgTypeEnum.ORG_TYPE_DEPT.getValue(), finalDepartmentTree); + rootTreeList.add(childTree); + }); + } + if(!OrgTypeEnum.ORG_TYPE_DEPT.getValue().equals(parentId)) { + UserInfo[] infos = platformClientUtil.getFrameworkService().getUserByDeptId(parentId); + if (infos != null && infos.length > 0) { + Tree finalDepartmentTree = departmentTree; + Arrays.stream(infos).forEach(info -> { + Tree childTree = initDataTreeNode(info.id, info.trueName + "(" + info.userName + ")", info, OrgTypeEnum.ORG_TYPE_USER.getValue(), finalDepartmentTree); + rootTreeList.add(childTree); + }); + } + } + + }else if(OrgTypeEnum.ORG_TYPE_ROLE.getValue().equals(dataType)) {//濡傛灉鏄鑹� + if(OrgTypeEnum.ORG_TYPE_ROLE.getValue().equals(parentId)){ + Tree roleTree=initDataTreeNode(OrgTypeEnum.ORG_TYPE_ROLE.getValue(),"瑙掕壊",OrgTypeEnum.ORG_TYPE_ROLE.getValue(),OrgTypeEnum.ORG_TYPE_ROLE.getValue(),null); + RoleInfo[] roleInfos=platformClientUtil.getFrameworkService().fetchRoleInfo(); + if(roleInfos!=null&&roleInfos.length>0) { + Arrays.stream(roleInfos).forEach(info -> { + Tree childTree = initDataTreeNode(info.id, info.name, info, OrgTypeEnum.ORG_TYPE_ROLE.getValue(), roleTree); + rootTreeList.add(childTree); + }); + } + }else{ + RoleInfo roleInfo=platformClientUtil.getFrameworkService().fetchRoleInfoById(parentId); + Tree roleTree=initDataTreeNode(roleInfo.id,roleInfo.name,roleInfo,OrgTypeEnum.ORG_TYPE_ROLE.getValue(),null); + UserInfo[] infos=platformClientUtil.getFrameworkService().fetchUserInfoByRoleId(roleInfo.id,roleInfo.type); + if(infos!=null&&infos.length>0) { + Arrays.stream(infos).forEach(info -> { + Tree childTree = initDataTreeNode(info.id, info.trueName + "(" + info.userName + ")", info, OrgTypeEnum.ORG_TYPE_USER.getValue(), roleTree); + rootTreeList.add(childTree); + }); + } + } + } + } + } + + /*** + * + * @param oid + * @param text + * @param o + * @param type + * @param parentTree + * @return + */ + private Tree initDataTreeNode(String oid,String text,Object o,String type,Tree parentTree){ + Tree ObjectTreeNode=new Tree(oid,text,o); + ObjectTreeNode.setParentBtmName(type); + if(parentTree!=null) { + ObjectTreeNode.setParentId(parentTree.getParentId()); + ObjectTreeNode.setParentName(parentTree.getParentName()); + } + return ObjectTreeNode; + } + /** * 鏍¢獙瀵嗙爜鏄惁鐩稿悓锛屽湪鏂板钩鍙颁腑瀛樺偍鐨勫瘑鐮佹槸涓ゆmd5 * @param userOid 鐢ㄦ埛涓婚敭 * @param md5Password 宸茬粡md5鍔犲瘑涓�娆$殑瀵嗙爜--鑰佺殑骞冲彴閲屼笉鑳藉姞瀵� diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java index 375ec71..c13c9ac 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/controller/SmUserQueryController.java @@ -348,4 +348,19 @@ } } + /** + * 鐢ㄦ埛鏉冮檺閫夋嫨鏍� + * @param treeQueryObject 鏍戝舰鏁版嵁鐨勬煡璇㈠璞★紝鍖呮嫭鏌ヨ鏉′欢锛屼笂绾т富閿紝鏄惁澶氶�夌瓑锛屽嵆鍏佽浣跨敤SmUserVO閲岀殑鎵�鏈夊睘鎬т綔涓烘煡璇㈡潯浠讹紝涔熷彲浠ヤ娇鐢╬kRole.xxx锛宲kDepartment.xxx,pkDuty.xxx杩欐牱鏉ユ煡璇� + * @return 鏅�氱敤鎴凤紙涓嶅寘鍚笁鍛橈紝涔熶笉鍖呭惈鍋滅敤鐨勶級鐨勬爲褰㈡暟鎹紝宸茬粡杞崲杩囦笂涓嬬骇鍏崇郴锛岃鑾峰彇鍏朵腑鐨則reeData灞炴�� + * @throws VciBaseException 鏌ヨ鍑洪敊鐨勬椂鍊欎細鎶涘嚭寮傚父锛屽鏋滄槸鑰佺殑椤圭洰閲屼笉鎶涘嚭寮傚父 + */ + @RequestMapping(value = "/refPersonOrgTree",method = RequestMethod.GET) + public BaseResult<Tree> refPersonOrgTree(TreeQueryObject treeQueryObject) throws VciBaseException{ + List<Tree> userTreeList = userQueryService.refPersonOrgTree(treeQueryObject); + return BaseResult.tree(userTreeList); + //鑰佺殑椤圭洰渚濈劧鏄坊鍔爐ry catch锛屾柟娉曢噷涓嶆姏鍑哄紓甯� + //BaseResult.fail("杩欓噷杩斿洖鍓嶇鐨勯敊璇俊鎭�"); + } + + } diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/enumpck/OrgTypeEnum.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/enumpck/OrgTypeEnum.java new file mode 100644 index 0000000..c1552b2 --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/enumpck/OrgTypeEnum.java @@ -0,0 +1,112 @@ +package com.vci.frameworkcore.enumpck; +import com.vci.starter.web.enumpck.BaseEnum; + +/** + * @author xj + * @date 2024-09-12 + * 浜哄憳閫夋嫨缁勭粐绫诲瀷 + */ +public enum OrgTypeEnum implements BaseEnum { + /** + * 鏍规帴鐐� + */ + ORG_TYPE_ROOT("root","浜哄憳缁勭粐"), + + /** + * 鏌ヨ鎵�鏈夌被鍨嬶細浜哄憳锛岄儴闂紝瑙掕壊 + */ + ORG_TYPE_ALL("all","鎵�鏈�"), + /** + * 閮ㄩ棬 + */ + ORG_TYPE_DEPT("department","閮ㄩ棬"), + + /** + * 瑙掕壊 + */ + ORG_TYPE_ROLE("role","瑙掕壊"), + + ORG_TYPE_USER("user","浜哄憳"); + + /** + * 鏋氫妇鐨勫�� + */ + private String value; + + /** + * 鏋氫妇鏄剧ず鏂囨湰 + */ + private String text; + + /** + * 鑾峰彇鏋氫妇鍊� + * @return 鏋氫妇鍊� + */ + @Override + public String getValue() { + return value; + } + + /** + * 璁剧疆鏋氫妇鍊� + * @param value 鏋氫妇鍊� + */ + public void setValue(String value) { + this.value = value; + } + + /** + * 鑾峰彇鏋氫妇鏄剧ず鏂囨湰 + * @return 鏄剧ず鏂囨湰 + */ + @Override + public String getText() { + return text; + } + + /** + * 璁剧疆鏄剧ず鏂囨湰 + * @param text 鏄剧ず鏂囨湰 + */ + public void setText(String text) { + this.text = text; + } + + /** + * 鏋勯�犲嚱鏁� + * @param value 鍊� + * @param text 鏄剧ず鏂囨湰 + */ + private OrgTypeEnum(String value, String text){ + this.value = value; + this.text = text; + } + + /** + * 鏍规嵁鍚嶇О鑾峰彇瀵瑰簲鐨勬灇涓惧�� + * @param text 鍚嶇О + * @return 鏋氫妇鍊� + */ + public static String getValueByText(String text){ + for(OrgTypeEnum wenum : OrgTypeEnum.values()){ + if(wenum.getText().equalsIgnoreCase(text)){ + return wenum.getValue(); + } + } + return ""; + } + + /** + * 鏍规嵁鏋氫妇鍊艰幏鍙栧悕绉� + * @param value 鏋氫妇鍊� + * @return 鍚嶇О + */ + public static String getTextByValue(String value){ + for(OrgTypeEnum wenum : OrgTypeEnum.values()){ + if(wenum.getValue().equalsIgnoreCase(value)){ + return wenum.getText(); + } + } + return ""; + } +} diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java index ad31810..233f31b 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/UIManagerController.java @@ -506,7 +506,7 @@ */ @PostMapping( "/authorizedUI") @VciBusinessLog(operateName = "UI鎺堟潈") - public BaseResult authorizedUI(UIAuthorDTO uiAuthorDTO){ + public BaseResult authorizedUI(@RequestBody UIAuthorDTO uiAuthorDTO){ try { return uiManagerService.authorizedUI(uiAuthorDTO)?BaseResult.success("鎺堟潈鎴愬姛!"):BaseResult.fail("鎺堟潈澶辫触锛�"); }catch (Throwable e) { diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/data.s.json b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/data.s.json new file mode 100644 index 0000000..57196ad --- /dev/null +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/controller/data.s.json @@ -0,0 +1,94 @@ +{ + "code": 200, + "data": null, + "exceptionClassName": null, + "exceptionCode": null, + "exceptionObjs": null, + "finishTime": 1726130668800, + "msg": "", + "msgObjs": null, + "obj": null, + "requestTraceId": null, + "success": true, + "total": 0, + "traceId": "71bfe687-1112-47c3-9fe5-45ae9f7b7228", + "treeData": [ + { + "attributes": {}, + "checked": false, + "children": [ + { + "attributes": {}, + "checked": false, + "children": [], + "data": "user", + "expanded": false, + "href": null, + "icon": null, + "iconCls": null, + "index": null, + "leaf": false, + "level": 0, + "oid": "user", + "parentBtmName": "user", + "parentId": null, + "parentName": null, + "showCheckbox": false, + "text": "鐢ㄦ埛" + }, + { + "attributes": {}, + "checked": false, + "children": [], + "data": "department", + "expanded": false, + "href": null, + "icon": null, + "iconCls": null, + "index": null, + "leaf": false, + "level": 0, + "oid": "department", + "parentBtmName": "department", + "parentId": null, + "parentName": null, + "showCheckbox": false, + "text": "閮ㄩ棬" + }, + { + "attributes": {}, + "checked": false, + "children": [], + "data": "role", + "expanded": false, + "href": null, + "icon": null, + "iconCls": null, + "index": null, + "leaf": false, + "level": 0, + "oid": "role", + "parentBtmName": "role", + "parentId": null, + "parentName": null, + "showCheckbox": false, + "text": "瑙掕壊" + } + ], + "data": "root", + "expanded": true, + "href": null, + "icon": null, + "iconCls": null, + "index": null, + "leaf": false, + "level": 0, + "oid": "root", + "parentBtmName": "root", + "parentId": null, + "parentName": null, + "showCheckbox": false, + "text": "浜哄憳缁勭粐" + } + ] +} \ No newline at end of file diff --git a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java index d85f3ef..b58b9f9 100644 --- a/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java +++ b/Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/web/service/impl/UIManagerServiceImpl.java @@ -1,8 +1,10 @@ package com.vci.web.service.impl; +import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSON; import com.vci.common.utility.ObjectUtility; import com.vci.corba.common.PLException; +import com.vci.corba.common.data.UserEntityInfo; import com.vci.corba.framework.data.RoleRightInfo; import com.vci.corba.omd.btm.BizType; import com.vci.corba.portal.PortalService; @@ -39,6 +41,7 @@ import javax.annotation.Resource; import java.io.File; import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import java.util.regex.Pattern; @@ -57,6 +60,11 @@ @Resource private PlatformClientUtil platformClientUtil; + /** + * 瑙掕壊 + */ + @Resource + private SmRoleQueryServiceI smRoleQueryServiceI; /*** * 鏄惁鏄鐞嗗憳 */ @@ -136,7 +144,7 @@ public List<PLUILayout> getUIContextDataByBtName(String btemName,String context) throws PLException { VciBaseUtil.alertNotNull(btemName,"涓氬姟绫诲瀷"); List<PLUILayout> pluiLayoutList=new ArrayList<>(); - List<String> contextList= VciBaseUtil.str2List(context); + List<String> contextList= new ArrayList<>(); if(StringUtils.isNotBlank(context)){ contextList=VciBaseUtil.str2List(context); }else{ @@ -1298,7 +1306,7 @@ String userName= WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); RoleRightInfo[] rightInfos= platformClientUtil.getFrameworkService().getRoleRightList(roleId,userName); List<RoleRightVO> roleRightVOList=roleRightDOO2VOS(Arrays.asList(rightInfos)); - roleRightVOMap=roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO)); + roleRightVOMap=roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO,(oldValue,newOldValue)->oldValue)); } BizType[] bizTypes=osBtmServiceI.getBizTypes(type); List<Tree> treeList=new ArrayList<>(); @@ -1316,12 +1324,10 @@ bizTypeTree.setShowCheckbox(true); bizTypeTree.setParentBtmName(bizTypes[i].name); childList.add(bizTypeTree); - if(roleRightVOMap.containsKey(bizTypes[i].oid)){ - List<PLUILayout>contextList=getUIContextDataByBtName(bizTypes[i].name,context); - List<Tree> btmChildList=new ArrayList<>(); - btmChildList.add(bizTypeTree); - setChildNode(btmChildList,contextList,roleRightVOMap,showCheckBox); - } + List<PLUILayout>contextList=getUIContextDataByBtName(bizTypes[i].name,context); + List<Tree> btmChildList=new ArrayList<>(); + btmChildList.add(bizTypeTree); + setChildNode(btmChildList,contextList,roleRightVOMap,showCheckBox); } rootNode.setChildren(childList); treeList.add(rootNode); @@ -1349,48 +1355,96 @@ treeQueryObject.setConditionMap(conditionMap); List<Tree> treeList=this.getUIAuthor(treeQueryObject); HashMap<String,Tree> allTreeMap=new HashMap<>(); - Map<String,RoleRightVO> roleRightVOMap=new HashMap<>(); + Map<String,RoleRightDTO> roleRightVOMap=new HashMap<>(); if(!CollectionUtil.isEmpty(treeList)){ if(StringUtils.isNotBlank(uiAuthorDTO.getRoleId())){ String userName= WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(); RoleRightInfo[] rightInfos= platformClientUtil.getFrameworkService().getRoleRightList(uiAuthorDTO.getRoleId(),userName); List<RoleRightVO> roleRightVOList=roleRightDOO2VOS(Arrays.asList(rightInfos)); - roleRightVOMap=roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVO)); + roleRightVOMap=roleRightVOList.stream().collect(Collectors.toMap(RoleRightVO::getFuncId,roleRightVO ->roleRightVOO2DTO(roleRightVO),(oldValue,newValue)->oldValue)); } convertTreeDOO2Map(treeList,allTreeMap); List<RoleRightDTO> roleRightDTOList=new ArrayList<>(); List<Tree> selectTreeList= uiAuthorDTO.getSelectTreeList(); - getSelectedRoleRightObjs(uiAuthorDTO.getRoleId(),selectTreeList,allTreeMap,roleRightDTOList); + getSelectedRoleRightObjs(uiAuthorDTO.getRoleId(),selectTreeList,allTreeMap,roleRightVOMap,roleRightDTOList); + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); + String currentUserName = sessionInfo.getUserId(); + boolean isDeveloper= rightControlUtil.isDeveloper(currentUserName); + List<RoleRightInfo> roleRightInfoList= roleRightDTOO2InfoS(roleRightDTOList); + UserEntityInfo info=new UserEntityInfo(); + info.modules="UI鎺堟潈"; + info.userName=currentUserName; + try { + res= platformClientUtil.getFrameworkService().saveRoleRight(roleRightInfoList.toArray(new RoleRightInfo[]{}),uiAuthorDTO.getRoleId(),currentUserName,info); + }catch (PLException e){ + throw new Exception("淇濆瓨澶辫触锛�"+e.getMessage()); + } } return res; } /** - * + *鏍规嵁鏉冮檺璁$畻涓婁笅鏉冮檺 * @param roleOid * @param selectTreeList * @param allTreeMap * @param roleRightDTOList */ - private void getSelectedRoleRightObjs(String roleOid,List<Tree> selectTreeList,HashMap<String,Tree> allTreeMap, List<RoleRightDTO> roleRightDTOList){ + private void getSelectedRoleRightObjs(String roleOid,List<Tree> selectTreeList,HashMap<String,Tree> allTreeMap,Map<String,RoleRightDTO> allRoleRightDTOMap, List<RoleRightDTO> roleRightDTOList){ Date date=new Date(); Map<String,RoleRightDTO> roleRightDTOMap=new HashMap<>(); - selectTreeList.stream().forEach(tree -> { - RoleRightDTO roleRightDTO=new RoleRightDTO(); - String id=ObjectUtility.getNewObjectID36(); - Object data= tree.getData(); - if(data instanceof String){ - getRightValue(roleOid,tree,allTreeMap,false,roleRightDTOMap);//鍚戜笅鑾峰彇鎵�鏈夋ā鍧楃殑鏉冮檺鍊� - }else if (!(data instanceof PLTabButton)) {//涓氬姟绫诲瀷 - getRightValue(roleOid,tree,allTreeMap,true,roleRightDTOMap);//鍚戜笂澶勭悊 - getRightValue(roleOid,tree,allTreeMap,false,roleRightDTOMap);//鍚戜笅澶勭悊锛堝寘鍚綋鍓嶈妭鐐癸級 - }else if (data instanceof PLTabButton) {//鎸夐挳 + if(!CollectionUtil.isEmpty(selectTreeList)){ + selectTreeList.stream().forEach(tree -> { + String oid=tree.getOid(); + if(allTreeMap.containsKey(oid)){ + tree= allTreeMap.get(oid); + Object data= tree.getData(); + if (data instanceof String) { + getRightValue(roleOid, tree, allTreeMap, false, roleRightDTOMap);//鍚戜笅鑾峰彇鎵�鏈夋ā鍧楃殑鏉冮檺鍊� + } else if (!(data instanceof PLTabButton)) {//涓氬姟绫诲瀷 + getRightValue(roleOid, tree, allTreeMap, true, roleRightDTOMap);//鍚戜笂澶勭悊 + getRightValue(roleOid, tree, allTreeMap, false, roleRightDTOMap);//鍚戜笅澶勭悊锛堝寘鍚綋鍓嶈妭鐐癸級 + } else if (data instanceof PLTabButton) {//鎸夐挳 + String parrentId=tree.getParentId(); + if(allTreeMap.containsKey(parrentId)){ + SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); + String currentUserName = sessionInfo.getUserId(); + boolean isDeveloper= rightControlUtil.isDeveloper(currentUserName); + Tree parentNode= allTreeMap.get(parrentId); + String funcId = parentNode.getOid(); + getRightValue(roleOid,tree, allTreeMap, true, roleRightDTOMap);//鍚戜笂澶勭悊璇ユ搷浣滅埗绾х殑涓婄骇妯″潡鏉冮檺(涓嶅寘鍚埗鑺傜偣) + if(!roleRightDTOMap.containsKey(funcId)){ + RoleRightDTO roleRightDTO = new RoleRightDTO(); + roleRightDTO.setId(ObjectUtility.getNewObjectID36());//涓婚敭 + roleRightDTO.setFuncId(funcId); + if(isDeveloper) { + roleRightDTO.setRightType((short) 1);//鏉冮檺绫诲瀷 鏉冮檺绫诲瀷锛岃秴绾х鐞嗗憳缁欑鐞嗗憳鎺堟潈涓�1锛岀鐞嗗憳缁欐櫘閫氱敤鎴锋巿鏉冧负2 + }else{ + roleRightDTO.setRightType((short) 2); + } + roleRightDTO.setRightValue(1);// 鏉冮檺鍊硷紝娌℃湁鎿嶄綔鐨勬ā鍧楁潈闄愬�煎瓨鍌ㄤ负0 + roleRightDTO.setRoleId(roleOid);//瑙掕壊ID + roleRightDTO.setCreateUser(currentUserName);//鍒涘缓鑰� + roleRightDTO.setCreateTime(VciDateUtil.date2Str(new Date(),""));//鍒涘缓鏃堕棿 + roleRightDTO.setModifyUser(currentUserName);//淇敼鑰� + roleRightDTO.setModifyTime(VciDateUtil.date2Str(new Date(),""));//淇敼鏃堕棿 + roleRightDTO.setLicensor(""); + if(!roleRightDTOMap.containsKey(funcId)){ + roleRightDTOMap.put(funcId, roleRightDTO); + } + roleRightDTOMap.put(funcId, roleRightDTO); + } + } - } - }); + } - - + } + }); + /* allRoleRightDTOMap.putAll(roleRightDTOMap.entrySet().stream() + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry:: getValue)));*/ + List<RoleRightDTO> newRoleRightDTOList=Optional.ofNullable(roleRightDTOMap).orElseGet(()->new HashMap<String,RoleRightDTO>()).values().stream().collect(Collectors.toList()); + roleRightDTOList.addAll(newRoleRightDTOList); + } } /** @@ -1401,28 +1455,28 @@ SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread(); String currentUserName = sessionInfo.getUserId(); boolean isDeveloper= rightControlUtil.isDeveloper(currentUserName); - String parentOid=node.getParentId(); - if(allTreeMap.containsKey(parentOid)){ - String id=ObjectUtility.getNewObjectID36(); - Tree parentNode =allTreeMap.get(parentOid); - Object parentData= parentNode.getData(); - if(isUp) {//鍚戜笂鑾峰彇锛屽瓨鍌ㄦ瘡涓笂绾фā鍧楃殑鏉冮檺鍊� - while (!"root".equals(parentNode.getData())){ + String id=ObjectUtility.getNewObjectID36(); + Object data=node.getData(); + if(isUp) {//鍚戜笂鑾峰彇锛屽瓨鍌ㄦ瘡涓笂绾фā鍧楃殑鏉冮檺鍊� + while (!"root".equals(node.getData())){ + data=node.getData(); + String oid=node.getOid(); + if(allTreeMap.containsKey(oid)){ String funcId = ""; - if (parentData instanceof BizType) { - BizType bizType = (BizType) parentData; + if (data instanceof BizType) { + BizType bizType = (BizType) data; funcId = bizType.name; - } else if (parentData instanceof PLUILayout) { - PLUILayout context = (PLUILayout)parentData; + } else if (data instanceof PLUILayout) { + PLUILayout context = (PLUILayout)data; funcId = context.plOId; - } else if (parentData instanceof PLTabPage) { - PLTabPage tab = (PLTabPage) parentData; + } else if (data instanceof PLTabPage) { + PLTabPage tab = (PLTabPage) data; funcId = tab.plOId; - } else if (parentData instanceof PLPageDefination){ - PLPageDefination pageDef = (PLPageDefination) parentData; + } else if (data instanceof PLPageDefination){ + PLPageDefination pageDef = (PLPageDefination) data; funcId = pageDef.plOId; - } else if (parentData instanceof PLTabButton) { - PLTabButton but = (PLTabButton)parentData; + } else if (data instanceof PLTabButton) { + PLTabButton but = (PLTabButton)data; funcId = but.plOId; } RoleRightDTO roleRightDTO = new RoleRightDTO(); @@ -1436,74 +1490,77 @@ roleRightDTO.setRightValue(1);// 鏉冮檺鍊硷紝娌℃湁鎿嶄綔鐨勬ā鍧楁潈闄愬�煎瓨鍌ㄤ负0 roleRightDTO.setRoleId(roleId);//瑙掕壊ID roleRightDTO.setCreateUser(currentUserName);//鍒涘缓鑰� - roleRightDTO.setCreateTime(new Date());//鍒涘缓鏃堕棿 + roleRightDTO.setCreateTime(VciDateUtil.date2Str(new Date(),""));//鍒涘缓鏃堕棿 roleRightDTO.setModifyUser(currentUserName);//淇敼鑰� - roleRightDTO.setModifyTime(new Date());//淇敼鏃堕棿 + roleRightDTO.setModifyTime(VciDateUtil.date2Str(new Date(),""));//淇敼鏃堕棿 roleRightDTO.setLicensor(""); if(!rightMap.containsKey(funcId)){ rightMap.put(funcId, roleRightDTO); } - } - }else{ - String funcId = ""; - if(parentData instanceof String){ - funcId = (String)parentData; - } else if (parentData instanceof BizType) { - BizType bizType = (BizType)parentData; - funcId = bizType.name; - } else if (parentData instanceof PLUILayout) { - PLUILayout context = (PLUILayout)parentData; - funcId = context.plOId; - } else if (parentData instanceof PLTabPage) { - PLTabPage tab = (PLTabPage) parentData; - funcId = tab.plOId; - } else if (parentData instanceof PLPageDefination){ - PLPageDefination pageDef = (PLPageDefination) parentData; - funcId = pageDef.plOId; - } else if (parentData instanceof PLTabButton) { - PLTabButton but = (PLTabButton)parentData; - funcId = but.plOId; - } - if(!(parentData instanceof PLPageDefination)) {//瀛愯妭鐐逛笉鏄搷浣� - if(!rightMap.containsKey(funcId)&&!funcId.equals("root")){ - RoleRightDTO roleRightDTO = new RoleRightDTO(); - roleRightDTO.setFuncId(funcId); - if(isDeveloper) { - roleRightDTO.setRightType((short) 1);//鏉冮檺绫诲瀷 鏉冮檺绫诲瀷锛岃秴绾х鐞嗗憳缁欑鐞嗗憳鎺堟潈涓�1锛岀鐞嗗憳缁欐櫘閫氱敤鎴锋巿鏉冧负2 - }else{ - roleRightDTO.setRightType((short) 2); - } - roleRightDTO.setRightValue(0);//娌℃湁鎿嶄綔鐨勬ā鍧楁潈闄愬�煎瓨鍌ㄤ负0 - roleRightDTO.setRoleId(roleId); - roleRightDTO.setCreateUser(currentUserName); - roleRightDTO.setCreateTime(new Date()); - roleRightDTO.setModifyUser(currentUserName); - roleRightDTO.setModifyTime(new Date()); - roleRightDTO.setLicensor(""); - rightMap.put(funcId, roleRightDTO); - } - for(int i = 0;i < parentNode.getChildren().size();i++){ - //瀵规瘡涓瓙鍚戜笅閫掑綊閬嶅巻 - getRightValue(roleId,parentNode.getChildren().get(i),allTreeMap,false,rightMap); - } - }else { - if(!rightMap.containsKey(funcId)){ - RoleRightDTO roleRightDTO = new RoleRightDTO(); - roleRightDTO.setFuncId(funcId); - roleRightDTO.setRightType((short)2); // 璁剧疆UI鏉冮檺 - roleRightDTO.setRightValue(countRightValue(parentNode,true));//娌℃湁鎿嶄綔鐨勬ā鍧楁潈闄愬�煎瓨鍌ㄤ负0 - roleRightDTO.setRoleId(roleId); - - roleRightDTO.setCreateUser(currentUserName); - roleRightDTO.setCreateTime(new Date()); - roleRightDTO.setModifyUser(currentUserName); - roleRightDTO.setModifyTime(new Date()); - roleRightDTO.setLicensor(""); - rightMap.put(funcId, roleRightDTO); + oid= node.getParentId(); + if(allTreeMap.containsKey(oid)) { + node=allTreeMap.get(oid); } } } + }else { + String funcId = ""; + if (data instanceof String) { + funcId = (String) data; + } else if (data instanceof BizType) { + BizType bizType = (BizType) data; + funcId = bizType.name; + } else if (data instanceof PLUILayout) { + PLUILayout context = (PLUILayout) data; + funcId = context.plOId; + } else if (data instanceof PLTabPage) { + PLTabPage tab = (PLTabPage) data; + funcId = tab.plOId; + } else if (data instanceof PLPageDefination) { + PLPageDefination pageDef = (PLPageDefination) data; + funcId = pageDef.plOId; + } else if (data instanceof PLTabButton) { + PLTabButton but = (PLTabButton) data; + funcId = but.plOId; + } + if (!(data instanceof PLPageDefination)) {//瀛愯妭鐐逛笉鏄搷浣� + if (!rightMap.containsKey(funcId) && !funcId.equals("root")) { + RoleRightDTO roleRightDTO = new RoleRightDTO(); + roleRightDTO.setFuncId(funcId); + if (isDeveloper) { + roleRightDTO.setRightType((short) 1);//鏉冮檺绫诲瀷 鏉冮檺绫诲瀷锛岃秴绾х鐞嗗憳缁欑鐞嗗憳鎺堟潈涓�1锛岀鐞嗗憳缁欐櫘閫氱敤鎴锋巿鏉冧负2 + } else { + roleRightDTO.setRightType((short) 2); + } + roleRightDTO.setRightValue(0);//娌℃湁鎿嶄綔鐨勬ā鍧楁潈闄愬�煎瓨鍌ㄤ负0 + roleRightDTO.setRoleId(roleId); + roleRightDTO.setCreateUser(currentUserName); + roleRightDTO.setCreateTime(VciDateUtil.date2Str(new Date(),"")); + roleRightDTO.setModifyUser(currentUserName); + roleRightDTO.setModifyTime(VciDateUtil.date2Str(new Date(),"")); + roleRightDTO.setLicensor(""); + rightMap.put(funcId, roleRightDTO); + } + for (int i = 0; i < node.getChildren().size(); i++) { + //瀵规瘡涓瓙鍚戜笅閫掑綊閬嶅巻 + getRightValue(roleId, node.getChildren().get(i), allTreeMap, false, rightMap); + } + } else { + if (!rightMap.containsKey(funcId)) { + RoleRightDTO roleRightDTO = new RoleRightDTO(); + roleRightDTO.setFuncId(funcId); + roleRightDTO.setRightType((short) 2); // 璁剧疆UI鏉冮檺 + roleRightDTO.setRightValue(countRightValue(node, true));//娌℃湁鎿嶄綔鐨勬ā鍧楁潈闄愬�煎瓨鍌ㄤ负0 + roleRightDTO.setRoleId(roleId); + roleRightDTO.setCreateUser(currentUserName); + roleRightDTO.setCreateTime(VciDateUtil.date2Str(new Date(),"")); + roleRightDTO.setModifyUser(currentUserName); + roleRightDTO.setModifyTime(VciDateUtil.date2Str(new Date(),"")); + roleRightDTO.setLicensor(""); + rightMap.put(funcId, roleRightDTO); + } + } } } @@ -1540,6 +1597,13 @@ }); } + /*** + * 閬嶅巻瀛愯妭鐐� + * @param parentTree + * @param contextList + * @param roleRightVOMap + * @param isShowCheckBox + */ private void setChildNode(List<Tree> parentTree, List<PLUILayout>contextList,Map<String,RoleRightVO> roleRightVOMap,boolean isShowCheckBox){ Optional.ofNullable(parentTree).orElseGet(()->new ArrayList<Tree>()).stream().forEach(pTree -> { Object funcObj= pTree.getData(); @@ -1657,6 +1721,24 @@ }); } + + /** + * UI瑙掕壊瀵硅薄杞崲 + * @param vos + * @return + */ + private List<RoleRightDTO> roleRightVOO2DTOS(List<RoleRightVO> vos){ + List<RoleRightDTO> roleRightVOS=new ArrayList<>(); + Optional.ofNullable(vos).orElseGet(()->new ArrayList<>()).stream().forEach(vo -> { + RoleRightDTO dto=roleRightVOO2DTO(vo); + roleRightVOS.add(dto); + }); + + return roleRightVOS; + } + + + /** * UI瑙掕壊瀵硅薄杞崲 * @param infos @@ -1671,7 +1753,25 @@ return roleRightVOS; } + /** + * UI瑙掕壊瀵硅薄杞崲 + * @param dtos + * @return + */ + private List<RoleRightInfo> roleRightDTOO2InfoS(List<RoleRightDTO> dtos){ + List<RoleRightInfo> roleRightInfoList=new ArrayList<>(); + Optional.ofNullable(dtos).orElseGet(()->new ArrayList<>()).stream().forEach(dto -> { + RoleRightInfo info= null; + try { + info = roleRightDTOO2Info(dto); + } catch (Exception e) { + e.printStackTrace(); + } + roleRightInfoList.add(info); + }); + return roleRightInfoList; + } /** * UI瑙掕壊瀵硅薄杞崲 * @param info @@ -1690,6 +1790,45 @@ vo.setModifyTime(VciDateUtil.date2Str(VciDateUtil.long2Date(info.modifyTime),"")); vo.setModifyUser(info.modifyUser); return vo; + } + /** + * UI瑙掕壊瀵硅薄杞崲 + * @param vo + * @return + */ + private RoleRightDTO roleRightVOO2DTO(RoleRightVO vo){ + RoleRightDTO dto=new RoleRightDTO(); + dto.setId(vo.getId()); + dto.setCreateTime(vo.getCreateTime()); + dto.setCreateUser(vo.getCreateUser()); + dto.setRoleId(vo.getRoleId()); + dto.setRightType(vo.getRightType()); + dto.setLicensor(vo.getLicensor()); + dto.setRightValue(vo.getRightValue()); + dto.setFuncId(vo.getFuncId()); + dto.setModifyTime(vo.getModifyTime()); + dto.setModifyUser(vo.getModifyUser()); + return dto; + } + + /** + * UI瑙掕壊瀵硅薄杞崲 + * @param dto + * @return + */ + private RoleRightInfo roleRightDTOO2Info(RoleRightDTO dto) throws Exception { + RoleRightInfo info=new RoleRightInfo(); + info.id=StringUtils.isBlank(dto.getId())?"":dto.getId(); + info.createTime=StringUtils.isBlank(dto.getCreateTime())?new Date().getTime():VciDateUtil.getTime(VciDateUtil.str2Date(dto.getCreateTime(),"")); + info.createUser=StringUtils.isBlank(dto.getCreateUser())?"":dto.getCreateUser(); + info.roleId=StringUtils.isBlank(dto.getRoleId())?"":dto.getRoleId(); + info.rightType=dto.getRightType(); + info.licensor =StringUtils.isBlank(dto.getLicensor())?"":dto.getLicensor(); + info.rightValue=dto.getRightValue(); + info.funcId=StringUtils.isBlank(dto.getFuncId())?"":dto.getFuncId(); + info.modifyTime=StringUtils.isBlank(dto.getModifyTime())? new Date().getTime() :VciDateUtil.getTime(VciDateUtil.str2Date(dto.getModifyTime(),"")); + info.modifyUser=StringUtils.isBlank(dto.getModifyUser())?"":dto.getModifyUser(); + return info; } /** @@ -2393,7 +2532,7 @@ } } else { // 閾炬帴绫诲瀷涓虹┖鏃讹紝鍙渶瑕佹鏌ヤ笟鍔$被鍨嬩笅鐨勬煡璇㈡ā鏉挎槸鍚︽湁鏁� - if(!(super.checkQTNameTxtIsOk("鏌ヨ妯℃澘", queryTemplateName, btmType,true))){ + if(!(super.checkQTNameTxtIsOk("鏌ヨ妯℃澘", queryTemplateName, btmType))){ res = false; return res; } -- Gitblit v1.9.3