0605 - 新入职时增加身份证copy
parent
b62f6121cc
commit
f0d3584c93
|
|
@ -79,6 +79,7 @@ public class UserAddExe {
|
||||||
// }
|
// }
|
||||||
private final CodeConfig codeConfig;
|
private final CodeConfig codeConfig;
|
||||||
private final UserExpandInfoRepository userExpandInfoRepository;
|
private final UserExpandInfoRepository userExpandInfoRepository;
|
||||||
|
private final ImgFilesRepository imgFilesRepository;
|
||||||
|
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean execute(UserAddCmd cmd) {
|
public boolean execute(UserAddCmd cmd) {
|
||||||
|
|
@ -380,11 +381,14 @@ public class UserAddExe {
|
||||||
|
|
||||||
if (firstUserWithIdCard.isPresent()) {
|
if (firstUserWithIdCard.isPresent()) {
|
||||||
UserDO user = firstUserWithIdCard.get();
|
UserDO user = firstUserWithIdCard.get();
|
||||||
|
String oldUserId = user.getUserId();
|
||||||
BeanUtils.copyProperties(user, userE);
|
BeanUtils.copyProperties(user, userE);
|
||||||
userE.setId(null);
|
userE.setId(null);
|
||||||
userE.initFormOnboarding(cmd.getCorpinfoId(), cmd.getDepartmentId(), cmd.getPostName(), Tools.get32UUID());
|
userE.initFormOnboarding(cmd.getCorpinfoId(), cmd.getDepartmentId(), cmd.getPostName(), Tools.get32UUID());
|
||||||
userE.setFlowFlag(flowFlag);
|
userE.setFlowFlag(flowFlag);
|
||||||
userRepository.saveOnboardingUser(userE);
|
userRepository.saveOnboardingUser(userE);
|
||||||
|
// 复制身份证照片
|
||||||
|
copyIdCardPhotos(oldUserId, userE.getUserId());
|
||||||
} else {
|
} else {
|
||||||
// 没有找到符合条件的用户
|
// 没有找到符合条件的用户
|
||||||
throw new BizException("当前用户不存在完整用户信息");
|
throw new BizException("当前用户不存在完整用户信息");
|
||||||
|
|
@ -420,11 +424,14 @@ public class UserAddExe {
|
||||||
|
|
||||||
if (firstUserWithIdCard.isPresent()) {
|
if (firstUserWithIdCard.isPresent()) {
|
||||||
UserDO user = firstUserWithIdCard.get();
|
UserDO user = firstUserWithIdCard.get();
|
||||||
|
String oldUserId = user.getUserId();
|
||||||
BeanUtils.copyProperties(user, userE);
|
BeanUtils.copyProperties(user, userE);
|
||||||
userE.setId(null);
|
userE.setId(null);
|
||||||
userE.initFormOnboarding(cmd.getCorpinfoId(), cmd.getDepartmentId(), cmd.getPostName(), Tools.get32UUID());
|
userE.initFormOnboarding(cmd.getCorpinfoId(), cmd.getDepartmentId(), cmd.getPostName(), Tools.get32UUID());
|
||||||
userE.setFlowFlag(flowFlag);
|
userE.setFlowFlag(flowFlag);
|
||||||
userRepository.saveOnboardingUser(userE);
|
userRepository.saveOnboardingUser(userE);
|
||||||
|
// 复制身份证照片
|
||||||
|
copyIdCardPhotos(oldUserId, userE.getUserId());
|
||||||
} else {
|
} else {
|
||||||
// 没有找到符合条件的用户
|
// 没有找到符合条件的用户
|
||||||
throw new BizException("当前用户不存在完整用户信息");
|
throw new BizException("当前用户不存在完整用户信息");
|
||||||
|
|
@ -599,5 +606,34 @@ public class UserAddExe {
|
||||||
|
|
||||||
public void addCorpInfo(CorpInfoAddCmd cmd) {
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue