LIVE_YE hace 2 meses
padre
commit
51c9cb63ee

+ 218 - 0
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/domain/model/AjaxResult.java

@@ -0,0 +1,218 @@
+package org.dromara.common.core.domain.model;
+
+
+import org.dromara.common.core.constant.HttpStatus;
+import org.dromara.common.core.utils.StringUtils;
+
+import java.util.HashMap;
+import java.util.Objects;
+
+/**
+ * 操作消息提醒
+ *
+ * @author ruoyi
+ */
+public class AjaxResult extends HashMap<String, Object>
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 状态码 */
+    public static final String CODE_TAG = "code";
+
+    /** 返回内容 */
+    public static final String MSG_TAG = "msg";
+
+    /** 数据对象 */
+    public static final String DATA_TAG = "data";
+
+    /**
+     * 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
+     */
+    public AjaxResult()
+    {
+    }
+
+    /**
+     * 初始化一个新创建的 AjaxResult 对象
+     *
+     * @param code 状态码
+     * @param msg 返回内容
+     */
+    public AjaxResult(int code, String msg)
+    {
+        super.put(CODE_TAG, code);
+        super.put(MSG_TAG, msg);
+    }
+
+    /**
+     * 初始化一个新创建的 AjaxResult 对象
+     *
+     * @param code 状态码
+     * @param msg 返回内容
+     * @param data 数据对象
+     */
+    public AjaxResult(int code, String msg, Object data)
+    {
+        super.put(CODE_TAG, code);
+        super.put(MSG_TAG, msg);
+        if (StringUtils.isNotNull(data))
+        {
+            super.put(DATA_TAG, data);
+        }
+    }
+
+    /**
+     * 返回成功消息
+     *
+     * @return 成功消息
+     */
+    public static AjaxResult success()
+    {
+        return AjaxResult.success("操作成功");
+    }
+
+    /**
+     * 返回成功数据
+     *
+     * @return 成功消息
+     */
+    public static AjaxResult success(Object data)
+    {
+        return AjaxResult.success("操作成功", data);
+    }
+
+    /**
+     * 返回成功消息
+     *
+     * @param msg 返回内容
+     * @return 成功消息
+     */
+    public static AjaxResult success(String msg)
+    {
+        return AjaxResult.success(msg, null);
+    }
+
+    /**
+     * 返回成功消息
+     *
+     * @param msg 返回内容
+     * @param data 数据对象
+     * @return 成功消息
+     */
+    public static AjaxResult success(String msg, Object data)
+    {
+        return new AjaxResult(HttpStatus.SUCCESS, msg, data);
+    }
+
+    /**
+     * 返回警告消息
+     *
+     * @param msg 返回内容
+     * @return 警告消息
+     */
+    public static AjaxResult warn(String msg)
+    {
+        return AjaxResult.warn(msg, null);
+    }
+
+    /**
+     * 返回警告消息
+     *
+     * @param msg 返回内容
+     * @param data 数据对象
+     * @return 警告消息
+     */
+    public static AjaxResult warn(String msg, Object data)
+    {
+        return new AjaxResult(HttpStatus.WARN, msg, data);
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @return 错误消息
+     */
+    public static AjaxResult error()
+    {
+        return AjaxResult.error("操作失败");
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @param msg 返回内容
+     * @return 错误消息
+     */
+    public static AjaxResult error(String msg)
+    {
+        return AjaxResult.error(msg, null);
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @param msg 返回内容
+     * @param data 数据对象
+     * @return 错误消息
+     */
+    public static AjaxResult error(String msg, Object data)
+    {
+        return new AjaxResult(HttpStatus.ERROR, msg, data);
+    }
+
+    /**
+     * 返回错误消息
+     *
+     * @param code 状态码
+     * @param msg 返回内容
+     * @return 错误消息
+     */
+    public static AjaxResult error(int code, String msg)
+    {
+        return new AjaxResult(code, msg, null);
+    }
+
+    /**
+     * 是否为成功消息
+     *
+     * @return 结果
+     */
+    public boolean isSuccess()
+    {
+        return Objects.equals(HttpStatus.SUCCESS, this.get(CODE_TAG));
+    }
+
+    /**
+     * 是否为警告消息
+     *
+     * @return 结果
+     */
+    public boolean isWarn()
+    {
+        return Objects.equals(HttpStatus.WARN, this.get(CODE_TAG));
+    }
+
+    /**
+     * 是否为错误消息
+     *
+     * @return 结果
+     */
+    public boolean isError()
+    {
+        return Objects.equals(HttpStatus.ERROR, this.get(CODE_TAG));
+    }
+
+    /**
+     * 方便链式调用
+     *
+     * @param key 键
+     * @param value 值
+     * @return 数据对象
+     */
+    @Override
+    public AjaxResult put(String key, Object value)
+    {
+        super.put(key, value);
+        return this;
+    }
+}

+ 14 - 0
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/DateUtils.java

@@ -298,4 +298,18 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
         }
     }
 
