From ed9fac7c424b2721680887e20292a88a11b16121 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期三, 11 十月 2023 10:30:35 +0800
Subject: [PATCH] 后台

---
 cloud-server-course/src/main/resources/mapper/CoursePackagePaymentConfigMapper.xml                              |    7 
 cloud-server-management/src/main/java/com/dsh/course/feignClient/competition/model/CompetitionQuery.java        |    1 
 cloud-server-course/src/main/java/com/dsh/course/model/RegisterOrderQuery.java                                  |    2 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html                     |  196 +++++++++----
 cloud-server-competition/src/main/java/com/dsh/competition/model/CompetitionQuery.java                          |    1 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/operatorIncome.html                  |  193 +++++++++----
 cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/tCoupon_add.html                            |    8 
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/DataStatisticsController.java |  357 +++++++++---------------
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java        |    2 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html                             |    3 
 cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java                                |    5 
 cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/platformIncome.html                  |    2 
 cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java                |   11 
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/RegisterOrderQuery.java                 |    2 
 14 files changed, 431 insertions(+), 359 deletions(-)

diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java b/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java
index 3a10b45..ce9f065 100644
--- a/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/controller/CompetitionController.java
@@ -32,6 +32,7 @@
 import java.io.PrintWriter;
 import java.text.SimpleDateFormat;
 import java.util.*;
+import java.util.concurrent.CompletionService;
 import java.util.stream.Collectors;
 
 /**
@@ -70,13 +71,21 @@
     @Autowired
     private AppUserClient appUserClient;
 
+
     /**
      * 获取赛事报名记录
      */
     @ResponseBody
     @RequestMapping("/base/competition/listAllPayment")
     public List<PaymentCompetition> listAllPayment(@RequestBody CompetitionQuery query){
-        return paymentCompetitionService.listAll(query);
+        List<PaymentCompetition> paymentCompetitions = paymentCompetitionService.listAll(query);
+        if (query.getOperatorId()!=null){
+            for (PaymentCompetition paymentCompetition : paymentCompetitions) {
+                Integer competitionId = paymentCompetition.getCompetitionId();
+                Competition byId = cttService.getById(competitionId);
+            }
+        }
+        return paymentCompetitions;
     }
     @ResponseBody
     @PostMapping("/base/competition/getPayedCompetitions")
diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/model/CompetitionQuery.java b/cloud-server-competition/src/main/java/com/dsh/competition/model/CompetitionQuery.java
index 1f58786..944cc0d 100644
--- a/cloud-server-competition/src/main/java/com/dsh/competition/model/CompetitionQuery.java
+++ b/cloud-server-competition/src/main/java/com/dsh/competition/model/CompetitionQuery.java
@@ -17,4 +17,5 @@
     // 用户ids
     private List<Integer> userIds;
     private Integer insertType;
+    private Integer operatorId;
 }
diff --git a/cloud-server-course/src/main/java/com/dsh/course/model/RegisterOrderQuery.java b/cloud-server-course/src/main/java/com/dsh/course/model/RegisterOrderQuery.java
index 456dcd0..1a02411 100644
--- a/cloud-server-course/src/main/java/com/dsh/course/model/RegisterOrderQuery.java
+++ b/cloud-server-course/src/main/java/com/dsh/course/model/RegisterOrderQuery.java
@@ -38,4 +38,6 @@
     // 订单金额
     private BigDecimal amount;
     private Integer insertType;
+    // 门店ids
+    private List<Integer> storesIds;
 }
diff --git a/cloud-server-course/src/main/resources/mapper/CoursePackagePaymentConfigMapper.xml b/cloud-server-course/src/main/resources/mapper/CoursePackagePaymentConfigMapper.xml
index 9ea4874..7e26912 100644
--- a/cloud-server-course/src/main/resources/mapper/CoursePackagePaymentConfigMapper.xml
+++ b/cloud-server-course/src/main/resources/mapper/CoursePackagePaymentConfigMapper.xml
@@ -75,7 +75,12 @@
             <if test="sTime !=null and sTime!= '' and eTime !=null and eTime!= ''">
                 and t1.insertTime between #{sTime} and #{eTime}
             </if>
