气象预警增加导出功能

master
徐杰盟 2024-07-17 16:49:37 +08:00
parent b6f20e5b51
commit 97a4700dbf
4 changed files with 27 additions and 1 deletions

View File

@ -3,6 +3,7 @@ package com.whdc.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Sets;
import com.whdc.exception.MyException;
import com.whdc.model.dto.ApiDto;
import com.whdc.model.dto.GroupWarningDto;
import com.whdc.model.dto.WarnDppleDto;
@ -524,9 +525,14 @@ public class QXWarnController {
*/
@ApiOperation(value = "历史气象预警导出")
@PostMapping("/getHistoryWarning/download")
public void getHistoryWarningDownload(@RequestBody GroupWarningDto dto, HttpServletResponse response) {
public void getHistoryWarningDownload(@RequestBody @Validated GroupWarningDto dto, HttpServletResponse response) {
if (LocalDate.parse(dto.getStartTime().split(" ")[0]).plusDays(90).compareTo(LocalDate.parse(dto.getEndTime().split(" ")[0])) < 0){
throw new MyException("时间差不能超过90天");
}
List<QXWarning> list = service.list(dto);
ExcelCommon.exportExcel(list,
null, "历史气象预警", QXWarning.class, "历史气象预警.xlsx",
response);

View File

@ -14,6 +14,7 @@ public interface QXWarningMapper extends BaseMapper<QXWarning> {
List<QXWarningVO> findByMsgIsNull();
IPage<QXWarning> page(@Param("page") IPage<QXWarning> page, @Param("dto") GroupWarningDto dto);
List<QXWarning> list( @Param("dto") GroupWarningDto dto);
List<QXWarning> getWarnAndMsg(@Param("stm") String stm,@Param("etm") String etm);

View File

@ -1,10 +1,13 @@
package com.whdc.model.dto;
import com.whdc.model.group.Update;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
/**
* Description:
* Created by XuSan on 2024/5/23.
@ -18,9 +21,11 @@ import lombok.ToString;
public class GroupWarningDto extends FindPageDto{
@ApiModelProperty(value = "开始时间, 格式应为yyyy-MM-dd HH:mm:ss", dataType = "java.lang.String", example = "2023-06-15 08:00:00")
@NotNull(message = "开始时间不能为空")
private String startTime;
@ApiModelProperty(value = "结束时间, 格式应为yyyy-MM-dd HH:mm:ss", dataType = "java.lang.String", example = "2023-06-15 08:00:00")
@NotNull(message = "结束时间不能为空")
private String endTime;
@ApiModelProperty(value = "发布单位")

View File

@ -41,6 +41,20 @@
AND Q.PUBLISH_TIME BETWEEN #{dto.startTime} AND #{dto.endTime}
</if>
ORDER BY Q.WARNID DESC
</select>
<select id="list" resultType="com.whdc.model.vo.QXWarningVO">
SELECT
Q.*,IF( WF.ID IS NOT NULL,1,0) STATUS
FROM
FXKH_TXL.QXWARNING Q
LEFT JOIN FXKH_TXL.WARNMSG_FEEDBACK WF ON WF.WARNID = Q.WARNID
WHERE
1 = 1
<if test="dto.startTime != null and dto.startTime != '' and dto.endTime != null and dto.endTime != ''">
AND Q.PUBLISH_TIME BETWEEN #{dto.startTime} AND #{dto.endTime}
</if>
ORDER BY Q.WARNID DESC
</select>
</mapper>