浏览代码

APP首页统计

LIVE_YE 4 月之前
父节点
当前提交
254dbca4d5

+ 39 - 0
ruoyi-admin/src/main/java/com/ruoyi/web/controller/statistics/StatisticsController.java

@@ -0,0 +1,39 @@
+package com.ruoyi.web.controller.statistics;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
+import com.ruoyi.system.domain.houseInfo.PropertyFee;
+import com.ruoyi.system.domain.suggestionFj.SuggestionFj;
+import com.ruoyi.system.service.IStatisticsService;
+import com.ruoyi.system.service.ISuggestionFjService;
+import org.springframework.beans.factory.annotation.Autowired;
+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.List;
+
+/**
+ * 首页统计Controller
+ *
+ * @author boman
+ * @date 2025-03-06
+ */
+@RestController
+@RequestMapping("/wuYe/statistics")
+public class StatisticsController {
+
+
+    @Autowired
+    private IStatisticsService statisticsService;
+    /**
+     * APP首页统计
+     */
+    @PreAuthorize("@ss.hasPermi('wuYe:statistics:num:app')")
+    @GetMapping("/num/app")
+    public AjaxResult numApp()
+    {
+        return statisticsService.numApp();
+    }
+}

+ 17 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/IStatisticsService.java

@@ -0,0 +1,17 @@
+package com.ruoyi.system.service;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+
+/**
+ * 首页统计Service接口
+ *
+ * @author boman
+ * @date 2025-03-06
+ */
+public interface IStatisticsService {
+
+    /**
+     * APP首页统计
+     */
+    AjaxResult numApp();
+}

+ 145 - 0
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/StatisticsServiceImpl.java

