增加告警分类修改 优化告警列表查询 优化主动拍照

master
liuguijing 2 years ago
parent e2fb29ed11
commit d03730cf7a

@ -8,7 +8,6 @@ import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.*; import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TermSetService; import com.shxy.xymanager_service.service.TermSetService;
import com.shxy.xymanager_service.service.TerminalChannelService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponse;

@ -33,7 +33,7 @@ public class TerminalAlarmController extends BaseController {
@RequestMapping("/getTerminalAlarmList") @RequestMapping("/getTerminalAlarmList")
@Log(title = "获取告警列表", type = "查询") @Log(title = "获取告警列表", type = "查询")
public ResponseReult<TerminalAlarmListModel> getTerminalAlarmList(@RequestBody @Validated TerminalAlarmSelectVo vo) { public ResponseReult<TerminalAlarmListModel> getTerminalAlarmList(@RequestBody @Validated TerminalAlarmSelectVo vo) {
ServiceBody<TerminalAlarmListModel> serviceBody = terminalAlarmService.getAlarmList(vo); ServiceBody<TerminalAlarmListModel> serviceBody = terminalAlarmService.getTerminalAlarmList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {
@ -69,17 +69,17 @@ public class TerminalAlarmController extends BaseController {
} }
// @ApiOperation(value = "修改告警分类列表", notes = "修改告警分类列表", httpMethod = "POST") @ApiOperation(value = "修改告警分类列表", notes = "修改告警分类列表", httpMethod = "POST")
// @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
// @RequestMapping("/getAlarmTypeList") @RequestMapping("/updateAlarmTypeList")
// @Log(title = "修改告警分类列表", type = "修改") @Log(title = "修改告警分类列表", type = "修改")
// public ResponseReult<TerminalImgAlarmParamsModel> updateAlarmTypeList() { public ResponseReult<String> updateAlarmTypeList(@RequestBody @Validated UpdateTerminalAlarmParamsVo vo) {
// ServiceBody<TerminalImgAlarmParamsModel> serviceBody = terminalAlarmService.getAlarmTypeList(); ServiceBody<String> serviceBody = terminalAlarmService.updateAlarmTypeList(vo);
// if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
// return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
// } else { } else {
// return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg()); return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
// } }
// } }
} }

@ -43,13 +43,12 @@ public class TerminalPhotoController extends BaseController {
} }
} }
@ApiOperation(value = "获取最新图片", notes = "获取最新图片接口", httpMethod = "POST") @ApiOperation(value = "主动拍照", notes = "主动拍照接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getLatestPhoto") @RequestMapping("/getLatestPhoto")
@Log(title = "获取最新图片", type = "查询") @Log(title = "主动拍照", type = "查询")
public ResponseReult<Date> getLatestPhoto(@RequestBody @Validated TerminalPhotoVo vo) { public ResponseReult<Date> getLatestPhoto(@RequestBody @Validated TerminalPhotoVo vo) {
ServiceBody<Date> latestPhoto = terminalPhotoService.getLatestPhoto(vo); ServiceBody<Date> serviceBody = terminalPhotoService.getLatestPhoto(vo);
ServiceBody<Date> serviceBody = latestPhoto;
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {
@ -176,4 +175,17 @@ public class TerminalPhotoController extends BaseController {
} }
@ApiOperation(value = "历史图片", notes = "历史图片接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getHistoryList")
@Log(title = "历史图片", type = "查询")
public ResponseReult<TerminalPhotoSelectListModel> getHistoryList(@RequestBody @Validated TermIdAndChannelIdVo vo) {
ServiceBody<TerminalPhotoSelectListModel> serviceBody = terminalPhotoService.getHistoryList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
} }

@ -0,0 +1,55 @@
package com.shxy.xymanager_admin.test;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mysql.cj.xdevapi.JsonArray;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
public class Testbatch {
private static Connection con;
public static void main(String[] args) throws Exception {
String driver = "com.mysql.jdbc.Driver";
//这里我的数据库是cgjr
String url = "jdbc:mysql://47.96.238.157:3306/xymp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8";
String user = "xymp";
String password = "Xymp@2023";
try {
Class.forName(driver);
con = DriverManager.getConnection(url, user, password);
if (!con.isClosed()) {
System.out.println("数据库连接成功");
}
String sql = "insert into terminal_img_alarms (term_id,channel_id,preset_id,photo_org_id,alarm_time,alarm_info,create_time) values(?,?,?,?,?,?,?)";
PreparedStatement preparedStatement = con.prepareStatement(sql);
Date date = new Date(1686118807);
for (int i = 0; i < 10; i++) {
preparedStatement.setInt(1, 10002);
preparedStatement.setInt(2, 1);
preparedStatement.setInt(3, 255);
preparedStatement.setLong(4, 1962967140);
preparedStatement.setLong(5, 1686118807);
preparedStatement.setString(6, "{info}");
preparedStatement.setDate(7, date);
preparedStatement.addBatch();
}
preparedStatement.executeBatch();
con.commit();
} catch (ClassNotFoundException e) {
System.out.println("数据库驱动没有安装");
} catch (SQLException e) {
System.out.println("数据库连接失败");
} catch (Exception e) {
e.printStackTrace();
} finally {
con.close();
}
}
}

@ -1 +1 @@
org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor #org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor

@ -2,7 +2,7 @@
spring: spring:
datasource: datasource:
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/xymp?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 url: jdbc:mysql://127.0.0.1:3306/xymp?allowMultiQueries=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: root username: root
password: 123456 password: 123456
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource

@ -0,0 +1,26 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
@Data
@ApiModel(value = "装置编号和通道编号对象", description = "装置编号和通道编号对象")
public class TermIdAndChannelIdVo {
@ApiModelProperty(value = "装置编号", example = "123455")
private Integer termId;
@ApiModelProperty(value = "通道编号", example = "123455")
private Integer channelId;
@Min(value = 1, message = "分页位置最小从1开始")
@ApiModelProperty(value = "分页位置从1开始", required = true, example = "1")
private int pageindex;
@Min(value = 1, message = "分页大小最小为1")
@ApiModelProperty(value = "分页大小", required = true, example = "1")
private int pagesize;
}

@ -15,13 +15,13 @@ import java.util.Date;
public class TerminalAlarmSelectVo { public class TerminalAlarmSelectVo {
@ApiModelProperty(value = "电压编号", example = "123455") @ApiModelProperty(value = "电压编号", example = "123455")
private Integer dyid; private Integer dyId;
@ApiModelProperty(value = "装置编号", example = "123455") @ApiModelProperty(value = "装置编号", example = "123455")
private Integer lineid; private Integer lineId;
@ApiModelProperty(value = "杆塔编号", example = "123455") @ApiModelProperty(value = "杆塔编号", example = "123455")
private Integer towerid; private Integer towerId;
@ApiModelProperty(value = "告警类型", example = "123455") @ApiModelProperty(value = "告警类型", example = "123455")
private Integer label; private Integer label;

@ -5,15 +5,17 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.List;
@Data @Data
@ApiModel(value = "最近图片请求参数", description = "最近图片请求参数") @ApiModel(value = "最近图片请求参数", description = "最近图片请求参数")
public class TerminalPhotoVo { public class TerminalPhotoVo {
// @NotNull(message = "装置列表不能缺少")
// @ApiModelProperty(value = "装置通道编号列表", example = "123455")
// private String cmdid;
@NotNull(message = "装置列表不能缺少") @NotNull(message = "装置编号")
@ApiModelProperty(value = "装置通道编号列表", example = "123455") @ApiModelProperty(value = "装置编号", example = "123455")
private String cmdid; private Integer termId;
@NotNull(message = "通道号") @NotNull(message = "通道号")
@ApiModelProperty(value = "通道号", example = "123455") @ApiModelProperty(value = "通道号", example = "123455")

@ -0,0 +1,31 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
@ApiModel(value = "修改告警类型", description = "修改告警类型信息")
public class UpdateTerminalAlarmParamsVo implements Serializable {
@ApiModelProperty(value = "修改告警类型列表", example = "[]")
private List<AlarmParamBean> list;
@Data
public static class AlarmParamBean {
@ApiModelProperty(value = "编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "告警编号", example = "123456")
private Integer label;
@ApiModelProperty(value = "告警名称", example = "123456")
private String name;
@ApiModelProperty(value = "可信度", example = "123456")
private Float prob;
}
private static final long serialVersionUID = 1L;
}

@ -1,10 +1,13 @@
package com.shxy.xymanager_dao.dao; package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.TerminalImgAlarmParams; import com.shxy.xymanager_common.entity.TerminalImgAlarmParams;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List; import java.util.List;
public interface TerminalImgAlarmParamsDao { public interface TerminalImgAlarmParamsDao {
int deleteByPrimaryKey(Integer id); int deleteByPrimaryKey(Integer id);
int insert(TerminalImgAlarmParams record); int insert(TerminalImgAlarmParams record);
@ -17,5 +20,7 @@ public interface TerminalImgAlarmParamsDao {
int updateByPrimaryKeySelective(TerminalImgAlarmParams record); int updateByPrimaryKeySelective(TerminalImgAlarmParams record);
int updateList(@Param("list") List<TerminalImgAlarmParams> record, @Param("updateTime") Date updateTime);
int updateByPrimaryKey(TerminalImgAlarmParams record); int updateByPrimaryKey(TerminalImgAlarmParams record);
} }

@ -1,11 +1,11 @@
package com.shxy.xymanager_dao.dao; package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.dto.TerminalImgAlarmsDto; import com.shxy.xymanager_common.dto.TerminalImgAlarmsDto;
import com.shxy.xymanager_common.entity.TerminalImgAlarmParams;
import com.shxy.xymanager_common.entity.TerminalImgAlarms; import com.shxy.xymanager_common.entity.TerminalImgAlarms;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.Date;
import java.util.List; import java.util.List;
public interface TerminalImgAlarmsDao { public interface TerminalImgAlarmsDao {
@ -17,7 +17,7 @@ public interface TerminalImgAlarmsDao {
TerminalImgAlarms selectByPrimaryKey(Long id); TerminalImgAlarms selectByPrimaryKey(Long id);
List<TerminalImgAlarmsDto> selectAlarmsDetails(@Param("terminalidlist") List<Integer> termidlist, @Param("label") Integer label,@Param("prob") Float prob, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime); List<TerminalImgAlarmsDto> selectAlarmsDetails(@Param("terminalidlist") List<Integer> termidlist, @Param("labellist") List<TerminalImgAlarmParams> labellist, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
int updateByPrimaryKeySelective(TerminalImgAlarms record); int updateByPrimaryKeySelective(TerminalImgAlarms record);

@ -33,13 +33,14 @@ public interface TerminalPhotoDao {
TerminalPhoto getLatestPhoto(@Param("termId") Integer termId); TerminalPhoto getLatestPhoto(@Param("termId") Integer termId);
List<TerminalPhoto> getLatestPhotoByTermidAndChannelid(@Param("termId") Integer termId,@Param("channelId") Integer channelId);
List<PhotoAndLineAndChannelDto> selectPhotos(); List<PhotoAndLineAndChannelDto> selectPhotos();
List<TermAndChannelLatestPhotoMapperDto> selectTermAndChannelLatestPhotoList(@Param("list") List<Integer> list); List<TermAndChannelLatestPhotoMapperDto> selectTermAndChannelLatestPhotoList(@Param("list") List<Integer> list);
List<TerminalPhoto> selectPhotoListForOpen(@Param("termId") Integer terminalid,@Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime); List<TerminalPhoto> selectPhotoListForOpen(@Param("termId") Integer terminalid,@Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
List<TerminalPhotoScheduleDto> selectPhotoSchedule(TerminalPhotoTimeVo vo); List<TerminalPhotoScheduleDto> selectPhotoSchedule(TerminalPhotoTimeVo vo);
PhotoParamsDto selectPhotoParams(ReturnedPhotoParamsVo vo); PhotoParamsDto selectPhotoParams(ReturnedPhotoParamsVo vo);

@ -1,33 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.shxy.xymanager_dao.dao.TerminalImgAlarmParamsDao"> <mapper namespace="com.shxy.xymanager_dao.dao.TerminalImgAlarmParamsDao">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalImgAlarmParams"> <resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalImgAlarmParams">
<id column="id" jdbcType="INTEGER" property="id" /> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="label" jdbcType="INTEGER" property="label" /> <result column="label" jdbcType="INTEGER" property="label"/>
<result column="name" jdbcType="VARCHAR" property="name" /> <result column="name" jdbcType="VARCHAR" property="name"/>
<result column="prob" jdbcType="REAL" property="prob" /> <result column="prob" jdbcType="REAL" property="prob"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" /> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, label, name, prob, create_time, update_time id, label, name, prob, create_time, update_time
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from terminal_img_alarm_params from terminal_img_alarm_params
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</select> </select>
<select id="selectAll" resultMap="BaseResultMap"> <select id="selectAll" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from terminal_img_alarm_params from terminal_img_alarm_params
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from terminal_img_alarm_params delete from terminal_img_alarm_params
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</delete> </delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams"> <insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams">
insert into terminal_img_alarm_params (id, label, name, insert into terminal_img_alarm_params (id, label, name,
prob, create_time, update_time prob, create_time, update_time
) )
@ -35,71 +35,71 @@
#{prob,jdbcType=REAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} #{prob,jdbcType=REAL}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams"> <insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams">
insert into terminal_img_alarm_params insert into terminal_img_alarm_params
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="label != null"> <if test="label != null">
label, label,
</if> </if>
<if test="name != null"> <if test="name != null">
name, name,
</if> </if>
<if test="prob != null"> <if test="prob != null">
prob, prob,
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time, update_time,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
#{id,jdbcType=INTEGER}, #{id,jdbcType=INTEGER},
</if> </if>
<if test="label != null"> <if test="label != null">
#{label,jdbcType=INTEGER}, #{label,jdbcType=INTEGER},
</if> </if>
<if test="name != null"> <if test="name != null">
#{name,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
</if> </if>
<if test="prob != null"> <if test="prob != null">
#{prob,jdbcType=REAL}, #{prob,jdbcType=REAL},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
#{updateTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams"> <update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams">
update terminal_img_alarm_params update terminal_img_alarm_params
<set> <set>
<if test="label != null"> <if test="label != null">
label = #{label,jdbcType=INTEGER}, label = #{label,jdbcType=INTEGER},
</if> </if>
<if test="name != null"> <if test="name != null">
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
</if> </if>
<if test="prob != null"> <if test="prob != null">
prob = #{prob,jdbcType=REAL}, prob = #{prob,jdbcType=REAL},
</if> </if>
<if test="createTime != null"> <if test="createTime != null">
create_time = #{createTime,jdbcType=TIMESTAMP}, create_time = #{createTime,jdbcType=TIMESTAMP},
</if> </if>
<if test="updateTime != null"> <if test="updateTime != null">
update_time = #{updateTime,jdbcType=TIMESTAMP}, update_time = #{updateTime,jdbcType=TIMESTAMP},
</if> </if>
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams"> <update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmParams">
update terminal_img_alarm_params update terminal_img_alarm_params
set label = #{label,jdbcType=INTEGER}, set label = #{label,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR}, name = #{name,jdbcType=VARCHAR},
@ -108,4 +108,13 @@
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateList">
<foreach collection="list" index="index" item="item" separator=";">
update terminal_img_alarm_params
set
prob = #{item.prob}
where id = #{item.id}
</foreach>
</update>
</mapper> </mapper>

@ -67,11 +67,18 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="label != null"> <if test="labellist != null and labellist.size > 0">
and label = #{label} and
</if> <foreach collection="labellist" item="item" index="index" separator="or">
<if test="prob != null and prob lte 100"> (
and prob >= #{prob} <if test="item.label != null">
label = #{item.label}
</if>
<if test="item.prob != null and item.prob lte 100">
and prob >= #{item.prob}
</if>
)
</foreach>
</if> </if>
order by a.alarm_time desc order by a.alarm_time desc
</select> </select>

@ -204,6 +204,14 @@
order by recv_time desc limit 1 order by recv_time desc limit 1
</select> </select>
<select id="getLatestPhotoByTermidAndChannelid" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_photos
where term_id = #{termId} and channel_id = #{channelId}
order by recv_time desc
</select>
<select id="selectPhotoListForOpen" resultMap="BaseResultMap"> <select id="selectPhotoListForOpen" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>

@ -40,10 +40,10 @@
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
</exclusion> </exclusion>
<exclusion> <!-- <exclusion>-->
<groupId>org.springframework.boot</groupId> <!-- <groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot-starter-tomcat</artifactId> <!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
</exclusion> <!-- </exclusion>-->
</exclusions> </exclusions>
</dependency> </dependency>

@ -51,6 +51,7 @@ public class XyCache {
termchannelMap.clear(); termchannelMap.clear();
termchannelMapMap.clear(); termchannelMapMap.clear();
alarmParamMap.clear(); alarmParamMap.clear();
List<LineAndDyNameDto> lineAndDyNameDtos = linesDao.selectAll(CommonStatus.EFFECTIVE.value()); List<LineAndDyNameDto> lineAndDyNameDtos = linesDao.selectAll(CommonStatus.EFFECTIVE.value());
for (LineAndDyNameDto lineitem : lineAndDyNameDtos) { for (LineAndDyNameDto lineitem : lineAndDyNameDtos) {
lineMap.put(lineitem.getId(), lineitem); lineMap.put(lineitem.getId(), lineitem);

@ -14,6 +14,7 @@ import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.util.MyDateUtils; import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.vo.TerminalAlarmIdVo; import com.shxy.xymanager_common.vo.TerminalAlarmIdVo;
import com.shxy.xymanager_common.vo.TerminalAlarmSelectVo; import com.shxy.xymanager_common.vo.TerminalAlarmSelectVo;
import com.shxy.xymanager_common.vo.UpdateTerminalAlarmParamsVo;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.cache.XyCache; import com.shxy.xymanager_service.cache.XyCache;
import com.shxy.xymanager_service.service.TerminalAlarmService; import com.shxy.xymanager_service.service.TerminalAlarmService;
@ -63,23 +64,22 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
private String videoaddress; private String videoaddress;
@Override @Override
public ServiceBody<TerminalAlarmListModel> getAlarmList(TerminalAlarmSelectVo vo) { public ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(TerminalAlarmSelectVo vo) {
TerminalAlarmListModel model = new TerminalAlarmListModel(); TerminalAlarmListModel model = new TerminalAlarmListModel();
Integer dyid = vo.getDyid(); Integer dyid = vo.getDyId();
Integer lineid = vo.getLineid(); Integer lineid = vo.getLineId();
Integer towerid = vo.getTowerid(); Integer towerid = vo.getTowerId();
Integer label = vo.getLabel(); Integer label = vo.getLabel();
Float prob = null; List<TerminalImgAlarmParams> labellist = new ArrayList<>();
if (label !=null && label == -1) { Map<Integer, TerminalImgAlarmParams> alarmParamMap = XyCache.alarmParamMap;
label = null; if (label != null && label == -1) {
prob = null; alarmParamMap.forEach((key, value) -> {
labellist.add(value);
});
} else { } else {
Map<Integer, TerminalImgAlarmParams> alarmParamMap = XyCache.alarmParamMap;
TerminalImgAlarmParams terminalImgAlarmParams = alarmParamMap.get(label); TerminalImgAlarmParams terminalImgAlarmParams = alarmParamMap.get(label);
if (terminalImgAlarmParams != null) { labellist.add(terminalImgAlarmParams);
prob = terminalImgAlarmParams.getProb();
}
} }
Date starttime = vo.getStarttime(); Date starttime = vo.getStarttime();
@ -93,7 +93,7 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
List<Integer> termidlist = new ArrayList<>(); List<Integer> termidlist = new ArrayList<>();
if (dyid == null || dyid.intValue() == 0) { if (dyid == null || dyid.intValue() == 0) {
PageUtils.SetPage(pageindex, pagesize); PageUtils.SetPage(pageindex, pagesize);
list = terminalImgAlarmsDao.selectAlarmsDetails(null, label, prob, BigInteger.valueOf(start), BigInteger.valueOf(end)); list = terminalImgAlarmsDao.selectAlarmsDetails(null, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end));
} else { } else {
if (lineid == null || lineid.intValue() == 0) { if (lineid == null || lineid.intValue() == 0) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, CommonStatus.EFFECTIVE.value()); dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, CommonStatus.EFFECTIVE.value());
@ -114,7 +114,7 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
} }
} }
PageUtils.SetPage(pageindex, pagesize); PageUtils.SetPage(pageindex, pagesize);
list = terminalImgAlarmsDao.selectAlarmsDetails(termidlist, label, prob, BigInteger.valueOf(start), BigInteger.valueOf(end)); list = terminalImgAlarmsDao.selectAlarmsDetails(termidlist, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end));
} }
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
@ -264,26 +264,38 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
} }
// /** /**
// * 获取告警分类列表 *
// * *
// * @return * @return
// */ */
// @Override @Override
// public ServiceBody<TerminalImgAlarmParamsModel> updateAlarmTypeList() { public ServiceBody<String> updateAlarmTypeList(UpdateTerminalAlarmParamsVo vo) {
// TerminalImgAlarmParamsModel model = new TerminalImgAlarmParamsModel(); List<UpdateTerminalAlarmParamsVo.AlarmParamBean> list = vo.getList();
// ArrayList<TerminalImgAlarmParamsModel.AlarmBean> list = new ArrayList<>(); if (CollectionUtil.isEmpty(list)) {
// Map<Integer, TerminalImgAlarmParams> beans = XyCache.alarmParamMap; return Asserts.error("数据不能为空");
// beans.forEach((key, value) -> { }
// TerminalImgAlarmParamsModel.AlarmBean alarmBean = new TerminalImgAlarmParamsModel.AlarmBean(); ArrayList<TerminalImgAlarmParams> record = new ArrayList<>();
// alarmBean.setId(value.getId()); for (UpdateTerminalAlarmParamsVo.AlarmParamBean item : list) {
// alarmBean.setLabel(value.getLabel()); TerminalImgAlarmParams params = new TerminalImgAlarmParams();
// alarmBean.setName(value.getName()); params.setId(item.getId());
// alarmBean.setProb(value.getProb()); params.setLabel(item.getLabel());
// list.add(alarmBean); params.setProb(item.getProb());
// }); params.setName(item.getName());
// model.setList(list); record.add(params);
// return Asserts.success(model); }
// } int i = terminalImgAlarmParamsDao.updateList(record, new Date());
Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<>();
List<TerminalImgAlarmParams> terminalImgAlarmParams = terminalImgAlarmParamsDao.selectAll();
for (TerminalImgAlarmParams item : terminalImgAlarmParams) {
alarmParamMap.put(item.getLabel(), item);
}
XyCache.alarmParamMap = alarmParamMap;
if (i != 0) {
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");
}
}
} }

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -32,6 +33,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigInteger; import java.math.BigInteger;
import java.util.*; import java.util.*;
@ -351,9 +354,17 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Override @Override
public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) { public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
// String cmd = Constants.CMD + "capture --cmdid=" + vo.getCmdid() + " --channel=" + vo.getChannel() + " --preset=255 --type=" + vo.getCaptureType(); Integer termId = vo.getTermId();
String cmd = CmaUtil.takePic(vo.getCmdid(), vo.getChannel(), vo.getCaptureType()); Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
ProcessExecUtils.exec(cmd); Terminals terminals = terminalMap.get(termId);
String cmdid = null;
if (terminals != null) {
cmdid = terminals.getCmdid();
}
if (StrUtil.isNotEmpty(cmdid)) {
String cmd = CmaUtil.takePic(cmdid, vo.getChannel(), vo.getCaptureType());
ProcessExecUtils.exec(cmd);
}
return Asserts.success(now); return Asserts.success(now);
} }
@ -374,7 +385,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
} else { } else {
hasNew = false; hasNew = false;
} }
return Asserts.success(hasNew); return Asserts.success(hasNew);
} }
@ -588,5 +598,72 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
return Asserts.success(model); return Asserts.success(model);
} }
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<TerminalPhotoSelectListModel> getHistoryList(TermIdAndChannelIdVo vo) {
TerminalPhotoSelectListModel model = new TerminalPhotoSelectListModel();
List<TerminalPhotoSelectListModel.PhotoBean> beans = new ArrayList<>();
Integer termId = vo.getTermId();
Integer channelId = vo.getChannelId();
int pagesize = vo.getPagesize();
int pageindex = vo.getPageindex();
PageUtils.SetPage(pageindex, pagesize);
List<TerminalPhoto> list = terminalPhotoDao.getLatestPhotoByTermidAndChannelid(termId, channelId);
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setList(new ArrayList<>());
} else {
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
for (TerminalPhoto item : list) {
TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean();
photoBean.setTermid(item.getTermId());
Terminals terminals = terminalMap.get(item.getTermId());
if (!BeanUtil.isEmpty(terminals)) {
photoBean.setDisplayname(terminals.getDisplayName());
photoBean.setLineid(terminals.getLineid());
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName());
photoBean.setChannelid(item.getChannelId());
photoBean.setCmdid(terminals.getCmdid());
photoBean.setChannnelname(termchannelMap.get(item.getChannelId()).getChannelName());
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
photoBean.setMediaType(item.getMediaType());
photoBean.setOrginalid(item.getOrginalId());
if (item.getMediaType() == 0) {
photoBean.setPath(photoaddress + item.getPath());
} else {
photoBean.setPath(videoaddress + item.getPath());
}
photoBean.setPresetId(item.getPresetId());
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime));
long rectime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
photoBean.setRecvTime(MyDateUtils.date(rectime));
beans.add(photoBean);
}
}
model.setList(beans);
}
PageInfo pageData = PageUtils.getPageData(list);
int currentpage = pageData.getPageNum();
model.setCurrentpage(currentpage);
long total = pageData.getTotal();
model.setTotal(total);
int pageSize = pageData.getPageSize();
model.setPagesize(pageSize);
int pages = pageData.getPages();
model.setTotalpage(pages);
return Asserts.success(model);
}
} }

