From 651f2856e9ae10aacbfb8327d967aacbb6d58333 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 12 四月 2023 18:13:58 +0800
Subject: [PATCH] 大淘客API修复/唯品会订单爬取策略修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
index c2e3091..c707697 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderMoneySettleServiceImpl.java
@@ -164,6 +164,13 @@
         inviteSettle(uid, sourceType, maxPregetTime);
     }
 
+    @Override
+    public void inviteSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
+        // 鏌ヨUID鐨勪竴浜岀骇閭�璇疯禋
+        int sourceType = Constant.SOURCE_TYPE_DY;
+        inviteSettle(uid, sourceType, maxPregetTime);
+    }
+
 
     @Transactional(rollbackFor = Exception.class)
     @Override
@@ -276,7 +283,7 @@
                 @Override
                 public TransactionStatus execute(Message arg0, Object arg1) {
                     try {
-                        fanLiShareTB(hongBaoList, uid, taskKey);
+                        fanLiShareTB(hongBaoList, uid, taskKey,maxPregetTime);
                     } catch (TaoBaoWeiQuanException e) {
                         return TransactionStatus.RollbackTransaction;
                     }
@@ -320,7 +327,7 @@
             orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
                 @Override
                 public TransactionStatus execute(Message arg0, Object arg1) {
-                    fanLiShareOther(hongBaoList, uid, sourceType, taskKey);
+                    fanLiShareOther(hongBaoList, uid, sourceType, taskKey,maxPregetTime);
                     return TransactionStatus.CommitTransaction;
                 }
             }, null);
@@ -345,6 +352,11 @@
     @Override
     public void shareSettleSuning(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
         shareSettle(Constant.SOURCE_TYPE_SUNING, uid, maxPregetTime);
+    }
+
+    @Override
+    public void shareSettleDY(Long uid, Date maxPregetTime) throws OrderMoneySettleException {
+        shareSettle(Constant.SOURCE_TYPE_DY, uid, maxPregetTime);
     }
 
     private void shareSettle(int sourceType, Long uid, Date maxPregetTime) throws OrderMoneySettleException {
@@ -376,7 +388,7 @@
             orderTransactionProducer.send(msg, new LocalTransactionExecuter() {
                 @Override
                 public TransactionStatus execute(Message arg0, Object arg1) {
-                    fanLiShareOther(hongBaoList, uid, sourceType, taskKey);
+                    fanLiShareOther(hongBaoList, uid, sourceType, taskKey,maxPregetTime);
                     return TransactionStatus.CommitTransaction;
                 }
             }, null);
@@ -396,6 +408,9 @@
         Map<Long, Integer> userGoodsCount = new HashMap<>();
         for (CommonOrder co : orderList) {
             HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(co.getId());
+            if (hongBaoOrder == null) {
+                continue;
+            }
             hongBaoList.add(hongBaoOrder.getHongBaoV2());
             Long uid = co.getUserInfo().getId();
             if (userGoodsCount.get(uid) == null)
@@ -599,7 +614,7 @@
      * @param uid
      * @throws TaoBaoWeiQuanException
      */
-    private void fanLiShareTB(List<HongBaoV2> hongBaoList, Long uid, String key) throws TaoBaoWeiQuanException {
+    private void fanLiShareTB(List<HongBaoV2> hongBaoList, Long uid, String key,Date recieveMonth) throws TaoBaoWeiQuanException {
         BigDecimal sharemoney = new BigDecimal(0);
         List<Long> hbIdList = new ArrayList<>();
         Set<String> drawBackOrders = new HashSet<String>();
@@ -644,7 +659,7 @@
             // 娣诲姞鏂扮増璇︽儏璁板綍
             try {
                 UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, Constant.SOURCE_TYPE_TAOBAO,
-                        sharemoney, new Date());
+                        sharemoney,recieveMonth);
                 // 娣诲姞璧勯噾
                 userMoneyService.addUserMoney(uid, sharemoney, userMoneyDetail);
 
@@ -689,7 +704,7 @@
      * @param uid
      * @param sourceType
      */
-    private void fanLiShareOther(List<HongBaoV2> hongBaoList, Long uid, int sourceType, String key) {
+    private void fanLiShareOther(List<HongBaoV2> hongBaoList, Long uid, int sourceType, String key,Date recieveMonth) {
         BigDecimal sharemoney = new BigDecimal(0);
         List<Long> hbIdList = new ArrayList<>();
         List<Long> recieveHongBaoIds = new ArrayList<>();
@@ -725,7 +740,7 @@
             // 娣诲姞鏂扮増璇︽儏璁板綍
             try {
                 UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, sourceType, sharemoney,
-                        new Date());
+                        recieveMonth);
                 // 娣诲姞璧勯噾
                 userMoneyService.addUserMoney(uid, sharemoney, userMoneyDetail);
 

--
Gitblit v1.8.0