Explorar o código

Merge remote-tracking branch 'origin/master'

zhaoxian hai 1 ano
pai
achega
3451afcaa1

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

@@ -84,6 +84,28 @@ public class settlementJob {
     }
 
 
+
+    @XxlJob("mgsCleanSettlementData")
+    public void mgsCleanSettlementData() {
+        String url = "http://mgs.api.tjyourong.com.cn/settlement/data";
+        String date = DateUtils.getLastDay(DateUtils.date2Str(), 1);
+        Long statDate = Long.valueOf(date.replace("-", ""));
+        List<JSONObject> list = ikuaishouSupplyChainService.getMgsDataList(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";

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

@@ -38,4 +38,6 @@ public interface KuaishouSupplyChainMapper extends BaseMapper<KuaishouSupplyChai
     void deleteMgsPromoterBindChannelByDate(@Param("date") Long date);
 
     void cleanMgsKuaiShouPromoterBindChannel(@Param("date") Long date);
+
+    List<JSONObject> getMgsDataList(@Param("statDate") Long statDate);
 }

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

@@ -200,5 +200,39 @@ group by t1.promoter_id;
         group by t1.promoter_id
 
     </select>
+    <select id="getMgsDataList" 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 miaogousi.kuaishou_rule_order_data t1
+                             left join miaogousi.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 miaogousi.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

@@ -35,4 +35,6 @@ public interface IKuaishouSupplyChainService extends IService<KuaishouSupplyChai
     void deleteMgsPromoterBindChannelByDate(Long date);
 
     void cleanMgsKuaiShouPromoterBindChannel(Long date);
+
+    List<JSONObject> getMgsDataList(Long statDate);
 }

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

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