|
|
@@ -2,8 +2,8 @@ package zs.payment.controller;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.util.ObjectUtils;
|
|
|
+
|
|
|
+
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
@@ -12,20 +12,19 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import zs.payment.dao.OrderCallbackDao;
|
|
|
import zs.payment.entity.OrderCallback;
|
|
|
import zs.payment.enums.CallbackMessageType;
|
|
|
+import zs.payment.messages.KafkaProducer;
|
|
|
import zs.payment.req.*;
|
|
|
-import zs.payment.entity.Orders;
|
|
|
+
|
|
|
import zs.payment.req.aftersales.AfterSalesOrderReq;
|
|
|
import zs.payment.req.aftersales.AfterSalesOrderTypeReq;
|
|
|
import zs.payment.req.storage.StoragePageReq;
|
|
|
import zs.payment.resp.Result;
|
|
|
-import zs.payment.service.OrdersService;
|
|
|
-import zs.payment.utils.HttpUtil;
|
|
|
-import zs.payment.utils.RedisUtils;
|
|
|
-import zs.payment.dto.OrderDetailDTO;
|
|
|
+
|
|
|
+import zs.payment.service.paysupply.PaySupplyService;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
+
|
|
|
import java.util.Map;
|
|
|
|
|
|
/**
|
|
|
@@ -36,313 +35,69 @@ import java.util.Map;
|
|
|
@RequestMapping("/supply")
|
|
|
public class YxSupplyChannelManualController {
|
|
|
|
|
|
- @Value("${supply.demain}")
|
|
|
- private String prefixUrl;
|
|
|
-
|
|
|
- @Value("${supply.appKey}")
|
|
|
- private String appKey;
|
|
|
- @Value("${supply.appSecret}")
|
|
|
- private String appSecret;
|
|
|
|
|
|
@Autowired
|
|
|
- private RedisUtils redisUtils;
|
|
|
+ private OrderCallbackDao callbackDao;
|
|
|
|
|
|
@Autowired
|
|
|
- private OrdersService ordersService;
|
|
|
+ private PaySupplyService paySupplyService;
|
|
|
|
|
|
@Autowired
|
|
|
- private OrderCallbackDao callbackDao;
|
|
|
-
|
|
|
- public static final String SUPPLY_TOKEN = "supply:token";
|
|
|
+ private KafkaProducer kafkaProducer;
|
|
|
|
|
|
/**
|
|
|
* 获取token
|
|
|
*/
|
|
|
@PostMapping("/getToken")
|
|
|
public Result getToken() {
|
|
|
- return fetchAndCacheToken();
|
|
|
+ return paySupplyService.fetchAndCacheToken();
|
|
|
}
|
|
|
-
|
|
|
- /**
|
|
|
- * 请求上游获取token并缓存到Redis
|
|
|
- * 成功返回 Result.success(token),失败返回 Result.fail(msg)
|
|
|
- */
|
|
|
- private Result fetchAndCacheToken() {
|
|
|
- // 先判断TTL,剩余时间大于1小时才取缓存token直接返回
|
|
|
- if (redisUtils.ttl(SUPPLY_TOKEN) > 3600) {
|
|
|
- return Result.success(redisUtils.get(SUPPLY_TOKEN));
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("app_key", appKey);
|
|
|
- params.put("app_secret", appSecret);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/application/getToken", params);
|
|
|
-
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- JSONObject data = respJson.getJSONObject("data");
|
|
|
- String token = data.getString("token");
|
|
|
- long expiresAt = data.getLongValue("expiresAt");
|
|
|
-
|
|
|
- long ttlSeconds = (expiresAt - System.currentTimeMillis()) / 1000;
|
|
|
- if (ttlSeconds <= 0) ttlSeconds = 60;
|
|
|
-
|
|
|
- redisUtils.set(SUPPLY_TOKEN, token, (int) ttlSeconds);
|
|
|
-
|
|
|
- return Result.success(token);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 选品列表API
|
|
|
*/
|
|
|
@PostMapping("/cursorList")
|
|
|
public Result cursorList(@Valid @RequestBody ProductPageReq req) {
|
|
|
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("pageSize", req.getPageSize());
|
|
|
- if (req.getCursor() != null) {
|
|
|
- params.put("cursor", req.getCursor());
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/product/storage/cursorList", params, headers);
|
|
|
-
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- return Result.success(respJson.getJSONObject("data"));
|
|
|
+ return paySupplyService.cursorList(req);
|
|
|
}
|
|
|
|
|
|
//支持多个商品详情查看
|
|
|
@PostMapping("/detailList")
|
|
|
public Result detailList(@Valid @RequestBody ProductDetailReq req) {
|
|
|
+ return paySupplyService.detailList(req);
|
|
|
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("ids", req.getIds());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/product/storage/detailList", params, headers);
|
|
|
-
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- log.info("查看商品详情失败,{}",req.getIds());
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- List<OrderDetailDTO> list = JSONObject.parseArray(
|
|
|
- respJson.getJSONObject("data").getJSONArray("list").toJSONString(),
|
|
|
- OrderDetailDTO.class
|
|
|
- );
|
|
|
-
|
|
|
- //todo 导入到企云商城
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return Result.success(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
// 订单验证
|
|
|
@PostMapping("/beforeCheck")
|
|
|
public Result beforeCheck(@Valid @RequestBody OrderCheckReq req) {
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("spu", req.getSpu());
|
|
|
- params.put("address", req.getAddress());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/order/beforeCheck", params, headers);
|
|
|
-
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- return Result.success(respJson.getJSONObject("data"));
|
|
|
+ return paySupplyService.beforeCheck(req);
|
|
|
}
|
|
|
+
|
|
|
//仅下单
|
|
|
@PostMapping("/orderConfirmOnly")
|
|
|
public Result orderConfirmOnly(@Valid @RequestBody OrderReq req){
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("spu", req.getSpu());
|
|
|
- params.put("address", req.getAddress());
|
|
|
- params.put("order_sn", req.getOrderSn());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/order/orderConfirmOnly", params, headers);
|
|
|
-
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- List<Orders> orders = JSONObject.parseArray(
|
|
|
- respJson.getJSONObject("data").getJSONArray("Orders").toJSONString(),
|
|
|
- Orders.class
|
|
|
- );
|
|
|
- log.info("仅下单,存储订单");
|
|
|
- ordersService.addBatchOrder(orders);
|
|
|
-
|
|
|
- return Result.success(orders);
|
|
|
+ return paySupplyService.orderConfirmOnly(req);
|
|
|
}
|
|
|
|
|
|
//订单支付(单独下单之后使用这个支付)
|
|
|
@PostMapping("/orderPayOnly")
|
|
|
public Result orderPayOnly(@Valid @RequestBody OrderPayReq req){
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("order_sn", req.getOrderSn());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/order/orderPayOnly", params, headers);
|
|
|
-
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- List<Orders> orders = JSONObject.parseArray(
|
|
|
- respJson.getJSONObject("data").getJSONArray("Orders").toJSONString(),
|
|
|
- Orders.class
|
|
|
- );
|
|
|
- return Result.success(orders);
|
|
|
+ return paySupplyService.orderPayOnly(req);
|
|
|
}
|
|
|
|
|
|
|
|
|
// 生成订单同时支付,如果已生成订单则是直接支付
|
|
|
@PostMapping("/order")
|
|
|
public Result order(@Valid @RequestBody OrderReq req) {
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("spu", req.getSpu());
|
|
|
- params.put("address", req.getAddress());
|
|
|
- params.put("order_sn", req.getOrderSn());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/order", params, headers);
|
|
|
-
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- List<Orders> orders = JSONObject.parseArray(
|
|
|
- respJson.getJSONObject("data").getJSONArray("Orders").toJSONString(),
|
|
|
- Orders.class
|
|
|
- );
|
|
|
- log.info("下单并支付,存储订单");
|
|
|
- ordersService.addBatchOrder(orders);
|
|
|
- return Result.success(orders);
|
|
|
+ return paySupplyService.order(req);
|
|
|
}
|
|
|
|
|
|
// 取消订单
|
|
|
@PostMapping("/appCloseOrder")
|
|
|
public Result appCloseOrder(@Valid @RequestBody CloseOrderReq req){
|
|
|
-
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("order_id", req.getOrderId());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/order/appCloseOrder", params, headers);
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
- //{
|
|
|
- // "body": {
|
|
|
- // "MSG": "SUCCESS",
|
|
|
- // "CODE": 200,
|
|
|
- // "data": {
|
|
|
- // "errorOrdersSNs": null,
|
|
|
- // "successOrdersSNs": [
|
|
|
- // 195319850638
|
|
|
- // ]
|
|
|
- // }
|
|
|
- // },
|
|
|
- // "success": true
|
|
|
- //}
|
|
|
- return Result.success(respJson.getJSONObject("data"));
|
|
|
+ return paySupplyService.appCloseOrder(req);
|
|
|
}
|
|
|
|
|
|
// =======================售后==========================================
|
|
|
@@ -355,76 +110,14 @@ public class YxSupplyChannelManualController {
|
|
|
@PostMapping("/getAfterSalesTypeNameMap")
|
|
|
public Result getAfterSalesTypeNameMap(@Valid @RequestBody AfterSalesOrderTypeReq req){
|
|
|
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("order_id", req.getOrderId());
|
|
|
- params.put("order_item_id",req.getOrderItemId());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplateGet(prefixUrl + "/supplyapi/app/afterSales/getAfterSalesTypeNameMap", params, headers);
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- return Result.success(respJson.getJSONObject("data"));
|
|
|
+ return paySupplyService.getAfterSalesTypeNameMap(req);
|
|
|
}
|
|
|
|
|
|
|
|
|
//申请售后
|
|
|
@PostMapping("/afterSalesCreate")
|
|
|
public Result afterSalesCreate(@Valid @RequestBody AfterSalesOrderReq req){
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("order_id", req.getOrderId());
|
|
|
- params.put("is_received",req.getIsReceived());
|
|
|
- params.put("order_item_id",req.getOrderItemId());
|
|
|
- if (!ObjectUtils.isEmpty(req.getAmount())){
|
|
|
- //退款总额不为空
|
|
|
- params.put("amount",req.getAmount());
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(req.getRefundType())){
|
|
|
- // 退款方式: "0": "退款", "1": "退货退款"
|
|
|
- params.put("refund_type",req.getRefundType());
|
|
|
- }
|
|
|
- if (!ObjectUtils.isEmpty(req.getTechnicalServicesFee())){
|
|
|
- //技术服务费
|
|
|
- params.put("technical_services_fee",req.getTechnicalServicesFee());
|
|
|
- }
|
|
|
-
|
|
|
- if (!ObjectUtils.isEmpty(req.getFreight())){
|
|
|
- //运费
|
|
|
- params.put("freight",req.getFreight());
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/afterSales/create", params, headers);
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
- return Result.success(respJson.getJSONObject("data"));
|
|
|
+ return paySupplyService.afterSalesCreate(req);
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -436,18 +129,39 @@ public class YxSupplyChannelManualController {
|
|
|
|
|
|
JSONObject reqJson = JSONObject.parseObject(JSONObject.toJSONString(req));
|
|
|
String messageType = reqJson.getString("message_type");
|
|
|
+ OrderCallback callback = new OrderCallback();
|
|
|
+ callback.setMessage_type(messageType);
|
|
|
+ callback.setMessage(req);
|
|
|
//当 message_type == 商品类的事件 时跳过保存,其他类型才入库
|
|
|
-// if (CallbackMessageType.GOODS_ALTER.equalsIgnoreCase(messageType) || CallbackMessageType.GOODS_UNDERCARRIAGE.equalsIgnoreCase(messageType)
|
|
|
-// || CallbackMessageType.GOODS_ON_SALE.equalsIgnoreCase(messageType) || CallbackMessageType.GOODS_DELETE.equalsIgnoreCase(messageType)) {
|
|
|
-// return result;
|
|
|
-// }
|
|
|
+ if (CallbackMessageType.GOODS_ALTER.equalsIgnoreCase(messageType) || CallbackMessageType.GOODS_UNDERCARRIAGE.equalsIgnoreCase(messageType)
|
|
|
+ || CallbackMessageType.GOODS_ON_SALE.equalsIgnoreCase(messageType) || CallbackMessageType.GOODS_DELETE.equalsIgnoreCase(messageType)) {
|
|
|
+ int productId = reqJson.getIntValue("product_id");
|
|
|
+ callback.setProduct_id(productId);
|
|
|
+ // 若product_id =0 ,则为无效数据,直接跳过
|
|
|
+ if (0== productId){
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ JSONObject json=new JSONObject();
|
|
|
+ json.put("product_id", productId);
|
|
|
+ // 商品变更,有可能是加入到选品库了
|
|
|
+ if (CallbackMessageType.GOODS_ALTER.equalsIgnoreCase(messageType)){
|
|
|
+
|
|
|
+ //添加商品
|
|
|
+ kafkaProducer.sendMessage(CallbackMessageType.GOODS_ALTER, json.toJSONString());
|
|
|
+ }
|
|
|
+ // 当商品下架的时候,更新商品为下架
|
|
|
+ if (CallbackMessageType.GOODS_UNDERCARRIAGE.equalsIgnoreCase(messageType)){
|
|
|
+ //更新商品下架,状态变更,
|
|
|
+ kafkaProducer.sendMessage(CallbackMessageType.GOODS_UNDERCARRIAGE, json.toJSONString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
//售后通过
|
|
|
if (CallbackMessageType.AFTER_SALES_PASS.equalsIgnoreCase(messageType)) {
|
|
|
|
|
|
}
|
|
|
- OrderCallback callback = new OrderCallback();
|
|
|
- callback.setMessage(req);
|
|
|
+
|
|
|
callbackDao.save(callback);
|
|
|
|
|
|
return result;
|
|
|
@@ -458,31 +172,7 @@ public class YxSupplyChannelManualController {
|
|
|
//我的选品库
|
|
|
@PostMapping("/getMyStorageIdsList")
|
|
|
public Result getMyStorageIdsList(@Valid @RequestBody StoragePageReq req){
|
|
|
- String token = redisUtils.get(SUPPLY_TOKEN);
|
|
|
- if (token == null || token.isEmpty()) {
|
|
|
- Result tokenResult = fetchAndCacheToken();
|
|
|
- if (!tokenResult.isSuccess()) {
|
|
|
- return tokenResult;
|
|
|
- }
|
|
|
- token = (String) tokenResult.getBody().get("token");
|
|
|
- }
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("page", req.getPage());
|
|
|
- params.put("pageSize",req.getPageSize());
|
|
|
- params.put("create_sort",req.getCreateSort());
|
|
|
-
|
|
|
- Map<String, String> headers = new HashMap<>();
|
|
|
- headers.put("x-token", token);
|
|
|
-
|
|
|
- String resp = HttpUtil.restTemplatePost(prefixUrl + "/supplyapi/app/product/storage/getMyStorageIdsList", params, headers);
|
|
|
- JSONObject respJson = JSONObject.parseObject(resp);
|
|
|
- if (respJson.getIntValue("code") != 0) {
|
|
|
- return Result.fail(respJson.getString("msg"));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- return Result.success(respJson.getJSONObject("data"));
|
|
|
+ return paySupplyService.getMyStorageIdsList(req);
|
|
|
}
|
|
|
|
|
|
|