Browse Source

武汉电站下发联合任务合并生成报告结果

master
wangguangyuan 8 months ago
parent
commit
dbaff68ce1
20 changed files with 260 additions and 53 deletions
  1. +5
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/mapper/ResultAnalysisMapper.java
  2. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/IResultAnalysisService.java
  3. +5
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/ResultAnalysisServiceImpl.java
  4. +23
    -12
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/controller/PatrolResultController.java
  5. +3
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/PatrolResult.java
  6. +8
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/mapper/PatrolResultMapper.java
  7. +5
    -1
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/IPatrolResultService.java
  8. +33
    -16
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java
  9. +3
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresultAux/mapper/PatrolResultAuxMapper.java
  10. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresultAux/service/IPatrolResultAuxService.java
  11. +5
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresultAux/service/impl/PatrolResultAuxServiceImpl.java
  12. +13
    -4
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/PatrolTaskResultMainController.java
  13. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java
  14. +2
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java
  15. +5
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/impl/PatrolTaskResultMainServiceImpl.java
  16. +1
    -2
      inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml
  17. +12
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultAuxMapper.xml
  18. +80
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml
  19. +29
    -18
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml
  20. +22
    -0
      inspect-main/inspect-main-task/src/main/resources/mapper/task/ResultAnalysisMapper.xml

+ 5
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/mapper/ResultAnalysisMapper.java View File

@ -7,6 +7,7 @@ import com.inspect.analysis.domain.ResultAnalysis;
import com.inspect.partrolresult.domain.PatrolResult;
import com.inspect.task.domain.PatrolData;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
@ -64,4 +65,8 @@ public interface ResultAnalysisMapper {
List<AlgPatrolPoint> selectResultAnalyseForAlarm(AnalyseSummaryAlarmModel alarmModel);
List<PatrolData> selectResultAnalysisListForAlarm(AnalyseSummaryAlarmModel alarmModel);
int selectResultAnalysisByMainIds(@Param("lineIds") List<Long> lineIds);
List<ResultAnalysis> selectResultAnalysisListByMainIds(@Param("lineIds") List<Long> lineIds);
}

+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/IResultAnalysisService.java View File