@@ -0,0 +1,145 @@
+package com.ruoyi.system.service.impl;
+
+import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.system.domain.checkPoint.CheckPointRecord;
+import com.ruoyi.system.domain.complaintSuggestion.ComplaintSuggestion;
+import com.ruoyi.system.domain.illegalParking.IllegalParking;
+import com.ruoyi.system.domain.propertyRepair.PropertyRepair;
+import com.ruoyi.system.mapper.CheckPointRecordMapper;
+import com.ruoyi.system.mapper.ComplaintSuggestionMapper;
+import com.ruoyi.system.mapper.IllegalParkingMapper;
+import com.ruoyi.system.mapper.PropertyRepairMapper;
+import com.ruoyi.system.service.IStatisticsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+/**
+ * 首页统计Service业务层处理
+ *
+ * @author boman
+ * @date 2025-03-06
+ */
+@Service
+public class StatisticsServiceImpl implements IStatisticsService {
+
+    @Autowired
+    private IllegalParkingMapper illegalParkingMapper;
+    @Autowired
+    private CheckPointRecordMapper checkPointRecordMapper;
+    @Autowired
+    private PropertyRepairMapper propertyRepairMapper;
+    @Autowired
+    private ComplaintSuggestionMapper complaintSuggestionMapper;
+
+
+    @Override
+    public AjaxResult numApp() {
+        String day = DateUtils.getDate();
+        String dayTime = DateUtils.getTime();
+        Map<String,Object> map = new HashMap<>();
+        //空闲车位
+        int kxcw = 0;
+        //空闲充电桩
+        int kxcdz = 0;
+        //进入车辆
+        int jrcl = 0;
+        //离开车辆
+        int lkcl = 0;
+        //外来车辆
+        int wlcl = 0;
+        //违停登记
+        int wtdj = 0;
+        //外来人员
+        int wlry = 0;
+        //进入人员
+        int jrry = 0;
+        //已巡更
+        int yxg = 0;
+        //未巡更
+        int wxg = 0;
+        //家政订单
+        int jzdd = 0;
+        //完成订单
+        int wcdd = 0;
+        //今日报修
+        int jrbx = 0;
+        //已派报修
+        int ypbx = 0;
+        //投诉建议
+        int tsjy = 0;
+        //已回投诉
+        int yhjy = 0;
+        // todo 空闲车位,空闲充电桩,进入车辆,离开车辆,外来车辆,外来人员,进入人员,家政订单,完成订单
+
+
+        //查询违停登记
+        Map<String, Object> params = new HashMap<>();
+        params.put("createTime",day);
+        IllegalParking illegalParking = new IllegalParking();
+        illegalParking.setParams(params);
+        List<IllegalParking> illegalParkings = illegalParkingMapper.selectIllegalParkingList(illegalParking);
+        if(illegalParkings!=null && illegalParkings.size()>0){
+            wtdj = illegalParkings.size();
+        }
+        //查询巡更
+        CheckPointRecord checkPointRecord = new CheckPointRecord();
+        checkPointRecord.setCheckTime(DateUtils.getNowDate());
+        List<CheckPointRecord> checkPointRecords = checkPointRecordMapper.selectCheckPointRecordList(checkPointRecord);
+        if(checkPointRecords!=null && checkPointRecords.size()>0){
+            Map<String, List<CheckPointRecord>> collects = checkPointRecords.stream().collect(Collectors.groupingBy(CheckPointRecord::getCheckStatus));
+            if(collects.containsKey("1")){
+                wxg = collects.get("1").size();
+            }
+            if(collects.containsKey("2")){
+                yxg = collects.get("2").size();
+            }
+        }
+
+        //查询报修
+        List<PropertyRepair> propertyRepairs = propertyRepairMapper.selectPropertyRepairListByTime(day, day);
+        if(propertyRepairs!=null && propertyRepairs.size()>0){
+            jrbx = propertyRepairs.size();
+            for (PropertyRepair propertyRepair : propertyRepairs) {
+                if(StringUtils.isNotEmpty(propertyRepair.getPhoneNumber())){
+                    ypbx++;
+                }
+            }
+        }
+        //查询投诉建议
+        ComplaintSuggestion complaintSuggestion = new ComplaintSuggestion();
+        complaintSuggestion.setParams(params);
+        List<ComplaintSuggestion> complaintSuggestions = complaintSuggestionMapper.selectComplaintSuggestionList(complaintSuggestion);
+        if(complaintSuggestions!=null && complaintSuggestions.size()>0){
+            tsjy = complaintSuggestions.size();
+            Map<String, List<ComplaintSuggestion>> suggestionCollect = complaintSuggestions.stream().collect(Collectors.groupingBy(ComplaintSuggestion::getStatus));
+            if(suggestionCollect.containsKey("2")){
+                yhjy = suggestionCollect.get("2").size();
+            }
+        }
+        map.put("wtdj",wtdj);
+        map.put("yxg",yxg);
+        map.put("wxg",wxg);
+        map.put("jrbx",jrbx);
+        map.put("ypbx",ypbx);
+        map.put("tsjy",tsjy);
+        map.put("yhjy",yhjy);
+        // todo 空闲车位,空闲充电桩,进入车辆,离开车辆,外来车辆,外来人员,进入人员,家政订单,完成订单
+        map.put("kxcw",kxcw);
+        map.put("kxcdz",kxcdz);
+        map.put("jrcl",jrcl);
+        map.put("lkcl",lkcl);
+        map.put("wlcl",wlcl);
+        map.put("wlry",wlry);
+        map.put("jrry",jrry);
+        map.put("jzdd",jzdd);
+        map.put("wcdd",wcdd);
+        return AjaxResult.success(map);
+    }
+}

+ 1 - 0
ruoyi-system/src/main/resources/mapper/system/ComplaintSuggestionMapper.xml

@@ -38,6 +38,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="type != null  and type != ''"> and type = #{type}</if>
             <if test="isPublic != null  and isPublic != ''"> and is_public = #{isPublic}</if>
             <if test="isDel != null  and isDel != ''"> and is_del = #{isDel}</if>
+            <if test="params.createTime != null  and params.createTime != ''"> AND date_format(create_time,'%Y%m%d') = date_format(#{params.createTime},'%Y%m%d')</if>
         </where>
     </select>
     

+ 0 - 0
ruoyi-system/src/main/resources/mapper/system/CommentContentMapper.xml → ruoyi-system/src/main/resources/mapper/system/IStatisticsService.xml