Browse Source

/*无人机红外框架流程闭环。*/

master
htjcAdmin 8 months ago
parent
commit
58f247a92a
5 changed files with 218 additions and 21 deletions
  1. +71
    -0
      src/main/java/com/inspect/simulator/domain/result/PatrolPresetPos.java
  2. +12
    -0
      src/main/java/com/inspect/simulator/mapper/PatrolPresetPosMapper.java
  3. +34
    -15
      src/main/java/com/inspect/simulator/service/impl/AlgorithmServiceImpl.java
  4. +95
    -0
      src/main/resources/mapper/PatrolPresetPosMapper.xml
  5. +6
    -6
      src/main/resources/mapper/PatrolResultMapper.xml

+ 71
- 0
src/main/java/com/inspect/simulator/domain/result/PatrolPresetPos.java View File

@ -0,0 +1,71 @@
package com.inspect.simulator.domain.result;
import com.inspect.simulator.domain.BaseEntity;
import lombok.*;
import java.util.Objects;
@Getter
@Setter
public class PatrolPresetPos extends BaseEntity {
private static final long serialVersionUID = 1L;
private String presetPosId;
private String presetPosCode;
private String presetPosName;
private Long patrolPointId;
private String channelId;
private String coordinateType;
private Long stopTime;
private String channelImg;
private String description;
private String isEnable;
private String algSubtypeCode;
private String eqpBookId;
private String channelCode;
private String channelType;
private String patrolDeviceCode;
private String stdParolPointId;
private String deviceId;
private String patrolDeviceName;
private String videoNvrCode;
private String channelContent;
@Override
public boolean equals(Object object) {
if (this == object) return true;
if (object == null || getClass() != object.getClass()) return false;
PatrolPresetPos that = (PatrolPresetPos) object;
return Objects.equals(presetPosId, that.presetPosId) && Objects.equals(presetPosCode, that.presetPosCode) && Objects.equals(presetPosName, that.presetPosName) && Objects.equals(patrolPointId, that.patrolPointId) && Objects.equals(channelId, that.channelId) && Objects.equals(coordinateType, that.coordinateType) && Objects.equals(stopTime, that.stopTime) && Objects.equals(channelImg, that.channelImg) && Objects.equals(description, that.description) && Objects.equals(isEnable, that.isEnable) && Objects.equals(algSubtypeCode, that.algSubtypeCode) && Objects.equals(eqpBookId, that.eqpBookId) && Objects.equals(channelCode, that.channelCode) && Objects.equals(channelType, that.channelType) && Objects.equals(patrolDeviceCode, that.patrolDeviceCode) && Objects.equals(stdParolPointId, that.stdParolPointId) && Objects.equals(deviceId, that.deviceId) && Objects.equals(patrolDeviceName, that.patrolDeviceName) && Objects.equals(videoNvrCode, that.videoNvrCode) && Objects.equals(channelContent, that.channelContent);
}
@Override
public int hashCode() {
return Objects.hash(presetPosId, presetPosCode, presetPosName, patrolPointId, channelId, coordinateType, stopTime, channelImg, description, isEnable, algSubtypeCode, eqpBookId, channelCode, channelType, patrolDeviceCode, stdParolPointId, deviceId, patrolDeviceName, videoNvrCode, channelContent);
}
@Override
public String toString() {
return "PatrolPresetPos{" +
"presetPosId='" + presetPosId + '\'' +
", presetPosCode='" + presetPosCode + '\'' +
", presetPosName='" + presetPosName + '\'' +
", patrolPointId=" + patrolPointId +
", channelId='" + channelId + '\'' +
", coordinateType='" + coordinateType + '\'' +
", stopTime=" + stopTime +
", channelImg='" + channelImg + '\'' +
", description='" + description + '\'' +
", isEnable='" + isEnable + '\'' +
", algSubtypeCode='" + algSubtypeCode + '\'' +
", eqpBookId='" + eqpBookId + '\'' +
", channelCode='" + channelCode + '\'' +
", channelType='" + channelType + '\'' +
", patrolDeviceCode='" + patrolDeviceCode + '\'' +
", stdParolPointId='" + stdParolPointId + '\'' +
", deviceId='" + deviceId + '\'' +
", patrolDeviceName='" + patrolDeviceName + '\'' +
", videoNvrCode='" + videoNvrCode + '\'' +
", channelContent='" + channelContent + '\'' +
'}';
}
}

