From 8d5fb4ee9d27fd6a61b210eaee74af265f76aa7c Mon Sep 17 00:00:00 2001 From: manailin <261030956@qq.com> Date: 星期五, 08 四月 2022 14:55:18 +0800 Subject: [PATCH] [修改]修改配置 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java | 66 +++++++++++++++++++++++++-------- 1 files changed, 50 insertions(+), 16 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 9f4f3e1..aac7347 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 @@ -15,6 +15,7 @@ import javax.annotation.Resource; +import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.common.model.vos.community.*; import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.BeanUtils; @@ -198,6 +199,7 @@ if (comActActivityVO.getSignUpEnd() != null && now.getTime() < comActActivityVO.getSignUpEnd().getTime() && now.getTime() > comActActivityVO.getSignUpBegin().getTime()) { comActActivityDO.setStatus(3); + comActActivityDO.setPublishAt(new Date()); } boolean b = this.updateById(comActActivityDO); if (b) { @@ -303,10 +305,22 @@ comActActivityVO.setIsVolunteer(comActActSignDO.getIsVolunteer()); } List<ComActActRegistDO> regList = comActActRegistDAO.selectList(new QueryWrapper<ComActActRegistDO>().lambda() - .eq(ComActActRegistDO::getUserId, userId).eq(ComActActRegistDO::getActivityId, id).eq(ComActActRegistDO::getType, 1)); + .eq(ComActActRegistDO::getUserId, userId).eq(ComActActRegistDO::getActivityId, id)); if (!regList.isEmpty()) { List<ComActActRegistDO> collect = regList.stream().sorted(Comparator.comparing(ComActActRegistDO::getId).reversed()).collect(Collectors.toList()); comActActivityVO.setTimes(collect.get(0).getTimes()); + ComActActRegistDO comActActRegistDO=collect.get(0); + if(comActActRegistDO.getType()==3){ + if(comActActRegistDO.getEndTime()==null){ + comActActivityVO.setSignType(2); + } + else { + comActActivityVO.setSignType(1); + } + } + } + else { + comActActivityVO.setSignType(1); } } } @@ -460,6 +474,9 @@ if (isNull(actActivityDO)) { return R.fail("活动不存在"); } + if(actActivityDO.getSignUpBegin().after(new Date())){ + return R.fail("未到报名时间"); + } int num = 0; ComActActSignDO comActActSignDO = comActActSignDAO.selectOne(new QueryWrapper<ComActActSignDO>() .lambda().eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getUserId, userId)); @@ -468,6 +485,7 @@ return R.fail("已经报名过了,请勿重复提交"); } Integer volunteerMax = actActivityDO.getVolunteerMax(); + Integer activityType = actActivityDO.getType(); Integer residentMax = actActivityDO.getParticipantMax(); R<LoginUserInfoVO> userInfoR = userService.getUserInfoByUserId(String.valueOf(userId)); LoginUserInfoVO loginUserInfoVO = @@ -475,7 +493,7 @@ // 查询当前活动下参与居民 Integer residentCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getIsVolunteer, 0).eq(ComActActSignDO::getStatus, 1)); - if (volunteerMax != 0) { + if (activityType.equals(1)) { //志愿者活动 boolean userIsVolunteer = loginUserInfoVO.getIsVolunteer() == 1; // 查询当前活动下参与志愿者 @@ -532,12 +550,14 @@ comActActSignDO.setCreateAt(new Date()); comActActSignDO.setReason(null); comActActSignDO.setIsVolunteer(isVolunteer); + comActActSignDO.setTimes(comActActSignDO.getTimes()+1); num = comActActSignDAO.updateById(comActActSignDO); } else { comActActSignDO = new ComActActSignDO(); comActActSignDO.setActivityId(activityId); comActActSignDO.setUserId(userId); comActActSignDO.setIsVolunteer(isVolunteer); + comActActSignDO.setTimes(1); num = comActActSignDAO.insert(comActActSignDO); } } else { @@ -563,7 +583,7 @@ AddComActIntegralUserDTO addComActIntegralUserDTO = new AddComActIntegralUserDTO(); addComActIntegralUserDTO.setUserId(userId); addComActIntegralUserDTO.setIntegralType(8); - addComActIntegralUserDTO.setActivityType(1); + addComActIntegralUserDTO.setActivityType(actActivityDO.getType()); addComActIntegralUserDTO.setIsVolunteer(comActActSignDO.getIsVolunteer()); addComActIntegralUserDTO.setCommunityId(actActivityDO.getCommunityId()); addComActIntegralUserDTO.setServiceId(activityId); @@ -585,7 +605,7 @@ * @return 活动列表 */ @Override - public R listActivity(Long userId, Integer status) { + public R listActivity(Long userId, Integer status,Integer type) { List<ActivitySignVO> activitySignVOList = comActActSignDAO.selectList(userId); if (ObjectUtils.isEmpty(activitySignVOList)) { return R.ok(); @@ -603,20 +623,20 @@ .filter(activityDO -> activityDO.getStatus().equals(status)).collect(Collectors.toList()); } } + if(!isNull(type)){ + comActActivityDOS=comActActivityDOS.stream().filter(comActActivityDO -> comActActivityDO.getType().equals(type)).collect(Collectors.toList()); + } if (!comActActivityDOS.isEmpty()) { comActActivityDOS.forEach(comActActivityDO -> { ComActActivityVO comActActivityVO = new ComActActivityVO(); BeanUtils.copyProperties(comActActivityDO, comActActivityVO); List<ActivitySignVO> collect = activitySignVOList.stream() - .filter(activitySignVO -> activitySignVO.getActivityId().equals(comActActivityVO.getId())).limit(1) + .filter(activitySignVO -> activitySignVO.getActivityId().equals(comActActivityVO.getId())) .collect(Collectors.toList()); + comActActivityVO.setSignCount(collect.size()); + comActActivityVO.setIsComment(0); + comActActivityVO.setIsRegist(0); ActivitySignVO activitySignVO = collect.get(0); - Integer isVolunteer = activitySignVO.getIsVolunteer(); - if (isVolunteer.intValue() == 1) { - comActActivityVO.setType(1); - } else { - comActActivityVO.setType(2); - } Integer activityStatus = comActActivityVO.getStatus(); if (activityStatus.intValue() == 3) { comActActivityVO.setStatus(4); @@ -629,9 +649,9 @@ log.error("时间转换异常【{}】", e.getMessage()); } comActActivityVO.setSingDate(createAt); - comActActivityVO.setTimes(activitySignVO.getTimes()); Integer totalAward = comActActRegistDAO.selectTotalAwardWithRegist(activitySignVO.getActivityId(), userId); comActActivityVO.setAward(totalAward); + comActActivityVO.setActivitySignVOList(collect); comActActivityVOS.add(comActActivityVO); }); } @@ -914,7 +934,7 @@ // return R.fail("你已签到,如要再次签到请三十分钟后尝试!"); // } ComActActRegistDO comActActRegistDO = new ComActActRegistDO(); - if(comActActRegistVO.getType()!=null&&comActActRegistVO.getType()==2){ + if(comActActRegistVO.getSignType()!=null&&comActActRegistVO.getSignType()==2){ ComActActRegistDO comActActActRegistDO=comActActRegistDAO.selectOne(new QueryWrapper<ComActActRegistDO>() .lambda().eq(ComActActRegistDO::getActivityId, activityId).eq(ComActActRegistDO::getUserId, userId).eq(ComActActRegistDO::getCodeId,comActActRegistVO.getCodeId())); if(comActActActRegistDO==null){ @@ -923,7 +943,7 @@ if(comActActActRegistDO.getEndTime()!=null){ return R.fail("无法重复签退"); } - comActActRegistDO.setId(comActActRegistVO.getId()); + comActActRegistDO.setId(comActActActRegistDO.getId()); comActActRegistDO.setEndTime(new Date()); int result=comActActRegistDAO.updateById(comActActRegistDO); if (result > 0) { @@ -957,7 +977,7 @@ } comActActRegistDO.setActivityId(activityId); comActActRegistDO.setStartTime(new Date()); - comActActRegistDO.setType(1); + comActActRegistDO.setType(comActActivityDO.getType()); comActActRegistDO.setUserId(userId); comActActRegistDO.setIsVolunteer(comActActSignDO.getIsVolunteer()); comActActRegistDO.setCreateAt(nowDate); @@ -966,7 +986,7 @@ comActActRegistDO.setPosition(comActActRegistVO.getPosition()); comActActRegistDO.setTimes(signAllCount+1); int result = comActActRegistDAO.insert(comActActRegistDO); - if (result > 0&&comActActRegistDO.getType()==1) { + if (result > 0&&comActActivityDO.getType()!=3) { if (isHave) { boolean isVolunteerAct = comActActivityDO.getVolunteerMax() != 0; AddComActIntegralUserDTO addComActIntegralUserDTO=new AddComActIntegralUserDTO(); @@ -981,6 +1001,9 @@ } else { return R.ok(); } + } + else { + return R.ok(); } } return R.fail("网络错误,请重试"); @@ -1123,6 +1146,17 @@ partyActivityStatics.setPartyActivityLines(getPoints(communityId,year)); return R.ok(partyActivityStatics); } + + @Override + public R partyMemberDetail(CommonPage commonPage) { + return R.ok(comActActivityDAO.partyMemberDetail(new Page<>(commonPage.getPage(),commonPage.getSize()),commonPage)); + } + + @Override + public R exportPartyMemberDetail(CommonPage commonPage) { + return R.ok(comActActivityDAO.exportPartyMemberDetail(commonPage)); + } + public List<PartyActivityLine> getPoints(Long communityId,String year){ List<PartyActivityLine> partyActivityLines=new ArrayList<>(); for(int i=1;i<=12;i++){ -- Gitblit v1.7.1