| | |
| | | vo.setId(lotteryEvent.getId()); |
| | | vo.setName(lotteryEvent.getName()); |
| | | vo.setActivityProfile(lotteryEvent.getActivityProfile()); |
| | | List<TUserLotteryEvent> userLotteryEvents = userLotteryEventService.list(new QueryWrapper<TUserLotteryEvent>().eq("lottery_event_id", id).eq("user_id", userId)); |
| | | vo.setLaveTimes(lotteryEvent.getTimes() - userLotteryEvents.size()); |
| | | //查询抽检活动奖品 |
| | | //订单抽奖,每次进去都是新的抽奖机会 |
| | | if(2 == lotteryEvent.getActivityType()){ |
| | | vo.setLaveTimes(lotteryEvent.getTimes()); |
| | | }else{ |
| | | List<TUserLotteryEvent> userLotteryEvents = userLotteryEventService.list(new QueryWrapper<TUserLotteryEvent>().eq("lottery_event_id", id).eq("user_id", userId)); |
| | | vo.setLaveTimes(lotteryEvent.getTimes() - userLotteryEvents.size()); |
| | | |
| | | //构建我的奖品明细 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); |
| | | List<UserLotteryEventVo> collect = userLotteryEvents.stream().map(s -> { |
| | | UserLotteryEventVo userLotteryEventVo = new UserLotteryEventVo(); |
| | | userLotteryEventVo.setName(s.getObjectName()); |
| | | userLotteryEventVo.setPrizeType(s.getPrizeType()); |
| | | userLotteryEventVo.setNumber(s.getNumber()); |
| | | if (Arrays.asList(2, 3).contains(s.getPrizeType())) { |
| | | MemberGiftRecord memberGiftRecord = remoteMemberService.getVerifyPrizeByGiftId(s.getId()).getData(); |
| | | userLotteryEventVo.setVerifyCode("3-" + memberGiftRecord.getPrizeId()); |
| | | userLotteryEventVo.setIsVerify(1 == memberGiftRecord.getVerifyStatus() ? 0 : 1); |
| | | userLotteryEventVo.setVerifyTime(null == memberGiftRecord.getVerifyTime() ? "" : sdf.format(memberGiftRecord.getVerifyTime())); |
| | | } |
| | | Member member = remoteMemberService.getMember(userId).getData(); |
| | | userLotteryEventVo.setVerifyShop("全部门店"); |
| | | if (null != member && null != member.getRelationShopId()) { |
| | | Shop shop = remoteShopService.getShop(member.getRelationShopId()).getData(); |
| | | userLotteryEventVo.setVerifyShop(shop.getShopName()); |
| | | } |
| | | return userLotteryEventVo; |
| | | }).collect(Collectors.toList()); |
| | | vo.setYourPrizeList(collect); |
| | | } |
| | | |
| | | //查询抽奖活动奖品 |
| | | List<TLotteryEventPrize> lotteryEventPrizeList = lotteryEventPrizeService.list(new QueryWrapper<TLotteryEventPrize>().eq("lottery_event_id", id)); |
| | | vo.setPrizeList(lotteryEventPrizeList); |
| | | //答题正确率 |
| | |
| | | vo.setCorrectAnswerRate(questionsServiceOne.getCorrectAnswerRate()); |
| | | } |
| | | } |
| | | //构建我的奖品明细 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm"); |
| | | List<UserLotteryEventVo> collect = userLotteryEvents.stream().map(s -> { |
| | | UserLotteryEventVo userLotteryEventVo = new UserLotteryEventVo(); |
| | | userLotteryEventVo.setName(s.getObjectName()); |
| | | userLotteryEventVo.setPrizeType(s.getPrizeType()); |
| | | userLotteryEventVo.setNumber(s.getNumber()); |
| | | if (Arrays.asList(2, 3).contains(s.getPrizeType())) { |
| | | MemberGiftRecord memberGiftRecord = remoteMemberService.getVerifyPrizeByGiftId(s.getId()).getData(); |
| | | userLotteryEventVo.setVerifyCode("3-" + memberGiftRecord.getPrizeId()); |
| | | userLotteryEventVo.setIsVerify(1 == memberGiftRecord.getVerifyStatus() ? 0 : 1); |
| | | userLotteryEventVo.setVerifyTime(null == memberGiftRecord.getVerifyTime() ? "" : sdf.format(memberGiftRecord.getVerifyTime())); |
| | | } |
| | | Member member = remoteMemberService.getMember(userId).getData(); |
| | | userLotteryEventVo.setVerifyShop("全部门店"); |
| | | if (null != member && null != member.getRelationShopId()) { |
| | | Shop shop = remoteShopService.getShop(member.getRelationShopId()).getData(); |
| | | userLotteryEventVo.setVerifyShop(shop.getShopName()); |
| | | } |
| | | return userLotteryEventVo; |
| | | }).collect(Collectors.toList()); |
| | | vo.setYourPrizeList(collect); |
| | | return vo; |
| | | } |
| | | |