From 70d2a5d0f9c6951b2d4cac954041ed73582ff7eb Mon Sep 17 00:00:00 2001
From: liujie <1793218484@qq.com>
Date: 星期一, 09 六月 2025 11:54:00 +0800
Subject: [PATCH] 6.9新增登录失败冻结逻辑

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java |   79 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 72 insertions(+), 7 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
index 7251db7..6041455 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComStreetServiceImpl.java
@@ -1,18 +1,20 @@
 package com.panzhihua.service_community.service.impl;
 
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.TreeSet;
+import java.util.*;
 import java.util.stream.Collectors;
 
 
 import javax.annotation.Resource;
 
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.panzhihua.common.model.dtos.community.building.BuildingDto;
+import com.panzhihua.common.model.dtos.community.large.AreaStreetDetail;
+import com.panzhihua.common.model.dtos.community.large.AreaStreetDetailResp;
+import com.panzhihua.common.model.dtos.community.large.SumAreaStreetResp;
+import com.panzhihua.common.model.dtos.partybuilding.QryReportResp;
 import com.panzhihua.common.model.vos.StreetVO;
 import com.panzhihua.common.model.vos.area.StreetAndBuildVO;
 import com.panzhihua.common.model.vos.community.bigscreen.ScreenStatics;
@@ -32,6 +34,7 @@
 import com.panzhihua.service_community.util.WxDataUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.ObjectUtils;
@@ -49,6 +52,7 @@
 import com.panzhihua.service_community.model.dos.ComActDO;
 import com.panzhihua.service_community.model.dos.ComStreetDO;
 import com.panzhihua.service_community.service.ComStreetService;
+import org.springframework.util.StringUtils;
 
 /**
  * @author: llming
@@ -70,6 +74,9 @@
 
     @Autowired
     private CommunityService communityService;
+
+    @Resource
+    private StringRedisTemplate stringRedisTemplate;
 
     /**
      * 新增社区
@@ -318,8 +325,23 @@
     public R getScreenStatics() {
         ScreenStatics screenStatics = comActDAO.getScreenStatics();
         WxDataUtil wxDataUtil=new WxDataUtil();
-        screenStatics.setDayUser(wxDataUtil.getDayUser());
-        screenStatics.setCountUser(wxDataUtil.getMonthUser());
+        //微信查询较慢 数据时有 时没有  缓存到 redis 里
+        //日 活跃
+        if(null != wxDataUtil.getDayUser()){
+            stringRedisTemplate.opsForValue().set("WxDataUtil_Day",String.valueOf(wxDataUtil.getDayUser()));
+            screenStatics.setDayUser(wxDataUtil.getDayUser());
+        }else {
+            Object obj = stringRedisTemplate.opsForValue().get("WxDataUtil_Day");
+            screenStatics.setDayUser(Integer.valueOf((String)obj));
+        }
+        //月 活跃
+        if(null != wxDataUtil.getMonthUser()){
+            stringRedisTemplate.opsForValue().set("WxDataUtil_Month",String.valueOf(wxDataUtil.getMonthUser()));
+            screenStatics.setCountUser(wxDataUtil.getMonthUser());
+        }else {
+            Object obj = stringRedisTemplate.opsForValue().get("WxDataUtil_Month");
+            screenStatics.setCountUser(Integer.valueOf((String)obj));
+        }
         return R.ok(screenStatics);
     }
 
@@ -358,7 +380,8 @@
 //            endTime=year.toString().concat("-12-31");
 //        }
         activityVO.setUnitCount(comActDAO.arriveUnit(belongTo));
-        R r = communityService.institutionalUnitServiceAnalysis(year, null, null, null, null, null, belongTo, null, null);
+        R r = communityService.institutionalUnitServiceAnalysis(year, null, null, null,
+                null, null, belongTo, null, null,null);
         Object data = r.getData();
         String jsonString = JSON.toJSONString(data);
         ActivityAnalysisVO activityAnalysisVO = JSON.parseObject(jsonString, ActivityAnalysisVO.class);
@@ -366,4 +389,46 @@
         return R.ok(activityVO);
     }
 
+    @Override
+    public SumAreaStreetResp sumAreaStreet() {
+        SumAreaStreetResp resp = comActDAO.sumAreaStreet();
+        return resp;
+    }
+
+    @Override
+    public AreaStreetDetail areaStreetDetail(String code, String type) {
+        //根据层级 查询 社区id
+        LambdaQueryWrapper<ComActDO> qry = new LambdaQueryWrapper<>();
+        if(type.equals("1")){// 1 查询 大区
+            qry.eq( !StringUtils.isEmpty(code),ComActDO::getAreaCode,code);
+        }
+        if(type.equals("2")){// 2 查询 街道
+            qry.eq( !StringUtils.isEmpty(code),ComActDO::getStreetId,code);
+        }
+        if(type.equals("3")){// 3 查询 小区
+            qry.eq( !StringUtils.isEmpty(code),ComActDO::getCommunityId,code);
+        }
+//        qry.eq(ComActDO::getAppId,"wx118de8a734d269f0");
+        List<ComActDO> doList = comActDAO.selectList(qry);
+        //解析 社区id
+        List<Long> ids = doList.stream().map(ComActDO::getCommunityId).collect(Collectors.toList());
+
+        AreaStreetDetail result = new AreaStreetDetail();
+        if(CollectionUtil.isNotEmpty(ids)){
+            //查询 街道相关信息
+            AreaStreetDetailResp village = comActDAO.selectVillage(ids,type);
+            result.setAreaStreetDetailResp(village);
+            //查询 人口相关数据
+            EventPopulationSpecialStatisticsVO eventResult = comActDAO.selectEvent(ids);
+            result.setEventPopulationVO(eventResult);
+        }
+        return result;
+    }
+
+
+    @Override
+    public List<QryReportResp> qryReport(String yearTime) {
+        List<QryReportResp> result = comActDAO.qryReport(yearTime);
+        return result;
+    }
 }

--
Gitblit v1.7.1