Przeglądaj źródła

增加各种边界判断

xwh 4 lat temu
rodzic
commit
68080a490c

+ 48 - 5
kmall-admin/src/main/java/com/kmall/admin/controller/statistics/MonthlyCustomersController.java

@@ -77,6 +77,12 @@ public class MonthlyCustomersController {
      */
     @RequestMapping("/customersQuery")
     public R queryMonthlyCustomers(@RequestParam("startMonth") String startMonth, @RequestParam("endMonth") String endMonth) {
+        if (Objects.isNull(startMonth) || "".equals(startMonth)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(endMonth)  || "".equals(endMonth)){
+            return R.error("请先选择结束时间");
+        }
         List<String> dateList = new ArrayList<>();
         Map<String, Object> returnMap = new HashMap<>();
         try {
@@ -199,7 +205,12 @@ public class MonthlyCustomersController {
      */
     @RequestMapping("/top10ForProduct")
     public R top10ForProduct(@RequestParam("month") String month, @RequestParam("week") String week){
-
+        if (Objects.isNull(month) || "".equals(month)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(week)  || "".equals(week)){
+            return R.error("请先选择结束时间");
+        }
         String merchSn = null;
         SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
         if(!"1".equals(sysUser.getRoleType())){
@@ -221,7 +232,12 @@ public class MonthlyCustomersController {
     @RequestMapping("/top10ByBrandAndSupplier")
     public R top10ByBrandAndSupplier(@RequestParam("startDate") String startDate,
                                      @RequestParam("endDate") String endDate){
-
+        if (Objects.isNull(startDate) || "".equals(startDate)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(endDate)  || "".equals(endDate)){
+            return R.error("请先选择结束时间");
+        }
         String merchSn = null;
         SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
         if(!"1".equals(sysUser.getRoleType())){
@@ -236,7 +252,12 @@ public class MonthlyCustomersController {
     @RequestMapping("/top10ByBrandAndSupplierExport")
     public R top10ByBrandAndSupplierExport(@RequestParam("startDate") String startDate,
                                      @RequestParam("endDate") String endDate, HttpServletResponse response, HttpServletRequest request){
-
+        if (Objects.isNull(startDate) || "".equals(startDate)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(endDate)  || "".equals(endDate)){
+            return R.error("请先选择结束时间");
+        }
         String merchSn = null;
         SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
         if(!"1".equals(sysUser.getRoleType())){
@@ -296,7 +317,12 @@ public class MonthlyCustomersController {
      */
     @RequestMapping("/customersQueryByWeek")
     public R queryWeeklyCustomers(@RequestParam("startWeek") String startWeek, @RequestParam("endWeek") String endWeek) throws ParseException {
-
+        if (Objects.isNull(startWeek) || "".equals(startWeek)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(endWeek)  || "".equals(endWeek)){
+            return R.error("请先选择结束时间");
+        }
         List<String> dateList = new ArrayList<>();
         try {
             calculateDifferentWeek(dateList, startWeek, endWeek);
@@ -431,6 +457,12 @@ public class MonthlyCustomersController {
      */
     @RequestMapping("/queryMonthlyWechatFollowers")
     public R queryMonthlyWechatFollowers(@RequestParam("startMonth") String startMonth, @RequestParam("endMonth") String endMonth) {
+        if (Objects.isNull(startMonth) || "".equals(startMonth)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(endMonth)  || "".equals(endMonth)){
+            return R.error("请先选择结束时间");
+        }
         List<String> dateList = new ArrayList<>();
         Map<String, Object> returnMap = new HashMap<>();
         try {
@@ -535,7 +567,12 @@ public class MonthlyCustomersController {
      */
     @RequestMapping("/salesByCategory")
     public R salesByCategory(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate){
-
+        if (Objects.isNull(startDate) || "".equals(startDate)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(endDate)  || "".equals(endDate)){
+            return R.error("请先选择结束时间");
+        }
         String merchSn = null;
         SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
         if(!"1".equals(sysUser.getRoleType())){
@@ -553,6 +590,12 @@ public class MonthlyCustomersController {
      */
     @RequestMapping("/monthlyCategory")
     public R monthlyCategory(@RequestParam("startMonth") String startMonth, @RequestParam("endMonth") String endMonth) {
+        if (Objects.isNull(startMonth) || "".equals(startMonth)){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(endMonth)  || "".equals(endMonth)){
+            return R.error("请先选择结束时间");
+        }
         List<String> dateList = new ArrayList<>();
         Map<String, Object> returnMap = new HashMap<>();
         try {

+ 24 - 2
kmall-admin/src/main/webapp/js/sale/monthlyCategory.js

@@ -118,7 +118,12 @@ function dFun(categoryList,series) {
 function queryMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         startMonth:startMonth,
         endMonth:endMonth
@@ -133,6 +138,10 @@ function queryMonthly(){
         type: 'POST',
         success: function(data) {
             console.log(JSON.stringify(data));
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             series=[];
             series.length=0;
             for (var i = 0, size = data.dateList.length; i < size; i++) {
@@ -170,11 +179,24 @@ function queryMonthly(){
 function exportMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var params = {
         startMonth:startMonth,
         endMonth:endMonth
     };
+    if (startMonth==null || startMonth==undefined || startMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
+    if (endMonth==null || endMonth==undefined || endMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
     console.log(params);
     exportFile('#rrapp', '../monthly/monthlyCategoryExport', params);
 

+ 24 - 275
kmall-admin/src/main/webapp/js/sale/monthlyCustomers.js

@@ -175,7 +175,12 @@ function dFun(dateList, totalNumberList, totalSalesList,taotalCustomersList,avgB
 function queryMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         startMonth:startMonth,
         endMonth:endMonth
@@ -189,6 +194,10 @@ function queryMonthly(){
         type: 'POST',
         success: function(data) {
             console.log(JSON.stringify(data))
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             dFun(data.dateList, data.totalNumberList, data.totalSalesList,data.taotalCustomersList,data.avgBasketSaleList);
 
         },
@@ -199,285 +208,25 @@ function queryMonthly(){
 function exportMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var params = {
         startMonth:startMonth,
         endMonth:endMonth
     };
+    if (startMonth==null || startMonth==undefined || startMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
+    if (endMonth==null || endMonth==undefined || endMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
     console.log(params);
     exportFile('#rrapp', '../monthly/monthlySalesGrowthExport2', params);
 
 }
-
-
-let vm = new Vue({
-    el: '#rrapp',
-    data: {
-        date: '',
-        refreshTime: 10,
-        type: 'store',
-        refreshCount:0,
-
-        storeId: '',
-        merchSn: '',
-        merchName: '',
-        storeName: '',
-        salesDate: '',
-        totalSales: '',
-        actualSales: '',
-        preferentialLoss: '',
-        totalCost: '',
-        grossProfit: '',
-        grossProfitRatio: '',
-        proportion: '',
-        guestNumber: '',
-        guestUnitPrice: '',
-        lastSalesTime: '',
-        categoryId: '',
-        categoryName: '',
-
-        showList: false,
-        compareDate: '',//比较日期
-        storeId2: '',
-        merchSn2: '',
-        merchName2: '',
-        storeName2: '',
-        salesDate2: '',
-        totalSales2: '',
-        actualSales2: '',
-        preferentialLoss2: '',
-        totalCost2: '',
-        grossProfit2: '',
-        grossProfitRatio2: '',
-        proportion2: '',
-        guestNumber2: '',
-        guestUnitPrice2: '',
-        lastSalesTime2: '',
-        intervalId: 0,
-        isCompare: false,
-        compare2: '',
-
-
-        temp: {
-            date: '',
-            refreshTime: 10,
-            type: '',
-            storeId: '',
-            merchSn: '',
-            salesDate: '',
-            categoryId: ''
-        },
-
-
-        rateList: [
-            {
-                id: '0',
-                name: '含税'
-            },
-            {
-                id: '1',
-                name: '不含税'
-
-            }
-        ],
-        projectList: [
-            {
-                id: '0',
-                name: '销售总额'
-            },
-            {
-                id: '1',
-                name: '客单价'
-
-            }
-        ],
-        seriesTypeList: [
-            {
-                id: 'bar',
-                name: '垂直柱状图'
-            },
-            {
-                id: 'line',
-                name: '折线图'
-
-            },
-            {
-                id: 'pie',
-                name: '饼图'
-
-            }
-        ],
-        formatsList: [
-            {
-                id: '0',
-                name: '<全部>'
-            },
-            {
-                id: '1',
-                name: '<非全部>'
-
-            }
-        ],
-        salesList: [
-            {
-                store: {storeId: '11106', storeName: '前海店'},
-                totalSales: 43046.18,
-                actualSales: 35593.46
-            }
-        ],
-        dept: {
-            deptId: '',
-            deptName: ''
-        },
-        category: {
-            categoryId: '',
-            categoryName: ''
-        },
-        seriesList: [], //保存饼图数据
-        seriesList2: [],
-        xAxisList: {    //主要用于保存 启动刷新时的条件和数据
-            storeId: '',
-            storeName: '',
-            merchSn: '',
-            merchName: '',
-            totalSales: '',
-            actualSales: '',
-            preferentialLoss: '',
-            totalCost: '',
-            grossProfit: '',
-            grossProfitRatio: '',
-            proportion: '',
-            guestNumber: '',
-            guestUnitPrice: '',
-            lastSalesTime: '',
-
-            salesDate: '0',
-            projectSelect: '0',
-            type:''
-        },
-        dataList: [],
-        tooltip: {},
-        today:''
-    },
-    created() {
-        this.rateSelect = this.rateList[0].id;
-        this.projectSelect = this.projectList[0].id;
-        this.seriesTypeSelect = this.seriesTypeList[0].id;
-        this.formatsSelect = this.formatsList[0].id;
-    },
-    methods: {
-
-        seriesTypeSwitch: function () {
-            console.log(vm.seriesTypeSelect);
-        },
-        showEcharts: function () {
-            // 基于准备好的dom,初始化echarts实例
-            myChart = echarts.init(document.getElementById('main'));
-            myChart.clear();
-            //加载动画
-            myChart.showLoading();
-
-
-            //项目下拉框判断       6-19,饼图设置 vm.xAxisList
-            var temp = '';
-            if (vm.xAxisList.projectSelect == '0') {
-                if (vm.xAxisList.type == 'dept') {
-                    temp = '[' + vm.xAxisList.merchSn + ']' + vm.xAxisList.merchName + '/销售总额:' + vm.xAxisList.totalSales + '元(' + vm.xAxisList.salesDate + ')';
-                } else {
-                    temp = '[' + vm.xAxisList.storeId + ']' + vm.xAxisList.storeName + '/销售总额:' + vm.xAxisList.totalSales + '元(' + vm.xAxisList.salesDate + ')';
-                }
-                vm.seriesList2.push(vm.xAxisList.totalSales);
-                vm.seriesList.push({value: vm.xAxisList.totalSales, name: temp});
-
-            } else if (vm.xAxisList.projectSelect == '1') {
-                if (vm.xAxisList.type == 'dept') {
-                    temp = '[' + vm.xAxisList.merchSn + ']' + vm.xAxisList.merchName + '/客单价:' + vm.xAxisList.guestUnitPrice + '元(' + vm.xAxisList.salesDate + ')';
-                } else {
-                    temp = '[' + vm.xAxisList.storeId + ']' + vm.xAxisList.storeName + '/客单价:' + vm.xAxisList.guestUnitPrice + '元(' + vm.xAxisList.salesDate + ')';
-                }
-                vm.seriesList2.push(vm.xAxisList.guestUnitPrice);
-                vm.seriesList.push({value: vm.xAxisList.guestUnitPrice, name: temp});
-
-            }
-
-            vm.dataList = [temp];
-
-            if (vm.seriesTypeSelect == "pie") {
-                vm.seriesList2 = vm.seriesList.concat();
-            }
-
-            // console.log('vm.seriesList2');
-            // console.log(vm.seriesList2);
-
-            // 指定图表的配置项和数据
-            //销售量
-            var option = {
-                title: {
-                    // textAlign: 'right',
-                    text: 'Monthly Customers & Avg Basket',
-                    x: 'center',
-                    textStyle: {
-                        //文字颜色
-                        color: '#17233d',
-                        //字体风格,'normal','italic','oblique'
-                        fontStyle: 'normal',
-                        //字体粗细 'normal','bold','bolder','lighter',100 | 200 | 300 | 400...
-                        fontWeight: 'bold',
-                        //字体系列
-                        fontFamily: 'sans-serif',
-                        //字体大小
-                        fontSize: 28
-                    }
-                },
-                tooltip: {
-                    formatter: function (params) {
-                        return params.name;
-                    }
-                },
-                legend: {
-                    data: ['/销售总额']
-                },
-                xAxis: {
-                    data: vm.dataList,
-                    axisLabel: {
-                        interval: 0
-                    }
-                },
-                yAxis: {},
-                series: [{
-                    barMaxWidth: '20%',
-                    barWidth: '50%',
-                    radius: '55%',
-                    roseType: 'angle',
-                    type: vm.seriesTypeSelect,
-                    color: ['#dd6b66', '#759aa0'],
-                    data: vm.seriesList2
-                }]
-            };
-
-            //隐藏
-            myChart.hideLoading();
-            // 使用刚指定的配置项和数据显示图表。
-            myChart.setOption(option);
-
-        },
-        tooltipFormatter: function () {
-            if (vm.type == 'dept') {
-                return '[' + vm.merchSn + ']' + vm.merchName + '/销售总额:' + vm.totalSales + '元(' + vm.salesDate + ')';
-            }
-            return '[' + vm.storeId + ']' + vm.storeName + '/销售总额:' + vm.totalSales + '元(' + vm.salesDate + ')';
-        },
-        showTable: function (postParam) {
-
-            console.log(postParam);
-
-            $("#jqGrid").jqGrid('setGridParam', {
-                postData: postParam
-
-            }).trigger("reloadGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
-        },
-        switchProjectView: function () {
-            console.log(vm.projectSelect);
-        }
-    }
-});

+ 57 - 35
kmall-admin/src/main/webapp/js/sale/monthlySalesGrowth.js

@@ -1,37 +1,37 @@
 $(function () {
-    var data = {
-        "echatX": [
-            "2019-07-02",
-            "2019-07-03",
-            "2019-07-04",
-            "2019-07-05",
-            "2019-07-06",
-            "2019-07-07",
-            "2019-07-08",
-            "2019-07-09",
-            "2019-07-10",
-            "2019-07-11",
-            "2019-07-12",
-            "2019-07-13",
-            "2019-07-14",
-            "2019-07-15"
-        ],
-        "echatY": [
-            501,210,123,333,445,157,151,369,101,101,350,435,153,100
-        ],
-        "echatY2": [
-            80,40,13,36,57,77,41,39,61,31,60,73,33,50
-        ],
-        "echatY3": [
-            5091,2210,1233,3133,4415,1517,1511,3619,1101,1011,3510,4315,1513,1100
-        ],
-        "echatY4": [
-            501,210,123,333,445,157,151,369,101,101,350,435,153,100
-        ],
-        "peopleTotal":15,"peopleOnline":4,"peopleOutline":12,"ranges":[]
-    };
-    dFun(data.echatX, data.echatY, data.echatY2,data.echatY3,data.echatY4);
-
+    // var data = {
+    //     "echatX": [
+    //         "2019-07-02",
+    //         "2019-07-03",
+    //         "2019-07-04",
+    //         "2019-07-05",
+    //         "2019-07-06",
+    //         "2019-07-07",
+    //         "2019-07-08",
+    //         "2019-07-09",
+    //         "2019-07-10",
+    //         "2019-07-11",
+    //         "2019-07-12",
+    //         "2019-07-13",
+    //         "2019-07-14",
+    //         "2019-07-15"
+    //     ],
+    //     "echatY": [
+    //         501,210,123,333,445,157,151,369,101,101,350,435,153,100
+    //     ],
+    //     "echatY2": [
+    //         80,40,13,36,57,77,41,39,61,31,60,73,33,50
+    //     ],
+    //     "echatY3": [
+    //         5091,2210,1233,3133,4415,1517,1511,3619,1101,1011,3510,4315,1513,1100
+    //     ],
+    //     "echatY4": [
+    //         501,210,123,333,445,157,151,369,101,101,350,435,153,100
+    //     ],
+    //     "peopleTotal":15,"peopleOnline":4,"peopleOutline":12,"ranges":[]
+    // };
+    // dFun(data.echatX, data.echatY, data.echatY2,data.echatY3,data.echatY4);
+    //
 
 });
 var myChart;
@@ -140,7 +140,12 @@ function dFun(dateList, totalNumberList, totalSalesList) {
 function queryMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         startMonth:startMonth,
         endMonth:endMonth
@@ -154,6 +159,10 @@ function queryMonthly(){
         type: 'POST',
         success: function(data) {
             console.log(JSON.stringify(data))
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             dFun(data.dateList, data.totalNumberList, data.totalSalesList);
 
         },
@@ -165,11 +174,24 @@ function queryMonthly(){
 function exportMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var params = {
         startMonth:startMonth,
         endMonth:endMonth
     };
+    if (startMonth==null || startMonth==undefined || startMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
+    if (endMonth==null || endMonth==undefined || endMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
     console.log(params);
     exportFile('#rrapp', '../monthly/monthlySalesGrowthExport', params);
 

+ 10 - 1
kmall-admin/src/main/webapp/js/sale/salesByCategory.js

@@ -41,7 +41,12 @@ function dFun(dateList) {
 function queryMonthly(){
     var startDate = document.getElementById("startDate").value;
     var endDate = document.getElementById("endDate").value;
-
+    var startTimeDate = new Date(startDate);
+    var endTimeDate = new Date(endDate);
+    if(startTimeDate.getTime() > endTimeDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         startDate:startDate,
         endDate:endDate
@@ -54,6 +59,10 @@ function queryMonthly(){
         type: 'POST',
         success: function(data) {
             console.log(JSON.stringify(data.list))
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             dFun(data.list);
 
         },

+ 24 - 2
kmall-admin/src/main/webapp/js/sale/top10ByBrandAndSupplier.js

@@ -1,7 +1,12 @@
 function queryMonthly(){
     var startDate = document.getElementById("startDate").value;
     var endDate = document.getElementById("endDate").value;
-
+    var startTimeDate = new Date(startDate);
+    var endTimeDate = new Date(endDate);
+    if(startTimeDate.getTime() > endTimeDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         startDate:startDate,
         endDate:endDate
@@ -14,6 +19,10 @@ function queryMonthly(){
         contentType:"application/x-www-form-urlencoded",
         type: 'POST',
         success: function(data) {
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             document.getElementById("supplierUl").innerHTML = "";
             document.getElementById("brandUl").innerHTML = "";
 
@@ -52,11 +61,24 @@ function createLi(title,sales,ulId,flag){
 function exportMonthly(){
     var startDate = document.getElementById("startDate").value;
     var endDate = document.getElementById("endDate").value;
-
+    var startTimeDate = new Date(startDate);
+    var endTimeDate = new Date(endDate);
+    if(startTimeDate.getTime() > endTimeDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var params = {
         startDate:startDate,
         endDate:endDate
     };
+    if (startDate==null || startDate==undefined || startDate==''){
+        alert("请输入开始时间");
+        return;
+    }
+    if (endDate==null || endDate==undefined || endDate==''){
+        alert("请输入开始时间");
+        return;
+    }
     console.log(params);
     exportFile('#rrapp', '../monthly/top10ByBrandAndSupplierExport', params);
 

+ 10 - 274
kmall-admin/src/main/webapp/js/sale/top10ForProduct.js

@@ -55,7 +55,12 @@ var seriesLabel = {
 function queryMonthly(){
     var month = document.getElementById("month").value;
     var week = document.getElementById("week").value;
-
+    var startMonthDate = new Date(month);
+    var endWeekDate = new Date(week);
+    if(startMonthDate.getTime() > endWeekDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         month:month,
         week:week
@@ -69,282 +74,13 @@ function queryMonthly(){
         type: 'POST',
         success: function(data) {
             console.log(JSON.stringify(data))
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             dFun(data.productNameList, data.salesPriceList);
 
         },
     });
 
 }
-
-
-let vm = new Vue({
-    el: '#rrapp',
-    data: {
-        date: '',
-        refreshTime: 10,
-        type: 'store',
-        refreshCount:0,
-
-        storeId: '',
-        merchSn: '',
-        merchName: '',
-        storeName: '',
-        salesDate: '',
-        totalSales: '',
-        actualSales: '',
-        preferentialLoss: '',
-        totalCost: '',
-        grossProfit: '',
-        grossProfitRatio: '',
-        proportion: '',
-        guestNumber: '',
-        guestUnitPrice: '',
-        lastSalesTime: '',
-        categoryId: '',
-        categoryName: '',
-
-        showList: false,
-        compareDate: '',//比较日期
-        storeId2: '',
-        merchSn2: '',
-        merchName2: '',
-        storeName2: '',
-        salesDate2: '',
-        totalSales2: '',
-        actualSales2: '',
-        preferentialLoss2: '',
-        totalCost2: '',
-        grossProfit2: '',
-        grossProfitRatio2: '',
-        proportion2: '',
-        guestNumber2: '',
-        guestUnitPrice2: '',
-        lastSalesTime2: '',
-        intervalId: 0,
-        isCompare: false,
-        compare2: '',
-
-
-        temp: {
-            date: '',
-            refreshTime: 10,
-            type: '',
-            storeId: '',
-            merchSn: '',
-            salesDate: '',
-            categoryId: ''
-        },
-
-
-        rateList: [
-            {
-                id: '0',
-                name: '含税'
-            },
-            {
-                id: '1',
-                name: '不含税'
-
-            }
-        ],
-        projectList: [
-            {
-                id: '0',
-                name: '销售总额'
-            },
-            {
-                id: '1',
-                name: '客单价'
-
-            }
-        ],
-        seriesTypeList: [
-            {
-                id: 'bar',
-                name: '垂直柱状图'
-            },
-            {
-                id: 'line',
-                name: '折线图'
-
-            },
-            {
-                id: 'pie',
-                name: '饼图'
-
-            }
-        ],
-        formatsList: [
-            {
-                id: '0',
-                name: '<全部>'
-            },
-            {
-                id: '1',
-                name: '<非全部>'
-
-            }
-        ],
-        salesList: [
-            {
-                store: {storeId: '11106', storeName: '前海店'},
-                totalSales: 43046.18,
-                actualSales: 35593.46
-            }
-        ],
-        dept: {
-            deptId: '',
-            deptName: ''
-        },
-        category: {
-            categoryId: '',
-            categoryName: ''
-        },
-        seriesList: [], //保存饼图数据
-        seriesList2: [],
-        xAxisList: {    //主要用于保存 启动刷新时的条件和数据
-            storeId: '',
-            storeName: '',
-            merchSn: '',
-            merchName: '',
-            totalSales: '',
-            actualSales: '',
-            preferentialLoss: '',
-            totalCost: '',
-            grossProfit: '',
-            grossProfitRatio: '',
-            proportion: '',
-            guestNumber: '',
-            guestUnitPrice: '',
-            lastSalesTime: '',
-
-            salesDate: '0',
-            projectSelect: '0',
-            type:''
-        },
-        dataList: [],
-        tooltip: {},
-        today:''
-    },
-    created() {
-        this.rateSelect = this.rateList[0].id;
-        this.projectSelect = this.projectList[0].id;
-        this.seriesTypeSelect = this.seriesTypeList[0].id;
-        this.formatsSelect = this.formatsList[0].id;
-    },
-    methods: {
-
-        seriesTypeSwitch: function () {
-            console.log(vm.seriesTypeSelect);
-        },
-        showEcharts: function () {
-            // 基于准备好的dom,初始化echarts实例
-            myChart = echarts.init(document.getElementById('main'));
-            myChart.clear();
-            //加载动画
-            myChart.showLoading();
-
-
-            //项目下拉框判断       6-19,饼图设置 vm.xAxisList
-            var temp = '';
-            if (vm.xAxisList.projectSelect == '0') {
-                if (vm.xAxisList.type == 'dept') {
-                    temp = '[' + vm.xAxisList.merchSn + ']' + vm.xAxisList.merchName + '/销售总额:' + vm.xAxisList.totalSales + '元(' + vm.xAxisList.salesDate + ')';
-                } else {
-                    temp = '[' + vm.xAxisList.storeId + ']' + vm.xAxisList.storeName + '/销售总额:' + vm.xAxisList.totalSales + '元(' + vm.xAxisList.salesDate + ')';
-                }
-                vm.seriesList2.push(vm.xAxisList.totalSales);
-                vm.seriesList.push({value: vm.xAxisList.totalSales, name: temp});
-
-            } else if (vm.xAxisList.projectSelect == '1') {
-                if (vm.xAxisList.type == 'dept') {
-                    temp = '[' + vm.xAxisList.merchSn + ']' + vm.xAxisList.merchName + '/客单价:' + vm.xAxisList.guestUnitPrice + '元(' + vm.xAxisList.salesDate + ')';
-                } else {
-                    temp = '[' + vm.xAxisList.storeId + ']' + vm.xAxisList.storeName + '/客单价:' + vm.xAxisList.guestUnitPrice + '元(' + vm.xAxisList.salesDate + ')';
-                }
-                vm.seriesList2.push(vm.xAxisList.guestUnitPrice);
-                vm.seriesList.push({value: vm.xAxisList.guestUnitPrice, name: temp});
-
-            }
-
-            vm.dataList = [temp];
-
-            if (vm.seriesTypeSelect == "pie") {
-                vm.seriesList2 = vm.seriesList.concat();
-            }
-
-            // console.log('vm.seriesList2');
-            // console.log(vm.seriesList2);
-
-            // 指定图表的配置项和数据
-            //销售量
-            var option = {
-                title: {
-                    // textAlign: 'right',
-                    text: 'Monthly Customers & Avg Basket',
-                    x: 'center',
-                    textStyle: {
-                        //文字颜色
-                        color: '#17233d',
-                        //字体风格,'normal','italic','oblique'
-                        fontStyle: 'normal',
-                        //字体粗细 'normal','bold','bolder','lighter',100 | 200 | 300 | 400...
-                        fontWeight: 'bold',
-                        //字体系列
-                        fontFamily: 'sans-serif',
-                        //字体大小
-                        fontSize: 28
-                    }
-                },
-                tooltip: {
-                    formatter: function (params) {
-                        return params.name;
-                    }
-                },
-                legend: {
-                    data: ['/销售总额']
-                },
-                xAxis: {
-                    data: vm.dataList,
-                    axisLabel: {
-                        interval: 0
-                    }
-                },
-                yAxis: {},
-                series: [{
-                    barMaxWidth: '20%',
-                    barWidth: '50%',
-                    radius: '55%',
-                    roseType: 'angle',
-                    type: vm.seriesTypeSelect,
-                    color: ['#dd6b66', '#759aa0'],
-                    data: vm.seriesList2
-                }]
-            };
-
-            //隐藏
-            myChart.hideLoading();
-            // 使用刚指定的配置项和数据显示图表。
-            myChart.setOption(option);
-
-        },
-        tooltipFormatter: function () {
-            if (vm.type == 'dept') {
-                return '[' + vm.merchSn + ']' + vm.merchName + '/销售总额:' + vm.totalSales + '元(' + vm.salesDate + ')';
-            }
-            return '[' + vm.storeId + ']' + vm.storeName + '/销售总额:' + vm.totalSales + '元(' + vm.salesDate + ')';
-        },
-        showTable: function (postParam) {
-
-            console.log(postParam);
-
-            $("#jqGrid").jqGrid('setGridParam', {
-                postData: postParam
-
-            }).trigger("reloadGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
-        },
-        switchProjectView: function () {
-            console.log(vm.projectSelect);
-        }
-    }
-});

+ 24 - 2
kmall-admin/src/main/webapp/js/sale/wechatFollowersGrowth.js

@@ -83,7 +83,12 @@ function weChatFun(dateList, wechatFollowersList) {
 function queryMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         startMonth:startMonth,
         endMonth:endMonth
@@ -97,6 +102,10 @@ function queryMonthly(){
         type: 'POST',
         success: function(data) {
             console.log(data)
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             weChatFun(data.dateList, data.wechatFollowersList);
 
         },
@@ -128,11 +137,24 @@ function addWechatFollowers(){
 function exportMonthly(){
     var startMonth = document.getElementById("startMonth").value;
     var endMonth = document.getElementById("endMonth").value;
-
+    var startMonthDate = new Date(startMonth);
+    var endMonthDate = new Date(endMonth);
+    if(startMonthDate.getTime() > endMonthDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var params = {
         startMonth:startMonth,
         endMonth:endMonth
     };
+    if (startMonth==null || startMonth==undefined || startMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
+    if (endMonth==null || endMonth==undefined || endMonth==''){
+        alert("请输入开始时间");
+        return;
+    }
     console.log(params);
     exportFile('#rrapp', '../monthly/wechatFollowersGrowthExport', params);
 

+ 50 - 33
kmall-admin/src/main/webapp/js/sale/weeklySalesSummary.js

@@ -1,36 +1,36 @@
 $(function () {
-    var data = {
-        "echatX": [
-            "2019-07-02",
-            "2019-07-03",
-            "2019-07-04",
-            "2019-07-05",
-            "2019-07-06",
-            "2019-07-07",
-            "2019-07-08",
-            "2019-07-09",
-            "2019-07-10",
-            "2019-07-11",
-            "2019-07-12",
-            "2019-07-13",
-            "2019-07-14",
-            "2019-07-15"
-        ],
-        "echatY": [
-            501,210,123,333,445,157,151,369,101,101,350,435,153,100
-        ],
-        "echatY2": [
-            80,40,13,36,57,77,41,39,61,31,60,73,33,50
-        ],
-        "echatY3": [
-            5091,2210,1233,3133,4415,1517,1511,3619,1101,1011,3510,4315,1513,1100
-        ],
-        "echatY4": [
-            501,210,123,333,445,157,151,369,101,101,350,435,153,100
-        ],
-        "peopleTotal":15,"peopleOnline":4,"peopleOutline":12,"ranges":[]
-    };
-    dFun(data.echatX, data.echatY, data.echatY2,data.echatY3,data.echatY4);
+    // var data = {
+    //     "echatX": [
+    //         "2019-07-02",
+    //         "2019-07-03",
+    //         "2019-07-04",
+    //         "2019-07-05",
+    //         "2019-07-06",
+    //         "2019-07-07",
+    //         "2019-07-08",
+    //         "2019-07-09",
+    //         "2019-07-10",
+    //         "2019-07-11",
+    //         "2019-07-12",
+    //         "2019-07-13",
+    //         "2019-07-14",
+    //         "2019-07-15"
+    //     ],
+    //     "echatY": [
+    //         501,210,123,333,445,157,151,369,101,101,350,435,153,100
+    //     ],
+    //     "echatY2": [
+    //         80,40,13,36,57,77,41,39,61,31,60,73,33,50
+    //     ],
+    //     "echatY3": [
+    //         5091,2210,1233,3133,4415,1517,1511,3619,1101,1011,3510,4315,1513,1100
+    //     ],
+    //     "echatY4": [
+    //         501,210,123,333,445,157,151,369,101,101,350,435,153,100
+    //     ],
+    //     "peopleTotal":15,"peopleOnline":4,"peopleOutline":12,"ranges":[]
+    // };
+    // dFun(data.echatX, data.echatY, data.echatY2,data.echatY3,data.echatY4);
 
 
 });
@@ -157,7 +157,12 @@ function dFun(dateList, totalNumberList, totalSalesList) {
 function queryWeekly(){
     var startWeek = document.getElementById("startWeek").value;
     var endWeek = document.getElementById("endWeek").value;
-
+    var startWeekDate = new Date(startWeek);
+    var endWeekDate = new Date(endWeek);
+    if(startWeekDate.getTime() > endWeekDate.getTime()){
+        alert("开始时间不能大于结束时间");
+        return;
+    }
     var param = {
         startWeek:startWeek,
         endWeek:endWeek
@@ -170,6 +175,10 @@ function queryWeekly(){
         contentType:"application/x-www-form-urlencoded",
         type: 'POST',
         success: function(data) {
+            if (data.code =='500'){
+                alert(data.msg);
+                return;
+            }
             dFun(data.dateList, data.totalNumberList, data.totalSalesList);
 
         },
@@ -186,6 +195,14 @@ function exportWeekly(){
         startWeek:startWeek,
         endWeek:endWeek
     };
+    if (startWeek==null || startWeek==undefined || startWeek==''){
+        alert("请输入开始时间");
+        return;
+    }
+    if (endWeek==null || endWeek==undefined || endWeek==''){
+        alert("请输入开始时间");
+        return;
+    }
     console.log(params);
     exportFile('#rrapp', '../monthly/weeklySalesSummaryExport', params);