Commit aef5db9e authored by 李成龙's avatar 李成龙

Merge remote-tracking branch 'origin/develop_tzs_bugfix' into develop_tzs_bugfix

parents 6d8c10a3 44bd5fb5
......@@ -1053,7 +1053,7 @@
<select id="queryOutOfMaintenanceRecord" resultType="java.util.Map">
SELECT
tt."RECORD",
ui."RECORD",
tt."INFORM_END",
ui."USE_UNIT_NAME",
ui."USE_UNIT_CREDIT_CODE",
......@@ -1068,27 +1068,29 @@
si."ORG_BRANCH_CODE",
si."COMPANY_ORG_BRANCH_CODE"
FROM
(
idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN (
SELECT
"RECORD","INFORM_END","ROWNUM1"
FROM
(
SELECT "RECORD","INFORM_END",ROW_NUMBER() OVER (PARTITION BY "RECORD" ORDER BY "REC_DATE" DESC) AS ROWNUM1
FROM
idx_biz_jg_maintenance_record_info
idx_biz_jg_maintenance_record_info where "INFORM_END" is not null
) d
WHERE d."ROWNUM1" = 1 and d."INFORM_END" <![CDATA[<]]> to_char(now(), 'YYYY-MM-DD')
) tt
LEFT JOIN idx_biz_jg_use_info ui ON ui."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = tt."RECORD"
WHERE ui."DATA_SOURCE" like 'jg%' and ui.IS_INTO_MANAGEMENT = true
) tt on tt."RECORD" = ui."RECORD"
WHERE si."ORG_BRANCH_CODE" like '50%'
and oi."CLAIM_STATUS" not in ('草稿','已拒领','待认领')
and tt."INFORM_END" is not null
</select>
<select id="queryOutOfInspectionRecord" resultType="java.util.Map">
SELECT
tt."RECORD",
ui."RECORD",
tt."NEXT_INSPECT_DATE",
ui."USE_UNIT_NAME",
ui."USE_UNIT_CREDIT_CODE",
......@@ -1103,21 +1105,23 @@
si."ORG_BRANCH_CODE",
si."COMPANY_ORG_BRANCH_CODE"
FROM
(
SELECT "RECORD","NEXT_INSPECT_DATE","rowNum1"
idx_biz_jg_use_info ui
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = ui."RECORD"
LEFT JOIN idx_biz_jg_register_info ri on ri."RECORD" = ui."RECORD"
LEFT JOIN (
SELECT "RECORD","NEXT_INSPECT_DATE",rowNum1
FROM
(
SELECT ROW_NUMBER () OVER ( PARTITION BY "RECORD" ORDER BY "REC_DATE" DESC) AS rowNum1,"RECORD", "NEXT_INSPECT_DATE"
SELECT ROW_NUMBER () OVER ( PARTITION BY "RECORD" ORDER BY "NEXT_INSPECT_DATE" DESC) AS rowNum1,"RECORD", "NEXT_INSPECT_DATE"
FROM
idx_biz_jg_inspection_detection_info
idx_biz_jg_inspection_detection_info where "NEXT_INSPECT_DATE" is not null
) d
WHERE d.rowNum1 = 1 and d."NEXT_INSPECT_DATE" <![CDATA[<]]> to_char(now(), 'YYYY-MM-DD')
) tt
LEFT JOIN idx_biz_jg_use_info ui ON ui."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_register_info ri ON ri."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_other_info oi ON oi."RECORD" = tt."RECORD"
LEFT JOIN idx_biz_jg_supervision_info si on si."RECORD" = tt."RECORD"
WHERE ui."DATA_SOURCE" like 'jg%' and ui.IS_INTO_MANAGEMENT = true
WHERE d.rowNum1 =1 and d."NEXT_INSPECT_DATE" <![CDATA[<]]> to_char(now(), 'YYYY-MM-DD')
) tt on tt."RECORD" = ui."RECORD"
WHERE si."ORG_BRANCH_CODE" like '50%'
and oi."CLAIM_STATUS" not in ('草稿','已拒领','待认领')
and tt."NEXT_INSPECT_DATE" is not null
</select>
<select id="countBizFinishedNumForDP" resultType="java.lang.Long">
SELECT count(1) FROM "tzs_jg_installation_notice" where receive_company_org_code like CONCAT(#{orgCode}, '%') and notice_status = '6616'
......
......@@ -207,6 +207,7 @@
tzs_safety_problem_tracing
WHERE
is_delete = '0'
and problem_status_code = '0'
<if test="orgCode != null and orgCode != ''">
and governing_body_org_code like CONCAT(#{orgCode}, '%')
</if>
......
......@@ -1535,7 +1535,7 @@ public class DataHandlerServiceImpl {
Map<String, List<IdxBizJgInspectionDetectionInfo>> recordInspectInfosGroupByInspectTypeMap = lastedInspectInfosGroupByInspectType.stream().collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord));
// 设备最新的检验信息-维度:设备
Map<String, Optional<IdxBizJgInspectionDetectionInfo>> recordLastInspectionMap = lastedInspectInfosGroupByInspectType.stream().filter(e -> e.getInspectDate() != null).collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord, Collectors.maxBy(Comparator.comparing(IdxBizJgInspectionDetectionInfo::getInspectDate))));
Map<String, Optional<IdxBizJgInspectionDetectionInfo>> recordLastInspectionMap = lastedInspectInfosGroupByInspectType.stream().filter(e -> e.getNextInspectDate() != null).collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord, Collectors.maxBy(Comparator.comparing(IdxBizJgInspectionDetectionInfo::getNextInspectDate))));
List<ESEquipmentInfo> esEquipmentInfos = refreshRecords.parallelStream().map(record -> {
ESEquipmentInfo esEquipmentInfo = null;
try {
......@@ -1641,7 +1641,7 @@ public class DataHandlerServiceImpl {
Map<String, List<IdxBizJgInspectionDetectionInfo>> recordInspectInfosGroupByInspectTypeMap = lastedInspectInfosGroupByInspectType.stream().collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord));
// 设备最新的检验信息-维度:设备
Map<String, Optional<IdxBizJgInspectionDetectionInfo>> recordLastInspectionMap = lastedInspectInfosGroupByInspectType.stream().filter(e -> e.getInspectDate() != null).collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord, Collectors.maxBy(Comparator.comparing(IdxBizJgInspectionDetectionInfo::getInspectDate))));
Map<String, Optional<IdxBizJgInspectionDetectionInfo>> recordLastInspectionMap = lastedInspectInfosGroupByInspectType.stream().filter(e -> e.getNextInspectDate() != null).collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord, Collectors.maxBy(Comparator.comparing(IdxBizJgInspectionDetectionInfo::getNextInspectDate))));
List<ESEquipmentInfo> esEquipmentInfos = records.parallelStream().map(record -> {
ESEquipmentInfo esEquipmentInfo = null;
try {
......@@ -1768,7 +1768,7 @@ public class DataHandlerServiceImpl {
Map<String, List<IdxBizJgInspectionDetectionInfo>> recordInspectInfosGroupByInspectTypeMap = lastedInspectInfosGroupByInspectType.stream().collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord));
// 设备最新的检验信息-维度:设备
Map<String, Optional<IdxBizJgInspectionDetectionInfo>> recordLastInspectionMap = lastedInspectInfosGroupByInspectType.stream().filter(e -> e.getInspectDate() != null).collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord, Collectors.maxBy(Comparator.comparing(IdxBizJgInspectionDetectionInfo::getInspectDate))));
Map<String, Optional<IdxBizJgInspectionDetectionInfo>> recordLastInspectionMap = lastedInspectInfosGroupByInspectType.stream().filter(e -> e.getNextInspectDate() != null).collect(Collectors.groupingBy(IdxBizJgInspectionDetectionInfo::getRecord, Collectors.maxBy(Comparator.comparing(IdxBizJgInspectionDetectionInfo::getNextInspectDate))));
List<ESEquipmentInfo> esEquipmentInfos = records.parallelStream().map(record -> {
ESEquipmentInfo esEquipmentInfo = null;
try {
......
......@@ -2,7 +2,6 @@ package com.yeejoin.amos.boot.module.jg.biz.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.google.common.collect.Lists;
......@@ -27,7 +26,6 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -145,18 +143,22 @@ public class SafetyProblemTracingGenServiceImpl{
return;
}
List<String> records = mapList.stream().map(m -> m.get("RECORD").toString()).collect(Collectors.toList());
// 更新设备状态为未处理(异常)
idxBizJgOtherInfoService.lambdaUpdate()
.in(IdxBizJgOtherInfo::getRecord, records)
.set(IdxBizJgOtherInfo::getStatus, SafetyProblemStatusEnum.UNHANDLED.getCode())
.update();
List<ESEquipmentCategoryDto> esEquipmentCategoryDto = Lists.newArrayList();
for (ESEquipmentCategoryDto equipmentCategoryDto : esEquipmentCategory.findAllById(records)) {
equipmentCategoryDto.setProblemStatus(SafetyProblemStatusEnum.UNHANDLED.getCode());
esEquipmentCategoryDto.add(equipmentCategoryDto);
int batchSize = 10000;
for (int i = 0; i < records.size(); i += batchSize) {
List<String> batch = records.subList(i, Math.min(i + batchSize, records.size()));
// 更新设备状态为未处理(异常)
idxBizJgOtherInfoService.lambdaUpdate()
.in(IdxBizJgOtherInfo::getRecord, batch)
.set(IdxBizJgOtherInfo::getStatus, SafetyProblemStatusEnum.UNHANDLED.getCode())
.update();
List<ESEquipmentCategoryDto> esEquipmentCategoryDto = Lists.newArrayList();
for (ESEquipmentCategoryDto equipmentCategoryDto : esEquipmentCategory.findAllById(batch)) {
equipmentCategoryDto.setProblemStatus(SafetyProblemStatusEnum.UNHANDLED.getCode());
esEquipmentCategoryDto.add(equipmentCategoryDto);
}
esEquipmentCategory.saveAll(esEquipmentCategoryDto);
sendSafetyProblemMessage(mapList, safetyProblemTypeEnum);
}
esEquipmentCategory.saveAll(esEquipmentCategoryDto);
sendSafetyProblemMessage(mapList, safetyProblemTypeEnum);
}
private void updateEnterpriseAndSendMessage(List<Map<String, Object>> mapList) {
......@@ -193,11 +195,10 @@ public class SafetyProblemTracingGenServiceImpl{
* @param safetyProblemTypeEnum
*/
private void sendSafetyProblemMessage(List<Map<String, Object>> mapList, SafetyProblemTypeEnum safetyProblemTypeEnum) {
JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(mapList));
if (CollectionUtil.isNotEmpty(jsonArray)){
if (CollectionUtil.isNotEmpty(mapList)){
try {
logger.info("发送安全追溯问题主题---->{}", safetyProblemTypeEnum.getTopic());
emqKeeper.getMqttClient().publish(safetyProblemTypeEnum.getTopic(), jsonArray.toString().getBytes(StandardCharsets.UTF_8), 2, false);
emqKeeper.getMqttClient().publish(safetyProblemTypeEnum.getTopic(), JSON.toJSONBytes(mapList), 2, false);
logger.info("发送安全追溯问题消息成功---->");
} catch (MqttException e) {
logger.error("发送安全追溯问题设备信息消息失败---->{}", e.getMessage());
......
......@@ -1302,6 +1302,7 @@ public class ComprehensiveStatisticalAnalysisServiceImpl {
pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE"));
pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE",""));
SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum(countField).field("pipeLength").missing(0);
builder.query(pipeLengthQuery);
builder.aggregation(pipeLengthAgg).size(0);
request.source(builder);
try {
......
......@@ -486,7 +486,9 @@ public class JGDPStatisticsServiceImpl {
pipeLengthQuery.must(QueryBuilders.existsQuery("pipeLength"));
pipeLengthQuery.must(existsQuery("SUPERVISORY_CODE"));
pipeLengthQuery.mustNot(QueryBuilders.termQuery("SUPERVISORY_CODE", ""));
pipeLengthQuery.mustNot(QueryBuilders.termsQuery("STATUS", Arrays.asList("草稿", "已拒领", "待认领")));
SumAggregationBuilder pipeLengthAgg = AggregationBuilders.sum("pipeLengthSum").field("pipeLength").missing(0);
builder.query(pipeLengthQuery);
builder.aggregation(pipeLengthAgg).size(0);
request.source(builder);
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