From 5cc66034f6d2dba30d2132078b2730f1dd4abf86 Mon Sep 17 00:00:00 2001 From: huanghongfa <huanghongfa123456> Date: 星期六, 31 七月 2021 21:00:56 +0800 Subject: [PATCH] 修改bug --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java | 38 +++++++++++++++++++++++++++++++++++--- 1 files changed, 35 insertions(+), 3 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..76c4481 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 @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -189,7 +190,14 @@ public ComActActivityVO inforActivity(Long id, Long userId) { ComActActivityVO comActActivityVO=comActActivityDAO.inforActivity(id); if (!ObjectUtils.isEmpty(comActActivityVO)) { - ComActActSignDO comActActSignDO = comActActSignDAO.selectOne(new QueryWrapper<ComActActSignDO>().lambda().eq(ComActActSignDO::getActivityId, id).eq(ComActActSignDO::getUserId, userId)); + + LambdaQueryWrapper<ComActActSignDO> actSignQuery = new LambdaQueryWrapper<>(); + actSignQuery.eq(ComActActSignDO::getActivityId, id); + if(userId != null){ + actSignQuery.eq(ComActActSignDO::getUserId, userId); + } + + ComActActSignDO comActActSignDO = comActActSignDAO.selectOne(actSignQuery); if (!ObjectUtils.isEmpty(comActActSignDO)) { comActActivityVO.setIsSign(1); comActActivityVO.setIsVolunteer(comActActSignDO.getIsVolunteer()); @@ -208,7 +216,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); } @@ -255,6 +271,21 @@ boolean userNotVolunteer = !(loginUserInfoVO.getIsVolunteer()==1); if(isVolunteer == 1 && userNotVolunteer){ 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(); @@ -379,7 +410,8 @@ log.info("定时任务--修改社区活动进行状态活动数量【{}】",num2); int num3=comActActivityDAO.updateStatusToBeginAfterSingEnd(); log.info("定时任务--报名结束修改社区活动进行状态活动数量【{}】",num3); - return R.ok(); + //查询已经结束的活动,需要计算积分 + return R.ok(comActActivityDAO.getActivityEndIds()); } /** -- Gitblit v1.7.1