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

This commit is contained in:
俞扬
2023-06-19 16:26:18 +08:00
5 changed files with 61 additions and 2 deletions

View File

@@ -11,6 +11,9 @@ import com.cool.store.dto.dept.DepartmentEventDTO;
*/
public interface EnterpriseSyncService {
/**
* 全量同步
*/
void syncAll();
/**

View File

@@ -85,7 +85,10 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
}
}
/**
* 同步组织架构
* @return
*/
private Pair<List<RegionDO>, Multimap<String, String>> syncRegion(){
//同步部门
List<SysDepartmentDTO> departments = isvHttpRequest.getSubDepartments(CommonConstants.ROOT_DEPT_ID_STR, true);
@@ -239,13 +242,23 @@ public class EnterpriseSyncServiceImpl implements EnterpriseSyncService {
dealUserLeaderDept(updateLeaderDeptMap);
break;
case DEPARTMENT_DELETED:
syncAll();
boolean leafNode = regionDAO.isLeafNode(departmentDetail.getId());
if(leafNode){
//叶子节点的时候会删除部门
regionDAO.deleteRegionByRegionId(departmentDetail.getId());
}else{
syncAll();
}
break;
default:
return;
}
}
/**
* 处理用户负责部门信息
* @param leaderDeptMap
*/
public void dealUserLeaderDept(Multimap<String, String> leaderDeptMap){
if(leaderDeptMap.isEmpty()){
return;