|
@@ -288,16 +288,30 @@ private AssoPersonVipMapper assoPersonVipMapper;
|
|
*/
|
|
*/
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
|
public boolean editPerson(EditPersonDTO vo) {
|
|
public boolean editPerson(EditPersonDTO vo) {
|
|
- if (!RegexUtil.isPhoneLegal(vo.getPhoneNum())) {
|
|
|
|
- throw new BusinessException(ExceptionEnum.PHONE_FORMAT_ERROR);
|
|
|
|
|
|
+ PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
|
|
|
|
+ if (StringUtils.isNotEmpty(vo.getPhoneNum())) {
|
|
|
|
+ if (!RegexUtil.isPhoneLegal(vo.getPhoneNum())) {
|
|
|
|
+ throw new BusinessException(ExceptionEnum.PHONE_FORMAT_ERROR);
|
|
|
|
+ }
|
|
|
|
+ long count = personMapper.selectCount(new LambdaQueryWrapper<Person>()
|
|
|
|
+ .eq(Person::getPhoneNum, vo.getPhoneNum()));
|
|
|
|
+ if (count > 0) {
|
|
|
|
+ throw new BusinessException(ExceptionEnum.THE_PHONE_CANNOT_BE_EXIST);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Person person = personMapper.selectById(personnelVO.getId());
|
|
|
|
+ if (StringUtils.isNotEmpty(vo.getName())) {
|
|
|
|
+ person.setName(vo.getName());
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(vo.getFileGuid())) {
|
|
|
|
+ person.setFileGuid(vo.getFileGuid());
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isNotEmpty(vo.getEmail())) {
|
|
|
|
+ person.setEmail(vo.getEmail());
|
|
}
|
|
}
|
|
- long count = personMapper.selectCount(new LambdaQueryWrapper<Person>()
|
|
|
|
- .eq(Person::getPhoneNum, vo.getPhoneNum()));
|
|
|
|
- if (count > 0) {
|
|
|
|
- throw new BusinessException(ExceptionEnum.THE_PHONE_CANNOT_BE_EXIST);
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(vo.getPhoneNum())) {
|
|
|
|
+ person.setPhoneNum(vo.getPhoneNum());
|
|
}
|
|
}
|
|
- Person person = personMapper.selectById(vo.getId());
|
|
|
|
- BeanUtil.copy(vo, person);
|
|
|
|
person.updateById();
|
|
person.updateById();
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|