气象预警增加导出功能
parent
e039c4da78
commit
b6f20e5b51
|
|
@ -61,9 +61,11 @@ public class MyPostConstruct {
|
||||||
@Async
|
@Async
|
||||||
@ApiOperation(value = "预警数据同步接口", notes = "预警数据同步接口")
|
@ApiOperation(value = "预警数据同步接口", notes = "预警数据同步接口")
|
||||||
@GetMapping("/syncData")
|
@GetMapping("/syncData")
|
||||||
@Scheduled(cron ="0 0/1 * * * ?")
|
@Scheduled(cron ="*/20 * * * * ?")
|
||||||
public void syncData() {
|
public void syncData() {
|
||||||
sync(null,null);
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
sync(DateUtils.dateToStr(now.minusHours(1)),DateUtils.dateToStr(now.plusHours(1)));
|
||||||
|
// sync(null,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.whdc.model.entity.WarnMsgFB;
|
||||||
import com.whdc.model.vo.*;
|
import com.whdc.model.vo.*;
|
||||||
import com.whdc.service.*;
|
import com.whdc.service.*;
|
||||||
import com.whdc.utils.DateUtils;
|
import com.whdc.utils.DateUtils;
|
||||||
|
import com.whdc.utils.ExcelCommon;
|
||||||
import com.whdc.utils.HttpUtil;
|
import com.whdc.utils.HttpUtil;
|
||||||
import com.whdc.utils.ResultJson;
|
import com.whdc.utils.ResultJson;
|
||||||
import io.swagger.annotations.Api;
|
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.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
@ -252,6 +254,7 @@ public class QXWarnController {
|
||||||
for (int i = 0; i < cnnms.length; i++) {
|
for (int i = 0; i < cnnms.length; i++) {
|
||||||
String cnnm = cnnms[i];
|
String cnnm = cnnms[i];
|
||||||
String cnnm2 = cnnm.replace("县", "").replace("区", "");
|
String cnnm2 = cnnm.replace("县", "").replace("区", "");
|
||||||
|
|
||||||
// String adcd = adinfoService.getAdcdByAdnm2(cnnm2);//根据区县的名字找到对应的adcd
|
// String adcd = adinfoService.getAdcdByAdnm2(cnnm2);//根据区县的名字找到对应的adcd
|
||||||
// System.out.println(adcd);
|
// System.out.println(adcd);
|
||||||
if (StringUtils.isNotBlank(cnnm2)) {
|
if (StringUtils.isNotBlank(cnnm2)) {
|
||||||
|
|
@ -291,9 +294,9 @@ public class QXWarnController {
|
||||||
return ResultJson.error("该名称或编码重复");
|
return ResultJson.error("该名称或编码重复");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dto.getCallTime() == null) {
|
// if (dto.getCallTime() == null) {
|
||||||
dto.setCallTime(dto.getHandleTime());
|
// dto.setCallTime(dto.getHandleTime());
|
||||||
}
|
// }
|
||||||
|
|
||||||
boolean save = warnMsgFBService.save(dto);
|
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天暴雨预警叫应信息统计
|
* 历史7天暴雨预警叫应信息统计
|
||||||
*
|
*
|
||||||
|
|
@ -961,7 +981,7 @@ public class QXWarnController {
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = HttpUtil.getBySetCookie("https://shdata.cloudowr.cn/shwarn/msg/totalquery?stm=" + stm.toLocalDate().toString() + "&etm=" + etm.toLocalDate().toString(),
|
String str = HttpUtil.getBySetCookie("https://shdata.cloudowr.cn/shwarn/msg/totalquery?stm=" + stm.toLocalDate().toString() + "&etm=" + etm.toLocalDate().toString(),
|
||||||
"userobj="+ userobj);
|
"userobj=" + userobj);
|
||||||
JSONObject json = JSON.parseObject(str);
|
JSONObject json = JSON.parseObject(str);
|
||||||
if (json != null && json.getInteger("ok") == 1) {
|
if (json != null && json.getInteger("ok") == 1) {
|
||||||
TotalQueryVo data = json.getJSONObject("results").toJavaObject(TotalQueryVo.class);
|
TotalQueryVo data = json.getJSONObject("results").toJavaObject(TotalQueryVo.class);
|
||||||
|
|
@ -1028,7 +1048,7 @@ public class QXWarnController {
|
||||||
|
|
||||||
List<String> oraCnnms = Lists.newArrayList();
|
List<String> oraCnnms = Lists.newArrayList();
|
||||||
orangeList.forEach((k, v) -> {
|
orangeList.forEach((k, v) -> {
|
||||||
warnStr.append(getCnnmStr(v,oraCnnms));
|
warnStr.append(getCnnmStr(v, oraCnnms));
|
||||||
});
|
});
|
||||||
|
|
||||||
warnStr.setCharAt(warnStr.length() - 1, '等');
|
warnStr.setCharAt(warnStr.length() - 1, '等');
|
||||||
|
|
@ -1039,7 +1059,7 @@ public class QXWarnController {
|
||||||
|
|
||||||
List<String> redCnnms = Lists.newArrayList();
|
List<String> redCnnms = Lists.newArrayList();
|
||||||
redList.forEach((k, v) -> {
|
redList.forEach((k, v) -> {
|
||||||
warnStr.append(getCnnmStr(v,redCnnms));
|
warnStr.append(getCnnmStr(v, redCnnms));
|
||||||
});
|
});
|
||||||
warnStr.setCharAt(warnStr.length() - 1, '等');
|
warnStr.setCharAt(warnStr.length() - 1, '等');
|
||||||
warnStr.append(redCnnms.size()).append("个县市区,").append(red.stream().filter(o -> Objects.nonNull(o.getCallTime())).count()).append("次。");
|
warnStr.append(redCnnms.size()).append("个县市区,").append(red.stream().filter(o -> Objects.nonNull(o.getCallTime())).count()).append("次。");
|
||||||
|
|
@ -1052,7 +1072,7 @@ public class QXWarnController {
|
||||||
List<String> oraCnnms = Lists.newArrayList();
|
List<String> oraCnnms = Lists.newArrayList();
|
||||||
|
|
||||||
orangeList.forEach((k, v) -> {
|
orangeList.forEach((k, v) -> {
|
||||||
warnStr.append(getCnnmStr(v,oraCnnms));
|
warnStr.append(getCnnmStr(v, oraCnnms));
|
||||||
});
|
});
|
||||||
|
|
||||||
warnStr.setCharAt(warnStr.length() - 1, '等');
|
warnStr.setCharAt(warnStr.length() - 1, '等');
|
||||||
|
|
@ -1064,7 +1084,7 @@ public class QXWarnController {
|
||||||
|
|
||||||
List<String> redCnnms = Lists.newArrayList();
|
List<String> redCnnms = Lists.newArrayList();
|
||||||
redList.forEach((k, v) -> {
|
redList.forEach((k, v) -> {
|
||||||
warnStr.append(getCnnmStr(v,redCnnms));
|
warnStr.append(getCnnmStr(v, redCnnms));
|
||||||
});
|
});
|
||||||
warnStr.setCharAt(warnStr.length() - 1, '等');
|
warnStr.setCharAt(warnStr.length() - 1, '等');
|
||||||
warnStr.append(redCnnms.size()).append("个县市区,").append(red.stream().filter(o -> Objects.nonNull(o.getCallTime())).count()).append("次。");
|
warnStr.append(redCnnms.size()).append("个县市区,").append(red.stream().filter(o -> Objects.nonNull(o.getCallTime())).count()).append("次。");
|
||||||
|
|
@ -1077,7 +1097,7 @@ public class QXWarnController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringBuilder getCnnmStr(List<QXWarning> list,List<String> cnnms) {
|
private StringBuilder getCnnmStr(List<QXWarning> list, List<String> cnnms) {
|
||||||
List<String> lists = list.stream().map(QXWarning::getCnnm).distinct().collect(Collectors.toList());
|
List<String> lists = list.stream().map(QXWarning::getCnnm).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
HashSet<String> cnnmSet = Sets.newHashSet();
|
HashSet<String> cnnmSet = Sets.newHashSet();
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ public interface QXWarningMapper extends BaseMapper<QXWarning> {
|
||||||
List<QXWarningVO> findByMsgIsNull();
|
List<QXWarningVO> findByMsgIsNull();
|
||||||
|
|
||||||
IPage<QXWarning> page(@Param("page") IPage<QXWarning> page, @Param("dto") GroupWarningDto dto);
|
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);
|
List<QXWarning> getWarnAndMsg(@Param("stm") String stm,@Param("etm") String etm);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,61 +25,61 @@ public class QXWarning {
|
||||||
@ApiModelProperty(value = "id")
|
@ApiModelProperty(value = "id")
|
||||||
private Integer id;
|
private Integer id;
|
||||||
|
|
||||||
@Excel(name = "createTime")
|
@Excel(name = "预警信息生成时间")
|
||||||
@TableField("CREATE_TIME")
|
@TableField("CREATE_TIME")
|
||||||
@ApiModelProperty(value = "预警信息生成时间")
|
@ApiModelProperty(value = "预警信息生成时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
@Excel(name = "publishTime")
|
@Excel(name = "预警信息发布时间")
|
||||||
@TableField("PUBLISH_TIME")
|
@TableField("PUBLISH_TIME")
|
||||||
@ApiModelProperty(value = "预警信息发布时间")
|
@ApiModelProperty(value = "预警信息发布时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date publishTime;
|
private Date publishTime;
|
||||||
|
|
||||||
@Excel(name = "startTime")
|
@Excel(name = "预警信息开始时间")
|
||||||
@TableField("START_TIME")
|
@TableField("START_TIME")
|
||||||
@ApiModelProperty(value = "预警信息开始时间")
|
@ApiModelProperty(value = "预警信息开始时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date startTime;
|
private Date startTime;
|
||||||
|
|
||||||
@Excel(name = "endTime")
|
@Excel(name = "预警信息结束时间")
|
||||||
@TableField("END_TIME")
|
@TableField("END_TIME")
|
||||||
@ApiModelProperty(value = "预警信息结束时间")
|
@ApiModelProperty(value = "预警信息结束时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private Date endTime;
|
private Date endTime;
|
||||||
|
|
||||||
@Excel(name = "warnSignalType")
|
@Excel(name = "预警类型")
|
||||||
@ApiParam(value = "预警类型")
|
@ApiParam(value = "预警类型")
|
||||||
@ApiModelProperty(value = "预警类型", dataType = "java.lang.String")
|
@ApiModelProperty(value = "预警类型", dataType = "java.lang.String")
|
||||||
private String warnSignalType;
|
private String warnSignalType;
|
||||||
|
|
||||||
@Excel(name = "warnSignalLevel")
|
@Excel(name = "预警级别")
|
||||||
@ApiParam(value = "预警级别")
|
@ApiParam(value = "预警级别")
|
||||||
@ApiModelProperty(value = "预警级别", dataType = "java.lang.String")
|
@ApiModelProperty(value = "预警级别", dataType = "java.lang.String")
|
||||||
private String warnSignalLevel;
|
private String warnSignalLevel;
|
||||||
|
|
||||||
@Excel(name = "publishUnit")
|
@Excel(name = "发布单位")
|
||||||
@ApiParam(value = "发布单位")
|
@ApiParam(value = "发布单位")
|
||||||
@ApiModelProperty(value = "发布单位", dataType = "java.lang.String")
|
@ApiModelProperty(value = "发布单位", dataType = "java.lang.String")
|
||||||
private String publishUnit;
|
private String publishUnit;
|
||||||
|
|
||||||
@Excel(name = "content")
|
@Excel(name = "预警内容")
|
||||||
@ApiParam(value = "预警内容")
|
@ApiParam(value = "预警内容")
|
||||||
@ApiModelProperty(value = "预警内容", dataType = "java.lang.String")
|
@ApiModelProperty(value = "预警内容", dataType = "java.lang.String")
|
||||||
private String content;
|
private String content;
|
||||||
|
|
||||||
@Excel(name = "Qx_Id")
|
@Excel(name = "预警信息ID")
|
||||||
@TableField("WARNID")
|
@TableField("WARNID")
|
||||||
@ApiModelProperty(value = "预警信息ID")
|
@ApiModelProperty(value = "预警信息ID")
|
||||||
private Integer warnid;
|
private Integer warnid;
|
||||||
|
|
||||||
@Excel(name = "effectArea_Big")
|
@Excel(name = "预警市名称")
|
||||||
@TableField("CTNM")
|
@TableField("CTNM")
|
||||||
@ApiModelProperty(value = "预警市名称", dataType = "java.lang.String")
|
@ApiModelProperty(value = "预警市名称", dataType = "java.lang.String")
|
||||||
private String ctnm;
|
private String ctnm;
|
||||||
|
|
||||||
@Excel(name = "effectArea_Small")
|
@Excel(name = "预警县名称")
|
||||||
@TableField("CNNM")
|
@TableField("CNNM")
|
||||||
@ApiModelProperty(value = "预警县名称", dataType = "java.lang.String")
|
@ApiModelProperty(value = "预警县名称", dataType = "java.lang.String")
|
||||||
private String cnnm;
|
private String cnnm;
|
||||||
|
|
|
||||||
|
|
@ -12,5 +12,7 @@ public interface IQXWarningService extends IService<QXWarning> {
|
||||||
List<QXWarningVO> find();
|
List<QXWarningVO> find();
|
||||||
IPage<QXWarning> page(GroupWarningDto dto);
|
IPage<QXWarning> page(GroupWarningDto dto);
|
||||||
|
|
||||||
|
List<QXWarning> list(GroupWarningDto dto);
|
||||||
|
|
||||||
List<QXWarning> getWarnAndMsg(String stm, String etm);
|
List<QXWarning> getWarnAndMsg(String stm, String etm);
|
||||||
}
|
}
|
||||||
|
|
@ -24,6 +24,10 @@ public class QXWarningServiceImpl extends ServiceImpl<QXWarningMapper, QXWarnin
|
||||||
public IPage<QXWarning> page(GroupWarningDto dto) {
|
public IPage<QXWarning> page(GroupWarningDto dto) {
|
||||||
return getBaseMapper().page(dto.getPage(),dto);
|
return getBaseMapper().page(dto.getPage(),dto);
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<QXWarning> list(GroupWarningDto dto) {
|
||||||
|
return getBaseMapper().list(dto);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<QXWarning> getWarnAndMsg(String stm, String etm) {
|
public List<QXWarning> getWarnAndMsg(String stm, String etm) {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@
|
||||||
select * from ADDRESS_BOOK_OLD A
|
select * from ADDRESS_BOOK_OLD A
|
||||||
where 1=1 and
|
where 1=1 and
|
||||||
<if test="adnm != null and adnm != '' ">
|
<if test="adnm != null and adnm != '' ">
|
||||||
A.CNNM like CONCAT(#{adnm},'%')
|
A.CNNM like CONCAT('%',#{adnm},'%')
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue