代码提交

master
徐杰盟 2024-06-21 11:45:49 +08:00
parent 827b7ee209
commit a24adf091d
6 changed files with 42 additions and 21 deletions

View File

@ -209,7 +209,7 @@ CREATE TABLE "FXKH_TXL"."QXWARNING"
"CONTENT" VARCHAR(500),
"WARNID" INTEGER,
"CTNM" VARCHAR(200),
"CNNM" VARCHAR(200),
"CNNM" VARCHAR(1000),
NOT CLUSTER PRIMARY KEY("ID")) STORAGE(ON "MAIN", CLUSTERBTR) ;
COMMENT ON TABLE "FXKH_TXL"."QXWARNING" IS '气象预警表';

View File

@ -142,7 +142,6 @@ public class QXWarnController {
*/
@ApiOperation(value = "气象预警-正在生效的预警信息")
@PostMapping("/getGroupWarning")
// @Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
public ResultJson<List<QXWarningVO>> getGroupWarning() {
return ResultJson.ok(service.find());
@ -242,7 +241,6 @@ public class QXWarnController {
*/
@ApiOperation(value = "确认处理完成")
@PostMapping("/confirmHandle")
@Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
public ResultJson<List<WarnDppleVO>> confirmHandle(
@RequestBody WarnMsgFB dto) {
//根据warnid和phone判断是否重复
@ -419,7 +417,7 @@ public class QXWarnController {
*/
@ApiOperation(value = "历史气象预警查询")
@PostMapping("/getHistoryWarning")
// @Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
@Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
public ResultJson<HistoryWarnsVO> getHistoryWarning(@RequestBody GroupWarningDto dto) {
// List<QXWarningVO> warnList = new ArrayList<>();
// HistoryWarnsVO historyWarnsVO = new HistoryWarnsVO();

View File

@ -23,7 +23,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@ -68,7 +67,6 @@ public class WarningController {
*/
@ApiOperation(value = "气象预警")
@PostMapping("/getGroupWarning")
@Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
public ResultJson<List<WarningListVo>> getGroupWarning(
@RequestBody GroupWarningDto dto) {
@ -146,7 +144,7 @@ public class WarningController {
*/
@ApiOperation(value = "历史气象预警统计")
@PostMapping("/getHistoryGroupWarning")
@Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
// @Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
public ResultJson<List<WarningHistoryListVo>> getHistoryGroupWarning(@RequestBody GroupWarningDto dto) {
ApiDto apiDto = new ApiDto();
@ -346,7 +344,8 @@ public class WarningController {
// 类型 只要暴雨
Map<String, List<WarningData.Warning>> types = v.stream()
.filter(o -> "暴雨".equals(o.getWarnSignalType()))
// .filter(o -> "暴雨".equals(o.getWarnSignalType()))
.filter(o -> "橙色".equals(o.getWarnSignalLevel()) || "红色".equals(o.getWarnSignalLevel()))
.collect(Collectors
.groupingBy(WarningData.Warning::getWarnSignalType, Collectors.toList()));
@ -437,6 +436,12 @@ public class WarningController {
for (AdcdTree adcdTree : tree) {
String adnm = adcdTree.getAdnm();
if ("恩施土家族苗族自治州".equals(adnm)){
adnm = "恩施州";
adcdTree.setAdnm(adnm);
}
List<AdcdTree> children = adcdTree.getChildren();
List<WarningHistoryListVo> vos = areaMap.remove(adnm);
@ -449,6 +454,9 @@ public class WarningController {
for (int i = 1; i < children.size(); i++) {
AdcdTree t = children.get(i);
String adnm1 = t.getAdnm();
if ("经济技术开发区(汉南区)".equals(adnm1)){
adnm1 = "武汉经济技术开发区";
}
List<WarningHistoryListVo> vos1 = areaMap.remove(adnm1);
if (CollectionUtils.isNotEmpty(vos1)) {
childList.addAll(vos1);
@ -456,13 +464,23 @@ public class WarningController {
}
}
vo.setAreaChild(childList);
respList.add(vo);
}
}
areaMap.keySet().forEach(s -> System.out.println("未匹配行政区划: " + s));
return respList;
}
// public static void main(String[] args) {
// GroupWarningDto dto = new GroupWarningDto();
// dto.setStartTime("2024-01-01 00:00:00");
// dto.setEndTime("2024-06-20 23:00:00");
// System.out.println(new WarningController().getHistoryGroupWarning(dto));
// }
}

View File

@ -2,6 +2,8 @@ package com.whdc.model.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
/**
* Description:
@ -10,6 +12,8 @@ import lombok.Data;
* @author XuSan
* @version 1.0
*/
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Data
public class GroupWarningDto extends FindPageDto{
@ -28,10 +32,4 @@ public class GroupWarningDto extends FindPageDto{
@ApiModelProperty(value = "级别")
private String warnSignalLevel;
@ApiModelProperty(value = "页数", dataType = "java.lang.Integer", example = "1")
private Integer pageNumber = 1;
@ApiModelProperty(value = "条数", dataType = "java.lang.Integer", example = "999")
private Integer pageSize = 999;
}

View File

@ -105,8 +105,15 @@ public class AdinfoServiceImpl extends ServiceImpl<AdinfoMapper, Adinfo> impleme
tree.add(adcdTree);
} else if ("000000000".equals(ad.substring(6))) { // 县
adcdTree.setAdlevel(2);
addTree(county, cityStr, adcdTree);
// 县级市
if (ad.contains("4290")){
adcdTree.setAdlevel(1);
addTree(city, provinceStr, adcdTree);
tree.add(adcdTree);
}else{
adcdTree.setAdlevel(2);
addTree(county, cityStr, adcdTree);
}
}
}

View File

@ -40,11 +40,11 @@ spring:
# Redis
redis:
database: 5
host: 10.42.6.75
# host: 127.0.0.1
# host: 10.42.6.75
host: 127.0.0.1
password:
# password: Whdc_890
port: 6379
# password:
password: Whdc_890
servlet:
multipart: