Commit 32a380b3 authored by kongfm's avatar kongfm

企业人员更新问题修改,配套设备相关接口

parent 77bf68fd
...@@ -124,10 +124,5 @@ public class EquipmentAssociated extends BaseEntity { ...@@ -124,10 +124,5 @@ public class EquipmentAssociated extends BaseEntity {
@TableField("approval_certificate_number") @TableField("approval_certificate_number")
private String approvalCertificateNumber; private String approvalCertificateNumber;
/**
* 更新人id
*/
@TableField("rec_user_d")
private Long recUserD;
} }
package com.yeejoin.amos.boot.module.tzs.flc.biz.controller; package com.yeejoin.amos.boot.module.tzs.flc.biz.controller;
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.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.flc.api.dto.EquipmentDto;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.Equipment;
import com.yeejoin.amos.boot.module.tzs.flc.api.entity.EquipmentAssociated;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -24,7 +32,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType; ...@@ -24,7 +32,7 @@ import org.typroject.tyboot.core.foundation.enumeration.UserType;
* @date 2021-11-26 * @date 2021-11-26
*/ */
@RestController @RestController
@Api(tags = "配套设备/设施/部件Api") @Api(tags = "配套设备设施部件Api")
@RequestMapping(value = "/equipment-associated") @RequestMapping(value = "/equipment-associated")
public class EquipmentAssociatedController extends BaseController { public class EquipmentAssociatedController extends BaseController {
...@@ -38,79 +46,38 @@ public class EquipmentAssociatedController extends BaseController { ...@@ -38,79 +46,38 @@ public class EquipmentAssociatedController extends BaseController {
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/save") @PostMapping(value = "/save")
@ApiOperation(httpMethod = "POST", value = "新增配套设备/设施/部件", notes = "新增配套设备/设施/部件") @ApiOperation(httpMethod = "POST", value = "新增配套设备设施部件", notes = "新增配套设备设施部件")
public ResponseModel<EquipmentAssociatedDto> save(@RequestBody EquipmentAssociatedDto model) { public ResponseModel<EquipmentAssociatedDto> save(@RequestBody EquipmentAssociatedDto model) {
model = equipmentAssociatedServiceImpl.createWithModel(model); model = equipmentAssociatedServiceImpl.createWithModel(model);
return ResponseHelper.buildResponse(model); return ResponseHelper.buildResponse(model);
} }
/**
* 根据sequenceNbr更新
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PutMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "PUT", value = "根据sequenceNbr更新配套设备/设施/部件", notes = "根据sequenceNbr更新配套设备/设施/部件")
public ResponseModel<EquipmentAssociatedDto> updateBySequenceNbrEquipmentAssociated(@RequestBody EquipmentAssociatedDto model,@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
model.setSequenceNbr(sequenceNbr);
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.updateWithModel(model));
}
/** /**
* 根据sequenceNbr删除 *
* * @param pageNum
* @param sequenceNbr 主键 * @param pageSize
* @return * @param equipId
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除配套设备/设施/部件", notes = "根据sequenceNbr删除配套设备/设施/部件")
public ResponseModel<Boolean> deleteBySequenceNbr(HttpServletRequest request, @PathVariable(value = "sequenceNbr") Long sequenceNbr){
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.removeById(sequenceNbr));
}
/**
* 根据sequenceNbr查询
*
* @param sequenceNbr 主键
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "GET",value = "根据sequenceNbr查询单个配套设备/设施/部件", notes = "根据sequenceNbr查询单个配套设备/设施/部件")
public ResponseModel<EquipmentAssociatedDto> selectOne(@PathVariable Long sequenceNbr) {
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.queryBySeq(sequenceNbr));
}
/**
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET",value = "配套设备/设施/部件分页查询", notes = "配套设备/设施/部件分页查询")
public ResponseModel<Page<EquipmentAssociatedDto>> queryForPage(@RequestParam(value = "current") int current,@RequestParam
(value = "size") int size) {
Page<EquipmentAssociatedDto> page = new Page<EquipmentAssociatedDto>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.queryForEquipmentAssociatedPage(page));
}
/**
* 列表全部数据查询
*
* @return * @return
*/ */
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET",value = "配套设备/设施/部件列表全部数据查询", notes = "配套设备/设施/部件列表全部数据查询") @GetMapping(value = "/page")
@GetMapping(value = "/list") @ApiOperation(httpMethod = "GET",value = "配套设备设施部件分页查询", notes = "配套设备设施部件分页查询")
public ResponseModel<List<EquipmentAssociatedDto>> selectForList() { public ResponseModel<IPage<EquipmentAssociatedDto>> queryForPage(String pageNum, String pageSize, @RequestParam (value = "equipId") Long equipId) {
return ResponseHelper.buildResponse(equipmentAssociatedServiceImpl.queryForEquipmentAssociatedList()); Page<EquipmentAssociated> pageBean;
IPage<EquipmentAssociated> page;
LambdaQueryWrapper<EquipmentAssociated> queryWrapper = new LambdaQueryWrapper<EquipmentAssociated>().eq(EquipmentAssociated::getIsDelete,false).eq(EquipmentAssociated::getEquipmentId,equipId);
if (StringUtils.isBlank(pageNum) || StringUtils.isBlank(pageSize)) {
pageBean = new Page<>(0, Long.MAX_VALUE);
} else {
pageBean = new Page<>(Integer.parseInt(pageNum), Integer.parseInt(pageSize));
}
page = equipmentAssociatedServiceImpl.page(pageBean, queryWrapper);
int num= equipmentAssociatedServiceImpl.count(queryWrapper);
pageBean.setTotal(num);
IPage<EquipmentAssociatedDto> result = BeanDtoVoUtils.iPageVoStream(page,EquipmentAssociatedDto.class);
return ResponseHelper.buildResponse(result);
} }
} }
...@@ -498,6 +498,9 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -498,6 +498,9 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
if(company == null || company.getResult() == null) { if(company == null || company.getResult() == null) {
throw new BadRequest("所在单位选择有误"); throw new BadRequest("所在单位选择有误");
} }
OrgUsr oldInfo = iOrgUsrService.getById(unitPersonInfoDto.getSequenceNbr());
String originalPassword = oldInfo.getOrgExpandAttr2();
String amosId = oldInfo.getAmosOrgId();
unitPersonInfoDto.setParentName(company.getResult().getCompanyName()); unitPersonInfoDto.setParentName(company.getResult().getCompanyName());
BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo); BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo);
...@@ -528,7 +531,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -528,7 +531,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
// 更新人员资质信息 // 更新人员资质信息
personQualityDto.setPsersonId(unitPersonInfoDto.getSequenceNbr()); personQualityDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto); if(personQualityDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto);
} else {
personQualityDto = flcPersonQualityServiceImpl.createWithModel(personQualityDto);
}
userAttach = new HashMap<>(); userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo()); userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo());
iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach); iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach);
...@@ -538,7 +546,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -538,7 +546,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
if(personEducationDto != null) { if(personEducationDto != null) {
// 更新人员教育信息 // 更新人员教育信息
personEducationDto.setPsersonId(unitPersonInfoDto.getSequenceNbr()); personEducationDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto); if(personEducationDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
} else {
personEducationDto = personEducationServiceImpl.createWithModel(personEducationDto);
}
userAttach = new HashMap<>(); userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment()); userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment());
iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach); iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach);
...@@ -554,49 +567,104 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -554,49 +567,104 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) { && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) {
String roleName = unitPersonInfoDto.getOrgExpandAttr5(); // 首先判断是否存在 用户信息, 如果不存在走新增方法
Long companyId = Long.parseLong(unitPersonInfoDto.getOrgExpandAttr3()); if(StringUtils.isNotEmpty(amosId)) {
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.setOriginalPassword(originalPassword);
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);
} else {
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 = new AgencyUserModel();
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);
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.create(agencyUserModel);
agencyUserModel = userResult.getResult();
unitPersonInfoDto.setAmosOrgId(agencyUserModel.getUserId() + "");
orgPersonVo.setAmosOrgId(agencyUserModel.getUserId() + "");
iOrgUsrService.updateByIdOrgPersonFlc(orgPersonVo,unitPersonInfoDto.getSequenceNbr());
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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -617,6 +685,9 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -617,6 +685,9 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
} }
// 只有parentId 需要手动填充name // 只有parentId 需要手动填充name
OrgUsr parent = iOrgUsrService.getById(Long.parseLong(unitPersonInfoDto.getParentId())); OrgUsr parent = iOrgUsrService.getById(Long.parseLong(unitPersonInfoDto.getParentId()));
OrgUsr oldInfo = iOrgUsrService.getById(unitPersonInfoDto.getSequenceNbr());
String originalPassword = oldInfo.getOrgExpandAttr2();
String amosId = oldInfo.getAmosOrgId();
unitPersonInfoDto.setParentName(parent.getBizOrgName()); unitPersonInfoDto.setParentName(parent.getBizOrgName());
BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo); BeanUtils.copyProperties(unitPersonInfoDto,orgPersonVo);
...@@ -647,7 +718,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -647,7 +718,12 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
// 更新人员资质信息 // 更新人员资质信息
personQualityDto.setPsersonId(unitPersonInfoDto.getSequenceNbr()); personQualityDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto); if(personQualityDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personQualityDto = flcPersonQualityServiceImpl.updateWithModel(personQualityDto);
} else {
personQualityDto = flcPersonQualityServiceImpl.createWithModel(personQualityDto);
}
userAttach = new HashMap<>(); userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo()); userAttach.put(TzsCommonParam.LICENCE_INFO,personQualityDto.getLicenceInfo());
iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach); iSourceFileService.saveAttachments(personQualityDto.getSequenceNbr(),userAttach);
...@@ -657,7 +733,14 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -657,7 +733,14 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
if(personEducationDto != null) { if(personEducationDto != null) {
// 更新人员教育信息 // 更新人员教育信息
personEducationDto.setPsersonId(unitPersonInfoDto.getSequenceNbr()); personEducationDto.setPsersonId(unitPersonInfoDto.getSequenceNbr());
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
if(personEducationDto.getSequenceNbr() != null) {
// 已经存在更新 否则新增
personEducationDto = personEducationServiceImpl.updateWithModel(personEducationDto);
} else {
personEducationDto = personEducationServiceImpl.createWithModel(personEducationDto);
}
userAttach = new HashMap<>(); userAttach = new HashMap<>();
userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment()); userAttach.put(TzsCommonParam.ATTACHMENT,personEducationDto.getAttachment());
iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach); iSourceFileService.saveAttachments(personEducationDto.getSequenceNbr(),userAttach);
...@@ -673,51 +756,100 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -673,51 +756,100 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr3()) && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr4())
&& StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) { && StringUtils.isNotEmpty(unitPersonInfoDto.getOrgExpandAttr5() )) {
String roleName = unitPersonInfoDto.getOrgExpandAttr5(); // 首先判断是否存在 用户信息, 如果不存在走新增方法
String orgId = unitPersonInfoDto.getOrgExpandAttr3();// 拿到的是 org_user的id 需要转换成amosid if(StringUtils.isNotEmpty(amosId)) {
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId)); String roleName = unitPersonInfoDto.getOrgExpandAttr5();
Long companyId = Long.parseLong(temp.getAmosOrgId()); String orgId = unitPersonInfoDto.getOrgExpandAttr3();// 拿到的是 org_user的id 需要转换成amosid
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId));
Long companyId = Long.parseLong(temp.getAmosOrgId());
String appcode = unitPersonInfoDto.getOrgExpandAttr4(); 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.setOriginalPassword(originalPassword);
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);
} else {
String roleName = unitPersonInfoDto.getOrgExpandAttr5();
String orgId = unitPersonInfoDto.getOrgExpandAttr3();// 拿到的是 org_user的id 需要转换成amosid
OrgUsr temp = iOrgUsrService.getById(Long.parseLong(orgId));
Long companyId = Long.parseLong(temp.getAmosOrgId());
String appcode = unitPersonInfoDto.getOrgExpandAttr4();
// 创建人员账户信息
FeignClientResult<List<RoleModel>> roleListResult = Privilege.roleClient.queryRoleList(null,null);
AgencyUserModel agencyUserModel = new AgencyUserModel();
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);
FeignClientResult<AgencyUserModel> userResult = Privilege.agencyUserClient.create(agencyUserModel);
agencyUserModel = userResult.getResult();
unitPersonInfoDto.setAmosOrgId(agencyUserModel.getUserId() + "");
orgPersonVo.setAmosOrgId(agencyUserModel.getUserId() + "");
iOrgUsrService.updateByIdOrgPersonFlc(orgPersonVo,unitPersonInfoDto.getSequenceNbr());
}
// 创建人员账户信息
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) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
...@@ -736,10 +868,21 @@ public class UnitPersonServiceImpl implements IUnitPersonService { ...@@ -736,10 +868,21 @@ public class UnitPersonServiceImpl implements IUnitPersonService {
break; break;
} }
} }
OrgUsr company = iOrgUsrService.getById(orgPerson.getParentId());
String qrString = "人员类型: " +personType +"\n\r"; String qrString = "人员类型: " +personType +"\n\r";
qrString += "企业编码: " +company.getBizOrgCode() +"\n\r"; OrgUsr company = iOrgUsrService.getById(orgPerson.getParentId());
qrString += "人员编号: " +orgPerson.getBizOrgCode() +"\n\r"; // 如果company 为空 说明是 监管端 需要获取组织机构树
if(company == null) {
FeignClientResult<CompanyModel> amosCompany = Privilege.companyClient.seleteOne(Long.parseLong(orgPerson.getParentId()));
if(amosCompany == null || amosCompany.getResult() == null) {
throw new BadRequest("所在单位有误");
}
qrString += "企业编码: " +amosCompany.getResult().getOrgCode()+"\n\r";
qrString += "人员编号: " +orgPerson.getBizOrgCode() +"\n\r";
} else {
qrString += "企业编码: " +company.getBizOrgCode() +"\n\r";
qrString += "人员编号: " +orgPerson.getBizOrgCode() +"\n\r";
}
byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(qrString, 480); byte[] bytes = QRCodeUtil.generateQRCodeImageByteData(qrString, 480);
MultipartFile file = new MockMultipartFile("person_" + orgPerson.getSequenceNbr() + ".png","person_" + orgPerson.getSequenceNbr() + ".png","application/octet-stream" ,bytes); MultipartFile file = new MockMultipartFile("person_" + orgPerson.getSequenceNbr() + ".png","person_" + orgPerson.getSequenceNbr() + ".png","application/octet-stream" ,bytes);
......
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