Commit 2d45a71c by zhoupeng

提交导入组织架构openapi接口

parent ac1a0146
......@@ -6,6 +6,7 @@ import com.github.pagehelper.PageInfo;
import com.rome.order.domain.enums.ResponseMsg;
import com.rome.order.domain.service.OrganizationRedisService;
import com.rome.order.domain.service.SyncEmployeCdpService;
import com.rome.order.domain.util.BatchHandlerUtil;
import com.rome.order.domain.util.HttpUtil;
import com.rome.order.domain.util.ParameterCheckUtils;
import com.rome.order.infrastructure.dataobject.SyncEmployeeCdpDO;
......@@ -126,6 +127,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
try {
//转换成Map
Map<String, List<OrgDTO>> orgDTOMap = this.getOrgDTOMap(allOrg);
List<EmpMainDataResDTO> allEmps=new ArrayList<>();
// 分页获取全量数据
int pageNum = 1;
if(pageParamNum!=null){
......@@ -145,7 +147,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
break;
}
// 处理同步的员工信息
this.dealthEmpCdpList(empResList,orgDTOMap);
this.dealthEmpCdpList(empResList,allEmps);
if(empResList.size()<pageSize){
// 处理同步的员工信息
log.info("------synAllEmpCdp全量同步结束-------");
......@@ -153,6 +155,10 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
}
pageNum ++;
}
//同步腾讯
if(!CollectionUtils.isEmpty(allEmps)){
this.orgSyncTecent(allEmps, orgDTOMap);
}
log.info("------synAllEmpCdp全量同步结束-------");
return true;
} catch (Exception e) {
......@@ -179,7 +185,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
* 处理同步的员工信息
* @param empResList
*/
private void dealthEmpCdpList(List<EmpMainDataResDTO> empResList, Map<String, List<OrgDTO>> orgDTOMap){
private void dealthEmpCdpList(List<EmpMainDataResDTO> empResList, List<EmpMainDataResDTO> allEmps){
empResList.forEach(s->{
s.setCreator(-1);
s.setCreatorName("system");
......@@ -195,8 +201,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
//需要用户id 根据进行去重
// empResList = empResList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(o -> o.getUserId()))), ArrayList::new));
syncEmployeeCdpMapper.batchSaveEmpCdp(empResList);
//同步腾讯
this.orgSyncTecent( empResList, orgDTOMap);
allEmps.addAll(empResList);
}else{
//批量添加
List<EmpMainDataResDTO> batchAdd=new ArrayList<>();
......@@ -209,8 +214,7 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
}
if(!CollectionUtils.isEmpty(batchAdd)){
syncEmployeeCdpMapper.batchSaveEmpCdp(batchAdd);
//同步腾讯
this.orgSyncTecent( empResList, orgDTOMap);
allEmps.addAll(batchAdd);
}
}
}
......@@ -299,7 +303,13 @@ public class SyncEmployeCdpServiceImpl implements SyncEmployeCdpService {
s.setErrorMsg(errMsg);
}
}
syncEmployeeCdpMapper.batchUpdateEmpCdp(empResList);
if(!CollectionUtils.isEmpty(empResList)){
List<List<EmpMainDataResDTO>> addLists = BatchHandlerUtil.splitTo(empResList, 200);
log.info("appPlanExecuteList总条数:{},分{}批更新", addLists.size(), addLists.size());
for (List<EmpMainDataResDTO> list : addLists) {
syncEmployeeCdpMapper.batchUpdateEmpCdp(list);
}
}
}
private String orgSetAdminAccountId(String accountId){
......
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