|
@@ -203,6 +203,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
Person person = ConvertPersonTool.INSTANCE.convertAddDto2Entity(addPersonDTO);
|
|
Person person = ConvertPersonTool.INSTANCE.convertAddDto2Entity(addPersonDTO);
|
|
person.setNamePinyin(PinyinUtil.getPinyin(person.getName(), ""));
|
|
person.setNamePinyin(PinyinUtil.getPinyin(person.getName(), ""));
|
|
person.setAccountId(accountId);
|
|
person.setAccountId(accountId);
|
|
|
|
+ if (!CollectionUtils.isEmpty(addPersonDTO.getProfessions())) {
|
|
|
|
+ person.setProfession(String.join(",", addPersonDTO.getProfessions()));
|
|
|
|
+ }
|
|
// 设置默认值
|
|
// 设置默认值
|
|
setDefaultValue(person);
|
|
setDefaultValue(person);
|
|
save(person);
|
|
save(person);
|
|
@@ -232,6 +235,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean checkDuplicateUserName(String username) {
|
|
public Boolean checkDuplicateUserName(String username) {
|
|
|
|
+ if (StringUtils.isBlank(username)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
List<Person> people = queryByUsername(username);
|
|
List<Person> people = queryByUsername(username);
|
|
if (!CollectionUtils.isEmpty(people)) {
|
|
if (!CollectionUtils.isEmpty(people)) {
|
|
return true;
|
|
return true;
|
|
@@ -245,6 +251,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Boolean checkDuplicateMail(String mail) {
|
|
public Boolean checkDuplicateMail(String mail) {
|
|
|
|
+ if (StringUtils.isBlank(mail)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
PageQuerySaasAccountDTO pageQuerySaasAccountDTO = new PageQuerySaasAccountDTO();
|
|
PageQuerySaasAccountDTO pageQuerySaasAccountDTO = new PageQuerySaasAccountDTO();
|
|
pageQuerySaasAccountDTO.setMail(mail);
|
|
pageQuerySaasAccountDTO.setMail(mail);
|
|
List<SaasAccountListItemVO> accountListItemVoList = saasAccountService.querySaasAccountList(pageQuerySaasAccountDTO);
|
|
List<SaasAccountListItemVO> accountListItemVoList = saasAccountService.querySaasAccountList(pageQuerySaasAccountDTO);
|
|
@@ -261,6 +270,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean checkDuplicatePhoneNum(String phoneNum) {
|
|
public Boolean checkDuplicatePhoneNum(String phoneNum) {
|
|
|
|
+ if (StringUtils.isBlank(phoneNum)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
PageQuerySaasAccountDTO pageQuerySaasAccountDTO = new PageQuerySaasAccountDTO();
|
|
PageQuerySaasAccountDTO pageQuerySaasAccountDTO = new PageQuerySaasAccountDTO();
|
|
pageQuerySaasAccountDTO.setPhoneNum(phoneNum);
|
|
pageQuerySaasAccountDTO.setPhoneNum(phoneNum);
|
|
List<SaasAccountListItemVO> accountListItemVoList = saasAccountService.querySaasAccountList(pageQuerySaasAccountDTO);
|
|
List<SaasAccountListItemVO> accountListItemVoList = saasAccountService.querySaasAccountList(pageQuerySaasAccountDTO);
|
|
@@ -307,6 +319,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean checkDuplicateIdNumber(String idNumber) {
|
|
public Boolean checkDuplicateIdNumber(String idNumber) {
|
|
|
|
+ if (StringUtils.isBlank(idNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
List<Person> people = queryByIdCard(idNumber);
|
|
List<Person> people = queryByIdCard(idNumber);
|
|
return !CollectionUtils.isEmpty(people);
|
|
return !CollectionUtils.isEmpty(people);
|
|
}
|
|
}
|
|
@@ -321,6 +336,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public Boolean checkDuplicateJobNumber(String jobNumber) {
|
|
public Boolean checkDuplicateJobNumber(String jobNumber) {
|
|
|
|
+ if (StringUtils.isBlank(jobNumber)) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
List<Person> people = queryByJobNumber(jobNumber);
|
|
List<Person> people = queryByJobNumber(jobNumber);
|
|
return !CollectionUtils.isEmpty(people);
|
|
return !CollectionUtils.isEmpty(people);
|
|
}
|
|
}
|
|
@@ -427,7 +445,11 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
person.setModifier(DefaultAppContext.getContext().getAccountId());
|
|
person.setModifier(DefaultAppContext.getContext().getAccountId());
|
|
updateById(person);
|
|
updateById(person);
|
|
// 账号基本信息发生改变,更新账号信息
|
|
// 账号基本信息发生改变,更新账号信息
|
|
- SaasAccountListItemVO account = saasAccountService.querySaasAccountDetail(person.getAccountId());
|
|
|
|
|
|
+ String accountId = person.getAccountId();
|
|
|
|
+ if (StringUtils.isBlank(accountId)) {
|
|
|
|
+ throw new IllegalArgumentException("无法获取人员的账号信息,人员的账号id为空,人员id:" + personId);
|
|
|
|
+ }
|
|
|
|
+ SaasAccountListItemVO account = saasAccountService.querySaasAccountDetail(accountId);
|
|
if (accountInfoChanged(updatePersonDTO, account)) {
|
|
if (accountInfoChanged(updatePersonDTO, account)) {
|
|
UpdateSaasAccountDTO updateSaasAccountDTO = ConvertPersonTool.INSTANCE.
|
|
UpdateSaasAccountDTO updateSaasAccountDTO = ConvertPersonTool.INSTANCE.
|
|
convert2UpdateSaasAccountDTO(account, updatePersonDTO);
|
|
convert2UpdateSaasAccountDTO(account, updatePersonDTO);
|
|
@@ -436,24 +458,62 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
|
|
|
// 更新账号和角色的关联
|
|
// 更新账号和角色的关联
|
|
List<SaasAccountRole> saasAccountRoles = saasAccountRoleService.
|
|
List<SaasAccountRole> saasAccountRoles = saasAccountRoleService.
|
|
- querySaasAccountRoleListByAccountIdList(Lists.newArrayList(person.getAccountId()));
|
|
|
|
|
|
+ querySaasAccountRoleListByAccountIdList(Lists.newArrayList(accountId));
|
|
if (accountRoleChanged(saasAccountRoles, updatePersonDTO.getMainDuty(),
|
|
if (accountRoleChanged(saasAccountRoles, updatePersonDTO.getMainDuty(),
|
|
updatePersonDTO.getOtherDuties(), updatePersonDTO.getOtherRoles())) {
|
|
updatePersonDTO.getOtherDuties(), updatePersonDTO.getOtherRoles())) {
|
|
- // TODO: 2021/4/7
|
|
|
|
|
|
+ resetAccountRoles(updatePersonDTO, accountId);
|
|
}
|
|
}
|
|
|
|
|
|
// 更新账号和项目的关联
|
|
// 更新账号和项目的关联
|
|
List<SaasAccountProject> saasAccountProjects = saasAccountProjectService.
|
|
List<SaasAccountProject> saasAccountProjects = saasAccountProjectService.
|
|
- querySaasAccountProjectListByAccountId(person.getAccountId());
|
|
|
|
|
|
+ querySaasAccountProjectListByAccountId(accountId);
|
|
if (accountProjectsChanged(saasAccountProjects, updatePersonDTO.getProjectIds())) {
|
|
if (accountProjectsChanged(saasAccountProjects, updatePersonDTO.getProjectIds())) {
|
|
- // TODO: 2021/4/8
|
|
|
|
|
|
+ saasAccountProjectService.resetSaasAccountProject(accountId, updatePersonDTO.getProjectIds());
|
|
}
|
|
}
|
|
|
|
|
|
// 更新工作信息
|
|
// 更新工作信息
|
|
List<String> depIdsAfterUpdate = updatePersonDTO.getDepIds();
|
|
List<String> depIdsAfterUpdate = updatePersonDTO.getDepIds();
|
|
updatePersonWorkResumes(depIdsAfterUpdate, personId);
|
|
updatePersonWorkResumes(depIdsAfterUpdate, personId);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 重置账号与角色的关联关系
|
|
|
|
+ *
|
|
|
|
+ * @param updatePersonDTO 更新人员入参
|
|
|
|
+ * @param accountId 账号id
|
|
|
|
+ * @author lixing
|
|
|
|
+ * @version V1.0 2021/4/8 3:07 下午
|
|
|
|
+ */
|
|
|
|
+ private void resetAccountRoles(UpdatePersonDTO updatePersonDTO, String accountId) {
|
|
|
|
+ List<AddSaasAccountRoleDTO> accountRoleDTOList = Lists.newArrayList();
|
|
|
|
+ if (StringUtils.isNotBlank(updatePersonDTO.getMainDuty())) {
|
|
|
|
+ AddSaasAccountRoleDTO mainDutyDTO = new AddSaasAccountRoleDTO();
|
|
|
|
+ mainDutyDTO.setRoleId(updatePersonDTO.getMainDuty());
|
|
|
|
+ mainDutyDTO.setCasType(AccountRoleTypeEnum.MAIN_DUTY.getType());
|
|
|
|
+ accountRoleDTOList.add(mainDutyDTO);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!CollectionUtils.isEmpty(updatePersonDTO.getOtherDuties())) {
|
|
|
|
+ updatePersonDTO.getOtherDuties().forEach(otherDuty -> {
|
|
|
|
+ AddSaasAccountRoleDTO otherDutyDTO = new AddSaasAccountRoleDTO();
|
|
|
|
+ otherDutyDTO.setRoleId(otherDuty);
|
|
|
|
+ otherDutyDTO.setCasType(AccountRoleTypeEnum.OTHER_DUTY.getType());
|
|
|
|
+ accountRoleDTOList.add(otherDutyDTO);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!CollectionUtils.isEmpty(updatePersonDTO.getOtherRoles())) {
|
|
|
|
+ updatePersonDTO.getOtherRoles().forEach(otherRole -> {
|
|
|
|
+ AddSaasAccountRoleDTO otherDutyDTO = new AddSaasAccountRoleDTO();
|
|
|
|
+ otherDutyDTO.setRoleId(otherRole);
|
|
|
|
+ otherDutyDTO.setCasType(AccountRoleTypeEnum.SYS_ROLE.getType());
|
|
|
|
+ accountRoleDTOList.add(otherDutyDTO);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ saasAccountRoleService.resetSaasAccountRole(accountId, accountRoleDTOList);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 判断账号关联的项目是否发生变化
|
|
* 判断账号关联的项目是否发生变化
|
|
*
|
|
*
|
|
@@ -734,6 +794,15 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
@Override
|
|
@Override
|
|
public void batchUpdatePeople(BatchUpdatePersonDTO batchUpdatePersonDTO) {
|
|
public void batchUpdatePeople(BatchUpdatePersonDTO batchUpdatePersonDTO) {
|
|
// TODO: 2021/3/22 批量更新人员
|
|
// TODO: 2021/3/22 批量更新人员
|
|
|
|
+ List<Long> personIds = batchUpdatePersonDTO.getIds();
|
|
|
|
+ if (CollectionUtils.isEmpty(personIds)) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ personIds.forEach(personId -> {
|
|
|
|
+ UpdatePersonDTO updatePersonDTO = new UpdatePersonDTO();
|
|
|
|
+// updatePerson();
|
|
|
|
+ });
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|