From 470af7313f05d5be58fb643981c27c486ba88f2f Mon Sep 17 00:00:00 2001 From: jyy <935090232@qq.com> Date: Tue, 09 Mar 2021 16:06:47 +0800 Subject: [PATCH] 优化邮费计算 --- zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java | 4 zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java | 29 +----- zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java | 33 +------ zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesGroupBuyController.java | 6 - zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java | 2 zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java | 3 zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java | 75 +----------------- zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java | 9 - zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSecKillAction.java | 12 ++ zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WXShopOrderServiceImpl.java | 52 ++---------- zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java | 4 zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java | 6 12 files changed, 51 insertions(+), 184 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java b/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java index 705a50f..957ed99 100644 --- a/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java +++ b/zq-erp/src/main/java/com/matrix/system/common/constance/AppConstance.java @@ -262,41 +262,11 @@ // =====================================订单包裹相关 - /** - * 省内包裹 - */ - public static final String IN_PROVINCE_PACKAGE = "IN_PROVINCE_PACKAGE"; - /** - * 外省包裹 - */ - public static final String OUT_PROVINCE_PACKAGE = "OUT_PROVINCE_PACKAGE"; - /** - * 省内免邮费包裹 - */ - public static final String PROVINCE_OVER_FREE_PACKAGE = "PROVINCE_OVER_FREE_PACKAGE"; // =====================================订单短信提醒相关 - /** - * 短信提醒 - */ - public static final String MSG_ALERT = "MSG_ALERT"; - /** - * 短信提醒号码(多个以",分割") - */ - public static final String MSG_ALERT_MOBILE = "MSG_ALERT_MOBILE"; - - /** - * 短信提醒内容 - */ - public static final String MSG_ALERT_CONTENT = "MSG_ALERT_CONTENT"; - - /** - * 商户余额不足短信提醒内容 - */ - public static final String MSG_ALERT_NSF = "MSG_ALERT_NSF"; /** * 待开票 @@ -542,51 +512,14 @@ public static final String REFUND_FAIL_NOTENOUGH = "NOTENOUGH"; - // =====================================分销相关 /** - * 成为分销商最低额度(查询数据字典时使用) + * 运费 */ - public static final String BECOMING_DISTRIBUTOR_CONDITION = "BECOMING_DISTRIBUTOR_CONDITION"; - + public static final String PACKAGE_PRICE = "PACKAGE_PRICE"; /** - * 用户等级-分销商 + * 免免邮金额 */ - public static final Integer USER_VIP_DISTRIBUTOR = 1; - - /** - * 积分业务类型-获得 - */ - public static final Integer SCORE_BUSINESS_TYPE_GET = 1; - - /** - * 积分业务类型-兑换 - */ - public static final Integer SCORE_BUSINESS_TYPE_EXCHANGE = 2; - - /** - * 免费配送距离 - */ - public static final String DELIVERY_DISTANCE = "delivery_distance"; - /** - * 支持学校列表 - */ - public static final String SCHOOL = "SCHOOL"; - - - /** - * 省运费关系 - */ - public static final String IN_PROVINCE_PACKAGE_PRICE = "IN_PROVINCE_PACKAGE_PRICE"; - public static final String FIRST_OUT_PROVINCE_PACKAGE_PRICE = "FIRST_OUT_PROVINCE_PACKAGE_PRICE"; - public static final String SECOND_OUT_PROVINCE_PACKAGE_PRICE = "SECOND_OUT_PROVINCE_PACKAGE_PRICE"; - - public static final String IN_PROVINCE_PACKAGE_LIST = "IN_PROVINCE_PACKAGE_LIST"; - public static final String FIRST_PROVINCE_PACKAGE_LIST = "FIRST_PROVINCE_PACKAGE_LIST"; - public static final String SECOND_PROVINCE_PACKAGE_LIST = "SECOND_PROVINCE_PACKAGE_LIST"; - /** - * 起送费 - */ - public static final String QSFY = "QSFY"; + public static final String FREE_PACKAGE_PRICE = "FREE_PACKAGE_PRICE"; /** diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java index ed0c492..7c7577a 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WXShopOrderAction.java @@ -10,7 +10,6 @@ import com.matrix.core.pojo.AjaxResult; import com.matrix.core.tools.StringUtils; import com.matrix.system.common.constance.AppConstance; -import com.matrix.system.common.interceptor.HostInterceptor; import com.matrix.system.constance.Dictionary; import com.matrix.system.hive.bean.ShoppingGoods; import com.matrix.system.hive.dao.ShoppingGoodsDao; @@ -117,7 +116,7 @@ } } //获取当前购物车产品可用的优惠券 - List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(HostInterceptor.getCompanyId(),notCouponuyCart); + List<CouponReceiveInfoVO> usefulCoupon = wxShopCouponService.getCartVoCouponList(bizUser.getCompanyId(),notCouponuyCart); //获取用户使用的优惠券 CouponReceiveInfoVO shopCoupon = new CouponReceiveInfoVO(); @@ -151,13 +150,9 @@ } - Integer addrId = null; - if (shopReceiveAddress != null) { - addrId = shopReceiveAddress.getAddrId(); - } //得到订单计价说明 - DiscountExplain discountExplain = shopOrderService.buildDiscountExplain(cartList, shopCoupon.getReceiveId(), addrId); + DiscountExplain discountExplain = shopOrderService.buildDiscountExplain(cartList, shopCoupon.getReceiveId(), bizUser.getCompanyId()); AjaxResult result = new AjaxResult(AjaxResult.STATUS_SUCCESS, buyCart, buyCart.size()); //结算金额信息 diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java index 9ad03ff..66b4c64 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxRefundRecordAction.java @@ -1,24 +1,22 @@ package com.matrix.system.shopXcx.api.action; +import com.matrix.biz.bean.BizUser; +import com.matrix.component.redis.RedisUserLoginUtils; +import com.matrix.component.tools.WxUtils; import com.matrix.core.pojo.AjaxResult; import com.matrix.core.tools.LogUtil; -import com.matrix.biz.bean.BizUser; -import com.matrix.system.common.bean.BusParameterSettings; import com.matrix.system.common.bean.CustomerDataDictionary; +import com.matrix.system.common.constance.AppConstance; import com.matrix.system.common.dao.BusParameterSettingsDao; import com.matrix.system.common.dao.CustomerDataDictionaryDao; -import com.matrix.component.redis.RedisUserLoginUtils; -import com.matrix.system.common.constance.AppConstance; - +import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService; +import com.matrix.system.shopXcx.api.tools.SMSTools; import com.matrix.system.shopXcx.bean.ShopDeliveryInfo; import com.matrix.system.shopXcx.bean.ShopOrder; import com.matrix.system.shopXcx.bean.ShopRefundRecord; import com.matrix.system.shopXcx.dao.ShopDeliveryInfoDao; import com.matrix.system.shopXcx.dao.ShopOrderDao; import com.matrix.system.shopXcx.dao.ShopRefundRecordDao; -import com.matrix.component.tools.WxUtils; -import com.matrix.system.shopXcx.api.service.WxShopRefundRecordService; -import com.matrix.system.shopXcx.api.tools.SMSTools; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -175,25 +173,6 @@ modifyMap.put("id", orderId); modifyMap.put("orderStatus", ShopOrder.ORDER_STATUS_APPLY_MONEYBACK); shopOrderDao.updateByMap(modifyMap); - //从数据字典获取需要发送的手机号码和短信提醒内容 - BusParameterSettings busParameterSetting1 =busParameterSettingsDao.selectCompanyParamByCode("MSG_ALERT_CONTENT_REFUND",17L); - - String msg = busParameterSetting1.getParamValue(); - - - //TODO 写死微商城17L公司id - BusParameterSettings busParameterSetting= busParameterSettingsDao.selectCompanyParamByCode("MSG_ALERT_MOBILE",17L); - - - String phons = busParameterSetting.getParamValue(); - - phons.replace(',',','); - List<String> result = Arrays.asList(phons.split(",")); - if(CollectionUtils.isNotEmpty(result)){ - for(String phon : result){ - smsTools.sendMsg(phon, msg + "退订回T" ); - } - } return new AjaxResult(AjaxResult.STATUS_SUCCESS, "保存成功"); } diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesGroupBuyController.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesGroupBuyController.java index b33e744..6054384 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesGroupBuyController.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesGroupBuyController.java @@ -4,7 +4,6 @@ import com.matrix.component.redis.RedisUserLoginUtils; import com.matrix.core.pojo.AjaxResult; import com.matrix.system.common.interceptor.HostInterceptor; -import com.matrix.system.hive.dao.SysVipInfoDao; import com.matrix.system.shopXcx.api.service.WXShopOrderService; import com.matrix.system.shopXcx.api.service.WxShopActivitiesGroupService; import com.matrix.system.shopXcx.api.vo.WxActivitiesGroupBuyVO; @@ -17,8 +16,6 @@ import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; -import java.util.Calendar; -import java.util.Date; import java.util.List; /** @@ -201,6 +198,7 @@ @PostMapping(value = "/calPrice") public AjaxResult calPrice(@RequestBody CreateGroupBuyDTO createGroupBuyDTO) { + BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); ShopActivitiesGroupPrice groupPrice = shopActivitiesGroupPriceDao.selectById(createGroupBuyDTO.getGpId()); // 判断参数中gjId是否为空,若为空则为团长开团。再判断团长价是否为空,如果不为空则拥有团长价 if (createGroupBuyDTO.getGjId() == null) { @@ -212,7 +210,7 @@ } else { createGroupBuyDTO.setPrice(groupPrice.getGpPrice()); } - BigDecimal postage = wxShopOrderService.calculationPostage(createGroupBuyDTO.getAddressId(), createGroupBuyDTO.getPrice()); + BigDecimal postage = wxShopOrderService.calculationPostage(createGroupBuyDTO.getPrice(),bizUser.getCompanyId()); BigDecimal payPrice = createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount())).add(postage); AjaxResult ajaxResult = new AjaxResult(AjaxResult.STATUS_SUCCESS, null); ajaxResult.putInMap("billPrice", createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount()))); diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSecKillAction.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSecKillAction.java index af6cc71..d931daf 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSecKillAction.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/action/WxShopActivitiesSecKillAction.java @@ -1,5 +1,7 @@ package com.matrix.system.shopXcx.api.action; +import com.matrix.biz.bean.BizUser; +import com.matrix.component.redis.RedisUserLoginUtils; import com.matrix.core.pojo.AjaxResult; import com.matrix.system.shopXcx.api.service.WXShopOrderService; import com.matrix.system.shopXcx.api.service.WxShopActivitiesSecKillService; @@ -37,7 +39,10 @@ @Autowired private WXShopOrderService wxShopOrderService; @Autowired - private WxShopActivitiesSecKillService wxShopActivitiesSecKillService; + private WxShopActivitiesSecKillService wxShopActvitiesSecKillService; + + @Autowired + private RedisUserLoginUtils redisUserLoginUtils; /** @@ -106,12 +111,13 @@ */ @PostMapping(value = "/calSecKillPrice") public AjaxResult calSecKillPrice(@RequestBody SecKillVO secKillVO) { + BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); ShopActivitiesSeckillInfo seckillInfo = shopActivitiesSeckillInfoDao.selectById(secKillVO.getId()); if (seckillInfo == null) { return AjaxResult.buildFailInstance("参数有误"); } - BigDecimal postage = wxShopOrderService.calculationPostage(secKillVO.getAddressId(), seckillInfo.getSiPrice()); + BigDecimal postage = wxShopOrderService.calculationPostage(seckillInfo.getSiPrice(),bizUser.getCompanyId()); BigDecimal payPrice = seckillInfo.getSiPrice().multiply(BigDecimal.valueOf(secKillVO.getCount())).add(postage); AjaxResult ajaxResult = new AjaxResult(AjaxResult.STATUS_SUCCESS, null); ajaxResult.putInMap("totalPrice", payPrice); @@ -128,6 +134,6 @@ */ @PostMapping(value = "/createSecKill") public AjaxResult createSecKill(@RequestBody CreateSecKillDTO secKillDTO) throws Exception { - return wxShopActivitiesSecKillService.createSecKillOrder(secKillDTO); + return wxShopActvitiesSecKillService.createSecKillOrder(secKillDTO); } } diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java index f790cc8..5180721 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/ShoppingCartService.java @@ -1,19 +1,14 @@ package com.matrix.system.shopXcx.api.service; -import com.matrix.core.tools.LogUtil; import com.matrix.biz.bean.BizUser; -import com.matrix.system.common.bean.BusParameterSettings; -import com.matrix.system.common.bean.CustomerDataDictionary; -import com.matrix.system.common.dao.BusParameterSettingsDao; -import com.matrix.system.common.dao.CustomerDataDictionaryDao; import com.matrix.component.redis.RedisUserLoginUtils; -import com.matrix.system.common.constance.AppConstance; - +import com.matrix.core.tools.LogUtil; +import com.matrix.system.common.dao.BusParameterSettingsDao; +import com.matrix.system.shopXcx.api.vo.ShopCartBillVo; +import com.matrix.system.shopXcx.api.vo.ShopCartVo; import com.matrix.system.shopXcx.bean.ShopCoupon; import com.matrix.system.shopXcx.bean.ShopShoppingCart; import com.matrix.system.shopXcx.dao.ShopShoppingCartDao; -import com.matrix.system.shopXcx.api.vo.ShopCartBillVo; -import com.matrix.system.shopXcx.api.vo.ShopCartVo; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -108,11 +103,7 @@ // 1表示没有优惠的默认分组 ShopCartVo def = new ShopCartVo(); - /** - * 同城配送标题 - * //DataDictionary qsfy = dataDictionaryDao.selectByTypeCode(AppConstance.QSFY); - * //def.setMsg("2公里内满" + qsfy.getValue() + "元免配送费"); - */ + def.setMsg("商城"); def.setCartList(new ArrayList<>()); @@ -316,15 +307,9 @@ } } } else { - BusParameterSettings qsfy= busParameterSettingsDao.selectCompanyParamByCode(AppConstance.IN_PROVINCE_PACKAGE_LIST,17L); - - shopCartVo.setSubtotal(selectSum); - shopCartVo.setSrcPrice(selectSum); - if (selectSum.compareTo(new BigDecimal(qsfy.getParamValue())) < 0) { - shopCartVo.setSatisfactionCoupon(false); - } else { + shopCartVo.setSubtotal(selectSum); + shopCartVo.setSrcPrice(selectSum); shopCartVo.setSatisfactionCoupon(true); - } } } } diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java index ac90aef..3dabe15 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WXShopOrderService.java @@ -18,7 +18,7 @@ - BigDecimal calculationPostage(Integer addressId, BigDecimal payPrice); + BigDecimal calculationPostage(BigDecimal payPrice,Long companyId); /** * 创建订单 @@ -93,5 +93,5 @@ */ AjaxResult updateStockAndVolumeById(Integer orderId); - DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer id, Integer addrId); + DiscountExplain buildDiscountExplain(List<ShopCartVo> cartList, Integer id, Long companyId); } diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java index 93bea5c..13d6e99 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/WxShopCouponService.java @@ -18,7 +18,7 @@ * 根据购物车选中的产品 * @return */ - public List<CouponReceiveInfoVO> getCartVoCouponList(Long shopId,List<ShopShoppingCart> shopShoppingCarts); + public List<CouponReceiveInfoVO> getCartVoCouponList(Long companyId,List<ShopShoppingCart> shopShoppingCarts); /** 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..dce9db6 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; - } /** @@ -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())); diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java index be14cdf..755f560 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesGroupServiceImpl.java @@ -8,7 +8,6 @@ import com.matrix.component.wechat.externalInterface.protocol.paramProtocol.BrandWCPayRequestData; import com.matrix.core.exception.GlobleException; import com.matrix.core.pojo.AjaxResult; -import com.matrix.core.tools.LogUtil; import com.matrix.core.tools.StringUtils; import com.matrix.system.common.constance.AppConstance; import com.matrix.system.constance.Dictionary; @@ -318,8 +317,9 @@ if (shopReceiveAddress == null) { throw new GlobleException("请选择正确的收获地址"); } - + BizUser user=redisUserLoginUtils.getLoginUser(BizUser.class); ShopOrder shopOrder = new ShopOrder(); + shopOrder.setCompanyId(user.getCompanyId()); shopOrder.setStoreId(Integer.parseInt(createGroupBuyDTO.getShopId().toString())); shopOrder.setOrderType(ShopOrder.ORDER_TYPE_SERVICE); @@ -389,7 +389,7 @@ shopOrder.setPayResult(ShopOrder.ORDER_WX_STATUS_WAIT_PAY); //如果没有提交购买方式或配送方式不是物流 //获取邮费 - BigDecimal postPrice = wxShopOrderService.calculationPostage(createGroupBuyDTO.getAddressId(), createGroupBuyDTO.getPrice()); + BigDecimal postPrice = wxShopOrderService.calculationPostage(createGroupBuyDTO.getPrice(),user.getCompanyId()); shopOrder.setPostage(postPrice); BigDecimal payPrice = createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount())).add(shopOrder.getPostage()); shopOrder.setOrderMoney(payPrice); diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java index bf2e433..1453dca 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/api/service/impl/WxShopActivitiesSecKillServiceImpl.java @@ -126,6 +126,7 @@ } private ShopOrder createOrder(CreateSecKillDTO secKillDTO) { + BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); ShopReceiveAddress shopReceiveAddress = shopReceiveAddressDao.selectById(secKillDTO.getAddressId()); if (shopReceiveAddress == null) { throw new GlobleException("请选择正确的收获地址"); @@ -177,6 +178,7 @@ shopOrder.setUpdateBy("微信小程序生成"); shopOrder.setCommodityPrice(secKillDTO.getPrice()); shopOrder.setPurchaseQuantity(1); + shopOrder.setCompanyId(bizUser.getCompanyId()); //购买方式 shopOrder.setShippingMethod(secKillDTO.getShippingMethod()); //生成订单号 @@ -201,7 +203,7 @@ shopOrder.setPayResult(ShopOrder.ORDER_WX_STATUS_WAIT_PAY); //如果没有提交购买方式或配送方式不是物流 //获取邮费 - BigDecimal postPrice = wxShopOrderService.calculationPostage(secKillDTO.getAddressId(), secKillDTO.getPrice()); + BigDecimal postPrice = wxShopOrderService.calculationPostage(secKillDTO.getPrice(),bizUser.getCompanyId()); shopOrder.setPostage(postPrice); BigDecimal payPrice = secKillDTO.getPrice().multiply(BigDecimal.valueOf(secKillDTO.getCount())).add(shopOrder.getPostage()); shopOrder.setOrderMoney(payPrice); diff --git a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java index 8fd2018..2c9ff6d 100644 --- a/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java +++ b/zq-erp/src/main/java/com/matrix/system/shopXcx/mqTask/OrderTask.java @@ -93,6 +93,7 @@ BizUser bizUser = bizUserService.findByOpenId(orderDto.getUserId()); SysOrder order = new SysOrder(); + //TODO 根据公司id区分 SysVipInfo vipInfo = vipDao.selectByPhone(bizUser.getPhoneNumber()); if(SysVipInfo.UNDEAL_VIP==vipInfo.getIsDeal()){ //非成交客户下单更新客户为成交客户 @@ -101,7 +102,7 @@ } //获取订单归属门店 - order.setCompanyId(vipInfo.getCompanyId()); + order.setCompanyId(orderDto.getCompanyId()); order.setShopId(Long.parseLong(orderDto.getStoreId()+"")); //同步的订单订单编号保持一致 order.setOrderNo(orderDto.getOrderNo()); -- Gitblit v1.9.1