Quellcode durchsuchen

Merge branch 'master' of http://124.70.58.209:3000/ytrd-project-management/VehicleMonitor

wyyay vor 1 Jahr
Ursprung
Commit
eae47601a4

+ 5 - 0
business-service/src/main/java/com/ozs/entity/BaseCameraManagement.java

@@ -166,4 +166,9 @@ public class BaseCameraManagement extends BaseEntity implements Serializable {
      */
     @TableField(exist = false)
     private Integer isStartRecording;
+
+    /**
+     * 是否在线 0.离线 1.在线
+     */
+    private Integer online;
 }

+ 5 - 0
business-service/src/main/java/com/ozs/entity/BaseTerminal.java

@@ -93,4 +93,9 @@ public class BaseTerminal implements Serializable {
      */
     @Excel(name = "备注")
     private String remark;
+
+    /**
+     * 是否在线 0.离线 1.在线
+     */
+    private Integer online;
 }

+ 3 - 0
business-service/src/main/java/com/ozs/mapper/BaseCameraManagementMapper.java

@@ -7,6 +7,7 @@ import com.ozs.entity.vo.MsgAlarmVo;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -22,4 +23,6 @@ public interface BaseCameraManagementMapper extends BaseMapper<BaseCameraManagem
     List<BaseCameraManagement> selectCameraManagementList(BaseCameraManagementVo baseCameraManagementVo);
 
     Integer countCamera(MsgAlarmVo msgAlarmVo);
+
+    Map<String, Integer> getMessageStatisticsCamera();
 }

+ 2 - 0
business-service/src/main/java/com/ozs/service/BaseCameraManagementService.java

@@ -37,4 +37,6 @@ public interface BaseCameraManagementService extends IService<BaseCameraManageme
     IPage<BaseCameraManagement> queryPage(BaseCameraManagementVo baseCameraManagementVo);
 
     List<BaseCameraManagement> baseCameraManagementList(BaseCameraManagementVo baseCameraManagementVo);
+
+    Map<String, Integer> getMessageStatisticsCamera();
 }

+ 5 - 0
business-service/src/main/java/com/ozs/service/impl/BaseCameraManagementServiceImpl.java

@@ -341,4 +341,9 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
     public List<BaseCameraManagement> baseCameraManagementList(BaseCameraManagementVo baseCameraManagementVo) {
         return baseCameraManagementMapper.selectCameraManagementList(baseCameraManagementVo);
     }
+
+    @Override
+    public Map<String, Integer> getMessageStatisticsCamera() {
+        return baseCameraManagementMapper.getMessageStatisticsCamera();
+    }
 }

+ 7 - 0
business-service/src/main/resources/mapper/BaseCameraManagementMapper.xml

@@ -33,4 +33,11 @@
     <select id="countCamera" parameterType="com.ozs.entity.vo.MsgAlarmVo" resultType="java.lang.Integer">
         select count(id) from base_camera_management
     </select>
+
+    <select id="getMessageStatisticsCamera" resultType="java.util.Map">
+        select count(id) countAll,
+            SUM(CASE online WHEN '0' THEN 1 ELSE 0 end) AS offline,
+            SUM(CASE online WHEN '1' THEN 1 ELSE 0 end) AS online
+        from base_camera_management
+    </select>
 </mapper>

+ 25 - 10
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/DataStatisticController.java

