| | |
| | | import java.text.DecimalFormat; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | import com.panzhihua.common.model.vos.IndexDataVO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.community.screen.work.ActActivityListVO; |
| | | import com.panzhihua.common.model.vos.user.SysTemplateConfigVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.WxUtil; |
| | | import com.panzhihua.common.utlis.WxXCXTempSend; |
| | | import com.panzhihua.service_community.dao.ComActActEvaluateDAO; |
| | | import com.panzhihua.service_community.dao.ComActActPictureDAO; |
| | | import com.panzhihua.service_community.dao.ComActActRegistDAO; |
| | | import com.panzhihua.service_community.dao.ComActActSignDAO; |
| | | import com.panzhihua.service_community.dao.ComActActivityCodeDao; |
| | | import com.panzhihua.service_community.dao.ComActActivityDAO; |
| | | import com.panzhihua.service_community.dao.ComBpActivityDAO; |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.entity.ComActActivityCode; |
| | | import com.panzhihua.service_community.model.dos.ComActActEvaluateDO; |
| | | import com.panzhihua.service_community.model.dos.ComActActPictureDO; |
| | | import com.panzhihua.service_community.model.dos.ComActActRegistDO; |
| | | import com.panzhihua.service_community.model.dos.ComActActSignDO; |
| | | import com.panzhihua.service_community.model.dos.ComActActivityDO; |
| | | import com.panzhihua.service_community.model.dos.*; |
| | | import com.panzhihua.service_community.service.ComActActivityCodeService; |
| | | import com.panzhihua.service_community.service.ComActActivityService; |
| | | import com.panzhihua.service_community.service.ComActIntegralUserTradeService; |
| | |
| | | private ComActIntegralUserTradeService comActIntegralUserTradeService; |
| | | @Resource |
| | | private ComActActivityCodeService comActActivityCodeService; |
| | | @Resource |
| | | private ComActDAO comActDAO; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | try { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | String accessToken = util.getAppAccessToken(); |
| | | |
| | | ComActDO comActDO=comActDAO.selectById(comActActivityDO.getCommunityId()); |
| | | R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),1); |
| | | activitySignVOS.forEach(activitySignVO1 -> { |
| | | // 变更社区活动推送订阅消息给用户 |
| | | WxUtil.sendSubscribeHDBG(activitySignVO1.getOpenid(), accessToken, |
| | |
| | | comActActivityDO.getActivityAddr(), |
| | | com.panzhihua.common.utlis.DateUtils.format(comActActivityVO.getBeginAt(), |
| | | com.panzhihua.common.utlis.DateUtils.ymdhms_format), |
| | | comActActivityVO.getActivityAddr()); |
| | | comActActivityVO.getActivityAddr(),r.getData().getTemplateId()); |
| | | }); |
| | | } catch (Exception e) { |
| | | log.error("消息推送失败,失败原因:" + e.getMessage()); |
| | |
| | | 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()==2){ |
| | | if(comActActRegistDO.getEndTime()==null){ |
| | | comActActivityVO.setSignType(2); |
| | | } |
| | | else { |
| | | comActActivityVO.setSignType(1); |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | comActActivityVO.setSignType(1); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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 = |
| | |
| | | // 查询当前活动下参与居民 |
| | | 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(2)) { |
| | | //志愿者活动 |
| | | boolean userIsVolunteer = loginUserInfoVO.getIsVolunteer() == 1; |
| | | // 查询当前活动下参与志愿者 |
| | |
| | | * @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.fail(); |
| | | return R.ok(); |
| | | } |
| | | List<Long> longs = activitySignVOList.stream().map(activitySignVO -> activitySignVO.getActivityId()) |
| | | .collect(Collectors.toList()); |
| | |
| | | comActActivityDOS = comActActivityDOS.stream() |
| | | .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 -> { |
| | |
| | | try { |
| | | String accessToken = util.getAppAccessToken(); |
| | | actActivityList.forEach(actActivity -> { |
| | | ComActDO comActDO=comActDAO.selectById(actActivity.getCommunityId()); |
| | | R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),9); |
| | | // 查询报名活动人员列表 |
| | | List<ComActActSignDO> actSignList = comActActSignDAO.selectList(new QueryWrapper<ComActActSignDO>() |
| | | .lambda().eq(ComActActSignDO::getActivityId, actActivity.getId())); |
| | |
| | | // 查询用户openId |
| | | Map<String, String> map = comActActSignDAO.getUserOpenId(actSign.getUserId()); |
| | | if (map != null) { |
| | | |
| | | String openid = map.get("openid"); |
| | | // 推送消息 |
| | | WxUtil.sendSubscribeHDJJKS(openid, accessToken, actActivity.getActivityName(), |
| | | com.panzhihua.common.utlis.DateUtils.format(actActivity.getBeginAt(), |
| | | com.panzhihua.common.utlis.DateUtils.ymdhms_format), |
| | | actActivity.getActivityAddr(), actSignList.size() + ""); |
| | | actActivity.getActivityAddr(), actSignList.size() + "",r.getData().getTemplateId()); |
| | | } |
| | | |
| | | }); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public String getActBelongRegionCode(Long communityId) { |
| | | return baseMapper.getActBelongRegionCode(communityId); |
| | | } |
| | | |
| | | @Override |
| | | public R partyMemberCount(Long communityId, String year) { |
| | | PartyActivityStatics partyActivityStatics=this.comActActivityDAO.selectActivityStatics(communityId); |
| | | List<PartyActivityTypeChart> partyActivityTypeChart=this.comActActivityDAO.selectActivityChart(communityId); |