|
@@ -0,0 +1,59 @@
|
|
|
+package com.ozs.web.controller.home;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import com.ozs.common.core.controller.BaseController;
|
|
|
+import com.ozs.common.core.domain.AjaxResult;
|
|
|
+import com.ozs.service.entity.MsgAlarm;
|
|
|
+import com.ozs.service.entity.vo.BaseCameraManagementVo;
|
|
|
+import com.ozs.service.service.BaseCameraManagementService;
|
|
|
+import com.ozs.service.service.MsgAlarmService;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author : sunhh
|
|
|
+ * @create 2023/3/7 14:34
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/home")
|
|
|
+public class HomeController extends BaseController {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BaseCameraManagementService baseCameraManagementService;
|
|
|
+ @Resource
|
|
|
+ private MsgAlarmService msgAlarmService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 统计数量
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "统计数量")
|
|
|
+ @GetMapping("/statisticsNum")
|
|
|
+ public AjaxResult statisticsNum() {
|
|
|
+ Map<String, Long> map = new HashMap<>();
|
|
|
+ // 相机数量
|
|
|
+ long countCamera = baseCameraManagementService.count();
|
|
|
+ // 累计报警次数
|
|
|
+ long countMsg = msgAlarmService.count();
|
|
|
+ // 解除报警
|
|
|
+ LambdaQueryWrapper<MsgAlarm> lwJC = new LambdaQueryWrapper<MsgAlarm>();
|
|
|
+ lwJC.eq(MsgAlarm::getIsLock, "1");
|
|
|
+ long countJC = msgAlarmService.count(lwJC);
|
|
|
+ // 未解除报警
|
|
|
+ LambdaQueryWrapper<MsgAlarm> lwWJC = new LambdaQueryWrapper<MsgAlarm>();
|
|
|
+ lwWJC.eq(MsgAlarm::getIsLock, "2");
|
|
|
+ long countWJC = msgAlarmService.count(lwWJC);
|
|
|
+ map.put("countCamera", countCamera);
|
|
|
+ map.put("countMsg", countMsg);
|
|
|
+ map.put("countJC", countJC);
|
|
|
+ map.put("countWJC", countWJC);
|
|
|
+ return AjaxResult.success(map);
|
|
|
+ }
|
|
|
+}
|