|
|
@@ -194,7 +194,7 @@ public class EmployeeBatchGetTask { |
|
|
|
dingEmployeeInfoSaveRecordList = dingEmployeeInfoSaveRecordList.stream() |
|
|
|
.filter(r -> "true".equals(r.getMainJob()) |
|
|
|
&& "A".equals(r.getEmpStatus()) |
|
|
|
&& StringUtils.isNotBlank(r.getOrganizationCode()) |
|
|
|
&& StringUtils.isNotBlank(r.getEmpPosUnitCode()) |
|
|
|
&& StringUtils.isNotBlank(r.getEmployeeCode()) |
|
|
|
).collect(Collectors.toList()); |
|
|
|
|
|
|
@@ -203,16 +203,19 @@ public class EmployeeBatchGetTask { |
|
|
|
List<DingEmployeeInfo> saveList = new ArrayList<>(); |
|
|
|
|
|
|
|
for (DingEmployeeInfo dingEmployeeInfo : dingEmployeeInfoSaveRecordList) { |
|
|
|
if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getOrganizationCode())) { |
|
|
|
if (uniqueKeySet.add(dingEmployeeInfo.getEmployeeCode() + dingEmployeeInfo.getEmpPosUnitCode())) { |
|
|
|
saveList.add(dingEmployeeInfo); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
List<DingOrganization> organizations = iDingOrganizationService.list(); |
|
|
|
Map<String, DingOrganization> organizationMap = organizations.stream().collect(Collectors.toMap(DingOrganization::getOrganizationCode, o -> o)); |
|
|
|
|
|
|
|
for (DingEmployeeInfo dingEmployeeInfo : saveList) { |
|
|
|
String employeeCode = dingEmployeeInfo.getEmployeeCode(); |
|
|
|
|
|
|
|
DingEmployeeInfo employeeInfo = iDingEmployeeInfoService.getOne(Wrappers.lambdaQuery(DingEmployeeInfo.class) |
|
|
|
.eq(DingEmployeeInfo::getOrganizationCode, dingEmployeeInfo.getOrganizationCode()) |
|
|
|
.eq(DingEmployeeInfo::getEmpPosUnitCode, dingEmployeeInfo.getEmpPosUnitCode()) |
|
|
|
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode)); |
|
|
|
if (Objects.isNull(employeeInfo)) { |
|
|
|
iDingEmployeeInfoService.save(dingEmployeeInfo); |
|
|
@@ -220,11 +223,11 @@ public class EmployeeBatchGetTask { |
|
|
|
dingEmployeeInfo.setId(employeeInfo.getId()); |
|
|
|
iDingEmployeeInfoService.saveOrUpdate(dingEmployeeInfo); |
|
|
|
} |
|
|
|
generateOrUpdateUserInfo(dingEmployeeInfo); |
|
|
|
generateOrUpdateUserInfo(dingEmployeeInfo,organizationMap); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo) { |
|
|
|
public void generateOrUpdateUserInfo(DingEmployeeInfo dingEmployeeInfo,Map<String, DingOrganization> organizationMap) { |
|
|
|
String employeeCode = dingEmployeeInfo.getEmployeeCode(); |
|
|
|
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) |
|
|
|
.eq(UserInfo::getEmployeeCode, employeeCode)); |
|
|
@@ -239,7 +242,13 @@ public class EmployeeBatchGetTask { |
|
|
|
.updateBy(-1L) |
|
|
|
.createOn(LocalDateTime.now()) |
|
|
|
.updateOn(LocalDateTime.now()) |
|
|
|
.empPosUnitCode(dingEmployeeInfo.getEmpPosUnitCode()) |
|
|
|
.build(); |
|
|
|
if(StringUtils.isNotBlank(userInfo.getEmpPosUnitCode()) && organizationMap.containsKey(userInfo.getEmpPosUnitCode())){ |
|
|
|
DingOrganization dingOrganization = organizationMap.get(userInfo.getEmpPosUnitCode()); |
|
|
|
userInfo.setEmpPosUnitName(dingOrganization.getOrganizationName()); |
|
|
|
userInfo.setRegionCode(dingOrganization.getDivisionCode()); |
|
|
|
} |
|
|
|
iUserInfoService.save(userInfo); |
|
|
|
} |
|
|
|
} |
|
|
|