增加预警曲线接口
This commit is contained in:
parent
ec0f7224ce
commit
cb690481ce
|
|
@ -1,13 +1,27 @@
|
|||
package org.jeecg.system.applet.controller;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.jeecg.common.constant.PollutionConstants;
|
||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||
import org.jeecg.common.entity.SurvStationInfo;
|
||||
import org.jeecg.common.util.R;
|
||||
import org.jeecg.common.vo.statistic.AlertSummaryVo;
|
||||
import org.jeecg.system.applet.annotation.ApiLogin;
|
||||
import org.jeecg.system.applet.dto.AlertSummaryDTO;
|
||||
import org.jeecg.system.applet.service.ISurvAlertRecordService;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.jeecg.system.applet.util.Iotutils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: surv_alert_record
|
||||
|
|
@ -22,8 +36,19 @@ import io.swagger.annotations.Api;
|
|||
public class SurvAlertRecordController {
|
||||
@Autowired
|
||||
private ISurvAlertRecordService survAlertRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 监控摄像头分页列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="预警曲线", notes="预警曲线")
|
||||
@PostMapping(value = "/alertSummary")
|
||||
@ApiLogin
|
||||
public R<AlertSummaryVo> alertSummary(@RequestBody AlertSummaryDTO alertSummaryDTO) {
|
||||
AlertSummaryVo alertSummaryVo = survAlertRecordService.getSummary(alertSummaryDTO);
|
||||
return R.ok(alertSummaryVo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package org.jeecg.system.applet.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlertSummaryDTO {
|
||||
@ApiModelProperty("设备ID")
|
||||
private String deployId;
|
||||
|
||||
@ApiModelProperty("开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
}
|
||||
|
|
@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import org.apache.ibatis.annotations.Param;
|
||||
import org.jeecg.common.entity.SurvAlertRecord;
|
||||
import org.jeecg.common.entity.SurvMaintainRecord;
|
||||
import org.jeecg.common.vo.statistic.AlertSummayDetail;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -17,4 +19,6 @@ import java.util.List;
|
|||
public interface SurvAlertRecordMapper extends BaseMapper<SurvAlertRecord> {
|
||||
|
||||
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, @Param("deviceList") List<String> deviceList, @Param("yearStr") String yearStr);
|
||||
|
||||
List<AlertSummayDetail> getSpotCheckData(@Param("deployId")String deployId,@Param("itemCode")String itemCode, @Param("dateList") List<String> dateList,@Param("startDateTime")LocalDateTime startDateTime,@Param("endDateTime")LocalDateTime endDateTime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,4 +24,6 @@ public interface SurvDeviceDeployMapper extends BaseMapper<SurvDeviceDeploy> {
|
|||
List<SurvDeviceDeploy> getDeviceByStationNoCam(String stationCode, String deployType);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceListByStations(@Param("stationCode")String stationCode,@Param("deployTypeList") List<String> deployTypeList);
|
||||
|
||||
SurvDeviceDeploy getDeployZhibiao(@Param("deployId") String deployId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,23 +2,29 @@
|
|||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.jeecg.system.applet.mapper.ScEquZhibiaoMapper">
|
||||
|
||||
<select id="getShowedChemical" resultType="org.jeecg.common.entity.ScEquZhibiao">
|
||||
select * from sc_equ_zhibiao where zhibiao_type = '1' AND equ_id IN
|
||||
<foreach collection="deviceList" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by sort_no,create_time desc
|
||||
<select id="getShowedChemical" resultType="org.jeecg.common.entity.ScEquZhibiao">
|
||||
select * from sc_equ_zhibiao where zhibiao_type = '1' AND equ_id IN
|
||||
<foreach collection="deviceList" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by sort_no,create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getAllChemical" resultType="org.jeecg.common.entity.ScEquZhibiao">
|
||||
select * from sc_equ_zhibiao where equ_id IN
|
||||
<foreach collection="deviceList" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by sort_no,create_time desc
|
||||
select * from sc_equ_zhibiao where equ_id IN
|
||||
<foreach collection="deviceList" index="index" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
order by sort_no,create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getSingleShowedChemical" resultType="org.jeecg.common.entity.ScEquZhibiao">
|
||||
select * from sc_equ_zhibiao where equ_id = #{deployCode} AND zhibiao_type = '1' order by sort_no,create_time desc
|
||||
<select id="getSingleShowedChemical" resultType="org.jeecg.common.entity.ScEquZhibiao">
|
||||
select * from sc_equ_zhibiao where equ_id = #{deployCode} AND zhibiao_type = '1' order by sort_no,create_time
|
||||
desc
|
||||
</select>
|
||||
|
||||
<select id="getZhibiao" resultType="org.jeecg.common.entity.ScEquZhibiao">
|
||||
select * from sc_equ_zhibiao where equ_id = #{deployId}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -14,6 +14,7 @@
|
|||
<result property="deployCode" column="DEPLOY_CODE" jdbcType="VARCHAR"/>
|
||||
<result property="deployId" column="DEPLOY_ID" jdbcType="VARCHAR"/>
|
||||
<result property="alertTime" column="ALERT_TIME" />
|
||||
<result property="itemCode" column="ITEM_CODE" jdbcType="VARCHAR"/>
|
||||
<result property="itemName" column="ITEM_NAME" jdbcType="VARCHAR"/>
|
||||
<result property="deviceName" column="DEVICE_NAME" jdbcType="VARCHAR"/>
|
||||
<result property="corpName" column="CORP_NAME" jdbcType="VARCHAR"/>
|
||||
|
|
@ -25,17 +26,23 @@
|
|||
<result property="isDel" column="IS_DEL" jdbcType="INTEGER"/>
|
||||
<result property="updatedTime" column="UPDATED_TIME"/>
|
||||
<result property="orgMessage" column="ORG_MESSAGE" jdbcType="VARCHAR"/>
|
||||
<association property="stationName" select="getStationName" column="DEPLOY_CODE"/>
|
||||
<result property="normalValue" column="NORMAL_VALUE" jdbcType="VARCHAR"/>
|
||||
<result property="survValue" column="SURV_VALUE" jdbcType="VARCHAR"/>
|
||||
<result property="survUnit" column="SURV_UNIT" jdbcType="VARCHAR"/>
|
||||
<result property="readStatus" column="READ_STATUS" jdbcType="VARCHAR"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="extMap" type="org.jeecg.common.entity.SurvAlertRecord" extends="baseResultMap">
|
||||
<association property="stationName" select="getStationName" column="DEPLOY_CODE"/>
|
||||
</resultMap>
|
||||
<sql id="baseSql">
|
||||
ID,ALERT_CONTENT,CORP_ID,ALERT_DTATA_TYPE,ALERT_DATA_ID,PUSH_STATUS,DEVICE_CODE,STATION_CDOE,DEPLOY_CODE,DEPLOY_ID,ALERT_TIME,ITEM_NAME,DEVICE_NAME,CORP_NAME,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME,ORG_MESSAGE
|
||||
ID,ALERT_CONTENT,CORP_ID,ALERT_DTATA_TYPE,ALERT_DATA_ID,PUSH_STATUS,DEVICE_CODE,STATION_CDOE,DEPLOY_CODE,DEPLOY_ID,ALERT_TIME,ITEM_NAME,DEVICE_NAME,CORP_NAME,TENANT_ID,RE_VISION,CREATED_BY,CREATE_TIME,UPDATED_BY,IS_DEL,UPDATED_TIME,ORG_MESSAGE,ITEM_CODE,NORMAL_VALUE,SURV_VALUE,READ_STATUS,SURV_UNIT
|
||||
</sql>
|
||||
|
||||
<select id="getStationName" resultType="String">
|
||||
select s.STATION_NAME from surv_device_deploy t left join surv_station_info s on t.STATION_CODE = s.STATION_CODE where t.DEPLOY_CODE= #{DEPLOY_CODE}
|
||||
</select>
|
||||
<select id="pages" resultMap="baseResultMap">
|
||||
<select id="pages" resultMap="extMap">
|
||||
select <include refid="baseSql"/>
|
||||
from surv_alert_record where 1=1
|
||||
<if test="deviceList!=null">
|
||||
|
|
@ -49,4 +56,39 @@
|
|||
</if>
|
||||
order by ALERT_TIME desc
|
||||
</select>
|
||||
|
||||
<select id="getSpotCheckData" resultType="org.jeecg.common.vo.statistic.AlertSummayDetail">
|
||||
SELECT
|
||||
ti.interval_start as alertTime,
|
||||
COALESCE(ad.ID, 0) as id,
|
||||
COALESCE(ad.DEPLOY_ID, #{deployId}) as deployId,
|
||||
COALESCE(ad.NORMAL_VALUE, 0) as normalValue,
|
||||
COALESCE(ad.SURV_VALUE, 0) as survValue,
|
||||
COALESCE(ad.ITEM_CODE, #{itemCode}) as itemCode,
|
||||
CASE WHEN ad.ALERT_TIME IS NULL THEN 0 ELSE 1 END as hasData
|
||||
FROM (
|
||||
<foreach item="items" collection="dateList" separator="union all" >
|
||||
SELECT CAST(#{items} AS DATETIME) as interval_start
|
||||
</foreach>
|
||||
) ti
|
||||
LEFT JOIN (
|
||||
SELECT t1.*
|
||||
FROM surv_alert_record t1
|
||||
INNER JOIN (
|
||||
SELECT
|
||||
DATE(ALERT_TIME) as date_part,
|
||||
HOUR(ALERT_TIME) as hour_part,
|
||||
FLOOR(MINUTE(ALERT_TIME) / 5) as minute_group,
|
||||
MIN(ALERT_TIME) as first_time_in_interval
|
||||
FROM surv_alert_record
|
||||
WHERE ALERT_TIME >= #{startDateTime} AND ALERT_TIME <= #{endDateTime} AND DEPLOY_ID = #{deployId} AND ITEM_CODE = #{itemCode}
|
||||
GROUP BY date_part, hour_part, minute_group
|
||||
) t2 ON DATE(t1.ALERT_TIME) = t2.date_part
|
||||
AND HOUR(t1.ALERT_TIME) = t2.hour_part
|
||||
AND FLOOR(MINUTE(t1.ALERT_TIME) / 5) = t2.minute_group
|
||||
AND t1.ALERT_TIME = t2.first_time_in_interval
|
||||
) ad ON ad.ALERT_TIME >= ti.interval_start
|
||||
AND ad.ALERT_TIME < DATE_ADD(ti.interval_start, INTERVAL 5 MINUTE)
|
||||
ORDER BY ti.interval_start;
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -45,6 +45,10 @@
|
|||
<association property="deviceInfo" select="getDeviceInfo" column="DEVICE_CODE"></association>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="zhibiaoMap" type="org.jeecg.common.entity.SurvDeviceDeploy" extends="baseResultMap">
|
||||
<collection property="zhibiaos" column="{deployId = id}" select="org.jeecg.system.applet.mapper.ScEquZhibiaoMapper.getZhibiao" />
|
||||
</resultMap>
|
||||
|
||||
<select id="getStationName" resultType="String">
|
||||
select STATION_NAME from surv_station_info where STATION_CODE = #{STATION_CODE}
|
||||
</select>
|
||||
|
|
@ -105,4 +109,8 @@
|
|||
</where>
|
||||
order by SORT_NO,CREATE_TIME desc
|
||||
</select>
|
||||
|
||||
<select id="getDeployZhibiao" resultMap="zhibiaoMap">
|
||||
select <include refid="baseSql"/> from surv_device_deploy where ID = #{deployId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.jeecg.common.entity.SurvAlertRecord;
|
||||
import org.jeecg.common.vo.statistic.AlertSummaryVo;
|
||||
import org.jeecg.system.applet.dto.AlertSummaryDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -16,4 +18,6 @@ import java.util.List;
|
|||
public interface ISurvAlertRecordService extends IService<SurvAlertRecord> {
|
||||
|
||||
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr);
|
||||
|
||||
AlertSummaryVo getSummary(AlertSummaryDTO alertSummaryDTO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,6 @@ public interface ISurvDeviceDeployService extends IService<SurvDeviceDeploy> {
|
|||
List<SurvDeviceDeploy> getDeviceByStationNoCam(String stationCode, String deployType);
|
||||
|
||||
List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployTypes);
|
||||
|
||||
SurvDeviceDeploy getDeployZhibiao(String deployId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,36 @@
|
|||
package org.jeecg.system.applet.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jeecg.common.constant.enums.PollutionEnum;
|
||||
import org.jeecg.common.entity.ScEquZhibiao;
|
||||
import org.jeecg.common.entity.SurvAlertRecord;
|
||||
import org.jeecg.common.entity.SurvDeviceDeploy;
|
||||
import org.jeecg.common.util.TimeIntervalUtils;
|
||||
import org.jeecg.common.vo.iot.common.SurvItemInfo;
|
||||
import org.jeecg.common.vo.statistic.AlertSummaryVo;
|
||||
import org.jeecg.common.vo.statistic.AlertSummayDetail;
|
||||
import org.jeecg.common.vo.statistic.CommonDateListResult;
|
||||
import org.jeecg.common.vo.statistic.CommonStatisticResultVo;
|
||||
import org.jeecg.system.applet.dto.AlertSummaryDTO;
|
||||
import org.jeecg.system.applet.mapper.SurvAlertRecordMapper;
|
||||
import org.jeecg.system.applet.service.ISurvAlertRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: surv_alert_record
|
||||
|
|
@ -17,10 +39,90 @@ import java.util.List;
|
|||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SurvAlertRecordServiceImpl extends ServiceImpl<SurvAlertRecordMapper, SurvAlertRecord> implements ISurvAlertRecordService {
|
||||
|
||||
@Autowired
|
||||
private ScEquZhibiaoServiceImpl zhibiaoService;
|
||||
@Autowired
|
||||
private SurvDeviceDeployServiceImpl deployService;
|
||||
@Override
|
||||
public IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr) {
|
||||
return baseMapper.pages(page,deviceList,yearStr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AlertSummaryVo getSummary(AlertSummaryDTO alertSummaryDTO) {
|
||||
Assert.notNull(alertSummaryDTO,"传入格式错误");
|
||||
SurvDeviceDeploy deploy = deployService.getDeployZhibiao(alertSummaryDTO.getDeployId());
|
||||
Assert.notNull(deploy,"设备无效");
|
||||
AlertSummaryVo alertSummaryVo = new AlertSummaryVo();
|
||||
List<SurvItemInfo> survItemInfos = new ArrayList<>();
|
||||
// step 1 所有监测项字典信息
|
||||
if(deploy.getZhibiaos()!=null && !deploy.getZhibiaos().isEmpty()){
|
||||
for (ScEquZhibiao zhibiao : deploy.getZhibiaos()) {
|
||||
SurvItemInfo survItemInfo = new SurvItemInfo();
|
||||
PollutionEnum pollutionEnum = PollutionEnum.catchPollution(zhibiao.getEntityField());
|
||||
survItemInfo.setItemName(zhibiao.getName());
|
||||
survItemInfo.setColor(pollutionEnum.getColor());
|
||||
survItemInfo.setHighVal(zhibiao.getValHeight()+"");
|
||||
survItemInfo.setLowVal(zhibiao.getValLow()+"");
|
||||
survItemInfo.setUnit(zhibiao.getNuit());
|
||||
survItemInfo.setEntity(zhibiao.getEntityField());
|
||||
survItemInfo.setPid(zhibiao.getEleKey());
|
||||
survItemInfos.add(survItemInfo);
|
||||
}
|
||||
}
|
||||
log.warn("====设备:{}监测项目--{}", deploy.getDeployDes(),survItemInfos.size());
|
||||
alertSummaryVo.setItemList(survItemInfos);
|
||||
Map<String, SurvItemInfo> itemMap = survItemInfos.stream()
|
||||
.collect(Collectors.toMap(SurvItemInfo::getEntity, itemss -> itemss));
|
||||
alertSummaryVo.setItemInfo(itemMap);
|
||||
|
||||
//step 2:获取每5分钟 的数据
|
||||
|
||||
|
||||
String startTime = alertSummaryDTO.getStartTime();
|
||||
String endTime = alertSummaryDTO.getEndTime();
|
||||
|
||||
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
|
||||
LocalDateTime startDateTime = null;
|
||||
LocalDateTime endDateTime = null;
|
||||
boolean isToday = false;
|
||||
LocalDateTime nowTime = LocalDateTime.now();
|
||||
LocalDate nowDate = nowTime.toLocalDate();
|
||||
if(StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)){
|
||||
startDateTime = LocalDateTime.of(LocalDate.parse(startTime,dtf), LocalTime.MIN);
|
||||
endDateTime = LocalDateTime.of(LocalDate.parse(endTime,dtf), LocalTime.MAX).withNano(999999000);
|
||||
//检查是否传入的今天
|
||||
if(nowTime.equals(startDateTime.toLocalDate())){
|
||||
isToday = true;
|
||||
}
|
||||
}else{
|
||||
startDateTime = LocalDateTime.of(nowDate, LocalTime.MIN);
|
||||
// endDateTime = LocalDateTime.of(nowTime, LocalTime.MAX).withNano(999999000);
|
||||
isToday = true;
|
||||
}
|
||||
|
||||
if(isToday){//如果查询的是今天,只查询到当前时间
|
||||
startDateTime = nowTime.minusDays(1);
|
||||
endDateTime = nowTime.withNano(999999000);
|
||||
}
|
||||
CommonDateListResult commonDateListResult = TimeIntervalUtils.generate5MinuteIntervals(startDateTime,endDateTime);
|
||||
Map<String,List<String>> dataMap = new HashMap<>();
|
||||
if(!survItemInfos.isEmpty()){
|
||||
for (SurvItemInfo survItemInfo : survItemInfos) {
|
||||
List<AlertSummayDetail> records = baseMapper.getSpotCheckData(alertSummaryDTO.getDeployId(),survItemInfo.getEntity(),commonDateListResult.getQueryList(),startDateTime,endDateTime);
|
||||
|
||||
//组装map
|
||||
if(!records.isEmpty()){
|
||||
List<String> dataList = records.stream().map(AlertSummayDetail::getSurvValue).collect(Collectors.toList());
|
||||
dataMap.put(survItemInfo.getEntity(),dataList);
|
||||
}
|
||||
}
|
||||
}
|
||||
alertSummaryVo.setTimeList(commonDateListResult.getShowList());
|
||||
alertSummaryVo.setDataMap(dataMap);
|
||||
return alertSummaryVo;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,4 +44,10 @@ public class SurvDeviceDeployServiceImpl extends ServiceImpl<SurvDeviceDeployMap
|
|||
public List<SurvDeviceDeploy> getDeviceListByStation(String stationCode, List<String> deployTypes) {
|
||||
return baseMapper.getDeviceListByStations(stationCode,deployTypes);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurvDeviceDeploy getDeployZhibiao(String deployId) {
|
||||
return baseMapper.getDeployZhibiao(deployId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,6 +112,13 @@ public class SurvAlertRecord implements Serializable {
|
|||
@DateTimeFormat(pattern="yyyy-MM-dd HH")
|
||||
@ApiModelProperty(value = "预警时间")
|
||||
private Date alertTime;
|
||||
|
||||
/**
|
||||
* 监测项编号
|
||||
*/
|
||||
@TableField("ITEM_CODE")
|
||||
private String itemCode;
|
||||
|
||||
/**监测项*/
|
||||
@Excel(name = "监测项", width = 15)
|
||||
@ApiModelProperty(value = "监测项")
|
||||
|
|
@ -130,6 +137,35 @@ public class SurvAlertRecord implements Serializable {
|
|||
@ApiModelProperty(value = "原始报文")
|
||||
private String orgMessage;
|
||||
|
||||
/**
|
||||
* 正常值
|
||||
*/
|
||||
@Excel(name = "正常值", width = 15)
|
||||
@TableField("NORMAL_VALUE")
|
||||
private String normalValue;
|
||||
|
||||
/**
|
||||
* 监测值
|
||||
*/
|
||||
@Excel(name = "检测值", width = 15)
|
||||
@TableField("SURV_VALUE")
|
||||
private String survValue;
|
||||
|
||||
|
||||
/**
|
||||
* 监测情况
|
||||
*/
|
||||
@Excel(name = "检测情况", width = 15)
|
||||
@TableField("READ_STATUS")
|
||||
private String readStatus;
|
||||
|
||||
/**
|
||||
* 监测单位
|
||||
*/
|
||||
@Excel(name = "检测单位", width = 15)
|
||||
@TableField("SURV_UNIT")
|
||||
private String survUnit;
|
||||
|
||||
/**站点名称*/
|
||||
@ApiModelProperty(value = "站点名称")
|
||||
@TableField(exist = false)
|
||||
|
|
|
|||
|
|
@ -240,8 +240,6 @@ public class SurvDeviceDeploy implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private String ysToken;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String[] depCodeArr;
|
||||
|
||||
|
|
@ -258,6 +256,9 @@ public class SurvDeviceDeploy implements Serializable {
|
|||
@TableField(exist = false)
|
||||
private Integer isOnline;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<ScEquZhibiao> zhibiaos;
|
||||
|
||||
public String[] getDepCodeArr() {
|
||||
if(StringUtils.isNotBlank(depCodes)) {
|
||||
return depCodes.split(",");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,62 @@
|
|||
package org.jeecg.common.util;
|
||||
|
||||
import org.jeecg.common.vo.statistic.CommonDateListResult;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TimeIntervalUtils {
|
||||
|
||||
private static final DateTimeFormatter DEFAULT_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
private static final DateTimeFormatter SHOW_FORMATTER =
|
||||
DateTimeFormatter.ofPattern("d日H:m");
|
||||
/**
|
||||
* 生成指定时间范围内的5分钟间隔时间点(使用默认格式)
|
||||
*/
|
||||
public static CommonDateListResult generate5MinuteIntervals(LocalDateTime start, LocalDateTime end) {
|
||||
return generate5MinuteIntervals(start, end, DEFAULT_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成指定时间范围内的5分钟间隔时间点(自定义格式)
|
||||
*/
|
||||
public static CommonDateListResult generate5MinuteIntervals(LocalDateTime start, LocalDateTime end,
|
||||
DateTimeFormatter formatter) {
|
||||
if (start == null || end == null) {
|
||||
throw new IllegalArgumentException("开始时间和结束时间不能为null");
|
||||
}
|
||||
|
||||
if (start.isAfter(end)) {
|
||||
throw new IllegalArgumentException("开始时间不能晚于结束时间");
|
||||
}
|
||||
|
||||
CommonDateListResult commonDateListResult = new CommonDateListResult();
|
||||
|
||||
List<String> intervals = new ArrayList<>();
|
||||
List<String> showIntervals = new ArrayList<>();
|
||||
LocalDateTime current = roundTo5Minutes(start);
|
||||
|
||||
while (!current.isAfter(end)) {
|
||||
intervals.add(current.format(formatter));
|
||||
showIntervals.add(current.format(SHOW_FORMATTER));
|
||||
current = current.plusMinutes(5);
|
||||
}
|
||||
commonDateListResult.setQueryList(intervals);
|
||||
commonDateListResult.setShowList(showIntervals);
|
||||
return commonDateListResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将时间取整到最近的5分钟(向下取整)
|
||||
*/
|
||||
private static LocalDateTime roundTo5Minutes(LocalDateTime dateTime) {
|
||||
int minute = dateTime.getMinute();
|
||||
int roundedMinute = (minute / 5) * 5;
|
||||
return dateTime.withMinute(roundedMinute).withSecond(0).withNano(0);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package org.jeecg.common.vo.iot.common;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SurvItemInfo {
|
||||
@ApiModelProperty("监测项名称")
|
||||
private String itemName;
|
||||
@ApiModelProperty("颜色")
|
||||
private String color;
|
||||
@ApiModelProperty("高阈值")
|
||||
private String highVal;
|
||||
@ApiModelProperty("低阈值")
|
||||
private String lowVal;
|
||||
@ApiModelProperty("单位")
|
||||
private String unit;
|
||||
@ApiModelProperty("字段")
|
||||
private String entity;
|
||||
@ApiModelProperty("pid")
|
||||
private String pid;
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
package org.jeecg.common.vo.statistic;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.jeecg.common.vo.iot.common.SurvItemInfo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class AlertSummaryVo {
|
||||
@ApiModelProperty("监测项信息")
|
||||
private Map<String,SurvItemInfo> itemInfo;
|
||||
@ApiModelProperty("监测项列表")
|
||||
private List<SurvItemInfo> itemList;
|
||||
@ApiModelProperty("X轴数据")
|
||||
private List<String> timeList;
|
||||
@ApiModelProperty("Y轴数据")
|
||||
private Map<String,List<String>> dataMap;
|
||||
}
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
package org.jeecg.common.vo.statistic;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AlertSummayDetail {
|
||||
@ApiModelProperty("数据id")
|
||||
private String id;
|
||||
@ApiModelProperty("设备id")
|
||||
private String deployId;
|
||||
@ApiModelProperty("告警时间")
|
||||
private String alertTime;
|
||||
@ApiModelProperty("监测项名称")
|
||||
private String itemName;
|
||||
@ApiModelProperty("监测项编号")
|
||||
private String itemCode;
|
||||
@ApiModelProperty("监测单位")
|
||||
private String itemUnit;
|
||||
@ApiModelProperty("正常值")
|
||||
private String normalValue;
|
||||
@ApiModelProperty("监测值")
|
||||
private String survValue;
|
||||
@ApiModelProperty("监测状态,low=偏低,high=偏高")
|
||||
private String readStatus;
|
||||
@ApiModelProperty("是否有数据,1=有,0=没有")
|
||||
private Integer hasData;
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
package org.jeecg.common.vo.statistic;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
public class CommonDateListResult {
|
||||
@ApiModelProperty("查询时间")
|
||||
private List<String> queryList;
|
||||
@ApiModelProperty("展示时间")
|
||||
private List<String> showList;
|
||||
}
|
||||
Loading…
Reference in New Issue