yumeng 11 hónapja
szülő
commit
538f704619

+ 15 - 17
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/TestController.java

@@ -160,7 +160,8 @@ public class TestController {
     @Autowired
     private IKuaiShouActivityItemListService activityItemListService;
 
-
+    @Autowired
+    private IJiaoYangFenXiaoService jiaoYangFenXiaoService;
 
 
 
@@ -170,17 +171,20 @@ public class TestController {
     @GetMapping(value = "/getData")
     public void getDate(String startDate, String endDate) throws Exception {
 
-        log.info("-------------------------获取快分销订单当前月数据开始数据开始--------------------------");
-        List<JSONObject> cookies = mgskuaishouSupplyChainService.getCookie();
+        //   List<String> dateList = new ArrayList<>();
+        Map<String, String> monthStartAndEnd = DateUtils.getMonthStartAndEnd();
+        String firstDay = monthStartAndEnd.get("firstDay");
+        String lastDay = monthStartAndEnd.get("lastDay");
+        List<String> days = DateUtils.getDays("2024-06-03", "2024-06-30");
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
         if (Check.isNull(cookies)) {
             log.error("cookie数据为空");
             return;
         }
 
-        List<String> days = DateUtils.getDays("2024-02-25", "2024-03-05");
+
         JSONArray hourList = KuaishouHourEnum.getHourList();
         JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
-        Map<Long, Long> itemMap = activityItemListService.getItemMap();
         for (int z = 0; z < days.size(); z++) {
             String date = days.get(z);
             for (int i = 0; i < hourList.size(); i++) {
@@ -191,25 +195,19 @@ public class TestController {
                     String endTime = minSecJson.getString("endTime");
                     String start = date + hour + startTime;
                     String end = date + hour + endTime;
+                    System.err.println("开始时间:" + start);
+                    System.err.println("结束时间:" + end);
                     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                     Long orderCreateTimeStart = sdf.parse(start).getTime();
                     Long orderCreateTimeEnd = sdf.parse(end).getTime();
                     for (int p = 0; p < cookies.size(); p++) {
                         JSONObject cookieJson = cookies.get(p);
                         String cookie = cookieJson.getString("cookie");
-                        videoService.submit(new Runnable() {
-                            @Override
-                            public void run() {
-                                try {
-                                    mgskuaishouSupplyChainService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd, itemMap);
-                                } catch (Exception e) {
-                                    e.printStackTrace();
-                                }
-                            }
-                        });
+                        jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
                     }
                 }
             }
+
         }
     }
 
@@ -1884,7 +1882,7 @@ public class TestController {
         refreshTokenService.getLiveKuaiShouAgentRefresh();
     }
 
-    public void save() {
+   /* public void save() {
         JSONObject people = new JSONObject();
         people.put("_id","zhao");
         people.put("name","an");
@@ -1905,5 +1903,5 @@ public class TestController {
         System.out.println("条件筛选结果:" + list);
         System.out.println("----All结果:" + all);
         log.info("find ok");
-    }
+    }*/
 }

+ 4 - 2
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/CheckSupplyChainJob.java

@@ -20,11 +20,13 @@ public class CheckSupplyChainJob {
     public void execute() throws Exception {
         String today = DateUtils.date2Str();
         //昨天
-        String yesterday = DateUtils.getLastDay(today, 1);
+        String yesterday = DateUtils.getLastDay(today, 2);
         Map<String, Object> paramMap = new HashMap<String, Object>();
         paramMap.put("endDate", today);
         paramMap.put("beginDate", yesterday);
         HttpUtils.httpGet("http://ruixuan.api.tjyourong.com.cn/isv/supply_chain/addList", paramMap, null);
-        XxlJobHelper.log(" --------供应链-快分销数据,执行完成-------- "+paramMap.toString());
+        XxlJobHelper.log(" --------供应链-快分销更新发货状态数据,执行完成-------- " + paramMap.toString());
     }
+
+
 }

+ 49 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/JiaoYangFenXiaoJob.java

@@ -376,4 +376,53 @@ public class JiaoYangFenXiaoJob {
     }
 
 
+
+    // 前7 14 21 30 天数据获取
+    @XxlJob("jyAppointYesterdayOrderGet")
+    public void jyAppointYesterdayOrderGet() throws Exception {
+        log.info("-------------------------获取快分销订单前日数据开始数据开始--------------------------");
+        List<JSONObject> cookies = jiaoYangFenXiaoService.getCookie();
+        if (Check.isNull(cookies)) {
+            log.error("cookie数据为空");
+            return;
+        }
+        String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
+        String date7 = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -7);
+        String date14 = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -14);
+        String date21 = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -21);
+        String date30 = DateUtils.getAnotherDay("yyyy-MM-dd", nowDate, -30);
+        List<String> days = new ArrayList<>();
+        days.add(date7);
+        days.add(date14);
+        days.add(date21);
+        days.add(date30);
+        JSONArray hourList = KuaishouHourEnum.getHourList();
+        JSONArray minSecList = KuaishouMinSecEnum.getMinSecList();
+        for (int z = 0; z < days.size(); z++) {
+            String date = days.get(z);
+            for (int i = 0; i < hourList.size(); i++) {
+                String hour = hourList.getString(i);
+                for (int j = 0; j < minSecList.size(); j++) {
+                    JSONObject minSecJson = minSecList.getJSONObject(j);
+                    String startTime = minSecJson.getString("startTime");
+                    String endTime = minSecJson.getString("endTime");
+                    String start = date + hour + startTime;
+                    String end = date + hour + endTime;
+                    System.err.println("开始时间:" + start);
+                    System.err.println("结束时间:" + end);
+                    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                    Long orderCreateTimeStart = sdf.parse(start).getTime();
+                    Long orderCreateTimeEnd = sdf.parse(end).getTime();
+                    for (int p = 0; p < cookies.size(); p++) {
+                        JSONObject cookieJson = cookies.get(p);
+                        String cookie = cookieJson.getString("cookie");
+                        jiaoYangFenXiaoService.getOrderList(cookie, 0, orderCreateTimeStart, orderCreateTimeEnd);
+                    }
+                }
+            }
+
+        }
+    }
+
+
 }

