From 43f0578e80af82ecae6c61b51bd0539c6b960603 Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期二, 16 八月 2022 19:08:32 +0800
Subject: [PATCH] 服务范围优化

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ServiceStaticDTO.java                               |    2 
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceDetailStaticsVO.java                          |   32 +++
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceStaticsVO.java                                |    2 
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActSignDO.java                    |    4 
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActActivityMapper.xml                                              |   12 +
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCircleAppDTO.java                     |    3 
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActRegistDO.java                  |    5 
 springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java                                                  |    1 
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml                                      |  406 ++++++++++++++++++++++++++++++++++------
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java                  |   19 +
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java |  109 +++++++---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/SignactivityVO.java                                 |    2 
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java       |    3 
 13 files changed, 504 insertions(+), 96 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
index b840f90..9d79434 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/applets/src/main/java/com/panzhihua/applets/api/NeighborApi.java
@@ -55,6 +55,7 @@
         if (loginUserInfo != null) {
             neighborCircleAppDTO.setPhone(loginUserInfo.getPhone());
             neighborCircleAppDTO.setUserId(loginUserInfo.getUserId());
+            neighborCircleAppDTO.setCheckUnitId(loginUserInfo.getCheckUnitId());
         }
         return communityService.pageRelationList(neighborCircleAppDTO);
     }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCircleAppDTO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCircleAppDTO.java
index 7074a11..6c24e02 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCircleAppDTO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ComActNeighborCircleAppDTO.java
@@ -52,6 +52,9 @@
     private Integer orderType;
     @ApiModelProperty("清单状态")
     private Integer status;
+
+    @ApiModelProperty(value = "单位id", hidden = true)
+    private Long checkUnitId;
     /**
      * 使用类型(1.邻里圈 2.问题清单 3.需求清单)
      */
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ServiceStaticDTO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ServiceStaticDTO.java
index 34732af..2c50a22 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ServiceStaticDTO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/dtos/neighbor/ServiceStaticDTO.java
@@ -16,4 +16,6 @@
     private String phone;
     @ApiModelProperty("年份")
     private String year;
+    @ApiModelProperty("服务方式(1.承接清单 2.单位参与社区活动 3.报到服务活动 4.党员参与社区活动)")
+    private Integer serviceType;
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/SignactivityVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/SignactivityVO.java
index f104d98..a2a491c 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/SignactivityVO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/community/SignactivityVO.java
@@ -29,6 +29,8 @@
     private Long activityId;
     @ApiModelProperty(value = "当前登录用户id", hidden = true)
     private Long userId;
+    @ApiModelProperty(value = "单位id(党员以单位名义报名社区活动)")
+    private Long checkUnitId;
     @ApiModelProperty("取消原因")
     private String reason;
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceDetailStaticsVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceDetailStaticsVO.java
new file mode 100644
index 0000000..360f485
--- /dev/null
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceDetailStaticsVO.java
@@ -0,0 +1,32 @@
+package com.panzhihua.common.model.vos.neighbor;
+
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @title: ServiceDetailStaticsVO
+ * @projectName:
+ * @description: 服务明细
+ * @author: hans
+ * @date: 2022/08/15 9:53
+ */
+@Data
+@ApiModel("服务明细")
+public class ServiceDetailStaticsVO {
+    @ApiModelProperty("关联id")
+    @JsonSerialize(using = ToStringSerializer.class)
+    private Long serviceId;
+    @ApiModelProperty("服务时长")
+    private Integer serviceTime;
+    @ApiModelProperty("服务时间")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date serviceAt;
+    @ApiModelProperty("服务方式(1.承接清单 2.单位参与社区活动 3.报到服务活动 4.党员参与社区活动)")
+    private Integer serviceType;
+}
diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceStaticsVO.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceStaticsVO.java
index 6c1cf48..697ead8 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceStaticsVO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/model/vos/neighbor/ServiceStaticsVO.java
@@ -23,5 +23,7 @@
     private List<ComActActivityVO> serviceActivityList;
     @ApiModelProperty("单位活动列表")
     private List<ComActActivityVO> workActivityList;
+    @ApiModelProperty("服务明细列表")
+    private List<ServiceDetailStaticsVO> serviceDetailStaticsList;
 }
 
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java
index 7fcb827..20af7cd 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComActNeighborCircleDAO.java
@@ -173,4 +173,23 @@
      * @return
      */
     IPage<ComActNeighborCircleAppVO> pageRelationList(@Param("userPage") Page userPage, @Param("neighborCircleAppDTO") ComActNeighborCircleAppDTO neighborCircleAppDTO);
