From 572df690f72ed4a077d934823f261dec39b3cc7d Mon Sep 17 00:00:00 2001
From: 刘帅 <rr.iii@qq.com>
Date: 星期二, 08 九月 2026 17:11:34 +0800
Subject: [PATCH] feat&bug:文档内容修改

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java | 1711 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 1,678 insertions(+), 33 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 20603a8..52c271e 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
@@ -1,26 +1,56 @@
 package com.dsh.guns.modular.system.controller.code;
 
+import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.dsh.course.feignClient.account.AppUserClient;
-import com.dsh.course.feignClient.account.CityClient;
-import com.dsh.course.feignClient.account.CityManagerClient;
-import com.dsh.course.feignClient.account.FinanceClient;
-import com.dsh.course.feignClient.account.model.CityManager;
-import com.dsh.course.feignClient.course.CancelledClassesClient;
+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.activity.CouponClient;
+import com.dsh.course.feignClient.activity.PayHuiminClient;
+import com.dsh.course.feignClient.activity.model.CouponDeductionQuery;
+import com.dsh.course.feignClient.activity.model.CouponDeductionVO;
+import com.dsh.course.feignClient.activity.model.HuiminPayQuery;
+import com.dsh.course.feignClient.activity.model.UserCouponPayment;
+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;
+import com.dsh.guns.core.util.ToolUtil;
 import com.dsh.guns.modular.system.model.*;
-import com.dsh.guns.modular.system.service.ICityService;
+import com.dsh.guns.modular.system.service.*;
+import groovyjarjarpicocli.CommandLine;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
+import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.time.*;
+import java.time.format.DateTimeFormatter;
+import java.time.temporal.ChronoUnit;
+import java.time.temporal.TemporalAdjusters;
+import java.util.*;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
 
 /**
  * 数据统计控制器
@@ -30,57 +60,1672 @@
 @RequestMapping("/data")
 public class DataStatisticsController extends BaseController {
     private String PREFIX = "/system/dataStatistics/";
+
+    private Integer resolveOperatorId(Integer operatorId) {
+        Integer objectType = UserExt.getUser().getObjectType();
+        if (Integer.valueOf(2).equals(objectType)) {
+            return UserExt.getUser().getObjectId();
+        }
+        return operatorId;
+    }
+
+    private Integer resolveStoreId(Integer storeId) {
+        Integer objectType = UserExt.getUser().getObjectType();
+        if (!Integer.valueOf(2).equals(objectType) || storeId == null) {
+            return storeId;
+        }
+        TStore store = storeService.getById(storeId);
+        if (store != null && UserExt.getUser().getObjectId().equals(store.getOperatorId())) {
+            return storeId;
+        }
+        return null;
+    }
+
+    /**
+     * 计算门店每日营业整小时数。相同的起止时间表示全天营业,结束时间早于
+     * 开始时间时按跨午夜营业处理。
+     */
+    private long getDailyBusinessHours(String startTime, String endTime) {
+        if (ToolUtil.isEmpty(startTime) || ToolUtil.isEmpty(endTime)) {
+            return 0;
+        }
+
+        try {
+            LocalTime start = LocalTime.parse(startTime);
+            LocalTime end = LocalTime.parse(endTime);
+            long minutes = Duration.between(start, end).toMinutes();
+            if (minutes <= 0) {
+                minutes += Duration.ofDays(1).toMinutes();
+            }
+            return Duration.ofMinutes(minutes).toHours();
+        } catch (DateTimeException e) {
+            return 0;
+        }
+    }
+
+    private long getStoreOperatingHours(TStore store, Date now) {
+        long operatingDays = Math.max(0, DateUtil.betweenDay(store.getCreateTime(), now, true));
+        return operatingDays * getDailyBusinessHours(store.getStartTime(), store.getEndTime());
+    }
+
     @Autowired
     private ICityService cityService;
-    @Autowired
+    @Resource
     private CityManagerClient cityManagerClient;
