Commit 84ef1e30 authored by tianyiming's avatar tianyiming

优化

parent 2a43001a
......@@ -110,14 +110,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
page.setRecords(list);
return page;
}
/**
* 生成监管码和电梯96333识别码
*/
@Override
public int createSupervisorCode(Map<String, Object> map) {
LinkedHashMap value = (LinkedHashMap) map.get("value");
//获取对应城市、区县值
LinkedHashMap o = (LinkedHashMap) value.get("1627903393253056514");
String city = o.get("CITY").toString();
String county = o.get("COUNTY").toString();
//获取对应种类、类别值
LinkedHashMap o1 = (LinkedHashMap) value.get("1630483430028369922");
String equipCategory = o1.get("EQU_CATEGORY").toString();
String equipList = o1.get("EQU_LIST").toString();
......@@ -126,21 +130,29 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
// String county = "610401";
// String equipCategory = "3200";
// String equipList = "3000";
//生成码
Map<String, String> codeMap = creatCode(city, county, equipCategory, equipList);
//查询最后一条数据并进行修改
CategoryOtherInfo otherInfo = categoryOtherInfoMapper.selectOne(new QueryWrapper<CategoryOtherInfo>().orderByDesc("REC_DATE").last("limit 1"));
return categoryOtherInfoMapper.updateSupervisorCode(codeMap.get("supervisorCode"), codeMap.get("elevatorCode"), otherInfo.getSequenceNbr());
}
//生成监管码和电梯96333识别码
/**
* 具体生成监管码和电梯96333识别码逻辑
*/
private Map<String, String> creatCode(String city, String county, String equipCategory, String equipList) {
Map<String, String> resultMap = new HashMap<>();
//生成监管码前缀
Map<String, Object> divisionMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), county);
String division = ObjectUtils.isEmpty(divisionMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQH.getCode(), city).get("code").toString() : divisionMap.get("code").toString();
StringBuilder supervisorCode = new StringBuilder();
supervisorCode.append(division).append(equipCategory);
//获取行政区划区县、市是否存在历史监管码
CategoryOtherInfo supervisor = categoryOtherInfoMapper.selectSupervisorCode(supervisorCode.toString());
//生成对应监管码
if (!ObjectUtils.isEmpty(supervisor)) {
if (supervisor.getSupervisoryCode() != null) {
//获取补零位长度
String supervisoryCode = supervisor.getSupervisoryCode().substring(4);
long num = Long.valueOf(supervisoryCode) + 1;
int numLength = String.valueOf(num).length();
......@@ -157,14 +169,20 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} else {
supervisorCode.append(EquipmentCategoryEnum.JGM.getCode());
}
StringBuilder elevatorCode = new StringBuilder();
//判断是否是否需要生成96333电梯码
if (EquipmentClassifityEnum.DT.getCode().equals(equipList)) {
//生成生成96333电梯码前缀
Map<String, Object> elevatorMap = equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), county);
String elevator = ObjectUtils.isEmpty(elevatorMap) ? equipmentCategoryMapper.getAdministrativeDivision(EquipmentCategoryEnum.XZQHDT.getCode(), city).get("code").toString() : elevatorMap.get("code").toString();
elevatorCode.append(elevator);
//获取行政区划区县、市是否存在历史96333电梯码
CategoryOtherInfo elevatorOtherInfo = categoryOtherInfoMapper.selectElevatorCode(elevatorCode.toString());
//生成对应96333电梯码
if (!ObjectUtils.isEmpty(elevatorOtherInfo)) {
if (elevatorOtherInfo.getCode() != null) {
//获取补零位长度
String elevatorCode1 = elevatorOtherInfo.getCode().substring(2);
long num = Long.valueOf(elevatorCode1) + 1;
int numLength = String.valueOf(num).length();
......
......@@ -10,7 +10,7 @@ import java.util.Map;
public class JsonUtils {
//将json文件转化为list<Map>
//将json文件转化为Map<list<Map<>>>
public static Map getResourceJson(Resource resource) {
String json = null;
try {
......
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