Commit 543478a4 authored by tianbo's avatar tianbo

refactor(jg): 优化设备参数接收公司代码处理逻辑

- 提取receiveCompanyCode解析逻辑为局部变量_receiveCompanyCode refactor(ymt): 统一使用常量定义监管机构树Redis键值 - 引入BizCommonConstant类中的COMPANY_TREE_REDIS_KEY常量 - 替换硬编码的REGULATOR_UNIT_TREE字符串 - 更新获取和设置监管机构树缓存时使用的键值 - 明确creatTree方法不包含审批局的业务含义
parent b8881008
......@@ -2088,6 +2088,11 @@ public class DataDockServiceImpl {
String usePlace = Objects.toString(equipInfo.get("usePlace"), null);
String useDate = Objects.toString(equipInfo.get("useDate"), null);
String equState = Objects.toString(equipInfo.get("EQU_STATE"), null);
String _receiveCompanyCode = Optional.ofNullable(receiveCompanyCode)
.map(code -> code.split("_"))
.filter(parts -> parts.length > 0)
.map(parts -> parts[0])
.orElse(null);
return new EquipRequestParamsDto().setCompanyCode(company.getCompanyCode().split("_")[0])
.setProvince(province)
.setProvinceName("陕西省")
......@@ -2114,11 +2119,7 @@ public class DataDockServiceImpl {
.setOrgBranchName(orgBranchCode.split("_").length > 1 ? orgBranchCode.split("_")[1] : "")
.setUseOrgCode(useOrgCode)
.setVehicleApanage(Objects.toString(equipInfo.get("VEHICLE_APANAGE"),""))
.setReceiveCompanyCode(Optional.ofNullable(receiveCompanyCode)
.map(code -> code.split("_"))
.filter(parts -> parts.length > 0)
.map(parts -> parts[0])
.orElse(null))
.setReceiveCompanyCode(_receiveCompanyCode)
.setReceiveCompanyName(Optional.ofNullable(receiveCompanyCode)
.map(code -> code.split("_"))
.filter(parts -> parts.length > 1)
......@@ -2135,7 +2136,7 @@ public class DataDockServiceImpl {
.setStartLatitudeLongitude(toJSONString(equipInfo.get("startLatitudeLongitude")))
.setEndLatitudeLongitude(toJSONString(equipInfo.get("endLatitudeLongitude")))
.setEquState(equState)
.setEquCode(installationNoticeService.generateEquCode(equListCode, equCategoryCode, equDefineCode, new Date(), receiveCompanyCode));
.setEquCode(installationNoticeService.generateEquCode(equListCode, equCategoryCode, equDefineCode, new Date(), _receiveCompanyCode));
}
/**
......
......@@ -10,5 +10,5 @@ public interface BizCommonConstant {
/**
* 所有平台企业数据redisKey
*/
String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE";
String COMPANY_TREE_REDIS_KEY = "REGULATOR_UNIT_TREE_YMT";
}
......@@ -15,6 +15,7 @@ import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.EsEquipmentDao;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.entity.ESEquipmentInfo;
import com.yeejoin.amos.boot.module.ymt.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipExportDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto;
import com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentMessageDto;
......@@ -552,11 +553,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
@Override
public List<LinkedHashMap> getTree() {
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(REGULATOR_UNIT_TREE);
List<LinkedHashMap> result = (List<LinkedHashMap>) redisUtils.get(BizCommonConstant.COMPANY_TREE_REDIS_KEY);
// 判断redis是否存在管辖机构树
return !ObjectUtils.isEmpty(result) ? result : creatTree();
}
/**
* 创建监管机构树,不包含审批局
*/
@Override
public List<LinkedHashMap> creatTree() {
FeignClientResult tree = privilegeFeginService.tree(RequestContext.getToken(), RequestContext.getAppKey(), RequestContext.getProduct());
......@@ -564,7 +568,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
List<LinkedHashMap> treeData = deleteTreeData(result, REGULATOR_UNIT);
List<LinkedHashMap> supervisionTree = treeData.stream().filter(e -> code.equals(e.get("orgCode"))).collect(Collectors.toList());
List<LinkedHashMap> resultTree = updateNullChildren(supervisionTree);
redisUtils.set(REGULATOR_UNIT_TREE, resultTree);
redisUtils.set(BizCommonConstant.COMPANY_TREE_REDIS_KEY, resultTree);
return resultTree;
}
......
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