|
@@ -457,18 +457,11 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
* @version V1.0 2021-03-15 17:20:31
|
|
|
*/
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void updatePerson(UpdatePersonDTO updatePersonDTO) {
|
|
|
String personId = updatePersonDTO.getId();
|
|
|
- Person person = getById(personId);
|
|
|
- person = ConvertPersonTool.INSTANCE.convertUpdateDto2Entity(person, updatePersonDTO);
|
|
|
- List<String> professions = updatePersonDTO.getProfessions();
|
|
|
- if (CollectionUtils.isEmpty(professions)) {
|
|
|
- person.setProfession("");
|
|
|
- } else {
|
|
|
- person.setProfession(String.join(",", professions));
|
|
|
- }
|
|
|
- person.setModifier(DefaultAppContext.getContext().getAccountId());
|
|
|
- updateById(person);
|
|
|
+ // 更新人员基本信息
|
|
|
+ Person person = updatePersonBaseInfo(updatePersonDTO, personId);
|
|
|
// 账号基本信息发生改变,更新账号信息
|
|
|
String accountId = person.getAccountId();
|
|
|
if (StringUtils.isBlank(accountId)) {
|
|
@@ -503,6 +496,30 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 更新人员基本信息
|
|
|
+ *
|
|
|
+ * @param updatePersonDTO 更新人员入参
|
|
|
+ * @param personId 人员id
|
|
|
+ * @return 更新后的人员对象
|
|
|
+ * @exception
|
|
|
+ * @author lixing
|
|
|
+ * @version V1.0 2021/4/9 7:30 下午
|
|
|
+ */
|
|
|
+ private Person updatePersonBaseInfo(UpdatePersonDTO updatePersonDTO, String personId) {
|
|
|
+ Person person = getById(personId);
|
|
|
+ person = ConvertPersonTool.INSTANCE.convertUpdateDto2Entity(person, updatePersonDTO);
|
|
|
+ List<String> professions = updatePersonDTO.getProfessions();
|
|
|
+ if (CollectionUtils.isEmpty(professions)) {
|
|
|
+ person.setProfession("");
|
|
|
+ } else {
|
|
|
+ person.setProfession(String.join(",", professions));
|
|
|
+ }
|
|
|
+ person.setModifier(DefaultAppContext.getContext().getAccountId());
|
|
|
+ updateById(person);
|
|
|
+ return person;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 重置账号与角色的关联关系
|
|
|
*
|
|
|
* @param updatePersonDTO 更新人员入参
|
|
@@ -822,17 +839,46 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional
|
|
|
public void batchUpdatePeople(BatchUpdatePersonDTO batchUpdatePersonDTO) {
|
|
|
- // TODO: 2021/3/22 批量更新人员
|
|
|
- List<Long> personIds = batchUpdatePersonDTO.getIds();
|
|
|
+
|
|
|
+ List<String> personIds = batchUpdatePersonDTO.getIds();
|
|
|
if (CollectionUtils.isEmpty(personIds)) {
|
|
|
return;
|
|
|
}
|
|
|
- personIds.forEach(personId -> {
|
|
|
- UpdatePersonDTO updatePersonDTO = new UpdatePersonDTO();
|
|
|
- // updatePerson();
|
|
|
- });
|
|
|
|
|
|
+ // 更新人员基本信息
|
|
|
+ if (batchUpdatePersonDTO.getPersonType() != null ||
|
|
|
+ batchUpdatePersonDTO.getProfessions() != null) {
|
|
|
+ personIds.forEach(personId -> {
|
|
|
+ UpdatePersonDTO updatePersonDTO = new UpdatePersonDTO();
|
|
|
+ updatePersonDTO.setPersonType(batchUpdatePersonDTO.getPersonType());
|
|
|
+ updatePersonDTO.setProfessions(batchUpdatePersonDTO.getProfessions());
|
|
|
+ updatePersonBaseInfo(updatePersonDTO, personId);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新工作信息
|
|
|
+ if (batchUpdatePersonDTO.getDepIds() != null) {
|
|
|
+ personIds.forEach(personId -> {
|
|
|
+ updatePersonWorkResumes(batchUpdatePersonDTO.getDepIds(), personId);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新主岗
|
|
|
+ if (batchUpdatePersonDTO.getMainDuty() != null) {
|
|
|
+ // TODO: 2021/4/9 需要运维平台更新账号角色关联关系接口增加关联类型字段
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新副岗
|
|
|
+ if (batchUpdatePersonDTO.getOtherDuties() != null) {
|
|
|
+ // TODO: 2021/4/9 需要运维平台更新账号角色关联关系接口增加关联类型字段
|
|
|
+ }
|
|
|
+
|
|
|
+ // 更新附加角色
|
|
|
+ if (batchUpdatePersonDTO.getOtherRoles() != null) {
|
|
|
+ // TODO: 2021/4/9 需要运维平台更新账号角色关联关系接口增加关联类型字段
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|