Browse Source

fix 修改用户 提示浙政钉用户编码不能为空,但是界面没有用户编码

tags/24080901
niohe·erbao 1 year ago
parent
commit
5b40251e99
3 changed files with 22 additions and 7 deletions
  1. +20
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java
  2. +2
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailEditPO.java
  3. +0
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailPO.java

+ 20
- 3
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserInfoManage.java View File

@@ -254,7 +254,15 @@ public class UserInfoManage {
}

public ResUserDetailVO userInfoDetail(ReqUserDetailPO reqUserDetailPO) {
Long userId = generateUserId(reqUserDetailPO.getEmployeeCode());
Long userId = reqUserDetailPO.getUserId();
String employeeCode = reqUserDetailPO.getEmployeeCode();
if (StringUtils.isBlank(employeeCode) && Objects.isNull(userId)) {
throw new BizException("employeeCode and userId can't not be null");
}
if (Objects.isNull(userId)) {
userId = generateUserId(reqUserDetailPO.getEmployeeCode());
}

UserInfo userInfo = iUserInfoService.getById(userId);
if (Objects.isNull(userInfo)) {
return null;
@@ -285,7 +293,15 @@ public class UserInfoManage {

@Transactional(rollbackFor = Exception.class)
public void userInfoDetailEdit(ReqUserDetailEditPO reqUserDetailEditPO) {
Long userId = generateUserId(reqUserDetailEditPO.getEmployeeCode());
Long userId = reqUserDetailEditPO.getUserId();
if (Objects.isNull(userId)) {
String employeeCode = reqUserDetailEditPO.getEmployeeCode();
if (StringUtils.isBlank(employeeCode)) {
throw new IllegalArgumentException("employeeCode can't be null");
}
userId = generateUserId(employeeCode);
}

UserInfo userInfo = iUserInfoService.getById(userId);
// 绑定用户手机号
bandUserMobile(userInfo, reqUserDetailEditPO);
@@ -298,10 +314,11 @@ public class UserInfoManage {
List<UserRoleVO> userRoleInfoList = reqUserDetailEditPO.getUserRoleInfoList();
iUserRoleService.remove(Wrappers.lambdaQuery(UserRole.class).eq(UserRole::getUserId, userId));
if (CollUtil.isNotEmpty(userRoleInfoList)) {
Long finalUserId = userId;
List<UserRole> userRoleList = userRoleInfoList.stream().map(r -> {
UserRole saveRecord = new UserRole();
saveRecord.setRoleId(r.getId());
saveRecord.setUserId(userId);
saveRecord.setUserId(finalUserId);
return saveRecord;
}).collect(Collectors.toList());
iUserRoleService.saveBatch(userRoleList);


+ 2
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailEditPO.java View File

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
@@ -16,10 +17,10 @@ import java.util.List;
@ApiModel("用户详情编辑请求")
public class ReqUserDetailEditPO {

@NotNull(message = "用户id 不能为空")
@ApiModelProperty("userId")
private Long userId;

@NotBlank(message = "浙政钉 用户编码 不能为空")
@ApiModelProperty("浙政钉 用户编码")
private String employeeCode;



+ 0
- 3
pmapi/src/main/java/com/ningdatech/pmapi/user/model/po/ReqUserDetailPO.java View File

@@ -4,8 +4,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotBlank;

/**
* @author liuxinxin
* @date 2023/2/15 上午8:43
@@ -17,7 +15,6 @@ public class ReqUserDetailPO {
@ApiModelProperty("用户id")
private Long userId;

@NotBlank(message = "浙政钉 用户编码 不能为空")
@ApiModelProperty("浙政钉 用户编码")
private String employeeCode;



Loading…
Cancel
Save