|
@@ -315,6 +315,37 @@ public class SceneController {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @RequestMapping(value = "/selectAlarmLable", method = RequestMethod.GET)
|
|
|
+ @ResponseBody
|
|
|
+ @ApiOperation(value = "报警标签")
|
|
|
+ public AjaxMessage<List<Map<String,Object>>> selectAlarmLable(
|
|
|
+ @ApiParam(value = "设备或场景ID", required = true) @RequestParam(required = true) int id,
|
|
|
+ @ApiParam(value = "统计类型:0-按月统计,1-按年统计,2-自定义统计", required = true) @RequestParam(required = true) int type,
|
|
|
+ @ApiParam(value = "统计时间:月格式(yyyy-MM),年格式(yyyy),自定义统计时间开始日期", required = true) @RequestParam(required = true) String startDate,
|
|
|
+ @ApiParam(value = "统计时间:年月统计不用传入此参数,自定义统计截至日期", required = false) @RequestParam(required = false) String endDate) throws ParseException {
|
|
|
+ SceneEntity sceneEntity = new SceneEntity();
|
|
|
+ sceneEntity.setId(Long.parseLong(String.valueOf(id)));
|
|
|
+ switch (type) {
|
|
|
+ case 0:
|
|
|
+ startDate = String.format("%s-01", startDate);
|
|
|
+ endDate = subMonth(startDate, 1);
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ startDate = String.format("%s-01-01", startDate);
|
|
|
+ endDate = subYear(startDate, 1);
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ startDate = String.format("%s-01", startDate);
|
|
|
+ endDate = String.format("%s-01", endDate);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ List<Map<String,Object>> list = sceneService.selectAlarmLable(sceneEntity,startDate,endDate);
|
|
|
+ return new AjaxMessage<>(ResultStatus.OK,list);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 获取一个月有多少天
|