+    /**
+     * 获取上个月年月
+     * @return
+     */
+    public static String getLastMonth(){
+        // 获取当前日期
+        LocalDate currentDate = LocalDate.now();
+
+        // 获取当前年份和上一个月份的组合(不包含具体的日)
+        YearMonth lastMonthYearMonth = YearMonth.from(currentDate).minusMonths(1);
+
+        return lastMonthYearMonth.toString();
+    }
+
 }

+ 65 - 0
ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/utils/StringUtils.java

@@ -77,6 +77,71 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils {
         return !isNull(object);
     }
 
+    /**
+     * * 判断一个Collection是否为空, 包含List,Set,Queue
+     *
+     * @param coll 要判断的Collection
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Collection<?> coll)
+    {
+        return isNull(coll) || coll.isEmpty();
+    }
+
+    /**
+     * * 判断一个Collection是否非空,包含List,Set,Queue
+     *
+     * @param coll 要判断的Collection
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Collection<?> coll)
+    {
+        return !isEmpty(coll);
+    }
+
+    /**
+     * * 判断一个对象数组是否为空
+     *
+     * @param objects 要判断的对象数组
+     ** @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Object[] objects)
+    {
+        return isNull(objects) || (objects.length == 0);
+    }
+
+    /**
+     * * 判断一个对象数组是否非空
+     *
+     * @param objects 要判断的对象数组
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Object[] objects)
+    {
+        return !isEmpty(objects);
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     *
+     * @param map 要判断的Map
+     * @return true:为空 false:非空
+     */
+    public static boolean isEmpty(Map<?, ?> map)
+    {
+        return isNull(map) || map.isEmpty();
+    }
+
+    /**
+     * * 判断一个Map是否为空
+     *
+     * @param map 要判断的Map
+     * @return true:非空 false:空
+     */
+    public static boolean isNotEmpty(Map<?, ?> map)
+    {
+        return !isEmpty(map);
+    }
     /**
      * * 判断一个对象是否是数组类型(Java基本型别的数组)
      *

+ 79 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/controller/statistics/StatisticsController.java

@@ -0,0 +1,79 @@
+package org.dromara.controller.statistics;
+
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.domain.model.AjaxResult;
+import org.dromara.domain.residentInfo.ResidentInfo;
+import org.dromara.domain.staffManage.StaffManage;
+import org.dromara.service.IStatisticsService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.Map;
+
+/**
+ * 首页统计Controller
+ *
+ * @author boman
+ * @date 2025-03-06
+ */
+@RestController
+@RequestMapping("/wuYe/statistics")
+public class StatisticsController {
+
+
+    @Autowired
+    private IStatisticsService statisticsService;
+    /**
+     * APP首页统计
+     */
+    @SaCheckPermission("wuYe:statistics:num:app")
+    @GetMapping("/num/app")
+    public R<Map<String, Object>> numApp()
+    {
+        return statisticsService.numApp();
+    }
+
+
+
+    /**
+     * APP首页红点物业统计
+     */
+    @SaCheckPermission("wuYe:statistics:wuYeTips")
+    @PostMapping("/num/app/wuYeTips")
+    public R<Map<String, Object>> appWuYeTips(@RequestBody StaffManage staffManage)
+    {
+        return statisticsService.wuYeTips(staffManage);
+    }
+    /**
+     * APP首页红点业主统计
+     */
+    @SaCheckPermission("wuYe:statistics:yeZhuTips")
+    @PostMapping("/num/app/yeZhuTips")
+    public R<Map<String, Object>> appYeZhuTips(@RequestBody ResidentInfo residentInfo)
+    {
+        return statisticsService.yeZhuTips(residentInfo);
+    }
+
+    /**
+     * web车辆管控统计
+     */
+    @SaCheckPermission("wuYe:statistics:vehicleControl")
+    @GetMapping("/num/vehicleControl")
+    public AjaxResult vehicleControl()
+    {
+        return statisticsService.vehicleControl();
+    }
+
+
+    /**
+     * todo PC车辆进出统计
+     */
+    @SaCheckPermission("wuYe:statistics:num:car")
+    @GetMapping("/num/car")
+    public AjaxResult numCar()
+    {
+        return statisticsService.numCar();
+    }
+}

+ 4 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/mapper/HouseInfoMapper.java

@@ -4,6 +4,9 @@ package org.dromara.mapper;
 import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
 import org.dromara.domain.houseInfo.HouseInfo;
 import org.dromara.domain.houseInfo.vo.HouseInfoVo;
