|
@@ -1,6 +1,7 @@
|
|
|
package com.persagy.fm.person.service.impl;
|
|
|
|
|
|
import cn.hutool.extra.pinyin.PinyinUtil;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -500,9 +501,9 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
* 更新人员基本信息
|
|
|
*
|
|
|
* @param updatePersonDTO 更新人员入参
|
|
|
- * @param personId 人员id
|
|
|
+ * @param personId 人员id
|
|
|
* @return 更新后的人员对象
|
|
|
- * @exception
|
|
|
+ * @throws
|
|
|
* @author lixing
|
|
|
* @version V1.0 2021/4/9 7:30 下午
|
|
|
*/
|
|
@@ -869,17 +870,46 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
|
|
|
// 更新主岗
|
|
|
if (batchUpdatePersonDTO.getMainDuty() != null) {
|
|
|
- // TODO: 2021/4/9 需要运维平台更新账号角色关联关系接口增加关联类型字段
|
|
|
+ personIds.forEach(personId -> {
|
|
|
+ Person person = getById(personId);
|
|
|
+ AddSaasAccountRoleDTO addSaasAccountRoleDTO = new AddSaasAccountRoleDTO();
|
|
|
+ addSaasAccountRoleDTO.setRoleId(batchUpdatePersonDTO.getMainDuty());
|
|
|
+ addSaasAccountRoleDTO.setCasType(AccountRoleTypeEnum.MAIN_DUTY.getType());
|
|
|
+ saasAccountRoleService.resetSaasAccountRole(
|
|
|
+ person.getAccountId(), Lists.newArrayList(addSaasAccountRoleDTO));
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// 更新副岗
|
|
|
if (batchUpdatePersonDTO.getOtherDuties() != null) {
|
|
|
- // TODO: 2021/4/9 需要运维平台更新账号角色关联关系接口增加关联类型字段
|
|
|
+ personIds.forEach(personId -> {
|
|
|
+ Person person = getById(personId);
|
|
|
+ List<AddSaasAccountRoleDTO> otherDuties = batchUpdatePersonDTO.getOtherDuties().stream().map(
|
|
|
+ otherDuty -> {
|
|
|
+ AddSaasAccountRoleDTO addSaasAccountRoleDTO = new AddSaasAccountRoleDTO();
|
|
|
+ addSaasAccountRoleDTO.setRoleId(otherDuty);
|
|
|
+ addSaasAccountRoleDTO.setCasType(AccountRoleTypeEnum.OTHER_DUTY.getType());
|
|
|
+ return addSaasAccountRoleDTO;
|
|
|
+ }
|
|
|
+ ).collect(Collectors.toList());
|
|
|
+ saasAccountRoleService.resetSaasAccountRole(person.getAccountId(), otherDuties);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
// 更新附加角色
|
|
|
if (batchUpdatePersonDTO.getOtherRoles() != null) {
|
|
|
- // TODO: 2021/4/9 需要运维平台更新账号角色关联关系接口增加关联类型字段
|
|
|
+ personIds.forEach(personId -> {
|
|
|
+ Person person = getById(personId);
|
|
|
+ List<AddSaasAccountRoleDTO> otherRoles = batchUpdatePersonDTO.getOtherRoles().stream().map(
|
|
|
+ otherRole -> {
|
|
|
+ AddSaasAccountRoleDTO addSaasAccountRoleDTO = new AddSaasAccountRoleDTO();
|
|
|
+ addSaasAccountRoleDTO.setRoleId(otherRole);
|
|
|
+ addSaasAccountRoleDTO.setCasType(AccountRoleTypeEnum.SYS_ROLE.getType());
|
|
|
+ return addSaasAccountRoleDTO;
|
|
|
+ }
|
|
|
+ ).collect(Collectors.toList());
|
|
|
+ saasAccountRoleService.resetSaasAccountRole(person.getAccountId(), otherRoles);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1050,4 +1080,17 @@ public class PersonServiceImpl extends ServiceImpl<PersonMapper, Person>
|
|
|
|
|
|
return latestJobNumberVO;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<Person> queryByProfessionId(String professionId) {
|
|
|
+ if (StringUtils.isBlank(professionId)) {
|
|
|
+ throw new IllegalArgumentException("根据专业查询人员,专业id不可为空");
|
|
|
+ }
|
|
|
+ LambdaQueryWrapper<Person> personLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ personLambdaQueryWrapper.
|
|
|
+ // apply(Person.PROP_PROFESSION + " like{0}", "%" + professionId + "%").
|
|
|
+ like(Person::getProfession, "%" + professionId + "%").
|
|
|
+ eq(Person::getValid, ValidEnum.TRUE.getType());
|
|
|
+ return list(personLambdaQueryWrapper);
|
|
|
+ }
|
|
|
}
|