From 859af35a1dab1079cff82e521422ab24963f828b Mon Sep 17 00:00:00 2001
From: jyy <935090232@qq.com>
Date: Fri, 19 Mar 2021 11:10:31 +0800
Subject: [PATCH] 积分商城5
---
zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java | 54 +++++++++++-------------------------------------------
1 files changed, 11 insertions(+), 43 deletions(-)
diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
index 3e9fd80..cc29acd 100644
--- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
+++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java
@@ -98,52 +98,20 @@
private BusParameterSettingsDao busParameterSettingsDao;
@Override
- public BigDecimal calculationPostage(Integer addressId, BigDecimal payPrice) {
+ public BigDecimal calculationPostage(BigDecimal payPrice,Long companyId) {
BigDecimal postage = BigDecimal.ZERO;
- if (addressId != null) {
- ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(addressId);
-
-
- BusParameterSettings sn= busParameterSettingsDao.selectCompanyParamByCode(AppConstance.IN_PROVINCE_PACKAGE_LIST,17L);
-
-
- BusParameterSettings pydq= busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SECOND_PROVINCE_PACKAGE_LIST,17L);
-
-
-
- if (sn.getParamValue().indexOf(shopReceiveAddress.getAddrProvince()) > -1) {
- //省内邮费计算
- postage = getPostageByDataBictionary(AppConstance.IN_PROVINCE_PACKAGE_PRICE, payPrice);
- } else if (pydq.getParamValue().indexOf(shopReceiveAddress.getAddrProvince()) > -1) {
- //偏远地区
- postage = getPostageByDataBictionary(AppConstance.SECOND_OUT_PROVINCE_PACKAGE_PRICE, payPrice);
- } else {
- //其他地区
- postage = getPostageByDataBictionary(AppConstance.FIRST_OUT_PROVINCE_PACKAGE_PRICE, payPrice);
+ BusParameterSettings yf = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.PACKAGE_PRICE, companyId);
+ BusParameterSettings myje = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.FREE_PACKAGE_PRICE, companyId);
+ if(yf!=null&&myje!=null){
+ if (Double.parseDouble(myje.getParamValue()) > payPrice.doubleValue()) {
+ postage = new BigDecimal(yf.getParamValue());
}
-
}
+
return postage;
}
- //todo 根据数据字典计算运费 运费设置为0 后面再改配置在改计算规则
- private BigDecimal getPostageByDataBictionary(String code, BigDecimal payPrice) {
- /*CustomerDataDictionary dd = dataDictionaryDao.selectByTypeCode(code);
-
-
- BigDecimal postage = BigDecimal.ZERO;
- if (StringUtils.isNotBlank(dd.getValue())) {
- if (StringUtils.isNotBlank(dd.getExtValue())
- && payPrice.compareTo(new BigDecimal(dd.getExtValue())) >= 0) {
- //达到条件免邮
- postage = BigDecimal.ZERO;
- } else {
- postage = new BigDecimal(dd.getValue());
- }
- }*/
- return BigDecimal.ZERO;
- }
/**
@@ -166,7 +134,7 @@
}
- List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId());
+ List<ShopCartVo> cartList = shoppingCartService.findUserCartList(addShopOrderPOJO.getShopId(),ShopShoppingCart.CAR_TYPE_MICRO);
//购物车不能为空
if (CollectionUtils.isEmpty(cartList)) {
return new AjaxResult(AjaxResult.STATUS_FAIL, "请选择您需要购买的产品");
@@ -189,7 +157,7 @@
}
//计算订单优惠信息
- DiscountExplain discountExplain = buildDiscountExplain(cartList, addShopOrderPOJO.getCouponReceiveId(), shopReceiveAddress.getAddrId());
+ DiscountExplain discountExplain = buildDiscountExplain(cartList, addShopOrderPOJO.getCouponReceiveId(), bizUser.getCompanyId());
ShopOrder shopOrder = new ShopOrder();
@@ -308,7 +276,7 @@
}
@Override
- public DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer receiveId, Integer receiveAddrId) {
+ public DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer receiveId, Long companyId) {
ShopCartBillVo shopCartBill = shoppingCartService.buildShopCartBillVo(cartList);
DiscountExplain discountExplain = new DiscountExplain();
discountExplain.setActivity(shopCartBill.getBillCouponTotal());
@@ -325,7 +293,7 @@
}
}
- discountExplain.setPostage(calculationPostage(receiveAddrId, discountExplain.getPayPrice()));
+ discountExplain.setPostage(calculationPostage(discountExplain.getPayPrice(),companyId));
//计算实际支付
discountExplain.setPayPrice(discountExplain.getPayPrice().add(discountExplain.getPostage()));
--
Gitblit v1.9.1