yumeng 1 year ago
parent
commit
3eb482c334

+ 8 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/controller/SupplyChainController.java

@@ -1896,7 +1896,14 @@ public class SupplyChainController extends BaseController {
                 @Override
                 public void run() {
                     try {
-                        supplyChainService.updateOrder(eventJSon);
+                        if(!Check.isNull(eventJSon)){
+                            String event = eventJSon.getString("event");
+                            if("kwaishop_distribute_order_change_notify".equals(event)){
+                                supplyChainService.updateOrder(eventJSon);
+                            }else if("kwaishop_distribute_activity_item_change".equals(event)){
+                                supplyChainService.updateItem(eventJSon);
+                            }
+                        }
                     } catch (Exception e) {
                         e.printStackTrace();
                     }

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/SupplyChainMapper.java

@@ -147,4 +147,6 @@ public interface SupplyChainMapper {
     void replaceAll(@Param("list") List<KuaishouSupplyChain> list);
 
     void updateOrder(@Param("oid") Long oid, @Param("cpsOrderStatus") Integer cpsOrderStatus);
+
+    void updateItem(@Param("itemId") Long itemId, @Param("status") Integer status);
 }

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/ISupplyChainService.java

@@ -168,4 +168,6 @@ public interface ISupplyChainService {
     void addList(String beginDate, String endDate,String pcursor);
 
     void updateOrder(JSONObject eventJSon);
+
+    void updateItem(JSONObject eventJSon);
 }

+ 16 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/SupplyChainServiceImpl.java

@@ -429,6 +429,22 @@ public class SupplyChainServiceImpl implements ISupplyChainService {
 
     }
 
+    @Override
+    public void updateItem(JSONObject eventJSon) {
+        try {
+            JSONObject info = eventJSon.getJSONObject("info");
+            if (!Check.isNull(info)) {
+                Long itemId = info.getLong("itemId");
+                Integer status = info.getInteger("status");
+                supplyChainMapper.updateItem(itemId, status);
+                log.info("商品id:{},状态:{} 修改成功", itemId, status);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+
+        }
+    }
+
     private void getInfo(KuaishouAccessToken accessToken, Long beginTime, Long endTime, String url, String pcursor, Map<Long, Long> itemMap) {
         List<KuaishouSupplyChain> list = new ArrayList<>();
         String appKey = accessToken.getAppKey();

+ 4 - 0
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -15,6 +15,10 @@
 
 
     </update>
+    <update id="updateItem">
+        update kuaishou_item_list set activity_item_status = #{status} where item_id = #{itemId}
+
+    </update>
     <delete id="unbindUser" parameterType="java.lang.Long">
         delete
         from kuaishou_item_bind_user