-
+            <if test="query.storesIds != null and query.storesIds.size()>0">
+                AND t2.storeId IN
+                <foreach collection="query.storesIds" separator="," item="id" open="(" close=")">
+                    #{id}
+                </foreach>
+            </if>
             <if test="query.userIds != null and query.userIds.size()>0">
                 AND t1.appUserId IN
                 <foreach collection="query.userIds" separator="," item="id" open="(" close=")">
diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/competition/model/CompetitionQuery.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/competition/model/CompetitionQuery.java
index ba14285..9215ed3 100644
--- a/cloud-server-management/src/main/java/com/dsh/course/feignClient/competition/model/CompetitionQuery.java
+++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/competition/model/CompetitionQuery.java
@@ -20,4 +20,5 @@
     // 筛选是平台 还是运营商 还是门店
     private Integer type;
     private Integer insertType;
+    private Integer operatorId;
 }
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 ee240cb..b6122b6 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
@@ -2,6 +2,7 @@
 
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.dsh.course.feignClient.account.*;
 import com.dsh.course.feignClient.account.model.*;
 import com.dsh.course.feignClient.activity.PointMercharsClient;
@@ -112,10 +113,19 @@
     @RequestMapping(value = "/getIncomeData")
     @ResponseBody
     public Object getIncomeData(Integer operatorId,Integer storeId) {
-        // 充值记录查询query
-        RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery();
         // 报名课程查询query
         RegisterOrderQuery query = new RegisterOrderQuery();
+
+        // 根据运营商ID 查询运营商下的所有门店
+        if (operatorId!=null){
+            List<TStore> stores = storeService.list(new QueryWrapper<TStore>().eq("operatorId", operatorId));
+            // 拿到该运营商下的门店id集合
+            List<Integer> storeIds = stores.stream().map(TStore::getId).collect(Collectors.toList());
+            query.setStoresIds(storeIds);
+        }
+
+        // 充值记录查询query
+        RechargeRecordsQuery rechargeRecordsQuery = new RechargeRecordsQuery();
         // 赛事活动查询query
         CompetitionQuery competitionQuery = new CompetitionQuery();
         // 会员支付查询query
@@ -128,7 +138,6 @@
             competitionQuery.setInsertType(roleType);
                  incomeQuery.setInsertType(roleType);
                  incomeQuery.setInsertType(roleType);
-        IncomeVO incomeVO = new IncomeVO();
         List<IncomeVO> incomeVOS = new ArrayList<>();
         // 会员支付记录
         List<VipPayment> vipPayments = vipPaymentClient.registrationList(incomeQuery);
@@ -184,6 +193,7 @@
             if (competition.getAmount() != null) {
                 temp.setAmount(new BigDecimal(competition.getAmount().toString()));
             }
+
             incomeVOS.add(temp);
         }
         // 预约场地
@@ -255,228 +265,131 @@
             BigDecimal orDefault = yearToTotalAmountMap.getOrDefault(Integer.valueOf(o.toString()), BigDecimal.ZERO);
             objects1.add(orDefault);
         }
-//        for (int year = integers1.get(0); year >= integers1.get(integers1.size()-1); year++) {
-//            BigDecimal totalAmount = yearToTotalAmountMap.getOrDefault(year, BigDecimal.ZERO);
-//            // 创建一个新的 IncomeVO 对象,并设置年份和累计金额
-//            IncomeVO resultIncomeVO = new IncomeVO();
-//            resultIncomeVO.setAmount(totalAmount);
-//            resultIncomeVOS.add(resultIncomeVO);
-//        }
         monthlyData.put("yearIncome",objects1);
