1
This commit is contained in:
@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -60,7 +61,25 @@ public class JDOrderController extends BaseController {
|
||||
}
|
||||
|
||||
private final static String skey = "2192057370ef8140c201079969c956a3";
|
||||
private final static String requestUrl = "http://192.168.8.88:6666/jd/";
|
||||
|
||||
@Value("${jarvis.server.jarvis-java.base-url:http://127.0.0.1:6666}")
|
||||
private String jarvisJavaBaseUrl;
|
||||
|
||||
@Value("${jarvis.server.jarvis-java.jd-api-path:/jd}")
|
||||
private String jdApiPath;
|
||||
|
||||
@Value("${jarvis.server.logistics.base-url:http://127.0.0.1:5001}")
|
||||
private String logisticsBaseUrl;
|
||||
|
||||
@Value("${jarvis.server.logistics.fetch-path:/fetch_logistics}")
|
||||
private String logisticsFetchPath;
|
||||
|
||||
/**
|
||||
* 获取JD接口请求URL
|
||||
*/
|
||||
private String getRequestUrl() {
|
||||
return jarvisJavaBaseUrl + jdApiPath + "/";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -70,7 +89,7 @@ public class JDOrderController extends BaseController {
|
||||
String promotionContent = requestBody.get("promotionContent");
|
||||
String result = "";
|
||||
try {
|
||||
String url = requestUrl + "generatePromotionContent";
|
||||
String url = getRequestUrl() + "generatePromotionContent";
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("skey", skey);
|
||||
param.put("promotionContent", promotionContent);
|
||||
@@ -191,7 +210,7 @@ public class JDOrderController extends BaseController {
|
||||
body.get("materialUrl"), body.get("skuId"), body.get("amount"),
|
||||
body.get("quantity"), body.get("owner"), body.get("skuName"));
|
||||
|
||||
String url = requestUrl + "createGiftCoupon";
|
||||
String url = getRequestUrl() + "createGiftCoupon";
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("skey", skey);
|
||||
// 透传必要参数
|
||||
@@ -310,7 +329,7 @@ public class JDOrderController extends BaseController {
|
||||
@PostMapping("/transfer")
|
||||
public AjaxResult transfer(@RequestBody Map<String, Object> body) {
|
||||
try {
|
||||
String url = requestUrl + "transfer";
|
||||
String url = getRequestUrl() + "transfer";
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("skey", skey);
|
||||
if (body.get("materialUrl") != null) param.put("materialUrl", body.get("materialUrl"));
|
||||
@@ -340,7 +359,7 @@ public class JDOrderController extends BaseController {
|
||||
body.get("materialUrl"), body.get("skuId"), body.get("amount"),
|
||||
body.get("quantity"), body.get("batchSize"), body.get("owner"), body.get("skuName"));
|
||||
|
||||
String url = requestUrl + "batchCreateGiftCoupons";
|
||||
String url = getRequestUrl() + "batchCreateGiftCoupons";
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("skey", skey);
|
||||
if (body.get("materialUrl") != null) param.put("materialUrl", body.get("materialUrl"));
|
||||
@@ -496,7 +515,7 @@ public class JDOrderController extends BaseController {
|
||||
for (String url : urls) {
|
||||
try {
|
||||
logger.info("查询商品信息 - URL: {}", url);
|
||||
String queryUrl = requestUrl + "generatePromotionContent";
|
||||
String queryUrl = getRequestUrl() + "generatePromotionContent";
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("skey", skey);
|
||||
param.put("promotionContent", url);
|
||||
@@ -634,7 +653,7 @@ public class JDOrderController extends BaseController {
|
||||
}
|
||||
|
||||
// 1. 查询该URL的商品信息
|
||||
String queryUrl = requestUrl + "generatePromotionContent";
|
||||
String queryUrl = getRequestUrl() + "generatePromotionContent";
|
||||
JSONObject queryParam = new JSONObject();
|
||||
queryParam.put("skey", skey);
|
||||
queryParam.put("promotionContent", urlSegment.normalizedJdUrl);
|
||||
@@ -686,7 +705,7 @@ public class JDOrderController extends BaseController {
|
||||
}
|
||||
|
||||
// 2. 为该商品创建礼金券
|
||||
String createUrl = requestUrl + "createGiftCoupon";
|
||||
String createUrl = getRequestUrl() + "createGiftCoupon";
|
||||
JSONObject createParam = new JSONObject();
|
||||
createParam.put("skey", skey);
|
||||
createParam.put("amount", amount);
|
||||
@@ -797,7 +816,7 @@ public class JDOrderController extends BaseController {
|
||||
String giftCouponKey = createData.getString("giftCouponKey");
|
||||
|
||||
// 3. 转链(带礼金)
|
||||
String transferUrl = requestUrl + "transfer";
|
||||
String transferUrl = getRequestUrl() + "transfer";
|
||||
JSONObject transferParam = new JSONObject();
|
||||
transferParam.put("skey", skey);
|
||||
transferParam.put("materialUrl", urlSegment.normalizedJdUrl);
|
||||
@@ -929,7 +948,7 @@ public class JDOrderController extends BaseController {
|
||||
orderId, order.getOrderId(), distributionMark, logisticsLink);
|
||||
|
||||
// 构建外部接口URL
|
||||
String externalUrl = "http://192.168.8.88:5001/fetch_logistics?tracking_url=" +
|
||||
String externalUrl = logisticsBaseUrl + logisticsFetchPath + "?tracking_url=" +
|
||||
java.net.URLEncoder.encode(logisticsLink, "UTF-8");
|
||||
|
||||
logger.info("准备调用外部接口 - URL: {}", externalUrl);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.ruoyi.common.utils.http.HttpUtils;
|
||||
import com.ruoyi.jarvis.service.ICommentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
@@ -20,13 +21,24 @@ import java.util.*;
|
||||
@RequestMapping("/public/comment")
|
||||
public class CommentPublicController extends BaseController {
|
||||
|
||||
// TODO: 可改为读取配置
|
||||
private static final String JD_BASE = "http://192.168.8.88:6666/jd";
|
||||
private static final String SKEY = "2192057370ef8140c201079969c956a3";
|
||||
|
||||
@Value("${jarvis.server.jarvis-java.base-url:http://127.0.0.1:6666}")
|
||||
private String jarvisJavaBaseUrl;
|
||||
|
||||
@Value("${jarvis.server.jarvis-java.jd-api-path:/jd}")
|
||||
private String jdApiPath;
|
||||
|
||||
@Autowired(required = false)
|
||||
private ICommentService commentService;
|
||||
|
||||
/**
|
||||
* 获取JD接口基础URL
|
||||
*/
|
||||
private String getJdBase() {
|
||||
return jarvisJavaBaseUrl + jdApiPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可选型号/类型(示例)
|
||||
*/
|
||||
@@ -34,7 +46,7 @@ public class CommentPublicController extends BaseController {
|
||||
public AjaxResult types() {
|
||||
boolean success = false;
|
||||
try {
|
||||
String url = JD_BASE + "/comment/types?skey=" + SKEY;
|
||||
String url = getJdBase() + "/comment/types?skey=" + SKEY;
|
||||
String result = HttpUtils.sendGet(url);
|
||||
Object parsed = JSON.parse(result);
|
||||
success = true;
|
||||
@@ -58,7 +70,7 @@ public class CommentPublicController extends BaseController {
|
||||
boolean success = false;
|
||||
String productType = null;
|
||||
try {
|
||||
String url = JD_BASE + "/comment/generate";
|
||||
String url = getJdBase() + "/comment/generate";
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("skey", SKEY);
|
||||
if (body != null && body.get("productType") != null) {
|
||||
|
||||
@@ -185,7 +185,20 @@ xss:
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
|
||||
# 服务地址配置(用于服务器迁移)
|
||||
jarvis:
|
||||
# 服务器基础地址(如果所有服务都在同一台服务器,可以使用127.0.0.1)
|
||||
# 开发环境:根据实际情况配置
|
||||
server:
|
||||
host: 192.168.8.88
|
||||
# Jarvis Java服务地址(JD相关接口)
|
||||
jarvis-java:
|
||||
base-url: http://192.168.8.88:6666
|
||||
jd-api-path: /jd
|
||||
# 物流接口服务地址
|
||||
logistics:
|
||||
base-url: http://192.168.8.88:5001
|
||||
fetch-path: /fetch_logistics
|
||||
# 腾讯文档开放平台配置
|
||||
# 文档地址:https://docs.qq.com/open/document/app/openapi/v3/sheet/model/spreadsheet.html
|
||||
tencent:
|
||||
|
||||
@@ -185,6 +185,20 @@ xss:
|
||||
excludes: /system/notice
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||
# 服务地址配置(用于服务器迁移)
|
||||
jarvis:
|
||||
# 服务器基础地址(如果所有服务都在同一台服务器,可以使用127.0.0.1)
|
||||
# 生产环境:192.168.8.88 或 127.0.0.1
|
||||
server:
|
||||
host: 127.0.0.1
|
||||
# Jarvis Java服务地址(JD相关接口)
|
||||
jarvis-java:
|
||||
base-url: http://127.0.0.1:6666
|
||||
jd-api-path: /jd
|
||||
# 物流接口服务地址
|
||||
logistics:
|
||||
base-url: http://127.0.0.1:5001
|
||||
fetch-path: /fetch_logistics
|
||||
# 腾讯文档开放平台配置
|
||||
# 文档地址:https://docs.qq.com/open/document/app/openapi/v3/sheet/model/spreadsheet.html
|
||||
tencent:
|
||||
|
||||
Reference in New Issue
Block a user