Commit a5240a4f authored by 黎博's avatar 黎博

update /api/order/selectJdOrder

parent 9cc7e51d
......@@ -11,6 +11,7 @@ import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
......@@ -134,7 +135,11 @@ public class OrderController {
public JSONObject qygOrderDetail(JdOrderDetailRequest request) {
String jdOrderId = request.getJdOrderId();
String queryExts = request.getQueryExts();
JSONObject orderInfo = JSONObject.parseObject(redisUtils.get(QYG_ORDER_PREFIX + jdOrderId).toString());
String jdOrderInfoRedisValue = (String) redisUtils.get(QYG_ORDER_PREFIX + jdOrderId);
JSONObject orderInfo = new JSONObject();
if (!StringUtils.isEmpty(jdOrderInfoRedisValue)) {
orderInfo = JSONObject.parseObject(jdOrderInfoRedisValue);
}
JSONObject response = new JSONObject();
response.put("success", true);
response.put("resultMessage", "");
......@@ -147,10 +152,20 @@ public class OrderController {
result.put("state", 1);
result.put("submitState", 1);
result.put("type", 1);
result.put("freight", orderInfo.get("freight"));
result.put("orderPrice", orderInfo.get("orderPrice"));
result.put("orderNakedPrice", orderInfo.get("orderNakedPrice"));
result.put("orderTaxPrice", orderInfo.get("orderTaxPrice"));
if (!orderInfo.isEmpty()) {
result.put("freight", orderInfo.get("freight"));
result.put("orderPrice", orderInfo.get("orderPrice"));
result.put("orderNakedPrice", orderInfo.get("orderNakedPrice"));
result.put("orderTaxPrice", orderInfo.get("orderTaxPrice"));
result.put("sku", orderInfo.get("sku"));
} else {
// 如果缓存里取不到值,就随便给个值
result.put("freight", 0);
result.put("orderPrice", 10);
result.put("orderNakedPrice", 8);
result.put("orderTaxPrice", 2);
result.put("sku", new JSONObject());
}
if (queryExts != null && queryExts.contains("orderType")) {
result.put("orderType", 1);
}
......@@ -165,7 +180,6 @@ public class OrderController {
result.put("jdOrderState", 16);
}
result.put("paymentType", 4);
result.put("sku", orderInfo.get("sku"));
response.put("result", result);
return response;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment