Browse Source

抖音 数据查看 初版

zhaoxian 2 years ago
parent
commit
1e836ab9b8
18 changed files with 2404 additions and 16 deletions
  1. 2 0
      ruixuan-live/pom.xml
  2. 1 1
      ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedanceColonelActivityController.java
  3. 1 1
      ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedanceController.java
  4. 1038 0
      ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedancePromoterOrderListController.java
  5. 278 0
      ruixuan-live/src/main/java/com/ruixuan/bytedance/entity/BytedancePromoterOrderList.java
  6. 63 0
      ruixuan-live/src/main/java/com/ruixuan/bytedance/mapper/BytedancePromoterOrderListMapper.java
  7. 61 0
      ruixuan-live/src/main/java/com/ruixuan/bytedance/service/IBytedancePromoterOrderListService.java
  8. 125 0
      ruixuan-live/src/main/java/com/ruixuan/bytedance/service/impl/BytedancePromoterOrderListServiceImpl.java
  9. 2 2
      ruixuan-live/src/main/java/com/ruixuan/bytedance/service/impl/BytedanceServiceImpl.java
  10. 1 1
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouLabelController.java
  11. 2 2
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java
  12. 4 1
      ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouItemList.java
  13. 1 1
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java
  14. 1 1
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java
  15. 2 2
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java
  16. 816 0
      ruixuan-live/src/main/resources/mapper/bytedance/BytedancePromoterOrderListMapper.xml
  17. 5 4
      ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml
  18. 1 0
      ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

+ 2 - 0
ruixuan-live/pom.xml

@@ -81,5 +81,7 @@
             <artifactId>tess4j</artifactId>
             <version>4.1.1</version>
         </dependency>
+
+
     </dependencies>
 </project>

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedanceColonelActivityController.java

@@ -24,7 +24,7 @@ import java.util.List;
  *
  * @date 2023-08-11
  */
