| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.account.entity.RechargeRecords; |
| | | import com.dsh.account.entity.TAppUser; |
| | | import com.dsh.account.entity.VipPayment; |
| | | import com.dsh.account.enums.RechargeRecordEnum; |
| | | import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; |
| | | import com.dsh.account.feignclient.competition.model.PaymentCompetition; |
| | | import com.dsh.account.feignclient.course.CoursePaymentClient; |
| | | import com.dsh.account.feignclient.course.model.CouponPaymentVo; |
| | | import com.dsh.account.feignclient.course.model.TCoursePackagePayment; |
| | | import com.dsh.account.feignclient.other.RechargeConfigClient; |
| | | import com.dsh.account.feignclient.other.SiteClient; |
| | | import com.dsh.account.feignclient.other.model.SiteBooking; |
| | | import com.dsh.account.mapper.RechargeRecordsMapper; |
| | | import com.dsh.account.mapper.TAppUserMapper; |
| | | import com.dsh.account.model.IncomeQuery; |
| | | import com.dsh.account.model.query.RechargeRecordsQuery; |
| | | import com.dsh.account.model.vo.RechargeRecordsVO; |
| | | import com.dsh.account.model.vo.userBenefitDetail.RechargeDetailsVo; |
| | | import com.dsh.account.model.vo.userBenefitDetail.RechargePayRequest; |
| | | import com.dsh.account.model.vo.userBenefitDetail.RechargesDetail; |
| | |
| | | |
| | | @Resource |
| | | private RechargeConfigClient reconMapper; |
| | | @Autowired |
| | | private RechargeRecordsMapper rechargeRecordsMapper; |
| | | |
| | | |
| | | @Override |
| | |
| | | } |
| | | } |
| | | // 2.课包购买 |
| | | List<TCoursePackagePayment> appuserCourseList = cpClient.getAppuserCourseList(appUserId); |
| | | List<CouponPaymentVo> appuserCourseList = cpClient.getAppuserCourseList(appUserId); |
| | | if (appuserCourseList.size() > 0){ |
| | | for (TCoursePackagePayment tCoursePackagePayment : appuserCourseList) { |
| | | for (CouponPaymentVo tCoursePackagePayment : appuserCourseList) { |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.COURSE_PACKAGE_PURCHASE.getMsg() ); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(tCoursePackagePayment.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("-" + tCoursePackagePayment.getPlayPaiCoin()); |
| | | consumeDetail.setConsumeTime(tCoursePackagePayment.getTime()); |
| | | consumeDetail.setConsumeAmount("-" + tCoursePackagePayment.getAmount()); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | } |
| | |
| | | if (siteBookings.size() > 0 ){ |
| | | for (SiteBooking booking : siteBookings) { |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.name()); |
| | | consumeDetail.setConsumeName(RechargeRecordEnum.VENUE_RESERVATION.getMsg()); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(booking.getInsertTime())); |
| | | consumeDetail.setConsumeAmount("-" + booking.getPayMoney()); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | // 4.智慧球场 |
| | | // 4.智慧球场 |
| | | List<Map<String,Object>> list = stClient.game(appUserId); |
| | | if (list.size() > 0 ){ |
| | | for (Map<String,Object> booking : list) { |
| | | RechargesDetail consumeDetail = new RechargesDetail(); |
| | | consumeDetail.setConsumeName("激战游戏"); |
| | | consumeDetail.setConsumeTime(simpleDateFormat.format(new Date(Long.valueOf(booking.get("time").toString())))); |
| | | consumeDetail.setConsumeAmount("-"+String.valueOf(booking.get("money"))); |
| | | consumeDetail.setRecordId(2); |
| | | details.add(consumeDetail); |
| | | } |
| | | } |
| | | |
| | | // 5.充值 |
| | | |
| | | // 5.充值 |
| | | List<RechargeRecords> rechargeRecords = this.baseMapper.selectList(new QueryWrapper<RechargeRecords>() |
| | | .eq("payStatus", 2) |
| | | .eq("appUserId", appUserId) |
| | |
| | | } |
| | | }); |
| | | } |
| | | Pageable pageable = PageRequest.of(pageNum - 1, pageSize); |
| | | Page<RechargesDetail> page = getPage(details, pageable); |
| | | return page.getContent(); |
| | | //当前第几页 |
| | | int pageNo = pageNum; |
| | | //一页五条 |
| | | int size = pageSize; |
| | | |
| | | //分页 |
| | | details = details.stream().skip((pageNo - 1) * size).limit(size). |
| | | collect(Collectors.toList()); |
| | | |
| | | return details; |
| | | } |
| | | |
| | | @Override |
| | |
| | | BigDecimal amount = BigDecimal.ZERO; |
| | | if (rechargeConfig.size() > 0){ |
| | | for (Map<String, Object> stringObjectMap : rechargeConfig) { |
| | | Long o = (Long) stringObjectMap.get("money"); |
| | | double o = (double) stringObjectMap.get("money"); |
| | | if (BigDecimal.valueOf(o).compareTo(request.getAmount()) == 0) { |
| | | amount = BigDecimal.valueOf(o); |
| | | rechargeRecords.setAmount(BigDecimal.valueOf(o)); |
| | |
| | | return null; |
| | | } |
| | | |
| | | // 对数据进行分页处理的方法 |
| | | private static Page<RechargesDetail> getPage(List<RechargesDetail> dataList, Pageable pageable) { |
| | | int start = (int) pageable.getOffset(); |
| | | int end = Math.min((start + pageable.getPageSize()), dataList.size()); |
| | | return new PageImpl<>(dataList.subList(start, end), pageable, dataList.size()); |
| | | @Override |
| | | public List<RechargeRecordsVO> rechargeList(RechargeRecordsQuery query) { |
| | | String STime = null; |
| | | String ETime = null; |
| | | if (StringUtils.hasLength(query.getTime())) { |
| | | STime = query.getTime().split(" - ")[0] + " 00:00:00"; |
| | | ETime = query.getTime().split(" - ")[1] + " 23:59:59"; |
| | | } |
| | | |
| | | return rechargeRecordsMapper.rechargeList(query,STime,ETime); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public List<VipPayment> listAll(IncomeQuery query) { |
| | | String STime = null; |
| | | String ETime = null; |
| | | if (StringUtils.hasLength(query.getTime())) { |
| | | STime = query.getTime().split(" - ")[0] + " 00:00:00"; |
| | | ETime = query.getTime().split(" - ")[1] + " 23:59:59"; |
| | | } |
| | | return rechargeRecordsMapper.listAll(query,STime,ETime,query.getAmount(),query.getInsertType()); |
| | | } |
| | | public static <T> List<T> pageList(List<T> list, int pageNum, int pageSize) { |
| | | //计算总页数 |
| | | int page = list.size() % pageSize == 0 ? list.size() / pageSize : list.size() / pageSize + 1; |
| | | //兼容性分页参数错误 |
| | | pageNum = pageNum <= 0 ? 1 : pageNum; |
| | | pageNum = pageNum >= page ? page : pageNum; |
| | | // 开始索引 |
| | | int begin = 0; |
| | | // 结束索引 |
| | | int end = 0; |
| | | if (pageNum != page) { |
| | | begin = (pageNum - 1) * pageSize; |
| | | end = begin + pageSize; |
| | | } else { |
| | | begin = (pageNum - 1) * pageSize; |
| | | end = list.size(); |
| | | } |
| | | return list.subList(begin, end); |
| | | } |
| | | |
| | | } |