| | |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import cn.binarywang.wx.miniapp.api.WxMaService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.panzhihua.common.constants.HttpStatus; |
| | | import com.panzhihua.common.model.dtos.PageBaseDTO; |
| | | import com.panzhihua.common.model.dtos.community.ActivityInviteDTO; |
| | | import com.panzhihua.common.model.vos.jinhui.JinhuiCoinGeneralTableVO; |
| | | import com.panzhihua.common.model.vos.jinhui.JinhuiGoldCoinRecordVO; |
| | | import com.panzhihua.common.service.jinhui.JinhuiCommunityService; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.service_community.dao.ComActNeighborCircleDAO; |
| | | import com.panzhihua.service_community.dao.ComActNeighborCircleTopicWestMapper; |
| | | import com.panzhihua.service_community.dao.ComPbMemberDAO; |
| | | import com.panzhihua.service_community.entity.ComActActivityInvite; |
| | | import com.panzhihua.service_community.entity.JinhuiCoinGeneralTable; |
| | | import com.panzhihua.service_community.model.dos.ComActNeighborCircleTopicWestDO; |
| | | import com.panzhihua.service_community.service.ComActActivityInviteService; |
| | | import com.panzhihua.service_community.util.WxMaConfiguration; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | |
| | | private ComActActivityInviteService comActActivityInviteService; |
| | | @Resource |
| | | private ComActNeighborCircleDAO comActNeighborCircleDAO; |
| | | @Resource |
| | | private WxMaConfiguration wxMaConfiguration; |
| | | @Resource |
| | | private JinhuiCommunityService jinhuiCommunityService; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | List<ActivitySignVO> activitySignVOS = comActActSignDAO.listActivitySigns(activitySignVO); |
| | | if (!activitySignVOS.isEmpty()) { |
| | | try { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | String accessToken = util.getAccessToken(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | String accessToken = maService.getAccessToken(); |
| | | ComActDO comActDO=comActDAO.selectById(comActActivityDO.getCommunityId()); |
| | | R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),1); |
| | | activitySignVOS.forEach(activitySignVO1 -> { |
| | |
| | | } |
| | | page.setSize(pageSize); |
| | | page.setCurrent(pageNum); |
| | | Long communityId = comActActivityVO.getCommunityId(); |
| | | if (null != communityId){ |
| | | List<Long> communityIds = comActDAO.selectIds(communityId); |
| | | if (CollUtil.isEmpty(communityIds)) { |
| | | communityIds = new ArrayList<>(); |
| | | communityIds.add(communityId); |
| | | } |
| | | comActActivityVO.setCommunityIds(communityIds); |
| | | } |
| | | 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()); |
| | | } |
| | | ComActDO comActDO = comActDAO.selectById(comActActivityVO.getCommunityId()); |
| | | if (nonNull(comActDO)) { |
| | | comActActivityVO.setStreetId(comActDO.getStreetId()); |
| | | } |
| | | } |
| | | iPage = comActActivityDAO.pageProjectActivity(page, comActActivityVO); |
| | | } else { |
| | |
| | | comActActSignDO.setStatus(0); |
| | | comActActSignDO.setReason(signactivityVO.getReason()); |
| | | num = comActActSignDAO.updateById(comActActSignDO); |
| | | //计算用户积分 |
| | | if (num > 0) { |
| | | AddComActIntegralUserDTO addComActIntegralUserDTO = new AddComActIntegralUserDTO(); |
| | | addComActIntegralUserDTO.setUserId(userId); |
| | |
| | | // 修改报名状态 变为报名中 |
| | | // int num1 = comActActivityDAO.updateStatusToBeginSign(); |
| | | // log.info("定时任务--修改社区活动报名状态活动数量【{}】", num1); |
| | | int num3 = comActActivityDAO.updateStatusToBeginAfterSingEnd(); |
| | | log.info("定时任务--报名结束修改社区活动进行状态活动数量【{}】", num3); |
| | | // 查询已经结束的活动,需要计算积分 |
| | | List<Long> activityEndIds = comActActivityDAO.selectBeginIds(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | if(!CollectionUtils.isEmpty(activityEndIds)){ |
| | | activityEndIds.forEach(activityId->{ |
| | | List<String> openIds=comActActivityDAO.selectOpenIdByActivityId(activityId); |
| | |
| | | openIds.forEach(op->{ |
| | | WxXCXTempSend wxXCXTempSend=new WxXCXTempSend(); |
| | | try { |
| | | WxUtil.sendLongTimeTemplate(op,wxXCXTempSend.getAccessToken("wx118de8a734d269f0"),"活动开始提醒","您参加的活动已开始","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+activityId); |
| | | WxUtil.sendLongTimeTemplate(op,maService.getAccessToken(),"活动开始提醒","您参加的活动已开始","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+activityId); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | }); |
| | | } |
| | | int num3 = comActActivityDAO.updateStatusToBeginAfterSingEnd(); |
| | | log.info("定时任务--报名结束修改社区活动进行状态活动数量【{}】", num3); |
| | | // 修改进行状态 变为进行中或者已结束 |
| | | List<Long> ids = comActActivityDAO.getActivityEndIds(); |
| | | if(!CollectionUtils.isEmpty(ids)){ |
| | |
| | | openIds.forEach(op->{ |
| | | WxXCXTempSend wxXCXTempSend=new WxXCXTempSend(); |
| | | try { |
| | | WxUtil.sendLongTimeTemplate(op,wxXCXTempSend.getAccessToken("wx118de8a734d269f0"),"活动结束提醒","您参加的活动已结束","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+id); |
| | | WxUtil.sendLongTimeTemplate(op,maService.getAccessToken(),"活动结束提醒","您参加的活动已结束","packageC/pages/activity/communityActivityDetails/communityActivityDetails?id="+id); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | } |
| | | page.setSize(pageSize); |
| | | page.setCurrent(pageNum); |
| | | Long communityId = comActActivityVO.getCommunityId(); |
| | | if (null != communityId){ |
| | | List<Long> communityIds = comActDAO.selectIds(communityId); |
| | | if (CollUtil.isEmpty(communityIds)) { |
| | | communityIds = new ArrayList<>(); |
| | | communityIds.add(communityId); |
| | | } |
| | | comActActivityVO.setCommunityIds(communityIds); |
| | | } |
| | | IPage<ComActActivityVO> iPage = comActActivityDAO.pageActivityCommunityBack(page, comActActivityVO); |
| | | iPage.getRecords().forEach(vo ->{ |
| | | List<ComActActEvaluateDO> comActActEvaluateDOList = comActActEvaluateDAO |
| | |
| | | .lambda().le(ComActActivityDO::getBeginAt, DateUtils.addDays(new Date(), 1)) |
| | | .ge(ComActActivityDO::getBeginAt, new Date()).notIn(ComActActivityDO::getStatus,5,6)); |
| | | if (!actActivityList.isEmpty()) { |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | WxMaService maService = wxMaConfiguration.getMaService("wx118de8a734d269f0"); |
| | | try { |
| | | String accessToken = util.getAccessToken(); |
| | | String accessToken = maService.getAccessToken(); |
| | | actActivityList.forEach(actActivity -> { |
| | | ComActDO comActDO=comActDAO.selectById(actActivity.getCommunityId()); |
| | | R<SysTemplateConfigVO> r=userService.selectTemplate(comActDO.getAreaCode(),9); |
| | |
| | | |
| | | @Override |
| | | public R partyMemberCount(Long communityId, String year) { |
| | | PartyActivityStatics partyActivityStatics=this.comActActivityDAO.selectActivityStatics(communityId); |
| | | List<PartyActivityTypeChart> partyActivityTypeChart=this.comActActivityDAO.selectActivityChart(communityId); |
| | | |
| | | List<Long> communityIds = comActDAO.selectIds(communityId); |
| | | if (CollUtil.isEmpty(communityIds)){ |
| | | communityIds = new ArrayList<>(); |
| | | communityIds.add(communityId); |
| | | } |
| | | PartyActivityStatics partyActivityStatics=this.comActActivityDAO.selectActivityStatics(communityIds); |
| | | List<PartyActivityTypeChart> partyActivityTypeChart=this.comActActivityDAO.selectActivityChart(communityIds); |
| | | if(partyActivityStatics.getActivityCount()!=null&&partyActivityStatics.getActivityCount()>0){ |
| | | if(!CollectionUtils.isEmpty(partyActivityTypeChart)){ |
| | | partyActivityTypeChart.forEach(partyActivityTypeChart1 -> { |
| | |
| | | } |
| | | } |
| | | partyActivityStatics.setPartyActivityTypeChartList(partyActivityTypeChart); |
| | | partyActivityStatics.setPartyActivityLines(getPoints(communityId,year)); |
| | | partyActivityStatics.setPartyActivityLines(getPoints(communityIds,year)); |
| | | return R.ok(partyActivityStatics); |
| | | } |
| | | |
| | |
| | | return R.ok(comActActivityDAO.exportPartyMemberDetail(commonPage)); |
| | | } |
| | | |
| | | public List<PartyActivityLine> getPoints(Long communityId,String year){ |
| | | public List<PartyActivityLine> getPoints(List<Long> communityIds,String year){ |
| | | List<PartyActivityLine> partyActivityLines=new ArrayList<>(); |
| | | for(int i=1;i<=12;i++){ |
| | | String x=""; |
| | |
| | | } |
| | | PartyActivityLine partyActivityLine=new PartyActivityLine(); |
| | | partyActivityLine.setX(i+"月"); |
| | | Integer y=this.comActActivityDAO.selectActivityLine(communityId,year,x); |
| | | Integer y=this.comActActivityDAO.selectActivityLine(communityIds,year,x); |
| | | partyActivityLine.setY(y); |
| | | partyActivityLines.add(partyActivityLine); |
| | | } |
| | | return partyActivityLines; |
| | | } |
| | | |
| | | @Override |
| | | public R pageActivityBigScreen(PageBaseDTO pageBaseDTO) { |
| | | return R.ok(comActActivityDAO.pageActivityBigScreen(new Page<>(pageBaseDTO.getPageNum(),pageBaseDTO.getPageSize()))); |
| | | } |
| | | |
| | | @Override |
| | | public R jinhuiSignActivity(SignactivityVO signactivityVO) { |
| | | Long activityId = signactivityVO.getActivityId(); |
| | | Integer type = signactivityVO.getType(); |
| | | Long userId = signactivityVO.getUserId(); |
| | | Integer isVolunteer = 0; |
| | | // 查询社区活动 |
| | | ComActActivityDO actActivityDO = this.baseMapper.selectById(activityId); |
| | | 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)); |
| | | Integer signIdentity = signactivityVO.getSignIdentity(); |
| | | if (1 == type) { |
| | | if (nonNull(comActActSignDO) && comActActSignDO.getStatus().equals(1)) { |
| | | return R.fail("已经报名过了,请勿重复提交"); |
| | | } |
| | | Integer activityType = actActivityDO.getType(); |
| | | Boolean isInvite = false; |
| | | if (activityType == 1) { |
| | | if (signIdentity == 1) { |
| | | //以居民身份参与活动 |
| | | Integer residentMax = actActivityDO.getParticipantMax(); |
| | | if (residentMax == null) { |
| | | return R.fail("活动暂未对居民开放"); |
| | | } |
| | | // 查询当前活动下参与居民 |
| | | Integer residentCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() |
| | | .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getSignIdentity, 1).eq(ComActActSignDO::getStatus, 1)); |
| | | if (residentMax != -1 && residentMax <= residentCount) { |
| | | return R.fail("报名人数已满"); |
| | | } |
| | | } else if (signIdentity == 2) { |
| | | //以党员身份参与活动 |
| | | Integer partyMemberMax = actActivityDO.getPartyMemberMax(); |
| | | if (partyMemberMax == null) { |
| | | return R.fail("活动暂未对党员开放"); |
| | | } |
| | | ComActActivityInvite activityInvite = comActActivityInviteService.getBaseMapper().selectOne(new LambdaQueryWrapper<ComActActivityInvite>() |
| | | .eq(ComActActivityInvite::getActivityId, activityId).eq(ComActActivityInvite::getUserId, userId)); |
| | | if (isNull(activityInvite)) { |
| | | // int count = pbMemberDAO.checkIsPbMember(userId); |
| | | // if (count < 1) { |
| | | // return R.fail(HttpStatus.NOT_ACCEPTABLE, "您还不是党员"); |
| | | // } |
| | | // 查询当前活动下参与志愿者 |
| | | Integer partyMemberCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() |
| | | .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getSignIdentity, 2) |
| | | .eq(ComActActSignDO::getStatus, 1).eq(ComActActSignDO::getIsInvite, false)); |
| | | if (partyMemberMax != -1 && partyMemberMax <= partyMemberCount) { |
| | | return R.fail("报名人数已满"); |
| | | } |
| | | } else { |
| | | isInvite = true; |
| | | } |
| | | } else { |
| | | //以志愿者身份参与活动 |
| | | Integer volunteerMax = actActivityDO.getVolunteerMax(); |
| | | if (volunteerMax == null) { |
| | | return R.fail("活动暂未对志愿者开放"); |
| | | } |
| | | // int count = pbMemberDAO.checkIsVolunteer(userId); |
| | | // if (count < 1) { |
| | | // return R.fail(HttpStatus.NOT_ACCEPTABLE, "您还不是志愿者"); |
| | | // } |
| | | // 查询当前活动下参与志愿者 |
| | | Integer volunteerCount = comActActSignDAO.selectCount(new QueryWrapper<ComActActSignDO>().lambda() |
| | | .eq(ComActActSignDO::getActivityId, activityId).eq(ComActActSignDO::getSignIdentity, 3).eq(ComActActSignDO::getStatus, 1)); |
| | | if (volunteerMax != -1 && volunteerMax <= volunteerCount) { |
| | | return R.fail("报名人数已满"); |
| | | } |
| | | } |
| | | } |
| | | if (nonNull(comActActSignDO)) { |
| | | comActActSignDO.setStatus(1); |
| | | comActActSignDO.setCreateAt(new Date()); |
| | | comActActSignDO.setReason(null); |
| | | comActActSignDO.setSignIdentity(signIdentity); |
| | | comActActSignDO.setTimes(comActActSignDO.getTimes()+1); |
| | | comActActSignDO.setIsInvite(isInvite); |
| | | comActActSignDO.setCheckUnitId(signactivityVO.getCheckUnitId()); |
| | | num = comActActSignDAO.updateById(comActActSignDO); |
| | | } else { |
| | | comActActSignDO = new ComActActSignDO(); |
| | | comActActSignDO.setActivityId(activityId); |
| | | comActActSignDO.setUserId(userId); |
| | | comActActSignDO.setSignIdentity(signIdentity); |
| | | comActActSignDO.setTimes(1); |
| | | comActActSignDO.setIsInvite(isInvite); |
| | | comActActSignDO.setCheckUnitId(signactivityVO.getCheckUnitId()); |
| | | 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("缺少取消原因"); |
| | | } |
| | | if (isNull(comActActSignDO)) { |
| | | return R.fail("未报名"); |
| | | } |
| | | comActActSignDO.setStatus(0); |
| | | comActActSignDO.setReason(signactivityVO.getReason()); |
| | | num = comActActSignDAO.updateById(comActActSignDO); |
| | | //计算用户金汇币 |
| | | if (num > 0) |
| | | { |
| | | if(!StringUtils.isEmpty(actActivityDO.getJinhuiCoinPunishment()) && !StringUtils.equals(actActivityDO.getJinhuiCoinPunishment(),"0")) |
| | | { |
| | | //查询个人金汇币总额 |
| | | JinhuiCoinGeneralTable jinhuiCoinGeneralTable=comActActRegistDAO.getDetails(userId+""); |
| | | if(jinhuiCoinGeneralTable!=null) |
| | | { |
| | | if (!StringUtils.isEmpty(jinhuiCoinGeneralTable.getGoldCoin())) |
| | | { |
| | | JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); |
| | | jinhuiVO.setId(jinhuiCoinGeneralTable.getId()); |
| | | |
| | | int punishmentGold=Integer.valueOf(actActivityDO.getJinhuiCoinPunishment()); |
| | | int allGold=Integer.valueOf(jinhuiCoinGeneralTable.getGoldCoin()); |
| | | if(punishmentGold>=allGold) |
| | | { |
| | | jinhuiVO.setGoldCoin("0"); |
| | | } |
| | | else |
| | | { |
| | | allGold=allGold-punishmentGold; |
| | | jinhuiVO.setGoldCoin(allGold+""); |
| | | } |
| | | jinhuiCommunityService.coinTableEditData(jinhuiVO); |
| | | } |
| | | } |
| | | |
| | | JinhuiGoldCoinRecordVO jVo=new JinhuiGoldCoinRecordVO(); |
| | | jVo.setCommunityId(actActivityDO.getCommunityId()+""); |
| | | jVo.setTitle("取消志愿者活动"); |
| | | jVo.setUserId(userId+""); |
| | | jVo.setRemark("取消志愿者活动"); |
| | | jVo.setType("2"); |
| | | jVo.setGoldCoin(actActivityDO.getJinhuiCoinPunishment()); |
| | | jinhuiCommunityService.recordAddData(jVo); |
| | | |
| | | |
| | | } |
| | | } |
| | | } |
| | | if (num > 0) { |
| | | return R.ok(isVolunteer); |
| | | } |
| | | return R.fail(); |
| | | } |
| | | |
| | | @Override |
| | | public R jinhuiActivitySignIn(ComActActRegistVO comActActRegistVO) { |
| | | Long activityId = comActActRegistVO.getActivityId(); |
| | | Long userId = comActActRegistVO.getUserId(); |
| | | if (isNull(activityId)) { |
| | | return R.fail("签到所属活动id不能为空!"); |
| | | } |
| | | ComActActivityDO comActActivityDO = comActActivityDAO.selectById(activityId); |
| | | if (isNull(comActActivityDO)) { |
| | | 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(); |
| | | if (nowDate.before(beginAt) || nowDate.after(endAt)) { |
| | | return R.fail("不在活动时间范围内"); |
| | | } |
| | | //奖励的金汇币 |
| | | Integer rewardIntegral = Integer.valueOf(comActActivityDO.getJinhuiCoinAward()); |
| | | boolean isHave = rewardIntegral > 0; |
| | | ComActActRegistDO comActActRegistDO = new ComActActRegistDO(); |
| | | 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) { |
| | | return R.fail("未签到无法签退"); |
| | | } |
| | | if (comActActActRegistDO.getEndTime() != null) { |
| | | return R.fail("无法重复签退"); |
| | | } |
| | | |
| | | //1.居民 2.党员 3.志愿者 |
| | | switch (comActActActRegistDO.getSignIdentity()) |
| | | { |
| | | case 1: |
| | | if(comActActivityDO.getParticipantRewardWay()==2) |
| | | { |
| | | int hours = com.panzhihua.common.utlis.DateUtils.getHour(comActActActRegistDO.getStartTime(), comActActActRegistDO.getEndTime()); |
| | | if(hours>1) |
| | | { |
| | | rewardIntegral=rewardIntegral * hours; |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case 2: |
| | | if(comActActivityDO.getPbRewardWay()==2) |
| | | { |
| | | int hours = com.panzhihua.common.utlis.DateUtils.getHour(comActActActRegistDO.getStartTime(), comActActActRegistDO.getEndTime()); |
| | | if(hours>1) |
| | | { |
| | | rewardIntegral=rewardIntegral * hours; |
| | | } |
| | | } |
| | | break; |
| | | |
| | | case 3: |
| | | if(comActActivityDO.getVolunteerRewardWay()==2) |
| | | { |
| | | int hours = com.panzhihua.common.utlis.DateUtils.getHour(comActActActRegistDO.getStartTime(), comActActActRegistDO.getEndTime()); |
| | | if(hours>1) |
| | | { |
| | | rewardIntegral=rewardIntegral * hours; |
| | | } |
| | | } |
| | | break; |
| | | } |
| | | |
| | | comActActRegistDO.setId(comActActActRegistDO.getId()); |
| | | comActActRegistDO.setEndTime(nowDate); |
| | | comActActRegistDO.setAward(rewardIntegral); |
| | | |
| | | int result = comActActRegistDAO.updateById(comActActRegistDO); |
| | | if (result > 0) { |
| | | if (isHave) { |
| | | // AddComActIntegralUserDTO addComActIntegralUserDTO = new AddComActIntegralUserDTO(); |
| | | // addComActIntegralUserDTO.setUserId(userId); |
| | | // addComActIntegralUserDTO.setIntegralType(integralType); |
| | | // addComActIntegralUserDTO.setIntegral(retrieveIntegral); |
| | | // addComActIntegralUserDTO.setSignIdentity(comActActSignDO.getSignIdentity()); |
| | | // addComActIntegralUserDTO.setCommunityId(comActActivityDO.getCommunityId()); |
| | | // addComActIntegralUserDTO.setServiceId(activityId); |
| | | // addComActIntegralUserDTO.setRemark(remark); |
| | | // comActIntegralUserTradeService.addIntegralTradeAdmin(addComActIntegralUserDTO); |
| | | |
| | | //查询个人金汇币总额 |
| | | JinhuiCoinGeneralTable jinhuiCoinGeneralTable=comActActRegistDAO.getDetails(userId+""); |
| | | if(jinhuiCoinGeneralTable!=null) |
| | | { |
| | | JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); |
| | | jinhuiVO.setId(jinhuiCoinGeneralTable.getId()); |
| | | int allGold=0; |
| | | if (!StringUtils.isEmpty(jinhuiCoinGeneralTable.getGoldCoin())) |
| | | { |
| | | allGold=Integer.valueOf(jinhuiCoinGeneralTable.getGoldCoin()); |
| | | } |
| | | allGold=allGold+rewardIntegral; |
| | | jinhuiVO.setGoldCoin(allGold+""); |
| | | jinhuiCommunityService.coinTableEditData(jinhuiVO); |
| | | } |
| | | else |
| | | { |
| | | JinhuiCoinGeneralTableVO jinhuiVO=new JinhuiCoinGeneralTableVO(); |
| | | jinhuiVO.setCommunityId(comActActivityDO.getCommunityId()+""); |
| | | jinhuiVO.setGoldCoin(rewardIntegral+""); |
| | | jinhuiVO.setUserId(userId+""); |
| | | jinhuiCommunityService.coinTableAddData(jinhuiVO); |
| | | } |
| | | |
| | | JinhuiGoldCoinRecordVO jVo=new JinhuiGoldCoinRecordVO(); |
| | | jVo.setCommunityId(comActActivityDO.getCommunityId()+""); |
| | | jVo.setTitle("志愿者活动奖励"); |
| | | jVo.setUserId(userId+""); |
| | | jVo.setRemark("志愿者活动奖励"); |
| | | jVo.setType("1"); |
| | | jVo.setGoldCoin(rewardIntegral+""); |
| | | jinhuiCommunityService.recordAddData(jVo); |
| | | return R.ok(); |
| | | } else { |
| | | return R.ok(); |
| | | } |
| | | } |
| | | } else { |
| | | int signDayCount = comActActRegistDAO.selectCount(new QueryWrapper<ComActActRegistDO>().lambda() |
| | | .eq(ComActActRegistDO::getActivityId, activityId).eq(ComActActRegistDO::getUserId, userId) |
| | | .eq(ComActActRegistDO::getCodeId, comActActRegistVO.getCodeId())); |
| | | int signAllCount = comActActRegistDAO.selectCount(new QueryWrapper<ComActActRegistDO>().lambda() |
| | | .eq(ComActActRegistDO::getActivityId, activityId).eq(ComActActRegistDO::getUserId, userId)); |
| | | if (signDayCount > 0) { |
| | | return R.fail("请扫描新的签到码"); |
| | | } |
| | | if (isHave) { |
| | | int limit = comActActivityDO.getLimit().intValue(); |
| | | if (limit != -1 && signAllCount >= limit) { |
| | | return R.fail("签到次数上限"); |
| | | } |
| | | } |
| | | comActActRegistDO.setActivityId(activityId); |
| | | comActActRegistDO.setStartTime(new Date()); |
| | | comActActRegistDO.setType(comActActivityDO.getType()); |
| | | comActActRegistDO.setUserId(userId); |
| | | comActActRegistDO.setSignIdentity(comActActSignDO.getSignIdentity()); |
| | | comActActRegistDO.setCreateAt(nowDate); |
| | | comActActRegistDO.setCodeId(comActActRegistVO.getCodeId()); |
| | | comActActRegistDO.setAward(0); |
| | | comActActRegistDO.setPosition(comActActRegistVO.getPosition()); |
| | | comActActRegistDO.setCheckUnitId(comActActSignDO.getCheckUnitId()); |
| | | comActActRegistDO.setTimes(signAllCount + 1); |
| | | int result = comActActRegistDAO.insert(comActActRegistDO); |
| | | if (result > 0) { |
| | | return R.ok(); |
| | | } |
| | | } |
| | | return R.fail("网络错误,请重试"); |
| | | } |
| | | } |