+        BigDecimal yearIn = new BigDecimal("0.00");
+        for (Object o : objects1) {
+            yearIn = yearIn.add(new BigDecimal(o.toString()));
+        }
+        BigDecimal orDefault = yearToTotalAmountMap.getOrDefault(years, BigDecimal.ZERO);
+        objects.add(orDefault);
+        // 创建一个 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));
+        //yearMount
+        BigDecimal monthI = new BigDecimal("0.00");
+        for (BigDecimal bigDecimal : monthlyAmountList) {
+            monthI = monthI.add(bigDecimal);
+        }
+        objects.add(monthI);
+        // 获取当前月份
+        LocalDate currentDate = LocalDate.now();
+        int currentMonth = currentDate.getMonthValue();
+        // 初始化一个长度为当前月份的天数的列表,并将每一天的金额初始化为零
+        int daysInCurrentMonth = currentDate.lengthOfMonth();
+        List<BigDecimal> weekAmount = new ArrayList<>();
+
+        // 获取最近四周
+        LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN);
+        LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX);
+        // 周度数据
+        LocalDateTime week1Start = minNow.minusDays(6);
+        LocalDateTime week1End   = maxNow;
+
+        LocalDateTime week2Start = minNow.minusDays(13);
+        LocalDateTime week2End = minNow.minusDays(7);
+
+        LocalDateTime week3Start = minNow.minusDays(20);
+        LocalDateTime week3End = minNow.minusDays(14);
+
+        LocalDateTime week4Start = minNow.minusDays(27);
+        LocalDateTime week4End = minNow.minusDays(21);
+
+        // 计算每个周的amount总和
+        BigDecimal tAmount1 = BigDecimal.ZERO;
+        BigDecimal tAmount2 = BigDecimal.ZERO;
+        BigDecimal tAmount3 = BigDecimal.ZERO;
+        BigDecimal tAmount4 = BigDecimal.ZERO;
+        for (IncomeVO incomeVO1 : incomeVOS) {
+            Date insertTime = incomeVO1.getInsertTime();
+            // 将Date转换为LocalDateTime
+            Instant instant = insertTime.toInstant();
+            ZoneId zoneId = ZoneId.systemDefault();
+            LocalDateTime dateTime = instant.atZone(zoneId).toLocalDateTime();
+            // 判断该数据属于哪个周
+            if (dateTime.isAfter(week1Start) && dateTime.isBefore(week1End)) {
+                BigDecimal amount1 = incomeVO1.getAmount();
+                tAmount1=tAmount1.add(amount1);
+            } else if (dateTime.isAfter(week2Start) && dateTime.isBefore(week2End)) {
+                BigDecimal amount1 = incomeVO1.getAmount();
+                tAmount2=tAmount2.add(amount1);
+            } else if (dateTime.isAfter(week3Start) && dateTime.isBefore(week3End)) {
+                BigDecimal amount1 = incomeVO1.getAmount();
+                tAmount4=tAmount3.add(amount1);
+            } else if (dateTime.isAfter(week4Start) && dateTime.isBefore(week4End)) {
+                BigDecimal amount1 = incomeVO1.getAmount();
+                tAmount4=tAmount4.add(amount1);
+            }
+        }
+        weekAmount.add(tAmount1);
+        weekAmount.add(tAmount2);
+        weekAmount.add(tAmount3);
+        weekAmount.add(tAmount4);
+        monthlyData.put("weekIncome", Collections.singletonList(weekAmount));
+        BigDecimal weekIn = new BigDecimal("0.00");
+        for (BigDecimal bigDecimal : weekAmount) {
+            weekIn = weekIn.add(bigDecimal);
+        }
+        objects.add(weekIn);
+        LocalDateTime currentDateTime = LocalDateTime.now();
+        List<BigDecimal> amountByDay = new ArrayList<>(Collections.nCopies(7, BigDecimal.ZERO));
+        for (IncomeVO incomeVO3 : incomeVOS) {
+            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));
+        BigDecimal totalToday = new BigDecimal("0.00");
+        for (BigDecimal bigDecimal : amountByDay) {
+            totalToday = totalToday.add(bigDecimal);
+        }
+        objects.add(totalToday);
+        // 最后put
+        monthlyData.put("yearMount",objects);
+
+        ArrayList<Object> integers = new ArrayList<>();
+        int year = DateUtil.year(new Date());
+        for (int i = 0; i < 10; i++) {
+            integers.add(year-i);
+        }
+        List<Object> collect1 = integers.stream().sorted().collect(Collectors.toList());
+        monthlyData.put("year",collect1);
         return monthlyData;
