Commit 95c60ba6 authored by kongfm's avatar kongfm

FLC 监管端人员更新接口

parent bddb2076
......@@ -24,4 +24,6 @@ public interface IUnitPersonService {
UnitPersonInfoDto saveSupUser(UnitPersonInfoDto unitPersonInfoDto);
UnitPersonInfoDto updateUser(UnitPersonInfoDto unitPersonInfoDto);
UnitPersonInfoDto updateSupUser(UnitPersonInfoDto unitPersonInfoDto);
}
......@@ -372,6 +372,18 @@ public class UnitPersonController extends BaseController {
return ResponseHelper.buildResponse( iUnitPersonService.updateUser(unitPersonInfoDto));
}
/**
* 更新监管端人员信息
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/updateSupUser", method = RequestMethod.PUT)
@ApiOperation(httpMethod = "PUT", value = "更新监管端人员信息", notes = "更新监管端人员信息")
public ResponseModel<?> updateSupUser(@RequestBody UnitPersonInfoDto unitPersonInfoDto) {
return ResponseHelper.buildResponse( iUnitPersonService.updateSupUser(unitPersonInfoDto));
}
}
......@@ -486,6 +486,128 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
@Transactional
@Override
public UnitPersonInfoDto updateSupUser(UnitPersonInfoDto unitPersonInfoDto) {
unitPersonInfoDto.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
OrgPersonDto orgPersonVo = new OrgPersonDto();
if(StringUtils.isNotBlank(unitPersonInfoDto.getOrgExpandAttr2())) {
String pwd = DesUtil.encode(unitPersonInfoDto.getOrgExpandAttr2(), "qaz");
unitPersonInfoDto.setOrgExpandAttr2(pwd);
}
// 只有parentId 需要手动填充name
FeignClientResult<CompanyModel> company = Privilege.companyClient.seleteOne(Long.parseLong(unitPersonInfoDto.getParentId()));
if(company == null || company.getResult() == null) {
throw new BadRequest("所在单位选择有误");
}
unitPersonInfoDto.setParentName(company.getResult().getCompanyName());
BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo);
try {
iOrgUsrService.updateByIdOrgPersonFlc(orgPersonVo,unitPersonInfoDto.getSequenceNbr());
PersonQualityDto personQualityDto = unitPersonInfoDto.getPersonQualityDto();
PersonEducationDto personEducationDto = unitPersonInfoDto.getPersonEducationDto();
// 处理图片信息 -- 证照和图片
Map<String, List<AttachmentDto>> userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_PIC,unitPersonInfoDto.getLicencePic());
userAttach.put(TzsCommonParam.HEAD_SHOT,unitPersonInfoDto.getHeadshot());
iSourceFileService.saveAttachments(unitPersonInfoDto.getSequenceNbr(),userAttach);
if(personQualityDto != null) {
String[] licenceTypeCode = personQualityDto.getLicenceTypeCode().split(",");
List<DataDictionary> list = iDataDictionaryService.list(new LambdaQueryWrapper<DataDictionary>().eq(DataDictionary::getIsDelete,false).in(DataDictionary::getCode,licenceTypeCode));
String licenceType = "";
for(DataDictionary temp : list) {
licenceType += "," + temp.getName();
}
if(licenceType.length() > 0) {
licenceType = licenceType.substring(1);
personQualityDto.setLicenceType(licenceType);
}
// 更新人员资质信息
personQualityDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto);
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo());
iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach);
unitPersonInfoDto.setPersonQualityDto(personQualityDto);
}
if(personEducationDto != null) {
// 更新人员教育信息
personEducationDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment());
iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach);
unitPersonInfoDto.setPersonEducationDto(personEducationDto);
}
// 更新账号信息
if(StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr1()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr2())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
Long companyId = Long.parseLong(unitPersonInfoDto.getOrgExpandAttr3());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = Privilege.agencyUserClient.queryByUserId(orgPersonVo.getAmosOrgId()).getResult();
agencyUserModel.setUserName(unitPersonInfoDto.getOrgExpandAttr1());
agencyUserModel.setRealName(unitPersonInfoDto.getBizOrgName());
agencyUserModel.setLockStatus("UNLOCK");
agencyUserModel.setPassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setRePassword(unitPersonInfoDto.getOrgExpandAttr2());
agencyUserModel.setAgencyCode("tzs");
// agencyUserModel.setMobile(adminTel); 不存储电话信息
// 所属组织
Map<Long, List<Long>> roleSeqsMap = new HashMap<>();
List<Long> roleIds = new ArrayList<>();
List<RoleModel> allRoleList = roleListResult.getResult();
List<RoleModel> userRoleList = new ArrayList<>();
allRoleList.stream().forEach(t -> {
if(t.getRoleName().equals(roleName)) {
userRoleList.add(t);
}
});
userRoleList.stream().forEach(r -> {
roleIds.add(r.getSequenceNbr());
});
roleSeqsMap.put(companyId,roleIds);
List<String> appCodes = new ArrayList<>();
appCodes.add(appcode);
agencyUserModel.setAppCodes(appCodes);
Map<Long, List<RoleModel>> orgRoles = new HashMap<>();
orgRoles.put(companyId,userRoleList);
agencyUserModel.setOrgRoles(orgRoles);
agencyUserModel.setOrgRoleSeqs(roleSeqsMap);
Privilege.agencyUserClient.update(agencyUserModel,orgPersonVo.getAmosOrgId());
// 密码另外更新
Privilege.agencyUserClient.modifyPassword(orgPersonVo.getAmosOrgId(),agencyUserModel);
}
} catch (Exception e) {
e.printStackTrace();
}
return unitPersonInfoDto;
}
@Transactional
@Override
public UnitPersonInfoDto updateUser(UnitPersonInfoDto unitPersonInfoDto) {
unitPersonInfoDto.setBizOrgType(CommonConstant.BIZ_ORG_TYPE_PERSON);
OrgPersonDto orgPersonVo = new OrgPersonDto();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment