feat(smartfactory): 为员工导入功能添加银行卡信息并优化更新逻辑
- 在 StaffImportExcelVO 中添加银行名称和银行卡号字段 - 优化员工信息更新逻辑,增加对用户名和身份证号的校验 - 在员工导入时设置银行卡名称和银行卡号 - 改进员工信息匹配逻辑,支持模糊匹配用户名
This commit is contained in:
parent
6cf49d88b1
commit
4131f6100d
@ -41,6 +41,12 @@ public class StaffImportExcelVO {
|
||||
@IdCard
|
||||
private String idCard;
|
||||
|
||||
@ExcelProperty("银行名称")
|
||||
private String bankName;
|
||||
|
||||
@ExcelProperty("银行卡号")
|
||||
private String bankNo;
|
||||
|
||||
@ExcelProperty("薪资")
|
||||
private BigDecimal salary;
|
||||
}
|
||||
|
@ -68,21 +68,22 @@ public class StaffServiceImpl implements StaffService {
|
||||
|
||||
@Override
|
||||
public void updateStaff(StaffSaveReqVO updateReqVO) {
|
||||
if (staffMapper.selectById(updateReqVO.getId()) == null) {
|
||||
StaffDO staff = staffMapper.selectById(updateReqVO.getId());
|
||||
if (staff == null) {
|
||||
throw exception(STAFF_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 校验用户名、身份证号是否已经存在
|
||||
Long cunt = staffMapper.selectCount(new LambdaQueryWrapperX<StaffDO>()
|
||||
.neIfPresent(StaffDO::getId, updateReqVO.getId())
|
||||
.eqIfPresent(StaffDO::getIdCard, updateReqVO.getIdCard()));
|
||||
if (cunt > 0) {
|
||||
throw exception(USER_USERNAME_EXISTS);
|
||||
if (!staff.getIdCard().equals(updateReqVO.getIdCard()) || !staff.getNickName().equals(updateReqVO.getNickName())) {
|
||||
// 校验用户名、身份证号是否已经存在
|
||||
Long cunt = staffMapper.selectCount(new LambdaQueryWrapperX<StaffDO>()
|
||||
.neIfPresent(StaffDO::getId, updateReqVO.getId())
|
||||
.eqIfPresent(StaffDO::getIdCard, updateReqVO.getIdCard())
|
||||
.eqIfPresent(StaffDO::getNickName, updateReqVO.getNickName()));
|
||||
if (cunt > 0) {
|
||||
throw exception(USER_USERNAME_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
// 身份证号是否已经存在
|
||||
validateUserForCreate(null, null, null, updateReqVO.getIdCard());
|
||||
|
||||
// 更新
|
||||
StaffDO updateObj = BeanUtils.toBean(updateReqVO, StaffDO.class);
|
||||
staffMapper.updateById(updateObj);
|
||||
@ -201,6 +202,9 @@ public class StaffServiceImpl implements StaffService {
|
||||
//设置 性别、年龄
|
||||
updateUser.setSex(idCardDO.getSex());
|
||||
updateUser.setAge(idCardDO.getAge());
|
||||
// 设置银行卡名称、 银行卡号
|
||||
updateUser.setBankName(importUser.getBankName());
|
||||
updateUser.setBankNo(importUser.getBankNo());
|
||||
|
||||
//设置部门ID
|
||||
if (StrUtil.isNotEmpty(importUser.getFactoryName())) {
|
||||
@ -226,12 +230,14 @@ public class StaffServiceImpl implements StaffService {
|
||||
if (updateSupport) {
|
||||
StaffDO staffDO = staffMapper.selectOne(new LambdaQueryWrapperX<StaffDO>()
|
||||
.eqIfPresent(StaffDO::getIdCard, importUser.getIdCard())
|
||||
.eqIfPresent(StaffDO::getNickName, importUser.getNickName()));
|
||||
.likeIfPresent(StaffDO::getNickName, importUser.getNickName()));
|
||||
|
||||
updateUser.setId(staffDO.getId());
|
||||
staffMapper.updateById(updateUser);
|
||||
respVO.getUpdateUsernames().add(importUser.getNickName());
|
||||
return;
|
||||
if (staffDO != null) {
|
||||
updateUser.setId(staffDO.getId());
|
||||
staffMapper.updateById(updateUser);
|
||||
respVO.getUpdateUsernames().add(importUser.getNickName());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 插入用户
|
||||
|
Loading…
Reference in New Issue
Block a user