+import org.dromara.domain.residentInfo.ResidentInfo;
+
+import java.util.List;
 
 /**
  * 房屋信息Mapper接口
@@ -13,4 +16,5 @@ import org.dromara.domain.houseInfo.vo.HouseInfoVo;
  */
 public interface HouseInfoMapper extends BaseMapperPlus<HouseInfo, HouseInfoVo> {
 
+    List<ResidentInfo> selectHouseInfoListAndResidentInfo(ResidentInfo residentInfo);
 }

+ 2 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/mapper/IllegalParkingMapper.java

@@ -1,6 +1,7 @@
 package org.dromara.mapper;
 
 
+import org.apache.ibatis.annotations.Param;
 import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
 import org.dromara.domain.illegalParking.IllegalParking;
 import org.dromara.domain.illegalParking.vo.IllegalParkingVo;
@@ -13,4 +14,5 @@ import org.dromara.domain.illegalParking.vo.IllegalParkingVo;
  */
 public interface IllegalParkingMapper extends BaseMapperPlus<IllegalParking, IllegalParkingVo> {
 
+    int selectIllegalCount(@Param("createTime")String createTime);
 }

+ 1 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/mapper/ProprietorCarMapper.java

@@ -12,4 +12,5 @@ import org.dromara.domain.proprietorCar.vo.ProprietorCarVo;
  */
 public interface ProprietorCarMapper extends BaseMapperPlus<ProprietorCar, ProprietorCarVo> {
 
+    int selectProprietorCarCount(String residentPhone);
 }

+ 1 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/mapper/VisitorManageMapper.java

@@ -12,4 +12,5 @@ import org.dromara.domain.visitor.vo.VisitorManageVo;
  */
 public interface VisitorManageMapper extends BaseMapperPlus<VisitorManage, VisitorManageVo> {
 
+    int selectVisitorManageVehicleCount(String visitorTime);
 }

+ 39 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/service/IStatisticsService.java

@@ -0,0 +1,39 @@
+package org.dromara.service;
+
+
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.domain.model.AjaxResult;
+import org.dromara.domain.residentInfo.ResidentInfo;
+import org.dromara.domain.staffManage.StaffManage;
+
+import java.util.Map;
+
+/**
+ * 首页统计Service接口
+ *
+ * @author boman
+ * @date 2025-03-06
+ */
+public interface IStatisticsService {
+
+    /**
+     * APP首页统计
+     */
+    R<Map<String, Object>> numApp();
+
+    AjaxResult numCar();
+
+    /**
+     * APP首页红点统计
+     */
+    R<Map<String, Object>> wuYeTips(StaffManage staffManage);
+
+    /**
+     * APP首页红点业主统计
+     */
+    R<Map<String, Object>> yeZhuTips(ResidentInfo residentInfo);
+    /**
+     * web车辆管控统计
+     */
+    AjaxResult vehicleControl();
+}

+ 420 - 0
ruoyi-modules/ruoyi-wuye/src/main/java/org/dromara/service/impl/StatisticsServiceImpl.java

