Jelajahi Sumber

供应链修改

yumeng 2 tahun lalu
induk
melakukan
951cc675db

+ 13 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -177,7 +177,8 @@ public class SupplyChainController extends BaseController {
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
             @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
             @ApiParam("排序字段") @RequestParam(value = "fieId", required = false) String fieId,
-            @ApiParam("排序方式") @RequestParam(value = "sort", required = false) String sort
+            @ApiParam("排序方式") @RequestParam(value = "sort", required = false) String sort,
+            @ApiParam("用户ID") @RequestParam(value = "userId", required = false) String userId
 
     ) {
         Map<String, Object> requestMap = new HashMap<>();
@@ -195,6 +196,9 @@ public class SupplyChainController extends BaseController {
         if (!Check.isNull(itemTitle)) {
             requestMap.put("itemTitle", itemTitle);
         }
+        if (!Check.isNull(userId)) {
+            requestMap.put("userId", userId);
+        }
 
         requestMap.put("fieId", fieId);
         requestMap.put("sort", sort);
@@ -736,15 +740,21 @@ public class SupplyChainController extends BaseController {
         if (!Check.isNull(requestJson.getString("itemTitle"))) {
             requestMap.put("itemTitle", requestJson.getString("itemTitle"));
         }
+        if (!Check.isNull(requestJson.getLong("userId"))) {
+            requestMap.put("userId", requestJson.getLong("userId"));
+        }
+
         List<JSONObject> list = supplyChainService.exportOrder(requestMap);
         List<List<Object>> exportList = new ArrayList<>();
         if (!Check.isNull(list)) {
             for (int i = 0; i < list.size(); i++) {
                 JSONObject date = list.get(i);
                 List<Object> export = new ArrayList();
+                export.add(date.getString("userName"));
                 export.add(date.getLong("itemId"));
                 export.add(date.getString("itemTitle"));
                 export.add(date.getString("imageUrl"));
+                export.add(date.getString("itemCommissionRate"));
                 export.add(date.getLong("promoterId"));
                 export.add(date.getString("promoterNickName"));
                 export.add(date.getInteger("orderNum"));
@@ -752,10 +762,11 @@ public class SupplyChainController extends BaseController {
                 export.add(date.getString("validRadio"));
                 export.add(date.getString("deliveryNum"));
                 export.add(date.getString("deliveryRadio"));
+                export.add(date.getString("notDeliveryNum"));
                 exportList.add(export);
             }
         }
-        String[] headers = {"商品ID", "商品名称", "商品封面", "达人ID", "达人名称", "订单数", "有效订单数", "有效订单率", "发货数", "发货率"};
+        String[] headers = {"所属人","商品ID", "商品名称", "商品封面", "佣金率","达人ID", "达人名称", "订单数", "有效订单数", "有效订单率", "发货数", "发货率","未发货数"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();

+ 63 - 45
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -121,22 +121,24 @@
     </select>
     <select id="itemList" resultType="com.alibaba.fastjson.JSONObject">
         select *
-        from (
-        select
-        item_id as 'itemId',
-        reserve_price as 'reservePrice',
-        item_title as 'itemTitle',
-        image_url as 'imageUrl',
-        count(oid) as 'orderNum',
-        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
-        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid),4) as 'validRadio',
-        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
-        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
-        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
-        then 1 else 0 end),4) as 'deliveryRadio',
-        item_commission_rate as 'itemCommissionRate'
-        from kuaishou_supply_chain
-        where 1= 1
+        from (select t2.user_id as 'userId',
+        t2.user_name as 'userName',
+        t1.item_id as 'itemId',
+        t1.reserve_price as 'reservePrice',
+        t1.item_title as 'itemTitle',
+        t1.image_url as 'imageUrl',
+        count(t1.oid) as 'orderNum',
+        sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid), 4) as 'validRadio',
+        sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) / sum(case when
+        t1.order_status != 80 then 1 else 0 end), 4) as 'deliveryRadio',
+        t1.item_commission_rate as 'itemCommissionRate'
+        from kuaishou_supply_chain t1
+        left join kuaishou_item_bind_user t2
+        on t1.item_id = t2.item_id
+        where 1 = 1
         <if test="start != null and start != ''">
             and order_create_time &gt;= #{start}
         </if>
@@ -149,7 +151,11 @@
         <if test="itemTitle != null and itemTitle != ''">
             and item_title like concat(concat('%',#{itemTitle}),'%')
         </if>
-        group by item_id) t
+        group by t1.item_id) t
+        where 1 = 1
+        <if test="userId != null and userId != ''">
+            and t.userId = #{userId}
+        </if>
         order by ${fieId} ${sort}
     </select>
 
@@ -225,7 +231,8 @@
         regimental_promotion_rate as 'regimentalPromotionRate',
         sum(case when order_status != 80 then pay_amount else 0 end) as 'payAmount',
         sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
