增加大屏预警接口

This commit is contained in:
zy 2026-03-20 15:29:23 +08:00
parent 82b6641132
commit f7ca5407c6
5 changed files with 79 additions and 10 deletions

View File

@ -1,6 +1,7 @@
package org.jeecg.modules.appmana.controller; package org.jeecg.modules.appmana.controller;
import cn.hutool.core.lang.Assert; import cn.hutool.core.lang.Assert;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -11,14 +12,17 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.enums.PollutionEnum; import org.jeecg.common.constant.enums.PollutionEnum;
import org.jeecg.common.entity.SurvAlertRecord;
import org.jeecg.common.entity.SurvDeviceDeploy; import org.jeecg.common.entity.SurvDeviceDeploy;
import org.jeecg.common.entity.SurvMaintainRecord; import org.jeecg.common.entity.SurvMaintainRecord;
import org.jeecg.common.iot.common.VOIntegrateStatistic; import org.jeecg.common.iot.common.VOIntegrateStatistic;
import org.jeecg.common.util.R;
import org.jeecg.common.vo.VOBigScreenSurvQ; import org.jeecg.common.vo.VOBigScreenSurvQ;
import org.jeecg.common.vo.VOHisFormResult; import org.jeecg.common.vo.VOHisFormResult;
import org.jeecg.common.vo.VOHisResult; import org.jeecg.common.vo.VOHisResult;
import org.jeecg.common.vo.params.StationMaintainPage; import org.jeecg.common.vo.params.StationMaintainPage;
import org.jeecg.common.vo.statistic.DeploySummaryVo; import org.jeecg.common.vo.statistic.DeploySummaryVo;
import org.jeecg.modules.appmana.service.ISurvAlertRecordService;
import org.jeecg.modules.appmana.service.ISurvDeviceDeployService; import org.jeecg.modules.appmana.service.ISurvDeviceDeployService;
import org.jeecg.modules.appmana.service.ISurvMaintainRecordService; import org.jeecg.modules.appmana.service.ISurvMaintainRecordService;
import org.jeecg.modules.appmana.service.impl.CommonServiceImpl; import org.jeecg.modules.appmana.service.impl.CommonServiceImpl;
@ -32,6 +36,7 @@ import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.List; import java.util.List;
@Api(tags="大屏接口part.2") @Api(tags="大屏接口part.2")
@ -50,7 +55,8 @@ public class BigScreenControllerP2 {
private IotCommonP3ServiceImpl iotCommonP3Service; private IotCommonP3ServiceImpl iotCommonP3Service;
@Autowired @Autowired
private ISurvMaintainRecordService maintainRecordService; private ISurvMaintainRecordService maintainRecordService;
@Autowired
private ISurvAlertRecordService alertRecordService;
@ApiOperationSupport(order = 1) @ApiOperationSupport(order = 1)
@ApiOperation(value = "01. 查询设备下各检测项的历史数据", notes = "") @ApiOperation(value = "01. 查询设备下各检测项的历史数据", notes = "")
@ -137,4 +143,30 @@ public class BigScreenControllerP2 {
return Result.OK(voIntegrateStatistic); return Result.OK(voIntegrateStatistic);
} }
@GetMapping("/alertRecord")
@ApiOperation("获取预警数据")
public Result<IPage<SurvAlertRecord>> getAlertRecord(@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
@RequestParam(value = "stationCode",required = false)String stationCode,
@RequestParam(value = "deployId",required = false)String deployId,
@RequestParam(value = "yearStr",required = false)String yearStr
){
commonService.getTenantId(null);
//效果评价
Page<SurvAlertRecord> page = new Page<SurvAlertRecord>(pageNo, pageSize);
//查询站点里的所有设备
List<String> allList =new ArrayList<>();
if(StringUtils.isNotBlank(stationCode)){
List<SurvDeviceDeploy> dList = survDeviceDeployService.getDeviceListByStation(stationCode, new ArrayList<>());
dList.forEach(item->allList.add(item.getId()));
} else if (StringUtils.isNotBlank(deployId)) {
allList.add(deployId);
}
IPage<SurvAlertRecord> pageList = alertRecordService.pageByDevice(page, allList,yearStr);
return Result.OK(pageList);
}
} }

View File

