图片告警 历史图片bug修改 图片查询流程优化

master
liuguijing 2 years ago
parent 8d84c257cc
commit c7be6bcb69

@ -8,7 +8,6 @@ import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalAlarmService;
import com.shxy.xymanager_service.service.TerminalPhotoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
@ -20,8 +19,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
@Api(value = "告警接口", tags = "告警接口相关")
@RestController
@ -35,7 +32,7 @@ public class TerminalAlarmController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getTerminalAlarmList")
@Log(title = "获取告警列表", type = "查询")
public ResponseReult<TerminalAlarmListModel> getTerminalAlarmList(@RequestBody @Validated TerminalAlarmVo vo) {
public ResponseReult<TerminalAlarmListModel> getTerminalAlarmList(@RequestBody @Validated TerminalAlarmSelectVo vo) {
ServiceBody<TerminalAlarmListModel> serviceBody = terminalAlarmService.getAlarmList(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
@ -44,7 +41,17 @@ public class TerminalAlarmController extends BaseController {
}
}
@ApiOperation(value = "更改告警列表未读状态", notes = "更改告警列表未读状态", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/readAlarm")
@Log(title = "更改告警列表未读状态", type = "修改")
public ResponseReult<String> readAlarm(@RequestBody @Validated TerminalAlarmIdVo vo) {
ServiceBody<String> serviceBody = terminalAlarmService.readAlarm(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
}

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

@ -0,0 +1,44 @@
package com.shxy.xymanager_common.dto;
import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
@Data
public class TerminalImgAlarmsDto implements Serializable {
private BigInteger id;
private Integer termId;
private Integer channelId;
private Integer presetId;
private BigInteger photoOrgId;
private BigInteger alarmTime;
private Integer label;
private String name;
private String enname;
private Float prob;
private Float x;
private Float y;
private Float width;
private Float height;
private Integer isread;
private static final long serialVersionUID = 1L;
}

@ -28,6 +28,8 @@ public class TerminalImgAlarmsDetails implements Serializable {
private Double height;
private Integer isread;
private static final long serialVersionUID = 1L;
}

@ -6,13 +6,14 @@ import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
/**
*
*
*/
@Data
@ApiModel(value = "通道列表", description = "通道列表信息")
@ApiModel(value = "报警列表", description = "报警列表信息")
public class TerminalAlarmListModel implements Serializable {
@ApiModelProperty(value = "总记录数", example = "120")
private long total;
@ -29,22 +30,62 @@ public class TerminalAlarmListModel implements Serializable {
public static class AlarmBean {
@ApiModelProperty(value = "告警编号", example = "123456")
private Integer id;
private BigInteger id;
@ApiModelProperty(value = "装置编号", example = "123456")
private Integer termId;
@ApiModelProperty(value = "告警时间", example = "123456")
private BigInteger alarmTime;
@ApiModelProperty(value = "装置名称", example = "123456")
private String displayName;
@ApiModelProperty(value = "电压等级", example = "123456")
private String dyLevel;
@ApiModelProperty(value = "线路编号", example = "123456")
private Integer lineId;
@ApiModelProperty(value = "线路名称", example = "123456")
private String lineName;
@ApiModelProperty(value = "是否已读", example = "123456")
private Short status;
@ApiModelProperty(value = "杆塔编号", example = "123456")
private Integer towerId;
@ApiModelProperty(value = "杆塔名称", example = "123456")
private String towerName;
@ApiModelProperty(value = "通道编号", example = "123456")
private Integer channelId;
@ApiModelProperty(value = "通道名称", example = "123456")
private String channnelName;
@ApiModelProperty(value = "别名", example = "123456")
private String alias;
@ApiModelProperty(value = "预置位编号", example = "123456")
private Integer presetId;
@ApiModelProperty(value = "图片编号", example = "123456")
private BigInteger photoOrgId;
@ApiModelProperty(value = "图片地址", example = "123456")
private String path;
@ApiModelProperty(value = "告警时间", example = "123456")
private Date alarmTime;
@ApiModelProperty(value = "识别标签编码", example = "123456")
private Integer label;
@ApiModelProperty(value = "告警名称", example = "123456")
private String name;
@ApiModelProperty(value = "告警中文", example = "123456")
private String enname;
@ApiModelProperty(value = "可信度", example = "123456")
private Float prob;
@ApiModelProperty(value = " 识别框横坐标", example = "123456")
private Float x;
@ApiModelProperty(value = " 识别框纵坐标", example = "123456")
private Float y;
@ApiModelProperty(value = "识别框宽度", example = "123456")
private Float width;
@ApiModelProperty(value = "识别框高度", example = "123456")
private Float height;
@ApiModelProperty(value = "1", example = "0--未读 1--已读")
private Integer isread;
}
}

@ -0,0 +1,21 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.util.Date;
@Data
@Validated
@ApiModel(value = "装置告警编号对象", description = "装置告警编号对象")
public class TerminalAlarmIdVo {
@ApiModelProperty(value = "告警编号", example = "123455")
private BigInteger id;
}

@ -0,0 +1,41 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;
@Data
@Validated
@ApiModel(value = "装置报警查询对象", description = "装置报警查询对象描述")
public class TerminalAlarmSelectVo {
@ApiModelProperty(value = "电压编号", example = "123455")
private Integer dyid;
@ApiModelProperty(value = "装置编号", example = "123455")
private Integer lineid;
@ApiModelProperty(value = "杆塔编号", example = "123455")
private Integer towerid;
@NotNull(message = "查询时间不能缺少")
@ApiModelProperty(value = "查询时间", example = "123455")
private Date starttime;
@NotNull(message = "查询结束时间不能缺少")
@ApiModelProperty(value = "查询结束时间", example = "123455")
private Date endtime;
@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;
}

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

@ -1,6 +1,7 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails;
import org.apache.ibatis.annotations.Param;
public interface TerminalImgAlarmsDetailsDao {
int deleteByPrimaryKey(Long id);
@ -11,6 +12,8 @@ public interface TerminalImgAlarmsDetailsDao {
TerminalImgAlarmsDetails selectByPrimaryKey(Long id);
int updateReadByPrimaryKey(@Param("id") Long id,@Param("status") Integer status);
int updateByPrimaryKeySelective(TerminalImgAlarmsDetails record);
int updateByPrimaryKey(TerminalImgAlarmsDetails record);

@ -15,6 +15,8 @@ public interface TerminalPhotoDao {
List<TerminalPhoto> selectPhotoList(@Param("terminalid") Integer terminalid, @Param("channelid") List<Integer> channelid, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
List<TerminalPhoto> selectPhotoListByOrginIdList(@Param("orginidlist") List<BigInteger> orginidlist);
List<TerminalPhoto> selectPhotoListByTermList(@Param("terminalidlist") List<Integer> terminalid, @Param("channelidlist") List<Integer> channelid, @Param("starttime") BigInteger starttime, @Param("endtime") BigInteger endtime);
int deleteByPrimaryKey(Long id);

@ -10,7 +10,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
id, term_id, channel_id, create_time, update_time
id, term_id, channel_id,alias, create_time, update_time
</sql>
<select id="selectByTermid" parameterType="java.lang.Integer" resultMap="BaseResultMap">

@ -12,15 +12,22 @@
<result column="alarm_info" jdbcType="LONGVARCHAR" property="alarmInfo"/>
</resultMap>
<resultMap id="AlarmsAndDetailsMap" type="com.shxy.xymanager_common.entity.TerminalImgAlarms">
<resultMap id="AlarmsAndDetailsMap" type="com.shxy.xymanager_common.dto.TerminalImgAlarmsDto">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="channel_id" jdbcType="TINYINT" property="channelId"/>
<result column="preset_id" jdbcType="TINYINT" property="presetId"/>
<result column="photo_org_id" jdbcType="INTEGER" property="photoOrgId"/>
<result column="photo_org_id" jdbcType="BIGINT" property="photoOrgId"/>
<result column="alarm_time" jdbcType="BIGINT" property="alarmTime"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="alarm_info" jdbcType="LONGVARCHAR" property="alarmInfo"/>
<result column="label" jdbcType="INTEGER" property="label"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="en_name" jdbcType="VARCHAR" property="enname"/>
<result column="prob" jdbcType="REAL" property="prob"/>
<result column="x" jdbcType="REAL" property="x"/>
<result column="y" jdbcType="REAL" property="y"/>
<result column="width" jdbcType="REAL" property="width"/>
<result column="height" jdbcType="REAL" property="height"/>
<result column="isread" jdbcType="INTEGER" property="isread"/>
</resultMap>
<sql id="Base_Column_List">
@ -36,15 +43,35 @@
<select id="selectAlarmsDetails" resultMap="AlarmsAndDetailsMap">
select
a.term_id as termId,
a.channel_id as channelId,
a.preset_id as presetId,
a.photo_org_id as photoOrgId,
a.alarm_time as alarmTime,
a.term_id as termid,
b.id as id,
a.term_id as term_id,
a.channel_id as channel_id,
a.preset_id as preset_id,
a.photo_org_id as photo_org_id,
a.alarm_time as alarm_time,
b.label as label,
b.name as name,
b.en_name as en_name,
b.prob as prob,
b.x as x,
b.y as y,
b.width as width,
b.height as height,
b.isread as isread
from
terminal_img_alarms a left join terminal_img_alarm_details b on a.id = b.alarm_id
where id = #{id,jdbcType=BIGINT}
where a.alarm_time between #{starttime} and #{endtime}
<if test="terminalidlist != null and terminalidlist.size > 0">
and term_id in
<foreach collection="terminalidlist" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by a.alarm_time desc
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

@ -1,32 +1,33 @@
<?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.shxy.xymanager_dao.dao.TerminalImgAlarmsDetailsDao">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="alarm_id" jdbcType="BIGINT" property="alarmId" />
<result column="label" jdbcType="INTEGER" property="label" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="en_name" jdbcType="VARCHAR" property="enName" />
<result column="prob" jdbcType="REAL" property="prob" />
<result column="x" jdbcType="REAL" property="x" />
<result column="y" jdbcType="REAL" property="y" />
<result column="width" jdbcType="REAL" property="width" />
<result column="height" jdbcType="REAL" property="height" />
</resultMap>
<sql id="Base_Column_List">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="alarm_id" jdbcType="BIGINT" property="alarmId"/>
<result column="label" jdbcType="INTEGER" property="label"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="en_name" jdbcType="VARCHAR" property="enName"/>
<result column="prob" jdbcType="REAL" property="prob"/>
<result column="x" jdbcType="REAL" property="x"/>
<result column="y" jdbcType="REAL" property="y"/>
<result column="width" jdbcType="REAL" property="width"/>
<result column="height" jdbcType="REAL" property="height"/>
<result column="isread" jdbcType="INTEGER" property="isread"/>
</resultMap>
<sql id="Base_Column_List">
id, alarm_id, label, name, en_name, prob, x, y, width, height
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from terminal_img_alarm_details
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
<select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_img_alarm_details
where id = #{id,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from terminal_img_alarm_details
where id = #{id,jdbcType=BIGINT}
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
insert into terminal_img_alarm_details (id, alarm_id, label,
name, en_name, prob, x,
y, width, height)
@ -34,107 +35,107 @@
#{name,jdbcType=VARCHAR}, #{enName,jdbcType=VARCHAR}, #{prob,jdbcType=REAL}, #{x,jdbcType=REAL},
#{y,jdbcType=REAL}, #{width,jdbcType=REAL}, #{height,jdbcType=REAL})
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
insert into terminal_img_alarm_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="alarmId != null">
alarm_id,
</if>
<if test="label != null">
label,
</if>
<if test="name != null">
name,
</if>
<if test="enName != null">
en_name,
</if>
<if test="prob != null">
prob,
</if>
<if test="x != null">
x,
</if>
<if test="y != null">
y,
</if>
<if test="width != null">
width,
</if>
<if test="height != null">
height,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="alarmId != null">
#{alarmId,jdbcType=BIGINT},
</if>
<if test="label != null">
#{label,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="enName != null">
#{enName,jdbcType=VARCHAR},
</if>
<if test="prob != null">
#{prob,jdbcType=REAL},
</if>
<if test="x != null">
#{x,jdbcType=REAL},
</if>
<if test="y != null">
#{y,jdbcType=REAL},
</if>
<if test="width != null">
#{width,jdbcType=REAL},
</if>
<if test="height != null">
#{height,jdbcType=REAL},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
update terminal_img_alarm_details
<set>
<if test="alarmId != null">
alarm_id = #{alarmId,jdbcType=BIGINT},
</if>
<if test="label != null">
label = #{label,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="enName != null">
en_name = #{enName,jdbcType=VARCHAR},
</if>
<if test="prob != null">
prob = #{prob,jdbcType=REAL},
</if>
<if test="x != null">
x = #{x,jdbcType=REAL},
</if>
<if test="y != null">
y = #{y,jdbcType=REAL},
</if>
<if test="width != null">
width = #{width,jdbcType=REAL},
</if>
<if test="height != null">
height = #{height,jdbcType=REAL},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
insert into terminal_img_alarm_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="alarmId != null">
alarm_id,
</if>
<if test="label != null">
label,
</if>
<if test="name != null">
name,
</if>
<if test="enName != null">
en_name,
</if>
<if test="prob != null">
prob,
</if>
<if test="x != null">
x,
</if>
<if test="y != null">
y,
</if>
<if test="width != null">
width,
</if>
<if test="height != null">
height,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=BIGINT},
</if>
<if test="alarmId != null">
#{alarmId,jdbcType=BIGINT},
</if>
<if test="label != null">
#{label,jdbcType=INTEGER},
</if>
<if test="name != null">
#{name,jdbcType=VARCHAR},
</if>
<if test="enName != null">
#{enName,jdbcType=VARCHAR},
</if>
<if test="prob != null">
#{prob,jdbcType=REAL},
</if>
<if test="x != null">
#{x,jdbcType=REAL},
</if>
<if test="y != null">
#{y,jdbcType=REAL},
</if>
<if test="width != null">
#{width,jdbcType=REAL},
</if>
<if test="height != null">
#{height,jdbcType=REAL},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
update terminal_img_alarm_details
<set>
<if test="alarmId != null">
alarm_id = #{alarmId,jdbcType=BIGINT},
</if>
<if test="label != null">
label = #{label,jdbcType=INTEGER},
</if>
<if test="name != null">
name = #{name,jdbcType=VARCHAR},
</if>
<if test="enName != null">
en_name = #{enName,jdbcType=VARCHAR},
</if>
<if test="prob != null">
prob = #{prob,jdbcType=REAL},
</if>
<if test="x != null">
x = #{x,jdbcType=REAL},
</if>
<if test="y != null">
y = #{y,jdbcType=REAL},
</if>
<if test="width != null">
width = #{width,jdbcType=REAL},
</if>
<if test="height != null">
height = #{height,jdbcType=REAL},
</if>
</set>
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalImgAlarmsDetails">
update terminal_img_alarm_details
set alarm_id = #{alarmId,jdbcType=BIGINT},
label = #{label,jdbcType=INTEGER},
@ -147,4 +148,10 @@
height = #{height,jdbcType=REAL}
where id = #{id,jdbcType=BIGINT}
</update>
<update id="updateReadByPrimaryKey">
update terminal_img_alarm_details
set isread = #{status},
where id = #{id}
</update>
</mapper>

@ -111,6 +111,17 @@
</if>
order by photo_time desc
</select>
<select id="selectPhotoListByOrginIdList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_photos
<if test="orginidlist != null and orginidlist.size > 0">
where orginal_id in
<foreach collection="orginidlist" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="selectPhotoListByTermList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>

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

@ -1,17 +1,32 @@
package com.shxy.xymanager_service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.dto.*;
import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.TerminalChannels;
import com.shxy.xymanager_common.entity.TerminalPhoto;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.TerminalAlarmListModel;
import com.shxy.xymanager_common.model.TerminalChannelListModel;
import com.shxy.xymanager_common.vo.TerminalAlarmVo;
import com.shxy.xymanager_dao.dao.SysUserMapperDao;
import com.shxy.xymanager_dao.dao.TerminalImgAlarmsDao;
import com.shxy.xymanager_dao.dao.TerminalImgAlarmsDetailsDao;
import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.vo.TerminalAlarmIdVo;
import com.shxy.xymanager_common.vo.TerminalAlarmSelectVo;
import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.cache.XyCache;
import com.shxy.xymanager_service.service.TerminalAlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigInteger;
import java.util.*;
/**
*
@ -25,13 +40,188 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
@Autowired
private TerminalImgAlarmsDao terminalImgAlarmsDao;
@Autowired
private TerminalPhotoDao terminalPhotoDao;
@Autowired
private TerminalImgAlarmsDetailsDao terminalImgAlarmsDetailsDao;
@Autowired
DyLevelDao dyLevelDao;
@Autowired
LinesDao linesDao;
@Autowired
TowerDao towerDao;
@Value("${photo.address}")
private String photoaddress;
@Value("${video.address}")
private String videoaddress;
@Override
public ServiceBody<TerminalAlarmListModel> getAlarmList(TerminalAlarmSelectVo vo) {
TerminalAlarmListModel model = new TerminalAlarmListModel();
Integer dyid = vo.getDyid();
Integer lineid = vo.getLineid();
Integer towerid = vo.getTowerid();
Date starttime = vo.getStarttime();
Date endtime = vo.getEndtime();
int pageindex = vo.getPageindex();
int pagesize = vo.getPagesize();
long start = MyDateUtils.TimeMillSecond2Second(DateTime.of(starttime));
long end = MyDateUtils.TimeMillSecond2Second(DateTime.of(endtime));
List<DyAndLineAndTowerAndTermDto> dtos = new ArrayList<>();
List<TerminalImgAlarmsDto> list = new ArrayList<>();
List<Integer> termidlist = new ArrayList<>();
if (dyid == null || dyid.intValue() == 0) {
PageUtils.SetPage(pageindex, pagesize);
list = terminalImgAlarmsDao.selectAlarmsDetails(null, BigInteger.valueOf(start), BigInteger.valueOf(end));
} else {
if (lineid == null || lineid.intValue() == 0) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, null, null, null, CommonStatus.EFFECTIVE.value());
} else {
if (towerid == null || towerid.intValue() == 0) {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, null, null, CommonStatus.EFFECTIVE.value());
} else {
dtos = dyLevelDao.selectDyAndLineAndTowerAnTermList(dyid, lineid, towerid, null, CommonStatus.EFFECTIVE.value());
}
}
for (DyAndLineAndTowerAndTermDto item1 : dtos) {
for (LineAndTowerAndTermDto item2 : item1.getList()) {
for (TowerAndTermDto item3 : item2.getList()) {
for (Terminals item4 : item3.getList()) {
termidlist.add(item4.getId());
}
}
}
}
PageUtils.SetPage(pageindex, pagesize);
list = terminalImgAlarmsDao.selectAlarmsDetails(termidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
}
if (CollectionUtil.isNotEmpty(list)) {
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, TowerDto> towerMap = XyCache.towerMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
ArrayList<BigInteger> originidlist = new ArrayList<>();
for (TerminalImgAlarmsDto item : list) {
originidlist.add(item.getPhotoOrgId());
}
List<TerminalPhoto> alarmphotolist = terminalPhotoDao.selectPhotoListByOrginIdList(originidlist);
Map<BigInteger, TerminalPhoto> map = new HashMap<>();
for (TerminalPhoto item : alarmphotolist) {
map.put(item.getOrginalId(), item);
}
// List<TerminalAlarmListModel.AlarmBean> alarmBeans = BeanUtil.copyToList(list, TerminalAlarmListModel.AlarmBean.class, CopyOptions.create().ignoreCase());
List<TerminalAlarmListModel.AlarmBean> alarmBeans = new ArrayList<>();
for (TerminalImgAlarmsDto item : list) {
TerminalAlarmListModel.AlarmBean alarmBean = new TerminalAlarmListModel.AlarmBean();
Integer termId = item.getTermId();
Integer channelId = item.getChannelId();
alarmBean.setId(item.getId());
alarmBean.setTermId(termId);
alarmBean.setChannelId(channelId);
Terminals terminals = terminalMap.get(termId);
if (terminals != null) {
alarmBean.setDisplayName(terminals.getDisplayName());
Integer termtowerid = terminals.getTowerid();
TowerDto towerDto = towerMap.get(termtowerid);
if (towerDto != null) {
alarmBean.setTowerId(termtowerid);
alarmBean.setTowerName(towerDto.getName());
alarmBean.setLineId(towerDto.getLineId());
alarmBean.setLineName(towerDto.getLineName());
}
}
TerminalChannels terminalChannels = termchannelMap.get(channelId);
if (terminalChannels != null) {
alarmBean.setChannnelName(terminalChannels.getChannelName());
}
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termId + "#" + channelId);
if (terminalChannelMapper != null) {
alarmBean.setAlias(terminalChannelMapper.getAlias());
}
alarmBean.setPresetId(item.getPresetId());
alarmBean.setPhotoOrgId(item.getPhotoOrgId());
if (map != null) {
TerminalPhoto terminalPhoto = map.get(item.getPhotoOrgId());
if (terminalPhoto != null) {
String path = terminalPhoto.getPath();
Integer mediaType = terminalPhoto.getMediaType();
if (mediaType == 0) {
alarmBean.setPath(photoaddress + path);
} else if (mediaType == 1) {
alarmBean.setPath(videoaddress + path);
} else {
alarmBean.setPath("");
}
} else {
alarmBean.setPath("");
}
} else {
alarmBean.setPath("");
}
long alarmtime = MyDateUtils.TimeSecond2MillSecond(item.getAlarmTime().longValue());
alarmBean.setAlarmTime(MyDateUtils.date(alarmtime));
alarmBean.setLabel(item.getLabel());
alarmBean.setName(item.getName());
alarmBean.setEnname(item.getEnname());
alarmBean.setProb(item.getProb());
alarmBean.setX(item.getX());
alarmBean.setY(item.getY());
alarmBean.setWidth(item.getWidth());
alarmBean.setHeight(item.getHeight());
if (item.getIsread() == null) {
alarmBean.setIsread(CommonStatus.DELETE.value());
}
alarmBeans.add(alarmBean);
}
model.setList(alarmBeans);
} else {
model.setList(new ArrayList<>());
}
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);
}
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<TerminalAlarmListModel> getAlarmList(TerminalAlarmVo vo) {
// terminalImgAlarmsDao
return null;
public ServiceBody<String> readAlarm(TerminalAlarmIdVo vo) {
int i = terminalImgAlarmsDetailsDao.updateReadByPrimaryKey(vo.getId().longValue(), CommonStatus.EFFECTIVE.value());
if (i > 0) {
return Asserts.success("success");
} else {
return Asserts.error("更改失败");
}
}
}

@ -106,9 +106,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
for (TerminalPhoto item : list) {
Integer mediaType = item.getMediaType();
if (mediaType == 0 && mediaType == 1) {
if (mediaType == 0 || mediaType == 1) {
TerminalPhotoListModel.PhotoBean photoBean = new TerminalPhotoListModel.PhotoBean();
photoBean.setChannelId(item.getChannelId());
Integer termId = item.getTermId();
Integer channelId = item.getChannelId();
photoBean.setChannelId(channelId);
photoBean.setFileSize(item.getFileSize());
photoBean.setHeight(item.getHeight());
photoBean.setMediaType(item.getMediaType());
@ -120,10 +123,19 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photoBean.setThumb(videoaddress + item.getThumb());
}
}
photoBean.setChannelName(termchannelMap.get(item.getChannelId()).getChannelName());
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
photoBean.setChannelName(termchannelMap.get(channelId).getChannelName());
if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termId + "#" + channelId);
if (terminalChannelMapper != null) {
photoBean.setAlias(terminalChannelMapper.getAlias());
} else {
photoBean.setAlias("");
}
} else {
photoBean.setAlias("");
}
photoBean.setId(item.getId());
photoBean.setTermId(item.getTermId());
photoBean.setTermId(termId);
photoBean.setWidth(item.getWidth());
photoBean.setPresetId(item.getPresetId());
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
@ -223,6 +235,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
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());
@ -384,8 +397,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
if (!CollectionUtil.isEmpty(list)) {
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
List<Integer> termidlist = new ArrayList<>();
for (ChannelAndTermDto item : list) {
@ -393,61 +404,57 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
termidlist.add(termid);
}
List<TermAndChannelLatestPhotoMapperDto> list2 = terminalPhotoDao.selectTermAndChannelLatestPhotoList(termidlist);
for (int y = 0; y < list2.size(); y++) {
log.info("日志开始");
TermAndChannelLatestPhotoMapperDto item = list2.get(y);
Integer mediatype = item.getMediatype();
if (mediatype == 0 || mediatype == 1) {
Integer termid = item.getTermid();
Integer lineid = terminalMap.get(termid).getLineid();
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid);
Integer channelid = item.getChannelid();
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
photosBean.setTermid(termid);
photosBean.setLineid(lineid);
if (lineAndDyNameDto != null) {
photosBean.setChannnelname(termchannelMap.get(channelid).getChannelName());
photosBean.setLinename(lineAndDyNameDto.getName());
} else {
photosBean.setChannnelname("");
photosBean.setLinename("");
}
photosBean.setChannelid(channelid);
Terminals terminals = terminalMap.get(termid);
if (terminals != null) {
photosBean.setDisplayname(terminals.getDisplayName());
} else {
photosBean.setDisplayname("");
}
if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
if (terminalChannelMapper != null) {
photosBean.setAlias(terminalChannelMapper.getAlias());
} else {
photosBean.setAlias("");
}
for (ChannelAndTermDto item : list) {
TerminalPhotosModel.PhotosBean photosBean = new TerminalPhotosModel.PhotosBean();
Integer termid = item.getTermid();
Integer channelid = item.getChannelid();
photosBean.setTermid(termid);
photosBean.setLineid(item.getLineid());
photosBean.setChannnelname(item.getChannelname());
if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
if (terminalChannelMapper != null) {
photosBean.setAlias(terminalChannelMapper.getAlias());
} else {
photosBean.setAlias("");
}
photosBean.setPath(item.getPath());
long recvtime = MyDateUtils.TimeSecond2MillSecond(item.getRecvTime().longValue());
photosBean.setRecvTime(MyDateUtils.date(recvtime));
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photosBean.setPhotoTime(MyDateUtils.date(phototime));
photosBean.setMediatype(mediatype);
if (mediatype.intValue() == 0) {
photosBean.setPath(photoaddress + item.getPath());
} else {
photosBean.setPath(videoaddress + item.getPath());
} else {
photosBean.setAlias("");
}
photosBean.setChannelid(channelid);
photosBean.setDisplayname(item.getDisplayname());
LineAndDyNameDto lineAndDyNameDto = lineMap.get(item.getLineid());
if (lineAndDyNameDto != null) {
photosBean.setLinename(lineAndDyNameDto.getName());
} else {
photosBean.setLinename("");
}
for (int y = 0; y < list2.size(); y++) {
TermAndChannelLatestPhotoMapperDto item2 = list2.get(y);
if (termid.intValue() == item2.getTermid().intValue() && item.getChannelid().intValue() == item2.getChannelid().intValue()) {
Integer mediatype = item2.getMediatype();
if (mediatype == 0 || mediatype == 1) {
photosBean.setPath(item2.getPath());
long recvtime = MyDateUtils.TimeSecond2MillSecond(item2.getRecvTime().longValue());
photosBean.setRecvTime(MyDateUtils.date(recvtime));
long phototime = MyDateUtils.TimeSecond2MillSecond(item2.getPhotoTime().longValue());
photosBean.setPhotoTime(MyDateUtils.date(phototime));
photosBean.setMediatype(mediatype);
if (mediatype.intValue() == 0) {
photosBean.setPath(photoaddress + item2.getPath());
} else {
photosBean.setPath(videoaddress + item2.getPath());
}
photosBean.setOrginalid(item2.getOrginalid());
photosBean.setPresetId(item2.getPresetId());
}
break;
}
photosBean.setOrginalid(item.getOrginalid());
photosBean.setPresetId(item.getPresetId());
beans.add(photosBean);
}
beans.add(photosBean);
}
}
model.setList(beans);

@ -16,7 +16,13 @@ public interface TerminalAlarmService {
*
* @return
*/
ServiceBody<TerminalAlarmListModel> getAlarmList(TerminalAlarmVo vo);
ServiceBody<TerminalAlarmListModel> getAlarmList(TerminalAlarmSelectVo vo);
/**
*
*
* @return
*/
ServiceBody<String> readAlarm(TerminalAlarmIdVo vo);
}

Loading…
Cancel
Save