-@Api(tags = "-------------头条团长活动")
+@Api(tags = "头条团长活动")
 @RestController
 @RequestMapping("/bytedance/activity")
 public class BytedanceColonelActivityController extends BaseController {

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedanceController.java

@@ -15,7 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
  * 抖音Controller
  */
 
-@Api(tags = "-------------抖音Controller------------")
+@Api(tags = "抖音Controller")
 @RestController
 @RequestMapping("/bytedance")
 public class BytedanceController extends BaseController {

File diff suppressed because it is too large
+ 1038 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/controller/BytedancePromoterOrderListController.java


+ 278 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/entity/BytedancePromoterOrderList.java

@@ -0,0 +1,278 @@
+package com.ruixuan.bytedance.entity;
+
+import com.ruixuan.common.annotation.Excel;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 团长订单对象 bytedance_promoter_order_list
+ *
+ * @author ruoyi
+ * @date 2023-08-28
+ */
+@Data
+public class BytedancePromoterOrderList implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 订单号
+     */
+    private Long orderId;
+
+    /**
+     * 商品id
+     */
+    @Excel(name = "商品id")
+    private String productId;
+
+    /**
+     * 商品名称
+     */
+    @Excel(name = "商品名称")
+    private String productName;
+
+    /**
+     * 商品图片URL
+     */
+    @Excel(name = "商品图片URL")
+    private String productImg;
+
+    /**
+     * 商品归属人ID
+     */
+    @Excel(name = "商品归属人ID")
+    private String productBindUserId;
+
+    /**
+     * 商品归属人名称
+     */
+    @Excel(name = "商品归属人名称")
+    private String productBindUserName;
+
+    /**
+     * 店铺ID
+     */
+    @Excel(name = "店铺ID")
+    private Long shopId;
+
+    /**
+     * 商家名称
+     */
+    @Excel(name = "商家名称")
+    private String shopName;
+
+    /**
+     * 订单支付金额,单位分
+     */
+    @Excel(name = "订单支付金额,单位分")
+    private Long totalPayAmount;
+
+    /**
+     * 订单状态(PAY_SUCC:支付完成 REFUND:退款 SETTLE:结算 CONFIRM: 确认收货)
+     */
+    @Excel(name = "订单状态(PAY_SUCC:支付完成 REFUND:退款 SETTLE:结算 CONFIRM: 确认收货)")
+    private String flowPoint;
+
+    /**
+     * App名称(抖音,火山,西瓜,头条)
+     */
+    @Excel(name = "App名称", readConverterExp = "抖=音,火山,西瓜,头条")
+    private String app;
+
+    /**
+     * 付款时间
+     */
+    @Excel(name = "付款时间")
+    private Long paySuccessTime;
+
+    /**
+     * 结算时间
+     */
+    @Excel(name = "结算时间")
+    private Long settleTime;
+
+    /**
+     * 预估参与结算金额,单位分
+     */
+    @Excel(name = "预估参与结算金额,单位分")
+    private Long payGoodsAmount;
+
+    /**
+     * 实际参与结算金额,单位分
+     */
+    @Excel(name = "实际参与结算金额,单位分")
+    private Long settledGoodsAmount;
+
+    /**
+     * 商品数目
+     */
+    @Excel(name = "商品数目")
+    private Long itemNum;
+
+    /**
+     * 领样凭证状态 1:未上传凭证 2:上传凭证
+     */
+    @Excel(name = "领样凭证状态 1:未上传凭证 2:上传凭证")
+    private Integer sampleVoucherStatus;
+
+    /**
+     * 退款订单退款时间
+     */
+    @Excel(name = "退款订单退款时间")
+    private Long refundTime;
+
+    /**
+     * 达人抖音号
+     */
+    @Excel(name = "达人抖音号")
+    private String authorShortId;
+
+    /**
+     * 达人抖音名称
+     */
+    @Excel(name = "达人抖音名称")
+    private String authorShortName;
+
+    /**
+     * 达人链接
+     */
+    @Excel(name = "达人链接")
+    private String authorShortUrl;
+
+    /**
+     * 达人归属人ID
+     */
+    @Excel(name = "达人归属人ID")
+    private String authorBindUserId;
+
+    /**
+     * 达人归属人名称
+     */
+    @Excel(name = "达人归属人名称")
+    private String authorBindUserName;
+
+    /**
+     * 团长类型。0:普通;1:一级团长;2: 二级团长
+     */
+    @Excel(name = "团长类型。0:普通;1:一级团长;2: 二级团长")
+    private String colonelType;
+
+    /**
+     * 带货体裁。shop_list:橱窗;video:视频;live:直播;others:其他
+     */
+    @Excel(name = "带货体裁。shop_list:橱窗;video:视频;live:直播;others:其他")
+    private String mediaType;
+
+    /**
+     * 达人佣金率,此处保存为真实数据x1万之后,如真实是0.35,这里是3500
+     */
+    @Excel(name = "达人佣金率,此处保存为真实数据x1万之后,如真实是0.35,这里是3500")
+    private Long commissionRate;
+
+    /**
+     * 是否托管 0否,1是
+     */
+    @Excel(name = "是否托管 0否,1是")
+    private String isTrusteeship;
+
+    /**
+     * 分销类型。ProductDetail:商品分销;Live:直播分销;Activity:频道活动;Mix:营销活动
+     */
+    @Excel(name = "分销类型。ProductDetail:商品分销;Live:直播分销;Activity:频道活动;Mix:营销活动")
+    private String goodShareType;
+
+    /**
+     * 团长服务费率(35%返回3500)
+     */
+    @Excel(name = "团长服务费率(35%返回3500)")
+    private Long colonelCommissionRate;
+
+    /**
+     * 团长活动ID
+     */
+    @Excel(name = "团长活动ID")
+    private Long colonelActivityId;
+
+    /**
+     * 团长预估服务费,单位分
+     */
+    @Excel(name = "团长预估服务费,单位分")
+    private Long colonelEstimatedCommission;
+
+    /**
+     * 团长结算服务费,单位分
+     */
+    @Excel(name = "团长结算服务费,单位分")
+    private Long colonelRealCommission;
+
+    /**
+     * 团长技术服务费率,单位分
+     */
+    @Excel(name = "团长技术服务费率,单位分")
+    private Long colonelTechServiceFeeRate;
+
+    /**
+     * 团长预估技术服务费,单位分
+     */
+    @Excel(name = "团长预估技术服务费,单位分")
+    private Long colonelTechServiceFee;
+
+    /**
+     * 团长结算技术服务费,单位分
+     */
+    @Excel(name = "团长结算技术服务费,单位分")
+    private Long colonelSettledTechServiceFee;
+
+    /**
+     * 团长机构ID
+     */
+    @Excel(name = "团长机构ID")
+    private Long colonelInstitutionId;
+
+    /**
+     * 团长机构名称
+     */
+    @Excel(name = "团长机构名称")
+    private String colonelInstitutionName;
+
+    /**
+     * 二级团长服务费率(35%返回3500)
+     */
+    @Excel(name = "二级团长服务费率(35%返回3500)")
+    private Long secondCommissionRate;
+
+    /**
+     * 二级团长活动ID
+     */
+    @Excel(name = "二级团长活动ID")
+    private Long secondActivityId;
+
+    /**
+     * 二级团长预估服务费,单位分
+     */
+    @Excel(name = "二级团长预估服务费,单位分")
+    private Long secondEstimatedCommission;
+
+    /**
+     * 二级团长结算服务费,单位分
+     */
+    @Excel(name = "二级团长结算服务费,单位分")
+    private Long secondRealCommission;
+
+    /**
+     * 日期
+     */
+    private Long statDate;
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+    /**
+     * 更新时间
+     */
+    private Long updateTime;
+}

+ 63 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/mapper/BytedancePromoterOrderListMapper.java

@@ -0,0 +1,63 @@
+package com.ruixuan.bytedance.mapper;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.bytedance.entity.BytedancePromoterOrderList;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 团长订单Mapper接口
+ *
+ * @author ruoyi
+ * @date 2023-08-28
+ */
+public interface BytedancePromoterOrderListMapper
+{
+    /**
+     * 查询团长订单
+     *
+     * @param orderId 团长订单主键
+     * @return 团长订单
+     */
+    public BytedancePromoterOrderList selectBytedancePromoterOrderListByOrderId(Long orderId);
+
+    /**
+     * 查询团长订单列表
+     *
+     * @param bytedancePromoterOrderList 团长订单
+     * @return 团长订单集合
+     */
+    public List<BytedancePromoterOrderList> selectBytedancePromoterOrderListList(BytedancePromoterOrderList bytedancePromoterOrderList);
+
+    List<JSONObject> getBytedanceOrderList(Map<String, Object> requestMap);
+
+    List<JSONObject> getTopOrders(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceBDReportList(Map<String, Object> requestMap);
+
+    List<JSONObject> anchorBytedanceOrderDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceItemList(Map<String, Object> requestMap);
+
+    List<JSONObject> adminBytedanceReportList(Map<String, Object> requestMap);
+
+    List<JSONObject> adminBytedanceReportListByBind(Map<String, Object> requestMap);
+
+    List<JSONObject> getBytedanceTopPromoterByItemId(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceOrderStatistics(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceItemDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceBDTotal(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceBDDetailList(Map<String, Object> requestMap);
+
+    JSONObject bytedanceUserItemTotal(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceUserItemDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> exportBytedancePromoter(Map<String, Object> requestMap);
+
+}

+ 61 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/IBytedancePromoterOrderListService.java

@@ -0,0 +1,61 @@
+package com.ruixuan.bytedance.service;
+
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.bytedance.entity.BytedancePromoterOrderList;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 团长订单Service接口
+ *
+ * @author ruoyi
+ * @date 2023-08-28
+ */
+public interface IBytedancePromoterOrderListService {
+    /**
+     * 查询团长订单
+     *
+     * @param orderId 团长订单主键
+     * @return 团长订单
+     */
+    public BytedancePromoterOrderList selectBytedancePromoterOrderListByOrderId(Long orderId);
+
+    /**
+     * 查询团长订单列表
+     *
+     * @param bytedancePromoterOrderList 团长订单
+     * @return 团长订单集合
+     */
+    public List<BytedancePromoterOrderList> selectBytedancePromoterOrderListList(BytedancePromoterOrderList bytedancePromoterOrderList);
+
+    List<JSONObject> getBytedanceOrderList(Map<String, Object> requestMap,boolean flag);
+
+    List<JSONObject> bytedanceBDReportList(Map<String, Object> requestMap);
+
+    List<JSONObject> anchorBytedanceOrderDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceItemList(Map<String, Object> requestMap);
+
+    List<JSONObject> adminBytedanceReportList(Map<String, Object> requestMap);
+
+    List<JSONObject> adminBytedanceReportListByBind(Map<String, Object> requestMap);
+
+    List<JSONObject> getBytedanceTopPromoterByItemId(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceOrderStatistics(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceItemDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceBDTotal(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceBDDetailList(Map<String, Object> requestMap);
+
+    JSONObject bytedanceUserItemTotal(Map<String, Object> requestMap);
+
+    List<JSONObject> bytedanceUserItemDetail(Map<String, Object> requestMap);
+
+    List<JSONObject> exportBytedancePromoter(Map<String, Object> requestMap);
+
+}

+ 125 - 0
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/impl/BytedancePromoterOrderListServiceImpl.java

@@ -0,0 +1,125 @@
+package com.ruixuan.bytedance.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ruixuan.bytedance.entity.BytedancePromoterOrderList;
+import com.ruixuan.bytedance.mapper.BytedancePromoterOrderListMapper;
+import com.ruixuan.bytedance.service.IBytedancePromoterOrderListService;
+import com.ruixuan.common.utils.Check;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 团长订单Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2023-08-28
+ */
+@Service
+public class BytedancePromoterOrderListServiceImpl implements IBytedancePromoterOrderListService {
+    @Autowired
+    private BytedancePromoterOrderListMapper bytedancePromoterOrderListMapper;
+
+    /**
+     * 查询团长订单
+     *
+     * @param orderId 团长订单主键
+     * @return 团长订单
+     */
+    @Override
+    public BytedancePromoterOrderList selectBytedancePromoterOrderListByOrderId(Long orderId) {
+        return bytedancePromoterOrderListMapper.selectBytedancePromoterOrderListByOrderId(orderId);
+    }
+
+    /**
+     * 查询团长订单列表
+     *
+     * @param bytedancePromoterOrderList 团长订单
+     * @return 团长订单
+     */
+    @Override
+    public List<BytedancePromoterOrderList> selectBytedancePromoterOrderListList(BytedancePromoterOrderList bytedancePromoterOrderList) {
+        return bytedancePromoterOrderListMapper.selectBytedancePromoterOrderListList(bytedancePromoterOrderList);
+    }
+
+    @Override
+    public List<JSONObject> getBytedanceOrderList(Map<String, Object> requestMap, boolean flag) {
+        List<JSONObject> list = bytedancePromoterOrderListMapper.getBytedanceOrderList(requestMap);
+        if (Check.isNotNull(list) && flag) {
+            for (int i = 0; i < list.size(); i++) {
+                JSONObject jsonObject = list.get(i);
+                requestMap.put("promoterId", jsonObject.getString("promoterId"));
+                List<JSONObject> topOrders = bytedancePromoterOrderListMapper.getTopOrders(requestMap);
+                jsonObject.put("topOrders", topOrders);
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public List<JSONObject> bytedanceBDReportList(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceBDReportList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> anchorBytedanceOrderDetail(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.anchorBytedanceOrderDetail(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> bytedanceItemList(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceItemList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> adminBytedanceReportList(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.adminBytedanceReportList(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> adminBytedanceReportListByBind(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.adminBytedanceReportListByBind(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> getBytedanceTopPromoterByItemId(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.getBytedanceTopPromoterByItemId(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> bytedanceOrderStatistics(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceOrderStatistics(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> bytedanceItemDetail(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceItemDetail(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> bytedanceBDTotal(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceBDTotal(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> bytedanceBDDetailList(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceBDDetailList(requestMap);
+    }
+
+    @Override
+    public JSONObject bytedanceUserItemTotal(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceUserItemTotal(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> bytedanceUserItemDetail(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.bytedanceUserItemDetail(requestMap);
+    }
+
+    @Override
+    public List<JSONObject> exportBytedancePromoter(Map<String, Object> requestMap) {
+        return bytedancePromoterOrderListMapper.exportBytedancePromoter(requestMap);
+    }
+}

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/bytedance/service/impl/BytedanceServiceImpl.java

@@ -191,7 +191,7 @@ public class BytedanceServiceImpl implements IBytedanceService {
               JSONObject data = dataArr.getJSONObject(0);
               if (!Check.isNull(data)) {
                   JSONObject itemJson = new JSONObject();
-                  Long product_id = data.getLong("product_id");//商品ID
+                  String product_id = data.getString("product_id");//商品ID
                   String title = data.getString("title");//商品名称
                   Long price = data.getLong("price");//商品售价
                   Double cos_ratio = data.getDouble("cos_ratio");//	佣金比例
@@ -311,7 +311,7 @@ public class BytedanceServiceImpl implements IBytedanceService {
                     returnJson.put("message", "媒体返回商品信息为空");
                 }else {
                     String update_time = record.getString("update_time"); // 更新时间
-                    Long product_id = record.getLong("product_id"); // 商品id
+                    String product_id = record.getString("product_id"); // 商品id
                     String product_name = record.getString("product_name"); // 商品id
                     Long product_price = record.getLong("product_price"); // 商品售价
                     String product_img = record.getString("product_img"); // 商品图片

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

@@ -24,7 +24,7 @@ import java.util.List;
  * @author ruoyi
  * @date 2023-03-28
  */
-@Api(tags = "---------快手标签")
+@Api(tags = "快手标签")
 @RestController
 @RequestMapping("/kuaishou/label")
 public class KuaishouLabelController extends BaseController {

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

@@ -143,9 +143,9 @@ public class KuaishouPromoterController extends BaseController {
      */
     @GetMapping(value = "/addPromotersCount")
     @ApiOperation(value = "新增设置渠道绑定达人数")
-    public JSONObject addPromotersCount(Long userId, Long promotersCount) {
+    public JSONObject addPromotersCount(Long userId, Long promotersCount,String mediaId) {
         try {
-            return kuaishouPromoterService.addPromotersCount(userId, promotersCount);
+            return kuaishouPromoterService.addPromotersCount(userId, promotersCount,mediaId);
         } catch (Exception e) {
             e.printStackTrace();
             JSONObject result = new JSONObject();

+ 4 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouItemList.java

@@ -1,5 +1,7 @@
 package com.ruixuan.isc.entity;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.ruixuan.common.annotation.Excel;
 import com.ruixuan.common.core.domain.BaseEntity;
 import org.springframework.data.annotation.Transient;
@@ -11,8 +13,9 @@ public class KuaishouItemList extends BaseEntity {
     /**
      * 商品ID
      */
+    @JsonSerialize(using = ToStringSerializer.class)
     private Long itemId;
-    private Integer  mediaId;
+    private Integer mediaId;
 
     /**
      * 商品标题

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java

@@ -97,5 +97,5 @@ public interface KuaishouPromoterMapper {
 
     Integer getBoundCount(@Param("userId") Long userId);
 
-    Integer addPromotersCount(@Param("userId") Long userId, @Param("promotersCount") Long promotersCount);
+    Integer addPromotersCount(@Param("userId") Long userId, @Param("promotersCount") Long promotersCount, @Param("mediaId") String mediaId);
 }

+ 1 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java

@@ -76,5 +76,5 @@ public interface IKuaishouPromoterService {
 
     KuaishouPromoter getOnlyPromoterInfoByUserId(String promoterId, Long userId);
 
-    JSONObject addPromotersCount(Long userId, Long promotersCount);
+    JSONObject addPromotersCount(Long userId, Long promotersCount, String mediaId);
 }

+ 2 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -364,8 +364,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     @Override
-    public JSONObject addPromotersCount(Long userId, Long promotersCount) {
-        kuaishouPromoterMapper.addPromotersCount(userId, promotersCount);
+    public JSONObject addPromotersCount(Long userId, Long promotersCount, String mediaId) {
+        kuaishouPromoterMapper.addPromotersCount(userId, promotersCount, mediaId);
         JSONObject result = new JSONObject();
         result.put("code", 200);
         result.put("msg", "success");

+ 816 - 0
ruixuan-live/src/main/resources/mapper/bytedance/BytedancePromoterOrderListMapper.xml

@@ -0,0 +1,816 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruixuan.bytedance.mapper.BytedancePromoterOrderListMapper">
+
+    <resultMap type="com.ruixuan.bytedance.entity.BytedancePromoterOrderList" id="BytedancePromoterOrderListResult">
+        <result property="orderId" column="order_id"/>
+        <result property="productId" column="product_id"/>
+        <result property="productName" column="product_name"/>
+        <result property="productImg" column="product_img"/>
+        <result property="productBindUserId" column="product_bind_user_id"/>
+        <result property="productBindUserName" column="product_bind_user_name"/>
+        <result property="shopId" column="shop_id"/>
+        <result property="shopName" column="shop_name"/>
+        <result property="totalPayAmount" column="total_pay_amount"/>
+        <result property="flowPoint" column="flow_point"/>
+        <result property="app" column="app"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="paySuccessTime" column="pay_success_time"/>
+        <result property="settleTime" column="settle_time"/>
+        <result property="payGoodsAmount" column="total_pay_amount"/>
+        <result property="settledGoodsAmount" column="total_pay_amount"/>
+        <result property="itemNum" column="item_num"/>
+        <result property="refundTime" column="refund_time"/>
+        <result property="authorShortId" column="author_short_id"/>
+        <result property="authorShortName" column="author_short_name"/>
+        <result property="authorShortUrl" column="author_short_url"/>
+        <result property="authorBindUserId" column="author_bind_user_id"/>
+        <result property="authorBindUserName" column="author_bind_user_name"/>
+        <result property="colonelType" column="colonel_type"/>
+        <result property="mediaType" column="media_type"/>
+        <result property="commissionRate" column="commission_rate"/>
+        <result property="isTrusteeship" column="is_trusteeship"/>
+        <result property="goodShareType" column="good_share_type"/>
+        <result property="colonelCommissionRate" column="colonel_commission_rate"/>
+        <result property="colonelActivityId" column="colonel_activity_id"/>
+        <result property="colonelEstimatedCommission" column="colonel_estimated_commission"/>
+        <result property="colonelRealCommission" column="colonel_real_commission"/>
+        <result property="colonelTechServiceFeeRate" column="colonel_tech_service_fee_rate"/>
+        <result property="colonelTechServiceFee" column="colonel_tech_service_fee"/>
+        <result property="colonelSettledTechServiceFee" column="colonel_settled_tech_service_fee"/>
+        <result property="colonelInstitutionId" column="colonel_institution_id"/>
+        <result property="colonelInstitutionName" column="colonel_institution_name"/>
+        <result property="secondCommissionRate" column="second_commission_rate"/>
+        <result property="secondActivityId" column="second_activity_id"/>
+        <result property="secondEstimatedCommission" column="second_estimated_commission"/>
+        <result property="secondRealCommission" column="second_real_commission"/>
+        <result property="createTime" column="create_time"/>
+        <result property="statDate" column="stat_date"/>
+    </resultMap>
+
+    <sql id="SELECTBytedancePromoterOrderListVo">
+        SELECT order_id,
+               product_id,
+               product_name,
+               product_img,
+               product_bind_user_id,
+               product_bind_user_name,
+               shop_id,
+               shop_name,
+               total_pay_amount,
+               flow_point,
+               app,
+               update_time,
+               pay_success_time,
+               settle_time,
+               total_pay_amount,
+               total_pay_amount,
+               item_num,
+               refund_time,
+               author_short_id,
+               author_short_url,
+               author_bind_user_id,
+               author_bind_user_name,
+               colonel_type,
+               media_type,
+               commission_rate,
+               is_trusteeship,
+               good_share_type,
+               colonel_commission_rate,
+               colonel_activity_id,
+               colonel_estimated_commission,
+               colonel_real_commission,
+               colonel_tech_service_fee_rate,
+               colonel_tech_service_fee,
+               colonel_settled_tech_service_fee,
+               colonel_institution_id,
+               colonel_institution_name,
+               second_commission_rate,
+               second_activity_id,
+               second_estimated_commission,
+               second_real_commission,
+               create_time,
+               stat_date
+        FROM bytedance_promoter_order_list
+    </sql>
+
+    <select id="SELECTBytedancePromoterOrderListList"
+            parameterType="com.ruixuan.bytedance.entity.BytedancePromoterOrderList"
+            resultMap="BytedancePromoterOrderListResult">
+        <include refid="SELECTBytedancePromoterOrderListVo"/>
+        <where>
+            <if test="productId != null  and productId != ''">and product_id = #{productId}</if>
+            <if test="productName != null  and productName != ''">and product_name like CONCAT('%', #{productName},
+                '%')
+            </if>
+            <if test="productImg != null  and productImg != ''">and product_img = #{productImg}</if>
+            <if test="productBindUserId != null  and productBindUserId != ''">and product_bind_user_id =
+                #{productBindUserId}
+            </if>
+            <if test="productBindUserName != null  and productBindUserName != ''">and product_bind_user_name like
+                CONCAT('%', #{productBindUserName}, '%')
+            </if>
+            <if test="shopId != null ">and shop_id = #{shopId}</if>
+            <if test="shopName != null  and shopName != ''">and shop_name like CONCAT('%', #{shopName}, '%')</if>
+            <if test="totalPayAmount != null ">and total_pay_amount = #{totalPayAmount}</if>
+            <if test="flowPoint != null  and flowPoint != ''">and flow_point = #{flowPoint}</if>
+            <if test="app != null  and app != ''">and app = #{app}</if>
+            <if test="paySuccessTime != null ">and pay_success_time = #{paySuccessTime}</if>
+            <if test="settleTime != null ">and settle_time = #{settleTime}</if>
+            <if test="payGoodsAmount != null ">and total_pay_amount = #{payGoodsAmount}</if>
+            <if test="settledGoodsAmount != null ">and total_pay_amount = #{settledGoodsAmount}</if>
+            <if test="itemNum != null ">and item_num = #{itemNum}</if>
+            <if test="refundTime != null ">and refund_time = #{refundTime}</if>
+            <if test="authorShortId != null  and authorShortId != ''">and author_short_id = #{authorShortId}</if>
+            <if test="authorShortUrl != null  and authorShortUrl != ''">and author_short_url = #{authorShortUrl}</if>
+            <if test="authorBindUserId != null  and authorBindUserId != ''">and author_bind_user_id =
+                #{authorBindUserId}
+            </if>
+            <if test="authorBindUserName != null  and authorBindUserName != ''">and author_bind_user_name like
+                CONCAT('%', #{authorBindUserName}, '%')
+            </if>
+            <if test="colonelType != null  and colonelType != ''">and colonel_type = #{colonelType}</if>
+            <if test="mediaType != null  and mediaType != ''">and media_type = #{mediaType}</if>
+            <if test="commissionRate != null ">and commission_rate = #{commissionRate}</if>
+            <if test="isTrusteeship != null  and isTrusteeship != ''">and is_trusteeship = #{isTrusteeship}</if>
+            <if test="goodShareType != null  and goodShareType != ''">and good_share_type = #{goodShareType}</if>
+            <if test="colonelCommissionRate != null ">and colonel_commission_rate = #{colonelCommissionRate}</if>
+            <if test="colonelActivityId != null ">and colonel_activity_id = #{colonelActivityId}</if>
+            <if test="colonelEstimatedCommission != null ">and colonel_estimated_commission =
+                #{colonelEstimatedCommission}
+            </if>
+            <if test="colonelRealCommission != null ">and colonel_real_commission = #{colonelRealCommission}</if>
+            <if test="colonelTechServiceFeeRate != null ">and colonel_tech_service_fee_rate =
+                #{colonelTechServiceFeeRate}
+            </if>
+            <if test="colonelTechServiceFee != null ">and colonel_tech_service_fee = #{colonelTechServiceFee}</if>
+            <if test="colonelSettledTechServiceFee != null ">and colonel_settled_tech_service_fee =
+                #{colonelSettledTechServiceFee}
+            </if>
+            <if test="colonelInstitutionId != null ">and colonel_institution_id = #{colonelInstitutionId}</if>
+            <if test="colonelInstitutionName != null  and colonelInstitutionName != ''">and colonel_institution_name
+                like CONCAT('%', #{colonelInstitutionName}, '%')
+            </if>
+            <if test="secondCommissionRate != null ">and second_commission_rate = #{secondCommissionRate}</if>
+            <if test="secondActivityId != null ">and second_activity_id = #{secondActivityId}</if>
+            <if test="secondEstimatedCommission != null ">and second_estimated_commission =
+                #{secondEstimatedCommission}
+            </if>
+            <if test="secondRealCommission != null ">and second_real_commission = #{secondRealCommission}</if>
+        </where>
+    </select>
+
+    <select id="SELECTBytedancePromoterOrderListByOrderId" parameterType="Long"
+            resultMap="BytedancePromoterOrderListResult">
+        <include refid="SELECTBytedancePromoterOrderListVo"/>
+        WHERE order_id = #{orderId}
+    </select>
+
+
+    <select id="getBytedanceOrderList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT *
+        FROM (
+        SELECT
+        IFNULL(author_short_id,'-') AS 'promoterId',
+        IFNULL(author_short_name,'-') AS 'promoterNickName',
+        count( order_id ) AS 'orderNum',
+        sum( CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END ) AS 'validOrderNUm',
+        CONCAT(round( sum( CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END ) / count( order_id )*100, 2 ),'%') AS
+        'validRadio',
+        sum( total_pay_amount )/100 AS 'payAmount',
+        sum( CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END )/100 AS 'validPayAmount',
+        sum( CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END )/100 AS
+        'regimentalPromotionAmount',
+        author_bind_user_id,
+        IFNULL(author_bind_user_name,'-') AS 'userName'
+        FROM
+        bytedance_promoter_order_list
+        WHERE
+        1 = 1
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="promoterId != null and promoterId != ''">
+            and author_short_id = #{promoterId}
+        </if>
+        <if test="promoterNickName != null and promoterNickName != ''">
+            and author_short_name like CONCAT(CONCAT('%',#{promoterNickName}),'%')
+        </if>
+        GROUP BY author_short_id) t
+        ORDER BY t.orderNum desc
+    </select>
+
+    <select id="getTopOrders" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT *
+        FROM
+        (SELECT product_id AS 'itemId',
+        product_name AS 'itemTitle',
+        product_img AS 'imageUrl',
+        count(order_id) AS 'orderNum'
+        FROM bytedance_promoter_order_list
+        WHERE author_short_id = #{promoterId}
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        GROUP BY product_id) t
+        ORDER BY t.orderNum desc limit 3
+    </select>
+
+
+    <select id="bytedanceBDReportList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.collectSampleId,
+        t1.collectSampleName,
+        t2.promoterCount,
+        t3.sampleCount,
+        round(t3.sampleCount / t2.promoterCount * 100, 2) AS 'sampleRate',
+        t2.promoterCount - t3.sampleCount AS 'notSampleCount',
+        t1.orderNum,
+        t1.validOrderNum,
+        t1.validOrderRate,
+        t1.orderAmount,
+        t1.regimentalPromotionAmount,
+        t1.totalRegimentalSettleAmount,
+        t4.sendTotalCount,
+        t4.sendPromoterCount,
+        t4.sendItemCount,
+        t1.voucherOrderNum,
+        t1.voucherValidOrderNum,
+        t1.voucherOrderAmount,
+        t1.voucherRegimentalPromotionAmount,
+        t1.voucherTotalRegimentalSettleAmount,
+        IFNULL(t5.promoters_count,'-') AS 'promotersCount'
+        FROM (
+        SELECT author_bind_user_id AS 'collectSampleId',
+        author_bind_user_name AS 'collectSampleName',
+        count(order_id) AS 'orderNum',
+        IFNULL(count(CASE WHEN sample_voucher_status = 2 THEN 1 ELSE 0 END), 0) AS 'voucherOrderNum',
+        t0.validOrderNUm AS 'validOrderNUm',
+        IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN 1 ELSE 0 END), 0) AS 'voucherValidOrderNum',
+        CONCAT(round(t0.validOrderNUm / count(order_id) * 100, 2),'%') AS 'validOrderRate',
+        sum(total_pay_amount)/100 AS 'orderAmount',
+        IFNULL(round(SUM(CASE WHEN sample_voucher_status = 2 THEN total_pay_amount ELSE 0 END) / 100,2), 0) AS
+        'voucherOrderAmount',
+        sum(colonel_estimated_commission)/100 AS 'regimentalPromotionAmount',
+        IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN colonel_estimated_commission ELSE 0 END)/100, 0)
+        AS'voucherRegimentalPromotionAmount',
+        sum(colonel_real_commission)/100 AS 'totalRegimentalSettleAmount',
+        IFNULL(SUM(CASE WHEN sample_voucher_status = 2 THEN colonel_real_commission ELSE 0 END)/100, 0) AS
+        'voucherTotalRegimentalSettleAmount'
+        FROM ruixuan.bytedance_promoter_order_list t
+        LEFT JOIN (
+        SELECT author_bind_user_id AS 'collectSampleId',
+        sum(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END) AS 'validOrderNUm'
+        FROM ruixuan.bytedance_promoter_order_list
+        WHERE author_bind_user_id is not null
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and author_bind_user_id = #{collectSampleId}
+        </if>
+        GROUP BY author_bind_user_id
+        ) t0 ON t.author_bind_user_id= t0.collectSampleId
+        WHERE author_bind_user_id is not null
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and author_bind_user_id = #{collectSampleId}
+        </if>
+        GROUP BY author_bind_user_id) t1
+        LEFT JOIN (
+        SELECT user_id AS 'userId',
+        count(distinct promoter_id) AS 'promoterCount'
+        FROM kuaishou_promoter
+        GROUP BY user_id) t2
+        on t1.collectSampleId = t2.userId
+        LEFT JOIN (
+        SELECT collect_sample_id AS 'collectSampleId',
+        count(distinct promoter_id) AS 'sampleCount'
+        FROM kuaishou_item_collect_samples
+        WHERE collect_sample_status > 2
+        GROUP BY collect_sample_id) t3
+        on t2.userId = t3.collectSampleId
+        LEFT JOIN (
+        SELECT collect_sample_id AS 'collectSampleId',
+        count(1) AS 'sendTotalCount',
+        count(distinct promoter_id) AS 'sendPromoterCount',
+        count(distinct item_id) AS 'sendItemCount'
+        FROM kuaishou_item_collect_samples
+        WHERE collect_sample_status > 2
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and collect_sample_id = #{collectSampleId}
+        </if>
+        <if test="start != null and start != ''">
+            and create_time &gt;= str_to_date(CONCAT(date_format(#{start}, '%Y-%m-%d'), '00:00:01'), '%Y-%m-%d
+            %H:%i:%s')
+        </if>
+        <if test="end != null and end != ''">
+            and create_time &lt;= str_to_date(CONCAT(date_format(#{end}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d %H:%i:%s')
+        </if>
+        GROUP BY collect_sample_id
+        ) t4
+        on t1.collectSampleId = t4.collectSampleId
+        LEFT JOIN (
+        SELECT user_id,promoters_count
+        FROM user_promoters_count
+        WHERE media_id = 1
+        ) t5
+        on t1.collectSampleId = t5.user_id
+        ORDER BY t1.orderNum desc
+    </select>
+
+    <select id="anchorBytedanceOrderDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t.*,
+        t2.status,
+        (
+        case
+        when t3.activity_item_status = 1 then '待审核'
+        when t3.activity_item_status = 2 then '已上架'
+        when t3.activity_item_status = 3 then '审核拒绝'
+        when t3.activity_item_status = 4 then '活动失效'
+        when t3.activity_item_status = 5 then '商品下架'
+        else ''
+        end
+        ) AS 'activityItemStatus'
+        FROM (
+        SELECT
+        tt.product_name AS 'itemTitle',
+        tt.product_id AS 'itemId',
+        tt.total_pay_amount/100 AS 'reservePrice',
+        tt.product_img 'imageUrl',
+        count(order_id) AS 'orderNum',
+        sum( CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END ) AS 'validOrderNUm',
+        CONCAT(round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id)*100,2),'%') as
+        'validRadio',
+        sum(case when flow_point != 'REFUND' then total_pay_amount else 0 end)/100 AS 'payAmount',
+        CONCAT(round(colonel_commission_rate/100,2),'%') AS 'regimentalPromotionRate'
+        FROM bytedance_promoter_order_list tt
+        WHERE 1= 1
+        <if test="promoterId != null and promoterId != ''">
+            and tt.author_short_id = #{promoterId}
+        </if>
+
+        <if test="start != null and start != ''">
+            and tt.pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and tt.pay_success_time &lt;= #{end}
+        </if>
+        <if test="itemId != null and itemId != ''">
+            and tt.product_id = #{itemId}
+        </if>
+        <if test="itemTitle != null and itemTitle != ''">
+            and tt.product_name like CONCAT(CONCAT('%',#{itemTitle}),'%')
+        </if>
+        GROUP BY tt.product_id) t
+        LEFT JOIN
+        ( SELECT item_id AS 'itemId', collect_sample_status AS 'status' FROM
+        kuaishou_item_collect_samples WHERE promoter_id = #{promoterId}) t2
+        on t.itemId = t2.itemId
+        LEFT JOIN kuaishou_item_list t3 ON t.itemId = t3.item_id
+        ORDER BY t.orderNum desc
+    </select>
+
+    <select id="bytedanceItemList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.product_bind_user_id AS 'userId',
+        t1.product_bind_user_name AS 'userName',
+        t1.product_id AS 'itemId',
+        t1.total_pay_amount/100 AS 'reservePrice',
+        t1.product_name AS 'itemTitle',
+        t1.product_img AS 'imageUrl',
+        count(t1.order_id) AS 'orderNum',
+        sum(case when t1.flow_point != 'REFUND' then 1 else 0 end) AS 'validOrderNUm',
+        CONCAT(round(sum(case when t1.flow_point != 'REFUND' then 1 else 0 end) / count(t1.order_id)*100, 2),'%') as
+        'validRadio',
+        CONCAT(Round(t1.commission_rate/100,2),'%') AS 'itemCommissionRate'
+        FROM bytedance_promoter_order_list t1
+        WHERE 1 = 1
+        <if test="start != null and start != ''">
+            and t1.pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and t1.pay_success_time &lt;= #{end}
+        </if>
+        <if test="itemId != null and itemId != ''">
+            and t1.product_id = #{itemId}
+        </if>
+        <if test="itemTitle != null and itemTitle != ''">
+            and t1.product_name like CONCAT(CONCAT('%',#{itemTitle}),'%')
+        </if>
+        <if test="userId != null and userId != ''">
+            and t1.product_bind_user_id = #{userId}
+        </if>
+        GROUP BY t1.product_id
+        ORDER BY ${fieId} ${sort}
+    </select>
+
+    <select id="adminBytedanceReportList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT *
+        FROM (
+        SELECT
+        t2.product_bind_user_id AS 'userId',
+        t2.product_bind_user_name AS 'userName',
+        count(distinct t2.product_id) AS 'itemCount',
+        count(t2.order_id) AS 'orderNum',
+        sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) AS 'validOrderNUm',
+        CONCAT(round(sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) / count(t2.order_id)*100, 2),'%') as
+        'validRadio',
+        sum(case when t2.flow_point = 'REFUND' then 1 else 0 end) AS 'invalidOrderNUm',
+        sum(case when t2.flow_point != 'REFUND' then t2.total_pay_amount else 0 end)/100 AS 'payAmount',
+        sum(case when t2.flow_point != 'REFUND' then t2.colonel_estimated_commission
+        else 0 end)/100 AS 'regimentalPromotionAmount',
+        sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as
+        'totalRegimentalSettleAmount'
+        FROM bytedance_promoter_order_list t2
+        WHERE product_bind_user_id is not null
+        <if test="start != null and start != ''">
+            and t2.pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and t2.pay_success_time &lt;= #{end}
+        </if>
+        GROUP BY t2.product_bind_user_id) t
+        LEFT JOIN
+        (
+        SELECT item_create_id,count(1) AS 'sendSampleCount' FROM kuaishou_item_collect_samples
+        WHERE courier_number_time >= CONCAT(#{start},' 00:00:00')
+        and courier_number_time &lt;= CONCAT(#{end},' 23:59:59')
+        GROUP BY item_create_id
+        ) t1 on t.userId = t1.item_create_id
+        WHERE 1 =1
+        <if test="userId != null and userId != ''">
+            and t.userId = #{userId}
+        </if>
+        ORDER BY t.orderNum desc
+    </select>
+
+    <select id="adminBytedanceReportListByBind" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT * FROM (
+        SELECT
+        t1.user_id AS 'userId',
+        t1.user_name AS 'userName',
+        count(distinct t1.item_id) AS 'itemCount',
+        count(t2.order_id) AS 'orderNum',
+        sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) AS 'validOrderNUm',
+        CONCAT(round(sum(case when t2.flow_point != 'REFUND' then 1 else 0 end) / count(t2.order_id)*100, 2),'%') as
+        'validRadio',
+        sum(case when t2.flow_point = 'REFUND' then 1 else 0 end) AS 'invalidOrderNUm',
+        sum(case when t2.flow_point != 'REFUND' then t2.total_pay_amount else 0 end)/100 AS 'payAmount',
+        sum(case when t2.flow_point != 'REFUND' then t2.colonel_estimated_commission
+        else 0 end)/100 AS 'regimentalPromotionAmount',
+        sum(case when t2.flow_point != 'REFUND' then t2.colonel_real_commission else 0 end)/100 as
+        'totalRegimentalSettleAmount'
+        FROM kuaishou_item_list t1
+        LEFT JOIN (SELECT product_id,
+        order_id,
+        flow_point,
+        total_pay_amount,
+        colonel_estimated_commission,
+        colonel_real_commission
+        FROM bytedance_promoter_order_list
+        WHERE pay_success_time &gt;= #{start}
+        ) t2
+        on t1.item_id = t2.product_id
+        WHERE t1.create_time >= CONCAT(#{start},' 00:00:00')
+        and t1.create_time &lt;= CONCAT(#{end},' 23:59:59')
+        <if test="userId != null and userId != ''">
+            and t1.userId = #{userId}
+        </if>
+        GROUP BY t1.user_id ) t LEFT JOIN (
+        SELECT t1.user_id,count(distinct courier_number) AS 'sendSampleCount' FROM kuaishou_item_list t1 LEFT JOIN
+        kuaishou_item_collect_samples t2
+        on t1.item_id = t2.item_id
+        WHERE t1.create_time >= CONCAT(#{start},' 00:00:00')
+        and t1.create_time &lt;= CONCAT(#{end},' 23:59:59')
+        and t2.courier_number_time >= CONCAT(#{start},' 00:00:00')
+        GROUP BY t1.user_id
+        ) t2 on t.userId = t2.user_id ORDER BY t.orderNum desc
+    </select>
+
+
+    <select id="getBytedanceTopPromoterByItemId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        *
+        FROM
+        (
+        SELECT author_short_id AS 'promoterId',
+        author_short_name AS 'promoterNickName',
+        count(order_id) AS 'orderNum'
+        FROM bytedance_promoter_order_list
+        WHERE product_id = #{itemId}
+        AND author_bind_user_id is not null
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        GROUP BY author_bind_user_id) t
+        ORDER BY t.orderNum desc
+        limit 3
+    </select>
+
+
+    <select id="bytedanceOrderStatistics" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        DATE_FORMAT(t.pay_success_time , '%Y-%m-%d') AS 'date',
+        count(t.order_id) AS 'orderNum'
+        FROM (
+        SELECT
+        order_id,
+        pay_success_time
+        FROM bytedance_promoter_order_list
+        WHERE 1 = 1
+        <if test="promoterId != null and promoterId != ''">
+            and author_short_id = #{promoterId}
+        </if>
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        ) t
+        GROUP BY DATE_FORMAT(t.pay_success_time , '%Y-%m-%d')
+        ORDER BY DATE_FORMAT(t.pay_success_time , '%Y-%m-%d') asc
+    </select>
+
+
+    <select id="bytedanceItemDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT *
+        FROM (
+        SELECT
+        author_short_id AS 'promoterId',
+        author_short_name AS 'promoterNickName',
+        count(order_id) AS 'orderNum',
+        sum(case when flow_point = 'REFUND' then total_pay_amount else 0 end) AS 'payAmount',
+        CONCAT(round(colonel_commission_rate/100,2),'%') AS 'regimentalPromotionRate',
+        sum(case when flow_point = 'REFUND' then 1 else 0 end) AS 'validOrderNUm',
+        CONCAT(round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id)*100, 2),'%') as
+        'validRadio'
+        FROM bytedance_promoter_order_list
+        WHERE 1= 1
+        <if test="itemId != null and itemId != ''">
+            and product_id = #{itemId}
+        </if>
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="promoterId != null and promoterId != ''">
+            and author_short_id = #{promoterId}
+        </if>
+        <if test="promoterNickName != null and promoterNickName != ''">
+            and author_bind_user_name like CONCAT(CONCAT('%',#{promoterNickName}),'%')
+        </if>
+        GROUP BY author_bind_user_id) t
+        ORDER BY t.orderNum desc
+    </select>
+
+    <select id="bytedanceBDTotal" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t2.sampleCount,
+        t1.orderNum,
+        t1.validOrderNum,
+        t1.validOrderRate,
+        t1.orderAmount,
+        t1.regimentalPromotionAmount,
+        t1.totalRegimentalSettleAmount
+        FROM (
+        SELECT
+        count(order_id) AS 'orderNum',
+        t0.validOrderNUm,
+        CONCAT(round(t0.validOrderNUm / count(order_id) * 100, 2),'%') AS 'validOrderRate',
+        sum(total_pay_amount)/100 AS 'orderAmount',
+        sum(colonel_estimated_commission)/100 AS 'regimentalPromotionAmount',
+        sum(colonel_real_commission)/100 AS 'totalRegimentalSettleAmount'
+        FROM ruixuan.bytedance_promoter_order_list t
+        LEFT JOIN (
+        SELECT author_bind_user_id AS 'collectSampleId',
+        sum(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END) AS 'validOrderNUm'
+        FROM ruixuan.bytedance_promoter_order_list
+        WHERE author_bind_user_id is not null
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and author_bind_user_id = #{collectSampleId}
+        </if>
+        GROUP BY author_bind_user_id
+        ) t0 ON t.author_bind_user_id= t0.collectSampleId
+        WHERE 1 = 1
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and author_bind_user_id = #{collectSampleId}
+        </if>
+        ) t1
+        join (
+        SELECT
+        count(distinct item_id) AS 'sampleCount'
+        FROM kuaishou_item_collect_samples
+        WHERE collect_sample_status > 2
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and collect_sample_id = #{collectSampleId}
+        </if>
+        ) t2
+    </select>
+
+    <select id="bytedanceBDDetailList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        t1.promoterId,
+        t1.promoterName,
+        t1.promoterUrl,
+        t2.sampleCount,
+        t1.orderNum,
+        t1.validOrderNum,
+        t1.validOrderRate,
+        t1.orderAmount,
+        t1.regimentalPromotionAmount,
+        t1.totalRegimentalSettleAmount
+        FROM (
+        SELECT
+        author_short_id AS 'promoterId',
+        author_short_name AS 'promoterName',
+        author_short_url AS 'promoterUrl',
+        count(order_id) AS 'orderNum',
+        t0.validOrderNUm,
+        CONCAT(round(t0.validOrderNUm / count(order_id) * 100, 2),'%') AS 'validOrderRate',
+        sum(total_pay_amount)/100 AS 'orderAmount',
+        sum(colonel_estimated_commission)/100 AS 'regimentalPromotionAmount',
+        sum(colonel_real_commission)/100 AS 'totalRegimentalSettleAmount'
+        FROM ruixuan.bytedance_promoter_order_list t
+        LEFT JOIN (
+        SELECT author_bind_user_id AS 'collectSampleId',
+        sum(CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END) AS 'validOrderNUm'
+        FROM ruixuan.bytedance_promoter_order_list
+        WHERE author_short_id is not null
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and author_bind_user_id = #{collectSampleId}
+        </if>
+        GROUP BY author_bind_user_id
+        ) t0 ON t.author_bind_user_id= t0.collectSampleId
+        WHERE 1 = 1
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and author_bind_user_id = #{collectSampleId}
+        </if>
+        GROUP BY author_short_id) t1
+        LEFT JOIN (
+        SELECT
+        promoter_id AS 'promoterId',
+        count(distinct item_id) AS 'sampleCount'
+        FROM kuaishou_item_collect_samples
+        WHERE collect_sample_status > 2
+        <if test="collectSampleId != null and collectSampleId != ''">
+            and collect_sample_id = #{collectSampleId}
+        </if>
+        GROUP BY promoter_id) t2
+        on t1.promoterId = t2.promoterId
+        ORDER BY ${fieId} ${sort}
+    </select>
+
+    <select id="bytedanceUserItemTotal" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        count( t2.order_id ) AS 'orderNum',
+        sum( CASE WHEN t2.flow_point != 'REFUND' THEN 1 ELSE 0 END ) AS 'validOrderNUm',
+        CONCAT(round( sum( CASE WHEN t2.flow_point != 'REFUND' THEN 1 ELSE 0 END ) / count( t2.order_id )*100, 2),'%')
+        AS 'validRadio',
+        sum( CASE WHEN t2.flow_point = 'REFUND' THEN 1 ELSE 0 END ) AS 'invalidOrderNUm',
+        sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.total_pay_amount ELSE 0 END ) AS 'payAmount',
+        sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_estimated_commission ELSE 0 END ) AS
+        'regimentalPromotionAmount',
+        sum( CASE WHEN t2.flow_point != 'REFUND' THEN t2.colonel_real_commission ELSE 0 END ) AS
+        'totalRegimentalSettleAmount'
+        FROM bytedance_promoter_order_list t2
+        WHERE
+        1 = 1
+        <if test="start != null and start != ''">
+            and t2.pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and t2.pay_success_time &lt;= #{end}
+        </if>
+        <if test="userId != null and userId != ''">
+            AND t2.product_bind_user_id = #{userId}
+        </if>
+    </select>
+
+
+    <select id="bytedanceUserItemDetail" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT
+        product_bind_user_id AS 'user_id',
+        product_bind_user_name AS 'userName',
+        product_id AS 'itemId',
+        product_name AS 'itemTitle',
+        product_img AS 'imageUrl',
+        total_pay_amount/100 AS 'reservePrice',
+        count( order_id ) AS 'orderNum',
+        sum( CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END ) AS 'validOrderNUm',
+        CONCAT(round( sum( CASE WHEN flow_point != 'REFUND' THEN 1 ELSE 0 END ) / count( order_id )*100, 2),'%') AS
+        'validRadio',
+        sum( CASE WHEN flow_point = 'REFUND' THEN 1 ELSE 0 END ) AS 'invalidOrderNUm',
+        round( sum( CASE WHEN flow_point != 'REFUND' THEN total_pay_amount ELSE 0 END )/ 100, 2 ) AS 'payAmount',
+        CONCAT(round(colonel_commission_rate/100,2),'%') AS 'regimentalPromotionRate',
+        round( sum( CASE WHEN flow_point != 'REFUND' THEN colonel_estimated_commission ELSE 0 END ) / 100, 2 ) AS
+        'regimentalPromotionAmount',
+        round( sum( CASE WHEN flow_point != 'REFUND' THEN colonel_real_commission ELSE 0 END ) / 100, 2 ) AS
+        'totalRegimentalSettleAmount',
+        CONCAT(round(colonel_commission_rate/100,2),'%') AS 'itemCommissionRate'
+        FROM bytedance_promoter_order_list
+        WHERE
+        product_bind_user_id is not null
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="itemId != null and itemId != ''">
+            and product_id = #{itemId}
+        </if>
+        <if test="itemTitle != null and itemTitle != ''">
+            and product_name like CONCAT(CONCAT('%',#{itemTitle}),'%')
+        </if>
+        <if test="userId != null and userId != ''">
+            and product_bind_user_id = #{userId}
+        </if>
+        GROUP BY product_id
+        ORDER BY orderNum desc
+    </select>
+
+    <select id="exportBytedancePromoter" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT *
+        FROM (
+        SELECT
+        author_short_id AS 'promoterId',
+        author_short_name AS 'promoterNickName',
+        product_id AS 'itemId',
+        product_name AS 'itemTitle',
+        product_img AS 'imageUrl',
+        count(order_id) AS 'orderNum',
+        sum(case when flow_point != 'REFUND' then 1 else 0 end) AS 'validOrderNUm',
+        CONCAT(round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id)*100, 2),'%') AS
+        'validRadio'
+        FROM bytedance_promoter_order_list
+        WHERE author_short_id is not null
+        <if test="start != null and start != ''">
+            and pay_success_time &gt;= #{start}
+        </if>
+        <if test="end != null and end != ''">
+            and pay_success_time &lt;= #{end}
+        </if>
+        <if test="promoterId != null and promoterId != ''">
+            and author_short_id = #{promoterId}
+        </if>
+        <if test="promoterNickName != null and promoterNickName != ''">
+            and author_short_name like CONCAT(CONCAT('%',#{promoterNickName}),'%')
+        </if>
+        <if test="itemId != null and itemId != ''">
+            and product_id = #{itemId}
+        </if>
+        <if test="itemTitle != null and itemTitle != ''">
+            and product_name like CONCAT(CONCAT('%',#{itemTitle}),'%')
+        </if>
+        GROUP BY author_short_id,product_id) t
+        ORDER BY t.promoterId,t.itemId desc
+    </select>
+
+</mapper>

+ 5 - 4
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -128,8 +128,8 @@
         IF(t0.videoSales is null,t2.video_sales,t0.videoSales) AS 'videoSales',
         IF(t0.avgVideoSales is null,t2.avg_video_sales,t0.avgVideoSales) AS 'avgVideoSales'
         FROM
-        promoter_info t0
-        LEFT JOIN promoter_oerder_amount t1 ON t1.promoter_id = t0.promoter_id
+        promoter_oerder_amount t1
+        LEFT JOIN promoter_info t0 ON t1.promoter_id = t0.promoter_id
         <choose>
             <when test="userId !=null and userId !='' ">
                 RIGHT
@@ -481,11 +481,12 @@
     <insert id="addPromotersCount">
         replace
         into user_promoters_count
-        (user_id, promoters_count)
+        (user_id, promoters_count,media_id)
         values
         (
         #{userId},
-        #{promotersCount}
+        #{promotersCount},
+        #{mediaId},
         )
     </insert>
 </mapper>

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

@@ -1369,6 +1369,7 @@
         left join (
         select user_id,promoters_count
         from user_promoters_count
+        where media_id = 2
         ) t5
         on t1.collectSampleId = t5.user_id
         order by t1.orderNum desc