|
@@ -10,7 +10,6 @@ import com.persagy.fm.common.constant.enums.ValidEnum;
|
|
import com.persagy.fm.common.context.DefaultAppContext;
|
|
import com.persagy.fm.common.context.DefaultAppContext;
|
|
import com.persagy.fm.common.model.vo.SimpleObjVO;
|
|
import com.persagy.fm.common.model.vo.SimpleObjVO;
|
|
import com.persagy.fm.common.utils.ListUtil;
|
|
import com.persagy.fm.common.utils.ListUtil;
|
|
-import com.persagy.fm.department.model.Department;
|
|
|
|
import com.persagy.fm.department.model.vo.DepSimpleObjVO;
|
|
import com.persagy.fm.department.model.vo.DepSimpleObjVO;
|
|
import com.persagy.fm.department.service.IDepartmentService;
|
|
import com.persagy.fm.department.service.IDepartmentService;
|
|
import com.persagy.fm.person.dao.PersonMapper;
|
|
import com.persagy.fm.person.dao.PersonMapper;
|
|
@@ -336,6 +335,38 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 校验重复项
|
|
|
|
+ *
|
|
|
|
+ * @param updatePerson4FrontEndDTO 更新人员入参
|
|
|
|
+ * @author lixing
|
|
|
|
+ * @version V1.0 2021/3/22 9:53 上午
|
|
|
|
+ */
|
|
|
|
+ private void checkUpdatePersonDTO(UpdatePerson4FrontEndDTO updatePerson4FrontEndDTO) {
|
|
|
|
+ String personId = updatePerson4FrontEndDTO.getId();
|
|
|
|
+ Person person = getById(personId);
|
|
|
|
+ // 校验身份证号
|
|
|
|
+ if (checkDuplicateIdNumber(updatePerson4FrontEndDTO.getIdNumber(), person)) {
|
|
|
|
+ throw new IllegalArgumentException("身份证号重复");
|
|
|
|
+ }
|
|
|
|
+ // 校验账号
|
|
|
|
+ if (checkDuplicateUserName(updatePerson4FrontEndDTO.getUsername(), person)) {
|
|
|
|
+ throw new IllegalArgumentException("账号已被使用");
|
|
|
|
+ }
|
|
|
|
+ // 校验手机号
|
|
|
|
+ if (checkDuplicatePhoneNum(updatePerson4FrontEndDTO.getPhoneNum(), person)) {
|
|
|
|
+ throw new IllegalArgumentException("手机号已被使用");
|
|
|
|
+ }
|
|
|
|
+ // 校验工号
|
|
|
|
+ if (checkDuplicateJobNumber(updatePerson4FrontEndDTO.getJobNumber(), person)) {
|
|
|
|
+ throw new IllegalArgumentException("工号已被使用");
|
|
|
|
+ }
|
|
|
|
+ // 校验邮箱
|
|
|
|
+ if (checkDuplicateMail(updatePerson4FrontEndDTO.getMail(), person)) {
|
|
|
|
+ throw new IllegalArgumentException("邮箱已被使用");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 校验身份证号重复
|
|
* 校验身份证号重复
|
|
*
|
|
*
|
|
* @param idNumber 身份证号
|
|
* @param idNumber 身份证号
|
|
@@ -466,6 +497,7 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
@Override
|
|
@Override
|
|
@Transactional
|
|
@Transactional
|
|
public void updatePerson(UpdatePerson4FrontEndDTO updatePerson4FrontEndDTO) {
|
|
public void updatePerson(UpdatePerson4FrontEndDTO updatePerson4FrontEndDTO) {
|
|
|
|
+ checkUpdatePersonDTO(updatePerson4FrontEndDTO);
|
|
String personId = updatePerson4FrontEndDTO.getId();
|
|
String personId = updatePerson4FrontEndDTO.getId();
|
|
// 更新人员基本信息
|
|
// 更新人员基本信息
|
|
Person person = updatePersonBaseInfo(updatePerson4FrontEndDTO, personId);
|
|
Person person = updatePersonBaseInfo(updatePerson4FrontEndDTO, personId);
|
|
@@ -534,7 +566,7 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
* 校验直接上级
|
|
* 校验直接上级
|
|
*
|
|
*
|
|
* @param leaderId 直接上级id
|
|
* @param leaderId 直接上级id
|
|
- * @param person 人员对象
|
|
|
|
|
|
+ * @param person 人员对象
|
|
* @author lixing
|
|
* @author lixing
|
|
* @version V1.0 2021/4/22 11:43 上午
|
|
* @version V1.0 2021/4/22 11:43 上午
|
|
*/
|
|
*/
|
|
@@ -1002,9 +1034,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
/**
|
|
/**
|
|
* 批量更新时,验证人员的主副岗是否重复
|
|
* 批量更新时,验证人员的主副岗是否重复
|
|
*
|
|
*
|
|
- * @param mainDuty 更新条件中的主岗,为空代表不更新
|
|
|
|
|
|
+ * @param mainDuty 更新条件中的主岗,为空代表不更新
|
|
* @param otherDuties 更新条件中的副岗,为空代表不更新
|
|
* @param otherDuties 更新条件中的副岗,为空代表不更新
|
|
- * @param personId 人员id
|
|
|
|
|
|
+ * @param personId 人员id
|
|
* @author lixing
|
|
* @author lixing
|
|
* @version V1.0 2021/4/21 7:44 下午
|
|
* @version V1.0 2021/4/21 7:44 下午
|
|
*/
|
|
*/
|
|
@@ -1019,7 +1051,7 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
String personMainDuty = mainDuty;
|
|
String personMainDuty = mainDuty;
|
|
if (mainDuty == null) {
|
|
if (mainDuty == null) {
|
|
SimpleObjVO mainDutyVO = accountRoleVO.getMainDuty();
|
|
SimpleObjVO mainDutyVO = accountRoleVO.getMainDuty();
|
|
- personMainDuty = mainDutyVO == null? null: mainDutyVO.getId();
|
|
|
|
|
|
+ personMainDuty = mainDutyVO == null ? null : mainDutyVO.getId();
|
|
}
|
|
}
|
|
List<String> personOtherDuties = otherDuties;
|
|
List<String> personOtherDuties = otherDuties;
|
|
if (otherDuties == null) {
|
|
if (otherDuties == null) {
|
|
@@ -1029,7 +1061,7 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
map(SimpleObjVO::getId).collect(Collectors.toList());
|
|
map(SimpleObjVO::getId).collect(Collectors.toList());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(!CollectionUtils.isEmpty(personOtherDuties)
|
|
|
|
|
|
+ if (!CollectionUtils.isEmpty(personOtherDuties)
|
|
&& StringUtils.isNotBlank(personMainDuty)
|
|
&& StringUtils.isNotBlank(personMainDuty)
|
|
&& personOtherDuties.contains(personMainDuty)) {
|
|
&& personOtherDuties.contains(personMainDuty)) {
|
|
throw new IllegalArgumentException("人员主岗与副岗不能出现重合");
|
|
throw new IllegalArgumentException("人员主岗与副岗不能出现重合");
|
|
@@ -1243,4 +1275,83 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
List<Person> result = list(queryWrapper);
|
|
List<Person> result = list(queryWrapper);
|
|
return packagePageResult(result, result.size());
|
|
return packagePageResult(result, result.size());
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean checkDuplicatePhoneNum(String phoneNumber, Person person) {
|
|
|
|
+ if (StringUtils.isBlank(phoneNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ SaasAccountListItemVO saasAccountListItemVO = saasAccountService.querySaasAccountDetail(person.getAccountId());
|
|
|
|
+ String accountPhoneNumber = saasAccountListItemVO.getPhoneNum();
|
|
|
|
+ if (phoneNumber.equals(accountPhoneNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return checkDuplicatePhoneNum(phoneNumber);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean checkDuplicateIdNumber(String idNumber, Person person) {
|
|
|
|
+ if (StringUtils.isBlank(idNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (person == null) {
|
|
|
|
+ return checkDuplicateIdNumber(idNumber);
|
|
|
|
+ }
|
|
|
|
+ String personIdNumber = person.getIdNumber();
|
|
|
|
+ if (idNumber.equals(personIdNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return checkDuplicateIdNumber(idNumber);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean checkDuplicateUserName(String username, Person person) {
|
|
|
|
+ if (StringUtils.isBlank(username)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (person == null) {
|
|
|
|
+ return checkDuplicateUserName(username);
|
|
|
|
+ }
|
|
|
|
+ String personUsername = person.getUsername();
|
|
|
|
+ if (username.equals(personUsername)) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return checkDuplicateUserName(username);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean checkDuplicateJobNumber(String jobNumber, Person person) {
|
|
|
|
+ if (StringUtils.isBlank(jobNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (person == null) {
|
|
|
|
+ return checkDuplicateJobNumber(jobNumber);
|
|
|
|
+ }
|
|
|
|
+ String personJobNumber = person.getJobNumber();
|
|
|
|
+ if (jobNumber.equals(personJobNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return checkDuplicateJobNumber(jobNumber);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Boolean checkDuplicateMail(String mail, Person person) {
|
|
|
|
+ if (StringUtils.isBlank(mail)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
|
|
+ if (person == null) {
|
|
|
|
+ return checkDuplicateMail(mail);
|
|
|
|
+ }
|
|
|
|
+ SaasAccountListItemVO saasAccountListItemVO = saasAccountService.querySaasAccountDetail(person.getAccountId());
|
|
|
|
+ String accountMail = saasAccountListItemVO.getMail();
|
|
|
|
+ if (mail.equals(accountMail)) {
|
|
|
|
+ return false;
|
|
|
|
+ } else {
|
|
|
|
+ return checkDuplicateMail(mail);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|