yumeng пре 2 година
родитељ
комит
ee2f407bd2

+ 26 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -766,7 +766,7 @@ public class SupplyChainController extends BaseController {
                 exportList.add(export);
             }
         }
-        String[] headers = {"所属人","商品ID", "商品名称", "商品封面", "佣金率","达人ID", "达人名称", "订单数", "有效订单数", "有效订单率", "发货数", "发货率","未发货数"};
+        String[] headers = {"所属人", "商品ID", "商品名称", "商品封面", "佣金率", "达人ID", "达人名称", "订单数", "有效订单数", "有效订单率", "发货数", "发货率", "未发货数"};
         OutputStream os = response.getOutputStream();
         ExportExcelUtils eeu = new ExportExcelUtils();
         XSSFWorkbook workbook = new XSSFWorkbook();
@@ -1012,8 +1012,33 @@ public class SupplyChainController extends BaseController {
     }
 
 
+    @GetMapping("/userItemTotal")
+    @ApiOperation(value = "认领商品列表汇总")
+    public JSONObject userItemTotal(
+            @ApiParam("userId") @RequestParam(value = "userId", required = false) Long userId,
+            @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate
+    ) {
+        Map<String, Object> requestMap = new HashMap<>();
+        if (!Check.isNull(userId)) {
+            requestMap.put("userId", userId);
+        }
+        if (!Check.isNull(orderStartDate)) {
+            Long start = DateUtils.getStartLongTime(orderStartDate);
+            requestMap.put("start", start);
+        }
+        if (!Check.isNull(orderEndDate)) {
+            Long end = DateUtils.getEndLongTime(orderEndDate);
+            requestMap.put("end", end);
+        }
+        JSONObject returnJson = supplyChainService.userItemTotal(requestMap);
+        return returnJson;
+    }
+
+
     /**
      * 商品认领汇总
+     *
      * @return
      */
     @GetMapping("/itemBindSummary")

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/SupplyChainMapper.java

@@ -66,4 +66,6 @@ public interface SupplyChainMapper {
     List<JSONObject> indexStatistics(Map<String, Object> requestMap);
 
     JSONObject itemBindSummary();
+
+    JSONObject userItemTotal(Map<String, Object> requestMap);
 }

+ 3 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/ISupplyChainService.java

@@ -89,4 +89,7 @@ public interface ISupplyChainService {
 
     // 商品热认领汇总
     JSONObject itemBindSummary();
+
+    // 商品绑定人员汇总
+    JSONObject userItemTotal(Map<String, Object> requestMap);
 }

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/SupplyChainServiceImpl.java

@@ -170,4 +170,9 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
     public JSONObject itemBindSummary() {
         return supplyChainMapper.itemBindSummary();
     }
+
+    @Override
+    public JSONObject userItemTotal(Map<String, Object> requestMap) {
+        return supplyChainMapper.userItemTotal(requestMap);
+    }
 }

+ 74 - 0
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -859,6 +859,80 @@
                    on t1.item_id = t2.item_id
        where 1=1
     </select>
+    <select id="userItemTotal" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT count(t2.oid) AS 'orderNum',
+        sum(
+        CASE
+        WHEN t2.order_status != 80 THEN 1
+        ELSE 0
+        END
+        ) AS 'validOrderNUm',
+        round(
+        sum(
+        CASE
+        WHEN t2.order_status != 80 THEN 1
+        ELSE 0
+        END
+        ) / count(t2.oid),
+        4
+        ) AS 'validRadio',
+        sum(
+        CASE
+        WHEN t2.send_status = 1
+        AND t2.order_status != 80 THEN 1
+        ELSE 0
+        END
+        ) AS 'deliveryNum',
+        sum(case when t2.send_status = 0 and t2.order_status != 80 then 1 else 0 end) as 'notDeliveryNum',
+        round(
+        sum(
+        CASE
+        WHEN t2.send_status = 1
+        AND t2.order_status != 80 THEN 1
+        ELSE 0
+        END
+        ) / sum(
+        CASE
+        WHEN t2.order_status != 80 THEN 1
+        ELSE 0
+        END
+        ),
+        4
+        ) AS 'deliveryRadio',
+        sum(
+        CASE
+        WHEN t2.order_status = 80 THEN 1
+        ELSE 0
+        END
+        ) AS 'invalidOrderNUm',
+        sum(
+        CASE
+        WHEN t2.order_status != 80 THEN t2.pay_amount
+        ELSE 0
+        END
+        ) AS 'payAmount',
+        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'
+        FROM kuaishou_item_bind_user t1
+        LEFT JOIN
+        kuaishou_supply_chain t2 ON t1.item_id = t2.item_id
+        WHERE 1 = 1
+        <if test="start != null and start != ''">
+            and t2.order_create_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and t2.order_create_time &lt;= #{end}
+        </if>
+        <if test="userId != null and userId != ''">
+            and t1.user_id = #{userId}
+        </if>
+    </select>
 
 
 </mapper>