Commit 7d698c5a authored by tianyiming's avatar tianyiming

处理西咸存量数据功能实现

parent 55981080
...@@ -72,5 +72,21 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> { ...@@ -72,5 +72,21 @@ public interface EquipmentCategoryMapper extends BaseMapper<EquipmentCategory> {
List<Map<String, Object>> selectTzsConInfo(@Param("record")String record); List<Map<String, Object>> selectTzsConInfo(@Param("record")String record);
List<Map<String, Object>> selectTzsInsInfo(@Param("record")String record); List<Map<String, Object>> selectTzsInsInfo(@Param("record")String record);
List<String> selectWriteXiXian();
void clearSupervisoryCodeAndXiXian();
void updateSupervisoryCode(@Param("writeRecordList") List<String> writeRecordList);
List<String> selectXiXian();
void clearSupervisoryCode();
void clearCode(@Param("recordList") List<String> recordList);
List<Map<String, Object>> getEquCategory(@Param("recordList") List<String> recordList);
} }
...@@ -41,4 +41,6 @@ public interface IEquipmentCategoryService { ...@@ -41,4 +41,6 @@ public interface IEquipmentCategoryService {
List<String> deleteBatch(Map<String, Object> map); List<String> deleteBatch(Map<String, Object> map);
ResponseModel submit(Map<String, Object> map); ResponseModel submit(Map<String, Object> map);
void creatXiXian();
} }
...@@ -567,4 +567,75 @@ ...@@ -567,4 +567,75 @@
where RECORD = #{record} where RECORD = #{record}
</select> </select>
<select id="selectWriteXiXian" resultType="java.lang.String">
SELECT
record
FROM
idx_biz_jg_other_info
WHERE
"CODE96333" IN ( SELECT code96333 FROM "biz_jg_supervisory_code" WHERE code96333 LIKE'31%' AND supervisory_code LIKE'D%' AND (status = '1' or status = '2') )
AND "CLAIM_STATUS" = '已认领';
</select>
<update id="clearCode">
update "idx_biz_jg_other_info" set "SUPERVISORY_CODE" = null ,"CODE96333" = null where "RECORD" in
<foreach collection="recordList" separator="," item="record" open="(" close=");">
#{record}
</foreach>
</update>
<update id="updateSupervisoryCode">
update "idx_biz_jg_other_info" set "SUPERVISORY_CODE" = null where "RECORD" in
<foreach collection="writeRecordList" separator="," item="record" open="(" close=");">
#{record}
</foreach>
</update>
<select id="selectXiXian" resultType="java.lang.String">
SELECT
record
FROM
idx_biz_jg_other_info
WHERE
"RECORD" IN ( SELECT "RECORD" FROM idx_biz_jg_supervision_info WHERE "ORG_BRANCH_CODE" LIKE'50*18667%' )
AND "CLAIM_STATUS" = '已认领'
AND ( "CODE96333" NOT LIKE'31%' OR "CODE96333" IS NULL );
</select>
<delete id="clearSupervisoryCode">
delete
FROM
biz_jg_supervisory_code
WHERE
supervisory_code IN (
SELECT
"SUPERVISORY_CODE"
FROM
idx_biz_jg_other_info
WHERE
"RECORD" IN ( SELECT "RECORD" FROM idx_biz_jg_supervision_info WHERE "ORG_BRANCH_CODE" LIKE'50*18667%' )
AND "CLAIM_STATUS" = '已认领'
AND ( "CODE96333" NOT LIKE'31%' OR "CODE96333" IS NULL )
)
</delete>
<select id="getEquCategory" resultType="java.util.Map">
SELECT
ibjri."RECORD" record,
ibjri."EQU_CATEGORY" category,
ifnull(ibjoi."CODE96333",'null') code
FROM
idx_biz_jg_register_info ibjri
LEFT JOIN
idx_biz_jg_other_info ibjoi ON ibjri."RECORD" = ibjoi."RECORD"
WHERE ibjri."RECORD" IN
<foreach collection="recordList" separator="," item="record" open="(" close=");">
#{record}
</foreach>
</select>
<delete id="clearSupervisoryCodeAndXiXian">
delete "biz_jg_supervisory_code" WHERE code96333 LIKE '31%' AND supervisory_code LIKE 'D%' AND (status = '1' or status = '2');
</delete>
</mapper> </mapper>
...@@ -299,6 +299,21 @@ public class EquipmentCategoryController extends BaseController { ...@@ -299,6 +299,21 @@ public class EquipmentCategoryController extends BaseController {
} }
/**
* 重新生成西咸新区的码
*
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@GetMapping(value = "/creatXiXian")
@ApiOperation(httpMethod = "GET", value = "西咸存量数据处理功能", notes = "西咸存量数据处理功能")
public ResponseModel<Object> creatXiXian() {
equipmentCategoryService.creatXiXian();
return ResponseHelper.buildResponse("ok");
}
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getTable") @GetMapping(value = "/getTable")
@ApiOperation(httpMethod = "GET", value = "设备认领和设备管理通用接口", notes = "设备认领和设备管理通用接口") @ApiOperation(httpMethod = "GET", value = "设备认领和设备管理通用接口", notes = "设备认领和设备管理通用接口")
......
...@@ -1569,6 +1569,55 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1569,6 +1569,55 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return ResponseHelper.buildResponse(record); return ResponseHelper.buildResponse(record);
} }
@Override
public void creatXiXian() {
// 1查找以31开头的96333码对应的数据writeRecordList
List<String> writeRecordList = equipmentCategoryMapper.selectWriteXiXian();
// 1.1删除码表中以31开头的96333码对应的数据
equipmentCategoryMapper.clearSupervisoryCodeAndXiXian();
// 1.2将以31开头的96333码对应的数据的监管码清空
equipmentCategoryMapper.updateSupervisoryCode(writeRecordList);
// 2查找管辖机构为西咸,但96333码不为31开头的数据recordList
List<String> recordList = equipmentCategoryMapper.selectXiXian();
// 2.1删除码表中recordList对应的码数据
equipmentCategoryMapper.clearSupervisoryCode();
// 2.2清空业务表中recordList对应的96333码和监管码
equipmentCategoryMapper.clearCode(recordList);
// 3 将recordList合并到writeRecordList
writeRecordList.addAll(recordList);
List<Map<String,Object>> equCategoryList= equipmentCategoryMapper.getEquCategory(writeRecordList);
// 4、生成对应的96333和监管码
for (Map<String, Object> map : equCategoryList) {
String code96333 = null;
String category = map.get("category").toString();
String supervisoryCode = createSupervisorCode("1", XIAN_YANG, null,category);
SupervisoryCodeInfo supervisoryCodeInfo = new SupervisoryCodeInfo();
supervisoryCodeInfo.setSupervisoryCode(supervisoryCode);
supervisoryCodeInfo.setStatus(EquipmentCategoryEnum.YSY.getCode());
if (category.startsWith("3")) {
if ("null".equals(map.get("code"))) {
code96333 = createElevatorCode("31");
supervisoryCodeInfo.setCreateStatus(CREATE);
} 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());
}
}
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();
String record = null; String record = null;
...@@ -1849,9 +1898,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD ...@@ -1849,9 +1898,9 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
Double lat = esElevator.getLatitude(); Double lat = esElevator.getLatitude();
Double lon = esElevator.getLongitude(); Double lon = esElevator.getLongitude();
esElevator.setLocation(new GeoPoint(lat, lon)); esElevator.setLocation(new GeoPoint(lat, lon));
esElavtorRepository.save(esElevator);
superviseInfoMapper.updateRecordBatch(recordList);
} }
esElavtorRepository.save(esElevator);
superviseInfoMapper.updateRecordBatch(recordList);
} }
/** /**
......
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