瀏覽代碼

用户编辑手机号修改

tags/24080901
niohe·erbao 1 年之前
父節點
當前提交
6015dc6c90
共有 1 個檔案被更改,包括 38 行新增16 行删除
  1. +38
    -16
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java

+ 38
- 16
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java 查看文件

@@ -74,6 +74,7 @@ public class UserInfoManage {

LambdaQueryWrapper<DingEmployeeInfo> wrapper = Wrappers.lambdaQuery(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getMainJob, "true")
.eq(DingEmployeeInfo::getStatus, "A")
.eq(StringUtils.isNotBlank(orgCode), DingEmployeeInfo::getOrganizationCode, orgCode)
.like(StringUtils.isNotBlank(phoneNo), DingEmployeeInfo::getBindUserMobile, phoneNo)
.like(StringUtils.isNotBlank(name), DingEmployeeInfo::getEmployeeName, name)
@@ -91,7 +92,7 @@ public class UserInfoManage {
Map<String, UserInfo> employeeCodeAvailableMap = new HashMap<>(16);
if (CollUtil.isNotEmpty(employeeCodeList)) {
employeeCodeAvailableMap = iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class)
.in(UserInfo::getEmployeeCode, employeeCodeList))
.in(UserInfo::getEmployeeCode, employeeCodeList))
.stream().collect(Collectors.toMap(UserInfo::getEmployeeCode, Function.identity()));
}
List<String> orgCodeList = records.stream()
@@ -168,7 +169,7 @@ public class UserInfoManage {

// TODO 这里过滤的非浙政钉用户的专家 后续需要增加补充逻辑
return iUserInfoService.list(Wrappers.lambdaQuery(UserInfo.class)
.in(UserInfo::getId, compliantUserIdList))
.in(UserInfo::getId, compliantUserIdList))
.stream().map(UserInfo::getEmployeeCode)
.filter(StringUtils::isNotBlank).collect(Collectors.toList());

@@ -256,23 +257,11 @@ public class UserInfoManage {

@Transactional(rollbackFor = Exception.class)
public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) {
String employeeCode = reqUserDetailEditPO.getEmployeeCode();
Long userId = generateUserId(reqUserDetailEditPO.getEmployeeCode());
UserInfo userInfo = iUserInfoService.getById(userId);
// 绑定用户手机号
bandUserMobile(userInfo, reqUserDetailEditPO);

String mobile = userInfo.getMobile();
if (StringUtils.isBlank(mobile)) {
String phoneNo = reqUserDetailEditPO.getPhoneNo();
userInfo.setMobile(phoneNo);
// 更新浙政钉相关数据
if (StringUtils.isNotBlank(phoneNo)) {
iDingEmployeeInfoService
.update(Wrappers.lambdaUpdate(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getMainJob, "true")
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode)
.set(DingEmployeeInfo::getBindUserMobile, phoneNo));
}
}
userInfo.setAvailable(reqUserDetailEditPO.getStatus());
userInfo.setUpdateOn(LocalDateTime.now());
userInfo.setUpdateBy(LoginUserUtil.getUserId());
@@ -291,6 +280,39 @@ public class UserInfoManage {
}
}

/**
* 绑定用户手机号
*
* @param userInfo
* @param reqUserDetailEditPO
*/
@Transactional(rollbackFor = Exception.class)
public void bandUserMobile(UserInfo userInfo, ReqUserDetailEditPO reqUserDetailEditPO) {
String employeeCode = reqUserDetailEditPO.getEmployeeCode();
String mobile = userInfo.getMobile();
Long userId = userInfo.getId();
if (StringUtils.isBlank(mobile)) {
// 校验手机号是否重复
UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getMobile, mobile).ne(UserInfo::getId, userId));
if (Objects.nonNull(repeatMobileUserInfo)) {
throw new BizException("该手机号码已被绑定,请问重复绑定");
}

String phoneNo = reqUserDetailEditPO.getPhoneNo();
userInfo.setMobile(phoneNo);
// 更新浙政钉相关数据
if (StringUtils.isNotBlank(phoneNo)) {
iDingEmployeeInfoService
.update(Wrappers.lambdaUpdate(DingEmployeeInfo.class)
.eq(DingEmployeeInfo::getMainJob, "true")
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode)
.set(DingEmployeeInfo::getBindUserMobile, phoneNo));
}
}

}

@Transactional(rollbackFor = Exception.class)
public Long generateUserId(String employeeCode) {
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)


Loading…
取消
儲存