Quellcode durchsuchen

按照绑定日期查询渠道管理

yumeng vor 2 Jahren
Ursprung
Commit
89e25c2069

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

@@ -1616,6 +1616,8 @@ public class SupplyChainController extends BaseController {
     public TableDataInfo bdReportListV2(
             @ApiParam("开始时间") @RequestParam(value = "orderStartDate", required = false) String orderStartDate,
             @ApiParam("结束时间") @RequestParam(value = "orderEndDate", required = false) String orderEndDate,
+            @ApiParam("结束时间") @RequestParam(value = "bindStartDate", required = false) String bindStartDate,
+            @ApiParam("结束时间") @RequestParam(value = "bindEndDate", required = false) String bindEndDate,
             @ApiParam("用户ID") @RequestParam(value = "collectSampleId", required = false) Long collectSampleId) {
         Map<String, Object> requestMap = new HashMap<>();
         if (!Check.isNull(orderStartDate)) {
@@ -1629,6 +1631,16 @@ public class SupplyChainController extends BaseController {
         if (!Check.isNull(collectSampleId)) {
             requestMap.put("collectSampleId", collectSampleId);
         }
+
+        if (!Check.isNull(bindStartDate)) {
+            Integer start = DateUtils.getIntegerTime(bindStartDate);
+            requestMap.put("bindStartDate", start);
+        }
+        if (!Check.isNull(bindEndDate)) {
+            Integer end = DateUtils.getIntegerTime(bindEndDate);
+            requestMap.put("bindEndDate", end);
+        }
+
         TableDataInfo dataInfo = new TableDataInfo();
         if (Check.isNullMap(requestMap)) {
             dataInfo.setCode(500);
@@ -1636,7 +1648,12 @@ public class SupplyChainController extends BaseController {
             return dataInfo;
         }
         startPage();
-        List<JSONObject> list = supplyChainService.bdReportListV2(requestMap);
+        List<JSONObject> list = new ArrayList<>();
+        if (!Check.isNull(orderStartDate) && !Check.isNull(orderEndDate)) {
+            list = supplyChainService.bdReportListV2(requestMap);
+        } else if (!Check.isNull(bindStartDate) && !Check.isNull(bindEndDate)) {
+            list = supplyChainService.bdReportListV2ByBind(requestMap);
+        }
         return getDataTable(list);
     }
 

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

@@ -137,4 +137,5 @@ public interface SupplyChainMapper {
 
     List<JSONObject> getPromoterRatioListBytedance(Map<String, Object> requestMap);
 
+    List<JSONObject> bdReportListV2ByBind(Map<String, Object> requestMap);
 }

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

@@ -158,4 +158,6 @@ public interface ISupplyChainService {
     List<JSONObject> getPromoterRatioListBytedance(Map<String, Object> requestMap);
 
     JSONObject selectOrderInfoBytedance(List<String> promoterIds, Long startDate, Long endDate);
+
+    List<JSONObject> bdReportListV2ByBind(Map<String, Object> requestMap);
 }

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

@@ -271,6 +271,11 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
     }
 
     @Override
+    public List<JSONObject> bdReportListV2ByBind(Map<String, Object> requestMap) {
+        return supplyChainMapper.bdReportListV2ByBind(requestMap);
+    }
+
+    @Override
     public JSONObject getMonthOrderAmountTotal(Map<String, Object> map) {
         return supplyChainMapper.getMonthOrderAmountTotal(map);
     }

+ 75 - 2
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -554,8 +554,8 @@
         author_short_id as 'promoterId',
         author_account as 'promoterNickName',
         count(order_id) as 'orderNum',
-        sum(case when flow_point != 'REFUND'  then 1 else 0 end) as 'validOrderNUm',
-        round(sum(case when flow_point != 'REFUND'  then 1 else 0 end) / count(order_id),4) as 'validRadio'
+        sum(case when flow_point != 'REFUND' then 1 else 0 end) as 'validOrderNUm',
+        round(sum(case when flow_point != 'REFUND' then 1 else 0 end) / count(order_id),4) as 'validRadio'
         from bytedance_order_list
         where 1= 1
         <if test='promoterIds != null and promoterIds.size() > 0'>
@@ -2222,4 +2222,77 @@
         where t.orderNum > 0
         order by ${fieId} ${sort}
     </select>
+    <select id="bdReportListV2ByBind" resultType="com.alibaba.fastjson.JSONObject">
+        select t.*,
+        tt.promoterCount,
+        ttt.sampleCount,
+        tttt.sendTotalCount,
+        tttt.sendPromoterCount,
+        tttt.sendItemCount,
+        IFNULL(ttttt.promoters_count, '-') as 'promotersCount'
+        from (select t1.user_id as 'collectSampleId',
+        t1.user_name as 'collectSampleName',
+        sum(t2.order_num) as 'orderNum',
+        sum(t2.valid_order_num) as 'validOrderNum',
+        concat(round(sum(t2.valid_order_num) / sum(t2.order_num) * 100, 2), '%') as 'validOrderRate',
+        round(sum(t2.order_amount) / 100, 2) as 'orderAmount',
+        round(sum(t2.regimental_promotion_amount) / 100, 2) as 'regimentalPromotionAmount',
+        round(sum(t2.total_regimental_settle_amount) / 100, 2) as 'totalRegimentalSettleAmount'
+        from kuaishou_promoter t1
+        left join(select *
+        from canal_management
+        where stat_date &gt;= #{bindStartDate}) t2
+        on t1.promoter_id = t2.promoter_id
+        where 1 = 1
+        <if test="bindStartDate != null and bindStartDate != '' ">
+            and t1.create_time &gt;= str_to_date(concat(date_format(#{bindStartDate}, '%Y-%m-%d'), '00:00:01'),
+            '%Y-%m-%d %H:%i:%s')
+        </if>
+        <if test="bindEndDate != null and bindEndDate != '' ">
+            and t1.create_time &lt;= str_to_date(concat(date_format(#{bindEndDate}, '%Y-%m-%d'), '23:59:59'), '%Y-%m-%d
+            %H:%i:%s')
+        </if>
+        <if test="collectSampleId != null and collectSampleId != '' ">
+            and t1.user_id = #{collectSampleId}
+        </if>
+        group by t1.user_id) t
+        left join (select user_id,
+        count(distinct promoter_id) as 'promoterCount'
+        from kuaishou_promoter
+        where 1 = 1
+        <if test="collectSampleId != null and collectSampleId != '' ">
+            and user_id = #{collectSampleId}
+        </if>
+        group by user_id) tt on t.collectSampleId = tt.user_id
+        left join (select collect_sample_id as 'user_id',
+        count(distinct promoter_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 collect_sample_id) ttt on t.collectSampleId = ttt.user_id
+        left join (select collect_sample_id as 'user_id',
+        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>
+        group by collect_sample_id) tttt on t.collectSampleId = tttt.user_id
+        left join (select user_id, promoters_count
+        from user_promoters_count
+        where media_id = 2
+        <if test="collectSampleId != null and collectSampleId != '' ">
+            and user_id = #{collectSampleId}
+        </if>
+        ) ttttt
+        on t.collectSampleId = ttttt.user_id
+        order by t.orderNum desc
+
+
+    </select>
 </mapper>