@ -2,8 +2,11 @@ package org.jeecg.modules.appmana.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.entity.SurvAlertRecord; import org.jeecg.common.entity.SurvAlertRecord;
import java.util.List;
/** /**
* @Description: surv_alert_record * @Description: surv_alert_record
* @Author: jeecg-boot * @Author: jeecg-boot
@ -13,4 +16,8 @@ import org.jeecg.common.entity.SurvAlertRecord;
public interface SurvAlertRecordMapper extends BaseMapper<SurvAlertRecord> { public interface SurvAlertRecordMapper extends BaseMapper<SurvAlertRecord> {
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, SurvAlertRecord survAlertRecord); IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, SurvAlertRecord survAlertRecord);
IPage<SurvAlertRecord> pageByDevice(IPage<SurvAlertRecord> page, @Param("deviceList") List<String> deviceList, @Param("yearStr") String yearStr);
} }

View File

@ -35,8 +35,9 @@
select s.STATION_NAME from surv_device_deploy t left join surv_station_info s on t.STATION_CODE = s.STATION_CODE where t.IS_DEL = 0 AND t.DEPLOY_CODE= #{DEPLOY_CODE} select s.STATION_NAME from surv_device_deploy t left join surv_station_info s on t.STATION_CODE = s.STATION_CODE where t.IS_DEL = 0 AND t.DEPLOY_CODE= #{DEPLOY_CODE}
</select> </select>
<select id="pages" resultMap="baseResultMap"> <select id="pages" resultMap="baseResultMap">
select <include refid="baseSql"/> select
<include refid="baseSql"/>
from surv_alert_record where 1=1 from surv_alert_record where 1=1
<if test="param2.deployCode!=null and param2.deployCode!=''"> <if test="param2.deployCode!=null and param2.deployCode!=''">
and DEPLOY_CODE = #{param2.deployCode} and DEPLOY_CODE = #{param2.deployCode}
@ -45,4 +46,22 @@
and DATE_FORMAT(ALERT_TIME,'%Y-%m-%d %H') = DATE_FORMAT(#{param2.alertTime},'%Y-%m-%d %H') and DATE_FORMAT(ALERT_TIME,'%Y-%m-%d %H') = DATE_FORMAT(#{param2.alertTime},'%Y-%m-%d %H')
</if> </if>
</select> </select>
<select id="pageByDevice" resultMap="baseResultMap">
select <include refid="baseSql"/>
from surv_alert_record
<where>
<if test="deviceList!=null and deviceList.size()>0">
and DEPLOY_ID IN
<foreach collection="deviceList" index="index" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</if>
<if test="yearStr!=null">
and ALERT_TIME BETWEEN CONCAT(#{yearStr},'-01-01') AND CONCAT(#{yearStr},'-12-31')
</if>
</where>
order by ALERT_TIME desc
</select>
</mapper> </mapper>

View File

@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.common.entity.SurvAlertRecord; import org.jeecg.common.entity.SurvAlertRecord;
import java.util.List;
/** /**
* @Description: surv_alert_record * @Description: surv_alert_record
* @Author: jeecg-boot * @Author: jeecg-boot
@ -13,4 +15,6 @@ import org.jeecg.common.entity.SurvAlertRecord;
public interface ISurvAlertRecordService extends IService<SurvAlertRecord> { public interface ISurvAlertRecordService extends IService<SurvAlertRecord> {
IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, SurvAlertRecord survAlertRecord); IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, SurvAlertRecord survAlertRecord);
IPage<SurvAlertRecord> pageByDevice(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr);
} }

View File

@ -7,6 +7,8 @@ import org.jeecg.modules.appmana.mapper.SurvAlertRecordMapper;
import org.jeecg.modules.appmana.service.ISurvAlertRecordService; import org.jeecg.modules.appmana.service.ISurvAlertRecordService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* @Description: surv_alert_record * @Description: surv_alert_record
* @Author: jeecg-boot * @Author: jeecg-boot
@ -20,4 +22,9 @@ public class SurvAlertRecordServiceImpl extends ServiceImpl<SurvAlertRecordMappe
public IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, SurvAlertRecord survAlertRecord) { public IPage<SurvAlertRecord> pages(IPage<SurvAlertRecord> page, SurvAlertRecord survAlertRecord) {
return baseMapper.pages(page,survAlertRecord); return baseMapper.pages(page,survAlertRecord);
} }
@Override
public IPage<SurvAlertRecord> pageByDevice(IPage<SurvAlertRecord> page, List<String> deviceList, String yearStr) {
return baseMapper.pageByDevice(page,deviceList,yearStr);
}
} }