| | |
| | | @RestController |
| | | @SuppressWarnings("rawtypes") |
| | | public class WarningAnalyseController { |
| | | |
| | | @Autowired |
| | | private IWarningAnalyseService warningService; |
| | | |
| | | @Autowired |
| | | private IWarningAnalyseService warningService; |
| | | |
| | | private static ConcurrentHashMap<String, Object> cache = new ConcurrentHashMap<>(5); |
| | | |
| | |
| | | |
| | | public static final long CACHE_HOLD_TIME_24H = 24 * 60 * 60 * 1000L; |
| | | |
| | | //报警分析 |
| | | //报警分析 |
| | | |
| | | /** |
| | | * 1.查询当前时间的所有点位value值(以47.dat查询即可) |
| | | * 2.筛选大于yssh_bjyj中的jcbj字段的值 返回id+经纬度+value |
| | |
| | | @ApiOperationSupport(order = 1) |
| | | @ApiOperation(value = "获取实时报警", notes = "获取实时报警分析数据") |
| | | @GetMapping("/runAlarm") |
| | | public Result alarmAnalyse(){ |
| | | return Result.OK(warningService.getRunTimeAlarmAnalyse()); |
| | | public Result alarmAnalyse() { |
| | | return Result.OK(warningService.getRunTimeAlarmAnalyse()); |
| | | } |
| | | |
| | | |
| | | //预警分析 |
| | | |
| | | /** |
| | | * 1.查询当前时间的所有点位value值(以47.dat查询即可) |
| | | * 2.筛选大于yssh_bjyj中的jcyj字段的值 返回id+经纬度+value |
| | |
| | | @ApiOperationSupport(order = 2) |
| | | @ApiOperation(value = "获取实时预警", notes = "获取实时预警分析数据") |
| | | @GetMapping("/runWarning") |
| | | public Result warningAnalyse(){ |
| | | return Result.OK(warningService.getRunTimeWarningAnalyse()); |
| | | public Result warningAnalyse() { |
| | | return Result.OK(warningService.getRunTimeWarningAnalyse()); |
| | | } |
| | | |
| | | |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "本月预警、报警统计", notes = "本月预警、报警统计,返回参数alarmNumber对应值为本月报警数据量,参数warningNumber对应值为本月预警数据量") |
| | | @GetMapping("/monthCount") |
| | | public Result thisMonthCount(){ |
| | | return Result.OK(warningService.countThisMonthAlarmAndWarning()); |
| | | public Result thisMonthCount() { |
| | | return Result.OK(warningService.countThisMonthAlarmAndWarning()); |
| | | } |
| | | |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "每日预警、报警数量变化趋势", notes = "一周每日预警、报警数量统计,返回参数alarmDayCount为一周每日报警统计数量列表,参数warningDayCount为一周每日预警统计数量列表") |
| | | @GetMapping("/everydayCount") |
| | | public Result everydayCount(){ |
| | | return Result.OK(warningService.countEverydayAlarmAndWarning()); |
| | | public Result everydayCount() { |
| | | return Result.OK(warningService.countEverydayAlarmAndWarning()); |
| | | } |
| | | |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "三小时监测站点数据变化趋势", notes = "返回值为三小时监测站点监测数据,返回值为map集合,其中key为站点名称,value为list集合,保存每天监测数值数据") |
| | | @GetMapping("/locationDataChange") |
| | | public Result locationDataChange() { |
| | | //return Result.OK(warningService.selectEachLocationDataChange()); |
| | | |
| | | String key = dateFormat.format(new Date()); |
| | | Map<String, List<Double>> map = null; |
| | | String key = dateFormat.format(new Date()) + "_local"; |
| | | Map<String, List<Double>> map; |
| | | if (cache.containsKey(key)) { |
| | | map = (Map<String, List<Double>>) cache.get(key); |
| | | } else { |
| | | map = warningService.selectEachLocationDataChange(); |
| | | if (null != map && map.size() > 0) { |
| | | if (cache.size() > 0) { |
| | | cache.clear(); |
| | | } |
| | | cache.put(key, map); |
| | | } |
| | | } |
| | | |
| | | return Result.ok(map); |
| | | } |
| | | |
| | | |
| | | @ApiOperationSupport(order = 4) |
| | | @ApiOperation(value = "获取本月监测大数据站点最大值TOP10", notes = "获取本月监测大数据站点最大值TOP10数量列表") |
| | | @GetMapping("/monthTop10") |
| | | public Result monthTop10(){ |
| | | return Result.OK(warningService.selectThisMonthLocationValueDataTop10()); |
| | | public Result monthTop10() { |
| | | //return Result.OK(warningService.selectThisMonthLocationValueDataTop10()); |
| | | |
| | | String key = dateFormat.format(new Date()) + "_top10"; |
| | | List<Map<String, Object>> list; |
| | | if (cache.containsKey(key)) { |
| | | list = (List<Map<String, Object>>) cache.get(key); |
| | | } else { |
| | | list = warningService.selectThisMonthLocationValueDataTop10(); |
| | | if (null != list && list.size() > 0) { |
| | | cache.put(key, list); |
| | | } |
| | | } |
| | | |
| | | return Result.OK(list); |
| | | } |
| | | } |