气象预警增加导出功能

master
徐杰盟 2024-07-17 16:31:26 +08:00
parent e039c4da78
commit b6f20e5b51
7 changed files with 52 additions and 23 deletions

View File

@ -61,9 +61,11 @@ public class MyPostConstruct {
@Async
@ApiOperation(value = "预警数据同步接口", notes = "预警数据同步接口")
@GetMapping("/syncData")
@Scheduled(cron ="0 0/1 * * * ?")
@Scheduled(cron ="*/20 * * * * ?")
public void syncData() {
sync(null,null);
LocalDateTime now = LocalDateTime.now();
sync(DateUtils.dateToStr(now.minusHours(1)),DateUtils.dateToStr(now.plusHours(1)));
// sync(null,null);
}
/**

View File

@ -12,6 +12,7 @@ import com.whdc.model.entity.WarnMsgFB;
import com.whdc.model.vo.*;
import com.whdc.service.*;
import com.whdc.utils.DateUtils;
import com.whdc.utils.ExcelCommon;
import com.whdc.utils.HttpUtil;
import com.whdc.utils.ResultJson;
import io.swagger.annotations.Api;
@ -29,6 +30,7 @@ import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@ -252,6 +254,7 @@ public class QXWarnController {
for (int i = 0; i < cnnms.length; i++) {
String cnnm = cnnms[i];
String cnnm2 = cnnm.replace("县", "").replace("区", "");
// String adcd = adinfoService.getAdcdByAdnm2(cnnm2);//根据区县的名字找到对应的adcd
// System.out.println(adcd);
if (StringUtils.isNotBlank(cnnm2)) {
@ -291,9 +294,9 @@ public class QXWarnController {
return ResultJson.error("该名称或编码重复");
}
if (dto.getCallTime() == null) {
dto.setCallTime(dto.getHandleTime());
}
// if (dto.getCallTime() == null) {
// dto.setCallTime(dto.getHandleTime());
// }
boolean save = warnMsgFBService.save(dto);
@ -513,6 +516,23 @@ public class QXWarnController {
}
/**
*
*
* @param dto
* @return
*/
@ApiOperation(value = "历史气象预警导出")
@PostMapping("/getHistoryWarning/download")
public void getHistoryWarningDownload(@RequestBody GroupWarningDto dto, HttpServletResponse response) {
List<QXWarning> list = service.list(dto);
ExcelCommon.exportExcel(list,
null, "历史气象预警", QXWarning.class, "历史气象预警.xlsx",
response);
}
/**
* 7
*

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

@ -25,61 +25,61 @@ public class QXWarning {
@ApiModelProperty(value = "id")
private Integer id;
@Excel(name = "createTime")
@Excel(name = "预警信息生成时间")
@TableField("CREATE_TIME")
@ApiModelProperty(value = "预警信息生成时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@Excel(name = "publishTime")
@Excel(name = "预警信息发布时间")
@TableField("PUBLISH_TIME")
@ApiModelProperty(value = "预警信息发布时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date publishTime;
@Excel(name = "startTime")
@Excel(name = "预警信息开始时间")
@TableField("START_TIME")
@ApiModelProperty(value = "预警信息开始时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date startTime;
@Excel(name = "endTime")
@Excel(name = "预警信息结束时间")
@TableField("END_TIME")
@ApiModelProperty(value = "预警信息结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date endTime;
@Excel(name = "warnSignalType")
@Excel(name = "预警类型")
@ApiParam(value = "预警类型")
@ApiModelProperty(value = "预警类型", dataType = "java.lang.String")
private String warnSignalType;
@Excel(name = "warnSignalLevel")
@Excel(name = "预警级别")
@ApiParam(value = "预警级别")
@ApiModelProperty(value = "预警级别", dataType = "java.lang.String")
private String warnSignalLevel;
@Excel(name = "publishUnit")
@Excel(name = "发布单位")
@ApiParam(value = "发布单位")
@ApiModelProperty(value = "发布单位", dataType = "java.lang.String")
private String publishUnit;
@Excel(name = "content")
@Excel(name = "预警内容")
@ApiParam(value = "预警内容")
@ApiModelProperty(value = "预警内容", dataType = "java.lang.String")
private String content;
@Excel(name = "Qx_Id")
@Excel(name = "预警信息ID")
@TableField("WARNID")
@ApiModelProperty(value = "预警信息ID")
private Integer warnid;
@Excel(name = "effectArea_Big")
@Excel(name = "预警市名称")
@TableField("CTNM")
@ApiModelProperty(value = "预警市名称", dataType = "java.lang.String")
private String ctnm;
@Excel(name = "effectArea_Small")
@Excel(name = "预警县名称")
@TableField("CNNM")
@ApiModelProperty(value = "预警县名称", dataType = "java.lang.String")
private String cnnm;

View File

@ -12,5 +12,7 @@ public interface IQXWarningService extends IService<QXWarning> {
List<QXWarningVO> find();
IPage<QXWarning> page(GroupWarningDto dto);
List<QXWarning> list(GroupWarningDto dto);
List<QXWarning> getWarnAndMsg(String stm, String etm);
}

View File

@ -24,6 +24,10 @@ public class QXWarningServiceImpl extends ServiceImpl<QXWarningMapper, QXWarnin
public IPage<QXWarning> page(GroupWarningDto dto) {
return getBaseMapper().page(dto.getPage(),dto);
}
@Override
public List<QXWarning> list(GroupWarningDto dto) {
return getBaseMapper().list(dto);
}
@Override
public List<QXWarning> getWarnAndMsg(String stm, String etm) {

View File

@ -93,7 +93,7 @@
select * from ADDRESS_BOOK_OLD A
where 1=1 and
<if test="adnm != null and adnm != '' ">
A.CNNM like CONCAT(#{adnm},'%')
A.CNNM like CONCAT('%',#{adnm},'%')
</if>
</select>