| | |
| | | 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.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; |
| | |
| | | private CoursePackageClient coursePackageClient; |
| | | @Autowired |
| | | private TOperatorService operatorService; |
| | | @Autowired |
| | | 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"; |
| | | } |
| | | |
| | |
| | | IncomeQuery incomeQuery = new IncomeQuery(); |
| | | // 场地预约记录查询query |
| | | SiteBookingQuery siteBookingQuery = new SiteBookingQuery(); |
| | | // 智慧球场查询query |
| | | GameDataQuery gameDataQuery = new GameDataQuery(); |
| | | // 筛选运营商的是时候使用 |
| | | List<Integer> storeIds = new ArrayList<>(); |
| | | // 根据运营商ID 查询运营商下的所有门店 |
| | |
| | | query.setInsertType(roleType); |
| | | competitionQuery.setInsertType(roleType); |
| | | incomeQuery.setInsertType(roleType); |
| | | 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()); |
| | | if (vipPayment.getState()!=3){ |
| | | temp.setInsertTime(vipPayment.getPayTime()); |
| | | incomeVOS.add(temp); |
| | | } |
| | | if (vipPayment.getAmount() != null) { |
| | |
| | | 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); |
| | |
| | | incomeVOS.add(temp); |
| | | } |
| | | } |
| | | // query权限设置 获取运营商下的门店集合 |
| | | if (roleType==2){ |
| | | competitionQuery.setOperatorId(UserExt.getUser().getObjectId()); |
| | | } |
| | | // 报名活动 |
| | | List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery); |
| | | for (PaymentCompetition competition : competitions) { |
| | |
| | | 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())); |
| | | } |
| | |
| | | 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())); |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | 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) { |
| | | if(UserExt.getUser().getObjectType()==3){ |
| | | id = UserExt.getUser().getObjectId(); |
| | | } |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | List<Integer> userPt = appUserClient.getUserStore(id); |
| | | if(userPt.size()==0){ |
| | |
| | | @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; |
| | | } |
| | |
| | | @RequestMapping(value = "/userAndVipStore") |
| | | @ResponseBody |
| | | public Object userAndVipStore(Integer id) { |
| | | if(UserExt.getUser().getObjectType()==3){ |
| | | id = UserExt.getUser().getObjectId(); |
| | | } |
| | | HashMap<String, Object> map = appUserClient.userAndVipStore(id); |
| | | return map; |
| | | } |
| | |
| | | @RequestMapping(value = "/actStore") |
| | | @ResponseBody |
| | | public Object actStore(Integer id) { |
| | | |
| | | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | if(objectType==3){ |
| | | id = UserExt.getUser().getObjectId(); |
| | | } |
| | | List<Integer> userPt = appUserClient.getUserStore(id); |
| | | HashMap<String, Object> map = competitionClient.actPt(userPt); |
| | | |
| | |
| | | // 找出平台的用户 |
| | | List<User> list = sysUserService.list(new LambdaQueryWrapper<User>().eq(User::getObjectType, 2)); |
| | | List<Integer> ids = list.stream().map(User::getId).collect(Collectors.toList()); |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | if(objectType==3){ |
| | | id = UserExt.getUser().getObjectId(); |
| | | } |
| | | List<Integer> userIds = appUserClient.getUserStore(id); |
| | | QueryDataFee queryDataFee = new QueryDataFee(time, userIds); |
| | | // 会员费 |
| | |
| | | @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 == 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("/stuUserDataStore") |
| | | @ResponseBody |
| | | public Object stuUserDataStore(Integer id) { |
| | | if(UserExt.getUser().getObjectType()==3){ |
| | | id = UserExt.getUser().getObjectId(); |
| | | } |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | HashMap<String, Object> map = appUserClient.queryUserAgeStore(id); |
| | |
| | | @RequestMapping("/selectStoreJx") |
| | | @ResponseBody |
| | | public Object selectStoreJx(Integer id) { |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | if(objectType==3){ |
| | | id = UserExt.getUser().getObjectId(); |
| | | } |
| | | ArrayList<Integer> objects = new ArrayList<>(); |
| | | objects.add(1); |
| | | HashMap<String, Object> map1 = appUserClient.queryUserAgeStore1(id); |