-
-
-
-
-
-
-
-
-//
-//        // 创建一个 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<>();
-//
-//        // 获取最近四周
-//        LocalDateTime minNow = LocalDateTime.now().with(LocalTime.MIN);
-//        LocalDateTime maxNow = LocalDateTime.now().with(LocalTime.MAX);
-//        // 周度数据
-//        LocalDateTime week1Start = minNow.minusDays(6);
-//        LocalDateTime week1End = maxNow;
-//
-//        LocalDateTime week2Start = minNow.minusDays(13);
-//        LocalDateTime week2End = minNow.minusDays(7);
-//
-//        LocalDateTime week3Start = minNow.minusDays(20);
-//        LocalDateTime week3End = minNow.minusDays(14);
-//
-//        LocalDateTime week4Start = minNow.minusDays(27);
-//        LocalDateTime week4End = minNow.minusDays(21);
-//        // 用于存放四个周的数据
-//        List<Object> objects1 = new ArrayList<>();
-//        // 计算每个周的amount总和
-//        BigDecimal tAmount1 = BigDecimal.ZERO;
-//        BigDecimal tAmount2 = BigDecimal.ZERO;
-//        BigDecimal tAmount3 = BigDecimal.ZERO;
-//        BigDecimal tAmount4 = BigDecimal.ZERO;
-//        for (IncomeVO incomeVO1 : incomeVOS) {
-//            Date insertTime = incomeVO1.getInsertTime();
-//            // 将Date转换为LocalDateTime
-//            Instant instant = insertTime.toInstant();
-//            ZoneId zoneId = ZoneId.systemDefault();
-//            LocalDateTime dateTime = instant.atZone(zoneId).toLocalDateTime();
-//            // 判断该数据属于哪个周
-//            if (dateTime.isAfter(week1Start) && dateTime.isBefore(week1End)) {
-//                BigDecimal amount1 = incomeVO1.getAmount();
-//                tAmount1=tAmount1.add(amount1);
-//            } else if (dateTime.isAfter(week2Start) && dateTime.isBefore(week2End)) {
-//                BigDecimal amount1 = incomeVO1.getAmount();
-//                tAmount2=tAmount2.add(amount1);
-//            } else if (dateTime.isAfter(week3Start) && dateTime.isBefore(week3End)) {
-//                BigDecimal amount1 = incomeVO1.getAmount();
-//                tAmount4=tAmount3.add(amount1);
-//            } else if (dateTime.isAfter(week4Start) && dateTime.isBefore(week4End)) {
-//                BigDecimal amount1 = incomeVO1.getAmount();
-//                tAmount4=tAmount4.add(amount1);
-//            }
-//        }
-//        weekAmount.add(tAmount1);
-//        weekAmount.add(tAmount2);
-//        weekAmount.add(tAmount3);
-//        weekAmount.add(tAmount4);
-//        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));
-//        // 获取当前日期和时间
-//        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);
-//
-//        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());
-//        monthlyData.put("year",collect);
-//        return monthlyData;
     }
