Преглед изворни кода

小程序主页数据修改

hyq пре 6 година
родитељ
комит
94db0dd9e3

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/FootprintController.java

@@ -92,6 +92,7 @@ public class FootprintController {
      */
     @RequestMapping("/queryTotal")
     public R queryTotal(@RequestParam Map<String, Object> params) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
         int hitCount = footprintService.queryTotal(params);
 
         return R.ok().put("hitCount", hitCount);

+ 1 - 1
kmall-admin/src/main/java/com/kmall/admin/controller/GoodsController.java

@@ -186,7 +186,7 @@ public class GoodsController {
      */
     @RequestMapping("/queryTotal")
     public R queryTotal(@RequestParam Map<String, Object> params) {
-        ParamUtils.setQueryPowerByRoleType(params, null, "merchSn", true);
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
         params.put("isDelete", 0);
         int sum = goodsService.queryTotal(params);
         return R.ok().put("goodsSum", sum);

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/OrderController.java

@@ -546,6 +546,7 @@ public class OrderController {
      */
     @RequestMapping("/getUserOrderInfo")
     public R getUserOrderInfo(@RequestParam Map<String, Object> params) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
         int result = orderService.getUserOrderInfo(params);
 
         return R.ok().put("result", result);

+ 1 - 0
kmall-admin/src/main/java/com/kmall/admin/controller/UserController.java

@@ -112,6 +112,7 @@ public class UserController {
      */
     @RequestMapping("/queryTotal")
     public R queryTotal(@RequestParam Map<String, Object> params) {
+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false);
         int sum = userService.queryTotal(params);
 
         return R.ok().put("userSum", sum);

+ 6 - 6
kmall-admin/src/main/java/com/kmall/admin/dao/OrderDao.java

@@ -28,42 +28,42 @@ public interface OrderDao extends BaseDao<OrderEntity> {
      *
      * @return
      */
-    int getYfkOrderUserSum();
+    int getYfkOrderUserSum(Map<String, Object> map);
 
     /**
      * 有订单会员数
      *
      * @return
      */
-    int getOderUserSum();
+    int getOderUserSum(Map<String, Object> map);
 
     /**
      * 今日订单数
      *
      * @return
      */
-    int getTodayUserOrder();
+    int getTodayUserOrder(Map<String, Object> map);
 
     /**
      * 今日会员购物总额
      *
      * @return
      */
-    int getTodayUserSales();
+    int getTodayUserSales(Map<String, Object> map);
 
     /**
      * 总收入
      *
      * @return
      */
-    int getIncomeSum();
+    int getIncomeSum(Map<String, Object> map);
 
     /**
      * 已支付订单数
      *
      * @return
      */
-    int getPayedOrderCount();
+    int getPayedOrderCount(Map<String, Object> map);
 
     Double getTotalActualPrice(@Param("merchOrderSn")String merchOrderSn);
 

+ 8 - 8
kmall-admin/src/main/java/com/kmall/admin/service/impl/OrderServiceImpl.java

@@ -461,21 +461,21 @@ public class OrderServiceImpl implements OrderService {
     }
 
     @Override
-    public int getUserOrderInfo(Map<String, Object> params) {
+    public int getUserOrderInfo(Map<String, Object> map) {
         int result = 0;
-        String type = (String) params.get("type");
+        String type = (String) map.get("type");
         if ("yfkOrderUserSum".equals(type)) {
-            result = orderDao.getYfkOrderUserSum();
+            result = orderDao.getYfkOrderUserSum(map);
         } else if ("oderUserSum".equals(type)) {
-            result = orderDao.getOderUserSum();
+            result = orderDao.getOderUserSum(map);
         } else if ("todayUserOrder".equals(type)) {
-            result = orderDao.getTodayUserOrder();
+            result = orderDao.getTodayUserOrder(map);
         } else if ("todayUserSales".equals(type)) {
-            result = orderDao.getTodayUserSales();
+            result = orderDao.getTodayUserSales(map);
         } else if ("incomeSum".equals(type)) {
-            result = orderDao.getIncomeSum();
+            result = orderDao.getIncomeSum(map);
         } else if ("payedOrderCount".equals(type)) {
-            result = orderDao.getPayedOrderCount();
+            result = orderDao.getPayedOrderCount(map);
         }
         return result;
     }

+ 18 - 2
kmall-admin/src/main/resources/mybatis/mapper/GoodsDao.xml

@@ -210,12 +210,18 @@
     </select>
 
     <select id="queryTotal" resultType="int">
-        select count(*) from mall_goods WHERE 1=1
+        select count(*) from mall_goods
+        left join mall_merch m on mall_goods.merch_sn = m.merch_sn
+        left join mall_goods_group on mall_goods_group.goods_id = mall_goods.id and mall_goods_group.open_status != 3
+        WHERE 1=1
         <!--  数据过滤  -->
         ${filterSql}
         <if test="merchSn != null and merchSn.trim() != ''">
             AND mall_goods.merch_sn = #{merchSn}
         </if>
+        <if test="prodBarcode != null and prodBarcode.trim() != ''">
+            AND mall_goods.prod_barcode = #{prodBarcode}
+        </if>
         <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
             AND mall_goods.third_party_merch_code = #{thirdPartyMerchCode}
         </if>
@@ -228,9 +234,19 @@
         <if test="sku != null and sku != ''">
             AND mall_goods.sku LIKE concat('%',#{sku},'%')
         </if>
-        <if test="isDelete != null and isDelete != ''">
+        <if test="isDelete != null">
             AND mall_goods.is_Delete = #{isDelete}
         </if>
+        <if test="isOnSale != null">
+            AND mall_goods.is_on_sale = #{isOnSale}
+        </if>
+        <if test="goodsBizType != null and goodsBizType != ''">
+            AND mall_goods.goods_biz_type = #{goodsBizType}
+        </if>
+        <if test="storeId != null and storeId != ''">
+            AND mall_goods.id not in (select goods_id from mall_product_store_rela where store_id = #{storeId})
+        </if>
+
     </select>
 
     <insert id="save" parameterType="com.kmall.admin.entity.GoodsEntity" useGeneratedKeys="true" keyProperty="id">

+ 49 - 5
kmall-admin/src/main/resources/mybatis/mapper/OrderDao.xml

@@ -486,21 +486,65 @@
     </update>
 
     <select id="getYfkOrderUserSum" resultType="int">
-        select count(1) from (select user_id,count(user_id) as counts from mall_order where pay_status = 2 group by user_id) u
+        select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
+        inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
+        where pay_status = 2
+        <if test="storeId != null and storeId != ''">
+            AND o.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND o.merch_sn = #{merchSn}
+        </if>
+        group by o.user_id) u
     </select>
     <select id="getOderUserSum" resultType="int">
-        select count(1) from (select user_id,count(user_id) as counts from mall_order group by user_id) u
+        select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
+        inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
+        where 1=1
+        <if test="storeId != null and storeId != ''">
+            AND o.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND o.merch_sn = #{merchSn}
+        </if>
+        group by o.user_id) u
     </select>
     <select id="getTodayUserOrder" resultType="int">
-        select count(1) from mall_order where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
+        select count(1) from mall_order o where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
+        <if test="storeId != null and storeId != ''">
+            AND o.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND o.merch_sn = #{merchSn}
+        </if>
+
     </select>
     <select id="getTodayUserSales" resultType="int">
-        select ifnull(sum(actual_price),0) from mall_order where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
+        select ifnull(sum(actual_price),0) from mall_order o where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
+        <if test="storeId != null and storeId != ''">
+            AND o.store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND o.merch_sn = #{merchSn}
+        </if>
+
     </select>
     <select id="getIncomeSum" resultType="int">
         select ifnull(sum(actual_price),0) from mall_order where pay_status = 2
+        <if test="storeId != null and storeId != ''">
+            AND store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND merch_sn = #{merchSn}
+        </if>
     </select>
     <select id="getPayedOrderCount" resultType="int">
-        select count(1) from mall_order where pay_status = 2
+        select count(1) from mall_order where pay_status = 2 and is_onffline_order = 0
+        <if test="storeId != null and storeId != ''">
+            AND store_id = #{storeId}
+        </if>
+        <if test="merchSn != null and merchSn.trim() != ''">
+            AND merch_sn = #{merchSn}
+        </if>
     </select>
 </mapper>

+ 11 - 11
kmall-admin/src/main/webapp/WEB-INF/page/sys/main.html

@@ -115,11 +115,11 @@
             <th colspan="5">会员购买率:<span style="color: red;">{{hygml}}%</span>(会员购买率=已付款订单会员数÷会员总数)</th>
         </tr>
         <tr style='text-align: center;'>
-            <th>会员总数</th>
-            <th>已付款订单会员数</th>
-            <th>有订单会员数</th>
-            <th>今日订单数</th>
-            <th>今日会员购物总额</th>
+            <th style="text-align: center;">会员总数</th>
+            <th style="text-align: center;">已付款订单会员数</th>
+            <th style="text-align: center;">有订单会员数</th>
+            <th style="text-align: center;">今日订单数</th>
+            <th style="text-align: center;">今日会员购物总额</th>
         </tr>
         <tr style='text-align: center;'>
             <td>{{userSum}}</td>
@@ -132,12 +132,12 @@
 
     <table class="table table-hover table-responsive table-bordered">
         <tr>
-            <th colspan="3">每会员平均订单数及购物额(每会员平均订单数=有订单会员数÷会员总数)</th>
+            <th colspan="3">每会员平均订单数及购物额</th>
         </tr>
         <tr style='text-align: center;'>
-            <th>总收入</th>
-            <th>每会员订单数</th>
-            <th>每会员购物数</th>
+            <th style="text-align: center;">总收入</th>
+            <th style="text-align: center;">每会员平均订单数(有订单会员数÷会员总数)</th>
+            <th style="text-align: center;">每会员平均购物数(已支付订单数量÷有订单会员数)</th>
         </tr>
         <tr style='text-align: center;'>
             <td>{{incomeSum}}</td>
@@ -329,8 +329,8 @@
         updated: function () {
             let vue = this;
             vue.hygml = (vue.yfkOrderUserSum / vue.userSum * 100).toFixed(4);
-            vue.mhydds = (vue.oderUserSum / vue.userSum).toFixed(4);
-            vue.mhygws = (vue.payedOrderCount / vue.oderUserSum).toFixed(4);
+            vue.mhydds = (vue.oderUserSum / vue.userSum).toFixed(2);
+            vue.mhygws = (vue.payedOrderCount / vue.oderUserSum).toFixed(2);
             vue.average1000 = (vue.orderSum / vue.hitCount * 1000).toFixed(4);
             vue.averageSales1000 = (vue.incomeSum / vue.hitCount * 1000).toFixed(4);
         }