浏览代码

根据达人结算

yumeng 1 年之前
父节点
当前提交
b28c3d34dc

+ 20 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/settlementJob.java

@@ -33,10 +33,8 @@ public class settlementJob {
         String date = DateUtils.getLastDay(DateUtils.date2Str(), 1);
         Long statDate = Long.valueOf(date.replace("-", ""));
         List<JSONObject> list = ikuaishouSupplyChainService.getDataList(statDate);
-
         if (Check.isNull(list)) {
             return;
-
         }
         List<List<JSONObject>> partition = Lists.partition(list, 1000);
         for (int i = 0; i < partition.size(); i++) {
@@ -51,5 +49,25 @@ public class settlementJob {
 
 
 
+    @XxlJob("cleanPromoterSettlementData")
+    public void cleanPromoterSettlementData() {
+        String url = "http://ruixuan.api.tjyourong.com.cn/settlement/promoterData";
+        String date = DateUtils.getLastDay(DateUtils.date2Str(), 1);
+        Long statDate = Long.valueOf(date.replace("-", ""));
+        List<JSONObject> list = ikuaishouSupplyChainService.getPromoterDataList(statDate);
+        if (Check.isNull(list)) {
+            return;
+        }
+        List<List<JSONObject>> partition = Lists.partition(list, 1000);
+        for (int i = 0; i < partition.size(); i++) {
+            List<JSONObject> jsonObjects = partition.get(i);
+            Map<String, Object> param = new HashMap<>();
+            param.put("statDate", statDate);
+            param.put("data", jsonObjects);
+            HttpUtils.httpPostRequest(url, param, null);
+        }
+
+    }
+
 
 }

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/KuaishouSupplyChainMapper.java

@@ -24,4 +24,6 @@ public interface KuaishouSupplyChainMapper extends BaseMapper<KuaishouSupplyChai
     void replaceSettlement(@Param(value = "adds") List<KuaishouSupplyChainSettlement> supplyChains);
 
     List<JSONObject> getDataList(@Param("statDate") Long statDate);
+
+    List<JSONObject> getPromoterDataList(@Param("statDate") Long statDate);
 }

+ 24 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/mapper/xml/KuaishouSupplyChainMapper.xml

@@ -118,6 +118,30 @@
       order by t.validOrderNum desc) t
          left join ruixuan.kuaishou_settlement_rules tt
                    on t.ruleId = tt.id
+                   where  1 = 1
+     and t.promoterId not in(
+    select  promoter_id  from promoter_bind_rule where 1 =  1)
+    </select>
+    <select id="getPromoterDataList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
+select t1.rule_id                                   as 'ruleId',
+       t1.promoter_id                               as 'promoterId',
+       t2.promoter_name                             as 'promoterName',
+       ifnull(sum(t2.order_num), 0)                 as 'orderNum',
+       ifnull(sum(t2.valid_order_num), 0)           as 'validOrderNum',
+       ifnull(sum(t2.yesterday_order_num), 0)       as 'yesterdayOrderNum',
+       ifnull(sum(t2.yesterday_valid_order_num), 0) as 'yesterdayValidOrderNum',
+       t2.stat_date                                 as 'statDate',
+       3                                            as 'rule_type',
+       t3.item_price                                as 'itemPrice'
+
+from promoter_bind_rule t1
+         left join kuaishou_rule_order_data t2 on t1.promoter_id = t2.promoter_id
+         left join kuaishou_item_list t3 on t2.item_id = t3.item_id
+where 1 = 1
+  and t2.stat_date =  #{statDate}
+  and t3.item_price >= 600
+group by t1.promoter_id;
+
 
     </select>
 

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/IKuaishouSupplyChainService.java

@@ -21,4 +21,6 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
     void getSettlementData(String cookie, Integer offset, Long orderCreateTimeStart, Long orderCreateTimeEnd) throws Exception;
 
     List<JSONObject> getDataList(Long statDate);
+
+    List<JSONObject> getPromoterDataList(Long statDate);
 }

+ 5 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouSupplyChainServiceImpl.java

@@ -189,6 +189,11 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         return supplyChainMapper.getDataList(statDate);
     }
 
+    @Override
+    public List<JSONObject> getPromoterDataList(Long statDate) {
+        return supplyChainMapper.getPromoterDataList(statDate);
+    }
+
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();
         for (char ch : content.toCharArray()) {