|
@@ -193,7 +193,7 @@ public class PayServiceImpl implements PayService {
|
|
|
if(sysPaymentConfig != null){
|
|
|
|
|
|
List<StudentPaymentOrderDetail> batchUpdateList = new ArrayList<StudentPaymentOrderDetail>();
|
|
|
- List<Goods> batchUpdateGoodsList = new ArrayList<Goods>();
|
|
|
+ Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
|
|
|
|
|
|
// 如果买了商品或组合商品,商品有内部库存,则将钱转入指定账户已云教练的方式作为收费项目(杭州、齐齐哈尔除外)
|
|
|
// 1.查询商品订单明细
|
|
@@ -242,11 +242,17 @@ public class PayServiceImpl implements PayService {
|
|
|
for(Goods subGoods : goodsList){
|
|
|
//判断是否有内部库存
|
|
|
if(subGoods.getStockCount() > 0){
|
|
|
+
|
|
|
+ if(batchUpdateGoodsMap.get(subGoods.getId()) != null){
|
|
|
+ subGoods = batchUpdateGoodsMap.get(subGoods.getId());
|
|
|
+ }
|
|
|
+
|
|
|
groupPurchaseAmount = groupPurchaseAmount.add(subGoods.getGroupPurchasePrice());
|
|
|
subGoods.setStockCount(new AtomicInteger(subGoods.getStockCount()).decrementAndGet());
|
|
|
subGoods.setSellCount(new AtomicInteger(subGoods.getSellCount()).incrementAndGet());
|
|
|
subGoods.setUpdateTime(date);
|
|
|
- batchUpdateGoodsList.add(subGoods);
|
|
|
+
|
|
|
+ batchUpdateGoodsMap.put(subGoods.getId(), subGoods);
|
|
|
|
|
|
minuendStockGoodsIdList.add(subGoods.getId());
|
|
|
|
|
@@ -262,11 +268,16 @@ public class PayServiceImpl implements PayService {
|
|
|
totalGroupPurchaseAmount = totalGroupPurchaseAmount.add(goods.getGroupPurchasePrice());
|
|
|
//判断是否有内部库存
|
|
|
if(goods.getStockCount() > 0){
|
|
|
+
|
|
|
+ if(batchUpdateGoodsMap.get(goods.getId()) != null){
|
|
|
+ goods = batchUpdateGoodsMap.get(goods.getId());
|
|
|
+ }
|
|
|
+
|
|
|
groupPurchaseAmount = groupPurchaseAmount.add(goods.getGroupPurchasePrice());
|
|
|
goods.setStockCount(new AtomicInteger(goods.getStockCount()).decrementAndGet());
|
|
|
goods.setSellCount(new AtomicInteger(goods.getSellCount()).incrementAndGet());
|
|
|
goods.setUpdateTime(date);
|
|
|
- batchUpdateGoodsList.add(goods);
|
|
|
+ batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
|
|
|
minuendStockGoodsIdList.add(goods.getId());
|
|
|
|
|
@@ -311,8 +322,8 @@ public class PayServiceImpl implements PayService {
|
|
|
studentPaymentOrderDetailService.batchUpdate(batchUpdateList);
|
|
|
}
|
|
|
|
|
|
- if(batchUpdateGoodsList.size() > 0){
|
|
|
- goodsService.batchUpdate(batchUpdateGoodsList);
|
|
|
+ if(batchUpdateGoodsMap.size() > 0){
|
|
|
+ goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|
|
|
}
|
|
|
|
|
|
if(subCashAmount.doubleValue() > 0){
|