|
|
@@ -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); |
|
|
|