Commit 0e0d1655 by fudahua

Merge remote-tracking branch 'origin/developer' into developer

parents fb5f0e9a 9dee53a2
......@@ -508,12 +508,12 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
// this.addSon(subList, wxEnterpriseId, parent,corpid,suiteid);
RedisUtil.lock("init_enterprise_" + wxEnterpriseId,60 * 60L);
String taskId = StringUtil.randomUUID();
//List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, 1);
// logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, 1);
logger.info("企业所有部门数据:{}", JSON.toJSONString(list));
// if(CollectionUtils.isNotEmpty(list)){
// this.addAllDepartment(list, 0, wxEnterpriseId, corpid, contactSecret,taskId);
// }
insertMQ(0,wxEnterpriseId, corpid,contactSecret,taskId);
// insertMQ(0,wxEnterpriseId, corpid,contactSecret,taskId);
RedisUtil.unlock("init_enterprise_" + wxEnterpriseId);
}
......@@ -547,6 +547,7 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> list = this.qywxDepartmentApiService.listSelfDepartment(corpid, contactSecret, parentId);
String chainId = "0";
String chainName = "0";
String pid = "0";
List<com.gic.wechat.api.dto.qywx.DepartmentDTO> handerList = new ArrayList<>();
if(parentId == 0){
for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : list) {
......@@ -564,6 +565,16 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
level = parent.getLevel() + 1;
chainId = parent.getChainId() + Constant.ID_SEPARATOR + parent.getDepartmentId();
chainName = parent.getChainName() + Constant.NAME_SEPARATOR + parent.getDepartmentName();
pid = parent.getParentDepartmentId();
}else{
TabHaobanSyncErrorLog tab = new TabHaobanSyncErrorLog();
tab.setDataId(parentId+"");
tab.setDataType(0);
tab.setLogType(0);
tab.setReason("父部门不存在");
tab.setTaskId(taskId);
tab.setWxEnterpriseId(wxEnterpriseId);
syncErrorLogService.add(tab);
}
}
if(handerList == null || handerList.isEmpty()){
......@@ -571,36 +582,36 @@ public class DepartmentApiServiceImpl implements DepartmentApiService {
}
logger.info("【mq同步】parentId={}",parentId);
for (com.gic.wechat.api.dto.qywx.DepartmentDTO departmentDTO : handerList) {
// insertMQ(departmentDTO.getId(),wxEnterpriseId, corpid,contactSecret,taskId);
// try {
// TabHaobanDepartment exist = this.departmentService.getByWxId(departmentDTO.getId() + "", wxEnterpriseId);
// logger.info("分组是否存在:{}", JSON.toJSONString(exist));
// if(exist == null){
// com.gic.haoban.manage.api.dto.DepartmentDTO dto = new com.gic.haoban.manage.api.dto.DepartmentDTO();
// dto.setDepartmentName(departmentDTO.getName());
// dto.setLevel(level);
// dto.setWxEnterpriseId(wxEnterpriseId);
// dto.setWxDepartmentId(departmentDTO.getId()+"");
// dto.setParentDepartmentId(parentId + "");
// dto.setChainId(chainId);
// dto.setChainName(chainName);
// dto.setSort(departmentDTO.getOrder());
// dto.setIsStore(0);
// this.departmentService.add(dto);
// }
// } catch (Exception e) {
// TabHaobanSyncErrorLog tab = new TabHaobanSyncErrorLog();
// tab.setDataId(departmentDTO.getId()+"");
// tab.setDataType(0);
// tab.setLogType(0);
// tab.setReason(e.getMessage());
// tab.setTaskId(taskId);
// tab.setWxEnterpriseId(wxEnterpriseId);
// syncErrorLogService.add(tab);
// }
// //this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId, corpid, contactSecret,taskId);
// this.staffApiService.initWxUser(corpid, contactSecret, wxEnterpriseId, departmentDTO.getId(),taskId);
return;
try {
TabHaobanDepartment exist = this.departmentService.getByWxId(departmentDTO.getId() + "", wxEnterpriseId);
logger.info("分组是否存在:{}", JSON.toJSONString(exist));
if(exist == null){
com.gic.haoban.manage.api.dto.DepartmentDTO dto = new com.gic.haoban.manage.api.dto.DepartmentDTO();
dto.setDepartmentName(departmentDTO.getName());
dto.setLevel(level);
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setWxDepartmentId(departmentDTO.getId()+"");
dto.setParentDepartmentId(pid);
dto.setChainId(chainId);
dto.setChainName(chainName);
dto.setSort(departmentDTO.getOrder());
dto.setIsStore(0);
this.departmentService.add(dto);
}
insertMQ(departmentDTO.getId(),wxEnterpriseId, corpid,contactSecret,taskId);
} catch (Exception e) {
TabHaobanSyncErrorLog tab = new TabHaobanSyncErrorLog();
tab.setDataId(departmentDTO.getId()+"");
tab.setDataType(0);
tab.setLogType(0);
tab.setReason(e.getMessage());
tab.setTaskId(taskId);
tab.setWxEnterpriseId(wxEnterpriseId);
syncErrorLogService.add(tab);
}
//this.addAllDepartment(list, departmentDTO.getId(), wxEnterpriseId, corpid, contactSecret,taskId);
this.staffApiService.initWxUser(corpid, contactSecret, wxEnterpriseId, departmentDTO.getId(),taskId);
// return;
}
}
......
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