+
+    /**
+     * 单位获取服务明细
+     * @param checkUnitId
+     * @param date
+     * @param serviceType
+     * @return
+     */
+    List<ServiceDetailStaticsVO> selectServiceDetailList(@Param("checkUnitId") Long checkUnitId, @Param("date") String date, @Param("serviceType") Integer serviceType);
+
+    /**
+     * 个人获取服务明细
+     * @param checkUnitId
+     * @param phone
+     * @param date
+     * @param serviceType
+     * @return
+     */
+    List<ServiceDetailStaticsVO> selectServiceDetailListForPersonal(@Param("checkUnitId") Long checkUnitId, @Param("phone") String phone, @Param("date") String date, @Param("serviceType") Integer serviceType);
 }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActRegistDO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActRegistDO.java
index d07113b..5e2cd0e 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActRegistDO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActRegistDO.java
@@ -82,4 +82,9 @@
      * 以什么身份报名(1.居民 2.党员 3.志愿者
      */
     private Integer signIdentity;
+
+    /**
+     * 单位id(党员以单位名义报名社区活动)
+     */
+    private Long checkUnitId;
 }
\ No newline at end of file
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActSignDO.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActSignDO.java
index 4ffe754..bae66d8 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActSignDO.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/model/dos/ComActActSignDO.java
@@ -52,6 +52,10 @@
      * 报名状态 0 已取消 1已报名
      */
     private Integer status;
