From c7cef19248eb9bb6a5420a48d1b26167ff7db858 Mon Sep 17 00:00:00 2001 From: 田源 <lastanimals@163.com> Date: 星期四, 27 六月 2024 17:58:21 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java | 62 +++++++++++++++++++++++++++--- 1 files changed, 55 insertions(+), 7 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..3d433a9 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; } /** @@ -412,4 +422,42 @@ 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