Commit ce2811a4 by fudahua

Merge branch 'feature-2024-09-23' into 'master'

Feature 2024 09 23

See merge request !2160
parents 76561474 9e20fcec
...@@ -545,11 +545,29 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -545,11 +545,29 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
unlockTask(wxEnterpriseId); unlockTask(wxEnterpriseId);
return "没有配置secret"; return "没有配置secret";
} }
Map<String,Integer> map = CustomSwitcher.haoban_department_id ; Map<String,String> map = CustomSwitcher.haoban_department_id ;
int id = 1 ; int syncId = 1 ;
List<Integer> ids=new ArrayList<>();
if(null != map && null != map.get(wxEnterpriseId)) { if(null != map && null != map.get(wxEnterpriseId)) {
id = map.get(wxEnterpriseId) ; String rootIdsStr = map.get(wxEnterpriseId);
List<Integer> rootIds = Arrays.stream(rootIdsStr.split(",")).filter(mid -> mid != null).map(mid -> Integer.valueOf(mid)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(rootIds)) {
logger.info("apollo部门配置异常");
return "同步部门配置异常";
}
ids.addAll(rootIds);
}else{
ids.add(syncId);
}
List<TabHaobanPreDealLog> dealLogList=new ArrayList<>();
String rootPid="0";
if (ids.size()>1) {
rootPid="-999";
syncId=Integer.valueOf(rootPid);
TabHaobanPreDealLog dealLog = getRootDept(wxEnterpriseId,rootPid,taskId);
dealLogList.add(dealLog);
} }
for (Integer id: ids) {
logger.info("id={}",id); logger.info("id={}",id);
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), id,qwDTO.getUrlHost()); List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = qywxDepartmentApiService.listSelfDepartment(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), id,qwDTO.getUrlHost());
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
...@@ -561,12 +579,13 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -561,12 +579,13 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
logger.info("企微部门数={}",list.size()); logger.info("企微部门数={}",list.size());
final int _id = id ; final int _id = id ;
syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.group_sync.getVal()); syncTaskService.updateTaskStatus(taskId, SyncTaskStatusEnum.group_sync.getVal());
List<TabHaobanPreDealLog> dealLogList = list.stream().map(dto -> { String finalRootPid = rootPid;
List<TabHaobanPreDealLog> dealLogListMid = list.stream().map(dto -> {
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog(); TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setDataId(dto.getId().toString()); dealLog.setDataId(dto.getId().toString());
if(dto.getId().toString().equals(_id+"")) { if(dto.getId().toString().equals(_id+"")) {
dealLog.setpDataId("0"); dealLog.setpDataId(finalRootPid);
dto.setParentid(0); dto.setParentid(Integer.valueOf(finalRootPid));
}else { }else {
dealLog.setpDataId(dto.getParentid().toString()); dealLog.setpDataId(dto.getParentid().toString());
} }
...@@ -577,14 +596,39 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ ...@@ -577,14 +596,39 @@ public class DealSyncOperationApiServiceImpl implements DealSyncOperationApiServ
dealLog.setWxEnterpriseId(wxEnterpriseId); dealLog.setWxEnterpriseId(wxEnterpriseId);
return dealLog; return dealLog;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
dealLogList.addAll(dealLogListMid);
}
// 保存部门数据 // 保存部门数据
preDealService.insert(dealLogList); preDealService.insert(dealLogList);
HashSet<String> hashSet = new HashSet<>(); HashSet<String> hashSet = new HashSet<>();
hashSet.add(""+id); hashSet.add(""+syncId);
sendToMq(taskId, hashSet, SyncTaskStatusEnum.group_sync,"departmentSyncDealMq2"); sendToMq(taskId, hashSet, SyncTaskStatusEnum.group_sync,"departmentSyncDealMq2");
return null; return null;
} }
private TabHaobanPreDealLog getRootDept(String wxEnterpriseId,String rootPid,String taskId) {
WxEnterpriseDTO wxEnterpriseDTO = this.wxEnterpriseService.selectById(wxEnterpriseId);
com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO = new com.gic.wechat.api.dto.qywx.DepartmentDTO();
departmentDTO.setName(wxEnterpriseDTO.getCorpName());
departmentDTO.setParentid(0);
departmentDTO.setOrder(0L);
departmentDTO.setId(Integer.valueOf(rootPid));
departmentDTO.setCorpid("");
TabHaobanPreDealLog dealLog = new TabHaobanPreDealLog();
dealLog.setDataId(rootPid);
dealLog.setpDataId("0");
dealLog.setDataType(0);
dealLog.setStatusFlag(0);
dealLog.setTaskId(taskId);
dealLog.setDataContent(JSONObject.toJSONString(departmentDTO));
dealLog.setWxEnterpriseId(wxEnterpriseId);
return dealLog;
}
@Override @Override
public void cleanDiffrence(String wxEnterpriseId, String taskId) { public void cleanDiffrence(String wxEnterpriseId, String taskId) {
......
package com.gic.haoban.manage.service.task; package com.gic.haoban.manage.service.task;
import java.util.List; import java.util.*;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.haoban.manage.api.service.DealSyncOperationApiService; import com.gic.haoban.manage.api.service.DealSyncOperationApiService;
...@@ -179,11 +177,12 @@ public class QywxDeptSyncOperation implements BaseSyncOperation { ...@@ -179,11 +177,12 @@ public class QywxDeptSyncOperation implements BaseSyncOperation {
private String getStaff(String taskId, String dataId, String enterpriseId, String wxEnterpriseId,SecretSettingDTO secretSetting,WxEnterpriseQwDTO qwDTO) { private String getStaff(String taskId, String dataId, String enterpriseId, String wxEnterpriseId,SecretSettingDTO secretSetting,WxEnterpriseQwDTO qwDTO) {
logger.info("getstaff={}",dataId); logger.info("getstaff={}",dataId);
String id = "1" ; String id = "1" ;
Map<String,Integer> map = CustomSwitcher.haoban_department_id ; Map<String,String> map = CustomSwitcher.haoban_department_id ;
if(null != map && null != map.get(wxEnterpriseId)) { if(null != map && null != map.get(wxEnterpriseId)) {
id = map.get(wxEnterpriseId) +"" ; id = map.get(wxEnterpriseId) ;
} }
if(id.equals(dataId)) { List<String> ids = Arrays.stream(id.split(",")).collect(Collectors.toList());
if(ids.contains(dataId)) {
List<UserDTO> list = null ; List<UserDTO> list = null ;
if(qwDTO.getWxSecurityType()==4) { if(qwDTO.getWxSecurityType()==4) {
list = this.qywxUserApiService.listDepartmentUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), dataId, 1) ; list = this.qywxUserApiService.listDepartmentUser(qwDTO.getThirdCorpid(), config.getWxSuiteid(), dataId, 1) ;
......
...@@ -21,6 +21,6 @@ public class CustomSwitcher { ...@@ -21,6 +21,6 @@ public class CustomSwitcher {
public static String haoban_one_bind_many ; public static String haoban_one_bind_many ;
@Switcher @Switcher
public static Map<String,Integer> haoban_department_id ; public static Map<String,String> haoban_department_id ;
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment