diff --git a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java index 2429dc70..a54bbee5 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/BuyOrderServiceImpl.java @@ -436,6 +436,7 @@ public class BuyOrderServiceImpl extends ServiceImpl impl commodity.setGoodsName(product.getProductName()+" ×"+buyOrderProduct.getQuantity()); commodity.setGoodsquantity(buyOrderProduct.getQuantity()); commodity.setGoodsWeight((product.getWeight().doubleValue())/1000); + commodity.setGoodsPrice(product.getPrice().doubleValue()); totalWeight = totalWeight.add( BigDecimal.valueOf(product.getWeight().doubleValue()).multiply(new BigDecimal(buyOrderProduct.getQuantity())).divide(BigDecimal.valueOf(1000),2,RoundingMode.HALF_UP) ); diff --git a/src/main/java/com/peanut/modules/book/service/impl/ExpressOrderServiceImpl.java b/src/main/java/com/peanut/modules/book/service/impl/ExpressOrderServiceImpl.java index b3098c49..e3f33173 100644 --- a/src/main/java/com/peanut/modules/book/service/impl/ExpressOrderServiceImpl.java +++ b/src/main/java/com/peanut/modules/book/service/impl/ExpressOrderServiceImpl.java @@ -6,6 +6,7 @@ import com.peanut.common.utils.HttpClientUtils; import com.peanut.common.utils.KdUtils; import com.peanut.config.Constants; import com.peanut.modules.book.dao.ExpressOrderDao; +import com.peanut.modules.book.entity.ExpressCommodity; import com.peanut.modules.book.entity.ExpressOrder; import com.peanut.modules.book.entity.ExpressQueryResponse; import com.peanut.modules.book.service.ExpressOrderService; @@ -15,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.math.BigDecimal; import java.util.HashMap; import java.util.Map; @@ -51,6 +53,24 @@ public class ExpressOrderServiceImpl extends ServiceImpl0){ + for (ExpressCommodity commodity : expressOrder.getCommodity()) { + BigDecimal quantity = BigDecimal.valueOf(commodity.getGoodsquantity()); + BigDecimal price = BigDecimal.valueOf(commodity.getGoodsPrice()); + BigDecimal total = quantity.multiply(price); + declaredValue = declaredValue.add(total); + } + } + DutiableVo dutiable = new DutiableVo(); + dutiable.setDeclaredValue(declaredValue.setScale(3)); + orderRequestVo.setDutiable(dutiable); + } } if (expressOrder.getExpressCompanyCode().equals(Constants.EXPRESS_COMPANY_CODE_YD)) { orderRequestVo.setCustomerName(Constants.EXPRESS_YD_CUSTOMER_NAME); @@ -81,13 +101,20 @@ public class ExpressOrderServiceImpl extends ServiceImpl params = new HashMap<>(); - params.put("RequestData", requestData); + params.put("RequestData", requestDataUpperCase); params.put("EBusinessID", Constants.EXPRESS_BUSINESS_ID); params.put("RequestType", Constants.EXPRESS_REQUEST_TYPE_PLACE_ORDER); try { - String dataSign = KdUtils.encrypt(requestData, Constants.EXPRESS_API_KEY, "UTF-8"); + String dataSign = KdUtils.encrypt(requestDataUpperCase, Constants.EXPRESS_API_KEY, "UTF-8"); params.put("DataSign", KdUtils.urlEncoder(dataSign, "UTF-8")); } catch (Exception e) { e.printStackTrace(); diff --git a/src/main/java/com/peanut/modules/book/vo/DutiableVo.java b/src/main/java/com/peanut/modules/book/vo/DutiableVo.java new file mode 100644 index 00000000..80cde0f6 --- /dev/null +++ b/src/main/java/com/peanut/modules/book/vo/DutiableVo.java @@ -0,0 +1,15 @@ +package com.peanut.modules.book.vo; + +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 申报价值 + */ +@Data +public class DutiableVo { + + private BigDecimal DeclaredValue; + +} diff --git a/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java b/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java index 0d7c66a5..519cf964 100644 --- a/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java +++ b/src/main/java/com/peanut/modules/book/vo/request/ExpressOrderRequestVo.java @@ -1,6 +1,7 @@ package com.peanut.modules.book.vo.request; import com.peanut.modules.book.entity.ExpressCommodity; +import com.peanut.modules.book.vo.DutiableVo; import com.peanut.modules.book.vo.ExpressUserInfoVo; import lombok.Data; @@ -87,5 +88,19 @@ public class ExpressOrderRequestVo { * 面单规格 */ private String TemplateSize; + + /** + * 货物单价的币种:港澳台必填 + * CNY: 人民币 + * HKD: 港币 + * NTD: 新台币 + * MOP: 澳门元 + */ + private String CurrencyCode; + + /** + * 申报价值 + */ + private DutiableVo Dutiable; }