From b1158d0bb5b453f0b8e5df143de92ee08d1e9048 Mon Sep 17 00:00:00 2001 From: 935090232@qq.com <ak473600000> Date: Wed, 27 Oct 2021 16:12:23 +0800 Subject: [PATCH] 修改赠送金额购买项目没打折的情况 --- zq-erp/src/main/resources/config/application.properties | 12 ++++++------ zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 41 +++++++++++++++++++++++++++++++++-------- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java index 0bdf347..230e11f 100644 --- a/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java +++ b/zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java @@ -36,7 +36,6 @@ import com.matrix.system.wechart.templateMsg.UniformMsgParam; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -483,9 +482,7 @@ // 更新收款时间 - pageOrder.setPayTime(new Date()); - pageOrder.setStatu(Dictionary.ORDER_STATU_YFK); - sysOrderDao.update(pageOrder); + updateOrderInfo(pageOrder); // 获取用户信息 SysVipInfo vipInfo = sysVipInfoDao.selectById(pageOrder.getVipId()); @@ -515,6 +512,30 @@ //设置会员积分 addVipScore(pageOrder); + } + + /** + * 付款后更新订单信息 + * @param pageOrder + */ + private void updateOrderInfo(SysOrder pageOrder) { + pageOrder.setPayTime(new Date()); + pageOrder.setStatu(Dictionary.ORDER_STATU_YFK); + List<SysOrderFlow> flows = pageOrder.getFlows(); + + BigDecimal cashPayAmount = flows.stream() + .filter(item -> (!item.getPayMethod().equals("储值卡")) && (!item.getPayMethod().equals("欠款"))) + .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + + BigDecimal cardPayAmount = flows.stream() + .filter(item -> item.getPayMethod().equals("储值卡") && item.getIsGift().equals("N")) + .map(SysOrderFlow::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); + + pageOrder.setCardPay(cardPayAmount.doubleValue()); + pageOrder.setCashPay(cashPayAmount.doubleValue()); + //欠款金额在流水处理中处理了 + + sysOrderDao.update(pageOrder); } private void checkOrder(SysOrder pageOrder) { @@ -1380,17 +1401,21 @@ //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗 boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE); if (zsConsumeAchieve) { - puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice()); + //赠送情况下,如果收款金额大于0,就是赠送金额划扣的情况,金额即为划扣的折扣金额 + if(sysOrderItem.getZkPrice()>0){ + puse.setPrice(sysOrderItem.getZkPrice()); + }else{ + puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice()); + } + } else { puse.setPrice(0D); } - - } // 设置失效时间 Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null); puse.setFailTime(invalidTime); - puse.setBalance(sysOrderItem.getShoppingGoods().getSealPice() * puse.getSurplusCount()); + puse.setBalance(puse.getPrice() * puse.getSurplusCount()); sysProjUseDao.insert(puse); } diff --git a/zq-erp/src/main/resources/config/application.properties b/zq-erp/src/main/resources/config/application.properties index 7b6d3b6..d2d049e 100644 --- a/zq-erp/src/main/resources/config/application.properties +++ b/zq-erp/src/main/resources/config/application.properties @@ -4,9 +4,9 @@ #线上测试环境 # -spring.datasource.username=ct_test -spring.datasource.password=123456 -spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test_meidu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 +#spring.datasource.username=ct_test +#spring.datasource.password=123456 +#spring.datasource.url=jdbc:mysql://120.27.238.55:3306/hive_test_meidu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 #spring.datasource.username=xc_shop #spring.datasource.password=xc_shop123!@# @@ -22,9 +22,9 @@ #spring.datasource.url=jdbc:mysql://47.111.134.136/db_meidu_prd?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 -#spring.datasource.username=root -#spring.datasource.password=root -#spring.datasource.url=jdbc:mysql://127.0.0.1:3306/md_test_local?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 +spring.datasource.username=root +spring.datasource.password=root +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/md_test_local?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&allowMultiQueries=true&transformedBitIsBoolean=true&serverTimezone=GMT%2B8 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource -- Gitblit v1.9.1