+ 21 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/entity/vo/ItemCheck.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.kuaishou.modules.batch.entity.vo;
+
+import lombok.Data;
+
+
+@Data
+public class ItemCheck {
+
+    private String _id;
+
+    private String ownership;
+
+
+    public ItemCheck() {
+    }
+
+    public ItemCheck(String id, String ownership) {
+        this._id = id;
+        this.ownership = ownership;
+    }
+}

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

@@ -30,4 +30,10 @@ public interface RocketSupplyChainMapper extends BaseMapper<KuaishouSupplyChain>
     List<JSONObject> getSamplesData(@Param("startDate") String startDate);
 
     void cleanBytedancePromoterBindChannel(@Param("date") Long date);
+
+    void replaceRuixuanSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> ruixuanSupplyChains);
+
+    void replaceMgsSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> mgsSupplyChains);
+
+    void replaceRocketSupplyChains(@Param(value = "adds") List<KuaishouSupplyChain> mgsSupplyChains);
 }

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

@@ -99,6 +99,207 @@
         group by t1.promoter_id
 
     </insert>
+    <insert id="replaceRuixuanSupplyChains">
+        replace into ruixuan.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+
+
+    </insert>
+    <insert id="replaceMgsSupplyChains">
+        replace into miaogousi.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+    </insert>
+    <insert id="replaceRocketSupplyChains">
+        replace into rocket.kuaishou_supply_chain(
+        id,
+        oid,
+        item_id,
+        item_title,
+        reserve_price,
+        image_url,
+        order_status,
+        order_create_time,
+        send_status,
+        settlement_biz_type,
+        settlement_biz_type_desc,
+        send_time,
+        recv_time,
+        seller_id,
+        promoter_id,
+        promoter_nick_name,
+        activity_id,
+        order_amount,
+        pay_amount,
+        regimental_promotion_rate,
+        share_rate,
+        base_amount,
+        service_amount,
+        regimental_promotion_amount,
+        total_regimental_settle_amount,
+        stat_date,
+        stat_hour,
+        item_commission_rate
+        )
+        values
+        <foreach collection="adds" item="add" separator=",">
+            (
+            #{add.id},
+            #{add.oid},
+            #{add.itemId},
+            #{add.itemTitle},
+            #{add.reservePrice},
+            #{add.imageUrl},
+            #{add.orderStatus},
+            #{add.orderCreateTime},
+            #{add.sendStatus},
+            #{add.settlementBizType},
+            #{add.settlementBizTypeDesc},
+            #{add.sendTime},
+            #{add.recvTime},
+            #{add.sellerId},
+            #{add.promoterId},
+            #{add.promoterNickName},
+            #{add.activityId},
+            #{add.orderAmount},
+            #{add.payAmount},
+            #{add.regimentalPromotionRate},
+            #{add.shareRate},
+            #{add.baseAmount},
+            #{add.serviceAmount},
+            #{add.regimentalPromotionAmount},
+            #{add.totalRegimentalSettleAmount},
+            #{add.statDate},
+            #{add.statHour},
+            #{add.itemCommissionRate}
+            )
+
+        </foreach>
+
+    </insert>
     <delete id="deletePromoterBindChannelByDate" parameterType="java.lang.Long">
         delete from rocket.promoter_bind_channel_date where stat_date = #{date}
     </delete>

