From 02f18587bd8860b305e2c688e20465be166bb48c Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期四, 22 七月 2021 15:14:03 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/test' into test

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 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 669a52e..ce0a352 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
@@ -208,7 +208,15 @@
      */
     @Override
     public R listActivitySign(ActivitySignVO activitySignVO) {
-        List<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySign(activitySignVO);
+
+        IPage<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySign(new Page(activitySignVO.getPageNum(),activitySignVO.getPageSize()),activitySignVO);
+//        List<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySign(activitySignVO);
+        return R.ok(activitySignVOS);
+    }
+
+    @Override
+    public R listActivitySigns(ActivitySignVO activitySignVO) {
+        List<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySigns(activitySignVO);
         return R.ok(activitySignVOS);
     }
 
@@ -257,6 +265,21 @@
                 return R.fail("只有志愿者才能报名");
             }
 
+            //查询社区活动
+            ComActActivityDO actActivityDO = this.baseMapper.selectById(activityId);
+            if(actActivityDO != null){
+                //查询当前活动下参与志愿者/居民数量
+                Integer count = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda().eq(ComActActSignDO::getActivityId,activityId)
+                        .eq(ComActActSignDO::getIsVolunteer,isVolunteer));
+                if(isVolunteer.equals(1) && actActivityDO.getVolunteerMax() <= count && !actActivityDO.getVolunteerMax().equals(-1)){
+                    return R.fail("志愿者报名人数已满");
+                }
+
+                if(isVolunteer.equals(0) && actActivityDO.getParticipantMax() <= count && !actActivityDO.getParticipantMax().equals(-1)){
+                    return R.fail("居民报名人数已满");
+                }
+            }
+
             ComActActSignDO comActActSignDO=new ComActActSignDO();
             comActActSignDO.setActivityId(activityId);
             comActActSignDO.setUserId(userId);

--
Gitblit v1.7.1