From 00a59b93c16b24e7be77c6f1ce4866c75a2e0431 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期二, 19 四月 2022 16:32:21 +0800
Subject: [PATCH] 花城E+防疫修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java |   24 +++++++++++++++++-------
 1 files changed, 17 insertions(+), 7 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 4eba9df..aac7347 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
@@ -199,6 +199,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) {
@@ -309,7 +310,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);
                         }
@@ -473,6 +474,9 @@
         if (isNull(actActivityDO)) {
             return R.fail("活动不存在");
         }
+        if(actActivityDO.getSignUpBegin().after(new Date())){
+            return R.fail("未到报名时间");
+        }
         int num = 0;
         ComActActSignDO comActActSignDO = comActActSignDAO.selectOne(new QueryWrapper<ComActActSignDO>()
                 .lambda().eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getUserId, userId));
@@ -546,12 +550,14 @@
                 comActActSignDO.setCreateAt(new Date());
                 comActActSignDO.setReason(null);
                 comActActSignDO.setIsVolunteer(isVolunteer);
+                comActActSignDO.setTimes(comActActSignDO.getTimes()+1);
                 num = comActActSignDAO.updateById(comActActSignDO);
             } else {
                 comActActSignDO = new ComActActSignDO();
                 comActActSignDO.setActivityId(activityId);
                 comActActSignDO.setUserId(userId);
                 comActActSignDO.setIsVolunteer(isVolunteer);
+                comActActSignDO.setTimes(1);
                 num = comActActSignDAO.insert(comActActSignDO);
             }
         } else {
@@ -577,7 +583,7 @@
                 AddComActIntegralUserDTO addComActIntegralUserDTO = new AddComActIntegralUserDTO();
                 addComActIntegralUserDTO.setUserId(userId);
                 addComActIntegralUserDTO.setIntegralType(8);
-                addComActIntegralUserDTO.setActivityType(1);
+                addComActIntegralUserDTO.setActivityType(actActivityDO.getType());
                 addComActIntegralUserDTO.setIsVolunteer(comActActSignDO.getIsVolunteer());
                 addComActIntegralUserDTO.setCommunityId(actActivityDO.getCommunityId());
                 addComActIntegralUserDTO.setServiceId(activityId);
@@ -628,7 +634,8 @@
                         .filter(activitySignVO -> activitySignVO.getActivityId().equals(comActActivityVO.getId()))
                         .collect(Collectors.toList());
                 comActActivityVO.setSignCount(collect.size());
-                comActActivityVO.setIsComment(1);
+                comActActivityVO.setIsComment(0);
+                comActActivityVO.setIsRegist(0);
                 ActivitySignVO activitySignVO = collect.get(0);
                 Integer activityStatus = comActActivityVO.getStatus();
                 if (activityStatus.intValue() == 3) {
@@ -642,9 +649,9 @@
                     log.error("时间转换异常【{}】", e.getMessage());
                 }
                 comActActivityVO.setSingDate(createAt);
-                comActActivityVO.setTimes(activitySignVO.getTimes());
                 Integer totalAward = comActActRegistDAO.selectTotalAwardWithRegist(activitySignVO.getActivityId(), userId);
                 comActActivityVO.setAward(totalAward);
+                comActActivityVO.setActivitySignVOList(collect);
                 comActActivityVOS.add(comActActivityVO);
             });
         }
@@ -936,7 +943,7 @@
                 if(comActActActRegistDO.getEndTime()!=null){
                     return R.fail("无法重复签退");
                 }
-                comActActRegistDO.setId(comActActRegistVO.getId());
+                comActActRegistDO.setId(comActActActRegistDO.getId());
                 comActActRegistDO.setEndTime(new Date());
                 int result=comActActRegistDAO.updateById(comActActRegistDO);
                 if (result > 0) {
@@ -970,7 +977,7 @@
                 }
                 comActActRegistDO.setActivityId(activityId);
                 comActActRegistDO.setStartTime(new Date());
-                comActActRegistDO.setType(1);
+                comActActRegistDO.setType(comActActivityDO.getType());
                 comActActRegistDO.setUserId(userId);
                 comActActRegistDO.setIsVolunteer(comActActSignDO.getIsVolunteer());
                 comActActRegistDO.setCreateAt(nowDate);
@@ -979,7 +986,7 @@
                 comActActRegistDO.setPosition(comActActRegistVO.getPosition());
                 comActActRegistDO.setTimes(signAllCount+1);
                 int result = comActActRegistDAO.insert(comActActRegistDO);
-                if (result > 0&&comActActRegistDO.getType()==1) {
+                if (result > 0&&comActActivityDO.getType()!=3) {
                     if (isHave) {
                         boolean isVolunteerAct = comActActivityDO.getVolunteerMax() != 0;
                         AddComActIntegralUserDTO addComActIntegralUserDTO=new AddComActIntegralUserDTO();
@@ -995,6 +1002,9 @@
                         return R.ok();
                     }
                 }
+                else {
+                    return R.ok();
+                }
             }
             return R.fail("网络错误,请重试");
 //        else {

--
Gitblit v1.7.1