@@ -0,0 +1,420 @@
+package org.dromara.service.impl;
+
+
+import org.apache.commons.lang3.ObjectUtils;
+import org.dromara.common.core.domain.R;
+import org.dromara.common.core.domain.model.AjaxResult;
+import org.dromara.common.core.utils.DateUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.redis.utils.RedisUtils;
+import org.dromara.domain.checkPoint.bo.CheckPointRecordBo;
+import org.dromara.domain.checkPoint.vo.CheckPointRecordVo;
+import org.dromara.domain.complaintSuggestion.bo.ComplaintSuggestionBo;
+import org.dromara.domain.complaintSuggestion.vo.ComplaintSuggestionVo;
+import org.dromara.domain.illegalParking.bo.IllegalParkingBo;
+import org.dromara.domain.illegalParking.vo.IllegalParkingVo;
+import org.dromara.domain.propertyRepair.PropertyRepair;
+import org.dromara.domain.residentInfo.ResidentInfo;
+import org.dromara.domain.staffManage.StaffManage;
+import org.dromara.mapper.*;
+import org.dromara.service.ICheckPointRecordService;
+import org.dromara.service.IComplaintSuggestionService;
+import org.dromara.service.IIllegalParkingService;
+import org.dromara.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;
+
+import static org.dromara.common.core.constant.Constants.*;
+
+
+/**
+ * 首页统计Service业务层处理
+ *
+ * @author boman
+ * @date 2025-03-06
+ */
+@Service
+public class StatisticsServiceImpl implements IStatisticsService {
+
+    @Autowired
+    private IllegalParkingMapper illegalParkingMapper;
+    @Autowired
+    private IIllegalParkingService illegalParkingService;
+    @Autowired
+    private ICheckPointRecordService checkPointRecordService;
+    @Autowired
+    private PropertyRepairMapper propertyRepairMapper;
+    @Autowired
+    private IComplaintSuggestionService complaintSuggestionService;
+    @Autowired
+    private VisitorManageMapper visitorManageMapper;
+    @Autowired
+    private HouseInfoMapper houseInfoMapper;
+    @Autowired
+    private ProprietorCarMapper proprietorCarMapper;
+
+
+    @Override
+    public R<Map<String, Object>> 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);
+        IllegalParkingBo illegalParking = new IllegalParkingBo();
+        illegalParking.setParams(params);
+        List<IllegalParkingVo> illegalParkings = illegalParkingService.queryList(illegalParking);
+        if (illegalParkings != null && !illegalParkings.isEmpty()) {
+            wtdj = illegalParkings.size();
+        }
+        //查询巡更
+        CheckPointRecordBo checkPointRecord = new CheckPointRecordBo();
+        checkPointRecord.setCheckTime(DateUtils.getNowDate());
+        List<CheckPointRecordVo> checkPointRecords = checkPointRecordService.queryList(checkPointRecord);
+        if (checkPointRecords != null && !checkPointRecords.isEmpty()) {
+            Map<String, List<CheckPointRecordVo>> collects = checkPointRecords.stream().collect(Collectors.groupingBy(CheckPointRecordVo::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.isEmpty()) {
+            jrbx = propertyRepairs.size();
+            for (PropertyRepair propertyRepair : propertyRepairs) {
+                if (StringUtils.isNotEmpty(propertyRepair.getPhoneNumber())) {
+                    ypbx++;
+                }
+            }
+        }
+        //查询投诉建议
+        ComplaintSuggestionBo complaintSuggestion = new ComplaintSuggestionBo();
+        complaintSuggestion.setParams(params);
+        List<ComplaintSuggestionVo> complaintSuggestions = complaintSuggestionService.queryList(complaintSuggestion);
+        if (complaintSuggestions != null && !complaintSuggestions.isEmpty()) {
+            tsjy = complaintSuggestions.size();
+            Map<String, List<ComplaintSuggestionVo>> suggestionCollect = complaintSuggestions.stream().collect(Collectors.groupingBy(ComplaintSuggestionVo::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 R.ok(map);
+    }
+
+    /**
+     * APP首页红点统计物业
+     */
+    @Override
+    public R<Map<String, Object>> wuYeTips(StaffManage staffManage) {
+        Map<String, Object> map = new HashMap<>(3);
+        Long userId = staffManage.getUserId();
+        //物业报修未完成的数量 投诉建议未回复的数量 社区资讯未读数量
+        Object repairNum = RedisUtils.getCacheObject(PROPERTY_REPAIR_NO_ALL);
+        map.put("propertyRepair", 0);
+        if (ObjectUtils.isNotEmpty(repairNum)) {
+            map.put("propertyRepair", repairNum);
+        }
+        //投诉建议未回复的数量
+        Object complaintSuggestionNum = RedisUtils.getCacheObject(COMPLAINT_SUGGESTION_NO_ALL);
+        map.put("complaintSuggestion", 0);
+        if (ObjectUtils.isNotEmpty(repairNum)) {
+            map.put("complaintSuggestion", complaintSuggestionNum);
+        }
+        //查询社区资讯未读互动数量
+        map.put("commentInteractionUserCount", 0);
+        String commentInteractionUserCountKey = COMMENT_INTERACTION_USER_COUNT + userId;
+        Object commentInteractionUserCount = RedisUtils.getCacheObject(commentInteractionUserCountKey);
+        if (ObjectUtils.isNotEmpty(commentInteractionUserCount)) {
+            map.put("commentInteractionUserCount", commentInteractionUserCount);
+        }
+        return R.ok(map);
+    }
+
+    /**
+     * APP首页红点业主统计
+     */
+    @Override
+    public R<Map<String, Object>> yeZhuTips(ResidentInfo residentInfo) {
+        Map<String, Object> map = new HashMap<>(7);
+        Long userId = residentInfo.getUserId();
+        //物业报修未完成的数量 投诉建议未回复的数量 社区资讯未读数量
+        String userRepairKey = PROPERTY_REPAIR_NO + userId;
+        Object repairNum = RedisUtils.getCacheObject(userRepairKey);
+        map.put("propertyRepair", 0);
+        if (ObjectUtils.isNotEmpty(repairNum)) {
+            map.put("propertyRepair", repairNum);
+        }
+        //个人投诉建议未回复的数量
+        String userSuggestionKey = COMPLAINT_SUGGESTION_NO + userId;
+        Object complaintSuggestionNum = RedisUtils.getCacheObject(userSuggestionKey);
+        map.put("complaintSuggestion", 0);
+        if (ObjectUtils.isNotEmpty(repairNum)) {
+            map.put("complaintSuggestion", complaintSuggestionNum);
+        }
+        //未读互动的数量
+        //查询社区资讯未读互动数量
+        map.put("commentInteractionUserCount", 0);
+        String commentInteractionUserCountKey = COMMENT_INTERACTION_USER_COUNT + userId;
+        Object commentInteractionUserCount = RedisUtils.getCacheObject(commentInteractionUserCountKey);
+        if (ObjectUtils.isNotEmpty(commentInteractionUserCount)) {
+            map.put("commentInteractionUserCount", commentInteractionUserCount);
+        }
+        //点赞的数量
+        //获取记录社区资讯某个用户一共有多少个未读的互动(点赞,收藏,回复)的具体信息
+        String commentInteractionUserKey = COMMENT_INTERACTION_USER + userId;
+        Map<String, Object> commentInteractionUserMap = RedisUtils.getCacheMap(commentInteractionUserKey);
+        //点赞数量
+        int likeCount = 0;
+        //评论数量
+        int contentCount = 0;
+        if (commentInteractionUserMap != null && !commentInteractionUserMap.isEmpty()) {
+            // hkey = {targetType:targetId} targetType = 目标类型(1:资讯评论 2:资讯点赞 3:资讯收藏 4:评论回复 5:回复点赞)
+            for (String hKey : commentInteractionUserMap.keySet()) {
+                //找到所有点赞的数量targetType = 2|5
+                String type = hKey.split(":")[0];
+                if (type.equals(TWO) || type.equals(FIV)) {
+                    likeCount = likeCount + 1;
+                }
+                if (likeCount == 99) {
+                    break;
+                }
+            }
+            for (String hKey : commentInteractionUserMap.keySet()) {
+                //找到所有评论的数量targetType = 2|5
+                String type = hKey.split(":")[0];
+                if (type.equals(ONE) || type.equals(FOR)) {
+                    contentCount = contentCount + 1;
+                }
+                if (contentCount == 99) {
+                    break;
+                }
+            }
+
+        }
+        map.put("likeCount", likeCount);
+        map.put("contentCount", contentCount);
+
+        //我的房屋
+        int houseCount = 0;
+        List<ResidentInfo> residentInfos = houseInfoMapper.selectHouseInfoListAndResidentInfo(residentInfo);
+        if (residentInfos != null && residentInfos.size() > 0) {
+            houseCount = residentInfos.size();
+        }
+        map.put("houseCount", houseCount);
+        //我的车辆
+        map.put("carCount", proprietorCarMapper.selectProprietorCarCount(residentInfo.getResidentPhone()));
+        return R.ok(map);
+    }
+
+    /**
+     * web车辆管控统计
+     */
+    @Override
+    public AjaxResult vehicleControl() {
+        Map<String, Object> map = new HashMap<>();
+        // todo 空闲车位,空闲充电桩,进入车辆,离开车辆
+        //空闲车位数量
+        map.put("idlePlace", 0);
+        //空闲车位占比
+        map.put("idlePercentage", "25%");
+        //空闲充电桩数量
+        map.put("chargePlace", 0);
+        //空闲充电桩占比
+        map.put("chargePercentage", "25%");
+        //进入车辆
+        map.put("interCarNum", 0);
+        map.put("interCarStatus", UP);
+        map.put("interCarPercentage", "25.83%");
+        //离开车辆
+        map.put("outCarNum", 0);
+        map.put("outCarStatus", UP);
+        map.put("outCarPercentage", "25.83%");
+
+        //---------外来车辆------------
+        getVisitorCar(map);
+        //---------外来车辆结束------------
+        //---------违停登记------------
+        getIllegalCar(map);
+
+        //---------违停登记结束------------
+        return AjaxResult.success(map);
+    }
+
+    /**
+     * visitor_manage来访管理表表中的车辆
+     *
+     * @param map
+     * @return
+     */
+    public Map<String, Object> getVisitorCar(Map<String, Object> map) {
+        //查询当月来访车辆总数
+        int currentMonth = 0;
+        Object nowMonthRedis = RedisUtils.getCacheObject(NOW_MONTH_VISITOR_CAR + DateUtils.getMonth());
+        if (ObjectUtils.isNotEmpty(nowMonthRedis)) {
+            currentMonth = (int) nowMonthRedis;
+        }
+        //上月数据
+        int previousMonth = 0;
+        map.put("visitorNum", currentMonth);
+        map.put("visitorStatus", UP);
+        //查询上月月来访车辆总数
+        Object cacheObject = RedisUtils.getCacheObject(LAST_MONTH_VISITOR_CAR);
+        if (ObjectUtils.isNotEmpty(cacheObject)) {
+            previousMonth = Integer.parseInt(cacheObject.toString());
+        } else {
+            //查询数据库写入redis
+            previousMonth = visitorManageMapper.selectVisitorManageVehicleCount(DateUtils.getLastMonth());
+            RedisUtils.setCacheObject(LAST_MONTH_VISITOR_CAR, previousMonth);
+        }
+        //判断谁大
+        if (currentMonth < previousMonth) {
+            map.put("visitorStatus", DOWN);
+        } else if (currentMonth == previousMonth) {
+            map.put("visitorStatus", FLAT);
+        }
+        //计算百分比
+        map.put("visitorPercentage", getPercentageChange(currentMonth, previousMonth));
+        return map;
+    }
+
+
+    /**
+     * illegal_parking 违章停车登记表
+     *
+     * @param map
+     * @return
+     */
+    public Map<String, Object> getIllegalCar(Map<String, Object> map) {
+        //查询当月违停车辆总数
+        int currentMonth = 0;
+        Object nowMonthRedis = RedisUtils.getCacheObject(NOW_MONTH_ILLEGAL_CAR + DateUtils.getMonth());
+        if (ObjectUtils.isNotEmpty(nowMonthRedis)) {
+            currentMonth = (int) nowMonthRedis;
+        }
+        //上月数据
+        int previousMonth = 0;
+        map.put("illegalNum", currentMonth);
+        map.put("illegalStatus", UP);
+        //查询上月月违停车辆总数
+        Object cacheObject = RedisUtils.getCacheObject(LAST_MONTH_ILLEGAL_CAR);
+        if (ObjectUtils.isNotEmpty(cacheObject)) {
+            previousMonth = Integer.parseInt(cacheObject.toString());
+        } else {
+            //查询数据库写入redis
+            previousMonth = illegalParkingMapper.selectIllegalCount(DateUtils.getLastMonth());
+            RedisUtils.setCacheObject(LAST_MONTH_ILLEGAL_CAR, previousMonth);
+        }
+        //判断谁大
+        if (currentMonth < previousMonth) {
+            map.put("illegalStatus", DOWN);
+        } else if (currentMonth == previousMonth) {
+            map.put("illegalStatus", FLAT);
+        }
+        //计算百分比
+        map.put("illegalPercentage", getPercentageChange(currentMonth, previousMonth));
+
+        return map;
+    }
+
+
+    /**
+     * 两个数计算绝对值百分比
+     * 格式化为两位小数+百分号
+     *
+     * @param previousMonth 上月
+     * @param currentMonth  当月
+     * @return
+     */
+    public String getPercentageChange(int currentMonth, int previousMonth) {
+        double percentageChange;
+
+        if (previousMonth == 0) {
+            // 处理上月为0的特殊情况
+            percentageChange = (currentMonth == 0)
+                    ? 0.0          // 两月都为0 → 0%变化
+                    : 100.0;       // 上月为0且本月非0 → 视为100%增长
+        } else {
+            // 常规计算并取绝对值确保正数
+            double change = currentMonth - previousMonth;
+            percentageChange = Math.abs((change / previousMonth) * 100);
+        }
+        return String.format("%.2f%%", percentageChange);
+    }
+
+    @Override
+    public AjaxResult numCar() {
+        Map<String,Object> map = new HashMap<>();
+        //总数
+        int zs = 1237;
+        //外来
+        int wl = 396;
+        //内部
+        int nb = 841;
+        map.put("zs",zs);
+        map.put("wl",wl);
+        map.put("nb",nb);
+        return AjaxResult.success(map);
+    }
+}

+ 113 - 0
ruoyi-modules/ruoyi-wuye/src/main/resources/mapper/wuYe/HouseInfoMapper.xml

@@ -4,4 +4,117 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.dromara.mapper.HouseInfoMapper">
 
+    <resultMap type="org.dromara.domain.houseInfo.HouseInfo" id="HouseInfoResult">
+        <result property="houseId"    column="house_id"    />
+        <result property="ownerName"    column="owner_name"    />
+        <result property="location"    column="location"    />
+        <result property="rightType"    column="right_type"    />
+        <result property="area"    column="area"    />
+        <result property="documentNumber"    column="document_number"    />
+        <result property="propertyUnitNumber"    column="property_unit_number"    />
+        <result property="coOwnership"    column="co_ownership"    />
+        <result property="usageType"    column="usage_type"    />
+        <result property="usagePeriod"    column="usage_period"    />
+        <result property="registrationDate"    column="registration_date"    />
+        <result property="coOwner"    column="co_owner"    />
+        <result property="detailedAddress"    column="detailed_address"    />
+        <result property="hasParkingSpace"    column="has_parking_space"    />
+        <result property="parkingNumber"    column="parking_number"    />
+        <result property="communityName"    column="community_name"    />
+        <result property="houseStatus"    column="house_status"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+        <collection property="residentInfoList" javaType="java.util.List" resultMap="ResidentInfoResult"  />
+    </resultMap>
+
+    <resultMap type="org.dromara.domain.houseInfo.HouseInfo" id="HouseInfoResultResident">
+        <result property="houseId"    column="h_house_id"    />
+        <result property="ownerName"    column="owner_name"    />
+        <result property="location"    column="location"    />
+        <result property="rightType"    column="right_type"    />
+        <result property="area"    column="area"    />
+        <result property="documentNumber"    column="document_number"    />
+        <result property="propertyUnitNumber"    column="property_unit_number"    />
+        <result property="coOwnership"    column="co_ownership"    />
+        <result property="usageType"    column="usage_type"    />
+        <result property="usagePeriod"    column="usage_period"    />
+        <result property="registrationDate"    column="registration_date"    />
+        <result property="coOwner"    column="co_owner"    />
+        <result property="detailedAddress"    column="h_detailed_address"    />
+        <result property="hasParkingSpace"    column="has_parking_space"    />
+        <result property="parkingNumber"    column="parking_number"    />
+        <result property="communityName"    column="community_name"    />
+        <result property="houseStatus"    column="house_status"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+        <collection property="residentInfoList" javaType="java.util.List" resultMap="ResidentInfoResult"  />
+    </resultMap>
+
+    <resultMap type="org.dromara.domain.residentInfo.ResidentInfo" id="ResidentInfoResult">
+        <result property="residentId"    column="resident_id"    />
+        <result property="houseId"    column="house_id"    />
+        <result property="userId"    column="user_id"    />
+        <result property="detailedAddress"    column="detailed_address"    />
+        <result property="residentName"    column="resident_name"    />
+        <result property="residentIdCard"    column="resident_id_card"    />
+        <result property="residentBirthday"    column="resident_birthday"    />
+        <result property="residentPhone"    column="resident_phone"    />
+        <result property="residentGender"    column="resident_gender"    />
+        <result property="residentRelationship"    column="resident_relationship"    />
+        <result property="isHouseholder"    column="is_householder"    />
+        <result property="isTenant"    column="is_tenant"    />
+        <result property="residentEmployer"    column="resident_employer"    />
+        <result property="specialType"    column="special_type"    />
+        <result property="residentHobby"    column="resident_hobby"    />
+        <result property="residentAppearance"    column="resident_appearance"    />
+        <result property="idCardFront"    column="id_card_front"    />
+        <result property="idCardBack"    column="id_card_back"    />
+        <result property="idCardAddress"    column="id_card_address"    />
+        <result property="facePhoto"    column="face_photo"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <select id="selectHouseInfoListAndResidentInfo" resultType="org.dromara.domain.residentInfo.ResidentInfo">
+        SELECT
+        h.house_id AS h_house_id,
+        h.detailed_address AS h_detailed_address,
+        h.house_status,
+        h.location,
+        h.owner_name,
+        h.area,
+        h.has_parking_space,
+        h.community_name,
+        r.resident_id,
+        r.resident_name,
+        r.resident_id_card,
+        r.resident_gender,
+        r.resident_relationship,
+        r.is_householder,
+        r.is_tenant,
+        r.resident_appearance
+        FROM
+        house_info h
+        left JOIN
+        resident_info r on h.house_id = r.house_id
+        <where>
+            <if test="residentName != null  and residentName != ''"> and r.resident_name like concat('%', #{residentName}, '%')</if>
+            <if test="residentAppearance != null  and residentAppearance != ''"> and r.resident_appearance = #{residentAppearance}</if>
+            <if test="userId != null  and userId != ''"> and r.user_id = #{userId}</if>
+            <if test="houseId != null"> and h.house_id = #{houseId}</if>
+            <if test="residentPhone != null"> and r.resident_phone = #{residentPhone}</if>
+            <if test="houseStatus != null"> and h.house_status = #{houseStatus}</if>
+            <if test="detailedAddress != null"> and h.detailed_address = #{detailedAddress}</if>
+        </where>
+        order by h.create_time DESC
+    </select>
 </mapper>

+ 27 - 0
ruoyi-modules/ruoyi-wuye/src/main/resources/mapper/wuYe/IllegalParkingMapper.xml

@@ -4,4 +4,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.dromara.mapper.IllegalParkingMapper">
 
+    <resultMap type="org.dromara.domain.illegalParking.IllegalParking" id="IllegalParkingResult">
+        <result property="illegalParkingId"    column="illegal_parking_id"    />
+        <result property="plateNumber"    column="plate_number"    />
+        <result property="portalId"    column="portal_id"    />
+        <result property="visitPortal"    column="visit_portal"    />
+        <result property="mobileNumber"    column="mobile_number"    />
+        <result property="visitName"    column="visit_name"    />
+        <result property="illegalPhoto"    column="illegal_photo"    />
+        <result property="isBlack"    column="is_black"    />
+        <result property="carType"    column="car_type"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectIllegalParkingVo">
+        select illegal_parking_id, plate_number, car_type,portal_id, visit_portal, mobile_number, visit_name, illegal_photo, is_black, create_by, create_time, update_by, update_time, remark from illegal_parking
+    </sql>
+
+    <select id="selectIllegalCount" resultType="java.lang.Integer">
+        SELECT COUNT(1) from illegal_parking
+        <where>
+            <if test="createTime != null  and createTime != ''"> AND date_format(create_time,'%Y%m') = date_format(#{createTime},'%Y%m')</if>
+        </where>
+    </select>
 </mapper>

+ 31 - 0
ruoyi-modules/ruoyi-wuye/src/main/resources/mapper/wuYe/ProprietorCarMapper.xml

@@ -4,4 +4,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.dromara.mapper.ProprietorCarMapper">
 
+    <resultMap type="org.dromara.domain.proprietorCar.ProprietorCar" id="ProprietorCarResult">
+        <result property="carId"    column="car_id"    />
+        <result property="houseId"    column="house_id"    />
+        <result property="detailedAddress"    column="detailed_address"    />
+        <result property="userId"    column="user_id"    />
+        <result property="userName"    column="user_name"    />
+        <result property="residentPhone"    column="resident_phone"    />
+        <result property="plateNumber"    column="plate_number"    />
+        <result property="vehicleBrand"    column="vehicle_brand"    />
+        <result property="vehicleType"    column="vehicle_type"    />
+        <result property="vehicleEnergy"    column="vehicle_energy"    />
+        <result property="vehicleColour"    column="vehicle_colour"    />
+        <result property="engineNumber"    column="engine_number"    />
+        <result property="identificationNumber"    column="identification_number"    />
+        <result property="registrationDate"    column="registration_date"    />
+        <result property="issueDate"    column="issue_date"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectProprietorCarVo">
+        select car_id, house_id, detailed_address, user_id, user_name,vehicle_energy, resident_phone, plate_number, vehicle_brand, vehicle_type, vehicle_colour, engine_number, identification_number, registration_date, issue_date, create_by, create_time, update_by, update_time, remark from proprietor_car
+    </sql>
+    <select id="selectProprietorCarCount" resultType="java.lang.Integer">
+        select count(*) from proprietor_car where  resident_phone = #{residentPhone}
+    </select>
+
+
 </mapper>

+ 32 - 0
ruoyi-modules/ruoyi-wuye/src/main/resources/mapper/wuYe/VisitorManageMapper.xml

@@ -4,4 +4,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="org.dromara.mapper.VisitorManageMapper">
 
+    <resultMap type="org.dromara.domain.visitor.VisitorManage" id="VisitorManageResult">
+        <result property="visitorManageId"    column="visitor_manage_id"    />
+        <result property="portalId"    column="portal_id"    />
+        <result property="houseAddress"    column="house_address"    />
+        <result property="name"    column="name"    />
+        <result property="num"    column="num"    />
+        <result property="reason"    column="reason"    />
+        <result property="mobileNumber"    column="mobile_number"    />
+        <result property="isCar"    column="is_car"    />
+        <result property="plateNumber"    column="plate_number"    />
+        <result property="reserveTime"    column="reserve_time"    />
+        <result property="visitorTime"    column="visitor_time"    />
+        <result property="status"    column="status"    />
+        <result property="photo"    column="photo"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="remark"    column="remark"    />
+    </resultMap>
+
+    <sql id="selectVisitorManageVo">
+        select visitor_manage_id, portal_id, house_address, name, num, reason, mobile_number, is_car, plate_number, reserve_time, visitor_time, status, photo, create_by, create_time, update_by, update_time, remark from visitor_manage
+    </sql>
+
+    <select id="selectVisitorManageVehicleCount" resultType="java.lang.Integer">
+        select count(1) from visitor_manage
+        <where>
+            is_car = 'Y'
+            <if test="visitorTime != null "> and date_format(visitor_time,'%Y%m')  = date_format(#{visitorTime},'%Y%m')</if>
+        </where>
+    </select>
 </mapper>