From f88cfa02e36752e4acad7adc4b045155e8e50f21 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 08 十二月 2023 09:16:29 +0800 Subject: [PATCH] Merge branch 'master' of http://120.76.84.145:10101/gitblit/r/java/PlayPai --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java | 169 ++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 114 insertions(+), 55 deletions(-) diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java index ae91893..a2044b0 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java @@ -3,6 +3,7 @@ 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; @@ -14,8 +15,11 @@ 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.TGameRecord; import com.dsh.course.model.MoneyBack; import com.dsh.guns.config.UserExt; import com.dsh.guns.core.base.controller.BaseController; @@ -88,6 +92,8 @@ private CoursePackageClient coursePackageClient; @Autowired private TOperatorService operatorService; + @Autowired + private BallClient ballClient; /** * 跳转到平台统计数据页面 */ @@ -95,15 +101,9 @@ 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"; } @@ -124,6 +124,8 @@ IncomeQuery incomeQuery = new IncomeQuery(); // 场地预约记录查询query SiteBookingQuery siteBookingQuery = new SiteBookingQuery(); + // 智慧球场查询query + GameDataQuery gameDataQuery = new GameDataQuery(); // 筛选运营商的是时候使用 List<Integer> storeIds = new ArrayList<>(); // 根据运营商ID 查询运营商下的所有门店 @@ -156,8 +158,8 @@ List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery); for (VipPayment vipPayment : vipPayments) { IncomeVO temp = new IncomeVO(); - if (vipPayment.getPayStatus()==1){ - temp.setInsertTime(vipPayment.getInsertTime()); + if (vipPayment.getState()!=3){ + temp.setInsertTime(vipPayment.getPayTime()); incomeVOS.add(temp); } if (vipPayment.getAmount() != null) { @@ -168,14 +170,13 @@ List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(rechargeRecordsQuery); for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) { IncomeVO temp = new IncomeVO(); - temp.setInsertTime(rechargeRecordsVO.getInsertTime()); + temp.setInsertTime(rechargeRecordsVO.getPayTime()); if (rechargeRecordsVO.getAmount() != null) { temp.setAmount(rechargeRecordsVO.getAmount()); } - if (rechargeRecordsVO.getPayStatus() ==1){ + if (rechargeRecordsVO.getState() !=3){ incomeVOS.add(temp); } - } // 报名课程记录 List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query); @@ -192,6 +193,10 @@ incomeVOS.add(temp); } } + // query权限设置 获取运营商下的门店集合 + if (roleType==2){ + competitionQuery.setOperatorId(UserExt.getUser().getObjectId()); + } // 报名活动 List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); for (PaymentCompetition competition : competitions) { @@ -201,8 +206,9 @@ if (competition.getPayType()==3 || competition.getPayType()==4){ continue; } + if (competition.getState()==3)continue; IncomeVO temp = new IncomeVO(); - temp.setInsertTime(competition.getInsertTime()); + temp.setInsertTime(competition.getPayTime()); if (competition.getAmount() != null) { temp.setAmount(new BigDecimal(competition.getAmount().toString())); } @@ -215,9 +221,10 @@ List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery); for (SiteBooking siteBooking : siteBookings) { IncomeVO temp = new IncomeVO(); - if(siteBooking.getStatus()!=3){ + if(siteBooking.getStatus()==0 || siteBooking.getStatus()==5){ continue; } + if (siteBooking.getPayType() ==3 || siteBooking.getPayType() ==4)continue; temp.setInsertTime(siteBooking.getPayTime()); if (siteBooking.getPayMoney() != null) { temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString())); @@ -230,9 +237,43 @@ 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); } } @@ -445,39 +486,39 @@ 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); @@ -860,7 +901,7 @@ @RequestMapping(value = "/courseYys") @ResponseBody public Object courseYys(Integer id) { - List<Integer> userPt = appUserClient.getUserPt(Arrays.asList(id)); + List<Integer> userPt = appUserClient.getUserYYs(id); HashMap<String, Object> map = coursePackagePaymentClient.coursePt(userPt); return map; } @@ -1222,8 +1263,17 @@ @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"; @@ -1249,7 +1299,6 @@ // 会员费 HashMap<String, Object> map1 = appUserClient.queryFee(queryDataFee); Object fee1 = map1.get("fee1"); - map.put("fee1",fee1); //玩湃比 Object fee2 = map1.get("fee2"); @@ -1259,12 +1308,9 @@ 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); @@ -1278,15 +1324,28 @@ 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()); -- Gitblit v1.7.1