|
@@ -0,0 +1,43 @@
|
|
|
|
|
+package com.zksy.web.controller.mobile;
|
|
|
|
|
+
|
|
|
|
|
+import com.zksy.base.alarm.dto.MobileAlarmQuery;
|
|
|
|
|
+import com.zksy.base.alarm.service.AlarmOperationsService;
|
|
|
|
|
+import com.zksy.base.service.EquipmentBaseService;
|
|
|
|
|
+import com.zksy.common.core.domain.AjaxResult;
|
|
|
|
|
+import com.zksy.ops.dto.InspectTaskPageDTO;
|
|
|
|
|
+import com.zksy.ops.service.InspectTaskService;
|
|
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
+
|
|
|
|
|
+import java.util.LinkedHashMap;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+@RestController
|
|
|
|
|
+@RequestMapping("/api/mobile/office")
|
|
|
|
|
+@RequiredArgsConstructor
|
|
|
|
|
+@PreAuthorize("isAuthenticated()")
|
|
|
|
|
+public class MobileOfficeController {
|
|
|
|
|
+ private final EquipmentBaseService equipment;
|
|
|
|
|
+ private final AlarmOperationsService alarms;
|
|
|
|
|
+ private final InspectTaskService inspections;
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/summary")
|
|
|
|
|
+ public AjaxResult summary() {
|
|
|
|
|
+ Map<String, Long> result = new LinkedHashMap<>();
|
|
|
|
|
+ result.put("equipmentTotal", equipment.findMobileByPage(1, 1, null, null, null, null).getTotal());
|
|
|
|
|
+ result.put("equipmentOffline", equipment.findMobileByPage(1, 1, null, null, 0, null).getTotal());
|
|
|
|
|
+ result.put("equipmentAlarming", equipment.findMobileByPage(1, 1, null, null, null, 1).getTotal());
|
|
|
|
|
+ MobileAlarmQuery alarmQuery = new MobileAlarmQuery();
|
|
|
|
|
+ alarmQuery.setPageSize(1);
|
|
|
|
|
+ result.put("alarmPending", alarms.mobilePage(alarmQuery).getTotal());
|
|
|
|
|
+ result.put("alarmAddedToday", alarms.mobileTodayCount());
|
|
|
|
|
+ InspectTaskPageDTO inspectQuery = new InspectTaskPageDTO();
|
|
|
|
|
+ inspectQuery.setPageSize(1L);
|
|
|
|
|
+ inspectQuery.setStatus(0);
|
|
|
|
|
+ result.put("inspectPending", inspections.findMobileByPage(inspectQuery).getTotal());
|
|
|
|
|
+ return AjaxResult.success(result);
|
|
|
|
|
+ }
|
|
|
|
|
+}
|