Forráskód Böngészése

数据大屏功能修改

zhangchen 3 hónapja
szülő
commit
929fab698f

+ 18 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/ManagementInfoVo.java

@@ -129,4 +129,22 @@ public class ManagementInfoVo {
     private String failReason;
     @ApiModelProperty(value = "提现状态, 0:进行中, 1:成功, 2:失败,3待审核,4已拒绝,5审核通过")
     private Integer paymentStatus;
+    @ApiModelProperty(value = "完成时间")
+    private Date finishTime;
+    @ApiModelProperty(value = "取消时间")
+    private Date cancelTime;
+    @ApiModelProperty(value = "商品名称")
+    private String couponName;
+    @ApiModelProperty(value = "商品ID")
+    private String couponId;
+    @ApiModelProperty(value = "商品类型")
+    private String couponType;
+    @ApiModelProperty(value = "图片ID")
+    private String imgId;
+    @ApiModelProperty(value = "图片ID")
+    private String imgUrl;
+    @ApiModelProperty(value = "支付时间")
+    private Date payTime;
+    @ApiModelProperty(value = "订单id")
+    private Integer orderId;
 }

+ 2 - 2
alien-entity/src/main/java/shop/alien/mapper/ManagementInfoMapper.java

@@ -85,10 +85,10 @@ public interface ManagementInfoMapper {
     List<ManagementInfoVo> getSalesVolume(@Param("startTime") String startTime, @Param("endTime") String endTime);
 
     //查询平台利润详情
-    IPage<ManagementInfoVo> getStorePlatformProfitDetails(IPage<ManagementInfoVo> iPage, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") String storeId);
+    IPage<ManagementInfoVo> getStorePlatformProfitDetails(IPage<ManagementInfoVo> iPage, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("storeId") String storeId, @Param("storeName") String storeName);
 
     //查询平台订单量详情
-    IPage<ManagementInfoVo> getStorePlatformOrderVolume(IPage<ManagementInfoVo> iPage, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("orderId") String orderId, @Param("orderType") String orderType);
+    IPage<ManagementInfoVo> getStorePlatformOrderVolume(IPage<ManagementInfoVo> iPage, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("orderId") String orderId, @Param("orderType") String orderType, @Param("couponName") String couponName, @Param("couponType") String couponType, @Param("storeName") String storeName);
 
     //获取退款订单量
     ManagementInfoVo getRefundOrderQuantity(@Param("dataTime") String dataTime);

+ 36 - 14
alien-entity/src/main/resources/mapper/ManagementInfoMapper.xml

@@ -689,6 +689,9 @@
         <if test="storeId != null and storeId != ''" >
             AND store_id like concat('%',#{storeId},'%')
         </if>
+        <if test="storeName != null and storeName != ''" >
+            AND store_name like concat('%',#{storeName},'%')
+        </if>
         GROUP BY
             store.id
         ORDER BY
@@ -717,10 +720,21 @@
                 </if>
     </select>
     <select id="getStorePlatformOrderVolume" resultType="shop.alien.entity.store.vo.ManagementInfoVo">
+        with total_coupon as(
+        select id coupon_id,2 coupon_type,lgbm.group_name coupon_name, SUBSTRING_INDEX(image_id, ',', 1) AS image_id
+        from life_group_buy_main lgbm where lgbm.delete_flag = 0
+        union all
+        select id coupon_id,1 coupon_type,lc.name coupon_name, SUBSTRING_INDEX(image_path, ',', 1) AS image_id
+        from life_coupon lc where lc.delete_flag = 0
+        )
+
         SELECT
-        order_no,
-        coupon.`name` AS order_name,
+         order_no,
+        `order`.id as order_id,
         `order`.created_time AS order_time,
+        `order`.finish_time AS finish_time,
+        `order`.cancel_time AS cancel_time,
+        `order`.pay_time AS pay_time,
         `order`.buy_time AS buy_time_str,
         ROUND(`order`.final_price, 2) AS final_price,
         CASE
@@ -733,27 +747,35 @@
         WHEN 5 THEN '已退款'
         WHEN 6 THEN '退款失败'
         WHEN 7 THEN '已完成'
-        END AS status_name
+        END AS status_name,
+        simg.img_url,
+        tc.*,
+        store.store_name
         FROM
         life_user_order `order`
-        LEFT JOIN life_coupon coupon ON `order`.quan_id = coupon.id
+        left join store_info store on `order`.store_id = store.id
+        left join order_coupon_middle ocm on ocm.order_id = `order`.id and ocm.delete_flag = 0
+        inner join total_coupon tc on tc.coupon_id = ocm.coupon_id and tc.coupon_type = `order`.coupon_type
+        left join  store_img simg on simg.id = tc.image_id and simg.delete_flag = 0
         <where>
             1 = 1
                 <if test="orderType != null and orderType != ''">
-                    <choose>
-                        <when test="orderType == 2">
-                            AND (`order`.`status` = "0" or `order`.`status` = "4")
-                        </when>
-                        <otherwise>
-                            AND `order`.`status` = #{orderType}
-                        </otherwise>
-                    </choose>
+                    AND `order`.`status` = #{orderType}
                 </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 test="orderId != null and orderId != ''">
+                    AND `order`.`order_no` like concat('%',#{orderId},'%')
+                </if>
+            <if test="couponType != null and couponType != ''">
+                AND tc.coupon_type = #{couponType}
+            </if>
+            <if test="couponName != null and couponName != ''">
+                AND tc.coupon_name like concat('%',#{couponName},'%')
+            </if>
+            <if test="storeName != null and storeName != ''">
+                AND store.store_name like concat('%',#{storeName},'%')
             </if>
         </where>
         ORDER BY

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

@@ -158,14 +158,16 @@ public class ManagementInfoController {
             @ApiImplicitParam(name = "storeId", value = "商家id", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "startTime", value = "开始时间", dataType = "String", paramType = "query"),
             @ApiImplicitParam(name = "entTime", value = "结束时间", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "storeName", value = "店铺名称", dataType = "String", paramType = "query"),
     })
     public R<IPage<ManagementInfoVo>> getStorePlatformProfitDetails(@RequestParam(value = "page", defaultValue = "1") int page,
                                                                     @RequestParam(value = "size", defaultValue = "10") int size,
                                                                     @RequestParam(value = "type", required = false) String type,
                                                                     @RequestParam(value = "storeId", required = false) String storeId,
                                                                     @RequestParam(value = "startTime", required = false) String startTime,
-                                                                    @RequestParam(value = "entTime", required = false) String entTime) {
-        IPage<ManagementInfoVo> storePlatformProfitDetails = managementInfoService.getStorePlatformProfitDetails(page, size, storeId, type, startTime, entTime);
+                                                                    @RequestParam(value = "entTime", required = false) String entTime,
+                                                                    @RequestParam(value = "storeName", required = false) String storeName) {
+        IPage<ManagementInfoVo> storePlatformProfitDetails = managementInfoService.getStorePlatformProfitDetails(page, size, storeId, type, startTime, entTime, storeName);
         return R.data(storePlatformProfitDetails);
     }
 
@@ -175,10 +177,13 @@ 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 = "订单类型(全部,传空; 0,待付款;4,已取消;1,待使用;7,已完成;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"),
+            @ApiImplicitParam(name = "couponName", value = "商品名称", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "couponType", value = "商品类型", dataType = "String", paramType = "query"),
+            @ApiImplicitParam(name = "storeName", value = "店铺名称", dataType = "String", paramType = "query"),
     })
     public R<IPage<ManagementInfoVo>> getStorePlatformOrderVolume(@RequestParam(value = "page", defaultValue = "1") int page,
                                                                   @RequestParam(value = "size", defaultValue = "10") int size,
@@ -186,8 +191,11 @@ public class ManagementInfoController {
                                                                   @RequestParam(value = "tabType", required = false) String tabType,
                                                                   @RequestParam(value = "orderId", required = false) String orderId,
                                                                   @RequestParam(value = "startTime", required = false) String startTime,
-                                                                  @RequestParam(value = "entTime", required = false) String entTime) {
-        IPage<ManagementInfoVo> storePlatformProfitDetails = managementInfoService.getStorePlatformOrderVolume(page, size, orderId, type, tabType, startTime, entTime);
+                                                                  @RequestParam(value = "entTime", required = false) String entTime,
+                                                                  @RequestParam(value = "couponName", required = false) String couponName,
+                                                                  @RequestParam(value = "couponType", required = false) String couponType,
+                                                                  @RequestParam(value = "storeName", required = false) String storeName) {
+        IPage<ManagementInfoVo> storePlatformProfitDetails = managementInfoService.getStorePlatformOrderVolume(page, size, orderId, type, tabType, startTime, entTime, couponName, couponType, storeName);
         return R.data(storePlatformProfitDetails);
     }
 

+ 2 - 2
alien-store/src/main/java/shop/alien/store/service/ManagementInfoService.java

@@ -67,11 +67,11 @@ public interface ManagementInfoService {
     /**
      * 数据可视化-平台净利润(¥) 详情页面
      */
-    IPage<ManagementInfoVo> getStorePlatformProfitDetails(Integer pageNum, Integer pageSize, String storeId, String type, String startTime, String entTime);
+    IPage<ManagementInfoVo> getStorePlatformProfitDetails(Integer pageNum, Integer pageSize, String storeId, String type, String startTime, String entTime, String storeName);
 
     /**
      * 数据可视化-平台净利润(¥) 详情页面
      */
-    IPage<ManagementInfoVo> getStorePlatformOrderVolume(Integer pageNum, Integer pageSize, String orderId, String type, String orderType, String startTime, String entTime);
+    IPage<ManagementInfoVo> getStorePlatformOrderVolume(Integer pageNum, Integer pageSize, String orderId, String type, String orderType, String startTime, String entTime, String couponName, String couponType, String storeName);
 
 }

+ 21 - 19
alien-store/src/main/java/shop/alien/store/service/impl/ManagementInfoServiceImpl.java

@@ -456,7 +456,7 @@ public class ManagementInfoServiceImpl implements ManagementInfoService {
     }
 
     @Override
-    public IPage<ManagementInfoVo> getStorePlatformProfitDetails(Integer pageNum, Integer pageSize, String storeId, String type, String startTime, String entTime) {
+    public IPage<ManagementInfoVo> getStorePlatformProfitDetails(Integer pageNum, Integer pageSize, String storeId, String type, String startTime, String entTime, String storeName) {
         IPage<ManagementInfoVo> cardPage = new Page<>(pageNum, pageSize);
         IPage<ManagementInfoVo> storePlatformProfitDetails = new Page<>();
         if ("1".equals(type)) {
@@ -467,35 +467,37 @@ public class ManagementInfoServiceImpl implements ManagementInfoService {
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
             // 将当日零点时间转换为字符串
             String midnightString = todayMidnight.format(formatter);
-            storePlatformProfitDetails = managementInfoMapper.getStorePlatformProfitDetails(cardPage, midnightString, null, storeId);
+            storePlatformProfitDetails = managementInfoMapper.getStorePlatformProfitDetails(cardPage, midnightString, null, storeId, storeName);
         } else if ("2".equals(type)) {
             //如果 type 是所有
-            storePlatformProfitDetails = managementInfoMapper.getStorePlatformProfitDetails(cardPage, startTime, entTime, storeId);
+            storePlatformProfitDetails = managementInfoMapper.getStorePlatformProfitDetails(cardPage, startTime, entTime, storeId, storeName);
         }
         return storePlatformProfitDetails;
     }
 
     @Override
-    public IPage<ManagementInfoVo> getStorePlatformOrderVolume(Integer pageNum, Integer pageSize, String orderId, String type, String orderType, String startTime, String entTime) {
+    public IPage<ManagementInfoVo> getStorePlatformOrderVolume(Integer pageNum, Integer pageSize, String orderId, String type, String orderType, String startTime, String entTime, String couponName, String couponType, String storeName) {
         IPage<ManagementInfoVo> cardPage = new Page<>(pageNum, pageSize);
         IPage<ManagementInfoVo> storePlatformProfitDetails = new Page<>();
-        //转换一下订单类型 订单状态,0.待使用, 1.已核销, 2.已过期, 3.待退款,4.已退款,99.待付款,1:已取消
+
         String orderTypeQuery = "";
-        if ("2".equals(orderType)) {
-            //待付款和已取消的数据
-            orderTypeQuery = "2";
-        } else if ("3".equals(orderType)) {
-            //已付款数据
-            orderTypeQuery = "1";
+        if ("0".equals(orderType)) {
+            //待付款
+            orderTypeQuery = "0";
         } else if ("4".equals(orderType)) {
-            // 已退款数据
-            orderTypeQuery = "5";
-        } else if ("5".equals(orderType)) {
-            // 已完成数据
+            //已取消
+            orderTypeQuery = "4";
+        } else if ("1".equals(orderType)) {
+            // 待使用
+            orderTypeQuery = "1";
+        } else if ("7".equals(orderType)) {
+            // 已完成
             orderTypeQuery = "7";
-        } else if ("6".equals(orderType)) {
-            orderTypeQuery = "3";
+        } else if ("5".equals(orderType)) {
+            // 已退款
+            orderTypeQuery = "5";
         }
+
         if ("3".equals(type) || "5".equals(type)) {
             //如果 type 是 当日
             // 获取当日零点时间
@@ -504,10 +506,10 @@ public class ManagementInfoServiceImpl implements ManagementInfoService {
             DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
             // 将当日零点时间转换为字符串
             String midnightString = todayMidnight.format(formatter);
-            storePlatformProfitDetails = managementInfoMapper.getStorePlatformOrderVolume(cardPage, midnightString, null, orderId, orderTypeQuery);
+            storePlatformProfitDetails = managementInfoMapper.getStorePlatformOrderVolume(cardPage, midnightString, null, orderId, orderTypeQuery, couponName, couponType, storeName);
         } else if ("4".equals(type) || "6".equals(type)) {
             //如果 type 是所有
-            storePlatformProfitDetails = managementInfoMapper.getStorePlatformOrderVolume(cardPage, startTime, entTime, orderId, orderTypeQuery);
+            storePlatformProfitDetails = managementInfoMapper.getStorePlatformOrderVolume(cardPage, startTime, entTime, orderId, orderTypeQuery, couponName, couponType, storeName);
         }
         return storePlatformProfitDetails;
     }