Browse Source

印尼-易达巡视结果接口问腿修改

master
王寅 8 months ago
parent
commit
a96eac3c88
6 changed files with 99 additions and 61 deletions
  1. +15
    -15
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/controller/PatrolResultController.java
  2. +1
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/InspectionPointParam.java
  3. +1
    -0
      inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/InspectionPointResultVo.java
  4. +45
    -31
      inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml
  5. +1
    -0
      inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/domain/vo/PointLatestResultVo.java
  6. +36
    -15
      inspect-metadata/src/main/resources/mapper/patrolpointmnt/BasedataPatrolPointMapper.xml

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

@ -2054,21 +2054,21 @@ public class PatrolResultController extends BaseController {
}
}
if (StringUtils.isNotEmpty(brr.getDeviceId())) {
String pointId = brr.getDeviceId();
List<Map<String, Object>> pointPrelist = this.patrolTaskService.selectBasePointPre(pointId);
if (pointPrelist != null && !pointPrelist.isEmpty()) {
Map<String, Object> drr = (Map) pointPrelist.get(0);
if (drr != null && drr.get("channel_code") != null) {
String channel_code = (String) drr.get("channel_code");
brr.setPatroldeviceCode(channel_code);
BasedataEqpBookChannel basedataEqpBookChannel = this.patrolResultService.selectChannelName(channel_code);
if (basedataEqpBookChannel != null) {
brr.setPatroldeviceName(basedataEqpBookChannel.getChannelName());
}
}
}
}
// if (StringUtils.isNotEmpty(brr.getDeviceId())) {
// String pointId = brr.getDeviceId();
// List<Map<String, Object>> pointPrelist = this.patrolTaskService.selectBasePointPre(pointId);
// if (pointPrelist != null && !pointPrelist.isEmpty()) {
// Map<String, Object> drr = (Map) pointPrelist.get(0);
// if (drr != null && drr.get("channel_code") != null) {
// String channel_code = (String) drr.get("channel_code");
// brr.setPatroldeviceCode(channel_code);
// BasedataEqpBookChannel basedataEqpBookChannel = this.patrolResultService.selectChannelName(channel_code);
// if (basedataEqpBookChannel != null) {
// brr.setPatroldeviceName(basedataEqpBookChannel.getChannelName());
// }
// }
// }
// }
}
}
List<InspectionPointResultVo> filteredList = new ArrayList<>();


+ 1
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/InspectionPointParam.java View File