@ -16,7 +16,7 @@ public interface TerminalAlarmService {
* *
* @return * @return
*/ */
ServiceBody<TerminalAlarmListModel> getAlarmList(TerminalAlarmSelectVo vo); ServiceBody<TerminalAlarmListModel> getTerminalAlarmList(TerminalAlarmSelectVo vo);
/** /**
* *
@ -32,4 +32,11 @@ public interface TerminalAlarmService {
*/ */
ServiceBody<TerminalImgAlarmParamsModel> getAlarmTypeList(); ServiceBody<TerminalImgAlarmParamsModel> getAlarmTypeList();
/**
*
*
* @return
*/
ServiceBody<String> updateAlarmTypeList(UpdateTerminalAlarmParamsVo vo);
} }

@ -73,11 +73,15 @@ public interface TerminalPhotoService {
ServiceBody<TerminalPhotosParamsModel> getLastedPhotoQueryParam(ReturnedPhotoParamsVo vo); ServiceBody<TerminalPhotosParamsModel> getLastedPhotoQueryParam(ReturnedPhotoParamsVo vo);
ServiceBody<TerminalScheduleRuleTimeListModel> selectPhotoTime(TerminalReqPhotoTimeVo vo); ServiceBody<TerminalScheduleRuleTimeListModel> selectPhotoTime(TerminalReqPhotoTimeVo vo);
ServiceBody<GetModel> selectPhotoTimeGet(TerminalPhotoTimeGetVo vo); ServiceBody<GetModel> selectPhotoTimeGet(TerminalPhotoTimeGetVo vo);
/**
*
* @param vo
* @return
*/
ServiceBody<TerminalPhotoSelectListModel> getHistoryList(TermIdAndChannelIdVo vo);
} }

Loading…
Cancel
Save