港澳台发货
This commit is contained in:
@@ -436,6 +436,7 @@ public class BuyOrderServiceImpl extends ServiceImpl<BuyOrderDao, BuyOrder> 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)
|
||||
);
|
||||
|
||||
@@ -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 ServiceImpl<ExpressOrderDao, Expres
|
||||
orderRequestVo.setPayType(3);
|
||||
if (expressOrder.getExpressCompanyCode().equals(Constants.EXPRESS_COMPANY_CODE_SF)) {
|
||||
orderRequestVo.setMonthCode(Constants.EXPRESS_SF_MONTH_CODE);
|
||||
//如果是顺丰港澳台,参数多两个必填CurrencyCode、Dutiable.DeclaredValue
|
||||
if ("台湾省".equals(expressOrder.getProvince())||
|
||||
"香港特别行政区".equals(expressOrder.getProvince())||
|
||||
"澳门特别行政区".equals(expressOrder.getProvince())){
|
||||
orderRequestVo.setCurrencyCode("CNY");
|
||||
BigDecimal declaredValue = new BigDecimal(0);
|
||||
if (expressOrder.getCommodity().size()>0){
|
||||
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<ExpressOrderDao, Expres
|
||||
orderRequestVo.setRemark(expressOrder.getRemark());
|
||||
orderRequestVo.setTemplateSize("150");
|
||||
String requestData = JSONObject.toJSONString(orderRequestVo);
|
||||
//如果是顺丰港澳台,参数多两个必填CurrencyCode、Dutiable.DeclaredValue,需要大写
|
||||
String requestDataUpperCase = requestData;
|
||||
if (requestData.contains("currencyCode")){
|
||||
requestDataUpperCase = requestData.replace("currencyCode","CurrencyCode")
|
||||
.replace("dutiable","Dutiable")
|
||||
.replace("declaredValue","DeclaredValue");
|
||||
}
|
||||
|
||||
Map<String, String> 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();
|
||||
|
||||
15
src/main/java/com/peanut/modules/book/vo/DutiableVo.java
Normal file
15
src/main/java/com/peanut/modules/book/vo/DutiableVo.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.peanut.modules.book.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 申报价值
|
||||
*/
|
||||
@Data
|
||||
public class DutiableVo {
|
||||
|
||||
private BigDecimal DeclaredValue;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user