Commit c40d44e9 authored by 韩桐桐's avatar 韩桐桐

fix(jg):安装告知和使用登记的监管部门,接收机构

parent f89662f2
......@@ -1709,6 +1709,29 @@ public class CommonServiceImpl implements ICommonService {
}
return result;
}
/**
* 递归属地监管部门树匹配监管部门
*
* @param tree 监管树
* @param orgBranchCode 监管部门orgCode
* @return 监管部门信息
*/
public LinkedHashMap recursiveMatching(List<LinkedHashMap> tree, String orgBranchCode) {
if (tree != null) {
for (LinkedHashMap map : tree) {
if (orgBranchCode.equals(map.get("orgCode"))) {
return map;
}
if (map.containsKey("children") && map.get("children") instanceof List) {
LinkedHashMap result = recursiveMatching((List<LinkedHashMap>) map.get("children"), orgBranchCode);
if (!"".equals(result)) {
return result;
}
}
}
}
return null;
}
/**
* 排序 :页面列表排序功能支持,将 "字段,ascend" 或 "字段,descend" 转化为对应JSONObject
......
......@@ -146,6 +146,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private CommonServiceImpl commonService;
@Autowired
private RedissonClient redissonClient;
@Autowired
CommonServiceImpl commonServiceImpl;
/**
* 根据sequenceNbr查询
......@@ -904,16 +906,17 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
}
tzsJgOtherInfo.setSupervisoryCode(mapCode.get("superviseCode").toString());
tzsJgOtherInfoMapper.updateById(tzsJgOtherInfo);
List<LinkedHashMap> tree = commonServiceImpl.getCreatTree();
// 更新设备监管部门信息
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda()
.eq(IdxBizJgSupervisionInfo::getRecord, jgRelationEquip.getEquId());
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = idxBizJgSupervisionInfoMapper.selectOne(eq);
if (!ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchCode()) && !ObjectUtils.isEmpty(jgInstallationNotice.getOrgBranchName())) {
CompanyModel result = Privilege.companyClient.queryByCompanyName(jgInstallationNotice.getOrgBranchName()).getResult();
idxBizJgSupervisionInfo.setOrgBranchCode(result.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(result.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(result.getCompanyCode());
// CompanyModel result = Privilege.companyClient.queryByCompanyName(jgInstallationNotice.getOrgBranchName()).getResult();
LinkedHashMap linkedHashMap = commonServiceImpl.recursiveMatching(tree, jgInstallationNotice.getOrgBranchCode());
idxBizJgSupervisionInfo.setOrgBranchCode((String) linkedHashMap.get("orgCode"));
idxBizJgSupervisionInfo.setOrgBranchName((String) linkedHashMap.get("companyName"));
idxBizJgSupervisionInfo.setCompanyOrgBranchCode((String) linkedHashMap.get("companyCode"));
idxBizJgSupervisionInfoMapper.updateById(idxBizJgSupervisionInfo);
}
......
......@@ -234,11 +234,11 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
IdxBizJgSupervisionInfo idxBizJgSupervisionInfo = new IdxBizJgSupervisionInfo();
if (map.containsKey("orgBranchCode") && !ObjectUtils.isEmpty(map.get("orgBranchCode"))) {
String[] data = String.valueOf(map.getString("orgBranchCode")).split("_");
String orgBranchName= data[1];
CompanyModel result = Privilege.companyClient.queryByCompanyName(orgBranchName).getResult();
idxBizJgSupervisionInfo.setOrgBranchCode(result.getOrgCode());
idxBizJgSupervisionInfo.setOrgBranchName(result.getCompanyName());
idxBizJgSupervisionInfo.setCompanyOrgBranchCode(result.getCompanyCode());
List<LinkedHashMap> tree = commonServiceImpl.getCreatTree();
LinkedHashMap linkedHashMap = commonServiceImpl.recursiveMatching(tree, data[0]);
idxBizJgSupervisionInfo.setOrgBranchCode(data[0]);
idxBizJgSupervisionInfo.setOrgBranchName(data[1]);
idxBizJgSupervisionInfo.setCompanyOrgBranchCode((String) linkedHashMap.get("companyCode"));
LambdaQueryWrapper<IdxBizJgSupervisionInfo> eq = new QueryWrapper<IdxBizJgSupervisionInfo>().lambda().eq(IdxBizJgSupervisionInfo::getRecord, map.get("equipId"));
idxBizJgSupervisionInfoMapper.update(idxBizJgSupervisionInfo, eq);
}
......@@ -525,18 +525,17 @@ public class JgUseRegistrationServiceImpl extends BaseService<JgUseRegistrationD
// 使用单位信息
useRegistration.setUseUnitName(company.getCompanyName());
useRegistration.setUseUnitCreditCode(company.getCompanyCode());
List<LinkedHashMap> tree = commonService.getCreatTree();
// 接收单位信息
Optional.ofNullable(useRegistration.getReceiveOrgCode())
.filter(code -> code.contains("_"))
.map(code -> code.split("_"))
.ifPresent(splitReceiveOrgCode -> {
String orgBranchName= splitReceiveOrgCode[1];
CompanyModel result = Privilege.companyClient.queryByCompanyName(orgBranchName).getResult();
useRegistration.setReceiveOrgCode(result.getOrgCode());
useRegistration.setReceiveCompanyOrgCode(result.getOrgCode());
useRegistration.setReceiveCompanyCode(result.getCompanyCode());
useRegistration.setReceiveOrgName(result.getCompanyName());
LinkedHashMap linkedHashMap = commonServiceImpl.recursiveMatching(tree, splitReceiveOrgCode[0]);
useRegistration.setReceiveOrgCode(splitReceiveOrgCode[0]);
useRegistration.setReceiveCompanyOrgCode(splitReceiveOrgCode[0]);
useRegistration.setReceiveCompanyCode((String) linkedHashMap.get("companyCode"));
useRegistration.setReceiveOrgName(splitReceiveOrgCode[1]);
});
// 安全管理员
......
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