Просмотр исходного кода

中台数据统计信息错误修正

zhangchen 3 месяцев назад
Родитель
Сommit
c3e7593966

+ 23 - 94
alien-entity/src/main/resources/mapper/ManagementInfoMapper.xml

@@ -277,15 +277,9 @@
             ( `status` = 1
             <if test="dataTime != null and dataTime != ''">
                 AND
-                used_time > #{dataTime}
-            </if>
-             )
-           OR ( `status` = 0
-            <if test="dataTime != null and dataTime != ''">
-                AND
                 buy_time > #{dataTime}
             </if>
-               )
+             )
     </select>
     <select id="getTradingVolume" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
         SELECT
@@ -706,7 +700,7 @@
         FROM
             life_user_order
         WHERE
-            `status` = 4
+            `status` = 5
             <if test="dataTime != null and dataTime != ''">
                 AND refund_time > #{dataTime}
             </if>
@@ -717,39 +711,10 @@
         FROM
             life_user_order `order`
         WHERE
-            1 = 1
-            AND (
-            (`order`.`status` = 0
-                <if test="dataTime != null and dataTime != ''">
-                         AND pay_time > #{dataTime}
-                </if>
-            )
-            OR (`order`.`status` = 1
-                <if test="dataTime != null and dataTime != ''">
-                        AND used_time > #{dataTime}
-                </if>
-            )
-            OR (`order`.`status` = 4
-                <if test="dataTime != null and dataTime != ''">
-                        AND refund_time > #{dataTime}
-                </if>
-            )
-            OR (`order`.`status` = 3
+            delete_flag = 0
                 <if test="dataTime != null and dataTime != ''">
-                        AND refund_time > #{dataTime}
+                         AND buy_time > #{dataTime}
                 </if>
-            )
-            OR (`order`.`status` = 99
-                <if test="dataTime != null and dataTime != ''">
-                        AND `order`.created_time > #{dataTime}
-                </if>
-            )
-            OR (`order`.`status` = 98
-                <if test="dataTime != null and dataTime != ''">
-                        AND `order`.created_time > #{dataTime}
-                </if>
-            )
-        )
     </select>
     <select id="getStorePlatformOrderVolume" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
         SELECT
@@ -760,69 +725,33 @@
         ROUND(`order`.final_price, 2) AS final_price,
         CASE
         `order`.`status`
-        WHEN 0 THEN '已付款'
-        WHEN 1 THEN '已完成'
-        WHEN 4 THEN '已退款'
-        WHEN 99 THEN '待付款'
-        WHEN 98 THEN '已取消'
-        WHEN 3 THEN '待退款'
+        WHEN 0 THEN '待支付'
+        WHEN 1 THEN '已支付/待使用'
+        WHEN 2 THEN '已核销'
+        WHEN 3 THEN '已过期'
+        WHEN 4 THEN '已取消'
+        WHEN 5 THEN '已退款'
+        WHEN 6 THEN '退款失败'
+        WHEN 7 THEN '已完成'
         END AS status_name
         FROM
         life_user_order `order`
         LEFT JOIN life_coupon coupon ON `order`.quan_id = coupon.id
         <where>
             1 = 1
-            <choose>
-                <when test="orderType != null and orderType != ''">
-                    AND (`order`.`status` = #{orderType}
-                    <if test="orderType == 99">
-                        or `order`.`status` = "98"
-                    </if>
-                    )
+                <if test="orderType != null and orderType != ''">
                     <choose>
-                        <when test="orderType == 0 and startTime != null and startTime != ''">AND pay_time > #{startTime}</when>
-                        <when test="orderType == 1 and startTime != null and startTime != ''">AND used_time > #{startTime}</when>
-                        <when test="orderType == 4 and startTime != null and startTime != ''">AND refund_time > #{startTime}</when>
-                        <when test="orderType == 3 and startTime != null and startTime != ''">AND refund_time > #{startTime}</when>
-                        <when test="orderType == 98 and startTime != null and startTime != ''">AND `order`.created_time > #{startTime}</when>
-                        <when test="orderType == 99 and startTime != null and startTime != ''">AND `order`.created_time > #{startTime}</when>
+                        <when test="orderType == 2">
+                            AND (`order`.`status` = "0" or `order`.`status` = "4")
+                        </when>
+                        <otherwise>
+                            AND `order`.`status` = #{orderType}
+                        </otherwise>
                     </choose>
-                </when>
-                <otherwise>
-                    AND (
-                    (`order`.`status` = 0
-                        <if test="startTime != null and startTime != ''">
-                            AND pay_time > #{startTime}
-                        </if>
-                    )
-                    OR (`order`.`status` = 1
-                        <if test="startTime != null and startTime != ''">
-                            AND used_time > #{startTime}
-                        </if>
-                    )
-                    OR (`order`.`status` = 4
-                        <if test="startTime != null and startTime != ''">
-                            AND refund_time > #{startTime}
-                        </if>
-                    )
-                    OR (`order`.`status` = 3
-                        <if test="startTime != null and startTime != ''">
-                            AND refund_time > #{startTime}
-                        </if>
-                    )
-                    OR (`order`.`status` = 99
-                        <if test="startTime != null and startTime != ''">
-                            AND `order`.created_time > #{startTime}
-                        </if>
-                    )
-                    OR (`order`.`status` = 98
-                    <if test="startTime != null and startTime != ''">
-                        AND `order`.created_time > #{startTime}
-                    </if>
-                    )
-                )
-                </otherwise>
-            </choose>
+                </if>
+                <if test="startTime != null and startTime != ''">
+                    AND buy_time > #{startTime}
+                </if>
             <if test="orderId != null and orderId != ''">
                 AND `order`.`order_no` like concat('%',#{orderId},'%')
             </if>

+ 1 - 1
alien-store/src/main/java/shop/alien/store/controller/ManagementInfoController.java

@@ -175,7 +175,7 @@ public class ManagementInfoController {
             @ApiImplicitParam(name = "page", value = "分页序数", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "size", value = "分页长度", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "type", value = "查询类型(1:当日,2:所有)", dataType = "String", paramType = "query"),
-            @ApiImplicitParam(name = "tabType", value = "订单类型(全部订单:1,待付款:2,已付款:3,已退款:4,已完成:5)", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "tabType", value = "订单类型(全部订单:1,待付款:2,待付款/已取消:3,已退款:4,已完成:5)", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "orderId", value = "订单编号", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "entTime", value = "结束时间", dataType = "String", paramType = "query"),

+ 8 - 5
alien-store/src/main/java/shop/alien/store/service/impl/ManagementInfoServiceImpl.java

@@ -482,14 +482,17 @@ public class ManagementInfoServiceImpl implements ManagementInfoService {
         //转换一下订单类型 订单状态,0.待使用, 1.已核销, 2.已过期, 3.待退款,4.已退款,99.待付款,1:已取消
         String orderTypeQuery = "";
         if ("2".equals(orderType)) {
-            //todo 此时待付款状态还未有
-            orderTypeQuery = "99";
+            //待付款和已取消的数据
+            orderTypeQuery = "2";
         } else if ("3".equals(orderType)) {
-            orderTypeQuery = "0";
+            //已付款数据
+            orderTypeQuery = "1";
         } else if ("4".equals(orderType)) {
-            orderTypeQuery = "4";
+            // 已退款数据
+            orderTypeQuery = "5";
         } else if ("5".equals(orderType)) {
-            orderTypeQuery = "1";
+            // 已完成数据
+            orderTypeQuery = "7";
         } else if ("6".equals(orderType)) {
             orderTypeQuery = "3";
         }