@ -22,6 +22,7 @@ public class InspectionPointParam {
String alarmLevel;
String alarmType;
String resultType;
String filter;
int pageNum;
int pageSize;
int offset;


+ 1
- 0
inspect-main/inspect-main-task/src/main/java/com/inspect/partrolresult/domain/InspectionPointResultVo.java View File

@ -37,4 +37,5 @@ public class InspectionPointResultVo {
String content;
String resultType;
String valid;
String filter;
}

+ 45
- 31
inspect-main/inspect-main-task/src/main/resources/mapper/task/PatrolResultMapper.xml View File

@ -966,8 +966,8 @@
<resultMap type="com.inspect.partrolresult.domain.InspectionPointResultVo" id="InspectionPointResultMap">
<result property="id" column="id"/>
<!-- <result property="deviceName" column="device_name"/>-->
<result property="patroldeviceCode" column="patrol_device_code"/>
<result property="patroldeviceName" column="patrol_device_name"/>
<result property="patroldeviceCode" column="patroldevice_code"/>
<result property="patroldeviceName" column="patroldevice_name"/>
<result property="taskCode" column="task_code"/>
<result property="taskName" column="task_name"/>
<result property="taskPatrolledId" column="task_patrolled_id"/>
@ -989,42 +989,56 @@
<result property="alarmType" column="alarm_type"/>
<result property="content" column="content"/>
<result property="vaild" column="vaild"/>
<result property="filter" column="filter"/>
<result property="resultType" column="result_type"/>
</resultMap>
<select id="inspectResult" parameterType="com.inspect.partrolresult.domain.InspectionPointParam" resultMap="InspectionPointResultMap">
SELECT pr.line_id id,
pr.task_code task_code,
pr.task_name task_name,
pr.task_patrolled_id task_patrolled_id,
pr.device_id,
pr.device_name,
bd.device_name AS component_name,
bd.device_id AS component_id,
pr.value,
pr.unit,
pr.recognition_type,
pr.time,
pr.file_type,
pr.file_path,
pr.file_path base_file_path,
pr.rectangle,
ra.result_type,
ra.description content,
pr.valid valid
select pr.line_id id,
bec.channel_code patroldevice_code,
bec.channel_name patroldevice_name,
pr.task_code,
pr.task_name,
pr.line_id task_patrolled_id,
bp.patrol_point_name device_name,
bp.patrol_point_id device_id,
bd.device_name main_dev_name,
bd.device_id main_dev_id ,
bdb.device_name component_name,
bdb.device_id component_id ,
ra.res_value value ,
pr.unit unit,
bas.alg_subtype_id recognition_type,
pr.time,
pr.file_type,
ra.res_img_url file_path,
CASE
WHEN ra.image_normal_url_path IS NOT NULL THEN CONCAT('/', ra.image_normal_url_path)
ELSE ra.image_normal_url_path
END base_file_path,
pr.rectangle,
pr.valid valid,
ra.filter filter
FROM patrol_result pr
LEFT JOIN result_analysis ra on pr.line_id = ra.business_id
LEFT JOIN basedata_patrolpoint bp ON pr.device_id = bp.patrol_point_id
LEFT JOIN basedata_device bd ON bp.device_id = bd.device_id
LEFT JOIN basedata_patrolpoint bp on bp.patrol_point_id = pr.device_id
LEFT JOIN patrol_preset_pos bpp ON bp.patrol_point_id = bpp.patrol_point_id
LEFT JOIN basedata_eqpbook_channel bec on bpp.channel_code = bec.channel_code
LEFT JOIN basedata_device bd on bp.main_device_id = bd.device_id
LEFT JOIN result_analysis ra on ra.business_id = pr.line_id
LEFT JOIN basedata_device bdb on bdb.device_id = bp.device_id
LEFT JOIN basedata_alg_subtype bas on ra.alg_type = bas.alg_subtype_code
<where>
<if test="startTime != null ">and pr.time &gt;= CONCAT(#{startTime}, ' 00:00:00')</if>
<if test="endTime != null ">and pr.time &lt;= CONCAT(#{endTime}, ' 23:59:59')</if>
<if test="deviceId != null ">and pr.device_id = #{deviceId}</if>
<if test="taskPatrolledId != null ">and pr.task_patrolled_id = #{taskPatrolledId}</if>
<if test="componentId != null ">and bd.device_id = #{componentId}</if>
<if test="resultType != null ">and ra.result_type = #{resultType}</if>
<if test="startTime != null and startTime != ''"> and pr.time &gt;= CONCAT(#{startTime}, ' 00:00:00') </if>
<if test="endTime != null and endTime != ''"> and pr.time &lt;= CONCAT(#{endTime}, ' 23:59:59') </if>
<if test="patroldeviceCode != null and patroldeviceCode != ''"> and bec.channel_code = #{patroldeviceCode} </if>
<if test="deviceId != null and deviceId != ''"> and bp.patrol_point_id = #{deviceId} </if>
<if test="mainDevId != null and mainDevId != ''"> and bd.device_id = #{mainDevId} </if>
<if test="componentId != null and componentId != ''"> and bdb.device_id = #{componentId} </if>
<if test="taskPatrolledId != null and taskPatrolledId != ''"> and pr.line_id = #{taskPatrolledId} </if>
<if test="filter != null and filter != ''"> and ra.filter = #{filter} </if>
<if test="resultType != null and resultType != ''"> and ra.result_type = #{resultType} and filter = 0 </if>
</where>
order by pr.time desc LIMIT #{pageSize} OFFSET #{offset}
order by pr.time desc LIMIT #{pageSize} OFFSET #{offset}
</select>
<select id="selectPatrolResultListByMainIds" resultMap="PatrolResultResult">


+ 1
- 0
inspect-metadata/src/main/java/com/inspect/metadata/patrolpointmnt/domain/vo/PointLatestResultVo.java View File

@ -31,4 +31,5 @@ public class PointLatestResultVo {
private String baseFilePath;
private String rectangle;
private String valid;
private String filter;
}

+ 36
- 15
inspect-metadata/src/main/resources/mapper/patrolpointmnt/BasedataPatrolPointMapper.xml View File

@ -363,30 +363,51 @@
<result property="baseFilePath" column="base_file_path" />
<result property="rectangle" column="rectangle" />
<result property="valid" column="valid" />
<result property="filter" column="filter" />
</resultMap>
<select id="pointLatestResult" parameterType="PointLatestResultVo"
resultMap="InspectionTaskResultMap">
SELECT bd.device_name main_dev_name,bd.device_id main_dev_id ,bp.patrol_point_name device_name,bp.patrol_point_id device_id,
bec.channel_code patroldevice_code,bec.channel_name patroldevice_name,
latest_pr.task_code,latest_pr.task_name,latest_pr.line_id task_patrolled_id,
bpp.patrol_point_preset_id device_id, bpp.preset_name device_name,
latest_pr.value ,latest_pr.value_unit unit,latest_pr.recognition_type,latest_pr.time,
latest_pr.file_type,latest_pr.file_path,latest_pr.rectangle,latest_pr.valid
-- #bec.*, bpp.*, latest_ra.*,latest_pr.*
FROM basedata_eqpbook_channel bec
LEFT JOIN basedata_patrolpoint_preset bpp ON bec.channel_code = bpp.channel_code
left join basedata_patrolpoint bp on bp.patrol_point_id = bpp.patrol_point_id
left join basedata_device bd on bp.main_device_id = bd.device_id
LEFT JOIN ( SELECT pr.*
select latest_pr.line_id id,
bec.channel_code patroldevice_code,
bec.channel_name patroldevice_name,
latest_pr.task_code,
latest_pr.task_name,
latest_pr.line_id task_patrolled_id,
bp.patrol_point_name device_name,
bp.patrol_point_id device_id,
bd.device_name main_dev_name,
bd.device_id main_dev_id ,
bdb.device_name component_name,
bdb.device_id component_id ,
ra.res_value value ,
latest_pr.unit unit,
bas.alg_subtype_id recognition_type,
latest_pr.time,
latest_pr.file_type,
ra.res_img_url file_path,
CASE
WHEN ra.image_normal_url_path IS NOT NULL THEN CONCAT('/', ra.image_normal_url_path)
ELSE ra.image_normal_url_path
END base_file_path,
latest_pr.rectangle,
latest_pr.valid,
ra.filter
FROM (SELECT pr.*
FROM patrol_result pr
INNER JOIN (
SELECT device_id, MAX(time) AS max_create_time
FROM patrol_result
GROUP BY device_id
) pr2 ON pr.device_id = pr2.device_id AND pr.time = pr2.max_create_time) latest_pr ON latest_pr.device_id = bpp.patrol_point_id
) pr2 ON pr.device_id = pr2.device_id AND pr.time = pr2.max_create_time ) latest_pr
left join basedata_patrolpoint bp on bp.patrol_point_id = latest_pr.device_id
LEFT JOIN patrol_preset_pos bpp ON bp.patrol_point_id = bpp.patrol_point_id
left join basedata_eqpbook_channel bec on bpp.channel_code = bec.channel_code
left join basedata_device bd on bp.main_device_id = bd.device_id
left join result_analysis ra on ra.business_id = latest_pr.line_id
left join basedata_device bdb on bdb.device_id = bp.device_id
left join basedata_alg_subtype bas on ra.alg_type = bas.alg_subtype_code
<where>
bpp.patrol_point_id IS NOT NULL AND latest_pr.line_id IS NOT NULL
<if test="patroldeviceCode != null ">and bpp.channel_code = #{patroldeviceCode}</if>
<if test="patroldeviceCode != null ">and bec.channel_code = #{patroldeviceCode}</if>
</where>
</select>


Loading…
Cancel
Save