From c02e4e8ebd88f2d277935111ca16f2119adbac23 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期日, 24 七月 2022 10:20:57 +0800 Subject: [PATCH] bug修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActActivityServiceImpl.java | 82 +++++++++++++++++++++++++++++++--------- 1 files changed, 63 insertions(+), 19 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 9b7cf9d..d47001b 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,7 +15,10 @@ import javax.annotation.Resource; +import com.panzhihua.common.model.dtos.property.CommonPage; import com.panzhihua.common.model.vos.community.*; +import com.panzhihua.common.utlis.Snowflake; +import com.panzhihua.service_community.entity.ComPbCheckUnit; import org.apache.commons.lang3.time.DateUtils; import org.springframework.beans.BeanUtils; import org.springframework.data.redis.core.StringRedisTemplate; @@ -87,6 +90,12 @@ private ComActActivityCodeService comActActivityCodeService; @Resource private ComActDAO comActDAO; + @Resource + private ComPbCheckUnitDao comPbCheckUnitDao; + @Resource + private ComActSocialProjectDao comActSocialProjectDao; + @Resource + private ComStreetDAO comStreetDAO; /** * 新增社区活动 @@ -120,6 +129,10 @@ if(comActActivityVO.getType()==4){ comActActivityDO.setIsProject(1); } + if(comActActivityVO.getType()==5){ + comPbCheckUnitDao.selectOne(new QueryWrapper<ComPbCheckUnit>().lambda().eq(ComPbCheckUnit::getAdminPhone,comActActivityVO.getPhone()).last("limit 1")); + } + boolean save = this.save(comActActivityDO); if (!save) { return R.fail(); @@ -169,7 +182,7 @@ if (!activitySignVOS.isEmpty()) { try { WxXCXTempSend util = new WxXCXTempSend(); - String accessToken = util.getAppAccessToken(); + String accessToken = util.getAccessToken(); ComActDO comActDO=comActDAO.selectById(comActActivityDO.getCommunityId()); R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),1); activitySignVOS.forEach(activitySignVO1 -> { @@ -198,6 +211,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) { @@ -226,7 +240,19 @@ } page.setSize(pageSize); page.setCurrent(pageNum); - IPage<ComActActivityVO> iPage = comActActivityDAO.pageActivity(page, comActActivityVO); + Integer type = comActActivityVO.getType(); + IPage<ComActActivityVO> iPage = null; + if (nonNull(type) && type.equals(4)) { + if (nonNull(comActActivityVO.getCommunityId())) { + ComActDO comActDO = comActDAO.selectById(comActActivityVO.getCommunityId()); + if (nonNull(comActDO)) { + comActActivityVO.setStreetId(comActDO.getStreetId()); + } + } + iPage = comActActivityDAO.pageProjectActivity(page, comActActivityVO); + } else { + iPage = comActActivityDAO.pageActivity(page, comActActivityVO); + } // List<ComActActivityVO> records = iPage.getRecords(); // if (!ObjectUtils.isEmpty(records)) { // records.forEach(comActActivityVO1 -> { @@ -308,7 +334,7 @@ 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()==2){ + if(comActActRegistDO.getType()==3||comActActRegistDO.getType()==5){ if(comActActRegistDO.getEndTime()==null){ comActActivityVO.setSignType(2); } @@ -472,6 +498,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)); @@ -480,6 +509,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 = @@ -487,7 +517,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; // 查询当前活动下参与志愿者 @@ -544,12 +574,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 { @@ -575,7 +607,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); @@ -615,7 +647,7 @@ .filter(activityDO -> activityDO.getStatus().equals(status)).collect(Collectors.toList()); } } - if(isNull(type)){ + if(!isNull(type)){ comActActivityDOS=comActActivityDOS.stream().filter(comActActivityDO -> comActActivityDO.getType().equals(type)).collect(Collectors.toList()); } if (!comActActivityDOS.isEmpty()) { @@ -623,15 +655,12 @@ 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); @@ -644,9 +673,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); }); } @@ -848,7 +877,7 @@ if (!actActivityList.isEmpty()) { WxXCXTempSend util = new WxXCXTempSend(); try { - String accessToken = util.getAppAccessToken(); + String accessToken = util.getAccessToken(); actActivityList.forEach(actActivity -> { ComActDO comActDO=comActDAO.selectById(actActivity.getCommunityId()); R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),9); @@ -929,7 +958,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){ @@ -938,7 +967,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) { @@ -972,7 +1001,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); @@ -981,7 +1010,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(); @@ -996,6 +1025,9 @@ } else { return R.ok(); } + } + else { + return R.ok(); } } return R.fail("网络错误,请重试"); @@ -1110,6 +1142,7 @@ @Override public R addActivityType(ComActActivityTypeVO comActActivityTypeVO) { try { + comActActivityTypeVO.setId(Snowflake.getId()); this.baseMapper.addActivityType(comActActivityTypeVO); } catch (Exception e) { log.error("添加活动类型错误【{}】", e.getMessage()); @@ -1138,6 +1171,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