0605 - 新入职时增加身份证copy
parent
b62f6121cc
commit
f0d3584c93
|
|
@ -79,6 +79,7 @@ public class UserAddExe {
|
|||
// }
|
||||
private final CodeConfig codeConfig;
|
||||
private final UserExpandInfoRepository userExpandInfoRepository;
|
||||
private final ImgFilesRepository imgFilesRepository;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean execute(UserAddCmd cmd) {
|
||||
|
|
@ -380,11 +381,14 @@ public class UserAddExe {
|
|||
|
||||
if (firstUserWithIdCard.isPresent()) {
|
||||
UserDO user = firstUserWithIdCard.get();
|
||||
String oldUserId = user.getUserId();
|
||||
BeanUtils.copyProperties(user, userE);
|
||||
userE.setId(null);
|
||||
userE.initFormOnboarding(cmd.getCorpinfoId(), cmd.getDepartmentId(), cmd.getPostName(), Tools.get32UUID());
|
||||
userE.setFlowFlag(flowFlag);
|
||||
userRepository.saveOnboardingUser(userE);
|
||||
// 复制身份证照片
|
||||
copyIdCardPhotos(oldUserId, userE.getUserId());
|
||||
} else {
|
||||
// 没有找到符合条件的用户
|
||||
throw new BizException("当前用户不存在完整用户信息");
|
||||
|
|
@ -420,11 +424,14 @@ public class UserAddExe {
|
|||
|
||||
if (firstUserWithIdCard.isPresent()) {
|
||||
UserDO user = firstUserWithIdCard.get();
|
||||
String oldUserId = user.getUserId();
|
||||
BeanUtils.copyProperties(user, userE);
|
||||
userE.setId(null);
|
||||
userE.initFormOnboarding(cmd.getCorpinfoId(), cmd.getDepartmentId(), cmd.getPostName(), Tools.get32UUID());
|
||||
userE.setFlowFlag(flowFlag);
|
||||
userRepository.saveOnboardingUser(userE);
|
||||
// 复制身份证照片
|
||||
copyIdCardPhotos(oldUserId, userE.getUserId());
|
||||
} else {
|
||||
// 没有找到符合条件的用户
|
||||
throw new BizException("当前用户不存在完整用户信息");
|
||||
|
|
@ -599,5 +606,34 @@ public class UserAddExe {
|
|||
|
||||
public void addCorpInfo(CorpInfoAddCmd cmd) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制身份证照片从老用户到新用户
|
||||
* @param oldUserId 老用户UUID
|
||||
* @param newUserId 新用户UUID
|
||||
*/
|
||||
private void copyIdCardPhotos(String oldUserId, String newUserId) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("eqForeignKey", newUserId.toString());
|
||||
params.put("eqType", 14);
|
||||
params.put("eqDeleteEnum", "FALSE");
|
||||
List<ImgFilesDO> newExistImgFiles = imgFilesRepository.listAll(params);
|
||||
if (CollUtil.isNotEmpty(newExistImgFiles)) {
|
||||
return;
|
||||
}
|
||||
params.put("eqForeignKey", oldUserId.toString());
|
||||
List<ImgFilesDO> oldImgFiles = imgFilesRepository.listAll(params);
|
||||
if (CollUtil.isNotEmpty(oldImgFiles)) {
|
||||
List<ImgFilesDO> newImgFiles = oldImgFiles.stream().map(img -> {
|
||||
ImgFilesDO newImg = new ImgFilesDO();
|
||||
BeanUtils.copyProperties(img, newImg);
|
||||
newImg.setId(null);
|
||||
newImg.setImgFilesId(Tools.get32UUID());
|
||||
newImg.setForeignKey(newUserId.toString());
|
||||
return newImg;
|
||||
}).collect(Collectors.toList());
|
||||
imgFilesRepository.saveBatch(newImgFiles);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public class UserCorpRecordQueryExe {
|
|||
*/
|
||||
public PageResponse<UserCorpRecordCO> execute(UserCorpRecordPageQry userCorpRecordPageQry) {
|
||||
|
||||
Long userId = userCorpRecordPageQry.getEqUserId()==null?AuthContext.getUserId():userCorpRecordPageQry.getEqUserId();
|
||||
Long userId = userCorpRecordPageQry.getEqUserId() == null ? AuthContext.getUserId() : userCorpRecordPageQry.getEqUserId();
|
||||
UserDO userDO = userRepository.getById(userId);
|
||||
if(userDO == null){
|
||||
return PageResponse.of(null, 0, userCorpRecordPageQry.getPageSize(), userCorpRecordPageQry.getPageIndex());
|
||||
|
|
|
|||
Loading…
Reference in New Issue