Commit e3353a7b by ping.wu

商城订单回调

parent c738c02f
......@@ -19,7 +19,7 @@ public class OrderPack {
/**
* 订单商品明细ID
*/
private String orderItemId;
private Long orderItemId;
/**
* 商品编号
......@@ -29,12 +29,6 @@ public class OrderPack {
/**
* 商品序号
*/
private String productSeq;
/**
*
*
*/
private Integer productSeq;
}
......@@ -43,6 +43,7 @@ import com.freemud.application.sdk.api.ordercenter.request.OrderCollectReq;
import com.freemud.application.sdk.api.ordercenter.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.ordercenter.response.OrderBaseResp;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderInfoReqs;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.OrderItemResp;
import com.freemud.application.sdk.api.ordercenter.response.orderInfo.QueryByCodeResponse;
import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService;
import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest;
......@@ -65,10 +66,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
import java.util.stream.Collectors;
/**
......@@ -100,7 +99,8 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService {
private OrderManagerAdapter orderManagerAdapter;
@Autowired
private OrderSdkService orderSdkService;
OrderServiceClient orderServiceClient;
@Autowired
private OrderServiceClient orderServiceClient;
@Autowired
private MessageNoticeAdapter messageNoticeAdapter;
@Autowired
......@@ -319,8 +319,6 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService {
@Override
public BaseResponse mallCallbackUrl(MallCallbackRequestDto request) {
// return ResponseUtil.success();
QueryByCodeResponse responseDto = orderSdkService.getOrderInfo(null, request.getTid(), null, null, null);
if (responseDto == null || !Objects.equals(SUCCESS_RESPONSE_CODE.toString(), responseDto.getCode())|| responseDto.getResult().getOrderCode() == null) {
return ResponseUtil.error(ResponseResult.ORDER_NOT_EXIST);
......@@ -345,21 +343,29 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService {
editLogisticsReq.setOperator("");
List<LogisticsList> logisticsList = new ArrayList<>();
LogisticsList logistics = new LogisticsList();
logistics.setExpressNo("");
logistics.setLogisticsCompanyName("");
logistics.setExpressNo(request.getLogisticsNo());
logistics.setLogisticsCompanyName(request.getLogisticsName());
logistics.setLogisticsCompanyCode("");
logistics.setState(1);
if (CollectionUtils.isNotEmpty(request.getGoodsList())){
Map<Long, OrderItemResp> maps = orderInfoReqs.getOrderItemList().stream().collect(Collectors.toMap(OrderItemResp::getId, orderItemResp -> orderItemResp, (key1, key2) -> key2));
List<OrderPack> orderPackList = new ArrayList<>();
for(MallCallbackRequestDto.LogisticsDetail logisticsDetail: request.getGoodsList()){
OrderPack orderPack = new OrderPack();
orderPack.setOrderItemId(Long.valueOf(logisticsDetail.getOid()));
orderPack.setProductId(logisticsDetail.getProductId());
OrderItemResp orderItemResp = maps.get(Long.valueOf(logisticsDetail.getOid()));
orderPack.setProductSeq(orderItemResp == null ? 0 : orderItemResp.getProductSeq());
orderPackList.add(orderPack);
}
logistics.setOrderPackList(orderPackList);
}
logisticsList.add(logistics);
List<OrderPack> orderPackList = new ArrayList<>();
OrderPack orderPack = new OrderPack();
orderPackList.add(orderPack);
logistics.setOrderPackList(orderPackList);
logisticsList.add(logistics);
editLogisticsReq.setLogisticsList(logisticsList);
orderServiceClient.editLogistics(editLogisticsReq);
BaseResponse editLogistics = orderServiceClient.editLogistics(editLogisticsReq);
if (editLogistics == null || !Objects.equals(SUCCESS_RESPONSE_CODE.toString(), editLogistics.getCode())) {
return ResponseUtil.error(ResponseResult.SYSTEM_BUSINESS_ERROR);
}
return ResponseUtil.success();
}
......
......@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;
@FeignClient(name = "order-service",url = "${order.service.url:}")
@FeignClient(name = "order-service",url = "http://order-service-dev.api-ingress.sandload.cn")
@RequestMapping(consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public interface OrderServiceClient {
/**
......
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