| | |
| | | |
| | | 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; |
| | |
| | | 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()); |
| | |
| | | //查询当前活动下参与志愿者/居民数量 |
| | | Integer count = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda().eq(ComActActSignDO::getActivityId,activityId) |
| | | .eq(ComActActSignDO::getIsVolunteer,isVolunteer)); |
| | | if(isVolunteer.equals(1) && actActivityDO.getVolunteerMax() <= count){ |
| | | if(isVolunteer.equals(1) && actActivityDO.getVolunteerMax() <= count && !actActivityDO.getVolunteerMax().equals(-1)){ |
| | | return R.fail("志愿者报名人数已满"); |
| | | } |
| | | |
| | | if(isVolunteer.equals(0) && actActivityDO.getParticipantMax() <= count){ |
| | | if(isVolunteer.equals(0) && actActivityDO.getParticipantMax() <= count && !actActivityDO.getParticipantMax().equals(-1)){ |
| | | return R.fail("居民报名人数已满"); |
| | | } |
| | | } |
| | |
| | | // 修改报名状态 变为报名中 |
| | | int num1=comActActivityDAO.updateStatusToBeginSign(); |
| | | log.info("定时任务--修改社区活动报名状态活动数量【{}】",num1); |
| | | //查询已经结束的活动,需要计算积分 |
| | | List<Long> activityEndIds = comActActivityDAO.getActivityEndIds(); |
| | | // 修改进行状态 变为进行中或者已结束 |
| | | int num2=comActActivityDAO.updateStatusToBeginActiveOrEnd(); |
| | | log.info("定时任务--修改社区活动进行状态活动数量【{}】",num2); |
| | | int num3=comActActivityDAO.updateStatusToBeginAfterSingEnd(); |
| | | log.info("定时任务--报名结束修改社区活动进行状态活动数量【{}】",num3); |
| | | return R.ok(); |
| | | return R.ok(activityEndIds); |
| | | } |
| | | |
| | | /** |