From d45e6830c15541053b4d5be1c47afe14842e630a Mon Sep 17 00:00:00 2001 From: ludc Date: 星期四, 27 六月 2024 17:59:19 +0800 Subject: [PATCH] 用户管理界面,增加部门查询、角色下拉查询、分配密码策略接口,联调修改代码上传 --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java | 64 ++++++++++++++++++++++++++++---- 1 files changed, 56 insertions(+), 8 deletions(-) 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 f2a737f..3f73e92 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 @@ -1,5 +1,6 @@ package com.vci.frameworkcore.compatibility.impl; +import com.vci.corba.common.PLException; import com.vci.corba.omd.data.BusinessObject; import com.vci.frameworkcore.compatibility.OrgDeptQueryServiceI; import com.vci.frameworkcore.lcstatuspck.FrameworkDataLCStatus; @@ -20,10 +21,13 @@ import com.vci.starter.web.util.VciBaseUtil; import com.vci.starter.web.wrapper.VciQueryWrapperForDO; import com.vci.web.service.WebBoServiceI; +import com.vci.web.util.Func; +import com.vci.web.util.PlatformClientUtil; import com.vci.web.util.WebUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import java.util.*; @@ -43,6 +47,12 @@ */ @Autowired private WebBoServiceI boService; + + /** + * 骞冲彴璋冪敤瀹㈡埛绔� + */ + @Autowired + private PlatformClientUtil platformClientUtil; /** * 瀵硅薄鎿嶄綔宸ュ叿绫� @@ -179,7 +189,7 @@ if(queryMap == null){ queryMap = new HashMap<>(); } - List<OrgDeptForPlatform1> roles = new ArrayList<>(); + List<OrgDeptForPlatform1> deptForPlatform1s = new ArrayList<>(); if(userOid.contains(",")){ Map<String, String> finalQueryMap = queryMap; WebUtil.switchCollectionForOracleIn(WebUtil.str2List(userOid)).stream().forEach(userOids->{ @@ -191,7 +201,7 @@ VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(conditionMap,OrgDeptForPlatform1.class); List<OrgDeptForPlatform1> roleForPlatform1s = boService.selectByQueryWrapper(queryWrapper, OrgDeptForPlatform1.class); if(!CollectionUtils.isEmpty(roleForPlatform1s)){ - roles.addAll(roleForPlatform1s); + deptForPlatform1s.addAll(roleForPlatform1s); } }); }else { @@ -200,9 +210,9 @@ VciQueryWrapperForDO queryWrapper = new VciQueryWrapperForDO(queryMap,OrgDeptForPlatform1.class); List<OrgDeptForPlatform1> roleForPlatform1s = boService.selectByQueryWrapper(queryWrapper, OrgDeptForPlatform1.class); if(!CollectionUtils.isEmpty(roleForPlatform1s)){ - roles.addAll(roleForPlatform1s); + deptForPlatform1s.addAll(roleForPlatform1s); } - return deptDO2VOs(roles); + return deptDO2VOs(deptForPlatform1s); } /** @@ -212,13 +222,13 @@ * @return 閮ㄩ棬鐨勬樉绀哄璞� */ @Override - public OrgDepartmentVO listDeptByUserOid(String userOid, + public List<OrgDepartmentVO> listDeptByUserOid(String userOid, Map<String, String> queryMap) { List<OrgDepartmentVO> departmentVOS = listDeptByUserOid(userOid, queryMap, false); if(CollectionUtils.isEmpty(departmentVOS)){ - return null; + return new ArrayList<>(); } - return departmentVOS.get(0); + return departmentVOS; } /** @@ -377,8 +387,9 @@ VciQueryWrapperForDO queryWrapperForDO = new VciQueryWrapperForDO(conditionMap,OrgDeptForPlatform1.class); orgDepartmentVOList = deptDO2VOs(boService.selectByQueryWrapper(queryWrapperForDO,OrgDeptForPlatform1.class)); } - TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions("pkFatherDepartment"); + TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(); BeanUtil.convert(treeQueryObject,treeWrapperOptions); + treeWrapperOptions.setParentFieldName("pkFatherDepartment"); return revisionModelUtil.doList2Trees(orgDepartmentVOList,treeWrapperOptions,dept->{ return dept.getId() + " " + dept.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equals(dept.getLcStatus())?"銆愬仠鐢ㄣ��":""); }); @@ -412,4 +423,41 @@ return dataGrid; } + /** + * 淇濆瓨閮ㄩ棬瑙掕壊鍏宠仈淇℃伅锛屽甫鏌ラ噸鍔熻兘 + * @param userOIds 鐢ㄦ埛id + * @param deptId 閮ㄩ棬id + * @return + */ + @Override + @Transactional(rollbackFor = Exception.class) + public boolean saveUsersDept(String[] userOIds, String deptId) throws PLException { + if(Func.isEmpty(userOIds) || Func.isBlank(deptId)){ + return false; + } + //鍏堣繘鎬ф煡閲嶅鐞� + List<String> repeatUserOidList = new ArrayList<>(); + //寰幆杩涜鏌ラ噸锛岄伩鍏峣n澶т簬1000 + WebUtil.switchCollectionForOracleIn(Arrays.asList(userOIds)).stream().forEach(userOId->{ + String sql = "select pluseruid,pldeptuid from pluserdept where pldeptuid = '" + deptId + + "' and " + "pluseruid in ("+WebUtil.toInSql(userOId.toArray(new String[0]))+")"; + List<BusinessObject> cbos = boService.queryBySql(sql, null); + if(!CollectionUtils.isEmpty(cbos)){ + cbos.stream().forEach(cbo->{ + repeatUserOidList.add(ObjectTool.getNewBOAttributeValue(cbo,"pluseruid")); + }); + } + }); + + //浠庡嵆灏嗚鎵ц淇濆瓨鐨勭敤鎴穙id涓Щ闄ゅ綋鍓嶇敤鎴峰凡缁忓瓨鍦ㄥ叧鑱斿叧绯荤殑oid + //绉婚櫎閲嶅鐨� + List<String> tempList = new ArrayList<>(Arrays.asList(userOIds)); + tempList.removeAll(repeatUserOidList); + userOIds = tempList.toArray(new String[tempList.size()]); + if(Func.isNotEmpty(userOIds)){ + platformClientUtil.getFrameworkService().saveUserDept(userOIds, deptId,null); + } + return true; + } + } -- Gitblit v1.9.3