+    /**
+     * 单位id(党员以单位名义报名社区活动)
+     */
+    private Long checkUnitId;
 
     /**
      * 取消原因
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
index d030854..f0fc51b 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java
@@ -645,6 +645,7 @@
                 comActActSignDO.setSignIdentity(signIdentity);
                 comActActSignDO.setTimes(comActActSignDO.getTimes()+1);
                 comActActSignDO.setIsInvite(isInvite);
+                comActActSignDO.setCheckUnitId(signactivityVO.getCheckUnitId());
                 num = comActActSignDAO.updateById(comActActSignDO);
             } else {
                 comActActSignDO = new ComActActSignDO();
@@ -653,6 +654,7 @@
                 comActActSignDO.setSignIdentity(signIdentity);
                 comActActSignDO.setTimes(1);
                 comActActSignDO.setIsInvite(isInvite);
+                comActActSignDO.setCheckUnitId(signactivityVO.getCheckUnitId());
                 num = comActActSignDAO.insert(comActActSignDO);
             }
         } else {
@@ -1111,6 +1113,7 @@
             comActActRegistDO.setCodeId(comActActRegistVO.getCodeId());
             comActActRegistDO.setAward(0);
             comActActRegistDO.setPosition(comActActRegistVO.getPosition());
+            comActActRegistDO.setCheckUnitId(comActActSignDO.getCheckUnitId());
             comActActRegistDO.setTimes(signAllCount + 1);
             int result = comActActRegistDAO.insert(comActActRegistDO);
             if (result > 0) {
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
index 06f2c06..d4c8fb8 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActNeighborCircleServiceImpl.java
@@ -1,18 +1,13 @@
 package com.panzhihua.service_community.service.impl;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import javax.annotation.Resource;
 
-import cn.hutool.core.collection.ListUtil;
-import cn.hutool.core.util.NumberUtil;
-import cn.hutool.core.util.PageUtil;
-import com.panzhihua.common.model.vos.LoginUserInfoVO;
-import com.panzhihua.common.model.vos.PageVO;
-import com.panzhihua.common.service.user.UserService;
-import com.panzhihua.common.utlis.SensitiveUtil;
-import com.panzhihua.service_community.entity.ComPbCheckUnit;
-import com.panzhihua.service_community.service.ComActNeighborCircleTopicService;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
@@ -24,20 +19,72 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.panzhihua.common.constants.NeighborCircleConstants;
-import com.panzhihua.common.model.dtos.neighbor.*;
+import com.panzhihua.common.model.dtos.neighbor.AddComActNeighborCircleAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborAddBrowseAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAdminDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCircleDetailAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCommentAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborCommentReplyAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborFabulousAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborForwardAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.ComActNeighborReplyAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.DeleteNeighborCircleAppDTO;
+import com.panzhihua.common.model.dtos.neighbor.DetailNeighborAllCommentByAdminDTO;
+import com.panzhihua.common.model.dtos.neighbor.DetailNeighborCommentReplyByAdminDTO;
+import com.panzhihua.common.model.dtos.neighbor.ServiceStaticBackstageDTO;
+import com.panzhihua.common.model.dtos.neighbor.ServiceStaticDTO;
+import com.panzhihua.common.model.vos.PageVO;
 import com.panzhihua.common.model.vos.R;
-import com.panzhihua.common.model.vos.neighbor.*;
+import com.panzhihua.common.model.vos.neighbor.ActivityAnalysisVO;
+import com.panzhihua.common.model.vos.neighbor.AddNeighborCircleAdminVO;
+import com.panzhihua.common.model.vos.neighbor.ChangeCommentReplyStatusByAdminVO;
+import com.panzhihua.common.model.vos.neighbor.ChangeCommentStatusByAdminVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAdminVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleCommentAppVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleCommentReplyAppVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleDetailAppVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentByAdminVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentReplyAppVO;
+import com.panzhihua.common.model.vos.neighbor.ComActNeighborCommentReplyByAdminVO;
+import com.panzhihua.common.model.vos.neighbor.DetailNeighborCircleAdminVO;
+import com.panzhihua.common.model.vos.neighbor.EditNeighborCircleAdminVO;
+import com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO;
+import com.panzhihua.common.model.vos.neighbor.ServiceStaticsVO;
+import com.panzhihua.common.model.vos.neighbor.UnitActivityAnalysisVO;
 import com.panzhihua.common.model.vos.user.AdministratorsUserVO;
+import com.panzhihua.common.service.user.UserService;
 import com.panzhihua.common.utlis.DateUtils;
+import com.panzhihua.common.utlis.SensitiveUtil;
 import com.panzhihua.common.utlis.StringUtils;
-import com.panzhihua.service_community.dao.*;
-import com.panzhihua.service_community.model.dos.*;
+import com.panzhihua.service_community.dao.ComActActivityDAO;
+import com.panzhihua.service_community.dao.ComActDAO;
+import com.panzhihua.service_community.dao.ComActNeighborCircleBrowseDAO;
+import com.panzhihua.service_community.dao.ComActNeighborCircleCommentDAO;
+import com.panzhihua.service_community.dao.ComActNeighborCircleCommentReplyDAO;
+import com.panzhihua.service_community.dao.ComActNeighborCircleDAO;
+import com.panzhihua.service_community.dao.ComActNeighborCircleFabulousDAO;
+import com.panzhihua.service_community.dao.ComActNeighborCircleTopicMapper;
+import com.panzhihua.service_community.dao.ComPbCheckUnitDao;
+import com.panzhihua.service_community.dao.ComPbMemberDAO;
+import com.panzhihua.service_community.entity.ComPbCheckUnit;
+import com.panzhihua.service_community.model.dos.ComActActivityDO;
+import com.panzhihua.service_community.model.dos.ComActDO;
+import com.panzhihua.service_community.model.dos.ComActNeighborCircleBrowseDO;
+import com.panzhihua.service_community.model.dos.ComActNeighborCircleCommentDO;
+import com.panzhihua.service_community.model.dos.ComActNeighborCircleCommentReplyDO;
+import com.panzhihua.service_community.model.dos.ComActNeighborCircleDO;
+import com.panzhihua.service_community.model.dos.ComActNeighborCircleFabulousDO;
+import com.panzhihua.service_community.model.dos.ComActNeighborCircleTopicDO;
+import com.panzhihua.service_community.model.dos.ComPbMemberDO;
 import com.panzhihua.service_community.service.ComActNeighborCircleBrowseService;
 import com.panzhihua.service_community.service.ComActNeighborCircleService;
+import com.panzhihua.service_community.service.ComActNeighborCircleTopicService;
 
+import cn.hutool.core.collection.ListUtil;
+import cn.hutool.core.util.PageUtil;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.RequestParam;
 
 /**
  * @auther lyq
@@ -1027,22 +1074,22 @@
 
     @Override
     public R serviceStatic(ServiceStaticDTO serviceStaticDTO) {
-        ServiceStaticsVO serviceStaticsVO=new ServiceStaticsVO();
-        if(serviceStaticDTO.getCheckUnitId()!=null){
-            serviceStaticsVO=this.baseMapper.selectStatsCheckUnit(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear());
-            serviceStaticsVO=this.baseMapper.selectStatsCheckUnit(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear());
-            serviceStaticsVO.setServiceProjecList(this.baseMapper.selectListByCheckUnitId(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear()));
-            serviceStaticsVO.setServiceActivityList(comActActivityDAO.selectListByRelationId(serviceStaticDTO.getCheckUnitId(),serviceStaticDTO.getYear()));
-        }
-        else {
-            serviceStaticsVO=this.baseMapper.selectStatsUser(serviceStaticDTO.getPhone(),serviceStaticDTO.getYear());
-            serviceStaticsVO.setServiceProjecList(this.baseMapper.selectListByPhone(serviceStaticDTO.getPhone(),serviceStaticDTO.getYear()));
-            ComPbMemberDO comPbMemberDO=comPbMemberDAO.selectOne(new QueryWrapper<ComPbMemberDO>().lambda().eq(ComPbMemberDO::getPhone,serviceStaticDTO.getPhone()).last("limit 1"));
-            if(comPbMemberDO!=null){
-                serviceStaticsVO.setWorkActivityList(comActActivityDAO.selectListByRelationId(comPbMemberDO.getCheckUnitId(),serviceStaticDTO.getYear()));
-                serviceStaticsVO.setServiceActivityList(comActActivityDAO.selectListByCommunityId(comPbMemberDO.getCommunityId(),serviceStaticDTO.getYear(),serviceStaticDTO.getPhone()));
+        ServiceStaticsVO serviceStaticsVO = new ServiceStaticsVO();
+        if (serviceStaticDTO.getCheckUnitId() != null) {
+            serviceStaticsVO =
+                this.baseMapper.selectStatsCheckUnit(serviceStaticDTO.getCheckUnitId(), serviceStaticDTO.getYear());
+            serviceStaticsVO.setServiceDetailStaticsList(this.baseMapper.selectServiceDetailList(serviceStaticDTO.getCheckUnitId(),
+                    serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType()));
+        } else {
+            serviceStaticsVO = this.baseMapper.selectStatsUser(serviceStaticDTO.getPhone(), serviceStaticDTO.getYear());
+            ComPbMemberDO comPbMemberDO = comPbMemberDAO.selectOne(new QueryWrapper<ComPbMemberDO>().lambda()
+                    .eq(ComPbMemberDO::getPhone, serviceStaticDTO.getPhone()).last("limit 1"));
+            Long checkUnitId = null;
+            if (comPbMemberDO != null) {
+                checkUnitId = comPbMemberDO.getCheckUnitId();
             }
-
+            serviceStaticsVO.setServiceDetailStaticsList(this.baseMapper.selectServiceDetailListForPersonal(checkUnitId, serviceStaticDTO.getPhone(),
+                    serviceStaticDTO.getYear(), serviceStaticDTO.getServiceType()));
         }
         return R.ok(serviceStaticsVO);
     }
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActActivityMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActActivityMapper.xml
index ca6a977..25a5984 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActActivityMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActActivityMapper.xml
@@ -359,7 +359,15 @@
         LEFT JOIN com_act ca ON a.community_id = ca.community_id
         WHERE 1 = 1
         <if test ="comActActivityVO.communityId != null and comActActivityVO.communityId != 0">
-            AND a.community_id = ${comActActivityVO.communityId}
+            <if test="comActActivityVO.checkUnitId != null">
+                AND (a.community_id = ${comActActivityVO.communityId} OR a.check_unit_id = #{comActActivityVO.checkUnitId})
+            </if>
+            <if test="comActActivityVO.checkUnitId == null">
+                AND a.community_id = ${comActActivityVO.communityId}
+                <if test="comActActivityVO.type == null">
+                    AND a.`type` != 5
+                </if>
+            </if>
         </if>
         <if test ="comActActivityVO.phone != null and comActActivityVO.phone != &quot;&quot;">
             AND a.phone = ${comActActivityVO.phone}
@@ -367,7 +375,7 @@
         <if test ="comActActivityVO.areaCode != null">
             AND ca.area_code = ${comActActivityVO.areaCode}
         </if>
-        <if test ="comActActivityVO.checkUnitId != null">
+        <if test ="comActActivityVO.checkUnitId != null and comActActivityVO.communityId == null">
             AND a.check_unit_id = #{comActActivityVO.checkUnitId}
         </if>
         <if test="comActActivityVO.activityName != null and comActActivityVO.activityName.trim() != &quot;&quot;">
diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml
index dd39d99..58d4259 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComActNeighborCircleDOMapper.xml
@@ -246,10 +246,14 @@
     </select>
 
     <select id="selectStatsCheckUnit" resultType="com.panzhihua.common.model.vos.neighbor.ServiceStaticsVO">
-         select count(t1.checkId) as times,sum(t1.hours) as hours from
-         ((select real_service_time as hours,solve_unit_id  as checkId  from com_act_neighbor_circle  where order_type = 1 and solve_status = 4 and solve_unit_id = #{checkUnitId} and create_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59'))
+         select count(t1.checkId) as times,COALESCE(sum(t1.hours),0) as hours from
+         ((select real_service_time as hours,solve_unit_id  as checkId  from com_act_neighbor_circle  where order_type = 1 AND is_del = 2 and solve_status = 4 and solve_unit_id = #{checkUnitId} and order_time between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59'))
           union all
-         (select duration as hours,check_unit_id as checkId from com_act_activity  where check_unit_id = #{checkUnitId} and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59'))) t1
+         (select duration as hours,check_unit_id as checkId from com_act_activity  where check_unit_id = #{checkUnitId} AND `status` = 5 and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59'))
+          union all
+         (SELECT a.duration AS hours,s.check_unit_id AS checkId FROM com_act_activity a LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+            WHERE s.end_time IS NOT NULL AND s.check_unit_id = #{checkUnitId} AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' ) AND concat( #{date}, '-12-31 23:59:59' ) GROUP BY a.id)
+         ) t1
     </select>
     <select id="selectListByCheckUnitId" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO">
         SELECT
@@ -267,9 +271,263 @@
         where is_del = 2 and canc.solve_status=4 and   canc.solve_unit_id = #{checkUnitId} and canc.create_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59')
     </select>
 
+    <select id="selectServiceDetailList" resultType="com.panzhihua.common.model.vos.neighbor.ServiceDetailStaticsVO">
+        <if test="serviceType == null">
+            SELECT * FROM (
+                SELECT
+                id AS serviceId,
+                order_time AS serviceAt,
+                real_service_time AS serviceTime,
+                1 AS serviceType
+                FROM
+                com_act_neighbor_circle
+                WHERE
+                order_type = 1
+                AND is_del = 2
+                AND solve_status = 4
+                AND solve_unit_id = #{checkUnitId}
+                AND order_time BETWEEN concat(#{date}, '-01-01 00:00:00')
+                AND concat(#{date}, '-12-31 23:59:59')
+                UNION ALL
+                SELECT
+                a.id AS serviceId,
+                a.publish_at AS serviceAt,
+                a.duration AS serviceTime,
+                2 AS serviceType
+                FROM
+                com_act_activity a
+                LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+                WHERE
+                s.end_time IS NOT NULL
+                AND s.check_unit_id = #{checkUnitId}
+                AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+                AND concat( #{date}, '-12-31 23:59:59' )
+                GROUP BY
+                a.id
+                UNION ALL
+                SELECT
+                id AS serviceId,
+                publish_at AS serviceAt,
+                duration AS serviceTime,
+                3 AS serviceType
+                FROM
+                com_act_activity
+                WHERE
+                check_unit_id = #{checkUnitId}
+                AND `status` = 5
+                AND publish_at BETWEEN concat( #{date}, '-01-01 00:00:00' )
+                AND concat( #{date}, '-12-31 23:59:59' )
+            ) temp ORDER BY serviceAt
+        </if>
+        <if test="serviceType == 1">
+            SELECT
+            id AS serviceId,
+            order_time AS serviceAt,
+            real_service_time AS serviceTime,
+            1 AS serviceType
+            FROM
+            com_act_neighbor_circle
+            WHERE
+            order_type = 1
+            AND is_del = 2
+            AND solve_status = 4
+            AND solve_unit_id = #{checkUnitId}
+            AND order_time BETWEEN concat(#{date}, '-01-01 00:00:00')
+            AND concat(#{date}, '-12-31 23:59:59')
+            ORDER BY serviceAt
+        </if>
+        <if test="serviceType == 2">
+            SELECT
+            a.id AS serviceId,
+            a.publish_at AS serviceAt,
+            a.duration AS serviceTime,
+            2 AS serviceType
+            FROM
+            com_act_activity a
+            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+            WHERE
+            s.end_time IS NOT NULL
+            AND s.check_unit_id = #{checkUnitId}
+            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            GROUP BY a.id
+            ORDER BY serviceAt
+        </if>
+        <if test="serviceType == 3">
+            SELECT
+            id AS serviceId,
+            publish_at AS serviceAt,
+            duration AS serviceTime,
+            3 AS serviceType
+            FROM
+            com_act_activity
+            WHERE
+            check_unit_id = #{checkUnitId}
+            AND `status` = 5
+            AND publish_at BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            ORDER BY serviceAt
+        </if>
+    </select>
+
+    <select id="selectServiceDetailListForPersonal" resultType="com.panzhihua.common.model.vos.neighbor.ServiceDetailStaticsVO">
+        <if test="serviceType == null">
+            SELECT * FROM (
+            SELECT
+            canc.id AS serviceId,
+            canc.order_time AS serviceAt,
+            canc.real_service_time AS serviceTime,
+            1 AS serviceType
+            FROM
+            com_act_neighbor_circle AS canc
+            LEFT JOIN sys_user su1 ON su1.user_id = canc.solve_id
+            WHERE
+            canc.order_type = 2
+            AND canc.is_del = 2
+            AND canc.solve_status = 4
+            AND su1.phone = #{phone}
+            AND canc.order_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            <if test="checkUnitId != null">
+                UNION ALL
+                SELECT
+                a.id AS serviceId,
+                a.publish_at AS serviceAt,
+                a.duration AS serviceTime,
+                2 AS serviceType
+                FROM
+                com_act_activity a
+                LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+                LEFT JOIN sys_user su ON su.user_id = s.user_id
+                WHERE
+                s.end_time IS NOT NULL
+                AND s.check_unit_id = #{checkUnitId}
+                AND su.phone = #{phone}
+                AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+                AND concat( #{date}, '-12-31 23:59:59' )
+                GROUP BY
+                a.id
+            </if>
+            UNION ALL
+            SELECT
+            a.id AS serviceId,
+            a.publish_at AS serviceAt,
+            a.duration AS serviceTime,
+            3 AS serviceType
+            FROM
+            com_act_activity a
+            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+            LEFT JOIN sys_user su ON su.user_id = s.user_id
+            WHERE
+            s.end_time IS NOT NULL
+            AND a.check_unit_id IS NOT NULL
+            AND su.phone = #{phone}
+            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            GROUP BY
+            a.id
+            UNION ALL
+            SELECT
+            a.id AS serviceId,
+            a.publish_at AS serviceAt,
+            a.duration AS serviceTime,
+            4 AS serviceType
+            FROM
+            com_act_activity a
+            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+            LEFT JOIN sys_user su ON su.user_id = s.user_id
+            WHERE
+            s.end_time IS NOT NULL
+            AND a.check_unit_id IS NULL
+            AND s.sign_identity = 2
+            AND su.phone = #{phone}
+            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            GROUP BY
+            a.id
+            ) temp ORDER BY serviceAt
+        </if>
+        <if test="serviceType == 1">
+            SELECT
+            canc.id AS serviceId,
+            canc.order_time AS serviceAt,
+            canc.real_service_time AS serviceTime,
+            1 AS serviceType
+            FROM
+            com_act_neighbor_circle AS canc
+            LEFT JOIN sys_user su1 ON su1.user_id = canc.solve_id
+            WHERE
+            canc.order_type = 2
+            AND canc.is_del = 2
+            AND canc.solve_status = 4
+            AND su1.phone = #{phone}
+            AND canc.order_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            ORDER BY serviceAt
+        </if>
+        <if test="serviceType == 2 and checkUnitId != null">
+            SELECT
+            a.id AS serviceId,
+            a.publish_at AS serviceAt,
+            a.duration AS serviceTime,
+            2 AS serviceType
+            FROM
+            com_act_activity a
+            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+            LEFT JOIN sys_user su ON su.user_id = s.user_id
+            WHERE
+            s.end_time IS NOT NULL
+            AND s.check_unit_id = #{checkUnitId}
+            AND su.phone = #{phone}
+            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            GROUP BY a.id
+            ORDER BY serviceAt
+        </if>
+        <if test="serviceType == 3">
+            SELECT
+            a.id AS serviceId,
+            a.publish_at AS serviceAt,
+            a.duration AS serviceTime,
+            3 AS serviceType
+            FROM
+            com_act_activity a
+            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+            LEFT JOIN sys_user su ON su.user_id = s.user_id
+            WHERE
+            s.end_time IS NOT NULL
+            AND a.check_unit_id IS NOT NULL
+            AND su.phone = #{phone}
+            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            GROUP BY a.id
+            ORDER BY serviceAt
+        </if>
+        <if test="serviceType == 4">
+            SELECT
+            a.id AS serviceId,
+            a.publish_at AS serviceAt,
+            a.duration AS serviceTime,
+            4 AS serviceType
+            FROM
+            com_act_activity a
+            LEFT JOIN com_act_act_regist s ON a.id = s.activity_id
+            LEFT JOIN sys_user su ON su.user_id = s.user_id
+            WHERE
+            s.end_time IS NOT NULL
+            AND a.check_unit_id IS NULL
+            AND s.sign_identity = 2
+            AND su.phone = #{phone}
+            AND s.start_time BETWEEN concat( #{date}, '-01-01 00:00:00' )
+            AND concat( #{date}, '-12-31 23:59:59' )
+            GROUP BY a.id
+            ORDER BY serviceAt
+        </if>
+    </select>
+
     <select id="selectStatsUser" resultType="com.panzhihua.common.model.vos.neighbor.ServiceStaticsVO">
-        select count(t1.checkId) as times,sum(t1.hours) as hours from  ((select real_service_time as hours,solve_id  as checkId  from com_act_neighbor_circle canc left join sys_user su on canc.solve_id = su.user_id  where order_type = 2 and solve_status = 4 and su.phone = #{phone} and canc.create_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59')) union all
-                                                                        (select duration as hours,caas.user_id as checkId from com_act_activity caa LEFT JOIN com_act_act_regist caas on caa.id = caas.activity_id left join sys_user su on caas.user_id = su.user_id where caa.type !=5 and caas.end_time is not null and su.phone =#{phone}  and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59') group by caa.id)) t1
+        select count(t1.checkId) as times,sum(t1.hours) as hours from  ((select real_service_time as hours,solve_id  as checkId  from com_act_neighbor_circle canc left join sys_user su on canc.solve_id = su.user_id  where order_type = 2 AND canc.is_del = 2 and solve_status = 4 and su.phone = #{phone} and canc.order_time between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59')) union all
+                                                                        (select duration as hours,caas.user_id as checkId from com_act_activity caa LEFT JOIN com_act_act_regist caas on caa.id = caas.activity_id left join sys_user su on caas.user_id = su.user_id where caas.sign_identity = 2 and caas.end_time is not null and su.phone =#{phone}  and publish_at between concat(#{date},'-01-01 00:00:00') and concat(#{date},'-12-31 23:59:59') group by caa.id)) t1
     </select>
 
     <select id="selectListByPhone" resultType="com.panzhihua.common.model.vos.neighbor.ComActNeighborCircleAppVO">
@@ -293,9 +551,13 @@
         select canc.solve_unit_id as unitId,sum(canc.real_service_time) as serviceTime,count(canc.real_service_time) as serviceTimes,canc.community_id as communityId,cpcu.belong_to
         from com_act_neighbor_circle as canc
         left join com_pb_check_unit as cpcu on canc.solve_unit_id=cpcu.id
-        where canc.solve_unit_id&lt;>''
+        where
+        canc.order_type = 1
+        AND is_del = 2
+        AND solve_status = 4
+        AND canc.solve_unit_id&lt;>''
         <if test="beginTime != null">
-            and canc.create_at between #{beginTime} and #{endTime}
+            and canc.order_time between #{beginTime} and #{endTime}
         </if>
         <if test="belongTo != null and belongTo != ''">
             and belong_to=#{belongTo}
@@ -309,68 +571,94 @@
     </select>
     <select id="institutionalUnitActivityAnalysis"
             resultType="com.panzhihua.common.model.vos.neighbor.UnitActivityAnalysisVO">
-        SELECT count(caa.check_unit_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as unitId,caa.community_id as communityId,cpcu.belong_to
-        FROM com_act_activity as caa
-        left join com_pb_check_unit as cpcu on caa.check_unit_id=cpcu.id
-        where caa.check_unit_id&lt;>''
-        and caa.type=5
-        <if test="beginTime != null">
-            and caa.create_at between #{beginTime} and #{endTime}
-        </if>
-        <if test="belongTo != null and belongTo != ''">
-            and belong_to=#{belongTo}
-        </if>
-        <if test="communityId != null">
-            and caa.community_id=#{communityId}
-        </if>
-        GROUP BY (caa.check_unit_id)
+        SELECT sum(serviceTimes) AS serviceTimes, sum(serviceTime) as serviceTime, unitId, communityId, belong_to
+        FROM (
+            SELECT count(caa.check_unit_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as
+            unitId,caa.community_id as communityId,cpcu.belong_to
+            FROM com_act_activity as caa
+            left join com_pb_check_unit as cpcu on caa.check_unit_id=cpcu.id
+            where caa.`status` = 5 AND caa.check_unit_id&lt;>''
+            and caa.type=5
+            <if test="beginTime != null">
+                and caa.publish_at between #{beginTime} and #{endTime}
+            </if>
+            <if test="belongTo != null and belongTo != ''">
+                and belong_to=#{belongTo}
+            </if>
+            <if test="communityId != null">
+                and caa.community_id=#{communityId}
+            </if>
+            GROUP BY (caa.check_unit_id)
+            UNION ALL
+            SELECT count(id) as serviceTimes, sum(duration) as serviceTime, check_unit_id as unitId, community_id as
+            communityId, belong_to
+            FROM(
+            SELECT caa.id, caa.duration, s.check_unit_id , cpcu.community_id , cpcu.belong_to
+            FROM com_act_activity caa
+            LEFT JOIN com_act_act_regist s ON caa.id = s.activity_id
+            left join com_pb_check_unit as cpcu on s.check_unit_id = cpcu.id
+            WHERE s.end_time IS NOT NULL AND s.check_unit_id IS NOT NULL
+            <if test="beginTime != null">AND s.start_time BETWEEN #{beginTime} and #{endTime}
+            </if>
+            <if test="belongTo != null and belongTo != ''">and belong_to=#{belongTo}
+            </if>
+                <if test="communityId != null">
+                    and caa.community_id=#{communityId}
+                </if>
+                GROUP BY caa.id,s.check_unit_id
+            ) temp GROUP BY check_unit_id
+        ) temp2 GROUP BY unitId
         having serviceTimes&lt;>'' and serviceTime&lt;>''
         order by serviceTime desc
     </select>
     <select id="institutionalPartyMemberServiceAnalysis"
             resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO">
-        SELECT count(caa.sponsor_id) as serviceTimes,sum(caa.duration) as serviceTime,caa.check_unit_id as unitId
-        ,caa.community_id as communityId,caa.sponsor_id as memberId,su.name as memberName,su.relation_name as belongUnit,ca.name as belongCommunity,cpcu.belong_to
-        FROM `com_act_activity` as caa
-        left join com_act_act_sign as caas on caa.id=caas.activity_id
-        left join sys_user as su on caa.sponsor_id=su.user_id
-        left join com_act as ca on su.community_id=ca.community_id
-        left join com_pb_check_unit as cpcu on ca.community_id=cpcu.community_id
-        where caa.sponsor_id&lt;>''
-        and caa.type=3
-        <if test="beginTime != null">
-            and caa.create_at between #{beginTime} and #{endTime}
-        </if>
-        <if test="belongTo != null and belongTo != ''">
-            and belong_to=#{belongTo}
-        </if>
-        <if test="communityId != null">
-            and su.community_id=#{communityId}
-        </if>
-        <if test="unitId != null">
-            and caa.check_unit_id=#{unitId}
-        </if>
-        GROUP BY (caa.sponsor_id)
+        SELECT count(id) as serviceTimes, sum(duration) as serviceTime, unitId,
+        communityId, memberId, memberName, belongUnit, belongCommunity, belong_to FROM (
+            SELECT caa.id, caa.duration, cpcu.id as unitId, cpcu.community_id as communityId, su.user_id as
+            memberId, su.name as memberName, su.relation_name as belongUnit, ca.name as belongCommunity, cpcu.belong_to
+            FROM `com_act_activity` as caa
+            left join com_act_act_regist as caar on caa.id=caar.activity_id
+            left join sys_user as su on caar.user_id=su.user_id
+            left join com_pb_member as cpm on su.phone=cpm.phone
+            left join com_pb_check_unit as cpcu on cpm.check_unit_id=cpcu.id
+            left join com_act as ca on cpcu.community_id=ca.community_id
+            where caar.sign_identity = 2 AND cpcu.id IS NOT NULL
+            <if test="beginTime != null">
+                and caar.start_time between #{beginTime} and #{endTime}
+            </if>
+            <if test="belongTo != null and belongTo != ''">
+                and cpcu.belong_to=#{belongTo}
+            </if>
+            <if test="communityId != null">
+                and cpcu.community_id=#{communityId}
+            </if>
+            <if test="unitId != null">
+                and cpcu.id=#{unitId}
+            </if>
+            GROUP BY caa.id,caar.user_id
+        ) temp GROUP BY memberId
         having serviceTimes&lt;>'' and serviceTime&lt;>'' and memberName&lt;>''
         order by serviceTime desc
     </select>
     <select id="institutionalPartyMemberActAnalysis"
             resultType="com.panzhihua.common.model.vos.neighbor.PartyMemberAnalysisVO">
         SELECT count(canc.solve_id) as serviceTimes,sum(canc.real_service_time) as serviceTime
-        ,canc.community_id as communityId,canc.solve_id as memberId,su.name as memberName,su.relation_name as belongUnit,ca.name as belongCommunity,cpcu.belong_to
+        ,cpcu.community_id as communityId,canc.solve_id as memberId,su.name as memberName,su.relation_name as belongUnit,ca.name as belongCommunity,cpcu.belong_to
         FROM `com_act_neighbor_circle` as canc
         left join sys_user as su on canc.solve_id=su.user_id
-        left join com_act as ca on su.community_id=ca.community_id
-        left join com_pb_check_unit as cpcu on ca.community_id=cpcu.community_id
-        where canc.solve_id&lt;>''
+        left join com_pb_member as cpm on su.phone=cpm.phone
+        left join com_pb_check_unit as cpcu on cpm.check_unit_id=cpcu.id
+        left join com_act as ca on cpcu.community_id=ca.community_id
+        where cpcu.id IS NOT NULL
         <if test="beginTime != null">
-            and canc.create_at between #{beginTime} and #{endTime}
+            and canc.order_time between #{beginTime} and #{endTime}
         </if>
         <if test="belongTo != null and belongTo != ''">
-            and belong_to=#{belongTo}
+            and cpcu.belong_to=#{belongTo}
         </if>
         <if test="communityId != null">
-            and su.community_id=#{communityId}
+            and cpcu.community_id=#{communityId}
         </if>
         <if test="unitId != null">
             and cpcu.id=#{unitId}
@@ -425,9 +713,12 @@
         left join com_act_neighbor_circle_topic as canct on canct.id = canc.topic_id
         left join com_act as ca on ca.community_id = canc.community_id
         LEFT JOIN com_act_activity t ON canc.id = t.relation_id
-        where is_del = 2 and canc.status = 2 and canc.community_id = ${neighborCircleAppDTO.communityId} AND t.id IS NULL
+        where is_del = 2 and canc.status = 2 and canc.solve_status in (2,3,4) and canc.community_id = ${neighborCircleAppDTO.communityId} AND t.id IS NULL
         <if test='neighborCircleAppDTO.topicId != null '>
             and canc.topic_id = #{neighborCircleAppDTO.topicId}
+        </if>
+        <if test='neighborCircleAppDTO.checkUnitId != null '>
+            and canc.solve_unit_id = #{neighborCircleAppDTO.checkUnitId}
         </if>
         <if test='neighborCircleAppDTO.belongType != null '>
             and canc.belong_type = #{neighborCircleAppDTO.belongType}
@@ -439,17 +730,6 @@
         </if>
         <if test="neighborCircleAppDTO.isHelp ==1">
             and (canc.help_member_content like concat ('%',#{neighborCircleAppDTO.phone},'%') or canc.help_org_content like concat ('%',#{neighborCircleAppDTO.phone},'%') )
-        </if>
-        <if test="neighborCircleAppDTO.solveStatus !=null">
-            <if test="neighborCircleAppDTO.solveStatus ==1">
-                and canc.solve_status in (0,1)
-            </if>
-            <if test="neighborCircleAppDTO.solveStatus ==2">
-                and canc.solve_status =2
-            </if>
-            <if test="neighborCircleAppDTO.solveStatus ==3">
-                and canc.solve_status in(3,4)
-            </if>
         </if>
         order by canc.create_at desc
     </select>

--
Gitblit v1.7.1