/getFBStats:允许时间段查询。

master
ForwithyNew 2024-06-11 14:50:42 +08:00
parent 3e2a38397d
commit 4146d1fc2a
1 changed files with 54 additions and 33 deletions

View File

@ -356,10 +356,13 @@ public class QXWarnController {
* @param dto
* @return
*/
@ApiOperation(value = "历史7天暴雨预警叫应信息统计")
@ApiOperation(value = "历史n天暴雨预警叫应信息统计")
@PostMapping("/getFBStats")
@Cacheable(value = THIS_REDIS_KEY, key = "#root.method.name+':'+#dto.toString()")
public ResultJson<FBStatsVO> getFeedBackStats(@RequestBody GroupWarningDto dto) {
String startTime = dto.getStartTime();
String endTime = dto.getEndTime();
if(Objects.isNull(startTime)&&Objects.isNull(endTime)){
//当前时间
Calendar startCalendarDay = Calendar.getInstance();
int year = startCalendarDay.get(Calendar.YEAR);
@ -397,10 +400,28 @@ public class QXWarnController {
// }
fbStatsVO = getCount3(data);
// System.out.println("周统计:"+weekWarnNum +"个");
}
return ResultJson.ok(fbStatsVO);
}
}else{
ApiDto searchDto = new ApiDto();
ArrayList<ApiDto.Filter> filter = Lists.newArrayList();
searchDto.setStartTime(startTime);
searchDto.setEndTime(endTime);
searchDto.setPageNumber(dto.getPageNumber());
searchDto.setPageSize(99999);
searchDto.setFilter(filter);
String searchstr = HttpUtil.sendPost("http://223.75.53.141:8000/shzh/met/zyqxfw/api/warning/getGroupWarning", JSON.toJSONString(searchDto));
JSONObject searchjson = JSON.parseObject(searchstr);
System.out.println("searchjson:"+searchjson);
FBStatsVO fbStatsVO = null;
if (searchjson != null && searchjson.getInteger("code") == HttpStatus.SC_OK) {
List<WarningData> data = searchjson.getJSONArray("data").toJavaList(WarningData.class);
fbStatsVO = getCount3(data);
return ResultJson.ok(fbStatsVO);
}
}
return null;
}
private FBStatsVO getCount3(List<WarningData> data){
int sum = 0;