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)) {
//获取对应行政区划 //获取对应行政区划
county = EquipmentCategoryEnum.XZQH.getCode(); city = String.valueOf(map.get("cityCode"));
city = map.get("regionCode").toString(); county = String.valueOf(map.get("countyCode"));
//获取对应设备分类 //获取对应设备分类
equipCategory = map.get("equCategory").toString(); equipCategory = String.valueOf(map.get("equCategory"));
} else { if ("null".equals(equipCategory) || "null".equals(city) || "null".equals(county)) {
equInfoDto = categoryOtherInfoMapper.selectEquipInfo(record); throw new BadRequest("请求参数不全,请查看参数中是否携带 cityCode、countyCode、equCategory 三个参数及对应值");
//判断这条数据认领状态是否为已认领,否则直接返回
if (!ObjectUtils.isEmpty(equInfoDto) && EquipmentCategoryEnum.YRL.getName().equals(equInfoDto.getStatus())) {
city = equInfoDto.getCity();
county = equInfoDto.getCounty();
equipCategory = equInfoDto.getEquipCategory();
} else {
return new HashMap<>();
}
} }
isNotXiXian = "null".equals(String.valueOf(map.get("isXiXian"))) ? "0" : "1";
//生成码 //生成码
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)) {
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); supervisoryCodeInfoMapper.insert(supervisoryCodeInfo);
}
return codeMap; return codeMap;
} }
...@@ -1571,27 +1545,33 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1571,27 +1545,33 @@ 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();
if (!ObjectUtils.isEmpty(writeRecordList)) {
// 1.1删除码表中以31或者33开头且为用户手动录入 // 1.1删除码表中以31或者33开头且为用户手动录入
equipmentCategoryMapper.clearSupervisoryCodeAndXiXian(); equipmentCategoryMapper.clearSupervisoryCodeAndXiXian();
// 1.2将以31或者33开头且为用户手动录入的96333码对应的数据的监管码清空 // 1.2将以31或者33开头且为用户手动录入的96333码对应的数据的监管码清空
equipmentCategoryMapper.updateSupervisoryCode(writeRecordList); 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();
if(!ObjectUtils.isEmpty(recordList)){
// 2.1删除码表中recordList对应的码数据 // 2.1删除码表中recordList对应的码数据
equipmentCategoryMapper.clearSupervisoryCode(); equipmentCategoryMapper.clearSupervisoryCode();
// 2.2清空业务表中recordList对应的96333码和监管码 // 2.2清空业务表中recordList对应的96333码和监管码
equipmentCategoryMapper.clearCode(recordList); 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<>();
if (!ObjectUtils.isEmpty(writeRecordList)) {
equCategoryList = equipmentCategoryMapper.getEquCategory(writeRecordList);
// 4、生成对应的96333和监管码 // 4、生成对应的96333和监管码
for (Map<String, Object> map : equCategoryList) { for (Map<String, Object> map : equCategoryList) {
String code96333 = null; String code96333 = null;
String category = map.get("category").toString(); String category = map.get("category").toString();
String supervisoryCode = createSupervisorCode("1", XIAN_YANG, null,category); String supervisoryCode = createSupervisorCode("1", XIAN_YANG, null, category);
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo(); SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
supervisoryCodeInfo.setSupervisoryCode(supervisoryCode); supervisoryCodeInfo.setSupervisoryCode(supervisoryCode);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode()); supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
...@@ -1618,6 +1598,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1618,6 +1598,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
saveEsElevator2ES(map.get("record").toString()); saveEsElevator2ES(map.get("record").toString());
} }
} }
}
private String batchSubmitOrUpdate(Map<String, Object> map, LinkedHashMap registerForm, String alias, String isCopy, String type, String claimStatus) { private String batchSubmitOrUpdate(Map<String, Object> map, LinkedHashMap registerForm, String alias, String isCopy, String type, String claimStatus) {
Date date = new Date(); Date date = new Date();
......
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