xwh 4 éve
szülő
commit
137e1a8df5

+ 35 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/statistics/MonthlyCustomersController.java

@@ -400,5 +400,40 @@ public class MonthlyCustomersController {
         return R.ok("添加成功");
     }
 
+    @RequestMapping("/wechatFollowersGrowthExport")
+    public R wechatFollowersGrowthExport(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", "thirdPartyMerchCode");
+        if (Objects.isNull(params.get("startMonth"))  || "".equals(params.get("startMonth"))){
+            return R.error("请先选择开始时间");
+        }
+        if (Objects.isNull(params.get("endMonth"))  || "".equals(params.get("endMonth"))){
+            return R.error("请先选择结束时间");
+        }
+        String merchSn = null;
+        SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
+        if(!"1".equals(sysUser.getRoleType())){
+            merchSn = sysUser.getMerchSn();
+        }
+        List<WechatFollowersEntity> wechatFollowersEntities = wechatFollowersDao.queryMonthlyWechatFollowers((String) params.get("startMonth"), (String) params.get("endMonth"), merchSn);
+        ExcelExport ee = new ExcelExport("Wechat Followers Growth");
+        String[] header = new String[]{"序号","商户编号","好友数量","年-月"};
+        List<Map<String, Object>> list = new ArrayList<>();
+        int count = 1;
+        if (wechatFollowersEntities!=null && wechatFollowersEntities.size()>0) {
+            for (WechatFollowersEntity wechatFollowersEntity : wechatFollowersEntities) {
+                LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+                map.put("OrderNumber",count++);
+                map.put("MerchSn",wechatFollowersEntity.getMerchSn());
+                map.put("WechatFollowers",wechatFollowersEntity.getWechatFollowers());
+                map.put("YearAndMonth",wechatFollowersEntity.getYearAndMonth());
+                list.add(map);
+            }
+        }
+        ee.addSheetByMap("Wechat Followers Growth", list, header);
+        ee.export(response);
+        return R.ok();
+    }
+
+
 
 }

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/GoodsEntity.java

@@ -220,6 +220,16 @@ public class GoodsEntity implements Serializable {
     // 日常价
     private BigDecimal dailyPrice;
 
+    // 最后销售时间
+    private Date lastSaleTime;
+
+    public Date getLastSaleTime() {
+        return lastSaleTime;
+    }
+
+    public void setLastSaleTime(Date lastSaleTime) {
+        this.lastSaleTime = lastSaleTime;
+    }
 
     public String getOriCntName() {
         return oriCntName;

+ 10 - 0
kmall-admin/src/main/java/com/kmall/admin/entity/ProductStoreRelaEntity.java

@@ -139,6 +139,16 @@ public class ProductStoreRelaEntity implements Serializable {
     private String bottomLinePrice;
     //园区库存  park_stock
     private String parkStock;
+    // 最后销售时间
+    private Date lastSaleTime;
+
+    public Date getLastSaleTime() {
+        return lastSaleTime;
+    }
+
+    public void setLastSaleTime(Date lastSaleTime) {
+        this.lastSaleTime = lastSaleTime;
+    }
 
     public String getBrandName() {
         return brandName;

+ 1 - 0
kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml

@@ -70,6 +70,7 @@
 
         <result column="cost_price" property="costPrice"/>
         <result property="dailyPrice" column="daily_price"/>
+        <result column="last_sale_time" property="lastSaleTime" jdbcType="TIMESTAMP"/>
     </resultMap>
 
     <select id="queryObject" resultType="com.kmall.admin.entity.GoodsEntity">

+ 1 - 0
kmall-admin/src/main/resources/mybatis/mapper/statistics/WechatFollowersDao.xml

@@ -65,6 +65,7 @@
 	</select>
 	<select id="queryMonthlyWechatFollowers" resultType="com.kmall.admin.entity.WechatFollowersEntity">
 		SELECT
+		merch_sn,
 		sum(mwf.wechat_followers) wechatFollowers,
 		DATE_FORMAT(mwf.create_time,'%Y-%m') as yearAndMonth
 		FROM

+ 1 - 0
kmall-admin/src/main/webapp/WEB-INF/page/sale/top10ByBrandAndSupplier.html

@@ -49,6 +49,7 @@
             <input type="date" name="startDate" id="startDate"/>&nbsp;
             <input type="date" name="endDate" id="endDate" />&nbsp;
                 <input type="button" name="queryButton" value="查询" onclick="queryMonthly()" />
+                <input type="button" name="exportButton" value="导出" onclick="exportMonthly()" />
             </div>
         </div>
     </header>

+ 1 - 0
kmall-admin/src/main/webapp/WEB-INF/page/sale/wechatFollowersGrowth.html

@@ -45,6 +45,7 @@
             <input type="month" name="startMonth" id="startMonth"/>&nbsp;
             <input type="month" name="endMonth" id="endMonth" />&nbsp;
             <input type="button" name="queryButton" value="查询" onclick="queryMonthly()" />
+            <input type="button" name="exportButton" value="导出" onclick="exportMonthly()" />
         </div>
     </div>
 </header>

+ 10 - 278
kmall-admin/src/main/webapp/js/sale/top10ByBrandAndSupplier.js

@@ -49,283 +49,15 @@ function createLi(title,sales,ulId,flag){
 
 }
 
-// var li=document.createElement("li");
-// var span_1=document.createElement("span");
-// li.innerHTML = title;
-// span_1.setAttribute("class","spanClass")
-// var span_2=document.createElement("span");
-// span_2.innerHTML = sales;
-// span_2.setAttribute("class","spanClass")
-// li.appendChild(span_1);
-// li.appendChild(span_2);
-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);
+function exportMonthly(){
+    var startDate = document.getElementById("startDate").value;
+    var endDate = document.getElementById("endDate").value;
 
-            $("#jqGrid").jqGrid('setGridParam', {
-                postData: postParam
+    var params = {
+        startDate:startDate,
+        endDate:endDate
+    };
+    console.log(params);
+    exportFile('#rrapp', '../monthly/monthlySalesGrowthExport', params);
 
-            }).trigger("reloadGrid").closest(".ui-jqgrid-bdiv").css({"overflow-x": "scroll"});
-        },
-        switchProjectView: function () {
-            console.log(vm.projectSelect);
-        }
-    }
-});
+}

+ 15 - 0
kmall-admin/src/main/webapp/js/sale/wechatFollowersGrowth.js

@@ -123,3 +123,18 @@ function addWechatFollowers(){
     });
 
 }
+
+
+function exportMonthly(){
+    var startMonth = document.getElementById("startMonth").value;
+    var endMonth = document.getElementById("endMonth").value;
+
+    var params = {
+        startMonth:startMonth,
+        endMonth:endMonth
+    };
+    console.log(params);
+    exportFile('#rrapp', '../monthly/wechatFollowersGrowthExport', params);
+
+}
+