From 40ff51856a11151ab3f0154a1ae3530e00dafff7 Mon Sep 17 00:00:00 2001 From: puhanshu <a9236326> Date: 星期四, 23 十二月 2021 13:52:31 +0800 Subject: [PATCH] 修改活动bug --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java | 24 +++++++++++++++++++----- 1 files changed, 19 insertions(+), 5 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 af68555..dd45bcc 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 @@ -483,13 +483,13 @@ JSONObject.parseObject(JSONObject.toJSONString(userInfoR.getData()), LoginUserInfoVO.class); // 查询当前活动下参与居民 Integer residentCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() - .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getIsVolunteer, 0)); + .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getIsVolunteer, 0).eq(ComActActSignDO::getStatus, 1)); if (volunteerMax != 0) { //志愿者活动 boolean userIsVolunteer = loginUserInfoVO.getIsVolunteer() == 1; // 查询当前活动下参与志愿者 Integer volunteerCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() - .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getIsVolunteer, 1)); + .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getIsVolunteer, 1).eq(ComActActSignDO::getStatus, 1)); if (userIsVolunteer) { //用户是志愿者以志愿者身份参加 if (volunteerMax > volunteerCount || volunteerMax.equals(-1)) { @@ -550,9 +550,14 @@ num = comActActSignDAO.insert(comActActSignDO); } } else { + Integer regTimes = comActActRegistDAO.selectCount(new QueryWrapper<ComActActRegistDO>().lambda() + .eq(ComActActRegistDO::getActivityId, activityId).eq(ComActActRegistDO::getUserId, userId).eq(ComActActRegistDO::getType, 1)); Integer canCancel = actActivityDO.getCanCancel(); if (nonNull(canCancel) && canCancel.equals(2)) { return R.fail("该活动暂不支持取消"); + } + if (regTimes > 0) { + return R.fail("您已参与活动,不可取消"); } if (isNull(signactivityVO.getReason())) { return R.fail("缺少取消原因"); @@ -566,8 +571,9 @@ if (num > 0) { AddComActIntegralUserDTO addComActIntegralUserDTO = new AddComActIntegralUserDTO(); addComActIntegralUserDTO.setUserId(userId); - addComActIntegralUserDTO.setIntegralType(9); + addComActIntegralUserDTO.setIntegralType(8); addComActIntegralUserDTO.setActivityType(1); + addComActIntegralUserDTO.setIsVolunteer(comActActSignDO.getIsVolunteer()); addComActIntegralUserDTO.setCommunityId(actActivityDO.getCommunityId()); addComActIntegralUserDTO.setServiceId(activityId); comActIntegralUserTradeService.addIntegralTradeAdmin(addComActIntegralUserDTO); @@ -895,6 +901,12 @@ return R.fail("活动不存在!"); } + ComActActSignDO comActActSignDO = comActActSignDAO.selectOne(new QueryWrapper<ComActActSignDO>().lambda() + .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getUserId, userId).eq(ComActActSignDO::getStatus, 1)); + if (isNull(comActActSignDO)) { + return R.fail("活动未报名"); + } + Date beginAt = comActActivityDO.getBeginAt(); Date endAt = comActActivityDO.getEndAt(); Date nowDate = new Date(); @@ -926,7 +938,7 @@ comActActRegistDO.setActivityId(activityId); comActActRegistDO.setType(1); comActActRegistDO.setUserId(userId); - comActActRegistDO.setIsVolunteer(comActActRegistVO.getIsVolunteer()); + comActActRegistDO.setIsVolunteer(comActActSignDO.getIsVolunteer()); comActActRegistDO.setCreateAt(nowDate); comActActRegistDO.setCodeId(comActActRegistVO.getCodeId()); comActActRegistDO.setAward(isHave ? comActActivityDO.getRewardIntegral() : 0); @@ -935,10 +947,12 @@ int result = comActActRegistDAO.insert(comActActRegistDO); if (result > 0) { if (isHave) { + boolean isVolunteerAct = comActActivityDO.getVolunteerMax() != 0; AddComActIntegralUserDTO addComActIntegralUserDTO=new AddComActIntegralUserDTO(); addComActIntegralUserDTO.setUserId(userId); - addComActIntegralUserDTO.setIntegralType(8); + addComActIntegralUserDTO.setIntegralType(isVolunteerAct ? 5 : 4); addComActIntegralUserDTO.setActivityType(1); + addComActIntegralUserDTO.setIsVolunteer(comActActSignDO.getIsVolunteer()); addComActIntegralUserDTO.setCommunityId(comActActivityDO.getCommunityId()); addComActIntegralUserDTO.setServiceId(activityId); comActIntegralUserTradeService.addIntegralTradeAdmin(addComActIntegralUserDTO); -- Gitblit v1.7.1