-
-
 
     /**
      * 运营统计-平台-用户数据
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java
index 16e7442..adc2a64 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TCouponController.java
@@ -85,7 +85,7 @@
         Integer objectType = UserExt.getUser().getObjectType();
         System.out.println(objectType);
         model.addAttribute("userType",objectType);
-        return PREFIX + "TQuestionAdd.html";
+        return PREFIX + "TCouponAdd.html";
     }
 
     @RequestMapping("/coupon_record/{id}")
diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/RegisterOrderQuery.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/RegisterOrderQuery.java
index f7d5213..ab910ea 100644
--- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/RegisterOrderQuery.java
+++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/model/RegisterOrderQuery.java
@@ -37,4 +37,6 @@
     // 订单金额
     private BigDecimal amount;
     private Integer insertType;
+    // 门店ids
+    private List<Integer> storesIds;
 }
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/operatorIncome.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/operatorIncome.html
index 94f3a09..98b5eac 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/operatorIncome.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/operatorIncome.html
@@ -79,11 +79,11 @@
                                     <h2>营收数据</h2>
                                     </br>
                                         <div id = "money1" style="width: 1500px" >
-                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>总营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本年度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本月度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本周营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本日营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="totalIncome">总营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                            <span id="yearIncome">本年度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                            <span id="monthIncome">本月度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                            <span id="weekIncome">本周营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                            <span id="todayIncome">本日营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                             </br>
                                             </br>
                                         </div>
@@ -267,7 +267,8 @@
 <script src="${ctxPath}/static/js/plugins/switchery/switchery.js"></script>
 <script>
 
-
+    var weekX = ["1周","2周","3周","4周"];
+    var monthX = ["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"];
     function oneChangeNext(e){
         var oneId=$(e).val();
         var ajax = new $ax(Feng.ctxPath + "/tCity/onChange", function(data){
@@ -292,7 +293,7 @@
 
 
     function search(){
-
+        income();
         if(cutType==1){
             srtj()
             tuifei()
@@ -307,6 +308,127 @@
         if(cutType==3){
             jxtj()
         }
+    }
+    function income(){
+        var id = $("#cCode").val()
+        var beginTime = $("#beginTime").val()
+        console.log(id)
+        if(id==""){
+            Feng.info("请先选择运营商");
+            return;
+        }
+        var ajax = new $ax(Feng.ctxPath + "/data/getIncomeData", function(resp){
+            yearX=resp.year
+            var list = resp.yearMount;
+            console.log(list);
+            var t1 = document.getElementById("totalIncome");
+            var t2 = document.getElementById("yearIncome");
+            var t3 = document.getElementById("monthIncome");
+            var t4 = document.getElementById("weekIncome");
+            var t5 = document.getElementById("todayIncome");
+            t1.innerText = "总营收:"+list[0]+"         ";
+            t2.innerText = "年度营收:"+list[1]+"         ";
+            t3.innerText = "月度营收:"+list[2]+"         ";
+            t4.innerText = "周度营收:"+list[3]+"         ";
+            t5.innerText = "日度营收:"+list[4]+"         ";
+            var year =  resp.yearIncome;
+            var month =  resp.monthIncome;
+            var week =  resp.weekIncome;
+            console.log("周度营收")
+            console.log(year)
+            console.log(week)
+            var days = week[0].length;
+            var day =  resp.dayIncome;
+            option  = {
+                tooltip: {
+                    trigger: 'axis'
+                },
+                legend: {
+
+                    data: ['年度营收', '月度营收','周度营收','日度营收'],
+                    icon: 'stack',
+                    selectedMode: 'single', // 单选
+                    selected: {
+                        年度营收: true,
+                        月度营收: false,
+                        周度营收: false,
+                        日度营收: false
+                    }
+                },
+                grid: {
+                    left: '3%',
+                    right: '4%',
+                    bottom: '3%',
+                    containLabel: true
+                },
+                toolbox: {
+                    feature: {
+                        saveAsImage: {}
+                    }
+                },
+                xAxis: {
+                    type: 'category',
+                    boundaryGap: false,
+                    data: yearX
+                },
+                yAxis: {
+                    type: 'value'
+                },
+                series: [
+                    {
+                        name: '年度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [year[0],year[1],year[2],year[3],year[4],year[5],year[6],year[7],year[8],year[9],year[10]]
+                    },
+                    {
+                        name: '月度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [month[0][0],month[0][1], month[0][2], month[0][3], month[0][4],
+                            month[0][5], month[0][6], month[0][7], month[0][8], month[0][9], month[0][10], month[0][11]]
+                    },
+                    {
+                        name: '周度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [
+                            week[0][0], week[0][1], week[0][2], week[0][3], week[0][4]
+                        ]
+                    },
+                    {
+                        name: '日度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [
+                            day[0][0], day[0][1],day[0][2], day[0][3], day[0][4], day[0][5], day[0][6]
+                        ]
+                    }
+                ]
+            };
+
+        });
+        ajax.set("type",1);
+        ajax.set("",id);
+        ajax.start();
+        // 营收
+        var income  = echarts.init(document.getElementById('income'));
+        income.on('legendselectchanged', obj => {
+            var options = income.getOption()
+            //这里是选择切换什么样的x轴,那么他会进行对Y值的切换
+            if (obj.name == '年度营收') {
+                options.xAxis[0].data = yearX
+            } else if (obj.name == '月度营收') {
+                options.xAxis[0].data = monthX
+            } else if (obj.name == '周度营收') {
+                options.xAxis[0].data = weekX
+            } else if (obj.name == '日度营收') {
+                options.xAxis[0].data = dataX
+            }
+            income.setOption(options, true)
+        })
+        // 使用刚指定的配置项和数据显示图表。
+        income.setOption(option);
     }
 
 
@@ -341,59 +463,9 @@
         var myChart6 = echarts.init(document.getElementById('teach'));
         var myChart7 = echarts.init(document.getElementById('courseData'));
         tuifei()
-        option  = {
-            tooltip: {
-                trigger: 'axis'
-            },
-            legend: {
-                data: ['年度营收', '月度营收', '周度营收', '日度营收']
-            },
-            grid: {
-                left: '3%',
-                right: '4%',
-                bottom: '3%',
-                containLabel: true
-            },
-            toolbox: {
-                feature: {
-                    saveAsImage: {}
-                }
-            },
-            xAxis: {
-                type: 'category',
-                boundaryGap: false,
-                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
-            },
-            yAxis: {
-                type: 'value'
-            },
-            series: [
-                {
-                    name: '年度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [120, 132, 101, 134, 90, 230, 160, 190, 410, 330, 210, 330]
-                },
-                {
-                    name: '月度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [220, 182, 191, 234, 290, 330, 310, 190, 210, 330, 410, 160]
-                },
-                {
-                    name: '周度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [150, 232, 201, 154, 190, 330, 410, 160, 210, 195, 210, 188]
-                },
-                {
-                    name: '日度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [320, 332, 301, 334, 390, 330, 320, 10, 195, 145, 188, 160]
-                }
-            ]
-        };
+        income()
+
+
         option2 = {
             tooltip: {
                 trigger: 'axis'
@@ -690,7 +762,6 @@
             ]
         };
         // 使用刚指定的配置项和数据显示图表。
-        myChart.setOption(option);
         myChart2.setOption(option2);
         myChart3.setOption(option3);
         myChart4.setOption(option4);
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/platformIncome.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/platformIncome.html
index d0cdc77..d5967a2 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/platformIncome.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/platformIncome.html
@@ -369,7 +369,7 @@
                         name: '年度营收',
                         type: 'line',
                         stack: 'Total',
-                        data: [year[0].amount,year[1].amount,year[2].amount,year[3].amount,year[4].amount,year[5].amount]
+                        data: [year[0],year[1],year[2],year[3],year[4],year[5],year[6],year[7],year[8],year[9],year[10]]
                     },
                     {
                         name: '月度营收',
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html
index e406831..e61f6d8 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/dataStatistics/storeIncome.html
@@ -80,15 +80,15 @@
                                 <div class="col-sm-10">
                                     <h2>营收数据</h2>
                                     </br>
-                                        <div id = "money1" style="width: 1500px" >
-                                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>总营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本年度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本月度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本周营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            <span>本日营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-                                            </br>
-                                            </br>
-                                        </div>
+                                    <div id = "money1" style="width: 1500px" >
+                                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id="totalIncome">总营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                        <span id="yearIncome">本年度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                        <span id="monthIncome">本月度营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                        <span id="weekIncome">本周营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                        <span id="todayIncome">本日营收:</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+                                        </br>
+                                        </br>
+                                    </div>
                                     <div id="income" style="width: 1280px;height:500px;"></div>
                                 </div>
                                 <div class="col-sm-10">
@@ -275,6 +275,7 @@
         if(cutType==1){
             srtj()
             tuifei()
+            income()
         }
 
         if(cutType==2){
@@ -286,7 +287,126 @@
             jxtj()
         }
     }
+    function income(){
+        // var id = $("#cCode").val()
+        // var beginTime = $("#beginTime").val()
+        // console.log(id)
+        // if(id==""){
+        //     Feng.info("请先选择运营商");
+        //     return;
+        // }
+        var ajax = new $ax(Feng.ctxPath + "/data/getIncomeData", function(resp){
+            yearX=resp.year
+            var list = resp.yearMount;
+            console.log(list);
+            var t1 = document.getElementById("totalIncome");
+            var t2 = document.getElementById("yearIncome");
+            var t3 = document.getElementById("monthIncome");
+            var t4 = document.getElementById("weekIncome");
+            var t5 = document.getElementById("todayIncome");
+            t1.innerText = "总营收:"+list[0]+"         ";
+            t2.innerText = "年度营收:"+list[1]+"         ";
+            t3.innerText = "月度营收:"+list[2]+"         ";
+            t4.innerText = "周度营收:"+list[3]+"         ";
+            t5.innerText = "日度营收:"+list[4]+"         ";
+            var year =  resp.yearIncome;
+            var month =  resp.monthIncome;
+            var week =  resp.weekIncome;
+            console.log("周度营收")
+            console.log(year)
+            console.log(week)
+            var days = week[0].length;
+            var day =  resp.dayIncome;
+            option  = {
+                tooltip: {
+                    trigger: 'axis'
+                },
+                legend: {
 
+                    data: ['年度营收', '月度营收','周度营收','日度营收'],
+                    icon: 'stack',
+                    selectedMode: 'single', // 单选
+                    selected: {
+                        年度营收: true,
+                        月度营收: false,
+                        周度营收: false,
+                        日度营收: false
+                    }
+                },
+                grid: {
+                    left: '3%',
+                    right: '4%',
+                    bottom: '3%',
+                    containLabel: true
+                },
+                toolbox: {
+                    feature: {
+                        saveAsImage: {}
+                    }
+                },
+                xAxis: {
+                    type: 'category',
+                    boundaryGap: false,
+                    data: yearX
+                },
+                yAxis: {
+                    type: 'value'
+                },
+                series: [
+                    {
+                        name: '年度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [year[0],year[1],year[2],year[3],year[4],year[5],year[6],year[7],year[8],year[9],year[10]]
+                    },
+                    {
+                        name: '月度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [month[0][0],month[0][1], month[0][2], month[0][3], month[0][4],
+                            month[0][5], month[0][6], month[0][7], month[0][8], month[0][9], month[0][10], month[0][11]]
+                    },
+                    {
+                        name: '周度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [
+                            week[0][0], week[0][1], week[0][2], week[0][3], week[0][4]
+                        ]
+                    },
+                    {
+                        name: '日度营收',
+                        type: 'line',
+                        stack: 'Total',
+                        data: [
+                            day[0][0], day[0][1],day[0][2], day[0][3], day[0][4], day[0][5], day[0][6]
+                        ]
+                    }
+                ]
+            };
+
+        });
+        ajax.set("type",1);
+        ajax.start();
+        // 营收
+        var income  = echarts.init(document.getElementById('income'));
+        income.on('legendselectchanged', obj => {
+            var options = income.getOption()
+            //这里是选择切换什么样的x轴,那么他会进行对Y值的切换
+            if (obj.name == '年度营收') {
+                options.xAxis[0].data = yearX
+            } else if (obj.name == '月度营收') {
+                options.xAxis[0].data = monthX
+            } else if (obj.name == '周度营收') {
+                options.xAxis[0].data = weekX
+            } else if (obj.name == '日度营收') {
+                options.xAxis[0].data = dataX
+            }
+            income.setOption(options, true)
+        })
+        // 使用刚指定的配置项和数据显示图表。
+        income.setOption(option);
+    }
 
     let cutType=1;
 
@@ -1089,8 +1209,7 @@
         getContent(1);
         getContent1(1);
         getContent2(1);
-        // 基于准备好的dom,初始化echarts实例
-        var myChart  = echarts.init(document.getElementById('income'));
+
         var myChart2 = echarts.init(document.getElementById('user'));
         var myChart3 = echarts.init(document.getElementById('vip'));
         var myChart4 = echarts.init(document.getElementById('activity'));
@@ -1098,59 +1217,7 @@
         var myChart6 = echarts.init(document.getElementById('teach'));
         var myChart7 = echarts.init(document.getElementById('courseData'));
         tuifei()
-        option  = {
-            tooltip: {
-                trigger: 'axis'
-            },
-            legend: {
-                data: ['年度营收', '月度营收', '周度营收', '日度营收']
-            },
-            grid: {
-                left: '3%',
-                right: '4%',
-                bottom: '3%',
-                containLabel: true
-            },
-            toolbox: {
-                feature: {
-                    saveAsImage: {}
-                }
-            },
-            xAxis: {
-                type: 'category',
-                boundaryGap: false,
-                data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月']
-            },
-            yAxis: {
-                type: 'value'
-            },
-            series: [
-                {
-                    name: '年度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [120, 132, 101, 134, 90, 230, 160, 190, 410, 330, 210, 330]
-                },
-                {
-                    name: '月度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [220, 182, 191, 234, 290, 330, 310, 190, 210, 330, 410, 160]
-                },
-                {
-                    name: '周度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [150, 232, 201, 154, 190, 330, 410, 160, 210, 195, 210, 188]
-                },
-                {
-                    name: '日度营收',
-                    type: 'line',
-                    stack: 'Total',
-                    data: [320, 332, 301, 334, 390, 330, 320, 10, 195, 145, 188, 160]
-                }
-            ]
-        };
+
         option2 = {
             tooltip: {
                 trigger: 'axis'
@@ -1447,7 +1514,6 @@
             ]
         };
         // 使用刚指定的配置项和数据显示图表。
-        myChart.setOption(option);
         myChart2.setOption(option2);
         myChart3.setOption(option3);
         myChart4.setOption(option4);
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html
index 75f870d..a93fec1 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/TCouponAdd.html
@@ -114,6 +114,9 @@
                             <input class="col-sm-1 control-label" name="distributionMethod"  type="radio"
                                    value="3" style="margin-left: 4%;margin-top: 10px;width: 13px;height: 13px"/>
                             <label class="col-sm-1" style="width: 16%;margin-top: 7px">自动发券</label>
+                            <input class="col-sm-1 control-label" name="distributionMethod"  type="radio"
+                                   value="4" style="margin-left: 4%;margin-top: 10px;width: 13px;height: 13px"/>
+                            <label class="col-sm-1" style="width: 16%;margin-top: 7px">课包赠送</label>
                         </div>
                     </div>
                     
diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/tCoupon_add.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/tCoupon_add.html
index 1ff93e8..b8925ea 100644
--- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/tCoupon_add.html
+++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tCoupon/tCoupon_add.html
@@ -8,13 +8,7 @@
                             <#input id="id" name="主键" underline="true"/>
                             <#input id="name" name="优惠券名称" underline="true"/>
                             <#input id="type" name="优惠券类型(1=满减券,2=代金券,3=体验券)" underline="true"/>
-                            <#input id="content" name="优惠券规则JSON
-格式:
-{
-	"conditionalAmount": 5,
-	"deductionAmount": 6.8,
-	"experienceName": ""
-}" underline="true"/>
+                            <#input id="content" name="优惠券规则JSON 格式: { 'conditionalAmount': 5, 'deductionAmount': 6.8, 'experienceName': '' }" underline="true"/>
                             <#input id="illustrate" name="优惠券说明" underline="true"/>
                             <#input id="distributionMethod" name="发放方式(1=积分购买,2=注册赠送,3=自动发券)" underline="true"/>
                             <#input id="redemptionMethod" name="兑换方式(1=积分,2=积分+现金)" underline="true"/>
diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
index 7a6dafe..4d85cff 100644
--- a/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
+++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/SiteServiceImpl.java
@@ -251,8 +251,12 @@
 
         //校验优惠券
         Long couponId = reservationSite.getCouponId();
+        if (couponId != 0){
+
         if(null != couponId && reservationSite.getPayType() != 3){
             UserCoupon userCoupon = userCouponClient.queryUserCouponById(new QueryUserCouponByIdAndUserId(reservationSite.getCouponId(),uid));
+
+
             if(userCoupon.getStatus() == 2){
                 return ResultUtil.error("优惠券已被核销");
             }
@@ -283,6 +287,7 @@
             userCoupon.setStatus(2);
             userCouponClient.updateUserCoupon(userCoupon);
         }
+        }
 
 
         SiteBooking siteBooking = new SiteBooking();

--
Gitblit v1.7.1