ludc
2024-10-30 37d730454255d0680c2bc4f1e15dc5cd1a55e6a9
Source/plt-web/plt-web-parent/plt-web/src/main/java/com/vci/frameworkcore/compatibility/impl/OrgDeptQueryServiceImpl.java
@@ -596,30 +596,11 @@
   @Override
   public boolean saveUsersDept(String[] userOIds, String deptId) throws PLException {
      VciBaseUtil.alertNotNull(deptId,"部门主键");
      //先查重处理
      List<String> repeatUserOidList = new ArrayList<>();
      //循环进行查重,避免in大于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"));
            });
         }
      });
      //从即将要执行保存的用户oid中移除当前用户已经存在关联关系的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,new UserEntityInfo(WebThreadLocalUtil.getCurrentUserSessionInfoInThread().getUserId(),null));
      }
      return true;
      //为空的话说明是清空当前这个部门下分配的成员
      SessionInfo sessionInfo = WebThreadLocalUtil.getCurrentUserSessionInfoInThread();
      UserEntityInfo userEntityInfo = new UserEntityInfo(sessionInfo.getUserId(), null);
      boolean resBoolean = platformClientUtil.getFrameworkService().saveRighForDept(deptId, userOIds, userEntityInfo);
      return resBoolean;
   }
   /**