+ 12
- 0
src/main/java/com/inspect/simulator/mapper/PatrolPresetPosMapper.java View File

@ -0,0 +1,12 @@
package com.inspect.simulator.mapper;
import com.inspect.simulator.domain.result.PatrolPresetPos;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface PatrolPresetPosMapper {
List<PatrolPresetPos> selectPatrolPresetPosByPatrolPointId(String patrolPointId);
}

+ 34
- 15
src/main/java/com/inspect/simulator/service/impl/AlgorithmServiceImpl.java View File

@ -8,6 +8,8 @@ import com.inspect.simulator.domain.algorithm.in.AnalyseRequest;
import com.inspect.simulator.domain.algorithm.out.AnalyseResItem;
import com.inspect.simulator.domain.algorithm.out.AnalyseResPoint;
import com.inspect.simulator.domain.algorithm.out.AnalyseResult;
import com.inspect.simulator.domain.result.PatrolPresetPos;
import com.inspect.simulator.mapper.PatrolPresetPosMapper;
import com.inspect.simulator.service.AlgorithmService;
import com.inspect.simulator.service.remote.AnalysisRemoteService;
import com.inspect.simulator.utils.HttpClientUtils;
@ -33,6 +35,9 @@ public class AlgorithmServiceImpl implements AlgorithmService {
@Resource
private AnalysisRemoteService analysisRemoteService;
@Resource
private PatrolPresetPosMapper patrolPresetPosMapper;
@Override
public String filterPicAnalyse(String analyseRequestStr) {
log.info(Color.MAGENTA + "[FILTER] filterPicAnalyse: analyseRequestStr={}" + Color.END, analyseRequestStr);
@ -126,21 +131,6 @@ public class AlgorithmServiceImpl implements AlgorithmService {
return "{\"code\":\"200\"}";
}
@Override
public String bigModelPicAnalyseRetNotify(final String picAnalyseResult) {
AnalyseResult analyseResult = new Gson().fromJson(picAnalyseResult, AnalyseResult.class);
log.info(Color.MAGENTA + "[BIG MODEL] bigModelPicAnalyseRetNotify: picAnalyseResultStr={}, picAnalyseResult: {}" + Color.END, picAnalyseResult, analyseResult);
try {
Call<Object> call = analysisRemoteService.picAnalyseRetNotify(analyseResult);
Response<Object> response = call.execute();
Object result = response.body();
System.out.println("result: " + result);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
@Override
public String infraredPicAnalyse(String analyseRequestStr) {
log.info(Color.MAGENTA + "[INFRARED] irPicAnalyse: analyseRequestStr={}" + Color.END, analyseRequestStr);
@ -166,6 +156,20 @@ public class AlgorithmServiceImpl implements AlgorithmService {
if (typeList != null && typeList.length != 0) {
algType = typeList[0];
}
final String patrolPointId = analyseReqItem.getObjectId();
// 根据patrol_point_id查询数据表patrol_preset_pos得到channel_id,根据channel_id查询数据表basedata_eqpbook_channel得到channel_content
List<PatrolPresetPos> patrolPresetPosList = patrolPresetPosMapper.selectPatrolPresetPosByPatrolPointId(patrolPointId);
if(patrolPresetPosList == null || patrolPresetPosList.isEmpty()) {
log.error("[INFRARED] irPicAnalyse: patrolPresetPosList empty!");
return "{\"code\":\"203\"}";
}
PatrolPresetPos patrolPresetPos = patrolPresetPosList.get(0);
final String channelContent = patrolPresetPos.getChannelContent();
log.info(Color.MAGENTA + "[INFRARED] irPicAnalyse: channelContent={}" + Color.END, channelContent);
// 调用红外算法
final String feedBackHostIp = analyseRequest.getRequestHostIp();
final String feedBackPort = analyseRequest.getRequestHostPort();
final String feedbackUrl = "http://" + feedBackHostIp + ":" + feedBackPort + "/simu/bigModel/picAnalyseRetNotify";
@ -201,4 +205,19 @@ public class AlgorithmServiceImpl implements AlgorithmService {
return "{\"code\":\"200\"}";
}
@Override
public String bigModelPicAnalyseRetNotify(final String picAnalyseResult) {
AnalyseResult analyseResult = new Gson().fromJson(picAnalyseResult, AnalyseResult.class);
log.info(Color.MAGENTA + "[BIG MODEL] bigModelPicAnalyseRetNotify: picAnalyseResultStr={}, picAnalyseResult: {}" + Color.END, picAnalyseResult, analyseResult);
try {
Call<Object> call = analysisRemoteService.picAnalyseRetNotify(analyseResult);
Response<Object> response = call.execute();
Object result = response.body();
System.out.println("result: " + result);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
}

+ 95
- 0
src/main/resources/mapper/PatrolPresetPosMapper.xml View File

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.inspect.simulator.mapper.PatrolPresetPosMapper">
<resultMap type="com.inspect.simulator.domain.result.PatrolPresetPos" id="PatrolPresetPosResult">
<result property="presetPosId" column="preset_pos_id"/>
<result property="presetPosCode" column="preset_pos_code"/>
<result property="presetPosName" column="preset_pos_name"/>
<result property="patrolPointId" column="patrol_point_id"/>
<result property="channelId" column="channel_id"/>
<result property="coordinateType" column="coordinate_type"/>
<result property="stopTime" column="stop_time"/>
<result property="channelImg" column="channel_img"/>
<result property="description" column="description"/>
<result property="isEnable" column="is_enable"/>
<result property="createTime" column="create_time"/>
<result property="algSubtypeCode" column="alg_subtype_code"/>
<result property="eqpBookId" column="eqp_book_id"/>
<result property="channelCode" column="channel_code"/>
<result property="channelType" column="channel_type"/>
<result property="channelContent" column="channel_content"/>
<result property="patrolDeviceName" column="patrol_device_name"/>
<result property="patrolDeviceCode" column="patrol_device_code"/>
<result property="videoNvrCode" column="video_nvr_code"/>
</resultMap>
<sql id="selectPatrolPresetPosVo">
select preset_pos_id,
preset_pos_code,
preset_pos_name,
patrol_point_id,
channel_id,
coordinate_type,
stop_time,
channel_img,
description,
is_enable,
create_time,
alg_subtype_code,
eqp_book_id,
channel_code,
channel_type,
patrol_device_code,
video_nvr_code
from patrol_preset_pos
</sql>
<select id="selectPatrolPresetPosList" parameterType="com.inspect.simulator.domain.result.PatrolPresetPos" resultMap="PatrolPresetPosResult">
<include refid="selectPatrolPresetPosVo"/>
<where>
<if test="presetPosCode != null and presetPosCode != ''">and preset_pos_code = #{presetPosCode}</if>
<if test="presetPosName != null and presetPosName != ''">and preset_pos_name like concat('%',
#{presetPosName}, '%')
</if>
<if test="patrolPointId != null ">and patrol_point_id = #{patrolPointId}</if>
<if test="channelId != null and channelId != ''">and channel_id = #{channelId}</if>
<if test="coordinateType != null and coordinateType != ''">and coordinate_type = #{coordinateType}</if>
<if test="stopTime != null ">and stop_time = #{stopTime}</if>
<if test="channelImg != null and channelImg != ''">and channel_img = #{channelImg}</if>
<if test="description != null and description != ''">and description = #{description}</if>
<if test="isEnable != null and isEnable != ''">and is_enable = #{isEnable}</if>
<if test="patrolDeviceCode != null and patrolDeviceCode != ''">and patrol_device_code = #{patrolDeviceCode}</if>
<if test="channelCode != null and channelCode != ''">and channel_code = #{channelCode}</if>
<if test="videoNvrCode != null and videoNvrCode != ''">and video_nvr_code = #{videoNvrCode}</if>
</where>
</select>
<select id="selectPatrolPresetPosListByIds" parameterType="String" resultMap="PatrolPresetPosResult">
<include refid="selectPatrolPresetPosVo"/>
where preset_pos_id in
<foreach item="presetPosId" collection="array" open="(" separator="," close=")">
#{presetPosId}
</foreach>
</select>
<select id="selectPatrolPresetPosByPresetPosId" parameterType="String" resultMap="PatrolPresetPosResult">
<include refid="selectPatrolPresetPosVo"/>
where preset_pos_id = #{presetPosId}
</select>
<select id="selectPatrolPresetPosByPatrolPointId" parameterType="String" resultMap="PatrolPresetPosResult">
select a.preset_pos_id,
a.preset_pos_name,
a.alg_subtype_code,
a.eqp_book_id,
a.channel_code,
a.channel_type,
a.channel_img,
c.channel_name patrol_device_name,
c.channel_content channel_content
from patrol_preset_pos a
left join basedata_eqpbook_channel c on c.channel_id = a.channel_id
where a.patrol_point_id = #{patrolPointId}
</select>
</mapper>

+ 6
- 6
src/main/resources/mapper/PatrolResultMapper.xml View File

@ -6,8 +6,8 @@
<resultMap type="com.inspect.simulator.domain.result.PatrolResult" id="PatrolResultResult">
<result property="lineId" column="line_id"/>
<result property="patrolDeviceName" column="patroldevice_name"/>
<result property="patrolDeviceCode" column="patroldevice_code"/>
<result property="patrolDeviceName" column="patrol_device_name"/>
<result property="patrolDeviceCode" column="patrol_device_code"/>
<result property="taskName" column="task_name"/>
<result property="taskCode" column="task_code"/>
<result property="deviceName" column="device_name"/>
@ -330,7 +330,7 @@
<result property="presetPosCode" column="preset_pos_code"/>
<result property="presetPosName" column="preset_pos_name"/>
<result property="eqpBookId" column="eqp_book_id"/>
<result property="patrolDeviceCode" column="patroldevice_code"/>
<result property="patrolDeviceCode" column="patrol_device_code"/>
<result property="patrolPointId" column="patrol_point_id"/>
<result property="channelId" column="channel_id"/>
<result property="channelCode" column="channel_code"/>
@ -464,7 +464,7 @@
<resultMap type="com.inspect.simulator.domain.result.BasePointAreaInfo" id="BasePointAreaInfo">
<result property="patrolPointId" column="patrol_point_id"/>
<result property="patrolPointName" column="patrolpoint_name"/>
<result property="patrolPointName" column="patrol_point_name"/>
<result property="deviceName" column="device_name"/>
<result property="mainName" column="main_name"/>
<result property="jgName" column="jg_name"/>
@ -629,8 +629,8 @@
<resultMap type="com.inspect.simulator.domain.result.ResultValue" id="ResultValue">
<result property="areaName" column="area_name"/>
<result property="deviceName" column="device_name"/>
<result property="patrolDeviceName" column="patroldevice_name"/>
<result property="patrolPointName" column="patrolpoint_name"/>
<result property="patrolDeviceName" column="patrol_device_name"/>
<result property="patrolPointName" column="patrol_point_name"/>
<result property="value" column="value"/>
<result property="lineId" column="line_id"/>
<result property="createTime" column="create_time"/>


Loading…
Cancel
Save