Commit d44266e1 by vega

优化转换

parent 6973cb16
......@@ -4,6 +4,7 @@ import com.freemud.application.sdk.api.deliverycenter.dto.CreateDeliveryOrderReq
import com.freemud.application.sdk.api.ordercenter.enums.OrderType;
import com.freemud.application.sdk.api.storecenter.response.StoreResponse;
import com.freemud.sdk.api.assortment.order.response.order.QueryOrdersResponse;
import org.apache.commons.lang.math.NumberUtils;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
......@@ -51,7 +52,7 @@ public class DeliverySdkAdapter {
deliveryOrderRequestDto.setReceiverLat(new BigDecimal(order.getLatitude()));
deliveryOrderRequestDto.setOrderTime(new Date(order.getGmtCreate()));
deliveryOrderRequestDto.setCallbackUrl(deliveryCallBackUrl);
deliveryOrderRequestDto.setOrderClient(Integer.valueOf(order.getOrderClient()));
deliveryOrderRequestDto.setOrderClient(NumberUtils.toInt(order.getOrderClient()));
// 预约单预计送到时间
if (order.getGmtExpect() != null && order.getGmtExpect() != 0) {
deliveryOrderRequestDto.setExpectTime(new Date(order.getGmtExpect()));
......@@ -59,7 +60,10 @@ public class DeliverySdkAdapter {
deliveryOrderRequestDto.setIsPre(order.getNewOrderType() == OrderType.RESERVED_EXPRESS.getIndex() ? 1 : 0);
Optional.ofNullable(order.getProductList())
.ifPresent(productList ->
deliveryOrderRequestDto.setProductInfos(productList.stream().filter(productBean -> productBean.getPrice() > 0).map(productBean -> {
deliveryOrderRequestDto.setProductInfos(productList.stream()
.filter(productBean -> Objects.nonNull(productBean.getPrice()))
.filter(productBean -> productBean.getPrice() > 0)
.map(productBean -> {
CreateDeliveryOrderRequestDto.DeliveryProductInfo deliveryProductInfo = new CreateDeliveryOrderRequestDto.DeliveryProductInfo();
deliveryProductInfo.setProductCode(productBean.getProductId());
deliveryProductInfo.setProductName(productBean.getProductName());
......
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