Commit 3ea6b73b authored by 钱坤's avatar 钱坤

Merge remote-tracking branch 'origin/master' into dev

parents 773b6e3d 76faa63f
......@@ -67,7 +67,7 @@ public class OrgSyncByWxcpJob {
@Resource
private FeignClientForFatools feignClientForFatools;
@Scheduled(cron = "10 0/30 6-19/1 * * ?") //每日凌晨6点30开始执行,半小时检查一次
@Scheduled(cron = "10 0/10 6-19/1 * * ?") //每日凌晨6点30开始执行,半小时检查一次
public void execute() {
log.info("====== 开始执行OrgSyncByWxcpJob ======");
try {
......@@ -181,7 +181,7 @@ public class OrgSyncByWxcpJob {
List<WxCpUser> wxCpUserList = wxCpDepartDto.getWxCpUserList();
for (WxCpUser wxCpUser : wxCpUserList) {
// key employee_id + '&' + role_id
String type = wxCpUser.getIsLeader() == 1 ? RoleTypeEnum.TEAM.code : RoleTypeEnum.IFA.code;
String type = wxCpUser.getIsLeader() != null && wxCpUser.getIsLeader() == 1 ? RoleTypeEnum.TEAM.code : RoleTypeEnum.IFA.code;
hashMap.put(corpId + "_" + wxCpUser.getUserId() + "&" + roleMap.get(type), wxCpUser);
}
}
......@@ -257,7 +257,7 @@ public class OrgSyncByWxcpJob {
continue;
}
//更新
String type = wxCpUser.getIsLeader() == 1 ? EmployeeDutyEnum.DIRECTOR.code : EmployeeDutyEnum.STAFF.code;
String type = wxCpUser.getIsLeader() != null && wxCpUser.getIsLeader() == 1 ? EmployeeDutyEnum.DIRECTOR.code : EmployeeDutyEnum.STAFF.code;
if (!departmentEmployee.getType().equals(type)) {
departmentEmployee.setType(type);
updateList.add(departmentEmployee);
......@@ -266,7 +266,7 @@ public class OrgSyncByWxcpJob {
}
for (String s : hashMap.keySet()) {
WxCpUser wxCpUser = hashMap.get(s);
String type = wxCpUser.getIsLeader() == 1 ? EmployeeDutyEnum.DIRECTOR.code : EmployeeDutyEnum.STAFF.code;
String type = wxCpUser.getIsLeader() != null && wxCpUser.getIsLeader() == 1 ? EmployeeDutyEnum.DIRECTOR.code : EmployeeDutyEnum.STAFF.code;
String[] split = s.split("&");
String departmentId = split[0];
String employeeId = split[1];
......@@ -460,8 +460,10 @@ public class OrgSyncByWxcpJob {
|| !wxCpUser.getUserId().equals(userInfo.getWxcpUid()) || StrUtil.isBlankIfStr(userInfo.getUiWechatXcxQrcode())
|| !userInfo.getUiShenfen().equals(String.valueOf(wxCpUser.getIsLeader()))
|| !StringUtils.equals(userInfo.getUiHeadimg(), wxCpUser.getThumbAvatar())) {
if (StringUtils.equals(userInfo.getUiHeadimg(), wxCpUser.getThumbAvatar())) {
log.info("用户头像未变化,无须重新生成qrcode,{}", JsonUtil.toJson(userInfo));
if ((StringUtils.equals(userInfo.getUiHeadimg(), wxCpUser.getThumbAvatar())
|| StringUtils.isBlank(userInfo.getUiHeadimg()) && StringUtils.isBlank(wxCpUser.getThumbAvatar()))
&& StringUtils.isNotBlank(userInfo.getUiWechatXcxQrcode())) {
log.info("用户头像未变化,无须重新生成qrcode,{}, {}", JsonUtil.toJson(userInfo), JsonUtil.toJson(wxCpUser));
} else {
userInfo.setUiWechatXcxQrcode(orgSyncService.createWechatXcxQrcode(userInfo.getId(), wxCpUser.getThumbAvatar(), qrCodeUrl));
}
......@@ -543,6 +545,10 @@ public class OrgSyncByWxcpJob {
for (WxCpDepart wxCpDepart : wxCpDepartList) {
try {
List<WxCpUser> wxCpUsers = cpService.getUserService().listByDepartment(wxCpDepart.getId(), Boolean.FALSE, 0);
if (wxCpUsers == null) {
wxCpUsers = new ArrayList<>();
}
wxCpUsers.stream().filter(p -> p.getIsLeader() == null).forEach(p -> p.setIsLeader(0));
WxCpDepartDto wxCpDepartDto = new WxCpDepartDto();
BeanUtil.copyProperties(wxCpDepart, wxCpDepartDto, true);
wxCpDepartDto.setWxCpUserList(wxCpUsers);
......
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