Commit e3353a7b by ping.wu

商城订单回调

parent c738c02f
...@@ -19,7 +19,7 @@ public class OrderPack { ...@@ -19,7 +19,7 @@ public class OrderPack {
/** /**
* 订单商品明细ID * 订单商品明细ID
*/ */
private String orderItemId; private Long orderItemId;
/** /**
* 商品编号 * 商品编号
...@@ -29,12 +29,6 @@ public class OrderPack { ...@@ -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; ...@@ -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.request.OrderExtInfoDto;
import com.freemud.application.sdk.api.ordercenter.response.OrderBaseResp; 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.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.response.orderInfo.QueryByCodeResponse;
import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService; import com.freemud.application.sdk.api.ordercenter.service.OrderSdkService;
import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest; import com.freemud.application.sdk.api.storecenter.request.StoreInfoRequest;
...@@ -65,10 +66,8 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -65,10 +66,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Date; import java.util.stream.Collectors;
import java.util.List;
import java.util.Objects;
/** /**
...@@ -100,7 +99,8 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService { ...@@ -100,7 +99,8 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService {
private OrderManagerAdapter orderManagerAdapter; private OrderManagerAdapter orderManagerAdapter;
@Autowired @Autowired
private OrderSdkService orderSdkService; private OrderSdkService orderSdkService;
OrderServiceClient orderServiceClient; @Autowired
private OrderServiceClient orderServiceClient;
@Autowired @Autowired
private MessageNoticeAdapter messageNoticeAdapter; private MessageNoticeAdapter messageNoticeAdapter;
@Autowired @Autowired
...@@ -319,8 +319,6 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService { ...@@ -319,8 +319,6 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService {
@Override @Override
public BaseResponse mallCallbackUrl(MallCallbackRequestDto request) { public BaseResponse mallCallbackUrl(MallCallbackRequestDto request) {
// return ResponseUtil.success();
QueryByCodeResponse responseDto = orderSdkService.getOrderInfo(null, request.getTid(), null, null, null); 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) { if (responseDto == null || !Objects.equals(SUCCESS_RESPONSE_CODE.toString(), responseDto.getCode())|| responseDto.getResult().getOrderCode() == null) {
return ResponseUtil.error(ResponseResult.ORDER_NOT_EXIST); return ResponseUtil.error(ResponseResult.ORDER_NOT_EXIST);
...@@ -345,21 +343,29 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService { ...@@ -345,21 +343,29 @@ public class ThirdDeliveryServiceImpl implements ThirdDeliveryService {
editLogisticsReq.setOperator(""); editLogisticsReq.setOperator("");
List<LogisticsList> logisticsList = new ArrayList<>(); List<LogisticsList> logisticsList = new ArrayList<>();
LogisticsList logistics = new LogisticsList(); LogisticsList logistics = new LogisticsList();
logistics.setExpressNo(""); logistics.setExpressNo(request.getLogisticsNo());
logistics.setLogisticsCompanyName(""); logistics.setLogisticsCompanyName(request.getLogisticsName());
logistics.setLogisticsCompanyCode(""); logistics.setLogisticsCompanyCode("");
logistics.setState(1); logistics.setState(1);
logisticsList.add(logistics); 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<>(); List<OrderPack> orderPackList = new ArrayList<>();
for(MallCallbackRequestDto.LogisticsDetail logisticsDetail: request.getGoodsList()){
OrderPack orderPack = new OrderPack(); 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); orderPackList.add(orderPack);
}
logistics.setOrderPackList(orderPackList); logistics.setOrderPackList(orderPackList);
}
logisticsList.add(logistics); logisticsList.add(logistics);
editLogisticsReq.setLogisticsList(logisticsList); 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(); return ResponseUtil.success();
} }
......
...@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List; 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) @RequestMapping(consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public interface OrderServiceClient { 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