luo
2023-10-08 1cb12391db6154f2d1a8fdf8e0506fe3f3eb2f15
cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java
@@ -1,26 +1,44 @@
package com.dsh.guns.modular.system.controller.code;
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.*;
import com.dsh.course.feignClient.account.model.CityManager;
import com.dsh.course.feignClient.course.CancelledClassesClient;
import com.dsh.course.feignClient.account.model.QueryDataFee;
import com.dsh.course.feignClient.account.model.TAppUser;
import com.dsh.course.feignClient.account.model.VipPayment;
import com.dsh.course.feignClient.activity.PointMercharsClient;
import com.dsh.course.feignClient.competition.CompetitionClient;
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.SiteClient;
import com.dsh.course.feignClient.other.StoreClient;
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.stream.Collectors;
/**
 * 数据统计控制器
@@ -34,12 +52,443 @@
    private ICityService cityService;
    @Autowired
    private CityManagerClient cityManagerClient;
    @Autowired
    private IUserService sysUserService;
    @Autowired
    private AppUserClient appUserClient;
    @Autowired
    private CourseClient courseClient;
    @Autowired
    private VipPaymentClient vipPaymentClient;
    @Autowired
    private FinanceClient financeClient;
    @Autowired
    private CoursePackagePaymentClient coursePackagePaymentClient;
    @Autowired
    private CompetitionClient competitionClient;
    @Autowired
    private ISiteBookingService siteBookingService;
    @Autowired
    private StoreClient storeClient;
    @Autowired
    private SiteClient siteClient;
    @Autowired
    private PointMercharsClient pointMercharsClient;
    @Autowired
    private RefundCoursePackageClient refundCoursePackageClient;
    @Resource
    private CourseStuddentClient courseStuddentClient;
    @Autowired
    private CoursePackageClient coursePackageClient;
    /**
     * 跳转到平台统计数据页面
     */
    @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 type) {
        // 充值记录查询query
        RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery();
        // 报名课程查询query
        RegisterOrderQuery query = new RegisterOrderQuery();
        // 赛事活动查询query
        CompetitionQuery competitionQuery = new CompetitionQuery();
        // 会员支付查询query
        IncomeQuery incomeQuery = new IncomeQuery();
        // 场地预约记录查询query
        SiteBookingQuery siteBookingQuery = new SiteBookingQuery();
        Integer roleType = UserExt.getUser().getObjectType();
        IncomeVO incomeVO = new IncomeVO();
        List<IncomeVO> incomeVOS = new ArrayList<>();
                // 会员支付记录
                List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery);
                for (VipPayment vipPayment : vipPayments) {
                    IncomeVO temp = new IncomeVO();
                    if (vipPayment.getPayStatus()==1){
                        temp.setInsertTime(vipPayment.getInsertTime());
                        incomeVOS.add(temp);
                    }
                    if (vipPayment.getAmount() != null) {
                        temp.setAmount(new BigDecimal(vipPayment.getAmount().toString()));
                    }
                }
                // 充值记录
                List<RechargeRecordsVO> rechargeRecordsVOS = financeClient.rechargeList(rechargeRecordsQuery);
                for (RechargeRecordsVO rechargeRecordsVO : rechargeRecordsVOS) {
                    IncomeVO temp = new IncomeVO();
                    temp.setInsertTime(rechargeRecordsVO.getInsertTime());
                    if (rechargeRecordsVO.getAmount() != null) {
                        temp.setAmount(rechargeRecordsVO.getAmount());
                    }
                    if (rechargeRecordsVO.getPayStatus() ==1){
                        incomeVOS.add(temp);
                    }
                }
                // 报名课程记录
                List<RegisterOrderVO> registerOrderVOS = coursePackagePaymentClient.listAllRegister(query);
                for (RegisterOrderVO registerOrderVO : registerOrderVOS) {
                    if (registerOrderVO.getMoney() == null) {
                        continue;
                    }
                    IncomeVO temp = new IncomeVO();
                    temp.setInsertTime(registerOrderVO.getInsertTime());
                    if (registerOrderVO.getMoney() != null) {
                        temp.setAmount(registerOrderVO.getMoney());
                    }
                    if (registerOrderVO.getPayStatus()==2){
                        incomeVOS.add(temp);
                    }
                }
                    // 报名活动
                    List<PaymentCompetition> competitions = competitionClient.listAllPayment(competitionQuery);
                    for (PaymentCompetition competition : competitions) {
                        if (competition.getPayStatus() != 2) {
                            continue;
                        }
                        if (competition.getPayType()==3 || competition.getPayType()==4){
                            continue;
                        }
                        IncomeVO temp = new IncomeVO();
                        temp.setInsertTime(competition.getInsertTime());
                        if (competition.getAmount() != null) {
                            temp.setAmount(new BigDecimal(competition.getAmount().toString()));
                        }
                        incomeVOS.add(temp);
                    }
                // 预约场地
                List<SiteBooking> siteBookings = siteClient.listAll(siteBookingQuery);
                for (SiteBooking siteBooking : siteBookings) {
                    IncomeVO temp = new IncomeVO();
                    if(siteBooking.getStatus()!=3){
                        continue;
                    }
                    temp.setInsertTime(siteBooking.getPayTime());
                    if (siteBooking.getPayMoney() != null) {
                        temp.setAmount(new BigDecimal(siteBooking.getPayMoney().toString()));
                    }
                    incomeVOS.add(temp);
                }
        // 积分商品
        List<PointMerchandiseIncomeVo> amount = pointMercharsClient.getAmount();
        for (PointMerchandiseIncomeVo pointMerchandiseIncomeVo : amount) {
            IncomeVO temp = new IncomeVO();
            temp.setInsertTime(pointMerchandiseIncomeVo.getInsertTime());
            if (pointMerchandiseIncomeVo.getCash()!=null){
                temp.setAmount(pointMerchandiseIncomeVo.getCash());
                incomeVOS.add(temp);
            }
        }
        // 最终返回的数据
        Map<String, List<Object>> monthlyData = new HashMap<>();
        // 创建一个 Map 用于存储每年的累计 amount
        Map<Integer, BigDecimal> yearToTotalAmountMap = new HashMap<>();
        // 初始化一个 BigDecimal 用于累加
        BigDecimal totalAmount1 = BigDecimal.ZERO;
        // 用于返回图表上的总营收 年度营收 月度 周度 日度
        List<Object> objects = new ArrayList<>();
        // 遍历 incomeVOS
        for (IncomeVO incomeVO1 : incomeVOS) {
            // 总营收
            BigDecimal total = incomeVO1.getAmount();
            // 累加到总金额
            totalAmount1 = totalAmount1.add(total);
            Date insertTime = incomeVO1.getInsertTime(); // 假设有一个方法用于获取 insertTime
            BigDecimal amount1 = incomeVO1.getAmount(); // 假设有一个方法用于获取 amount
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(insertTime);
            int year = calendar.get(Calendar.YEAR); // 获取年份
            // 更新年份对应的累计 amount
            if (yearToTotalAmountMap.containsKey(year)) {
                BigDecimal totalAmount = yearToTotalAmountMap.get(year);
                yearToTotalAmountMap.put(year, totalAmount.add(amount1));
            } else {
                yearToTotalAmountMap.put(year, amount1);
            }
        }
        objects.add(totalAmount1);
        // 创建一个新的列表,按年份升序排列
        List<Integer> sortedYears = new ArrayList<>(yearToTotalAmountMap.keySet());
        Collections.sort(sortedYears);
        // 创建一个新的 IncomeVO 列表,包含按年份累计的 amount
        List<Object> resultIncomeVOS = new ArrayList<>();
        // 循环遍历2023年到2028年的年份
        for (int year = 2023; year <= 2028; year++) {
            BigDecimal totalAmount = yearToTotalAmountMap.getOrDefault(year, BigDecimal.ZERO);
            // 创建一个新的 IncomeVO 对象,并设置年份和累计金额
            IncomeVO resultIncomeVO = new IncomeVO();
            resultIncomeVO.setAmount(totalAmount);
            resultIncomeVOS.add(resultIncomeVO);
        }
        monthlyData.put("yearIncome",resultIncomeVOS);
        // 创建一个 Map 用于存储今年每个月的累计 amount
        Map<Integer, BigDecimal> monthToTotalAmountMap = new HashMap<>();
        Calendar calendar = Calendar.getInstance();
        int currentYear = calendar.get(Calendar.YEAR);
        List<BigDecimal> monthlyAmountList = new ArrayList<>(Collections.nCopies(12, BigDecimal.ZERO));
        for (IncomeVO incomeVO1 : incomeVOS) {
            Calendar calendar1 = Calendar.getInstance();
            calendar1.setTime(incomeVO1.getInsertTime());
            int year = calendar1.get(Calendar.YEAR);
            int month = calendar1.get(Calendar.MONTH) + 1; // 月份从0开始,所以需要加1
            if (year == currentYear) {
                BigDecimal totalAmount = monthlyAmountList.get(month - 1);
                totalAmount = totalAmount.add(incomeVO1.getAmount());
                monthlyAmountList.set(month - 1, totalAmount);
            }
        }
        monthlyData.put("monthIncome", Collections.singletonList(monthlyAmountList));
        // 获取当前月份
        LocalDate currentDate = LocalDate.now();
        int currentMonth = currentDate.getMonthValue();
        // 初始化一个长度为当前月份的天数的列表,并将每一天的金额初始化为零
        int daysInCurrentMonth = currentDate.lengthOfMonth();
        List<BigDecimal> weekAmount = new ArrayList<>(daysInCurrentMonth);
        for (int i = 0; i < daysInCurrentMonth; i++) {
            weekAmount.add(BigDecimal.ZERO);
        }
        for (IncomeVO incomeVO1 : incomeVOS) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String string = dateFormat.format(incomeVO1.getInsertTime());
            LocalDate insertDate = LocalDate.parse(string, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
            if (insertDate.getMonthValue() == currentMonth) {
                int dayOfMonth = insertDate.getDayOfMonth();
                BigDecimal currentAmount = weekAmount.get(dayOfMonth - 1); // 列表索引从0开始
                weekAmount.set(dayOfMonth - 1, currentAmount.add(incomeVO1.getAmount()));
            }
        }
        monthlyData.put("weekIncome", Collections.singletonList(weekAmount));
        LocalDateTime currentDateTime = LocalDateTime.now();
        List<BigDecimal> amountByDay = new ArrayList<>(Collections.nCopies(7, BigDecimal.ZERO));
        for (IncomeVO incomeVO3 : incomeVOS) {
            Date insertTime = incomeVO3.getInsertTime();
            // 将 Date 转换为 LocalDateTime
            LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault());
            // 计算日期与当前日期的差距
            long daysDifference = ChronoUnit.DAYS.between(insertDateTime.toLocalDate(), currentDateTime.toLocalDate());
            // 如果日期在七天内,累加金额
            if (daysDifference >= 0 && daysDifference < 7) {
                int index = (int) (6 - daysDifference); // 计算对应的索引位置
                BigDecimal amount3 = incomeVO3.getAmount();
                BigDecimal updatedAmount = amountByDay.get(index).add(amount3);
                amountByDay.set(index, updatedAmount);
            }
        }
        monthlyData.put("dayIncome", Collections.singletonList(amountByDay));
        // 创建一个 Map 用于存储今年本周的累计 amount
        Map<Integer, BigDecimal> dayToTotalAmountMap = new HashMap<>();
        BigDecimal yearAmount = BigDecimal.ZERO; // 初始化累加变量为0
        BigDecimal monthAmount = BigDecimal.ZERO; // 初始化累加变量为0
        BigDecimal todayAmount = BigDecimal.ZERO; // 初始化累加变量为0
        // 获取当前日期和时间
        LocalDateTime now = LocalDateTime.now();
        // 今年的起始日期和结束日期
        LocalDateTime startOfYear = now.with(TemporalAdjusters.firstDayOfYear()).with(LocalTime.MIN);
        LocalDateTime endOfYear = now.with(TemporalAdjusters.lastDayOfYear()).with(LocalTime.MAX);
        // 本月的起始日期和结束日期
        LocalDateTime startOfMonth = now.with(TemporalAdjusters.firstDayOfMonth()).with(LocalTime.MIN);
        LocalDateTime endOfMonth = now.with(TemporalAdjusters.lastDayOfMonth()).with(LocalTime.MAX);
        // 本周的起始日期和结束日期
        LocalDateTime startOfWeek = now.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY)).with(LocalTime.MIN);
        LocalDateTime endOfWeek = now.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY)).with(LocalTime.MAX);
        // 今天的起始日期和结束日期
        LocalDateTime startOfDay = now.with(LocalTime.MIN);
        LocalDateTime endOfDay = now.with(LocalTime.MAX);
        // 创建日期格式化器
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        // 筛选符合条件的IncomeVO对象
        List<IncomeVO> thisYearIncome = incomeVOS.stream()
                .filter(income -> {
                    Date insertTime = income.getInsertTime();
                    try {
                        LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault());
                        return insertDateTime.isAfter(startOfYear) && insertDateTime.isBefore(endOfYear);
                    } catch (Exception e) {
                        e.printStackTrace();
                        return false;
                    }
                })
                .collect(Collectors.toList());
        // 使用 map 方法将 IncomeVO 转换为 BigDecimal,提取出 amount 字段
        List<BigDecimal> amounts = thisYearIncome.stream()
                .map(IncomeVO::getAmount)
                .collect(Collectors.toList());
        //本年总收入
        BigDecimal totalAmount = amounts.stream()
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        // 用于展示总营收 本年度营收 本月营收 本周营收 本日营收
        objects.add(totalAmount);
        List<IncomeVO> thisMonthIncome = incomeVOS.stream()
                .filter(income -> {
                    Date insertTime = income.getInsertTime();
                    try {
                        LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault());
                        return insertDateTime.isAfter(startOfMonth) && insertDateTime.isBefore(endOfMonth);
                    } catch (Exception e) {
                        e.printStackTrace();
                        return false;
                    }
                })
                .collect(Collectors.toList());
        List<BigDecimal> amountMonth = thisMonthIncome.stream()
                .map(IncomeVO::getAmount)
                .collect(Collectors.toList());
        // 使用 本月总收入
        BigDecimal totalMonth = amountMonth.stream()
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        objects.add(totalMonth);
        List<IncomeVO> thisWeekIncome = incomeVOS.stream()
                .filter(income -> {
                    Date insertTime = income.getInsertTime();
                    try {
                        LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault());
                        return insertDateTime.isAfter(startOfWeek) && insertDateTime.isBefore(endOfWeek);
                    } catch (Exception e) {
                        e.printStackTrace();
                        return false;
                    }
                })
                .collect(Collectors.toList());
        List<BigDecimal> amountWeek = thisWeekIncome.stream()
                .map(IncomeVO::getAmount)
                .collect(Collectors.toList());
        // 使用 本月总收入
        BigDecimal totalWeek = amountWeek.stream()
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        objects.add(totalWeek);
        List<IncomeVO> todayIncome = incomeVOS.stream()
                .filter(income -> {
                    Date insertTime = income.getInsertTime();
                    try {
                        LocalDateTime insertDateTime = LocalDateTime.ofInstant(insertTime.toInstant(), ZoneId.systemDefault());
                        return insertDateTime.isAfter(startOfDay) && insertDateTime.isBefore(endOfDay);
                    } catch (Exception e) {
                        e.printStackTrace();
                        return false;
                    }
                })
                .collect(Collectors.toList());
        List<BigDecimal> amountToday = todayIncome.stream()
                .map(IncomeVO::getAmount)
                .collect(Collectors.toList());
        // 使用 本月总收入
        BigDecimal totalToday = amountToday.stream()
                .reduce(BigDecimal.ZERO, BigDecimal::add);
        objects.add(totalToday);
        // 最后put
        monthlyData.put("yearMount",objects);
        return monthlyData;
    }
    /**
     * 运营统计-平台-用户数据
     *
     */
    @RequestMapping(value = "/getUserData")
    @ResponseBody
    public Object getUserData() {
        return null;
    }
    /**
     * 退费-平台
     *
     */
    @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<TCoursePackagePayment> 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;
    }
    /**
     * 跳转到运营商统计数据页面
@@ -79,6 +528,135 @@
        model.addAttribute("objectType",objectType);
        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.in(SiteBooking::getAppUserId,userIds);
        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;
    }
    @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;
    }
}