Browse Source

气象预警历史记录

develop
lau572 2 hours ago
parent
commit
52ac08a4f2
  1. 26
      zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java
  2. 125
      zc-business/src/main/java/com/zc/business/domain/export/MeteorologicalWarning.java
  3. 5
      zc-business/src/main/java/com/zc/business/mapper/DcNoStakeWarningTableMapper.java
  4. 9
      zc-business/src/main/java/com/zc/business/service/IDcNoStakeWarningTableService.java
  5. 20
      zc-business/src/main/java/com/zc/business/service/impl/DcNoStakeWarningTableServiceImpl.java
  6. 28
      zc-business/src/main/resources/mapper/business/DcNoStakeWarningTableMapper.xml

26
zc-business/src/main/java/com/zc/business/controller/WeatherForecastController.java

@ -3,12 +3,20 @@ package com.zc.business.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.system.domain.SysConfig;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysConfigService;
import com.zc.business.domain.DcNoStakeWarningTable;
import com.zc.business.domain.DcRegion;
import com.zc.business.domain.Status;
import com.zc.business.domain.export.MeteorologicalWarning;
import com.zc.business.enums.UniversalEnum;
import com.zc.business.service.IDcWarningService;
import com.zc.business.service.impl.DcNoStakeWarningTableServiceImpl;
@ -23,9 +31,11 @@ import io.swagger.annotations.ApiOperation;
import okhttp3.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.TimeUnit;
@ -927,4 +937,20 @@ public class WeatherForecastController extends BaseController {
return AjaxResult.success(jsonObject);
}
@ApiOperation("查询气象预警历史记录")
@GetMapping("/getHistory")
public TableDataInfo getHistory(MeteorologicalWarning meteorologicalWarning) {
startPage();
List<MeteorologicalWarning> list = noStakeWarningTableService.selectMeteorologicalWarningList(meteorologicalWarning);
return getDataTable(list);
}
@PostMapping("/export")
public void export(HttpServletResponse response, MeteorologicalWarning meteorologicalWarning)
{
List<MeteorologicalWarning> list = noStakeWarningTableService.selectMeteorologicalWarningList(meteorologicalWarning);
ExcelUtil<MeteorologicalWarning> util = new ExcelUtil<>(MeteorologicalWarning.class);
util.exportExcel(response, list, "气象预警记录");
}
}

125
zc-business/src/main/java/com/zc/business/domain/export/MeteorologicalWarning.java