@@ -53,6 +53,21 @@ public class DataStatisticController extends BaseController {
     private BaseCameraManagementService baseCameraManagementService;
     @Autowired
     private BaseTerminalService baseTerminalService;
+
+    /**
+     * 首页-信息统计
+     *
+     * @param
+     * @return
+     */
+    @ApiOperation(value = "查询相机总数,在线离线数量;车载终端总数,在线离线数量")
+    @PostMapping("/getMessageStatistics")
+    // @Log(title = "查询相机总数,在线离线数量;车载终端总数,在线离线数量", businessType = BusinessType.SELECT)
+    public AjaxResult getMessageStatistics() {
+        Map<String, Integer> cameraCount = baseCameraManagementService.getMessageStatisticsCamera();
+        return AjaxResult.success(cameraCount);
+    }
+
     /**
      * web数据统计
      *
@@ -182,12 +197,12 @@ public class DataStatisticController extends BaseController {
         Integer sum = list.stream().mapToInt((x) -> Integer.parseInt(String.valueOf(x.getFrequency()))).sum();
         NumberFormat numberFormat = NumberFormat.getPercentInstance();
         numberFormat.setMinimumFractionDigits(2);
-        if (!CollectionUtils.isEmpty(list) && list.size()!= 0){
+        if (!CollectionUtils.isEmpty(list) && list.size() != 0) {
             list.forEach(l -> {
                 if (!ObjectUtils.isEmpty(l.getAlarmType())) {
                     l.setAlarmTypeValue(dictDataService.selectDictLabel("sys_alarm_type", String.valueOf(l.getAlarmType())));
                 }
-                    l.setPercent(numberFormat.format(l.getFrequency()*1.0 / sum));
+                l.setPercent(numberFormat.format(l.getFrequency() * 1.0 / sum));
             });
         }
         return AjaxResult.success(list);
@@ -240,7 +255,7 @@ public class DataStatisticController extends BaseController {
             @ApiImplicitParam(paramType = "query", name = "currentYear", value = "当前年份"),
             @ApiImplicitParam(paramType = "query", name = "currentMonth", value = "当前月份")
     })
-    public void alarmTypeAreaCountExport(HttpServletResponse response,@RequestBody AlarmStatisticResVo alarmStatisticResVo) {
+    public void alarmTypeAreaCountExport(HttpServletResponse response, @RequestBody AlarmStatisticResVo alarmStatisticResVo) {
         List<AlarmFreqArea> list = msgAlarmService.alarmTypeAreaCount(alarmStatisticResVo.getRailwayCode(), alarmStatisticResVo.getCurrentYear(),
                 alarmStatisticResVo.getCurrentMonth());
         if (!CollectionUtils.isEmpty(list) && Objects.nonNull(list.get(0))) {
@@ -349,20 +364,20 @@ public class DataStatisticController extends BaseController {
         Long alarmNum = msgAlarmService.getAlarmNum();
         Long vehicleNum = baseVehicleService.count();
         QueryWrapper<BaseTerminal> wrapper = new QueryWrapper<BaseTerminal>();
-        wrapper.lambda().eq(BaseTerminal::getStatus,1);
-        Long terminalNum= baseTerminalService.count();
+        wrapper.lambda().eq(BaseTerminal::getStatus, 1);
+        Long terminalNum = baseTerminalService.count();
         Long cameraNum = baseCameraManagementService.count();
-        DataStatisticNum dataStatisticNum =new DataStatisticNum();
-        if(!ObjectUtils.isEmpty(alarmNum)){
+        DataStatisticNum dataStatisticNum = new DataStatisticNum();
+        if (!ObjectUtils.isEmpty(alarmNum)) {
             dataStatisticNum.setAlarmNum(alarmNum);
         }
-        if(!ObjectUtils.isEmpty(vehicleNum)){
+        if (!ObjectUtils.isEmpty(vehicleNum)) {
             dataStatisticNum.setVehicleNum(vehicleNum);
         }
-        if(!ObjectUtils.isEmpty(terminalNum)){
+        if (!ObjectUtils.isEmpty(terminalNum)) {
             dataStatisticNum.setTerminalNum(terminalNum);
         }
-        if(!ObjectUtils.isEmpty(cameraNum)){
+        if (!ObjectUtils.isEmpty(cameraNum)) {
             dataStatisticNum.setCameraNum(cameraNum);
         }
         return AjaxResult.success(dataStatisticNum);