-        sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount',
+        sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
+        'totalRegimentalSettleAmount',
         item_commission_rate as 'itemCommissionRate'
         from kuaishou_supply_chain
         where 1= 1
@@ -289,7 +296,8 @@
         sum(order_amount) as 'orderAmount',
         sum(base_amount) as 'baseAmount',
         sum(case when order_status != 80 then regimental_promotion_amount else 0 end) as 'regimentalPromotionAmount',
-        sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount'
+        sum(case when order_status != 80 then total_regimental_settle_amount else 0 end) as
+        'totalRegimentalSettleAmount'
         from kuaishou_supply_chain
         where 1= 1
         <if test="start != null and start != ''">
@@ -540,42 +548,50 @@
     </select>
     <select id="exportOrder" resultType="com.alibaba.fastjson.JSONObject">
         select *
-        from (
-        select
-        item_id as 'itemId',
-        item_title as 'itemTitle',
-        image_url as 'imageUrl',
-        promoter_id as 'promoterId',
-        promoter_nick_name as 'promoterNickName',
-        count(oid) as 'orderNum',
-        sum(case when order_status != 80 then 1 else 0 end) as 'validOrderNUm',
-        round(sum(case when order_status != 80 then 1 else 0 end) / count(oid) * 100,2) as 'validRadio',
-        sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) as 'deliveryNum',
-        sum(case when send_status = 0 and order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
-        round(sum(case when send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when order_status != 80
-        then 1 else 0 end) * 100,2) as 'deliveryRadio'
-        from kuaishou_supply_chain
-        where 1= 1
+        from (select
+        t2.user_id as 'userId',
+        t2.user_name as 'userName',
+        t1.item_id as 'itemId',
+        t1.item_title as 'itemTitle',
+        t1.image_url as 'imageUrl',
+        t1.promoter_id as 'promoterId',
+        t1.promoter_nick_name as 'promoterNickName',
+        count(t1.oid) as 'orderNum',
+        sum(case when t1.order_status != 80 then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when t1.order_status != 80 then 1 else 0 end) / count(t1.oid) * 100, 2) as 'validRadio',
+        sum(case when t1.send_status = 1 and t1.order_status != 80 then 1 else 0 end) as 'deliveryNum',
+        sum(case when t1.send_status = 0 and t1.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(sum(case when t1.send_status = 1 and order_status != 80 then 1 else 0 end) / sum(case when t1.order_status
+        != 80 then 1 else 0 end) * 100, 2) as 'deliveryRadio',
+        round(t1.item_commission_rate / 10,2) as 'itemCommissionRate'
+        from kuaishou_supply_chain t1
+        left join kuaishou_item_bind_user t2
+        on t1.item_id = t2.item_id
+        where 1 = 1
         <if test="start != null and start != ''">
-            and order_create_time &gt;= #{start}
+            and t1.order_create_time &gt;= #{start}
         </if>
         <if test="end != null and end != ''">
-            and order_create_time &lt;= #{end}
+            and t1.order_create_time &lt;= #{end}
         </if>
         <if test="promoterId != null and promoterId != ''">
-            and promoter_id = #{promoterId}
+            and t1.promoter_id = #{promoterId}
         </if>
         <if test="promoterNickName != null and promoterNickName != ''">
-            and promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
+            and t1.promoter_nick_name like concat(concat('%',#{promoterNickName}),'%')
         </if>
         <if test="itemId != null and itemId != ''">
-            and item_id = #{itemId}
+            and t1.item_id = #{itemId}
         </if>
         <if test="itemTitle != null and itemTitle != ''">
-            and item_title like concat(concat('%',#{itemTitle}),'%')
+            and t1.item_title like concat(concat('%',#{itemTitle}),'%')
+        </if>
+        group by t1.item_id, t1.promoter_id) t
+        where 1 = 1
+        <if test="userId != null and userId != ''">
+            and t.userId = #{userId}
         </if>
-        group by item_id,promoter_id) t
-        order by t.itemId,t.orderNum desc
+        order by t.itemId, t.orderNum desc
     </select>
     <select id="bindUserItemList" resultType="com.alibaba.fastjson.JSONObject">
         select *
@@ -649,7 +665,8 @@
         sum(case
         when t2.order_status != 80 then t2.regimental_promotion_amount
         else 0 end) as 'regimentalPromotionAmount',
-        sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount'
+        sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
+        'totalRegimentalSettleAmount'
         from kuaishou_item_bind_user t1
         left join kuaishou_supply_chain t2
         on t1.item_id = t2.item_id
@@ -737,7 +754,8 @@
         ELSE 0
         END
         ) AS 'regimentalPromotionAmount',
-        sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as 'totalRegimentalSettleAmount',
+        sum(case when t2.order_status != 80 then t2.total_regimental_settle_amount else 0 end) as
+        'totalRegimentalSettleAmount',
         t2.item_commission_rate as 'itemCommissionRate'
         FROM
         kuaishou_item_bind_user t1