| | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.dsh.course.entity.CoursePackageOrderStudent; |
| | | import com.dsh.course.feignClient.account.*; |
| | | import com.dsh.course.feignClient.account.model.*; |
| | | import com.dsh.course.feignClient.activity.PointMercharsClient; |
| | | import com.dsh.course.feignClient.competition.CompetitionClient; |
| | | import com.dsh.course.feignClient.competition.model.CompetionVO; |
| | | import com.dsh.course.feignClient.competition.model.Competition; |
| | | import com.dsh.course.feignClient.competition.model.CompetitionQuery; |
| | | import com.dsh.course.feignClient.competition.model.PaymentCompetition; |
| | | import com.dsh.course.feignClient.course.*; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackage; |
| | | import com.dsh.course.feignClient.course.model.TCoursePackagePayment; |
| | | import com.dsh.course.feignClient.other.BallClient; |
| | | import com.dsh.course.feignClient.other.SiteClient; |
| | | import com.dsh.course.feignClient.other.StoreClient; |
| | | import com.dsh.course.feignClient.other.model.GameDataQuery; |
| | | import com.dsh.course.feignClient.other.model.Site; |
| | | import com.dsh.course.feignClient.other.model.TGameRecord; |
| | | import com.dsh.course.model.MoneyBack; |
| | | import com.dsh.guns.config.UserExt; |
| | | import com.dsh.guns.core.base.controller.BaseController; |
| | |
| | | private String PREFIX = "/system/dataStatistics/"; |
| | | @Autowired |
| | | private ICityService cityService; |
| | | @Autowired |
| | | @Resource |
| | | private CityManagerClient cityManagerClient; |
| | | |
| | | @Autowired |
| | | private IUserService sysUserService; |
| | | @Autowired |
| | | @Resource |
| | | private AppUserClient appUserClient; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | private CourseClient courseClient; |
| | | |
| | | @Autowired |
| | | private IStoreService storeService; |
| | | @Autowired |
| | | @Resource |
| | | private VipPaymentClient vipPaymentClient; |
| | | @Autowired |
| | | @Resource |
| | | private FinanceClient financeClient; |
| | | @Autowired |
| | | @Resource |
| | | private CoursePackagePaymentClient coursePackagePaymentClient; |
| | | @Autowired |
| | | @Resource |
| | | private CompetitionClient competitionClient; |
| | | |
| | | @Autowired |
| | | private ISiteBookingService siteBookingService; |
| | | @Autowired |
| | | @Resource |
| | | private StoreClient storeClient; |
| | | @Autowired |
| | | @Resource |
| | | private SiteClient siteClient; |
| | | @Autowired |
| | | @Resource |
| | | private PointMercharsClient pointMercharsClient; |
| | | @Autowired |
| | | @Resource |
| | | private RefundCoursePackageClient refundCoursePackageClient; |
| | | @Resource |
| | | private CourseStuddentClient courseStuddentClient; |
| | | @Autowired |
| | | @Resource |
| | | private CoursePackageClient coursePackageClient; |
| | | @Autowired |
| | | private TOperatorService operatorService; |
| | | @Resource |
| | | private BallClient ballClient; |
| | | /** |
| | | * 跳转到平台统计数据页面 |
| | | */ |
| | |
| | | public String index(Model model) { |
| | | Object o = type1(null); |
| | | model.addAttribute("data",o); |
| | | |
| | | |
| | | |
| | | // 教学统计 |
| | | HashMap<String, Object> map = appUserClient.queryUserAge(); |
| | | model.addAttribute("stuData",map); |
| | | |
| | | |
| | | |
| | | return PREFIX + "platformIncome.html"; |
| | | } |
| | | |
| | |
| | | @RequestMapping(value = "/getIncomeData") |
| | | @ResponseBody |
| | | public Object getIncomeData(Integer operatorId,Integer storeId) { |
| | | // 充值记录查询query |
| | | RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery(); |
| | | // 报名课程查询query |
| | | RegisterOrderQuery query = new RegisterOrderQuery(); |
| | | // 充值记录查询query |
| | | RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery(); |
| | | // 赛事活动查询query |
| | | CompetitionQuery competitionQuery = new CompetitionQuery(); |
| | | // 会员支付查询query |
| | | IncomeQuery incomeQuery = new IncomeQuery(); |
| | | // 场地预约记录查询query |
| | | SiteBookingQuery siteBookingQuery = new SiteBookingQuery(); |
| | | // 智慧球场查询query |
| | | GameDataQuery gameDataQuery = new GameDataQuery(); |
| | | // 筛选运营商的是时候使用 |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | // 根据运营商ID 查询运营商下的所有门店 |
| | | if (storeId==null){ |
| | | if (operatorId!=null){ |
| | | List<TStore> stores = storeService.list(new QueryWrapper<TStore>().eq("operatorId", operatorId)); |
| | | // 拿到该运营商下的门店id集合 |
| | | storeIds = stores.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | query.setStoresIds(storeIds); |
| | | siteBookingQuery.setStoreIds(storeIds); |
| | | competitionQuery.setOperatorId(operatorId); |
| | | } |
| | | }else { |
| | | List<Integer> list = new ArrayList<>(); |
| | | list.add(storeId); |
| | | query.setStoresIds(list); |
| | | siteBookingQuery.setStoreIds(list); |
| | | competitionQuery.setStoreId(storeId); |
| | | } |
| | | |
| | | |
| | | Integer roleType = UserExt.getUser().getObjectType(); |
| | | rechargeRecordsQuery.setInsertType(roleType); |
| | | query.setInsertType(roleType); |
| | | competitionQuery.setInsertType(roleType); |
| | | incomeQuery.setInsertType(roleType); |
| | | incomeQuery.setInsertType(roleType); |
| | | |
| | | IncomeVO incomeVO = new IncomeVO(); |
| | | rechargeRecordsQuery.setObjectId(UserExt.getUser().getObjectId()); |
| | | List<IncomeVO> incomeVOS = new ArrayList<>(); |
| | | // 会员支付记录 |
| | | List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery); |
| | | for (VipPayment vipPayment : vipPayments) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | if (vipPayment.getPayStatus()==1){ |
| | | temp.setInsertTime(vipPayment.getInsertTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | if (vipPayment.getAmount() != null) { |
| | | temp.setAmount(new BigDecimal(vipPayment.getAmount().toString())); |
| | | } |
| | | // 会员支付记录 |
| | | List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery); |
| | | for (VipPayment vipPayment : vipPayments) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | if (vipPayment.getState()!=3){ |
| | | temp.setInsertTime(vipPayment.getPayTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | if (vipPayment.getAmount() != null) { |
| | | temp.setAmount(new BigDecimal(vipPayment.getAmount().toString())); |
| | | } |
| | | } |
| | | // 充值记录 |
| | | List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(rechargeRecordsQuery); |
| | | for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setInsertTime(rechargeRecordsVO.getPayTime()); |
| | | if (rechargeRecordsVO.getAmount() != null) { |
| | | temp.setAmount(rechargeRecordsVO.getAmount()); |
| | | } |
| | | if (rechargeRecordsVO.getState() !=3){ |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // 报名课程记录 |
| | | List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query); |
| | | for (RegisterOrderVO registerOrderVO : registerOrderVOS) { |
| | | if (registerOrderVO.getMoney() == null) { |
| | | continue; |
| | | } |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setInsertTime(registerOrderVO.getInsertTime()); |
| | | if (registerOrderVO.getMoney() != null) { |
| | | temp.setAmount(registerOrderVO.getMoney()); |
| | | } |
| | | if (registerOrderVO.getPayStatus()==2){ |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // query权限设置 获取运营商下的门店集合 |
| | | if (roleType==2){ |
| | | competitionQuery.setOperatorId(UserExt.getUser().getObjectId()); |
| | | } |
| | | // 报名活动 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | | for (PaymentCompetition competition : competitions) { |
| | | if (competition.getPayStatus() != 2) { |
| | | continue; |
| | | } |
| | | if (competition.getPayType()==3 || competition.getPayType()==4){ |
| | | continue; |
| | | } |
| | | if (competition.getState()==3)continue; |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setInsertTime(competition.getPayTime()); |
| | | if (competition.getAmount() != null) { |
| | | temp.setAmount(new BigDecimal(competition.getAmount().toString())); |
| | | } |
| | | incomeVOS.add(temp); |
| | | } |
| | | // 预约场地 |
| | | // 说明当前运营商下没有门店 |
| | | if (operatorId!=null && storeIds.size()==0){ |
| | | }else{ |
| | | List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | if(siteBooking.getStatus()==0 || siteBooking.getStatus()==5){ |
| | | continue; |
| | | } |
| | | // 充值记录 |
| | | List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(rechargeRecordsQuery); |
| | | List<RechargeRecords> rechargeRecords = financeClient.rechargeList1(rechargeRecordsQuery); |
| | | for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setInsertTime(rechargeRecordsVO.getInsertTime()); |
| | | if (rechargeRecordsVO.getAmount() != null) { |
| | | temp.setAmount(rechargeRecordsVO.getAmount()); |
| | | } |
| | | if (rechargeRecordsVO.getPayStatus() ==1){ |
| | | incomeVOS.add(temp); |
| | | } |
| | | if (siteBooking.getPayType() ==3 || siteBooking.getPayType() ==4)continue; |
| | | temp.setInsertTime(siteBooking.getPayTime()); |
| | | if (siteBooking.getPayMoney() != null) { |
| | | temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString())); |
| | | } |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | |
| | | } |
| | | // 报名课程记录 |
| | | List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query); |
| | | for (RegisterOrderVO registerOrderVO : registerOrderVOS) { |
| | | if (registerOrderVO.getMoney() == null) { |
| | | continue; |
| | | } |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setInsertTime(registerOrderVO.getInsertTime()); |
| | | if (registerOrderVO.getMoney() != null) { |
| | | temp.setAmount(registerOrderVO.getMoney()); |
| | | } |
| | | if (registerOrderVO.getPayStatus()==2){ |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // 报名活动 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | | for (PaymentCompetition competition : competitions) { |
| | | if (competition.getPayStatus() != 2) { |
| | | continue; |
| | | } |
| | | if (competition.getPayType()==3 || competition.getPayType()==4){ |
| | | continue; |
| | | } |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setInsertTime(competition.getInsertTime()); |
| | | if (competition.getAmount() != null) { |
| | | temp.setAmount(new BigDecimal(competition.getAmount().toString())); |
| | | } |
| | | incomeVOS.add(temp); |
| | | } |
| | | // 预约场地 |
| | | List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery); |
| | | for (SiteBooking siteBooking : siteBookings) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | if(siteBooking.getStatus()!=3){ |
| | | continue; |
| | | } |
| | | temp.setInsertTime(siteBooking.getPayTime()); |
| | | if (siteBooking.getPayMoney() != null) { |
| | | temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString())); |
| | | } |
| | | incomeVOS.add(temp); |
| | | } |
| | | // 积分商品 |
| | | List<PointMerchandiseIncomeVo> amount = pointMercharsClient.getAmount(); |
| | | for (PointMerchandiseIncomeVo pointMerchandiseIncomeVo : amount) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | if (pointMerchandiseIncomeVo==null) continue; |
| | | temp.setInsertTime(pointMerchandiseIncomeVo.getInsertTime()); |
| | | if (pointMerchandiseIncomeVo.getCash()!=null){ |
| | | temp.setAmount(pointMerchandiseIncomeVo.getCash()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | |
| | | // 平台智慧球场 |
| | | if (storeId==null&&operatorId==null){ |
| | | gameDataQuery.setObjectId(0); |
| | | List<TGameRecord> data = ballClient.getData(gameDataQuery); |
| | | for (TGameRecord datum : data) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setAmount(datum.getMoney()); |
| | | temp.setInsertTime(datum.getTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // 运营商 |
| | | if (operatorId!=null && storeId==null){ |
| | | gameDataQuery.setObjectId(operatorId); |
| | | List<TGameRecord> data = ballClient.getData(gameDataQuery); |
| | | for (TGameRecord datum : data) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setAmount(datum.getMoney()); |
| | | temp.setInsertTime(datum.getTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // 门店 |
| | | if (storeId!=null){ |
| | | gameDataQuery.setStoreId(storeId); |
| | | List<TGameRecord> data = ballClient.getData(gameDataQuery); |
| | | for (TGameRecord datum : data) { |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setAmount(datum.getMoney()); |
| | | temp.setInsertTime(datum.getTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // 最终返回的数据 |
| | | Map<String, List<Object>> monthlyData = new HashMap<>(); |
| | | // 创建一个 Map 用于存储每年的累计 amount |
| | |
| | | int years = DateUtil.year(new Date()); |
| | | for (int i = 0; i < 10; i++) { |
| | | integers1.add(years-i); |
| | | } |
| | | List<Object> collect = integers1.stream().sorted().collect(Collectors.toList()); |
| | | List<Object> objects1 = new ArrayList<>(); |
| | | for (Object o : collect) { |
| | | BigDecimal orDefault = yearToTotalAmountMap.getOrDefault(Integer.valueOf(o.toString()), BigDecimal.ZERO); |
| | | objects1.add(orDefault); |
| | | } |
| | | for (int year = integers1.get(0); year >= integers1.get(integers1.size()-1); year++) { |
| | | BigDecimal totalAmount = yearToTotalAmountMap.getOrDefault(year, BigDecimal.ZERO); |
| | | // 创建一个新的 IncomeVO 对象,并设置年份和累计金额 |
| | | IncomeVO resultIncomeVO = new IncomeVO(); |
| | | resultIncomeVO.setAmount(totalAmount); |
| | | resultIncomeVOS.add(resultIncomeVO); |
| | | monthlyData.put("yearIncome",objects1); |
| | | BigDecimal yearIn = new BigDecimal("0.00"); |
| | | for (Object o : objects1) { |
| | | yearIn = yearIn.add(new BigDecimal(o.toString())); |
| | | } |
| | | monthlyData.put("yearIncome",resultIncomeVOS); |
| | | |
| | | BigDecimal orDefault = yearToTotalAmountMap.getOrDefault(years, BigDecimal.ZERO); |
| | | objects.add(orDefault); |
| | | // 创建一个 Map 用于存储今年每个月的累计 amount |
| | | Map<Integer, BigDecimal> monthToTotalAmountMap = new HashMap<>(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | |
| | | } |
| | | } |
| | | monthlyData.put("monthIncome", Collections.singletonList(monthlyAmountList)); |
| | | |
| | | //yearMount |
| | | BigDecimal monthI = new BigDecimal("0.00"); |
| | | for (BigDecimal bigDecimal : monthlyAmountList) { |
| | | monthI = monthI.add(bigDecimal); |
| | | } |
| | | objects.add(monthI); |
| | | // 获取当前月份 |
| | | LocalDate currentDate = LocalDate.now(); |
| | | int currentMonth = currentDate.getMonthValue(); |
| | |
| | | LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX); |
| | | // 周度数据 |
| | | LocalDateTime week1Start = minNow.minusDays(6); |
| | | LocalDateTime week1End = maxNow; |
| | | LocalDateTime week1End = maxNow; |
| | | |
| | | LocalDateTime week2Start = minNow.minusDays(13); |
| | | LocalDateTime week2End = minNow.minusDays(7); |
| | |
| | | |
| | | LocalDateTime week4Start = minNow.minusDays(27); |
| | | LocalDateTime week4End = minNow.minusDays(21); |
| | | // 用于存放四个周的数据 |
| | | List<Object> objects1 = new ArrayList<>(); |
| | | |
| | | // 计算每个周的amount总和 |
| | | BigDecimal tAmount1 = BigDecimal.ZERO; |
| | | BigDecimal tAmount2 = BigDecimal.ZERO; |
| | |
| | | weekAmount.add(tAmount3); |
| | | weekAmount.add(tAmount4); |
| | | monthlyData.put("weekIncome", Collections.singletonList(weekAmount)); |
| | | |
| | | BigDecimal weekIn = new BigDecimal("0.00"); |
| | | for (BigDecimal bigDecimal : weekAmount) { |
| | | weekIn = weekIn.add(bigDecimal); |
| | | } |
| | | objects.add(weekIn); |
| | | LocalDateTime currentDateTime = LocalDateTime.now(); |
| | | List<BigDecimal> amountByDay = new ArrayList<>(Collections.nCopies(7, BigDecimal.ZERO)); |
| | | for (IncomeVO incomeVO3 : incomeVOS) { |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | monthlyData.put("dayIncome", Collections.singletonList(amountByDay)); |
| | | // 获取当前日期和时间 |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | // 今年的起始日期和结束日期 |
| | | LocalDateTime startOfYear = now.with(TemporalAdjusters.firstDayOfYear()).with(LocalTime.MIN); |
| | | LocalDateTime endOfYear = now.with(TemporalAdjusters.lastDayOfYear()).with(LocalTime.MAX); |
| | | // 本月的起始日期和结束日期 |
| | | LocalDateTime startOfMonth = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN); |
| | | LocalDateTime endOfMonth = now.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX); |
| | | // 本周的起始日期和结束日期 |
| | | LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).with(LocalTime.MIN); |
| | | LocalDateTime endOfWeek = now.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)).with(LocalTime.MAX); |
| | | // 今天的起始日期和结束日期 |
| | | LocalDateTime startOfDay = now.with(LocalTime.MIN); |
| | | LocalDateTime endOfDay = now.with(LocalTime.MAX); |
| | | // 创建日期格式化器 |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | // 筛选符合条件的IncomeVO对象 |
| | | List<IncomeVO> thisYearIncome = incomeVOS.stream() |
| | | .filter(income -> { |
| | | Date insertTime = income.getInsertTime(); |
| | | try { |
| | | LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault()); |
| | | return insertDateTime.isAfter(startOfYear) && insertDateTime.isBefore(endOfYear); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | // 使用 map 方法将 IncomeVO 转换为 BigDecimal,提取出 amount 字段 |
| | | List<BigDecimal> amounts = thisYearIncome.stream() |
| | | .map(IncomeVO::getAmount) |
| | | .collect(Collectors.toList()); |
| | | //本年总收入 |
| | | BigDecimal totalAmount = amounts.stream() |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | // 用于展示总营收 本年度营收 本月营收 本周营收 本日营收 |
| | | objects.add(totalAmount); |
| | | List<IncomeVO> thisMonthIncome = incomeVOS.stream() |
| | | .filter(income -> { |
| | | Date insertTime = income.getInsertTime(); |
| | | try { |
| | | LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault()); |
| | | return insertDateTime.isAfter(startOfMonth) && insertDateTime.isBefore(endOfMonth); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | List<BigDecimal> amountMonth = thisMonthIncome.stream() |
| | | .map(IncomeVO::getAmount) |
| | | .collect(Collectors.toList()); |
| | | // 使用 本月总收入 |
| | | BigDecimal totalMonth = amountMonth.stream() |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | |
| | | objects.add(totalMonth); |
| | | List<IncomeVO> thisWeekIncome = incomeVOS.stream() |
| | | .filter(income -> { |
| | | Date insertTime = income.getInsertTime(); |
| | | try { |
| | | LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault()); |
| | | return insertDateTime.isAfter(startOfWeek) && insertDateTime.isBefore(endOfWeek); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | List<BigDecimal> amountWeek = thisWeekIncome.stream() |
| | | .map(IncomeVO::getAmount) |
| | | .collect(Collectors.toList()); |
| | | // 使用 本月总收入 |
| | | BigDecimal totalWeek = amountWeek.stream() |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | objects.add(totalWeek); |
| | | List<IncomeVO> todayIncome = incomeVOS.stream() |
| | | .filter(income -> { |
| | | Date insertTime = income.getInsertTime(); |
| | | try { |
| | | LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault()); |
| | | return insertDateTime.isAfter(startOfDay) && insertDateTime.isBefore(endOfDay); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return false; |
| | | } |
| | | }) |
| | | .collect(Collectors.toList()); |
| | | List<BigDecimal> amountToday = todayIncome.stream() |
| | | .map(IncomeVO::getAmount) |
| | | .collect(Collectors.toList()); |
| | | // 使用 本月总收入 |
| | | BigDecimal totalToday = amountToday.stream() |
| | | .reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | BigDecimal totalToday = new BigDecimal("0.00"); |
| | | for (BigDecimal bigDecimal : amountByDay) { |
| | | totalToday = totalToday.add(bigDecimal); |
| | | } |
| | | objects.add(totalToday); |
| | | // 最后put |
| | | monthlyData.put("yearMount",objects); |
| | |
| | | for (int i = 0; i < 10; i++) { |
| | | integers.add(year-i); |
| | | } |
| | | List<Object> collect = integers.stream().sorted().collect(Collectors.toList()); |
| | | monthlyData.put("year",collect); |
| | | List<Object> collect1 = integers.stream().sorted().collect(Collectors.toList()); |
| | | monthlyData.put("year",collect1); |
| | | return monthlyData; |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | return null; |
| | | } |
| | | @RequestMapping(value = "/getYears") |
| | | @ResponseBody |
| | | public Object getYears() { |
| | | ArrayList<Object> integers = new ArrayList<>(); |
| | | int year = DateUtil.year(new Date()); |
| | | for (int i = 0; i < 10; i++) { |
| | | integers.add(year-i); |
| | | } |
| | | List<Object> collect = integers.stream().sorted().collect(Collectors.toList()); |
| | | |
| | | return collect; |
| | | } |
| | | /** |
| | | * 退费-平台 |
| | |
| | | List<MoneyBack> refund = refundCoursePackageClient.getRefund(); |
| | | |
| | | for (MoneyBack moneyBack : refund) { |
| | | List<TCoursePackagePayment> coursePackagePayments = courseStuddentClient.queryByIds(moneyBack.getIds()); |
| | | List<CoursePackageOrderStudent> coursePackagePayments = courseStuddentClient.queryByIds(moneyBack.getIds()); |
| | | BigDecimal totalAmount = BigDecimal.ZERO; |
| | | for (TCoursePackagePayment payment : coursePackagePayments){ |
| | | //课包名称 |
| | | TCoursePackage tCoursePackage = coursePackageClient.queryById(payment.getCoursePackageId()); |
| | | payment.setName(tCoursePackage.getName()); |
| | | payment.setId(Long.valueOf(tCoursePackage.getId())); |
| | | BigDecimal cashPayment = payment.getCashPayment(); |
| | | if (cashPayment==null){ |
| | | cashPayment = BigDecimal.ZERO; |
| | | } |
| | | Integer totalClassHours = payment.getTotalClassHours(); |
| | | BigDecimal result = new BigDecimal(0); |
| | | if (totalClassHours!=0) { |
| | | result = cashPayment.divide(BigDecimal.valueOf(totalClassHours), 2, RoundingMode.HALF_UP); |
| | | } |
| | | //单价 |
| | | payment.setOnePrice(result); |
| | | int has = payment.getTotalClassHours() - payment.getLaveClassHours(); |
| | | //剩余课时 |
| | | payment.setHasHours(has); |
| | | BigDecimal onePrice = payment.getOnePrice(); |
| | | Integer laveClassHours = payment.getLaveClassHours(); |
| | | BigDecimal result1 = onePrice.multiply(BigDecimal.valueOf(laveClassHours)); |
| | | //总价 |
| | | payment.setRestPrice(result1); |
| | | System.out.println("======="+result1); |
| | | totalAmount = totalAmount.add(result1); |
| | | IncomeVO temp = new IncomeVO(); |
| | | temp.setInsertTime(payment.getInsertTime()); |
| | | temp.setAmount(result1); |
| | | incomeVOS.add(temp); |
| | | } |
| | | // for (TCoursePackagePayment payment : coursePackagePayments){ |
| | | // //课包名称 |
| | | // TCoursePackage tCoursePackage = coursePackageClient.queryById(payment.getCoursePackageId()); |
| | | // payment.setName(tCoursePackage.getName()); |
| | | // payment.setId(Long.valueOf(tCoursePackage.getId())); |
| | | // BigDecimal cashPayment = payment.getCashPayment(); |
| | | // if (cashPayment==null){ |
| | | // cashPayment = BigDecimal.ZERO; |
| | | // } |
| | | // Integer totalClassHours = payment.getTotalClassHours(); |
| | | // BigDecimal result = new BigDecimal(0); |
| | | // if (totalClassHours!=0) { |
| | | // result = cashPayment.divide(BigDecimal.valueOf(totalClassHours), 2, RoundingMode.HALF_UP); |
| | | // } |
| | | // //单价 |
| | | // payment.setOnePrice(result); |
| | | // int has = payment.getTotalClassHours() - payment.getLaveClassHours(); |
| | | // //剩余课时 |
| | | // payment.setHasHours(has); |
| | | // BigDecimal onePrice = payment.getOnePrice(); |
| | | // Integer laveClassHours = payment.getLaveClassHours(); |
| | | // BigDecimal result1 = onePrice.multiply(BigDecimal.valueOf(laveClassHours)); |
| | | // //总价 |
| | | // payment.setRestPrice(result1); |
| | | // System.out.println("======="+result1); |
| | | // totalAmount = totalAmount.add(result1); |
| | | // IncomeVO temp = new IncomeVO(); |
| | | // temp.setInsertTime(payment.getInsertTime()); |
| | | // temp.setAmount(result1); |
| | | // incomeVOS.add(temp); |
| | | // } |
| | | } |
| | | // 获取赛事退费记录 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | |
| | | @RequestMapping(value = "/backStore") |
| | | @ResponseBody |
| | | public Object backStore(Integer id) { |
| | | List<Integer> collect1 = Arrays.asList(id); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<Integer> userPt = appUserClient.getUserStore(id); |
| | | if(userPt.size()==0){ |
| | | userPt.add(-1); |
| | | } |
| | | |
| | | ArrayList<Object> integers = new ArrayList<>(); |
| | | int year = DateUtil.year(new Date()); |
| | | List<TBackRecord> thisYear = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, year).in(TBackRecord::getUserId,userPt)); |
| | | List<TBackRecord> thisYear = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, year).in(TBackRecord::getUserId,list)); |
| | | double sum5 = thisYear.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | map.put("thisYear",sum5); |
| | | |
| | | List<TBackRecord> thisMonth = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, new SimpleDateFormat("yyyy-MM").format(new Date())).in(TBackRecord::getUserId,userPt)); |
| | | List<TBackRecord> thisMonth = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, new SimpleDateFormat("yyyy-MM").format(new Date())).in(TBackRecord::getUserId,list)); |
| | | double sum6= thisMonth.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | map.put("thisMonth",sum6); |
| | | |
| | |
| | | for (int i = 0; i < 10; i++) { |
| | | integers.add(year-i); |
| | | } |
| | | List<Object> collect = integers.stream().sorted().collect(Collectors.toList()); |
| | | List<Object> collectw = integers.stream().sorted().collect(Collectors.toList()); |
| | | // 年 |
| | | ArrayList<Double> years = new ArrayList<>(); |
| | | for (Object o : collect) { |
| | | for (Object o : collectw) { |
| | | double sum=0.0; |
| | | String s = o.toString(); |
| | | List<TBackRecord> list = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, s).in(TBackRecord::getUserId,userPt)); |
| | | sum = list.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | List<TBackRecord> lists = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, s).in(TBackRecord::getUserId,list)); |
| | | sum = lists.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | years.add(sum); |
| | | } |
| | | ArrayList<Double> months = new ArrayList<>(); |
| | |
| | | m="0"+i; |
| | | } |
| | | String s = year + "-" + m; |
| | | List<TBackRecord> list = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, s).in(TBackRecord::getUserId,userPt)); |
| | | sum = list.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | List<TBackRecord> lists = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().like(TBackRecord::getTime, s).in(TBackRecord::getUserId,list)); |
| | | sum = lists.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | months.add(sum); |
| | | } |
| | | |
| | |
| | | String s7 = minNow.minusDays(27).toString(); |
| | | String s8 = maxNow.minusDays(20).toString(); |
| | | |
| | | List<TBackRecord> list = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s7,s8).in(TBackRecord::getUserId,userPt)); |
| | | double sum = list.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | List<TBackRecord> lists = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s7,s8).in(TBackRecord::getUserId,list)); |
| | | double sum = lists.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | |
| | | List<TBackRecord> list1 = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s5,s6).in(TBackRecord::getUserId,userPt)); |
| | | double sum1 = list1.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | List<TBackRecord> list2 = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s3,s4).in(TBackRecord::getUserId,userPt)); |
| | | double sum2 = list2.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | List<TBackRecord> list3 = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s1,s2).in(TBackRecord::getUserId,userPt)); |
| | | List<TBackRecord> lists1 = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s5,s6).in(TBackRecord::getUserId,list)); |
| | | double sum1 = lists1.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | List<TBackRecord> lists2 = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s3,s4).in(TBackRecord::getUserId,list)); |
| | | double sum2 = lists2.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | List<TBackRecord> list3 = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s1,s2).in(TBackRecord::getUserId,list)); |
| | | double sum3 = list3.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | |
| | | map.put("thisWeek",sum3); |
| | |
| | | for (int i = 6; i >= 0; i--) { |
| | | String s = minNow.minusDays(i).toString(); |
| | | String s9 = maxNow.minusDays(i).toString(); |
| | | List<TBackRecord> day = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s,s9).in(TBackRecord::getUserId,userPt)); |
| | | List<TBackRecord> day = backRecordService.list(new LambdaQueryWrapper<TBackRecord>().between(TBackRecord::getTime, s,s9).in(TBackRecord::getUserId,list)); |
| | | double sum4 = day.stream().mapToDouble(TBackRecord::getMoney).sum(); |
| | | days.add(sum4); |
| | | if(i==0){ |
| | |
| | | @RequestMapping(value = "/userAndVipPt") |
| | | @ResponseBody |
| | | public Object userAndVipPt(Integer type) { |
| | | type=1; |
| | | HashMap<String, Object> map = appUserClient.userAndVipPt(type); |
| | | return map; |
| | | } |
| | | |
| | | @RequestMapping(value = "/stuPt") |
| | | @ResponseBody |
| | | public Object stuPt() { |
| | | HashMap<String, Object> map = appUserClient.stuPt(); |
| | | return map; |
| | | } |
| | | @RequestMapping(value = "/stuYys") |
| | | @ResponseBody |
| | | public Object stuYys(Integer id) { |
| | | List<TStore> list4 = storeService.list(new QueryWrapper<TStore>().eq("operatorId", id).eq("state", 1)); |
| | | List<Integer> collect1 = list4.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map = appUserClient.stuYys(list); |
| | | return map; |
| | | } |
| | | @RequestMapping(value = "/stuStores") |
| | | @ResponseBody |
| | | public Object stuStores(Integer id) { |
| | | List<Integer> collect1 = Arrays.asList(id); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map = appUserClient.stuStores(list); |
| | | return map; |
| | | } |
| | | |
| | | // 消耗课时数据-平台 |
| | | @RequestMapping(value = "/coursePt") |
| | | @ResponseBody |
| | | public Object coursePt() { |
| | | List<Integer> userPt = appUserClient.getUserPt(Arrays.asList(1)); |
| | | HashMap<String, Object> map = coursePackagePaymentClient.coursePt(userPt); |
| | | return map; |
| | | } |
| | | // 消耗课时数据-运营商 |
| | | @RequestMapping(value = "/courseYys") |
| | | @ResponseBody |
| | | public Object courseYys(Integer id) { |
| | | List<Integer> userPt = appUserClient.getUserYYs(id); |
| | | HashMap<String, Object> map = coursePackagePaymentClient.coursePt(userPt); |
| | | return map; |
| | | } |
| | | // 消耗课时数据-运营商 |
| | | @RequestMapping(value = "/courseStore") |
| | | @ResponseBody |
| | | public Object courseStore(Integer id) { |
| | | List<Integer> userPt = appUserClient.getUserPt(Arrays.asList(id)); |
| | | HashMap<String, Object> map = coursePackagePaymentClient.coursePt(userPt); |
| | | return map; |
| | | } |
| | | |
| | | @RequestMapping(value = "/userAndVipYys") |
| | | @ResponseBody |
| | | public Object userAndVipYys(Integer id) { |
| | | List<TStore> list4 = storeService.list(new QueryWrapper<TStore>().eq("operatorId", id).eq("state", 1)); |
| | | List<Integer> collect1 = list4.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map = appUserClient.userAndVipYys(list); |
| | | return map; |
| | | } |
| | | @RequestMapping(value = "/userAndVipStore") |
| | | @ResponseBody |
| | | public Object userAndVipStore(Integer id) { |
| | | List<Integer> collect1 = Arrays.asList(id); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map = appUserClient.userAndVipStore(list); |
| | | return map; |
| | | } |
| | | @RequestMapping(value = "/actPt") |
| | |
| | | HashMap<String, Object> map = competitionClient.actPt(userPt); |
| | | |
| | | List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getOperatorId, 0)); |
| | | long l1=0; |
| | | for (TStore tStore : list) { |
| | | long l = DateUtil.betweenDay(tStore.getCreateTime(), new Date(), true); |
| | | tStore.getStartTime(); |
| | | String startTime = tStore.getStartTime(); |
| | | String endTime = tStore.getEndTime(); |
| | | String s = startTime.split(":")[0]; |
| | | String s1 = endTime.split(":")[1]; |
| | | Integer integer = Integer.valueOf(s); |
| | | Integer integer1 = Integer.valueOf(s1); |
| | | Integer a =0; |
| | | if(integer==0 && integer1==0){ |
| | | a=24; |
| | | }else { |
| | | a= integer1-integer; |
| | | } |
| | | l1 += l * a; |
| | | } |
| | | map.put("allHour",l1); |
| | | return map; |
| | | } |
| | | @RequestMapping(value = "/actYys") |
| | | @ResponseBody |
| | | public Object actYys(Integer id) { |
| | | CompetionVO competionVO = new CompetionVO(); |
| | | List<TStore> list4 = storeService.list(new QueryWrapper<TStore>().eq("operatorId", id).eq("state", 1)); |
| | | List<Integer> collect1 = list4.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | |
| | | competionVO.setIds(list); |
| | | competionVO.setOperatorId(id); |
| | | HashMap<String, Object> map = competitionClient.actYys(competionVO); |
| | | |
| | | List<TStore> lists = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getOperatorId, id)); |
| | | long l1=0; |
| | | for (TStore tStore : lists) { |
| | | long l = DateUtil.betweenDay(tStore.getCreateTime(), new Date(), true); |
| | | String startTime = tStore.getStartTime(); |
| | | String endTime = tStore.getEndTime(); |
| | | String s = startTime.split(":")[0]; |
| | | String s1 = endTime.split(":")[1]; |
| | | Integer integer = Integer.valueOf(s); |
| | | Integer integer1 = Integer.valueOf(s1); |
| | | Integer a =0; |
| | | if(integer==0 && integer1==0){ |
| | | a=24; |
| | | }else { |
| | | a= integer-integer1; |
| | | } |
| | | l1 += l * a; |
| | | } |
| | | map.put("allHour",l1); |
| | | return map; |
| | | } |
| | | @RequestMapping(value = "/actStore") |
| | | @ResponseBody |
| | | public Object actStore(Integer id) { |
| | | List<Integer> collect1 = Arrays.asList(id); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map = competitionClient.actPt(list); |
| | | |
| | | List<TStore> lists = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getOperatorId, 0)); |
| | | long l1=0; |
| | | for (TStore tStore : lists) { |
| | | long l = DateUtil.betweenDay(tStore.getCreateTime(), new Date(), true); |
| | | String startTime = tStore.getStartTime(); |
| | | String endTime = tStore.getEndTime(); |
| | | String s = startTime.split(":")[0]; |
| | | String s1 = endTime.split(":")[1]; |
| | | Integer integer = Integer.valueOf(s); |
| | | Integer integer1 = Integer.valueOf(s1); |
| | | Integer a =0; |
| | | if(integer==0 && integer1==0){ |
| | | a=24; |
| | | }else { |
| | | a= integer1-integer; |
| | | } |
| | | l1 += l * a; |
| | | } |
| | | map.put("allHour",l1); |
| | | return map; |
| | | } |
| | | |
| | |
| | | @RequestMapping("/operator") |
| | | public String operator(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | List<TOperator> list = operatorService.list(new LambdaQueryWrapper<TOperator>().ne(TOperator::getState, 3)); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | |
| | | List<TOperator> list = operatorService.list(new LambdaQueryWrapper<TOperator>().ne(TOperator::getState, 3).ne(TOperator::getId,0)); |
| | | model.addAttribute("list",list); |
| | | model.addAttribute("objectType",objectType); |
| | | model.addAttribute("objectId",objectId); |
| | | return PREFIX + "operatorIncome.html"; |
| | | } |
| | | |
| | |
| | | public Object selectYys(Integer id,String time) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | // 找出平台的用户 |
| | | List<User> list = sysUserService.list(new LambdaQueryWrapper<User>().eq(User::getObjectType, 2)); |
| | | List<Integer> ids = list.stream().map(User::getId).collect(Collectors.toList()); |
| | | List<Integer> userIds = appUserClient.getUserYYs(id); |
| | | QueryDataFee queryDataFee = new QueryDataFee(time, userIds); |
| | | // 会员费 |
| | | HashMap<String, Object> map1 = appUserClient.queryFee(queryDataFee); |
| | | Object fee1 = map1.get("fee1"); |
| | | |
| | | map.put("fee1",fee1); |
| | | //玩湃比 |
| | | Object fee2 = map1.get("fee2"); |
| | | map.put("fee2",fee2); |
| | | // List<User> list = sysUserService.list(new LambdaQueryWrapper<User>().eq(User::getObjectType, 2)); |
| | | // List<Integer> ids = list.stream().map(User::getId).collect(Collectors.toList()); |
| | | // List<Integer> userIds = appUserClient.getUserYYs(id); |
| | | List<TStore> list4 = storeService.list(new QueryWrapper<TStore>().eq("operatorId", id).eq("state", 1)); |
| | | List<Integer> collect1 = list4.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | QueryDataFee queryDataFee = new QueryDataFee(time, collect1); |
| | | // 课程收入 |
| | | HashMap<String, Object> map3 = courseClient.queryFee(queryDataFee); |
| | | map.put("fee3",map3.get("fee")); |
| | |
| | | map.put("fee4",aDouble1); |
| | | |
| | | // 订场 |
| | | if(ids.size()==0){ |
| | | List<Integer> ids = new ArrayList<>(); |
| | | if(collect1.size()==0){ |
| | | ids.add(-1); |
| | | }else{ |
| | | List<TSite> list = siteService.list(new QueryWrapper<TSite>().in("storeId", collect1).eq("state", 1)); |
| | | ids = list.stream().map(TSite::getId).collect(Collectors.toList()); |
| | | if(collect1.size()==0){ |
| | | ids.add(-1); |
| | | } |
| | | } |
| | | LambdaQueryWrapper<SiteBooking> vipPaymentLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | |
| | | String etime = time.split(" - ")[1]+" 23:59:59"; |
| | | vipPaymentLambdaQueryWrapper.between(SiteBooking::getInsertTime,stime,etime); |
| | | } |
| | | if(userIds.size()==0){ |
| | | userIds.add(-1); |
| | | } |
| | | vipPaymentLambdaQueryWrapper.in(SiteBooking::getAppUserId,userIds); |
| | | vipPaymentLambdaQueryWrapper.in(SiteBooking::getSiteId,ids); |
| | | vipPaymentLambdaQueryWrapper.ne(SiteBooking::getStatus,0); |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | |
| | | @RequestMapping("/selectStore") |
| | | public Object selectStore(Integer id,String time) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | // 找出平台的用户 |
| | | List<User> list = sysUserService.list(new LambdaQueryWrapper<User>().eq(User::getObjectType, 2)); |
| | | List<Integer> ids = list.stream().map(User::getId).collect(Collectors.toList()); |
| | | List<Integer> userIds = appUserClient.getUserStore(id); |
| | | QueryDataFee queryDataFee = new QueryDataFee(time, userIds); |
| | | List<Integer> collect1 = Arrays.asList(id); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | QueryDataFee queryDataFee = new QueryDataFee(time, list); |
| | | // 会员费 |
| | | HashMap<String, Object> map1 = appUserClient.queryFee(queryDataFee); |
| | | Object fee1 = map1.get("fee1"); |
| | |
| | | map.put("fee4",aDouble1); |
| | | |
| | | // 订场 |
| | | if(ids.size()==0){ |
| | | ids.add(-1); |
| | | } |
| | | LambdaQueryWrapper<SiteBooking> vipPaymentLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | | String stime = time.split(" - ")[0]+" 00:00:00"; |
| | | String etime = time.split(" - ")[1]+" 23:59:59"; |
| | | vipPaymentLambdaQueryWrapper.between(SiteBooking::getInsertTime,stime,etime); |
| | | } |
| | | if(userIds.size()==0){ |
| | | userIds.add(-1); |
| | | } |
| | | vipPaymentLambdaQueryWrapper.in(SiteBooking::getAppUserId,userIds); |
| | | vipPaymentLambdaQueryWrapper.in(SiteBooking::getAppUserId,list); |
| | | vipPaymentLambdaQueryWrapper.ne(SiteBooking::getStatus,0); |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | objects.add(2); |
| | | vipPaymentLambdaQueryWrapper.in(SiteBooking::getPayType,objects); |
| | | List<SiteBooking> list1 = siteBookingService.list(vipPaymentLambdaQueryWrapper); |
| | | double sum = list1.stream().mapToDouble(SiteBooking::getPayMoney).sum(); |
| | | List<SiteBooking> lists1 = siteBookingService.list(vipPaymentLambdaQueryWrapper); |
| | | double sum = lists1.stream().mapToDouble(SiteBooking::getPayMoney).sum(); |
| | | map.put("fee5",sum); |
| | | |
| | | |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getSiteId).collect(Collectors.toList()); |
| | | if(collect.size()==0){ |
| | | List<Integer> collects = list1.stream().map(SiteBooking::getSiteId).collect(Collectors.toList()); |
| | | if(collects.size()==0){ |
| | | collect.add(-1); |
| | | } |
| | | List<TSite> list3 = siteService.list(new LambdaQueryWrapper<TSite>().in(TSite::getId, collect)); |
| | | List<TSite> list3 = siteService.list(new LambdaQueryWrapper<TSite>().in(TSite::getId, collects)); |
| | | for (SiteBooking siteBooking : list1) { |
| | | for (TSite tSite : list3) { |
| | | if(siteBooking.getSiteId().equals(tSite.getId())){ |
| | |
| | | } |
| | | |
| | | |
| | | List<TSiteType> list2 = siteTypeService.list(); |
| | | List<TSiteType> lists2 = siteTypeService.list(); |
| | | |
| | | List<Map<String,Object>> mapList = new ArrayList<>(); |
| | | |
| | | for (TSiteType tSiteType : list2) { |
| | | for (TSiteType tSiteType : lists2) { |
| | | HashMap<String, Object> map2 = new HashMap<>(); |
| | | map2.put("name",tSiteType.getName()); |
| | | double a =0; |
| | | for (SiteBooking siteBooking : list1) { |
| | | if(tSiteType.getId().equals(siteBooking.getType())){ |
| | | if(null != siteBooking.getType() && tSiteType.getId().equals(siteBooking.getType()) && null != siteBooking.getPayMoney()){ |
| | | a += siteBooking.getPayMoney(); |
| | | } |
| | | } |
| | |
| | | @RequestMapping("/store") |
| | | public String store(Model model) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1)); |
| | | model.addAttribute("list",list); |
| | | List<TStore> tStores = new ArrayList<>(); |
| | | if(objectType == 1){ |
| | | tStores = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1)); |
| | | } |
| | | if (objectType == 2){ |
| | | tStores = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1).eq(TStore::getOperatorId,UserExt.getUser().getObjectId())); |
| | | } |
| | | if (objectType == 3){ |
| | | tStores = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1).eq(TStore::getId,UserExt.getUser().getObjectId())); |
| | | } |
| | | model.addAttribute("list",tStores); |
| | | model.addAttribute("objectType",objectType); |
| | | model.addAttribute("objectId",UserExt.getUser().getObjectId()); |
| | | return PREFIX + "storeIncome.html"; |
| | | } |
| | | |
| | |
| | | // 会员费 |
| | | HashMap<String, Object> map1 = appUserClient.queryFee(queryDataFee); |
| | | Object fee1 = map1.get("fee1"); |
| | | |
| | | map.put("fee1",fee1); |
| | | //玩湃比 |
| | | Object fee2 = map1.get("fee2"); |
| | |
| | | map.put("fee3",map3.get("fee")); |
| | | Object data = map3.get("data"); |
| | | map.put("courseData",data); |
| | | |
| | | |
| | | // 赛事收入 |
| | | Double aDouble1 = competitionClient.queryFee(queryDataFee); |
| | | map.put("fee4",aDouble1); |
| | | |
| | | // 订场 |
| | | if(ids.size()==0){ |
| | | ids.add(-1); |
| | |
| | | if(userIds.size()==0){ |
| | | userIds.add(-1); |
| | | } |
| | | vipPaymentLambdaQueryWrapper.in(SiteBooking::getAppUserId,userIds); |
| | | vipPaymentLambdaQueryWrapper.ne(SiteBooking::getStatus,0); |
| | | vipPaymentLambdaQueryWrapper.ne(SiteBooking::getStatus,5); |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | objects.add(2); |
| | | vipPaymentLambdaQueryWrapper.in(SiteBooking::getPayType,objects); |
| | | List<SiteBooking> list1 = siteBookingService.list(vipPaymentLambdaQueryWrapper); |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>() |
| | | .ne("status",0) |
| | | .ne("status",5) |
| | | .ne("payType",3) |
| | | .ne("payType",4)); |
| | | double sum = list1.stream().mapToDouble(SiteBooking::getPayMoney).sum(); |
| | | map.put("fee5",sum); |
| | | // 智慧球场查询query |
| | | GameDataQuery gameDataQuery = new GameDataQuery(); |
| | | gameDataQuery.setObjectId(0); |
| | | // 平台智慧球场 |
| | | List<TGameRecord> data1 = ballClient.getData(gameDataQuery); |
| | | double sum1 = data1.stream() |
| | | .map(TGameRecord::getMoney) // 获取每个 TGameRecord 对象的 money 字段 |
| | | .mapToDouble(BigDecimal::doubleValue) // 将 BigDecimal 转换为 double |
| | | .sum(); |
| | | map.put("fee5",sum+sum1); |
| | | |
| | | |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getSiteId).collect(Collectors.toList()); |
| | |
| | | @RequestMapping("/stuUserDataYys") |
| | | @ResponseBody |
| | | public Object stuUserDataYys(Integer id) { |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | HashMap<String, Object> map = appUserClient.queryUserAgeYys(id); |
| | | |
| | | List<TStore> list4 = storeService.list(new QueryWrapper<TStore>().eq("operatorId", id).eq("state", 1)); |
| | | List<Integer> collect1 = list4.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | HashMap<String, Object> map = appUserClient.queryUserAgeYys(list); |
| | | return map; |
| | | } |
| | | @RequestMapping("/stuUserDataStore") |
| | | @ResponseBody |
| | | public Object stuUserDataStore(Integer id) { |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | HashMap<String, Object> map = appUserClient.queryUserAgeStore(id); |
| | | |
| | | List<Integer> collect1 = Arrays.asList(id); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map = appUserClient.queryUserAgeStore(list); |
| | | |
| | | return map; |
| | | } |
| | | @RequestMapping("/selectYysJx") |
| | | @ResponseBody |
| | | public Object selectYysJx(Integer id) { |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | HashMap<String, Object> map1 = appUserClient.queryUserAgeYys1(id); |
| | | // 找出运营商的用户 |
| | | List<Integer> userYYs = appUserClient.getUserYYs(id); |
| | | List<TStore> list4 = storeService.list(new QueryWrapper<TStore>().eq("operatorId", id).eq("state", 1)); |
| | | List<Integer> collect1 = list4.stream().map(TStore::getId).collect(Collectors.toList()); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | |
| | | List<Map<String, Object>> mapList = coursePackagePaymentClient.queryCourseData(userYYs); |
| | | HashMap<String, Object> map1 = appUserClient.queryUserAgeYys1(list); |
| | | List<Map<String, Object>> mapList = coursePackagePaymentClient.queryCourseData(list); |
| | | ArrayList<Object> objects2 = new ArrayList<>(); |
| | | ArrayList<Object> objects3 = new ArrayList<>(); |
| | | for (Map<String, Object> map : mapList) { |
| | |
| | | @RequestMapping("/selectStoreJx") |
| | | @ResponseBody |
| | | public Object selectStoreJx(Integer id) { |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | HashMap<String, Object> map1 = appUserClient.queryUserAgeStore1(id); |
| | | // 找出运营商的用户 |
| | | List<Integer> userYYs = appUserClient.getUserYYs(id); |
| | | List<Integer> collect1 = Arrays.asList(id); |
| | | //课程 |
| | | List<Integer> list = coursePackagePaymentClient.queryPaymentCoursePackage(collect1); |
| | | //场地 |
| | | List<SiteBooking> list1 = siteBookingService.list(new QueryWrapper<SiteBooking>().in("storeId", collect1).eq("state", 1)); |
| | | List<Integer> collect = list1.stream().map(SiteBooking::getAppUserId).collect(Collectors.toList()); |
| | | list.addAll(collect); |
| | | //赛事 |
| | | List<Integer> list2 = competitionClient.queryAppUserId(collect1); |
| | | list.addAll(list2); |
| | | //门票 |
| | | |
| | | HashMap<String, Object> map1 = appUserClient.queryUserAgeStore1(list); |
| | | |
| | | List<Map<String, Object>> mapList = coursePackagePaymentClient.queryCourseData(userYYs); |
| | | List<Map<String, Object>> mapList = coursePackagePaymentClient.queryCourseData(list); |
| | | ArrayList<Object> objects2 = new ArrayList<>(); |
| | | ArrayList<Object> objects3 = new ArrayList<>(); |
| | | for (Map<String, Object> map : mapList) { |