|
@@ -1,6 +1,7 @@
|
|
|
package com.caimei365.order.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.caimei365.order.feign.CommodityFeign;
|
|
|
import com.caimei365.order.feign.ToolsFeign;
|
|
|
import com.caimei365.order.feign.UserFeign;
|
|
|
import com.caimei365.order.mapper.MessagePushMapper;
|
|
@@ -36,6 +37,8 @@ public class RemoteCallServiceImpl implements RemoteCallService {
|
|
|
private ToolsFeign toolsFeign;
|
|
|
@Resource
|
|
|
private UserFeign userFeign;
|
|
|
+ @Resource
|
|
|
+ private CommodityFeign commodityFeign;
|
|
|
|
|
|
/**
|
|
|
* 生成短链接
|
|
@@ -149,4 +152,26 @@ public class RemoteCallServiceImpl implements RemoteCallService {
|
|
|
}
|
|
|
return resultData.get();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新商品销量
|
|
|
+ *
|
|
|
+ * @param productInfo [ // 商品id,数量
|
|
|
+ * {"productId": 2789, "productCount": 1},
|
|
|
+ * {"productId": 2790, "productCount": 2}
|
|
|
+ * ]
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public String productSaleUpdate(String productInfo) {
|
|
|
+ AtomicReference<String> resultData = new AtomicReference<>("");
|
|
|
+ try {
|
|
|
+ // 调用 ToolsFeign 获取物流
|
|
|
+ String jsonStr = commodityFeign.productSaleUpdate(productInfo);
|
|
|
+ log.info("更新商品销量:"+productInfo);
|
|
|
+ resultData.set(jsonStr);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("更新商品销量失败:", e);
|
|
|
+ }
|
|
|
+ return resultData.get();
|
|
|
+ }
|
|
|
}
|