@ -0,0 +1,125 @@
package com.zc.business.domain.export;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import java.util.Date;
/**
* 气象预警对象
*
* @author liuwenge
* @date 2026-06-11
*/
public class MeteorologicalWarning extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** id */
private Long id;
/** 预警标题 */
@Excel(name = "预警标题")
private String earlyWorningTitle;
/** 站点名称 */
@Excel(name = "站点名称")
private String stationName;
/** 预警发布时间 */
@Excel(name = "预警发布时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date warningTime;
/** 预警内容 */
@Excel(name = "预警内容",width = 150)
private String earlyWorningContent;
/** 预警类型 1-交通流预警 2-气象预警 3=交通流异常预警4-光纤告警 */
private String warningType;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date endTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getEarlyWorningTitle() {
return earlyWorningTitle;
}
public void setEarlyWorningTitle(String earlyWorningTitle) {
this.earlyWorningTitle = earlyWorningTitle;
}
public String getStationName() {
return stationName;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public Date getWarningTime() {
return warningTime;
}
public void setWarningTime(Date warningTime) {
this.warningTime = warningTime;
}
public String getEarlyWorningContent() {
return earlyWorningContent;
}
public void setEarlyWorningContent(String earlyWorningContent) {
this.earlyWorningContent = earlyWorningContent;
}
public String getWarningType() {
return warningType;
}
public void setWarningType(String warningType) {
this.warningType = warningType;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
@Override
public String toString() {
return new ToStringBuilder(this)
.append("id", id)
.append("earlyWorningTitle", earlyWorningTitle)
.append("stationName", stationName)
.append("earlyWorningIssueDate", warningTime)
.append("earlyWorningContent", earlyWorningContent)
.append("warningType", warningType)
.toString();
}
}

5
zc-business/src/main/java/com/zc/business/mapper/DcNoStakeWarningTableMapper.java

@ -2,8 +2,11 @@ package com.zc.business.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zc.business.domain.DcNoStakeWarningTable;
import com.zc.business.domain.export.MeteorologicalWarning;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 无桩号预警Mapper接口
*
@ -11,4 +14,6 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface DcNoStakeWarningTableMapper extends BaseMapper<DcNoStakeWarningTable> {
List<MeteorologicalWarning> selectNoStakeWarningTableList(MeteorologicalWarning meteorologicalWarning);
}

9
zc-business/src/main/java/com/zc/business/service/IDcNoStakeWarningTableService.java

@ -3,6 +3,7 @@ package com.zc.business.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.zc.business.domain.DcNoStakeWarningTable;
import com.zc.business.domain.export.MeteorologicalWarning;
import java.util.Date;
import java.util.List;
@ -61,4 +62,12 @@ public interface IDcNoStakeWarningTableService extends IService<DcNoStakeWarning
* @return 设备信息
*/
DcNoStakeWarningTable getDcNoStakeWarningTable(String id);
/**
* 查询气象预警
*
* @param meteorologicalWarning
* @return 设备信息
*/
List<MeteorologicalWarning> selectMeteorologicalWarningList(MeteorologicalWarning meteorologicalWarning);
}

20
zc-business/src/main/java/com/zc/business/service/impl/DcNoStakeWarningTableServiceImpl.java

@ -1,5 +1,6 @@
package com.zc.business.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -7,12 +8,16 @@ import com.ruoyi.common.constant.HttpStatus;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.PageUtils;
import com.zc.business.domain.DcNoStakeWarningTable;
import com.zc.business.domain.export.MeteorologicalWarning;
import com.zc.business.enums.UniversalEnum;
import com.zc.business.mapper.DcInfoBoardTemplateMapper;
import com.zc.business.mapper.DcNoStakeWarningTableMapper;
import com.zc.business.service.IDcNoStakeWarningTableService;
import com.zc.business.utils.WeatherTrafficProposeUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
@ -26,6 +31,9 @@ import java.util.stream.Collectors;
@Service
public class DcNoStakeWarningTableServiceImpl extends ServiceImpl<DcNoStakeWarningTableMapper, DcNoStakeWarningTable> implements IDcNoStakeWarningTableService {
@Autowired
private DcNoStakeWarningTableMapper dcNoStakeWarningTableMapper;
public LambdaQueryWrapper<DcNoStakeWarningTable> noStakeWarningTableQueryWrapper(DcNoStakeWarningTable dcNoStakeWarningTable, Date endTime, Date startTime) {
LambdaQueryWrapper<DcNoStakeWarningTable> queryWrapper = new LambdaQueryWrapper<>();
@ -142,5 +150,17 @@ public class DcNoStakeWarningTableServiceImpl extends ServiceImpl<DcNoStakeWarni
return getById(id);
}
/**
* 查询气象预警
*
* @param meteorologicalWarning
* @return 设备信息
*/
@Override
public List<MeteorologicalWarning> selectMeteorologicalWarningList(MeteorologicalWarning meteorologicalWarning){
return dcNoStakeWarningTableMapper.selectNoStakeWarningTableList(meteorologicalWarning);
}
}

28
zc-business/src/main/resources/mapper/business/DcNoStakeWarningTableMapper.xml

@ -0,0 +1,28 @@
<?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.zc.business.mapper.DcNoStakeWarningTableMapper">
<select id="selectNoStakeWarningTableList" parameterType="com.zc.business.domain.export.MeteorologicalWarning" resultType="com.zc.business.domain.export.MeteorologicalWarning">
select
id,
JSON_UNQUOTE(JSON_EXTRACT(other_config, '$.earlyWorningTitle')) as earlyWorningTitle,
JSON_UNQUOTE(JSON_EXTRACT(other_config, '$.stationName')) as stationName,
warning_time as warningTime,
JSON_UNQUOTE(JSON_EXTRACT(other_config, '$.earlyWorningContent')) as earlyWorningContent,
warning_type as warningType
from dc_no_stake_warning_table
<where>
warning_type = '2'
<if test="stationName != null and stationName != ''">
and JSON_UNQUOTE(JSON_EXTRACT(other_config, '$.stationName')) = #{stationName}
</if>
<if test="startTime != null and endTime != null">
and warning_time between #{startTime} and #{endTime}
</if>
</where>
order by warning_time desc
</select>
</mapper>
Loading…
Cancel
Save