From d152b0f34d06434456b69c012ba2712062efc313 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期三, 20 七月 2022 15:46:58 +0800
Subject: [PATCH] bug修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java |   44 +++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 39 insertions(+), 5 deletions(-)

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 aa02f95..34e08f5 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
@@ -17,6 +17,7 @@
 
 import com.panzhihua.common.model.dtos.property.CommonPage;
 import com.panzhihua.common.model.vos.community.*;
+import com.panzhihua.service_community.entity.ComActSocialProject;
 import org.apache.commons.lang3.time.DateUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.data.redis.core.StringRedisTemplate;
@@ -88,6 +89,10 @@
     private ComActActivityCodeService comActActivityCodeService;
     @Resource
     private ComActDAO comActDAO;
+    @Resource
+    private ComActSocialProjectDao comActSocialProjectDao;
+    @Resource
+    private ComStreetDAO comStreetDAO;
 
     /**
      * 新增社区活动
@@ -171,8 +176,24 @@
                 try {
                     WxXCXTempSend util = new WxXCXTempSend();
                     String accessToken = util.getAppAccessToken();
-                    ComActDO comActDO=comActDAO.selectById(comActActivityDO.getCommunityId());
-                    R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),1);
+                    Integer type = comActActivityDO.getType();
+                    String areaCode;
+                    if (nonNull(type) && type.equals(4)) {
+                        ComActSocialProject comActSocialProject = comActSocialProjectDao.selectById(comActActivityDO.getProjectId());
+                        Long streetId = comActSocialProject.getStreetId();
+                        Long communityId = comActSocialProject.getCommunityId();
+                        if (nonNull(streetId)) {
+                            ComStreetDO comStreetDO = comStreetDAO.selectById(streetId);
+                            areaCode = comStreetDO.getAreaCode().toString();
+                        } else {
+                            ComActDO comActDO = comActDAO.selectById(communityId);
+                            areaCode = comActDO.getAreaCode();
+                        }
+                    } else {
+                        ComActDO comActDO = comActDAO.selectById(comActActivityDO.getCommunityId());
+                        areaCode = comActDO.getAreaCode();
+                    }
+                    R<SysTemplateConfigVO> r=userService.selectTemplate(areaCode,1);
                     activitySignVOS.forEach(activitySignVO1 -> {
                         // 变更社区活动推送订阅消息给用户
                         WxUtil.sendSubscribeHDBG(activitySignVO1.getOpenid(), accessToken,
@@ -199,6 +220,7 @@
         if (comActActivityVO.getSignUpEnd() != null && now.getTime() < comActActivityVO.getSignUpEnd().getTime()
         && now.getTime() > comActActivityVO.getSignUpBegin().getTime()) {
             comActActivityDO.setStatus(3);
+            comActActivityDO.setPublishAt(new Date());
         }
         boolean b = this.updateById(comActActivityDO);
         if (b) {
@@ -227,7 +249,19 @@
         }
         page.setSize(pageSize);
         page.setCurrent(pageNum);
-        IPage<ComActActivityVO> iPage = comActActivityDAO.pageActivity(page, comActActivityVO);
+        Integer type = comActActivityVO.getType();
+        IPage<ComActActivityVO> iPage = null;
+        if (nonNull(type) && type.equals(4)) {
+            if (nonNull(comActActivityVO.getCommunityId())) {
+                ComActDO comActDO = comActDAO.selectById(comActActivityVO.getCommunityId());
+                if (nonNull(comActDO)) {
+                    comActActivityVO.setStreetId(comActDO.getStreetId());
+                }
+            }
+            iPage = comActActivityDAO.pageProjectActivity(page, comActActivityVO);
+        } else {
+            iPage = comActActivityDAO.pageActivity(page, comActActivityVO);
+        }
 //        List<ComActActivityVO> records = iPage.getRecords();
 //        if (!ObjectUtils.isEmpty(records)) {
 //            records.forEach(comActActivityVO1 -> {
@@ -309,7 +343,7 @@
                     List<ComActActRegistDO> collect = regList.stream().sorted(Comparator.comparing(ComActActRegistDO::getId).reversed()).collect(Collectors.toList());
                     comActActivityVO.setTimes(collect.get(0).getTimes());
                     ComActActRegistDO comActActRegistDO=collect.get(0);
-                    if(comActActRegistDO.getType()==2){
+                    if(comActActRegistDO.getType()==3){
                         if(comActActRegistDO.getEndTime()==null){
                             comActActivityVO.setSignType(2);
                         }
@@ -634,6 +668,7 @@
                         .collect(Collectors.toList());
                 comActActivityVO.setSignCount(collect.size());
                 comActActivityVO.setIsComment(0);
+                comActActivityVO.setIsRegist(0);
                 ActivitySignVO activitySignVO = collect.get(0);
                 Integer activityStatus = comActActivityVO.getStatus();
                 if (activityStatus.intValue() == 3) {
@@ -647,7 +682,6 @@
                     log.error("时间转换异常【{}】", e.getMessage());
                 }
                 comActActivityVO.setSingDate(createAt);
-                comActActivityVO.setTimes(activitySignVO.getTimes());
                 Integer totalAward = comActActRegistDAO.selectTotalAwardWithRegist(activitySignVO.getActivityId(), userId);
                 comActActivityVO.setAward(totalAward);
                 comActActivityVO.setActivitySignVOList(collect);

--
Gitblit v1.7.1