瀏覽代碼

炸弹睿选达人激励

yumeng 1 年之前
父節點
當前提交
640919dd55

+ 21 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/settlementJob.java

@@ -106,6 +106,27 @@ public class settlementJob {
     }
 
 
+    @XxlJob("rocketCleanSettlementData")
+    public void rocketCleanSettlementData() {
+        String url = "http://rocket.api.tjyourong.com.cn/settlement/data";
+        String date = DateUtils.getLastDay(DateUtils.date2Str(), 1);
+        Long statDate = Long.valueOf(date.replace("-", ""));
+        List<JSONObject> list = ikuaishouSupplyChainService.getRocketDataList(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);
+        }
+
+    }
+
+
     @XxlJob("cleanPromoterSettlementData")
     public void cleanPromoterSettlementData() {
         String url = "http://ruixuan.api.tjyourong.com.cn/settlement/promoterData";

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

@@ -41,7 +41,10 @@ public interface KuaishouSupplyChainMapper extends BaseMapper<KuaishouSupplyChai
 
     List<JSONObject> getMgsDataList(@Param("statDate") Long statDate);
 
+    List<JSONObject> getRocketDataList(Long statDate);
+
     void deleteRocketPromoterBindChannelByDate(@Param("date") Long date);
 
     void cleanRocketKuaiShouPromoterBindChannel(@Param("date") Long date);
+
 }

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

@@ -252,5 +252,38 @@ group by t1.promoter_id;
                            on t.ruleId = tt.id
 
     </select>
+    <select id="getRocketDataList" resultType="com.alibaba.fastjson.JSONObject" parameterType="java.lang.Long">
+        select t.*, tt.rule_type
+        from (select *
+              from (select t1.relate_id                                 as 'relateId',
+                            (case
+                                 when t2.rule_id is not null
+                                     then t2.rule_id
+                                 else 1
+                                end
+                                )                                        as 'ruleId',
+                            group_concat(t1.item_id)                     as 'itemIds',
+                            t1.promoter_id                               as 'promoterId',
+                            t1.promoter_name                             as 'promoterName',
+                            t1.item_create_id                            as 'itemCreateId',
+                            t1.item_create_name                          as 'itemCreateName',
+                            t1.promoter_create_id                        as 'promoterCreateId',
+                            t1.promoter_create_name                      as 'promoterCreateName',
+                            ifnull(sum(t1.order_num), 0)                 as 'orderNum',
+                            ifnull(sum(t1.valid_order_num), 0)           as 'validOrderNum',
+                            ifnull(sum(t1.yesterday_order_num), 0)       as 'yesterdayOrderNum',
+                            ifnull(sum(t1.yesterday_valid_order_num), 0) as 'yesterdayValidOrderNum',
+                            t1.stat_date                                 as 'statDate',
+                            round(t2.item_price / 100, 2)                as 'itemPrice'
+                    from rocket.kuaishou_rule_order_data t1
+                             left join rocket.kuaishou_item_list t2 on t1.item_id = t2.item_id
+                    where t1.stat_date = #{statDate}
+                      and t1.relate_id is not null
+                    group by t1.relate_id, t1.promoter_id) t
+              where t.itemPrice >= 6
+              order by t.validOrderNum desc) t
+                 left join rocket.kuaishou_settlement_rules tt
+                           on t.ruleId = tt.id
+    </select>
 
 </mapper>

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

@@ -41,4 +41,6 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
     void deleteRocketPromoterBindChannelByDate(Long date);
 
     void cleanRocketKuaiShouPromoterBindChannel(Long date);
+
+    List<JSONObject> getRocketDataList(Long statDate);
 }

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

@@ -244,6 +244,12 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         return supplyChainMapper.getMgsDataList(statDate);
     }
 
+
+    @Override
+    public List<JSONObject> getRocketDataList(Long statDate) {
+        return supplyChainMapper.getRocketDataList(statDate);
+    }
+
     @Override
     public void deleteRocketPromoterBindChannelByDate(Long date) {
          supplyChainMapper.deleteRocketPromoterBindChannelByDate(date);
@@ -254,6 +260,8 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
         supplyChainMapper.cleanRocketKuaiShouPromoterBindChannel(date);
     }
 
+
+
     public static String filterSupplement(String content) {
         StringBuilder sb = new StringBuilder();
         for (char ch : content.toCharArray()) {