Browse Source

告警总数 当日告警数 当月告警数

lyq 11 months ago
parent
commit
4eba3deeef

+ 14 - 0
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/controller/CenterEventReportController.java

@@ -54,6 +54,20 @@ public class CenterEventReportController extends BaseController {
         return R.ok(centerEventReportService.getEventTotal(visuForestCloudMapVO));
     }
 
+    @ApiOperation("查询事件总数")
+    @PostMapping("/getTotalMore")
+    public R getTotalMore(@RequestBody VisuForestCloudMapVO visuForestCloudMapVO) {
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("total", centerEventReportService.getEventTotal(visuForestCloudMapVO));
+        visuForestCloudMapVO.setDiff(0L);// 当日
+        resultMap.put("day", centerEventReportService.getEventTotal(visuForestCloudMapVO));
+        LocalDate currentDate = LocalDate.now();
+        int dayOfMonth = currentDate.getDayOfMonth() - 1;
+        visuForestCloudMapVO.setDiff(Long.valueOf(dayOfMonth));// 当月
+        resultMap.put("month", centerEventReportService.getEventTotal(visuForestCloudMapVO));
+        return R.ok(resultMap);
+    }
+
     @ApiOperation("事件来源、类型统计")
     @PostMapping("/getEventSourceAndTypeStatistics")
     public R getEventSourceAndTypeStatistics(@RequestBody VisuForestCloudMapVO visuForestCloudMapVO) {

+ 3 - 0
src/main/resources/mapper/centereventteventcatalogue/CenterEventReportMapper.xml

@@ -15,6 +15,9 @@
         <if test="day != null and day != ''">
             and DATE_FORMAT(a.create_time,'%Y-%m-%d') = #{day}
         </if>
+        <if test="diff != null">
+            and DATEDIFF( now(), a.create_time ) &lt;= #{diff}
+        </if>
         <if test="eventTypeId != null and eventTypeId.length > 0">
             and event_type_xl in
             <foreach item="eventTypeId" collection="eventTypeId" open="(" separator="," close=")">