@ -14,6 +14,8 @@ public interface IResultAnalysisService {
int selectResultAnalysisByMainId(Long mainId);
int selectResultAnalysisByMainIds(List<Long> mainIds);
List<ResultAnalysis> selectResultAnalysisList(ResultAnalysis resultAnalysis);
List<ResultAnalysis> selectResultAnalysisListByMainId(ResultAnalysis mainId);


+ 5
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/analysis/service/impl/ResultAnalysisServiceImpl.java View File

@ -31,6 +31,11 @@ public class ResultAnalysisServiceImpl implements IResultAnalysisService {
return this.resultAnalysisMapper.selectResultAnalysisByMainId(lineId);
}
@Override
public int selectResultAnalysisByMainIds(List<Long> lineIds) {
return this.resultAnalysisMapper.selectResultAnalysisByMainIds(lineIds);
}
public List<ResultAnalysis> selectResultAnalysisList(ResultAnalysis resultAnalysis) {
return this.resultAnalysisMapper.selectResultAnalysisList(resultAnalysis);
}


+ 23
- 12
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/controller/PatrolResultController.java View File

@ -166,22 +166,33 @@ public class PatrolResultController extends BaseController {
@GetMapping({"/list"})
public TableDataInfo list(PatrolResult patrolResult) {
startPage();
List<PatrolResult> list = patrolResultService.selectPatroByAllDev(patrolResult);
for (PatrolResult result : list) {
PatrolResultAux pra = new PatrolResultAux();
pra.setResultId(result.getLineId() + "");
List<PatrolResultAux> pra1 = iPatrolResultAuxService.selectPatrolResultAuxList(pra);
if (!pra1.isEmpty()) {
result.setValue(pra1.get(0).getValue());
String mainId = patrolResult.getMainId();
List<PatrolResult> list = new ArrayList<>();
if (StringUtils.isNotBlank(mainId)) {
List<Long> lineIds = patrolTaskResultMainService.selectLineIds(Long.parseLong(mainId));
if (lineIds != null && lineIds.size() > 0) {
patrolResult.setMainIds(lineIds);
list = patrolResultService.selectPatroByAllDevByMainIds(patrolResult);
} else {
list = patrolResultService.selectPatroByAllDev(patrolResult);
}
for (PatrolResult result : list) {
PatrolResultAux pra = new PatrolResultAux();
pra.setResultId(result.getLineId() + "");
List<PatrolResultAux> pra1 = iPatrolResultAuxService.selectPatrolResultAuxList(pra);
if (!pra1.isEmpty()) {
result.setValue(pra1.get(0).getValue());
}
if ("0".equals(result.getValue())) {
result.setValue("正常");
}
if ("0".equals(result.getValue())) {
result.setValue("正常");
}
if ("-1".equals(result.getValue()) || "1".equals(result.getValue())) {
result.setValue("异常");
if ("-1".equals(result.getValue()) || "1".equals(result.getValue())) {
result.setValue("异常");
}
}
}
return getDataTable(list);


+ 3
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/PatrolResult.java View File

@ -158,6 +158,8 @@ public class PatrolResult extends BaseEntity {
private String patrolPointName;
private String channelCode;
private List<Long> mainIds;
public PatrolResult(String mainId) {
this.mainId = mainId;
}
@ -233,6 +235,7 @@ public class PatrolResult extends BaseEntity {
", algId=" + algId +
", patrolPointName='" + patrolPointName + '\'' +
", channelCode='" + channelCode + '\'' +
", mainIds='" + mainIds + '\'' +
'}';
}
}

+ 8
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/mapper/PatrolResultMapper.java View File

@ -38,6 +38,8 @@ public interface PatrolResultMapper {
List<PatrolResult> selectPatroByAllDev(PatrolResult patrolResult);
List<PatrolResult> selectPatroByAllDevByMainIds(PatrolResult patrolResult);
List<AlgInfo> selectAlgInfo(PatrolResult patrolResult);
List<PatrolResult> queryPatrolResultByPointID(String key, Date date, Date date2);
@ -99,4 +101,10 @@ public interface PatrolResultMapper {
List<InspectionPointResultVo> inspectResult(InspectionPointParam inspectionPointParam);
BasedataEqpBookChannel selectChannelName(@Param("channelCode") String channelCode);
List<PatrolResult> selectPatrolResultListByMainIds(@Param("mainIds") List<Long> mainIds);
List<PatrolResultRef> selectResultRefByLineIds(@Param("mainIds") List<Long> mainIds);
List<BasePointAreaInfo> selectBaseInfoByMainIds(@Param("mainIds") List<Long> mainIds);
}

+ 5
- 1
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/IPatrolResultService.java View File

@ -31,6 +31,8 @@ public interface IPatrolResultService {
List<PatrolResult> selectPatroByAllDev(PatrolResult patrolResult);
List<PatrolResult> selectPatroByAllDevByMainIds(PatrolResult patrolResult);
List<AlgInfo> selectAlgInfo(PatrolResult patrolResult);
Map<String, String> selectAlgorithmType(String type);
@ -73,7 +75,7 @@ public interface IPatrolResultService {
List<ResultValue> select6FsResultValue(PatrolResult patrolResult);
Long saveReport(PatrolTaskResultMain resultMain, List<PatrolResult> resultList);
Long saveReport(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList);
List<PatrolResultRef> selectResultRefByLineId(String lineId);
@ -82,4 +84,6 @@ public interface IPatrolResultService {
List<InspectionPointResultVo> inspectResult(InspectionPointParam inspectionPointParam);
BasedataEqpBookChannel selectChannelName(String channelCode);
List<PatrolResult> selectPatrolResultListByMainIds(List<Long> mainIds);
}

+ 33
- 16
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/service/impl/PatrolResultServiceImpl.java View File

@ -113,6 +113,10 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
return patrolResultMapper.selectPatroByAllDev(patrolResult);
}
public List<PatrolResult> selectPatroByAllDevByMainIds(PatrolResult patrolResult) {
return patrolResultMapper.selectPatroByAllDevByMainIds(patrolResult);
}
public List<AlgInfo> selectAlgInfo(PatrolResult patrolResult) {
return patrolResultMapper.selectAlgInfo(patrolResult);
}
@ -288,21 +292,25 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
}
@Transactional
public Long saveReport(PatrolTaskResultMain resultMain, List<PatrolResult> resultList) {
public Long saveReport(PatrolTaskResultMain resultMain, List<Long> lineIds, Long currentLineId, List<PatrolResult> resultList) {
long startTime = System.currentTimeMillis();
String mainId = String.valueOf(resultMain.getLineId());
resultMain.setCheckTime(new Date());
resultMain.setFileStatus("1");
this.patrolTaskResultMainMapper.updatePatrolTaskResultMain(resultMain);
this.patrolResultMapper.updatePatrolResultByMainId(mainId);
// String mainId = String.valueOf(resultMain.getLineId());
for (Long lineId : lineIds) {
resultMain.setLineId(lineId);
resultMain.setCheckTime(new Date());
resultMain.setFileStatus("1");
this.patrolTaskResultMainMapper.updatePatrolTaskResultMain(resultMain);
this.patrolResultMapper.updatePatrolResultByMainId(String.valueOf(lineId));
}
PrintUtil.useTime("AMENDING DATA", startTime);
return saveReportData(resultList, resultMain);
resultMain.setLineId(currentLineId);
return saveReportData(resultList, resultMain, lineIds);
}
public Long saveReportData(List<PatrolResult> resultList, PatrolTaskResultMain resultMain) {
public Long saveReportData(List<PatrolResult> resultList, PatrolTaskResultMain resultMain, List<Long> lineIds) {
long startTime = System.currentTimeMillis();
String mainId = String.valueOf(resultMain.getLineId());
String analyseNum = statisticsAnalyseNum(mainId, resultList.size());
String analyseNum = statisticsAnalyseNum(lineIds, resultList.size());
startTime = PrintUtil.useTime("STATISTICS ANALYZE DATA", startTime);
if (resultList.isEmpty()) {
throw new ServiceException("LACK INSPECT RESULT: " + mainId);
@ -350,7 +358,7 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
report.setStationType(stationType);
inspectionReportMapper.insertInspectionReport(report);
PrintUtil.useTime("NEW TASK REPORT", startTime);
batchInsertReportData(String.valueOf(report.getLineId()), mainId);
batchInsertReportData(String.valueOf(report.getLineId()), lineIds);
PrintUtil.useTime("BATCH INSERT DETAIL", startTime);
}
@ -371,13 +379,15 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
report.setInspectionEndTime(DateUtil.parseDateTime(taskStatus.getEndTime()));
}
public void batchInsertReportData(String reportId, String mainId) {
log.info("batchInsertReportData reportId:" + reportId + ", mainId:" + mainId);
public void batchInsertReportData(String reportId, List<Long> mainIds) {
log.info("batchInsertReportData reportId:" + reportId + ", mainIds:" + mainIds);
long startTime = System.currentTimeMillis();
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineId(mainId);
// List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineId(mainId);
List<PatrolResultRef> patrolResultRefs = patrolResultMapper.selectResultRefByLineIds(mainIds);
log.info("batchInsertReportData patrolResultRefs:" + patrolResultRefs);
startTime = PrintUtil.useTime("SELECT RESULT", startTime);
List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainId(mainId);
// List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainId(mainId);
List<BasePointAreaInfo> basePointAreaInfoList = patrolResultMapper.selectBaseInfoByMainIds(mainIds);
log.info("batchInsertReportData basePointAreaInfoList:" + basePointAreaInfoList);
PrintUtil.useTime("AREA INQUERY", startTime);
log.info("REPORTS SIZE: {}", patrolResultRefs.size());
@ -480,11 +490,13 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
}
}
public String statisticsAnalyseNum(String mainId, int totalNum) {
public String statisticsAnalyseNum(List<Long> lineIds, int totalNum) {
int okNum = 0;
int failNum = 0;
int confirmNum = 0;
List<ResultAnalysis> analyses = resultAnalysisMapper.selectResultAnalysisListByMainId(new ResultAnalysis(mainId));
// List<ResultAnalysis> analyses = resultAnalysisMapper.selectResultAnalysisListByMainId(new ResultAnalysis(mainId));
List<ResultAnalysis> analyses = resultAnalysisMapper.selectResultAnalysisListByMainIds(lineIds);
log.info("lineIds:{},statisticsAnalyseNum analyses:{}", lineIds, analyses);
for (ResultAnalysis analyse : analyses) {
String var9 = analyse.getPointStatus();
byte var10 = -1;
@ -546,6 +558,11 @@ public class PatrolResultServiceImpl implements IPatrolResultService {
return patrolResultMapper.selectChannelName(channelCode);
}
@Override
public List<PatrolResult> selectPatrolResultListByMainIds(List<Long> mainIds) {
return patrolResultMapper.selectPatrolResultListByMainIds(mainIds);
}
public static void main(String[] args) {
List<String> students = new ArrayList<>();
students.add("s1");


+ 3
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresultAux/mapper/PatrolResultAuxMapper.java View File

@ -2,6 +2,7 @@ package com.inspect.partrolresultAux.mapper;
import com.inspect.partrolresultAux.domain.PatrolResultAux;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -13,6 +14,8 @@ public interface PatrolResultAuxMapper {
List<PatrolResultAux> selectPatrolResultAuxListByMainId(PatrolResultAux patrolResultAux);
List<PatrolResultAux> selectPatrolResultAuxListByMainIds(@Param("mainIds") List<Long> mainIds);
int insertPatrolResultAux(PatrolResultAux patrolResultAux);
int updatePatrolResultAux(PatrolResultAux patrolResultAux);


+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresultAux/service/IPatrolResultAuxService.java View File

@ -11,6 +11,8 @@ public interface IPatrolResultAuxService {
List<PatrolResultAux> selectPatrolResultAuxListByMainId(PatrolResultAux patrolResultAux);
List<PatrolResultAux> selectPatrolResultAuxListByMainIds(List<Long> mainIds);
int insertPatrolResultAux(PatrolResultAux patrolResultAux);
int updatePatrolResultAux(PatrolResultAux patrolResultAux);


+ 5
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresultAux/service/impl/PatrolResultAuxServiceImpl.java View File

@ -30,6 +30,11 @@ public class PatrolResultAuxServiceImpl implements IPatrolResultAuxService {
return this.patrolResultAuxMapper.selectPatrolResultAuxListByMainId(patrolResultAux);
}
@Override
public List<PatrolResultAux> selectPatrolResultAuxListByMainIds(List<Long> mainIds) {
return this.patrolResultAuxMapper.selectPatrolResultAuxListByMainIds(mainIds);
}
public int insertPatrolResultAux(PatrolResultAux patrolResultAux) {
patrolResultAux.setCreateTime(DateUtils.getNowDate());
return this.patrolResultAuxMapper.insertPatrolResultAux(patrolResultAux);


+ 13
- 4
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/controller/PatrolTaskResultMainController.java View File

@ -1,6 +1,7 @@
package com.inspect.resultmain.controller;
import cn.hutool.core.date.DateUtil;
import com.inspect.analysis.domain.resultList;
import com.inspect.analysis.service.IResultAnalysisService;
import com.inspect.base.core.sftp.SftpClient;
import com.inspect.base.core.sftp.SftpUploadEntity;
@ -163,16 +164,23 @@ public class PatrolTaskResultMainController extends BaseController {
String mainId = String.valueOf(lineId);
long startTime = System.currentTimeMillis();
logger.info("[ARCHIVE] Starting, Id: {}", mainId);
List<Long> lineIds = patrolTaskResultMainService.selectLineIds(lineId);
if (lineIds.size() == 0) {
lineIds.add(lineId);
}
logger.info("---归档--lineIds size: {},lineIds:{}", lineIds.size(), lineIds);
int analyseNum, collectNum;
AtomicInteger modifyNum = new AtomicInteger(0);
List<PatrolResult> resultList = patrolResultService.selectPatrolResultList(new PatrolResult(mainId));
// List<PatrolResult> resultList = patrolResultService.selectPatrolResultList(new PatrolResult(mainId));
List<PatrolResult> resultList = patrolResultService.selectPatrolResultListByMainIds(lineIds);
if (resultList.isEmpty()) {
final String result = "[ARCHIVE] Fail, Data is gathering, Please wait!";
logger.error(result);
return AjaxResult.error(result);
}
List<PatrolResultAux> patrolResultAuxList = iPatrolResultAuxService.selectPatrolResultAuxListByMainId(new PatrolResultAux(mainId));
// List<PatrolResultAux> patrolResultAuxList = iPatrolResultAuxService.selectPatrolResultAuxListByMainId(new PatrolResultAux(mainId));
List<PatrolResultAux> patrolResultAuxList = iPatrolResultAuxService.selectPatrolResultAuxListByMainIds(lineIds);
for (PatrolResultAux aux : patrolResultAuxList) {
resultList.forEach((item) -> {
if (aux.getResultId().equals(String.valueOf(item.getLineId()))) {
@ -186,7 +194,8 @@ public class PatrolTaskResultMainController extends BaseController {
startTime = PrintUtil.useTime("INQUIRY MEND DATA", startTime);
collectNum = resultList.size();
analyseNum = resultAnalysisService.selectResultAnalysisByMainId(lineId);
// analyseNum = resultAnalysisService.selectResultAnalysisByMainId(lineId);
analyseNum = resultAnalysisService.selectResultAnalysisByMainIds(lineIds);
startTime = PrintUtil.useTime("INQUIRY ANALYZE DATA", startTime);
logger.info("[ARCHIVE] Id: {}, collectNum: {}, analyseNum: {}, modifyNum:{}", mainId, collectNum, analyseNum, modifyNum.get());
if (modifyNum.get() + analyseNum != collectNum) {
@ -194,7 +203,7 @@ public class PatrolTaskResultMainController extends BaseController {
logger.error(failMsg);
return AjaxResult.error(failMsg);
} else {
Long reportId = patrolResultService.saveReport(resultMain, resultList);
Long reportId = patrolResultService.saveReport(resultMain, lineIds, lineId, resultList);
PrintUtil.useTime("ARCHIVE END", startTime);
(new Thread(() -> {
long beginTime = (new Date()).getTime();


+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/mapper/PatrolTaskResultMainMapper.java View File

@ -25,4 +25,6 @@ public interface PatrolTaskResultMainMapper {
List<PatrolTaskResultMain> selectMainFileStatus(String patrolIds);
List<Long> selectLineIds(Long lineId);
}

+ 2
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/IPatrolTaskResultMainService.java View File

@ -23,4 +23,6 @@ public interface IPatrolTaskResultMainService {
List<PatrolTaskResultMain> selectMainFileStatus(String patrolIds);
List<Long> selectLineIds(Long lineId);
}

+ 5
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/resultmain/service/impl/PatrolTaskResultMainServiceImpl.java View File

@ -56,4 +56,9 @@ public class PatrolTaskResultMainServiceImpl implements IPatrolTaskResultMainSer
return this.patrolTaskResultMainMapper.selectMainFileStatus(patrolIds);
}
@Override
public List<Long> selectLineIds(Long lineId) {
return this.patrolTaskResultMainMapper.selectLineIds(lineId);
}
}

+ 1
- 2
inspect-main/inspect-main-task/src/main/resources/mapper/task/InspectionReportMapper.xml View File

@ -79,13 +79,12 @@
left JOIN patrol_task b on a.task_id=b.task_id
left JOIN basedata_device c on b.device_list = c.device_id
left JOIN basedata_area d on b.area_id =d.area_id
left JOIN basedata_eqpbook e on find_in_set( e.patrol_device_code, b.dev_no )
-- left JOIN basedata_eqpbook e on find_in_set( e.patrol_device_code, b.dev_no )
<where>
<if test="areaName != null and areaName != ''">and b.area_name like concat('%',#{areaName},'%')</if>
<if test="areaType != null and areaType != ''">and d.area_name like concat('%',#{areaType},'%') and
area_type ='bayunit'
</if>
<if test="deviceType != null and deviceType != ''">and e.type =#{deviceType}</if>
<if test="type != null ">and b.type = #{type}</if>
<if test="cycleStartTime != null "><!-- 开始时间检索 -->
AND date_format(a.inspection_date,'%y%m%d') &gt;= date_format(#{cycleStartTime},'%y%m%d')


+ 12
- 0
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultAuxMapper.xml View File

@ -80,11 +80,23 @@
where b.main_id = #{resultId}
</select>
<select id="selectPatrolResultAuxListByMainIds"
resultMap="PatrolResultAuxResult">
select a.result_id, a.value
from patrol_result_aux a
left join patrol_result b on b.line_id = a.result_id
where b.main_id in
<foreach item="item" collection="mainIds" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectPatrolResultAuxByLineId" parameterType="Long" resultMap="PatrolResultAuxResult">
<include refid="selectPatrolResultAuxVo"/>
where line_id = #{lineId}
</select>
<insert id="insertPatrolResultAux" parameterType="PatrolResultAux" useGeneratedKeys="true" keyProperty="lineId">
insert into patrol_result_aux
<trim prefix="(" suffix=")" suffixOverrides=",">


+ 80
- 0
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml View File

@ -411,6 +411,34 @@
ORDER BY line_id desc
</select>
<select id="selectPatroByAllDevByMainIds" parameterType="PatrolResult" resultMap="PatrolResultResult">
select a.*,c.area_name from patrol_result a
left JOIN basedata_patrolpoint b on a.device_id=b.patrol_point_id
left join basedata_device c on b.main_device_id = c.device_id
left JOIN basedata_area d on c.area_id =d.area_id
left JOIN basedata_devicetype e on e.device_type_id =c.device_type_id
<where>
<if test="areaName != null and areaName != ''">and d.area_name like concat('%',#{areaName},'%')</if>
<if test="areaType != null and areaType != ''">and d.area_name like concat('%',#{areaType},'%') and
area_type ='bayunit'
</if>
<if test="deviceName != null and deviceName != ''">and a.device_name like concat('%',#{deviceName},'%')
</if>
<if test="deviceTypeName != null and deviceTypeName != ''">and e.device_type_name like
concat('%',#{deviceTypeName},'%')
</if>
<if test="deviceId != null and deviceId != ''">and a.device_id =#{deviceId}</if>
<if test="mainIds != null and mainIds.size() > 0">
and a.main_id in
<foreach collection="mainIds" item="mainId" open="(" separator="," close=")">
#{mainId}
</foreach>
</if>
<if test="taskName != null and taskName != ''">and a.task_name like concat('%',#{taskName},'%')</if>
</where>
ORDER BY line_id desc
</select>
<resultMap type="AlgInfo" id="AlgInfoResult">
<result property="algSubtypeName" column="alg_subtype_name"/>
@ -570,6 +598,29 @@
and a.patrol_device_code = c.dev_no
where a.main_id = #{mainId}
</select>
<select id="selectResultRefByLineIds" resultMap="PatrolResultRef">
select a.line_id,
a.device_id,
c.dev_type,
a.time,
a.value,
a.threshold,
a.file_path,
b.description,
b.point_status,
a.value_unit,
b.result_content
from patrol_result a
left join result_analysis b on a.line_id = b.business_id
left join patrol_task_info c on a.task_code = c.task_major_id
and a.device_id = c.device_id
and a.patrol_device_code = c.dev_no
where a.main_id in
<foreach collection="mainIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectBaseInfoByPointId" parameterType="String" resultType="java.util.Map">
select a.patrol_point_name, b.device_name, c.device_name as main_name, d.area_name as jg_name, e.area_name
from basedata_patrolpoint a
@ -606,6 +657,26 @@
left join basedata_area e on c.area_id = e.area_id
where f.main_id = #{mainId}
</select>
<select id="selectBaseInfoByMainIds" resultMap="BasePointAreaInfo">
select f.device_id,
a.patrol_point_id,
a.patrol_point_name,
b.device_name,
c.device_name as main_name,
d.area_name as jg_name,
e.area_name
from patrol_result f
left join basedata_patrolpoint a
on f.device_id = a.patrol_point_id OR f.device_name = a.patrol_point_name
left join basedata_device b on a.device_id = b.device_id and b.power_main_equ_flag = "no"
left join basedata_device c on b.parent_id = c.device_id
left join basedata_area d on c.area_id = d.area_id and d.area_type = 'bayunit'
left join basedata_area e on c.area_id = e.area_id
where f.main_id in
<foreach collection="mainIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<select id="selectAlgTypeByAlaName" parameterType="String" resultType="java.util.Map">
select a.*
from basedata_alg a
@ -948,4 +1019,13 @@
</where>
LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="selectPatrolResultListByMainIds" resultMap="PatrolResultResult">
<include refid="selectPatrolResultVo"/>
where main_id in
<foreach collection="mainIds" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
ORDER BY main_id,create_time
</select>
</mapper>

+ 29
- 18
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolTaskResultMainMapper.xml View File

@ -73,23 +73,24 @@
<select id="selectPatrolTaskResultMain" parameterType="PatrolTaskResultMain" resultMap="PatrolTaskResultMainResult">
SELECT
a.line_id,
a.task_id,
a.task_patrolled_id,
a.task_name,
a.task_code,
a.create_time,
a.create_by,
a.file_status,
a.area_name,
a.task_type,
a.task_time,
a.interval_name,
a.dev_type,
a.task_result,
a.request_id,
a.check_person,
a.check_time
max(a.line_id) as line_id,
max(a.task_id) as task_id,
group_concat(a.task_patrolled_id) as task_patrolled_id,
a.task_name as task_name,
max(a.task_code) as task_code,
max(a.create_time) as create_time,
a.create_by as create_by,
max(a.file_status) as file_status,
group_concat(a.area_name) as area_name,
max(a.task_type) as task_type,
max(a.task_time) as task_time,
max(a.interval_name) as interval_name,
group_concat(a.dev_type) as dev_type,
group_concat(a.task_result) as task_result,
max(a.request_id) as request_id,
max(a.check_person) as check_person,
max(a.check_time) as check_time,
a.unified_task_patrolled_id as unified_task_patrolled_id
FROM
patrol_task_result_main a,
patrol_task_status b
@ -113,7 +114,8 @@
<if test="checkPerson != null and checkPerson != ''">and a.check_person = #{checkPerson}</if>
<if test="checkTime != null ">and a.check_time = #{checkTime}</if>
<if test="taskPatrolledId != null ">and a.task_patrolled_id = #{taskPatrolledId}</if>
ORDER BY a.line_id desc
group by a.unified_task_patrolled_id,a.task_id,a.task_name,a.create_by
ORDER BY line_id desc
</select>
<select id="selectUnifiedTaskPatrolledId" parameterType="PatrolTaskResultMain" resultType="java.lang.String">
@ -136,6 +138,15 @@
task_patrolled_id in (${ids})
</select>
<select id="selectLineIds" resultType="java.lang.Long">
select
line_id
from
patrol_task_result_main
where
unified_task_patrolled_id in (select unified_task_patrolled_id from patrol_task_result_main where line_id = #{lineId})
</select>
<insert id="insertPatrolTaskResultMain" parameterType="PatrolTaskResultMain" useGeneratedKeys="true"
keyProperty="lineId">


+ 22
- 0
inspect-main/inspect-main-task/src/main/resources/mapper/task/ResultAnalysisMapper.xml View File

@ -115,6 +115,18 @@
where a.main_id = #{businessId}
and b.business_id is not null
</select>
<select id="selectResultAnalysisListByMainIds" resultMap="ResultAnalysisResult">
select b.business_id, b.point_status
from patrol_result a
left join result_analysis b on a.line_id = b.business_id
where a.main_id in
<foreach item="item" index="index" collection="lineIds" open="(" separator="," close=")">
#{item}
</foreach>
and b.business_id is not null
</select>
<resultMap type="PatrolResult" id="PatrolResultResult">
<result property="lineId" column="line_id"/>
<result property="patrolDeviceName" column="patrol_device_name"/>
@ -466,6 +478,16 @@
WHERE a.main_id = #{mainId}
</select>
<select id="selectResultAnalysisByMainIds" resultType="java.lang.Integer">
SELECT COUNT(b.line_id)
FROM patrol_result a
left join result_analysis b on a.line_id = b.business_id
WHERE a.main_id in
<foreach collection="lineIds" item="mainId" open="(" separator="," close=")">
#{mainId}
</foreach>
</select>
<insert id="insertAnalyseLog" parameterType="com.inspect.analysis.domain.AnalyseLog">
insert into patrol_analyse_log (content,type,create_time,task_patrol_id,filter,request_id)


Loading…
Cancel
Save