Browse Source

机构分析统计

huangzhiguo 2 years ago
parent
commit
56ed1a1f9e

+ 45 - 0
src/main/java/com/caimei/modules/user/entity/ClubStatistics.java

@@ -31,6 +31,12 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
     private String yearStartTime;         //近一个年开始时间
     private String yearEndTime;           //近一个年结束时间
 
+    // 排序
+    private Integer payTotalMonthType;  //近一个月购买额类型 0正序、1倒叙
+    private Integer orderCountMonthType;    //近一个月订单数类型 0正序、1倒叙
+    private Integer payTotalYearType;   //近一年购买额类型 0正序、1倒叙
+    private Integer orderCountYearType; //近一年订单数类型 0正序、1倒叙
+    private Integer payTotalType;   //总购买额类型 0正序、1倒叙
 
     // 省
     private String provinceID;
@@ -195,6 +201,45 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
         this.yearEndTime = yearEndTime;
     }
 
+    public Integer getPayTotalMonthType() {
+        return payTotalMonthType;
+    }
+
+    public void setPayTotalMonthType(Integer payTotalMonthType) {
+        this.payTotalMonthType = payTotalMonthType;
+    }
+
+    public Integer getOrderCountMonthType() {
+        return orderCountMonthType;
+    }
+
+    public void setOrderCountMonthType(Integer orderCountMonthType) {
+        this.orderCountMonthType = orderCountMonthType;
+    }
+
+    public Integer getPayTotalYearType() {
+        return payTotalYearType;
+    }
+
+    public void setPayTotalYearType(Integer payTotalYearType) {
+        this.payTotalYearType = payTotalYearType;
+    }
+
+    public Integer getOrderCountYearType() {
+        return orderCountYearType;
+    }
+
+    public void setOrderCountYearType(Integer orderCountYearType) {
+        this.orderCountYearType = orderCountYearType;
+    }
+
+    public Integer getPayTotalType() {
+        return payTotalType;
+    }
+
+    public void setPayTotalType(Integer payTotalType) {
+        this.payTotalType = payTotalType;
+    }
 
     public String getProvinceID() {
         return provinceID;

+ 45 - 1
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -888,7 +888,51 @@
                 </if>
             </if>
         </where>
-        GROUP BY c.userID ORDER BY MAX(cor.orderTime) DESC
+        GROUP BY c.userID ORDER BY
+        <if test="payTotalMonthType == null and orderCountMonthType == null and payTotalYearType == null and orderCountYearType == null and payTotalType == null">
+            MAX(cor.orderTime) DESC
+        </if>
+        <if test="orderCountMonthType != null">
+            <if test="orderCountMonthType == 0">
+                orderMonth.orderCountMonth
+            </if>
+            <if test="orderCountMonthType == 1">
+                orderMonth.orderCountMonth DESC
+            </if>
+        </if>
+        <if test="orderCountYearType != null">
+            <if test="orderCountYearType == 0">
+                orderYesr.orderCountYesr
+            </if>
+            <if test="orderCountYearType == 1">
+                orderYesr.orderCountYesr DESC
+            </if>
+        </if>
+        <if test="payTotalMonthType != null">
+            <if test="payTotalMonthType == 0">
+                orderMonth.payTotalMonth
+            </if>
+            <if test="payTotalMonthType == 1">
+                orderMonth.payTotalMonth DESC
+            </if>
+        </if>
+
+        <if test="payTotalYearType != null">
+            <if test="payTotalYearType == 0">
+                orderYesr.payTotalYesr
+            </if>
+            <if test="payTotalYearType == 1">
+                orderYesr.payTotalYesr DESC
+            </if>
+        </if>
+        <if test="payTotalType != null">
+            <if test="payTotalType == 0">
+                orderTotal.payTotal
+            </if>
+            <if test="payTotalType == 1">
+                orderTotal.payTotal DESC
+            </if>
+        </if>
     </select>
     <select id="findExcelList" resultType="com.caimei.modules.user.entity.easyExcel">
         SELECT

+ 86 - 24
src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyStatisticsList.jsp

@@ -63,6 +63,11 @@
            class="breadcrumb form-search">
     <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
     <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
+    <input id="payTotalMonthType" name="payTotalMonthType" type="hidden" value="${statistics.payTotalMonthType}"/>
+    <input id="orderCountMonthType" name="orderCountMonthType" type="hidden" value="${statistics.orderCountMonthType}"/>
+    <input id="payTotalYearType" name="payTotalYearType" type="hidden" value="${statistics.payTotalYearType}"/>
+    <input id="orderCountYearType" name="orderCountYearType" type="hidden" value="${statistics.orderCountYearType}"/>
+    <input id="payTotalType" name="payTotalType" type="hidden" value="${statistics.payTotalType}"/>
     <div class="flex-wrap">
         <div id="items" class="flex-wrap">
             <div class="item">
@@ -162,11 +167,6 @@
                 <form:option value="4" label="大于100万"/>
             </form:select>
         </div>
-        <%--<div class="item">
-            <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询" onclick="subClick()"/>
-            <input id="export" class="btn btn-primary" type="button" value="导出"/>
-        </div>--%>
-
     </div>
 </form:form>
 <sys:message content="${message}"/>
@@ -186,37 +186,37 @@
         <th>注册时间</th>
         <th class="th-sort">
             近一个月订单数
-            <div class="sort sort-button">
-                <a href="" class="icon icon-up"></a>
-                <a href="" class="icon icon-down"></a>
+            <div class="sort sort-button" id="sort-button1">
+                <a href="${ctx}/new/user/agency/statisticsList?orderCountMonthType=0" class="icon icon-up"></a>
+                <a href="${ctx}/new/user/agency/statisticsList?orderCountMonthType=1" class="icon icon-down"></a>
             </div>
         </th>
         <th class="th-sort">
             近一个年订单数
-            <div class="sort sort-button">
-                <a href="" class="icon icon-up"></a>
-                <a href="" class="icon icon-down"></a>
+            <div class="sort sort-button" id="sort-button2">
+                <a href="${ctx}/new/user/agency/statisticsList?orderCountYearType=0" class="icon icon-up"></a>
+                <a href="${ctx}/new/user/agency/statisticsList?orderCountYearType=1" class="icon icon-down"></a>
             </div>
         </th>
         <th class="th-sort">
             近一个月购买额
-            <div class="sort sort-button">
-                <a href="" class="icon icon-up"></a>
-                <a href="" class="icon icon-down"></a>
+            <div class="sort sort-button" id="sort-button3">
+                <a href="${ctx}/new/user/agency/statisticsList?payTotalMonthType=0" class="icon icon-up"></a>
+                <a href="${ctx}/new/user/agency/statisticsList?payTotalMonthType=1" class="icon icon-down"></a>
             </div>
         </th>
         <th class="th-sort">
             近一个年购买额
-            <div class="sort sort-button">
-                <a href="" class="icon icon-up"></a>
-                <a href="" class="icon icon-down"></a>
+            <div class="sort sort-button" id="sort-button4">
+                <a href="${ctx}/new/user/agency/statisticsList?payTotalYearType=0" class="icon icon-up"></a>
+                <a href="${ctx}/new/user/agency/statisticsList?payTotalYearType=1" class="icon icon-down"></a>
             </div>
         </th>
         <th class="th-sort">
             总购买额
-            <div class="sort sort-button">
-                <a href="" class="icon icon-up"></a>
-                <a href="" class="icon icon-down"></a>
+            <div class="sort sort-button" id="sort-button5">
+                <a href="${ctx}/new/user/agency/statisticsList?payTotalType=0" class="icon icon-up"></a>
+                <a href="${ctx}/new/user/agency/statisticsList?payTotalType=1" class="icon icon-down"></a>
             </div>
         </th>
         <th>最常搜索词</th>
@@ -338,14 +338,76 @@ function subClick() {
     return;
 }
 $(function () {
+    const typeMap = {
+        1: {
+            val: $("#orderCountMonthType").val() ? $("#orderCountMonthType").val() * 1 : null,
+            dom: $('#sort-button1')
+        },
+        2: {
+            val: $("#orderCountYearType").val() ? $("#orderCountYearType").val() * 1 : null,
+            dom: $('#sort-button2')
+        },
+        3: {
+            val: $("#payTotalMonthType").val() ? $("#payTotalMonthType").val() * 1 : null,
+            dom: $('#sort-button3')
+        },
+        4: {
+            val: $("#payTotalYearType").val() ? $("#payTotalYearType").val() * 1 : null,
+            dom: $('#sort-button4')
+        },
+        5: {
+            val: $("#payTotalType").val() ? $("#payTotalType").val() * 1 : null,
+            dom: $('#sort-button5')
+        }
+    }
+    if(typeMap[1].val) {
+        // 每月订单数 1 降序  0 升序
+        if( typeMap[1].val === 1){
+            typeMap[1].dom.find('.icon-down').addClass('active');
+        }else{
+            typeMap[1].dom.find('.icon-up').addClass('active');
+        }
+    }
+    // 每年订单总数 1 降序  0 升序
+    if(typeMap[2].val) {
+        if (typeMap[2] === 1) {
+            typeMap[2].dom.find('.icon-down').addClass('active');
+        } else {
+            typeMap[2].dom.find('.icon-up').addClass('active');
+        }
+    }
+    // 每月总额 1 降序  0 升序
+    if(typeMap[3].val) {
+        if (typeMap[3] === 1) {
+            typeMap[3].dom.find('.icon-down').addClass('active');
+        } else {
+            typeMap[3].dom.find('.icon-up').addClass('active');
+        }
+    }
+    // 每年总额 1 降序  0 升序
+    if(typeMap[4].val) {
+        if (typeMap[4] === 1) {
+            typeMap[4].dom.find('.icon-down').addClass('active');
+        } else {
+            typeMap[4].dom.find('.icon-up').addClass('active');
+        }
+    }
+    // 总金额 1 降序  0 升序
+    if(typeMap[5].val) {
+        if (typeMap[5] === 1) {
+            typeMap[5].dom.find('.icon-down').addClass('active');
+        } else {
+            typeMap[5].dom.find('.icon-up').addClass('active');
+        }
+    }
     $("#export").click(function () {
         var formData = $('#searchForm').serialize()
         window.location.href= "${ctx}/new/user/agency/club/export"
     })
-    $('.sort-button .icon').click(function () {
-        $(this).addClass('active')
-        $(this).siblings('.icon').removeClass("active");
-    })
+    // $('.sort-button .icon').click(function () {
+    //     $(this).addClass('active')
+    //     $(this).siblings('.icon').removeClass("active");
+    // })
 })
 /*function reExport() {
     var formData = $('#searchForm').serialize()