【安眼】信息同步修改
This commit is contained in:
+2
@@ -520,6 +520,8 @@ public interface ISysBaseAPI extends CommonAPI {
|
||||
|
||||
List<String> checkExistUser(String existUserId, String userName, String mobile, String idCard);
|
||||
|
||||
List<String> checkExistUserAY(String existUserId, String userName, String mobile, String idCard);
|
||||
|
||||
Page<SysUser> pageUser(SysUser user, Integer pageNo, Integer pageSize, List<String> managerCodes);
|
||||
// List<String> checkExistUser(String existUserId,String userName, String mobile, String idCard);
|
||||
|
||||
|
||||
+2
@@ -63,6 +63,8 @@ public interface IHealthUserEmployeeExService extends IService<HealthUserEmploye
|
||||
|
||||
boolean saveAndUser(UserEmployee userEmployee);
|
||||
|
||||
boolean saveAndUserAY(UserEmployee userEmployee);
|
||||
|
||||
Result<String> updateUserInfo(UserEmployee userEmployee, LoginUser loginUser);
|
||||
|
||||
boolean saveAndUserDepartManager(UserEmployee userEmployee);
|
||||
|
||||
+46
@@ -894,6 +894,52 @@ public class HealthUserEmployeeExServiceImpl extends ServiceImpl<HealthUserEmplo
|
||||
return i != 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* description: 保存用户信息(安眼)
|
||||
* @date: 2025/12/4 14:41
|
||||
* @Param userEmployee: [org.jeecg.modules.system.bean.UserEmployee]
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean saveAndUserAY(UserEmployee userEmployee) {
|
||||
// 添加账号 电话 身份证号校验
|
||||
List<String> checkExistUser = sysBaseAPI.checkExistUserAY(null, userEmployee.getUsername(), userEmployee.getPhone(), userEmployee.getIdCard());
|
||||
if (CollectionUtil.isNotEmpty(checkExistUser)) {
|
||||
ExceptionAssertsUtil.fail(String.join(",", checkExistUser));
|
||||
}
|
||||
// 1: 员工
|
||||
userEmployee.setPersonType("1");
|
||||
userEmployee.setCreateTime(new Date());
|
||||
handlePassword(userEmployee);
|
||||
userEmployee.setStatus(1);
|
||||
userEmployee.setWorkNo(userEmployee.getExtension().getEmpSysno());
|
||||
userEmployee.setDelFlag(CommonConstant.DEL_FLAG_0);
|
||||
String selectedDeparts = handleDepart(userEmployee);
|
||||
sysUserService.addUserWithDepart(userEmployee, selectedDeparts);
|
||||
String userId = userEmployee.getId();
|
||||
if (!StringUtils.hasText(userId)) {
|
||||
return false;
|
||||
}
|
||||
addCommonRole(userId);
|
||||
HealthUserEmployeeEx extension = userEmployee.getExtension();
|
||||
extension.setId(userId);
|
||||
extension.setCreatedon(new Date());
|
||||
// 添加当前年龄
|
||||
if (StrUtil.isNotEmpty(userEmployee.getIdCard())) {
|
||||
extension.setCurrentAge(GlobalUtils.getAgeByIdCard(userEmployee.getIdCard()));
|
||||
}
|
||||
int i = healthUserEmployeeExMapper.insert(extension);
|
||||
// 保存员工岗位信息,其他用户类型无岗位
|
||||
SysUserPost sysUserPost = new SysUserPost();
|
||||
if (StrUtil.isNotBlank(userEmployee.getExtension().getPostId())) {
|
||||
sysUserPost.setId(userId);
|
||||
sysUserPost.setPostId(userEmployee.getExtension().getPostId());
|
||||
sysUserPost.setClassifyId(userEmployee.getExtension().getClassifyId());
|
||||
sysUserPostService.insert(sysUserPost);
|
||||
}
|
||||
return i != 0;
|
||||
}
|
||||
|
||||
private void addQhCommonRole(String userId) {
|
||||
SysRole sysRole = sysRoleMapper.selectOne(new LambdaQueryWrapper<SysRole>().eq(SysRole::getRoleCode, "manager_qh"));
|
||||
SysUserRole userRole = new SysUserRole();
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ public class LoginAnYanServiceImpl implements ILoginAnYanService {
|
||||
user.setOrgCode(departId);
|
||||
user.setPersonType("1");
|
||||
user.setStatus(1);
|
||||
healthUserEmployeeExService.saveAndUser(user);
|
||||
healthUserEmployeeExService.saveAndUserAY(user);
|
||||
} else if (list.size() == 1) {
|
||||
SysUser sysUser = list.get(0);
|
||||
UserEmployee user = getUserEmployee(employeeUnitDTO);
|
||||
|
||||
+34
-13
@@ -40,7 +40,6 @@ import org.jeecg.common.bean.request.SendSmsReq;
|
||||
import org.jeecg.common.bean.response.BaseUserGroup;
|
||||
import org.jeecg.common.bean.response.NotSignType;
|
||||
import org.jeecg.common.bean.transfer.GroupCount;
|
||||
import org.jeecg.common.bean.transfer.UserEatFlag;
|
||||
import org.jeecg.common.bean.transfer.UserEatParam;
|
||||
import org.jeecg.common.bean.transfer.UserWeightSign;
|
||||
import org.jeecg.common.config.TenantContext;
|
||||
@@ -441,7 +440,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GroupCount> specificGroupUser(){
|
||||
public List<GroupCount> specificGroupUser() {
|
||||
/*
|
||||
* 机关其他 A01A80
|
||||
* 陇东油气开发分公司 A01A44
|
||||
@@ -536,6 +535,28 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> checkExistUserAY(String existUserId, String userName, String mobile, String idCard) {
|
||||
//userName mobile idCard
|
||||
List<CheckExistUserRes> list = userMapper.checkExistUser(existUserId, userName, mobile, idCard);
|
||||
return list.stream()
|
||||
.filter(f -> !"account".equals(f.getAccount()) && !"mobile".equals(f.getAccount()) && f.getCount() > 0)
|
||||
.map(CheckExistUserRes::getAccount)
|
||||
.map(s -> {
|
||||
if ("userName".equals(s)) {
|
||||
s = "用户账号已存在";
|
||||
}
|
||||
//安眼暂时去掉手机号校验
|
||||
// if ("mobile".equals(s)) {
|
||||
// s = "电话号码已存在";
|
||||
// }
|
||||
if ("idCard".equals(s)) {
|
||||
s = "身份证号已存在";
|
||||
}
|
||||
return s;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<SysUser> pageUser(SysUser user, Integer pageNo, Integer pageSize, List<String> managerCodes) {
|
||||
QueryWrapper<SysUser> queryWrapper = QueryGenerator.initQueryWrapper(user, Collections.emptyMap());
|
||||
@@ -613,7 +634,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<LoginUser> result = new ArrayList<>();
|
||||
GlobalUtils.convertList(users, result,LoginUser.class);
|
||||
GlobalUtils.convertList(users, result, LoginUser.class);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -1059,13 +1080,13 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
@Override
|
||||
public void sendBusSms(BusTemplateMessageDTO message) {
|
||||
//判断群发
|
||||
if(message.isMultipart()){
|
||||
if(CollectionUtil.isEmpty(message.getPhones())){
|
||||
if (message.isMultipart()) {
|
||||
if (CollectionUtil.isEmpty(message.getPhones())) {
|
||||
log.error("群发短信,phones不能为空");
|
||||
return ;
|
||||
}else if(message.getPhones().size()>CommonConstant.MSG_BATCH_NUM){
|
||||
return;
|
||||
} else if (message.getPhones().size() > CommonConstant.MSG_BATCH_NUM) {
|
||||
log.error("群发短信,一次不能超过10个手机号");
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1110,7 +1131,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
sysMessage.setEsTitle(title);
|
||||
sysMessage.setTemplateCode(message.getTemplateCode());
|
||||
sysMessage.setEsType(message.isMultipart() ? CommonConstant.ES_TYPE_2 : CommonConstant.ES_TYPE_1);//这里借用busType,区分1为短信单发,2为短信群发,群发的情况可能会一次保存很多信息,需要特殊优化处理
|
||||
sysMessage.setEsReceiver(message.isMultipart() ? String.join(",", message.getPhones()): toUser);//群发的这里phones处理一下
|
||||
sysMessage.setEsReceiver(message.isMultipart() ? String.join(",", message.getPhones()) : toUser);//群发的这里phones处理一下
|
||||
sysMessage.setEsContent(content);
|
||||
sysMessage.setEsParam(JSONObject.toJSONString(map));
|
||||
sysMessage.setEsSendStatus(SendMsgStatusEnum.WAIT.getCode());
|
||||
@@ -2041,7 +2062,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
|
||||
@Override
|
||||
public Result<List<String>> getUserIdsByOrgCodeList(List<String> orgCodeList) {
|
||||
return Result.OK("",userMapper.getUserIdsByOrgCodeList(orgCodeList));
|
||||
return Result.OK("", userMapper.getUserIdsByOrgCodeList(orgCodeList));
|
||||
}
|
||||
|
||||
|
||||
@@ -2150,11 +2171,11 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
|
||||
|
||||
@Override
|
||||
public List<EmployeeHeightWeight> userBodyInfo(List<String> userIds){
|
||||
public List<EmployeeHeightWeight> userBodyInfo(List<String> userIds) {
|
||||
if (CollUtil.isEmpty(userIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return userDataRecordBWHMapper.userBodyInfo(userIds,null);
|
||||
return userDataRecordBWHMapper.userBodyInfo(userIds, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -2204,7 +2225,7 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSmsNotSign(List<NotSignType> notSignTypes){
|
||||
public void sendSmsNotSign(List<NotSignType> notSignTypes) {
|
||||
if (CollUtil.isEmpty(notSignTypes)) {
|
||||
return;
|
||||
}
|
||||
|
||||
+23
-12
@@ -7,15 +7,16 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.renkang.anyan.client.AnYanClient;
|
||||
import com.renkang.anyan.model.vo.AnYanUpdateUserBatchInfo;
|
||||
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.modules.system.entity.SysUser;
|
||||
import org.jeecg.modules.system.service.ISysUserService;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -34,7 +35,8 @@ public class AnYanUserInfoJob {
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
|
||||
@XxlJob("an-yan-update-vital_info")
|
||||
// @XxlJob("an-yan-update-vital_info")
|
||||
@Scheduled(cron = "0 00 15 * * ?")
|
||||
public void batchUpdateUserInfo() {
|
||||
log.info("------开始执行用户信息同步任务------");
|
||||
boolean flag = true;
|
||||
@@ -87,21 +89,30 @@ public class AnYanUserInfoJob {
|
||||
}
|
||||
String phone = userInfo.getPhone();
|
||||
String idNo = userInfo.getIdNo();
|
||||
if ((phone != null && !phone.equals(existingUser.getPhone())) ||
|
||||
(idNo != null && !idNo.equals(existingUser.getIdCard()))) {
|
||||
if (StringUtils.isBlank(existingUser.getPhone())) {
|
||||
//系统中手机号为空时才更新
|
||||
sysUserService.update(new LambdaUpdateWrapper<SysUser>()
|
||||
.eq(SysUser::getWorkNo, existingUser.getWorkNo())
|
||||
.set(SysUser::getPhone, phone)
|
||||
.set(SysUser::getIdCard, idNo)
|
||||
.set(SysUser::getUpdateTime, existingUser.getUpdateTime())
|
||||
.set(SysUser::getUpdateTime, new Date())
|
||||
);
|
||||
}
|
||||
if (ObjectUtil.isNull(existingUser.getBirthday()) && StringUtils.isNotBlank(idNo)) {
|
||||
//同步生日
|
||||
sysUserService.update(new LambdaUpdateWrapper<SysUser>()
|
||||
.eq(SysUser::getWorkNo, existingUser.getWorkNo())
|
||||
.set(SysUser::getBirthday, IdcardUtil.getBirthByIdCard(idNo))
|
||||
);
|
||||
if (StringUtils.isNotBlank(idNo)) {
|
||||
if (existingUser.getIdCard() == null || !idNo.equals(existingUser.getIdCard())) {
|
||||
//系统身份证为空或者身份证不一致时做更新
|
||||
sysUserService.update(new LambdaUpdateWrapper<SysUser>()
|
||||
.eq(SysUser::getWorkNo, existingUser.getWorkNo())
|
||||
.set(SysUser::getIdCard, idNo)
|
||||
.set(SysUser::getUpdateTime, new Date())
|
||||
);
|
||||
}
|
||||
if (ObjectUtil.isNull(existingUser.getBirthday())) {
|
||||
//同步生日
|
||||
sysUserService.update(new LambdaUpdateWrapper<SysUser>()
|
||||
.eq(SysUser::getWorkNo, existingUser.getWorkNo())
|
||||
.set(SysUser::getBirthday, IdcardUtil.getBirthByIdCard(idNo))
|
||||
);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("用户信息同步任务异常:{}", e.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user