1
This commit is contained in:
@@ -15,6 +15,8 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -28,6 +30,8 @@ import java.util.Map;
|
|||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/jarvis/jdorder")
|
@RequestMapping("/jarvis/jdorder")
|
||||||
public class JDOrderController extends BaseController {
|
public class JDOrderController extends BaseController {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(JDOrderController.class);
|
||||||
|
|
||||||
private final IJDOrderService jdOrderService;
|
private final IJDOrderService jdOrderService;
|
||||||
private final IOrderRowsService orderRowsService;
|
private final IOrderRowsService orderRowsService;
|
||||||
|
|
||||||
@@ -157,6 +161,11 @@ public class JDOrderController extends BaseController {
|
|||||||
@PostMapping("/createGiftCoupon")
|
@PostMapping("/createGiftCoupon")
|
||||||
public AjaxResult createGiftCoupon(@RequestBody Map<String, Object> body) {
|
public AjaxResult createGiftCoupon(@RequestBody Map<String, Object> body) {
|
||||||
try {
|
try {
|
||||||
|
// 添加日志
|
||||||
|
logger.info("创建礼金请求 - 参数: materialUrl={}, skuId={}, amount={}, quantity={}, owner={}, skuName={}",
|
||||||
|
body.get("materialUrl"), body.get("skuId"), body.get("amount"),
|
||||||
|
body.get("quantity"), body.get("owner"), body.get("skuName"));
|
||||||
|
|
||||||
String url = requestUrl + "createGiftCoupon";
|
String url = requestUrl + "createGiftCoupon";
|
||||||
JSONObject param = new JSONObject();
|
JSONObject param = new JSONObject();
|
||||||
param.put("skey", skey);
|
param.put("skey", skey);
|
||||||
@@ -168,15 +177,23 @@ public class JDOrderController extends BaseController {
|
|||||||
if (body.get("owner") != null) param.put("owner", body.get("owner"));
|
if (body.get("owner") != null) param.put("owner", body.get("owner"));
|
||||||
if (body.get("skuName") != null) param.put("skuName", body.get("skuName"));
|
if (body.get("skuName") != null) param.put("skuName", body.get("skuName"));
|
||||||
|
|
||||||
|
logger.info("创建礼金请求 - 发送到内部服务: {}, 参数: {}", url, param.toJSONString());
|
||||||
|
|
||||||
String result = HttpUtils.sendJsonPost(url, param.toJSONString());
|
String result = HttpUtils.sendJsonPost(url, param.toJSONString());
|
||||||
|
|
||||||
|
logger.info("创建礼金响应 - 原始响应: {}", result);
|
||||||
|
|
||||||
// 优先返回JSON对象;若非JSON则按字符串返回
|
// 优先返回JSON对象;若非JSON则按字符串返回
|
||||||
try {
|
try {
|
||||||
Object parsed = JSON.parse(result);
|
Object parsed = JSON.parse(result);
|
||||||
|
logger.info("创建礼金响应 - 解析后: {}", parsed);
|
||||||
return AjaxResult.success(parsed);
|
return AjaxResult.success(parsed);
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
|
logger.warn("创建礼金响应 - JSON解析失败,返回字符串: {}", result);
|
||||||
return AjaxResult.success(result);
|
return AjaxResult.success(result);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
logger.error("创建礼金异常", e);
|
||||||
return AjaxResult.error("开礼金失败: " + e.getMessage());
|
return AjaxResult.error("开礼金失败: " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user