+ 7 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/JiaoYangFenXiaoServiceImpl.java

@@ -128,7 +128,13 @@ public class JiaoYangFenXiaoServiceImpl implements IJiaoYangFenXiaoService {
             order.setMcnSettlementAmount(jsonObject.getLong("mcnSettlementAmount"));
             orders.add(order);
         }
-        jiaoYangFenXiaoMapper.replace(orders);
+        try {
+            if (!Check.isNull(orders)) {
+                jiaoYangFenXiaoMapper.replace(orders);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
         if (list.size() >= 20) {
             getOrderList(cookie, offset + 20, orderCreateTimeStart, orderCreateTimeEnd);
         }

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

@@ -6,13 +6,18 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChainSettlement;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ItemCheck;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouSupplyChainMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.RocketSupplyChainMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouSupplyChainService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -38,6 +43,10 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
     private ISendMessageService sendMessageService;
     @Autowired
     private KuaishouSupplyChainMapper supplyChainMapper;
+    @Autowired
+    private MongoTemplate mongoTemplate;
+    @Autowired
+    private RocketSupplyChainMapper rocketSupplyChainMapper;
 
     public static void main(String[] args) {
         System.err.println(DateUtils.tempToLongDateStr(1706112000000L));
@@ -87,13 +96,17 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
             return;
         }
         log.info("快分销当前数据条数:{}", list.size());
-        List<KuaishouSupplyChain> supplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {
             JSONObject jsonObject = list.getJSONObject(i);
             KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
             supplyChain.setOid(jsonObject.getLong("oid"));
             JSONObject item = jsonObject.getJSONArray("itemList").getJSONObject(0);
+            Long itemId = null;
             if (!Check.isNull(item)) {
+                itemId = item.getLong("itemId");
                 supplyChain.setItemId(item.getLong("itemId"));
                 supplyChain.setItemTitle(item.getString("itemTitle"));
                 supplyChain.setReservePrice(item.getLong("reservePrice"));
@@ -121,10 +134,40 @@ public class KuaishouSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyCh
             supplyChain.setStatDate(DateUtils.tempToDate(jsonObject.getLong("orderCreateTime")));
             supplyChain.setStatHour(DateUtils.getHour(jsonObject.getLong("orderCreateTime")));
             supplyChain.setItemCommissionRate(itemMap.get(item.getLong("itemId")));
-            supplyChains.add(supplyChain);
+            Criteria criteria = new Criteria();
+            criteria = Criteria.where("_id").is(itemId);
+            Query query = new Query(criteria);
+            ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
+            if (Check.isNull(itemCheck)) {
+                ruixuanSupplyChains.add(supplyChain);
+            }
+            if (!Check.isNull(itemCheck)) {
+                String ownership = itemCheck.getOwnership();
+                if ("ruixuan".equals(ownership)) {
+                    ruixuanSupplyChains.add(supplyChain);
+                }
+                if ("miaogousi".equals(ownership)) {
+                    mgsSupplyChains.add(supplyChain);
+                }
+
+                if ("rocket".equals(ownership)) {
+                    rocketSupplyChains.add(supplyChain);
+                }
+            }
+
         }
         try {
-            supplyChainMapper.replace(supplyChains);
+            if (!Check.isNull(ruixuanSupplyChains)) {
+                rocketSupplyChainMapper.replaceRuixuanSupplyChains(ruixuanSupplyChains);
+            }
+
+            if (!Check.isNull(mgsSupplyChains)) {
+                rocketSupplyChainMapper.replaceMgsSupplyChains(mgsSupplyChains);
+            }
+
+            if (!Check.isNull(rocketSupplyChains)) {
+                rocketSupplyChainMapper.replaceRocketSupplyChains(mgsSupplyChains);
+            }
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 46 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/MgsSupplyChainServiceImpl.java

@@ -6,8 +6,10 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChainSettlement;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ItemCheck;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouSupplyChainMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.MgsSupplyChainMapper;
+import cn.com.ctop.kuaishou.modules.batch.mapper.RocketSupplyChainMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouSupplyChainService;
 import cn.com.ctop.kuaishou.modules.batch.service.IMgsSupplyChainService;
 import com.alibaba.fastjson.JSONArray;
@@ -16,6 +18,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -39,6 +44,10 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
     private ISendMessageService sendMessageService;
     @Autowired
     private MgsSupplyChainMapper mgsSupplyChainMapper;
+    @Autowired
+    private MongoTemplate mongoTemplate;
+    @Autowired
+    private RocketSupplyChainMapper rocketSupplyChainMapper;
 
     public static void main(String[] args) {
         System.err.println(DateUtils.tempToLongDateStr(1706112000000L));
@@ -88,13 +97,17 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
             return;
         }
         log.info("mgs当前数据条数:{}", list.size());
-        List<KuaishouSupplyChain> supplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {
             JSONObject jsonObject = list.getJSONObject(i);
             KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
             supplyChain.setOid(jsonObject.getLong("oid"));
             JSONObject item = jsonObject.getJSONArray("itemList").getJSONObject(0);
+            Long itemId = null;
             if (!Check.isNull(item)) {
+                itemId = item.getLong("itemId");
                 supplyChain.setItemId(item.getLong("itemId"));
                 supplyChain.setItemTitle(item.getString("itemTitle"));
                 supplyChain.setReservePrice(item.getLong("reservePrice"));
@@ -122,10 +135,40 @@ public class MgsSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChainMa
             supplyChain.setStatDate(DateUtils.tempToDate(jsonObject.getLong("orderCreateTime")));
             supplyChain.setStatHour(DateUtils.getHour(jsonObject.getLong("orderCreateTime")));
             supplyChain.setItemCommissionRate(itemMap.get(item.getLong("itemId")));
-            supplyChains.add(supplyChain);
+
+            Criteria criteria = new Criteria();
+            criteria = Criteria.where("_id").is(itemId);
+            Query query = new Query(criteria);
+            ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
+            if (Check.isNull(itemCheck)) {
+                mgsSupplyChains.add(supplyChain);
+            }
+            if (!Check.isNull(itemCheck)) {
+                String ownership = itemCheck.getOwnership();
+                if ("ruixuan".equals(ownership)) {
+                    ruixuanSupplyChains.add(supplyChain);
+                }
+                if ("miaogousi".equals(ownership)) {
+                    mgsSupplyChains.add(supplyChain);
+                }
+                if ("rocket".equals(ownership)) {
+                    rocketSupplyChains.add(supplyChain);
+                }
+            }
         }
         try {
-            mgsSupplyChainMapper.replace(supplyChains);
+            if (!Check.isNull(ruixuanSupplyChains)) {
+                rocketSupplyChainMapper.replaceRuixuanSupplyChains(ruixuanSupplyChains);
+            }
+
+            if (!Check.isNull(mgsSupplyChains)) {
+                rocketSupplyChainMapper.replaceMgsSupplyChains(mgsSupplyChains);
+            }
+
+            if (!Check.isNull(rocketSupplyChains)) {
+                rocketSupplyChainMapper.replaceRocketSupplyChains(mgsSupplyChains);
+            }
+
         } catch (Exception e) {
             e.printStackTrace();
         }

+ 45 - 4
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/RocketSupplyChainServiceImpl.java

@@ -6,6 +6,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChain;
 import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouSupplyChainSettlement;
+import cn.com.ctop.kuaishou.modules.batch.entity.vo.ItemCheck;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaishouSupplyChainMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.RocketSupplyChainMapper;
 import cn.com.ctop.kuaishou.modules.batch.service.RocketSupplyChainService;
@@ -15,6 +16,9 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.util.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.MongoTemplate;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -38,6 +42,8 @@ public class RocketSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChai
     private ISendMessageService sendMessageService;
     @Autowired
     private RocketSupplyChainMapper rocketSupplyChainMapper;
+    @Autowired
+    private MongoTemplate mongoTemplate;
 
     public static void main(String[] args) {
         System.err.println(DateUtils.tempToLongDateStr(1706112000000L));
@@ -87,14 +93,18 @@ public class RocketSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChai
             return;
         }
         log.info("rocket当前数据条数:{}", list.size());
-        List<KuaishouSupplyChain> supplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> ruixuanSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> mgsSupplyChains = new ArrayList<>();
+        List<KuaishouSupplyChain> rocketSupplyChains = new ArrayList<>();
         for (int i = 0; i < list.size(); i++) {
             JSONObject jsonObject = list.getJSONObject(i);
             KuaishouSupplyChain supplyChain = new KuaishouSupplyChain();
             supplyChain.setOid(jsonObject.getLong("oid"));
             JSONObject item = jsonObject.getJSONArray("itemList").getJSONObject(0);
+            Long itemId = null;
             if (!Check.isNull(item)) {
-                supplyChain.setItemId(item.getLong("itemId"));
+                itemId = item.getLong("itemId");
+                supplyChain.setItemId(itemId);
                 supplyChain.setItemTitle(item.getString("itemTitle"));
                 supplyChain.setReservePrice(item.getLong("reservePrice"));
                 supplyChain.setImageUrl(item.getString("imageUrl"));
@@ -121,10 +131,41 @@ public class RocketSupplyChainServiceImpl extends ServiceImpl<KuaishouSupplyChai
             supplyChain.setStatDate(DateUtils.tempToDate(jsonObject.getLong("orderCreateTime")));
             supplyChain.setStatHour(DateUtils.getHour(jsonObject.getLong("orderCreateTime")));
             supplyChain.setItemCommissionRate(itemMap.get(item.getLong("itemId")));
-            supplyChains.add(supplyChain);
+            Criteria criteria = new Criteria();
+            criteria = Criteria.where("_id").is(itemId);
+            Query query = new Query(criteria);
+            ItemCheck itemCheck = mongoTemplate.findOne(query, ItemCheck.class);
+            if (Check.isNull(itemCheck)) {
+                rocketSupplyChains.add(supplyChain);
+            }
+            if (!Check.isNull(itemCheck)) {
+                String ownership = itemCheck.getOwnership();
+                if ("ruixuan".equals(ownership)) {
+                    ruixuanSupplyChains.add(supplyChain);
+                }
+                if ("miaogousi".equals(ownership)) {
+                    mgsSupplyChains.add(supplyChain);
+                }
+                if ("rocket".equals(ownership)) {
+                    rocketSupplyChains.add(supplyChain);
+                }
+            }
+
         }
         try {
-            rocketSupplyChainMapper.replace(supplyChains);
+            if (!Check.isNull(ruixuanSupplyChains)) {
+                rocketSupplyChainMapper.replaceRuixuanSupplyChains(ruixuanSupplyChains);
+            }
+
+            if (!Check.isNull(mgsSupplyChains)) {
+                rocketSupplyChainMapper.replaceMgsSupplyChains(mgsSupplyChains);
+            }
+
+            if (!Check.isNull(rocketSupplyChains)) {
+                rocketSupplyChainMapper.replaceRocketSupplyChains(mgsSupplyChains);
+            }
+
+
         } catch (Exception e) {
             e.printStackTrace();
         }