From 98e41183cce52bd6e614c9dce6d5c512b214a188 Mon Sep 17 00:00:00 2001
From: 101captain <237651143@qq.com>
Date: 星期一, 18 十月 2021 13:29:03 +0800
Subject: [PATCH] 活动修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 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 9e2bcb0..26afcc6 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
@@ -798,11 +798,15 @@
             return R.fail("不在活动时间范围内");
         }
 
-        int signCount = comActActRegistDAO.selectCount(new QueryWrapper<ComActActRegistDO>()
+        int signDayCount = comActActRegistDAO.selectCount(new QueryWrapper<ComActActRegistDO>()
+                .lambda().eq(ComActActRegistDO::getActivityId, activityId).eq(ComActActRegistDO::getUserId, userId).eq(ComActActRegistDO::getCodeId,comActActRegistVO.getCodeId()));
+        int signAllCount = comActActRegistDAO.selectCount(new QueryWrapper<ComActActRegistDO>()
                 .lambda().eq(ComActActRegistDO::getActivityId, activityId).eq(ComActActRegistDO::getUserId, userId));
-
-        if (signCount >= comActActivityDO.getLimit()) {
-            return R.fail("请勿重复签到");
+        if (signDayCount >= 0) {
+            return R.fail("请扫描新的签到码");
+        }
+        if(signAllCount>=comActActivityDO.getLimit()){
+            return R.fail("签到次数上限");
         }
 
 //        String activitySignInKey = String.join(DELIMITER, ACTIVITY_SIGN_IN, userId.toString(), activityId.toString());
@@ -814,6 +818,10 @@
         comActActRegistDO.setUserId(userId);
         comActActRegistDO.setIsVolunteer(comActActRegistVO.getIsVolunteer());
         comActActRegistDO.setCreateAt(nowDate);
+        comActActRegistDO.setCodeId(comActActRegistVO.getCodeId());
+        comActActRegistDO.setAward(comActActivityDO.getRewardIntegral());
+        comActActRegistDO.setPosition(comActActRegistVO.getPosition());
+        comActActRegistDO.setTimes(signAllCount+1);
         int result = comActActRegistDAO.insert(comActActRegistDO);
         if (result > 0) {
 //            ValueOperations<String, String> opsForValue = stringRedisTemplate.opsForValue();

--
Gitblit v1.7.1