Commit 25f1c832 authored by tianyiming's avatar tianyiming

一码通西咸存量数据处理

parent ed65be87
...@@ -88,5 +88,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -88,5 +88,6 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<Map<String, Object>> getEquCategory(@Param("recordList") List<String> recordList); List<Map<String, Object>> getEquCategory(@Param("recordList") List<String> recordList);
List<String> selectXiXianNew();
} }
...@@ -21,7 +21,7 @@ public interface IEquipmentCategoryService { ...@@ -21,7 +21,7 @@ public interface IEquipmentCategoryService {
Page equipClaimOverview(); Page equipClaimOverview();
Map<String, String> createSupervisorCode(Map<String, Object> map, String record); Map<String, String> createSupervisorCode(Map<String, Object> map);
List<LinkedHashMap> getTree(); List<LinkedHashMap> getTree();
List<LinkedHashMap> creatTree(); List<LinkedHashMap> creatTree();
...@@ -42,5 +42,5 @@ public interface IEquipmentCategoryService { ...@@ -42,5 +42,5 @@ public interface IEquipmentCategoryService {
ResponseModel submit(Map<String, Object> map); ResponseModel submit(Map<String, Object> map);
void creatXiXian(); void creatXiXian(String type);
} }
...@@ -601,13 +601,14 @@ ...@@ -601,13 +601,14 @@
SELECT SELECT
ibjoi."RECORD" ibjoi."RECORD"
FROM FROM
"biz_jg_supervisory_code" bjsc idx_biz_jg_other_info ibjoi
LEFT JOIN idx_biz_jg_other_info ibjoi ON bjsc.code96333 = ibjoi."CODE96333"
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi.record = ibjoi.record LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi.record = ibjoi.record
LEFT JOIN "biz_jg_supervisory_code" bjsc ON bjsc.supervisory_code = ibjoi."SUPERVISORY_CODE"
WHERE WHERE
ibjsi."ORG_BRANCH_CODE" LIKE'50*18667%' ibjsi."ORG_BRANCH_CODE" LIKE'50*18667%'
AND ibjoi."SUPERVISORY_CODE" NOT LIKE'X%'
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND ( bjsc.status = '1' OR bjsc.status = '2' ) AND ( bjsc.status = '1' OR bjsc.status = '2' )
AND bjsc.supervisory_code NOT LIKE 'X%'
AND create_status = 1 AND create_status = 1
AND "CLAIM_STATUS" = '已认领'; AND "CLAIM_STATUS" = '已认领';
</select> </select>
...@@ -665,4 +666,18 @@ ...@@ -665,4 +666,18 @@
AND "CLAIM_STATUS" = '已认领' AND "CLAIM_STATUS" = '已认领'
); );
</delete> </delete>
<select id="selectXiXianNew" resultType="java.lang.String">
SELECT
ibjoi."RECORD"
FROM
idx_biz_jg_other_info ibjoi
LEFT JOIN idx_biz_jg_supervision_info ibjsi ON ibjsi.record = ibjoi.record
LEFT JOIN "biz_jg_supervisory_code" bjsc ON bjsc.supervisory_code = ibjoi."SUPERVISORY_CODE"
WHERE
ibjsi."ORG_BRANCH_CODE" LIKE'50*18667%'
AND ibjoi."SUPERVISORY_CODE" NOT LIKE'X%'
AND ( ibjoi."CODE96333" NOT LIKE'31%' OR ibjoi."CODE96333" IS NULL )
AND "CLAIM_STATUS" = '已认领';
</select>
</mapper> </mapper>
...@@ -217,7 +217,7 @@ public class EquipmentCategoryController extends BaseController { ...@@ -217,7 +217,7 @@ public class EquipmentCategoryController extends BaseController {
@RequestMapping(value = "/createSupervisorCode", method = RequestMethod.POST) @RequestMapping(value = "/createSupervisorCode", method = RequestMethod.POST)
@ApiOperation(httpMethod = "POST", value = "生成监管码和96333码", notes = "生成监管码和96333码") @ApiOperation(httpMethod = "POST", value = "生成监管码和96333码", notes = "生成监管码和96333码")
public ResponseModel<Object> createSupervisorCode(@RequestBody Map<String,Object> map) { public ResponseModel<Object> createSupervisorCode(@RequestBody Map<String,Object> map) {
return ResponseHelper.buildResponse(equipmentCategoryService.createSupervisorCode(map,null)); return ResponseHelper.buildResponse(equipmentCategoryService.createSupervisorCode(map));
} }
/** /**
...@@ -307,8 +307,8 @@ public class EquipmentCategoryController extends BaseController { ...@@ -307,8 +307,8 @@ public class EquipmentCategoryController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/creatXiXian") @GetMapping(value = "/creatXiXian")
@ApiOperation(httpMethod = "GET", value = "西咸存量数据处理功能", notes = "西咸存量数据处理功能") @ApiOperation(httpMethod = "GET", value = "西咸存量数据处理功能", notes = "西咸存量数据处理功能")
public ResponseModel<Object> creatXiXian() { public ResponseModel<Object> creatXiXian(@RequestParam String type) {
equipmentCategoryService.creatXiXian(); equipmentCategoryService.creatXiXian(type);
return ResponseHelper.buildResponse("ok"); return ResponseHelper.buildResponse("ok");
} }
......
...@@ -432,56 +432,30 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -432,56 +432,30 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
* 生成监管码和电梯96333识别码 * 生成监管码和电梯96333识别码
*/ */
@Override @Override
public Map<String, String> createSupervisorCode(Map<String, Object> map, String record) { public Map<String, String> createSupervisorCode(Map<String, Object> map) {
String city, county, equipCategory; String city, county, equipCategory,isNotXiXian;
EquInfoDto equInfoDto = new EquInfoDto(); //获取对应行政区划
if (ObjectUtils.isEmpty(record)) { city = String.valueOf(map.get("cityCode"));
//获取对应行政区划 county = String.valueOf(map.get("countyCode"));
county = EquipmentCategoryEnum.XZQH.getCode(); //获取对应设备分类
city = map.get("regionCode").toString(); equipCategory = String.valueOf(map.get("equCategory"));
//获取对应设备分类 if ("null".equals(equipCategory) || "null".equals(city) || "null".equals(county)) {
equipCategory = map.get("equCategory").toString(); throw new BadRequest("请求参数不全,请查看参数中是否携带 cityCode、countyCode、equCategory 三个参数及对应值");
} else { }
equInfoDto = categoryOtherInfoMapper.selectEquipInfo(record); isNotXiXian = "null".equals(String.valueOf(map.get("isXiXian"))) ? "0" : "1";
//判断这条数据认领状态是否为已认领,否则直接返回
if (!ObjectUtils.isEmpty(equInfoDto) && EquipmentCategoryEnum.YRL.getName().equals(equInfoDto.getStatus())) {
city = equInfoDto.getCity();
county = equInfoDto.getCounty();
equipCategory = equInfoDto.getEquipCategory();
} else {
return new HashMap<>();
}
}
//生成码 //生成码
EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy(); EquipmentCategoryServiceImpl categoryService = (EquipmentCategoryServiceImpl) AopContext.currentProxy();
Map<String, String> codeMap = categoryService.creatCode(null,city, county, equipCategory, null, null); Map<String, String> codeMap = categoryService.creatCode(isNotXiXian, city, county, equipCategory, null, null);
if (ObjectUtils.isEmpty(codeMap)) { if (ObjectUtils.isEmpty(codeMap)) {
return new HashMap<>(); throw new BadRequest("该请求参数未生成监管码或96333码,请核对参数");
} }
log.info(record + "已生成对应监管码或96333电梯识别码");
String equState = EquipmentCategoryEnum.CSZT.getCode(); String equState = EquipmentCategoryEnum.CSZT.getCode();
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo(); SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
supervisoryCodeInfo.setCode96333(codeMap.get("code96333")); supervisoryCodeInfo.setCode96333(codeMap.get("code96333"));
supervisoryCodeInfo.setSupervisoryCode(codeMap.get("superviseCode")); supervisoryCodeInfo.setSupervisoryCode(codeMap.get("superviseCode"));
supervisoryCodeInfo.setStatus(equState); supervisoryCodeInfo.setStatus(equState);
if (!ObjectUtils.isEmpty(record)) { supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
String supervisorCode, elevatorCode;
//设备状态为报废,对应电梯码作废
equState = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? EquipmentCategoryEnum.WSY.getCode() : EquipmentCategoryEnum.YSY.getCode();
supervisorCode = codeMap.get("superviseCode");
elevatorCode = EquipmentCategoryEnum.BF.getCode().equals(equInfoDto.getEquState()) ? null : codeMap.get("code96333");
List<CategoryOtherInfo> categoryOtherInfo = categoryOtherInfoMapper.selectList(new QueryWrapper<CategoryOtherInfo>().eq("SUPERVISORY_CODE", supervisorCode));
if (categoryOtherInfo.size() > 0) {
supervisoryCodeInfoMapper.update(supervisoryCodeInfo, new QueryWrapper<SupervisoryCodeInfo>().eq("supervisory_code", supervisoryCodeInfo.getSupervisoryCode()));
} else {
supervisoryCodeInfo.setStatus(equState);
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
}
//修改源数据的电梯码
categoryOtherInfoMapper.updateSupervisorCode(supervisorCode, elevatorCode, record);
} else {
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
}
return codeMap; return codeMap;
} }
...@@ -1571,51 +1545,58 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1571,51 +1545,58 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
} }
@Override @Override
public void creatXiXian() { public void creatXiXian(String type) {
// 1查找以31或者33开头且为用户手动录入的96333码对应的数据writeRecordList // 1查找以31或者33开头且为用户手动录入的96333码对应的数据writeRecordList
List<String> writeRecordList = equipmentCategoryMapper.selectWriteXiXian(); List<String> writeRecordList = equipmentCategoryMapper.selectWriteXiXian();
// 1.1删除码表中以31或者33开头且为用户手动录入 if (!ObjectUtils.isEmpty(writeRecordList)) {
equipmentCategoryMapper.clearSupervisoryCodeAndXiXian(); // 1.1删除码表中以31或者33开头且为用户手动录入
// 1.2将以31或者33开头且为用户手动录入的96333码对应的数据的监管码清空 equipmentCategoryMapper.clearSupervisoryCodeAndXiXian();
equipmentCategoryMapper.updateSupervisoryCode(writeRecordList); // 1.2将以31或者33开头且为用户手动录入的96333码对应的数据的监管码清空
equipmentCategoryMapper.updateSupervisoryCode(writeRecordList);
}
// 2查找管辖机构为西咸,但96333码不为31开头的数据recordList // 2查找管辖机构为西咸,但96333码不为31开头的数据recordList
List<String> recordList = equipmentCategoryMapper.selectXiXian(); List<String> recordList = !"new".equals(type) ? equipmentCategoryMapper.selectXiXian() : equipmentCategoryMapper.selectXiXianNew();
// 2.1删除码表中recordList对应的码数据 if(!ObjectUtils.isEmpty(recordList)){
equipmentCategoryMapper.clearSupervisoryCode(); // 2.1删除码表中recordList对应的码数据
// 2.2清空业务表中recordList对应的96333码和监管码 equipmentCategoryMapper.clearSupervisoryCode();
equipmentCategoryMapper.clearCode(recordList); // 2.2清空业务表中recordList对应的96333码和监管码
equipmentCategoryMapper.clearCode(recordList);
}
// 3 将recordList合并到writeRecordList // 3 将recordList合并到writeRecordList
writeRecordList.addAll(recordList); writeRecordList.addAll(recordList);
List<Map<String,Object>> equCategoryList= equipmentCategoryMapper.getEquCategory(writeRecordList); List<Map<String, Object>> equCategoryList = new ArrayList<>();
// 4、生成对应的96333和监管码 if (!ObjectUtils.isEmpty(writeRecordList)) {
for (Map<String, Object> map : equCategoryList) { equCategoryList = equipmentCategoryMapper.getEquCategory(writeRecordList);
String code96333 = null; // 4、生成对应的96333和监管码
String category = map.get("category").toString(); for (Map<String, Object> map : equCategoryList) {
String supervisoryCode = createSupervisorCode("1", XIAN_YANG, null,category); String code96333 = null;
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo(); String category = map.get("category").toString();
supervisoryCodeInfo.setSupervisoryCode(supervisoryCode); String supervisoryCode = createSupervisorCode("1", XIAN_YANG, null, category);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode()); SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
if (category.startsWith("3")) { supervisoryCodeInfo.setSupervisoryCode(supervisoryCode);
if ("null".equals(map.get("code"))) { supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
code96333 = createElevatorCode("31"); if (category.startsWith("3")) {
supervisoryCodeInfo.setCreateStatus(CREATE); if ("null".equals(map.get("code"))) {
} else { code96333 = createElevatorCode("31");
supervisoryCodeInfo.setCreateStatus(NOT_CREATE); supervisoryCodeInfo.setCreateStatus(CREATE);
code96333 = map.get("code").toString(); } else {
supervisoryCodeInfo.setCreateStatus(NOT_CREATE);
code96333 = map.get("code").toString();
}
} }
supervisoryCodeInfo.setCode96333(code96333);
//更新至码表
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
categoryOtherInfo.setCode(code96333);
categoryOtherInfo.setSupervisoryCode(supervisoryCode);
// 更新至业务表
categoryOtherInfoMapper.updateSupervisorCode(supervisoryCode, code96333, map.get("record").toString());
// 更新至一码通es
checkEsData(map.get("record").toString());
// 更新至电梯es
saveEsElevator2ES(map.get("record").toString());
} }
supervisoryCodeInfo.setCode96333(code96333);
//更新至码表
supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
CategoryOtherInfo categoryOtherInfo = new CategoryOtherInfo();
categoryOtherInfo.setCode(code96333);
categoryOtherInfo.setSupervisoryCode(supervisoryCode);
// 更新至业务表
categoryOtherInfoMapper.updateSupervisorCode(supervisoryCode, code96333, map.get("record").toString());
// 更新至一码通es
checkEsData(map.get("record").toString());
// 更新至电梯es
saveEsElevator2ES(map.get("record").toString());
} }
} }
......
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