【安眼】用户信息同步

This commit is contained in:
2025-12-02 17:39:04 +08:00
parent 23b560ca01
commit a20771f420
2 changed files with 23 additions and 0 deletions
@@ -5,10 +5,13 @@ import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.renkang.anyan.client.AnYanClient;
import com.renkang.anyan.model.dto.EmergencyContactParam;
import com.renkang.anyan.model.vo.AnYanUserEmployee;
import com.renkang.anyan.model.vo.AnYanUserInfoResult;
import com.renkang.anyan.model.vo.AuthResult;
import com.renkang.anyan.model.vo.EmergencyContactVO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
@@ -407,6 +410,21 @@ public class LoginAnYanServiceImpl implements ILoginAnYanService {
.eq(SysUser::getId, userId)
.set(StringUtils.isNotBlank(anYanUserEmployee.getBirthday()), SysUser::getBirthday, anYanUserEmployee.getBirthday())
);
EmergencyContactParam param = new EmergencyContactParam();
param.setEmployeeNum(workNo);
IPage<EmergencyContactVO> emergencyContactVOIPage = anYanClient.queryEmergencyContact(param);
if (emergencyContactVOIPage != null && emergencyContactVOIPage.getRecords() != null && !emergencyContactVOIPage.getRecords().isEmpty()) {
for (EmergencyContactVO emergencyContactVO : emergencyContactVOIPage.getRecords()) {
healthUserEmployeeExService.update(new LambdaUpdateWrapper<HealthUserEmployeeEx>()
.eq(HealthUserEmployeeEx::getId, userId)
.set(StringUtils.isNotBlank(emergencyContactVO.getRelationEmpName()), HealthUserEmployeeEx::getCareLiaisonName, emergencyContactVO.getRelationEmpName())
.set(StringUtils.isNotBlank(emergencyContactVO.getRelationEmpPostsText()), HealthUserEmployeeEx::getCareLiaisonJob, emergencyContactVO.getRelationEmpPostsText())
.set(StringUtils.isNotBlank(emergencyContactVO.getRelationEmpPhone()), HealthUserEmployeeEx::getCareLiaisonPhone, emergencyContactVO.getRelationEmpPhone())
.set(StringUtils.isNotBlank(emergencyContactVO.getFirstAiderName()), HealthUserEmployeeEx::getLifeguardName, emergencyContactVO.getFirstAiderName())
.set(StringUtils.isNotBlank(emergencyContactVO.getFirstAiderPhone()), HealthUserEmployeeEx::getLifeguardPhone, emergencyContactVO.getFirstAiderPhone())
);
}
}
} catch (Exception e) {
log.error("更新员工其他信息异常,userId={}, workNo={}", userId, workNo, e);
}