|
@@ -207,6 +207,54 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
}
|
|
|
//退优惠券
|
|
|
sysCouponCodeService.quit(orderByOrderNo.getCouponCodeId());
|
|
|
+
|
|
|
+ Date nowDate = new Date();
|
|
|
+ //增加商品库存
|
|
|
+ List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(orderByOrderNo.getId());
|
|
|
+ String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
|
|
|
+ if(StringUtils.isNotBlank(goodsIds)){
|
|
|
+ GoodsProcurement goodsProcurement = null;
|
|
|
+ List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
|
|
|
+ Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
|
|
|
+ Goods goods = null;
|
|
|
+ Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
|
|
|
+ Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
+
|
|
|
+ for(String goodsIdStr : goodsIds.split(",")){
|
|
|
+ if(StringUtils.isBlank(goodsIdStr)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ goods = goodsMap.get(Integer.parseInt(goodsIdStr));
|
|
|
+ if(batchUpdateGoodsMap.get(goods.getId()) != null){
|
|
|
+ goods = batchUpdateGoodsMap.get(goods.getId());
|
|
|
+ }
|
|
|
+ goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
+ goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
|
|
|
+ goods.setUpdateTime(nowDate);
|
|
|
+
|
|
|
+ batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
+
|
|
|
+ // 进货清单
|
|
|
+ goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
+ if(goodsProcurement != null){
|
|
|
+ if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
|
|
|
+ goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
|
|
|
+ }
|
|
|
+ goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
|
|
|
+ goodsProcurement.setUpdateTime(nowDate);
|
|
|
+ goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if(goodsProcurementMap.size() > 0){
|
|
|
+ goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
|
|
|
+ }
|
|
|
+
|
|
|
+ if(batchUpdateGoodsMap.size() > 0){
|
|
|
+ goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
StudentGoodsSell byOrderNo = studentGoodsSellDao.findByOrderNo(studentGoodsSell.getOrderNo());
|
|
|
if (byOrderNo != null) {
|
|
@@ -257,11 +305,11 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
goodsSellDto.setGoodsGroupPrice(groupPriceMap.get(goodsSellDto.getGoodsId()));
|
|
|
goodsSellDto.setTotalGoodsPrice(map.get(goodsSellDto.getGoodsId()).multiply(new BigDecimal(goodsSellDto.getGoodsNum())));
|
|
|
}
|
|
|
- Map<Integer, List<GoodsSellDto>> goodsMap = goodsSellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId));
|
|
|
+ Map<Integer, List<GoodsSellDto>> goodsSellDtoMap = goodsSellDtos.stream().collect(Collectors.groupingBy(GoodsSellDto::getGoodsId));
|
|
|
BigDecimal amount = BigDecimal.ZERO;
|
|
|
BigDecimal groupAmount = BigDecimal.ZERO;
|
|
|
for (Integer id : goodsIds) {
|
|
|
- GoodsSellDto goodsSellDto = goodsMap.get(id).get(0);
|
|
|
+ GoodsSellDto goodsSellDto = goodsSellDtoMap.get(id).get(0);
|
|
|
amount = amount.add(goodsSellDto.getTotalGoodsPrice());
|
|
|
groupAmount = groupAmount.add(goodsSellDto.getGoodsGroupPrice());
|
|
|
}
|
|
@@ -322,33 +370,44 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
if(goodsSellDtos != null){
|
|
|
String goodsIdsStr = goodsSellDtos.stream().map(t -> t.getGoodsId().toString()).collect(Collectors.joining(","));
|
|
|
List<Goods> goodsList = goodsService.findGoodsByIds(goodsIdsStr);
|
|
|
- BigDecimal goodsPrice = goodsList.stream().map(t -> t.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- for(Goods g : goodsList){
|
|
|
- studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
- studentPaymentOrderDetail.setCreateTime(date);
|
|
|
- if(g.getType() == GoodsType.INSTRUMENT){
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
|
|
|
- }else if(g.getType() == GoodsType.ACCESSORIES){
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
|
|
|
- }else if(g.getType() == GoodsType.TEACHING || g.getType() == GoodsType.STAFF){
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
|
|
|
- }else{
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
|
|
|
- }
|
|
|
- studentPaymentOrderDetail.setGoodsIdList(g.getId() + "");
|
|
|
-
|
|
|
- BigDecimal tempPrice = studentPaymentOrder.getExpectAmount().multiply(g.getGroupPurchasePrice()).divide(goodsPrice, RoundingMode.UP);
|
|
|
-
|
|
|
- if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0){
|
|
|
- studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
|
|
|
- }else{
|
|
|
- studentPaymentOrderDetail.setPrice(tempPrice);
|
|
|
- }
|
|
|
- studentPaymentOrderDetail.setUpdateTime(date);
|
|
|
- studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
-
|
|
|
- totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
|
|
|
- studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
|
|
|
+ BigDecimal totalGroupPurchasePrice = goodsList.stream().map(t -> t.getGroupPurchasePrice()).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
+ Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
|
|
|
+
|
|
|
+ Goods goods = null;
|
|
|
+ for(String goodsIdStr : goodsIdsStr.split(",")){
|
|
|
+ if(StringUtils.isBlank(goodsIdStr)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ goods = goodsMap.get(Integer.parseInt(goodsIdStr));
|
|
|
+
|
|
|
+ if(goods != null){
|
|
|
+ studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
+ studentPaymentOrderDetail.setCreateTime(date);
|
|
|
+ if(goods.getType() == GoodsType.INSTRUMENT){
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
|
|
|
+ }else if(goods.getType() == GoodsType.ACCESSORIES){
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
|
|
|
+ }else if(goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF){
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
|
|
|
+ }else{
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
|
|
|
+ }
|
|
|
+ studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
|
|
|
+
|
|
|
+ BigDecimal tempPrice = studentPaymentOrder.getExpectAmount().multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, RoundingMode.UP);
|
|
|
+
|
|
|
+ if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0){
|
|
|
+ studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
|
|
|
+ }else{
|
|
|
+ studentPaymentOrderDetail.setPrice(tempPrice);
|
|
|
+ }
|
|
|
+ studentPaymentOrderDetail.setUpdateTime(date);
|
|
|
+ studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+
|
|
|
+ totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
|
|
|
+ studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -639,32 +698,52 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
if(StringUtils.isNotBlank(repairInfo.getGoodsJson()) && repairGoodsDtos != null){
|
|
|
String goodsIds = repairGoodsDtos.stream().map(t -> t.getId().toString()).collect(Collectors.joining(","));
|
|
|
List<Goods> goodsList = goodsService.findGoodsByIds(goodsIds);
|
|
|
- for(Goods g : goodsList){
|
|
|
- studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
- studentPaymentOrderDetail.setCreateTime(date);
|
|
|
- if(g.getType() == GoodsType.INSTRUMENT){
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
|
|
|
- }else if(g.getType() == GoodsType.ACCESSORIES){
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
|
|
|
- }else if(g.getType() == GoodsType.TEACHING || g.getType() == GoodsType.STAFF){
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
|
|
|
- }else{
|
|
|
- studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
|
|
|
- }
|
|
|
- studentPaymentOrderDetail.setGoodsIdList(g.getId() + "");
|
|
|
-
|
|
|
- BigDecimal tempPrice = studentPaymentOrder.getExpectAmount().subtract(repairPrice).multiply(g.getGroupPurchasePrice()).divide(goodsPrice, RoundingMode.UP);
|
|
|
-
|
|
|
- if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0){
|
|
|
- studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
|
|
|
- }else{
|
|
|
- studentPaymentOrderDetail.setPrice(tempPrice);
|
|
|
- }
|
|
|
- studentPaymentOrderDetail.setUpdateTime(date);
|
|
|
- studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
-
|
|
|
- totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
|
|
|
- studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
|
|
|
+ Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
|
|
|
+ Goods goods = null;
|
|
|
+ BigDecimal totalGroupPurchasePrice = BigDecimal.ZERO;
|
|
|
+ for(String goodsIdStr : goodsIds.split(",")){
|
|
|
+ if(StringUtils.isBlank(goodsIdStr)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ goods = goodsMap.get(Integer.parseInt(goodsIdStr));
|
|
|
+
|
|
|
+ if(goods != null){
|
|
|
+ totalGroupPurchasePrice = totalGroupPurchasePrice.add(goods.getGroupPurchasePrice());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for(String goodsIdStr : goodsIds.split(",")){
|
|
|
+ if(StringUtils.isBlank(goodsIdStr)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ goods = goodsMap.get(Integer.parseInt(goodsIdStr));
|
|
|
+
|
|
|
+ if(goods != null){
|
|
|
+ studentPaymentOrderDetail = new StudentPaymentOrderDetail();
|
|
|
+ studentPaymentOrderDetail.setCreateTime(date);
|
|
|
+ if(goods.getType() == GoodsType.INSTRUMENT){
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.MUSICAL);
|
|
|
+ }else if(goods.getType() == GoodsType.ACCESSORIES){
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.ACCESSORIES);
|
|
|
+ }else if(goods.getType() == GoodsType.TEACHING || goods.getType() == GoodsType.STAFF){
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.TEACHING);
|
|
|
+ }else{
|
|
|
+ studentPaymentOrderDetail.setType(OrderDetailTypeEnum.OTHER);
|
|
|
+ }
|
|
|
+ studentPaymentOrderDetail.setGoodsIdList(goodsIdStr);
|
|
|
+
|
|
|
+ BigDecimal tempPrice = studentPaymentOrder.getExpectAmount().subtract(repairPrice).multiply(goods.getGroupPurchasePrice()).divide(totalGroupPurchasePrice, RoundingMode.UP);
|
|
|
+
|
|
|
+ if(totalPrice.add(tempPrice).compareTo(studentPaymentOrder.getExpectAmount()) > 0){
|
|
|
+ studentPaymentOrderDetail.setPrice(studentPaymentOrder.getExpectAmount().subtract(totalPrice));
|
|
|
+ }else{
|
|
|
+ studentPaymentOrderDetail.setPrice(tempPrice);
|
|
|
+ }
|
|
|
+ studentPaymentOrderDetail.setUpdateTime(date);
|
|
|
+ studentPaymentOrderDetail.setPaymentOrderId(studentPaymentOrder.getId());
|
|
|
+
|
|
|
+ totalPrice = totalPrice.add(studentPaymentOrderDetail.getPrice());
|
|
|
+ studentPaymentOrderDetailList.add(studentPaymentOrderDetail);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -957,36 +1036,51 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
saveSellOrder(studentPaymentOrder.getOrderNo());
|
|
|
} else if (studentPaymentOrder.getStatus() == DealStatusEnum.CLOSE || studentPaymentOrder.getStatus() == DealStatusEnum.FAILED) {
|
|
|
|
|
|
- List<Goods> batchUpdateGoodsList = new ArrayList<Goods>();
|
|
|
- //增加商品库存
|
|
|
+ //增加商品库存
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
|
|
|
String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
|
|
|
if(StringUtils.isNotBlank(goodsIds)){
|
|
|
GoodsProcurement goodsProcurement = null;
|
|
|
- List<GoodsProcurement> goodsProcurementList = new ArrayList<GoodsProcurement>();
|
|
|
List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
|
|
|
- for(Goods subGoods : goodsList){
|
|
|
- subGoods.setStockCount(new AtomicInteger(subGoods.getStockCount()).incrementAndGet());
|
|
|
- subGoods.setSellCount(new AtomicInteger(subGoods.getSellCount()).decrementAndGet());
|
|
|
- subGoods.setUpdateTime(nowDate);
|
|
|
- batchUpdateGoodsList.add(subGoods);
|
|
|
+ Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
|
|
|
+ Goods goods = null;
|
|
|
+ Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
|
|
|
+ Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
+
|
|
|
+ for(String goodsIdStr : goodsIds.split(",")){
|
|
|
+ if(StringUtils.isBlank(goodsIdStr)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ goods = goodsMap.get(Integer.parseInt(goodsIdStr));
|
|
|
+ if(batchUpdateGoodsMap.get(goods.getId()) != null){
|
|
|
+ goods = batchUpdateGoodsMap.get(goods.getId());
|
|
|
+ }
|
|
|
+ goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
+ goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
|
|
|
+ goods.setUpdateTime(nowDate);
|
|
|
+
|
|
|
+ batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
|
|
|
// 进货清单
|
|
|
- goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(subGoods.getId());
|
|
|
+ goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
if(goodsProcurement != null){
|
|
|
+ if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
|
|
|
+ goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
|
|
|
+ }
|
|
|
goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
|
|
|
goodsProcurement.setUpdateTime(nowDate);
|
|
|
- goodsProcurementList.add(goodsProcurement);
|
|
|
+ goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if(goodsProcurementList.size() > 0){
|
|
|
- goodsProcurementDao.batchUpdate(goodsProcurementList);
|
|
|
+ if(goodsProcurementMap.size() > 0){
|
|
|
+ goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if(batchUpdateGoodsList.size() > 0){
|
|
|
- goodsService.batchUpdate(batchUpdateGoodsList);
|
|
|
+
|
|
|
+ if(batchUpdateGoodsMap.size() > 0){
|
|
|
+ goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|
|
@@ -1369,36 +1463,51 @@ public class StudentRepairServiceImpl extends BaseServiceImpl<Integer, StudentRe
|
|
|
throw new BizException("维修单更新失败");
|
|
|
}
|
|
|
|
|
|
- List<Goods> batchUpdateGoodsList = new ArrayList<Goods>();
|
|
|
//增加商品库存
|
|
|
List<StudentPaymentOrderDetail> studentPaymentOrderDetailList = studentPaymentOrderDetailService.queryOrderDetail(studentPaymentOrder.getId());
|
|
|
String goodsIds = studentPaymentOrderDetailList.stream().filter(t -> StringUtils.isNotBlank(t.getMinuendStockGoodsIdList())).map(t -> t.getMinuendStockGoodsIdList()).collect(Collectors.joining(","));
|
|
|
if(StringUtils.isNotBlank(goodsIds)){
|
|
|
GoodsProcurement goodsProcurement = null;
|
|
|
- List<GoodsProcurement> goodsProcurementList = new ArrayList<GoodsProcurement>();
|
|
|
List<Goods> goodsList = goodsService.getGoodsWithLocked(goodsIds);
|
|
|
- for(Goods subGoods : goodsList){
|
|
|
- subGoods.setStockCount(new AtomicInteger(subGoods.getStockCount()).incrementAndGet());
|
|
|
- subGoods.setSellCount(new AtomicInteger(subGoods.getSellCount()).decrementAndGet());
|
|
|
- subGoods.setUpdateTime(nowDate);
|
|
|
- batchUpdateGoodsList.add(subGoods);
|
|
|
+ Map<Integer,Goods> goodsMap = goodsList.stream().collect(Collectors.toMap(Goods :: getId, t -> t));
|
|
|
+ Goods goods = null;
|
|
|
+ Map<Integer, Goods> batchUpdateGoodsMap = new HashMap<Integer, Goods>();
|
|
|
+ Map<Long, GoodsProcurement> goodsProcurementMap = new HashMap<Long, GoodsProcurement>();
|
|
|
+
|
|
|
+ for(String goodsIdStr : goodsIds.split(",")){
|
|
|
+ if(StringUtils.isBlank(goodsIdStr)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ goods = goodsMap.get(Integer.parseInt(goodsIdStr));
|
|
|
+ if(batchUpdateGoodsMap.get(goods.getId()) != null){
|
|
|
+ goods = batchUpdateGoodsMap.get(goods.getId());
|
|
|
+ }
|
|
|
+ goods.setStockCount(new AtomicInteger(goods.getStockCount()).incrementAndGet());
|
|
|
+ goods.setSellCount(new AtomicInteger(goods.getSellCount()).decrementAndGet());
|
|
|
+ goods.setUpdateTime(nowDate);
|
|
|
+
|
|
|
+ batchUpdateGoodsMap.put(goods.getId(), goods);
|
|
|
|
|
|
// 进货清单
|
|
|
- goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(subGoods.getId());
|
|
|
+ goodsProcurement = goodsProcurementDao.getWithStockSurplusProcurement(goods.getId());
|
|
|
if(goodsProcurement != null){
|
|
|
+ if(goodsProcurementMap.get(goodsProcurement.getId()) != null){
|
|
|
+ goodsProcurement = goodsProcurementMap.get(goodsProcurement.getId());
|
|
|
+ }
|
|
|
goodsProcurement.setStockSoldNum(new AtomicInteger(goodsProcurement.getStockSoldNum()).decrementAndGet());
|
|
|
goodsProcurement.setUpdateTime(nowDate);
|
|
|
- goodsProcurementList.add(goodsProcurement);
|
|
|
+ goodsProcurementMap.put(goodsProcurement.getId(), goodsProcurement);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- if(goodsProcurementList.size() > 0){
|
|
|
- goodsProcurementDao.batchUpdate(goodsProcurementList);
|
|
|
+ if(goodsProcurementMap.size() > 0){
|
|
|
+ goodsProcurementDao.batchUpdate(new ArrayList<GoodsProcurement>(goodsProcurementMap.values()));
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
- if(batchUpdateGoodsList.size() > 0){
|
|
|
- goodsService.batchUpdate(batchUpdateGoodsList);
|
|
|
+
|
|
|
+ if(batchUpdateGoodsMap.size() > 0){
|
|
|
+ goodsService.batchUpdate(new ArrayList<Goods>(batchUpdateGoodsMap.values()));
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (studentPaymentOrder.getBalancePaymentAmount() != null && studentPaymentOrder.getBalancePaymentAmount().compareTo(BigDecimal.ZERO) > 0) {
|