+
+    @Autowired
+    private IUserService sysUserService;
+    @Resource
+    private AppUserClient appUserClient;
+
+    @Resource
+    private CourseClient courseClient;
+
+    @Autowired
+    private IStoreService storeService;
+    @Resource
+    private VipPaymentClient vipPaymentClient;
+    @Resource
+    private FinanceClient financeClient;
+    @Resource
+    private CoursePackagePaymentClient coursePackagePaymentClient;
+    @Resource
+    private CompetitionClient competitionClient;
+
+    @Autowired
+    private ISiteBookingService siteBookingService;
+    @Resource
+    private StoreClient storeClient;
+    @Resource
+    private SiteClient siteClient;
+    @Resource
+    private PointMercharsClient pointMercharsClient;
+    @Resource
+    private CouponClient couponClient;
+    @Resource
+    private PayHuiminClient payHuiminClient;
+    @Resource
+    private RefundCoursePackageClient refundCoursePackageClient;
+    @Resource
+    private CourseStuddentClient courseStuddentClient;
+    @Resource
+    private CoursePackageClient coursePackageClient;
+    @Autowired
+    private TOperatorService operatorService;
+    @Resource
+    private BallClient ballClient;
     /**
      * 跳转到平台统计数据页面
      */
     @RequestMapping("/platform")
     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) {
+//        operatorId = resolveOperatorId(operatorId);
+//        storeId = resolveStoreId(operatorId);
+        Integer objectId = UserExt.getUser().getObjectId();
+        List<Integer> cityManagerId= new ArrayList<>();
+        if(objectId>0){
+            operatorId=objectId;
+            if(storeId==null){
+                cityManagerId= storeService.list(new QueryWrapper<TStore>().eq("cityManagerId", objectId)).stream().map(TStore::getId).collect(Collectors.toList());
+            }else {
+                cityManagerId.add(storeId);
+            }
+
+        }
+        // 报名课程查询query
+        RegisterOrderQuery query = new RegisterOrderQuery();
+        // 充值记录查询query
+        RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery();
+        // 赛事活动查询query
+        CompetitionQuery competitionQuery = new CompetitionQuery();
+        competitionQuery.setIncludeRefund(true);
+        // 会员支付查询query
+        IncomeQuery incomeQuery = new IncomeQuery();
+        incomeQuery.setIncludeRefund(true);
+        // 场地预约记录查询query
+        SiteBookingQuery siteBookingQuery = new SiteBookingQuery();
+        siteBookingQuery.setIncludeRefund(true);
+        // 智慧球场查询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);
+        rechargeRecordsQuery.setObjectId(UserExt.getUser().getObjectId());
+        List<IncomeVO> incomeVOS = new ArrayList<>();
+        Set<Long> usedCouponIds = new HashSet<>();
+        // 会员支付记录
+        List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery);
+        for (VipPayment vipPayment : vipPayments) {
+            if (vipPayment.getPayStatus() == 3 && vipPayment.getAmount() != null) {
+                IncomeVO payment = new IncomeVO();
+                payment.setInsertTime(vipPayment.getPayTime() == null ? vipPayment.getInsertTime() : vipPayment.getPayTime());
+                payment.setAmount(BigDecimal.valueOf(vipPayment.getAmount()));
+                incomeVOS.add(payment);
+                IncomeVO refund = new IncomeVO();
+                refund.setInsertTime(vipPayment.getRefundTime() == null ? vipPayment.getInsertTime() : vipPayment.getRefundTime());
+                refund.setRefundAmount(BigDecimal.valueOf(vipPayment.getAmount()));
+                incomeVOS.add(refund);
+                continue;
+            }
+            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){
+                if (registerOrderVO.getUserCouponId() != null) {
+                    usedCouponIds.add(registerOrderVO.getUserCouponId());
+                    temp.setId(registerOrderVO.getUserCouponId().toString());
+                }
+                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;
+            }
+            if (competition.getPayStatus() == 3 && competition.getAmount() != null) {
+                IncomeVO payment = new IncomeVO();
+                payment.setInsertTime(competition.getPayTime() == null
+                        ? competition.getInsertTime() : competition.getPayTime());
+                payment.setAmount(BigDecimal.valueOf(competition.getAmount()));
+                incomeVOS.add(payment);
+                IncomeVO refund = new IncomeVO();
+                refund.setInsertTime(competition.getRefundTime() == null
+                        ? competition.getInsertTime() : competition.getRefundTime());
+                refund.setRefundAmount(BigDecimal.valueOf(competition.getAmount()));
+                incomeVOS.add(refund);
+                continue;
+            }
+            if (competition.getPayStatus() != 2) {
+                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() == 5) {
+                    if (siteBooking.getPayMoney() != null) {
+                        IncomeVO payment = new IncomeVO();
+                        payment.setInsertTime(siteBooking.getPayTime() == null
+                                ? siteBooking.getInsertTime() : siteBooking.getPayTime());
+                        payment.setAmount(BigDecimal.valueOf(siteBooking.getPayMoney()));
+                        incomeVOS.add(payment);
+                        IncomeVO refund = new IncomeVO();
+                        refund.setInsertTime(siteBooking.getCancelTime() == null
+                                ? siteBooking.getInsertTime() : siteBooking.getCancelTime());
+                        refund.setRefundAmount(BigDecimal.valueOf(siteBooking.getPayMoney()));
+                        incomeVOS.add(refund);
+                    }
+                    continue;
+                }
+                if (siteBooking.getStatus() == 0) {
+                    continue;
+                }
+                if (siteBooking.getPayType() ==3 || siteBooking.getPayType() ==4)continue;
+                temp.setInsertTime(siteBooking.getPayTime());
+                if (siteBooking.getPayMoney() != null) {
+                    temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString()));
+                }
+                if (siteBooking.getUserCouponId() != null) {
+                    usedCouponIds.add(siteBooking.getUserCouponId());
+                    temp.setId(siteBooking.getUserCouponId().toString());
+                }
+                incomeVOS.add(temp);
+            }
+        }
+
+        Map<Long, BigDecimal> couponDeductionAmounts = getCouponDeductionAmounts(usedCouponIds);
+        applyCouponDeductions(incomeVOS, couponDeductionAmounts);
+
+        // 惠民卡和优惠券购买不归属到单一课程/场地门店,当前仅在平台或运营商汇总中计入。
+        if (storeId == null) {
+            appendHuiminIncome(incomeVOS, operatorId);
+            if (operatorId == null) {
+                appendCouponPurchaseIncome(incomeVOS);
+            }
+        }
+
+        // 积分商品
+        List<PointMerchandiseIncomeVo> amount = pointMercharsClient.getAmount(cityManagerId);
+        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, Object> monthlyData = buildIncomeStatistics(incomeVOS);
+        return monthlyData;
+    }
+
+    /** 惠民卡采用支付、退款两条事实流水,赠送卡不计营收。 */
+    private void appendHuiminIncome(List<IncomeVO> incomeRecords, Integer operatorId) {
+        HuiminPayQuery query = new HuiminPayQuery();
+        query.setGiftPaymentType(3);
+        if (operatorId != null) {
+            query.setOperatorId(operatorId.longValue());
+        }
+        List<SalesDetailVO> records = payHuiminClient.exportData(query);
+        if (records == null) {
+            return;
+        }
+        for (SalesDetailVO record : records) {
+            if (record == null || record.getSalesMoney() == null || record.getPaymentTime() == null) {
+                continue;
+            }
+            IncomeVO payment = new IncomeVO();
+            payment.setInsertTime(record.getPaymentTime());
+            payment.setAmount(record.getSalesMoney());
+            incomeRecords.add(payment);
+            if (Integer.valueOf(3).equals(record.getStatus())
+                    || Integer.valueOf(2).equals(record.getRefundStatus())
+                    || Integer.valueOf(3).equals(record.getRefundStatus())) {
+                IncomeVO refund = new IncomeVO();
+                refund.setInsertTime(record.getRefundTime() == null ? record.getPaymentTime() : record.getRefundTime());
+                refund.setRefundAmount(record.getSalesMoney());
+                incomeRecords.add(refund);
+            }
+        }
+    }
+
+    /** 仅计入积分+现金的成功优惠券购买,纯积分兑换不形成现金营收。 */
+    private void appendCouponPurchaseIncome(List<IncomeVO> incomeRecords) {
+        List<UserCouponPayment> records = couponClient.listPaidCouponPayments();
+        if (records == null) {
+            return;
+        }
+        for (UserCouponPayment record : records) {
+            if (record == null || record.getCash() == null || record.getPaymentTime() == null) {
+                continue;
+            }
+            IncomeVO payment = new IncomeVO();
+            payment.setInsertTime(record.getPaymentTime());
+            payment.setAmount(BigDecimal.valueOf(record.getCash()));
+            incomeRecords.add(payment);
+        }
+    }
+
+    /** 构建总计及年、月、周、日四个粒度的四维收入统计结果。 */
+    private Map<String, Object> buildIncomeStatistics(List<IncomeVO> incomeRecords) {
+        Map<String, Object> result = new HashMap<>();
+        LocalDate today = LocalDate.now();
+        int currentYear = today.getYear();
+        List<IncomeStatisticsVO> yearly = new ArrayList<>();
+        List<Object> years = new ArrayList<>();
+        for (int year = currentYear - 9; year <= currentYear; year++) {
+            final int statisticYear = year;
+            yearly.add(sumIncomeStatistics(incomeRecords, record -> getRecordDate(record)
+                    .getYear() == statisticYear));
+            years.add(year);
+        }
+
+        List<IncomeStatisticsVO> monthly = new ArrayList<>();
+        for (int month = 1; month <= 12; month++) {
+            final int statisticMonth = month;
+            monthly.add(sumIncomeStatistics(incomeRecords, record -> {
+                LocalDate date = getRecordDate(record);
+                return date.getYear() == currentYear && date.getMonthValue() == statisticMonth;
+            }));
+        }
+
+        List<IncomeStatisticsVO> weekly = new ArrayList<>();
+        for (int weekIndex = 3; weekIndex >= 0; weekIndex--) {
+            LocalDate startDate = today.minusDays(weekIndex * 7L + 6L);
+            LocalDate endDate = today.minusDays(weekIndex * 7L);
+            weekly.add(sumIncomeStatistics(incomeRecords, record -> {
+                LocalDate date = getRecordDate(record);
+                return !date.isBefore(startDate) && !date.isAfter(endDate);
+            }));
+        }
+
+        List<IncomeStatisticsVO> daily = new ArrayList<>();
+        for (int dayIndex = 6; dayIndex >= 0; dayIndex--) {
+            LocalDate statisticDate = today.minusDays(dayIndex);
+            daily.add(sumIncomeStatistics(incomeRecords, record -> getRecordDate(record)
+                    .equals(statisticDate)));
+        }
+
+        IncomeStatisticsVO total = sumIncomeStatistics(incomeRecords, record -> true);
+        IncomeStatisticsVO currentYearStatistics = yearly.get(yearly.size() - 1);
+        IncomeStatisticsVO currentMonthStatistics = monthly.get(today.getMonthValue() - 1);
+        IncomeStatisticsVO currentWeekStatistics = sumIncomeStatistics(incomeRecords, record -> {
+            LocalDate date = getRecordDate(record);
+            return !date.isBefore(today.minusDays(6)) && !date.isAfter(today);
+        });
+        IncomeStatisticsVO currentDayStatistics = daily.get(daily.size() - 1);
+
+        result.put("incomeStatistics", total);
+        result.put("netIncomeAmount", total.getNetIncomeAmount());
+        result.put("couponDeductionAmount", total.getCouponDeductionAmount());
+        result.put("refundAmount", total.getRefundAmount());
+        result.put("yearIncomeStatistics", yearly);
+        result.put("monthIncomeStatistics", monthly);
+        result.put("weekIncomeStatistics", weekly);
+        result.put("dayIncomeStatistics", daily);
+        result.put("year", years);
+        // 兼容既有图表消费字段,值调整为总营收金额。
+        result.put("yearIncome", yearly.stream().map(IncomeStatisticsVO::getTotalIncomeAmount)
+                .collect(Collectors.toList()));
+        result.put("monthIncome", Collections.singletonList(monthly.stream()
+                .map(IncomeStatisticsVO::getTotalIncomeAmount).collect(Collectors.toList())));
+        result.put("weekIncome", Collections.singletonList(weekly.stream()
+                .map(IncomeStatisticsVO::getTotalIncomeAmount).collect(Collectors.toList())));
+        result.put("dayIncome", Collections.singletonList(daily.stream()
+                .map(IncomeStatisticsVO::getTotalIncomeAmount).collect(Collectors.toList())));
+        result.put("yearMount", Arrays.asList(total.getTotalIncomeAmount(),
+                currentYearStatistics.getTotalIncomeAmount(), currentMonthStatistics.getTotalIncomeAmount(),
+                currentWeekStatistics.getTotalIncomeAmount(), currentDayStatistics.getTotalIncomeAmount()));
+        return result;
+    }
+
+    /** 按给定时间条件汇总四个收入维度。 */
+    private IncomeStatisticsVO sumIncomeStatistics(List<IncomeVO> incomeRecords,
+                                                     Predicate<IncomeVO> timePredicate) {
+        IncomeStatisticsVO statistics = new IncomeStatisticsVO();
+        for (IncomeVO record : incomeRecords) {
+            if (record.getInsertTime() == null || !timePredicate.test(record)) {
+                continue;
+            }
+            BigDecimal receivedAmount = getZeroIfNull(record.getAmount());
+            BigDecimal couponAmount = getZeroIfNull(record.getCouponDeductionAmount());
+            BigDecimal refundAmount = getZeroIfNull(record.getRefundAmount());
+            statistics.setTotalIncomeAmount(statistics.getTotalIncomeAmount()
+                    .add(receivedAmount).add(couponAmount));
+            statistics.setCouponDeductionAmount(statistics.getCouponDeductionAmount().add(couponAmount));
+            statistics.setRefundAmount(statistics.getRefundAmount().add(refundAmount));
+        }
+        statistics.setNetIncomeAmount(statistics.getTotalIncomeAmount()
+                .subtract(statistics.getCouponDeductionAmount())
+                .subtract(statistics.getRefundAmount()));
+        return statistics;
+    }
+
+    /** 将收入记录时间转换为本地日期。 */
+    private LocalDate getRecordDate(IncomeVO record) {
+        return LocalDateTime.ofInstant(record.getInsertTime().toInstant(), ZoneId.systemDefault()).toLocalDate();
+    }
+
+    /** 空金额按零参与统计。 */
+    private BigDecimal getZeroIfNull(BigDecimal amount) {
+        return amount == null ? BigDecimal.ZERO : amount;
+    }
+
+    /** 将批量查询到的优惠券抵扣金额回填到对应收入记录。 */
+    private void applyCouponDeductions(List<IncomeVO> incomeRecords,
+                                       Map<Long, BigDecimal> couponDeductionAmounts) {
+        for (IncomeVO record : incomeRecords) {
+            if (record.getId() == null) {
+                continue;
+            }
+            try {
+                record.setCouponDeductionAmount(couponDeductionAmounts.getOrDefault(
+                        Long.valueOf(record.getId()), BigDecimal.ZERO));
+            } catch (NumberFormatException ignored) {
+                record.setCouponDeductionAmount(BigDecimal.ZERO);
+            }
+        }
+    }
+
+    /**
+     * 批量获取已使用优惠券的抵扣金额,避免按订单逐条调用优惠券服务。
+     *
+     * @param usedCouponIds 用户优惠券领取记录 ID 集合
+     * @return 用户优惠券领取记录 ID 与抵扣金额的映射(单位:元)
+     */
+    private Map<Long, BigDecimal> getCouponDeductionAmounts(Set<Long> usedCouponIds) {
+        if (usedCouponIds.isEmpty()) {
+            return Collections.emptyMap();
+        }
+        CouponDeductionQuery query = new CouponDeductionQuery();
+        query.setUserCouponIds(new ArrayList<>(usedCouponIds));
+        List<CouponDeductionVO> deductions = couponClient.queryDeductionAmounts(query);
+        if (deductions == null || deductions.isEmpty()) {
+            return Collections.emptyMap();
+        }
+        return deductions.stream()
+                .filter(deduction -> deduction.getUserCouponId() != null)
+                .collect(Collectors.toMap(CouponDeductionVO::getUserCouponId,
+                        deduction -> getZeroIfNull(deduction.getDeductionAmount()), BigDecimal::add));
+    }
+
+    /**
+     * 运营统计-平台-用户数据
+     *
+     */
+    @RequestMapping(value = "/getUserData")
+    @ResponseBody
+    public Object getUserData() {
+
+
+        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;
+    }
+    /**
+     * 退费-平台
+     *
+     */
+    @RequestMapping(value = "/getRefundData")
+    @ResponseBody
+    public Object getRefundData(Integer type) {
+        // 赛事活动查询query
+        CompetitionQuery competitionQuery = new CompetitionQuery();
+        List<IncomeVO> incomeVOS = new ArrayList<>();
+        // 获取学员课包退费
+        List<MoneyBack> refund = refundCoursePackageClient.getRefund();
+
+        for (MoneyBack moneyBack : refund) {
+            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);
+//            }
+        }
+        // 获取赛事退费记录
+        List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery);
+        for (PaymentCompetition competition : competitions) {
+            if (competition.getPayStatus() != 3) {
+                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);
+        }
+
+        return null;
+    }
+
+
+    @Autowired
+    private TBackRecordService backRecordService;
+
+    @RequestMapping(value = "/backPt")
+    @ResponseBody
+    public Object backPt(Integer type) {
+        HashMap<String, Object> map = new HashMap<>();
+        List<Integer> userPt = appUserClient.getUserPt(Arrays.asList(1));
+        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));
+        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));
+        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());
+        // 年
+        ArrayList<Double> years = new ArrayList<>();
+        for (Object o : collect) {
+            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();
+            years.add(sum);
+        }
+        ArrayList<Double> months = new ArrayList<>();
+        // 月
+        for (int i = 1; i <= 12; i++) {
+            double sum=0.0;
+            String m=i+"";
+            if(i<10){
+                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();
+            months.add(sum);
+        }
+
+        // 获取最近四周
+        LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN);
+        LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX);
+        // 周度数据
+        String s1 = minNow.minusDays(6).toString();
+        String s2 = maxNow.toString();
+
+        String s3 = minNow.minusDays(13).toString();
+        String s4 = maxNow.minusDays(6).toString();
+
+
+        String s5 = minNow.minusDays(20).toString();
+        String s6 = maxNow.minusDays(13).toString();
+
+        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> 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));
+        double sum3 = list3.stream().mapToDouble(TBackRecord::getMoney).sum();
+
+        map.put("thisWeek",sum3);
+
+        ArrayList<Double> week = new ArrayList<>();
+        week.add(sum);
+        week.add(sum1);
+        week.add(sum2);
+        week.add(sum3);
+
+        // 日
+        ArrayList<Double> days = new ArrayList<>();
+        Double thisDay=0.0;
+        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));
+            double sum4 = day.stream().mapToDouble(TBackRecord::getMoney).sum();
+            days.add(sum4);
+            if(i==0){
+                thisDay=sum4;
+            }
+        }
+
+        map.put("thisDay",thisDay);
+        map.put("yearData",years);
+        map.put("monthData",months);
+        map.put("weekData",week);
+        map.put("dayData",days);
+
+        return map;
+    }
+
+    @RequestMapping(value = "/backYys")
+    @ResponseBody
+    public Object backYys(Integer id) {
+        id = resolveOperatorId(id);
+        HashMap<String, Object> map = new HashMap<>();
+        List<Integer> userPt = appUserClient.getUserYYs(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));
+        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));
+        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());
+        // 年
+        ArrayList<Double> years = new ArrayList<>();
+        for (Object o : collect) {
+            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();
+            years.add(sum);
+        }
+        ArrayList<Double> months = new ArrayList<>();
+        // 月
+        for (int i = 1; i <= 12; i++) {
+            double sum=0.0;
+            String m=i+"";
+            if(i<10){
+                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();
+            months.add(sum);
+        }
+
+        // 获取最近四周
+        LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN);
+        LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX);
+        // 周度数据
+        String s1 = minNow.minusDays(6).toString();
+        String s2 = maxNow.toString();
+
+        String s3 = minNow.minusDays(13).toString();
+        String s4 = maxNow.minusDays(6).toString();
+
+
+        String s5 = minNow.minusDays(20).toString();
+        String s6 = maxNow.minusDays(13).toString();
+
+        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> 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));
+        double sum3 = list3.stream().mapToDouble(TBackRecord::getMoney).sum();
+
+        map.put("thisWeek",sum3);
+
+        ArrayList<Double> week = new ArrayList<>();
+        week.add(sum);
+        week.add(sum1);
+        week.add(sum2);
+        week.add(sum3);
+
+        // 日
+        ArrayList<Double> days = new ArrayList<>();
+        Double thisDay=0.0;
+        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));
+            double sum4 = day.stream().mapToDouble(TBackRecord::getMoney).sum();
+            days.add(sum4);
+            if(i==0){
+                thisDay=sum4;
+            }
+        }
+
+        map.put("thisDay",thisDay);
+        map.put("yearData",years);
+        map.put("monthData",months);
+        map.put("weekData",week);
+        map.put("dayData",days);
+
+        return map;
+    }
+    @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<>();
+
+        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,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,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> collectw = integers.stream().sorted().collect(Collectors.toList());
+        // 年
+        ArrayList<Double> years = new ArrayList<>();
+        for (Object o : collectw) {
+            double sum=0.0;
+            String s = o.toString();
+            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<>();
+        // 月
+        for (int i = 1; i <= 12; i++) {
+            double sum=0.0;
+            String m=i+"";
+            if(i<10){
+                m="0"+i;
+            }
+            String s = year + "-" + m;
+            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);
+        }
+
+        // 获取最近四周
+        LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN);
+        LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX);
+        // 周度数据
+        String s1 = minNow.minusDays(6).toString();
+        String s2 = maxNow.toString();
+
+        String s3 = minNow.minusDays(13).toString();
+        String s4 = maxNow.minusDays(6).toString();
+
+
+        String s5 = minNow.minusDays(20).toString();
+        String s6 = maxNow.minusDays(13).toString();
+
+        String s7 = minNow.minusDays(27).toString();
+        String s8 = maxNow.minusDays(20).toString();
+
+        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> 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);
+
+        ArrayList<Double> week = new ArrayList<>();
+        week.add(sum);
+        week.add(sum1);
+        week.add(sum2);
+        week.add(sum3);
+
+        // 日
+        ArrayList<Double> days = new ArrayList<>();
+        Double thisDay=0.0;
+        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,list));
+            double sum4 = day.stream().mapToDouble(TBackRecord::getMoney).sum();
+            days.add(sum4);
+            if(i==0){
+                thisDay=sum4;
+            }
+        }
+
+        map.put("thisDay",thisDay);
+        map.put("yearData",years);
+        map.put("monthData",months);
+        map.put("weekData",week);
+        map.put("dayData",days);
+
+        return map;
+    }
+
+
+    @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) {
+        id = resolveOperatorId(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) {
+        id = resolveOperatorId(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) {
+        id = resolveOperatorId(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")
+    @ResponseBody
+    public Object actPt(Integer type) {
+        List<Integer> userPt = appUserClient.getUserPt(Arrays.asList(1));
+        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) {
+            l1 += getStoreOperatingHours(tStore, new Date());
+        }
+        map.put("allHour",l1);
+        return map;
+    }
+    @RequestMapping(value = "/actYys")
+    @ResponseBody
+    public Object actYys(Integer id) {
+        id = resolveOperatorId(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(list2);
+        competionVO.setOperatorId(id);
+        competionVO.setStoreIds(collect1);
+        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) {
+            l1 += getStoreOperatingHours(tStore, new Date());
+        }
+        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) {
+            l1 += getStoreOperatingHours(tStore, new Date());
+        }
+        map.put("allHour",l1);
+        return map;
+    }
+
+
+
     /**
      * 跳转到运营商统计数据页面
      */
     @RequestMapping("/operator")
     public String operator(Model model) {
         Integer objectType = UserExt.getUser().getObjectType();
-        List<CityManager> cityManagers = cityManagerClient.listAll();
-        HashSet<String> city = new HashSet<>();
-        List<CityManager> list = new ArrayList<>();
-        for (CityManager cityManager : cityManagers) {
-            if (!city.contains(cityManager.getCity())){
-                city.add(cityManager.getCity());
-                list.add(cityManager);
-            }
-        }
+        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";
     }
+
+    /**
+     * 运营商
+     * @param
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping("/selectYys")
+    public Object selectYys(Integer id,String time) {
+        id = resolveOperatorId(id);
+        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);
+        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"));
+        Object data = map3.get("data");
+        map.put("courseData",data);
+
+
+        // 赛事收入
+        Double aDouble1 = competitionClient.queryFee(queryDataFee);
+        map.put("fee4",aDouble1);
+
+        // 订场
+        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 stime = time.split(" - ")[0]+" 00:00:00";
+            String etime = time.split(" - ")[1]+" 23:59:59";
+            vipPaymentLambdaQueryWrapper.between(SiteBooking::getInsertTime,stime,etime);
+        }
+        vipPaymentLambdaQueryWrapper.in(SiteBooking::getSiteId,ids);
+        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();
+        map.put("fee5",sum);
+
+
+        List<Integer> collect = list1.stream().map(SiteBooking::getSiteId).collect(Collectors.toList());
+        if(collect.size()==0){
+            collect.add(-1);
+        }
+        List<TSite> list3 = siteService.list(new LambdaQueryWrapper<TSite>().in(TSite::getId, collect));
+        for (SiteBooking siteBooking : list1) {
+            for (TSite tSite : list3) {
+                if(siteBooking.getSiteId().equals(tSite.getId())){
+                    siteBooking.setType(tSite.getSiteTypeId());
+                }
+            }
+        }
+
+
+        List<TSiteType> list2 = siteTypeService.list();
+
+        List<Map<String,Object>> mapList = new ArrayList<>();
+
+        for (TSiteType tSiteType : list2) {
+            HashMap<String, Object> map2 = new HashMap<>();
+            map2.put("name",tSiteType.getName());
+            double a =0;
+            for (SiteBooking siteBooking : list1) {
+                if(tSiteType.getId().equals(siteBooking.getType())){
+                    a += siteBooking.getPayMoney();
+                }
+            }
+            map2.put("value",a);
+            mapList.add(map2);
+        }
+        map.put("siteData",mapList);
+
+
+        // 商品  门票
+        HashMap<String, Object> map2 = pointMercharsClient.queryFee(queryDataFee);
+        Object all = map2.get("all");
+        Object day = map2.get("day");
+        Object month = map2.get("month");
+        Object quarter = map2.get("quarter");
+        Object year = map2.get("year");
+        map.put("fee7",all);
+        map.put("dayone",day);
+        map.put("monthone",month);
+        map.put("quarterone",quarter);
+        map.put("yearone",year);
+
+        return map;
+    }
+
+
+
+    /**
+     * 运营商
+     * @param
+     * @return
+     */
+    @ResponseBody
+    @RequestMapping("/selectStore")
+    public Object selectStore(Integer id,String time) {
+        HashMap<String, Object> map = new HashMap<>();
+        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("fee1",fee1);
+        //玩湃比
+        Object fee2 = map1.get("fee2");
+        map.put("fee2",fee2);
+        // 课程收入
+        HashMap<String, Object> map3 = courseClient.queryFee(queryDataFee);
+        map.put("fee3",map3.get("fee"));
+        Object data = map3.get("data");
+        map.put("courseData",data);
+
+
+        // 赛事收入
+        Double aDouble1 = competitionClient.queryFee(queryDataFee);
+        map.put("fee4",aDouble1);
+
+        // 订场
+        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);
+        }
+        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> lists1 = siteBookingService.list(vipPaymentLambdaQueryWrapper);
+        double sum = lists1.stream().mapToDouble(SiteBooking::getPayMoney).sum();
+        map.put("fee5",sum);
+
+
+        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, collects));
+        for (SiteBooking siteBooking : list1) {
+            for (TSite tSite : list3) {
+                if(siteBooking.getSiteId().equals(tSite.getId())){
+                    siteBooking.setType(tSite.getSiteTypeId());
+                }
+            }
+        }
+
+
+        List<TSiteType> lists2 = siteTypeService.list();
+
+        List<Map<String,Object>> mapList = new ArrayList<>();
+
+        for (TSiteType tSiteType : lists2) {
+            HashMap<String, Object> map2 = new HashMap<>();
+            map2.put("name",tSiteType.getName());
+            double a =0;
+            for (SiteBooking siteBooking : list1) {
+                if(null != siteBooking.getType() && tSiteType.getId().equals(siteBooking.getType()) && null != siteBooking.getPayMoney()){
+                    a += siteBooking.getPayMoney();
+                }
+            }
+            map2.put("value",a);
+            mapList.add(map2);
+        }
+        map.put("siteData",mapList);
+
+
+        // 商品  门票
+        HashMap<String, Object> map2 = pointMercharsClient.queryFee(queryDataFee);
+        Object all = map2.get("all");
+        Object day = map2.get("day");
+        Object month = map2.get("month");
+        Object quarter = map2.get("quarter");
+        Object year = map2.get("year");
+        map.put("fee7",all);
+        map.put("dayone",day);
+        map.put("monthone",month);
+        map.put("quarterone",quarter);
+        map.put("yearone",year);
+
+        return map;
+    }
+
+
     /**
      * 跳转到门店统计数据页面
      */
     @RequestMapping("/store")
     public String store(Model model) {
         Integer objectType = UserExt.getUser().getObjectType();
-        List<CityManager> cityManagers = cityManagerClient.listAll();
-        HashSet<String> city = new HashSet<>();
-        List<CityManager> list = new ArrayList<>();
-        for (CityManager cityManager : cityManagers) {
-            if (!city.contains(cityManager.getCity())){
-                city.add(cityManager.getCity());
-                list.add(cityManager);
-            }
+        List<TStore> tStores = new ArrayList<>();
+        if(objectType == 1){
+            tStores = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getState, 1));
         }
