From 5ab7e28a31f810d8932ebf3b5c4b4cb7490e4089 Mon Sep 17 00:00:00 2001
From: 935090232@qq.com <ak473600000>
Date: Fri, 15 Oct 2021 13:29:21 +0800
Subject: [PATCH] 删除商品分类门店隔离
---
zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysOrderServiceImpl.java | 94 +++++++++++++++++++++++------------------------
1 files changed, 46 insertions(+), 48 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 53dffd4..9cfeec1 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
@@ -524,34 +524,34 @@
* 检查产品销售次数
*/
private void checkSealLimit(SysOrder pageOrder) {
- pageOrder.getItems().forEach(item->{
- ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId());
+ pageOrder.getItems().forEach(item->{
+ ShoppingGoods shopGoods = shoppingGoodsDao.selectById(item.getGoodsId());
- //最大销售次数检测
- Integer maxNum = shopGoods.getCarMaxSaleCount();
- if (maxNum != null && maxNum != 0) {
- Integer buyNum = orderItemDao.selectByGoodsId(shopGoods.getId(),null);
- if ((buyNum + item.getCount()) > maxNum) {
- throw new GlobleException(shopGoods.getName() + "已超过最大销售数量");
- }
- if ((buyNum + item.getCount()) == maxNum) {
- if (!shopGoods.getStaus().equals(Dictionary.BUSINESS_STATE_DOWN)) {
- shopGoods.setStaus(Dictionary.BUSINESS_STATE_DOWN);
- shoppingGoodsDao.update(shopGoods);
- }
- }
- }
- //每人限购次数检测
- Integer onceCount = shopGoods.getIsOnce();
- if(onceCount!=null && onceCount!=0){
- Integer buyOnceCount = orderItemDao.selectByGoodsId(shopGoods.getId(),pageOrder.getVipId());
+ //最大销售次数检测
+ Integer maxNum = shopGoods.getCarMaxSaleCount();
+ if (maxNum != null && maxNum != 0) {
+ Integer buyNum = orderItemDao.selectByGoodsId(shopGoods.getId(),null);
+ if ((buyNum + item.getCount()) > maxNum) {
+ throw new GlobleException(shopGoods.getName() + "已超过最大销售数量");
+ }
+ if ((buyNum + item.getCount()) == maxNum) {
+ if (!shopGoods.getStaus().equals(Dictionary.BUSINESS_STATE_DOWN)) {
+ shopGoods.setStaus(Dictionary.BUSINESS_STATE_DOWN);
+ shoppingGoodsDao.update(shopGoods);
+ }
+ }
+ }
+ //每人限购次数检测
+ Integer onceCount = shopGoods.getIsOnce();
+ if(onceCount!=null && onceCount!=0){
+ Integer buyOnceCount = orderItemDao.selectByGoodsId(shopGoods.getId(),pageOrder.getVipId());
- if ((buyOnceCount + item.getCount()) > onceCount) {
- throw new GlobleException(shopGoods.getName() + "每人限购"+onceCount+"次");
- }
- }
+ if ((buyOnceCount + item.getCount()) > onceCount) {
+ throw new GlobleException(shopGoods.getName() + "每人限购"+onceCount+"次");
+ }
+ }
- });
+ });
}
@@ -666,15 +666,15 @@
//添加自己的积分
if(selfScore>0){
- scoreVipDetailService.addScore(
- vipInfo.getId(),
- pageOrder.getStaffId(),
- pageOrder.getShopId(),
- selfScore,
- pageOrder.getId(),
- ScoreVipDetail.SCORE_VIP_TYPE_CASH,
- "消费奖励"
- );
+ scoreVipDetailService.addScore(
+ vipInfo.getId(),
+ pageOrder.getStaffId(),
+ pageOrder.getShopId(),
+ selfScore,
+ pageOrder.getId(),
+ ScoreVipDetail.SCORE_VIP_TYPE_CASH,
+ "消费奖励"
+ );
}
if(vipInfo.getRecommendId()!=null){
@@ -1026,8 +1026,8 @@
}
sourceOrder.setArrears(sourceOrder.getArrears() - refundTotal);
- sourceOrder.setCardPay(sourceOrder.getCardPay() + cardPayTotal);
- sourceOrder.setCashPay(sourceOrder.getCashPay() + cashPayTotal);
+ sourceOrder.setCardPay(sourceOrder.getCardPay()==null?0:sourceOrder.getCardPay() + cardPayTotal);
+ sourceOrder.setCashPay(sourceOrder.getCashPay()==null?0:sourceOrder.getCashPay() + cashPayTotal);
sysOrderDao.update(sourceOrder);
}
@@ -1188,7 +1188,7 @@
List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_XM);
assembleList.forEach(item -> {
//TODO 补综合卡逻辑
- createProjuseByAssemble(order, sysOrderItem, item, null, null,null);
+ createProjuseByAssemble(order, sysOrderItem, item, null, null,null,0);
});
//处理综合卡中包含的套餐
@@ -1209,7 +1209,7 @@
* 通过组合关系创建用户项目余次
*/
private SysProjUse createProjuseByAssemble(SysOrder order, SysOrderItem sysOrderItem,
- ShoppingGoodsAssemble goodsAssemble, Long taocanId, Date failTime,String source) {
+ ShoppingGoodsAssemble goodsAssemble, Long taocanId, Date failTime,String source,Integer maxCount) {
//计算折扣
Double zk = sysOrderItem.getZkPrice() / sysOrderItem.getPrice();
@@ -1217,7 +1217,7 @@
puse.setIsOver(Dictionary.DELETED_N);
puse.setOrderItemId(sysOrderItem.getId());
puse.setProjId(goodsAssemble.getAssembleGoodId());
- puse.setSurplusCount(goodsAssemble.getTotal());
+ puse.setSurplusCount(goodsAssemble.getTotal()==null?maxCount: goodsAssemble.getTotal());
puse.setDeductionNum(goodsAssemble.getDeductionNum());
puse.setProjName(goodsAssemble.getShoppingGoods().getName());
puse.setVipId(order.getVipId());
@@ -1297,19 +1297,21 @@
//创建套餐绑定的项目
List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(projId, ShoppingGoods.SHOPPING_GOODS_TYPE_XM);
for (ShoppingGoodsAssemble assemble : assembleList) {
- SysProjUse tempUse = createProjuseByAssemble(order, sysOrderItem, assemble, taocanProjUse.getId(),taocanProjUse.getFailTime(),taocanProjUse.getSource());
+ SysProjUse tempUse = createProjuseByAssemble(order, sysOrderItem, assemble, taocanProjUse.getId(),taocanProjUse.getFailTime(),taocanProjUse.getSource(),taocanShoppingGoods.getCarUseCount());
sumBanance += tempUse.getBalance();
surplusCount += tempUse.getSurplusCount();
}
if (Dictionary.FLAG_NO_N.equals(taocanShoppingGoods.getIsCourse())) {
//固定套餐,剩余次数等于绑定项目的次数
taocanProjUse.setSurplusCount(surplusCount);
+ //合计套餐余额
+ taocanProjUse.setBalance(sumBanance);
} else {
//任选套餐剩余次数等于最大使用次数
taocanProjUse.setSurplusCount(taocanShoppingGoods.getCarUseCount());
+ taocanProjUse.setBalance(sysOrderItem.getZkPrice());
}
- //合计套餐余额
- taocanProjUse.setBalance(sumBanance);
+
sysProjUseDao.update(taocanProjUse);
}
@@ -1345,11 +1347,7 @@
//赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗
boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE);
if(zsConsumeAchieve){
- if(sysOrderItem.getPrice()>0){
- puse.setPrice(sysOrderItem.getZkPrice());
- }else{
- puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice());
- }
+ puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice());
}else{
puse.setPrice(0D);
}
@@ -1681,7 +1679,7 @@
int sub = sysProjUse.getSurplusCount() - item.getCount();
if (sub < 0) {
- throw new GlobleException("项目余次不足");
+ throw new GlobleException("项目余次不足");
}else if(sub==0){
sysProjUse.setIsOver(Dictionary.FLAG_YES_Y);
sysProjUse.setStatus(Dictionary.TAOCAN_STATUS_WX);
--
Gitblit v1.9.1