-        model.addAttribute("list",list);
+        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";
     }
+
+
+    @Autowired
+    private ITSiteTypeService siteTypeService;
+
+
+    @Autowired
+    private ITSiteService siteService;
+
+    @RequestMapping("/type1")
+    @ResponseBody
+    public Object type1(String time) {
+        HashMap<String, Object> map = new HashMap<>();
+        // 找出平台的用户
+        List<User> list = sysUserService.list(new LambdaQueryWrapper<User>().eq(User::getObjectType, 1));
+        List<Integer> ids = list.stream().map(User::getId).collect(Collectors.toList());
+        List<Integer> userIds = appUserClient.getUserPt(ids);
+        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);
+        // 课程收入
+        HashMap<String, Object> map3 = courseClient.queryFee(queryDataFee);
+        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);
+        }
+        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.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(new QueryWrapper<SiteBooking>()
+                .ne("status",0)
+                .ne("status",5)
+                .ne("payType",3)
+                .ne("payType",4));
+        double sum = list1.stream().mapToDouble(SiteBooking::getPayMoney).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());
+        if(collect.size()==0){
+            collect.add(-1);
+        }
+        List<TSite> list3 = siteService.list(new LambdaQueryWrapper<TSite>().in(TSite::getId, collect));
+        for (SiteBooking siteBooking : list1) {
+            for (TSite tSite : list3) {
+                if(siteBooking.getSiteId().equals(tSite.getId())){
+                    siteBooking.setType(tSite.getSiteTypeId());
+                }
+            }
+        }
+
+
+        List<TSiteType> list2 = siteTypeService.list();
+
+        List<Map<String,Object>> mapList = new ArrayList<>();
+
+        for (TSiteType tSiteType : list2) {
+            HashMap<String, Object> map2 = new HashMap<>();
+            map2.put("name",tSiteType.getName());
+            double a =0;
+            for (SiteBooking siteBooking : list1) {
+                if(tSiteType.getId().equals(siteBooking.getType())){
+                    a += siteBooking.getPayMoney();
+                }
+            }
+            map2.put("value",a);
+            mapList.add(map2);
+        }
+        map.put("siteData",mapList);
+
+
+        // 商品  门票
+        HashMap<String, Object> map2 = pointMercharsClient.queryFee(queryDataFee);
+        Object all = map2.get("all");
+        Object day = map2.get("day");
+        Object month = map2.get("month");
+        Object quarter = map2.get("quarter");
+        Object year = map2.get("year");
+        map.put("fee7",all);
+        map.put("dayone",day);
+        map.put("monthone",month);
+        map.put("quarterone",quarter);
+        map.put("yearone",year);
+
+        return map;
+    }
+    @RequestMapping("/stuCourseData")
+    @ResponseBody
+    public Object stuCourseData() {
+        ArrayList<Integer> objects = new ArrayList<>();
+        objects.add(1);
+        List<Integer> userIds = appUserClient.getUserPt(objects);
+        List<Map<String,Object>> list = coursePackagePaymentClient.queryCourseData(userIds);
+        ArrayList<Object> objects2 = new ArrayList<>();
+        ArrayList<Object> objects3 = new ArrayList<>();
+        for (Map<String, Object> map : list) {
+            Object name = map.get("name");
+            Object value = map.get("value");
+            objects2.add(name);
+            objects3.add(value);
+        }
+        HashMap<String, Object> map = new HashMap<>();
+        map.put("data1",objects2);
+        map.put("data2",objects3);
+        return map;
+    }
+    @RequestMapping("/stuUserData")
+    @ResponseBody
+    public Object stuUserData() {
+        ArrayList<Integer> objects = new ArrayList<>();
+        objects.add(1);
+        HashMap<String, Object> map = appUserClient.queryUserAge1();
+
+        return map;
+    }
+    @RequestMapping("/stuUserDataYys")
+    @ResponseBody
+    public Object stuUserDataYys(Integer id) {
+        id = resolveOperatorId(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) {
+
+        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) {
+        id = resolveOperatorId(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> 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) {
+            Object name = map.get("name");
+            Object value = map.get("value");
+            objects2.add(name);
+            objects3.add(value);
+        }
+        HashMap<String, Object> map = new HashMap<>();
+        map1.put("data1",objects2);
+        map1.put("data2",objects3);
+
+
+        return map1;
+    }
+    @RequestMapping("/selectStoreJx")
+    @ResponseBody
+    public Object selectStoreJx(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> map1 = appUserClient.queryUserAgeStore1(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) {
+            Object name = map.get("name");
+            Object value = map.get("value");
+            objects2.add(name);
+            objects3.add(value);
+        }
+        HashMap<String, Object> map = new HashMap<>();
+        map1.put("data1",objects2);
+        map1.put("data2",objects3);
+
+
+        return map1;
+    }
 }
-
-
-
-

--
Gitblit v1.7.1