Browse Source

2023年7月12日18:04:05

纪新园 2 years ago
parent
commit
085da732f6
15 changed files with 293 additions and 79 deletions
  1. 2 1
      blade-service-api/blade-stock-api/src/main/java/org/springblade/stock/entity/StockGoods.java
  2. 5 5
      blade-service-api/blade-stock-api/src/main/java/org/springblade/stock/feign/IStockGoodsClient.java
  3. 4 1
      blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsDescServiceImpl.java
  4. 4 1
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/AllotController.java
  5. 0 3
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/DeliveryController.java
  6. 26 5
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryItemsServiceImpl.java
  7. 24 8
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java
  8. 4 1
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/feign/OrderDescClient.java
  9. 74 36
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java
  10. 46 0
      blade-service/blade-stock/src/main/java/org/springblade/stock/config/MyBatisPlusConfig.java
  11. 15 12
      blade-service/blade-stock/src/main/java/org/springblade/stock/feign/StockGoodsClient.java
  12. 16 0
      blade-service/blade-stock/src/main/java/org/springblade/stock/service/IStockGoodsService.java
  13. 53 3
      blade-service/blade-stock/src/main/java/org/springblade/stock/service/impl/StockGoodsServiceImpl.java
  14. 5 0
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/component/impl/DefaultOrderSaveImpl.java
  15. 15 3
      blade-service/trade-purchase/src/main/java/com/trade/purchase/order/service/impl/OrderServiceImpl.java

+ 2 - 1
blade-service-api/blade-stock-api/src/main/java/org/springblade/stock/entity/StockGoods.java

@@ -19,6 +19,7 @@ package org.springblade.stock.entity;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.Version;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -146,7 +147,7 @@ public class StockGoods implements Serializable {
 	 * 版本
 	 */
 	@ApiModelProperty(value = "版本")
-	private String version;
+	private Integer version;
 	/**
 	 * 租户id
 	 */

+ 5 - 5
blade-service-api/blade-stock-api/src/main/java/org/springblade/stock/feign/IStockGoodsClient.java

@@ -167,7 +167,7 @@ public interface IStockGoodsClient {
 	 * @return
 	 */
 	@PostMapping(UPDATE_STOCK)
-	boolean updateStock(@RequestBody StockGoods stockGoods);
+	R updateStock(@RequestBody StockGoods stockGoods);
 /**
 	 * 修改库存总账
 	 *
@@ -175,7 +175,7 @@ public interface IStockGoodsClient {
 	 * @return
 	 */
 	@PostMapping(UPDATE_STOCK_LIST)
-	boolean updateStockList(@RequestBody List<StockGoods> stockGoods);
+	R updateStockList(@RequestBody List<StockGoods> stockGoods);
 /**
 	 * 修改库存总账
 	 *
@@ -183,7 +183,7 @@ public interface IStockGoodsClient {
 	 * @return
 	 */
 	@PostMapping(SAVE_OR_UPDATE_BATCH_LIST)
-	boolean saveOrUpdateBatchList(@RequestBody List<StockGoods> stockGoods);
+	R saveOrUpdateBatchList(@RequestBody List<StockGoods> stockGoods);
 
 	/**
 	 * 修改库存总账
@@ -192,7 +192,7 @@ public interface IStockGoodsClient {
 	 * @return
 	 */
 	@PostMapping(UPDATE_STOCK_YCP)
-	boolean updateStockYCP(@RequestBody StockGoods stockGoods);
+	R updateStockYCP(@RequestBody StockGoods stockGoods);
 
 	/**
 	 * 修改库存总账
@@ -201,7 +201,7 @@ public interface IStockGoodsClient {
 	 * @return
 	 */
 	@PostMapping(UPDATE_STOCK_LIST_YCP)
-	boolean updateStockListYCP(@RequestBody List<StockGoods> stockGoods);
+	R updateStockListYCP(@RequestBody List<StockGoods> stockGoods);
 
 	@PostMapping(UPDATE_STOCK_GOODS)
 	int updateStockGoods(@RequestBody StockGoods stockGoods);

+ 4 - 1
blade-service/blade-client/src/main/java/org/springblade/client/goods/service/impl/GoodsDescServiceImpl.java

@@ -907,7 +907,10 @@ public class GoodsDescServiceImpl extends ServiceImpl<GoodsDescMapper, GoodsDesc
 						r.getData().setBalanceAmount(balanceAmount);
 						r.getData().setStockPrice(stockPrice);
 						r.getData().setStorageId(storageDesc.getId());
-						stockGoodsClient.updateStock(r.getData());
+						R res = stockGoodsClient.updateStock(r.getData());
+						if (!res.isSuccess()){
+							throw new RuntimeException(res.getMsg());
+						}
 					} else {
 						StockGoods stockGoods = new StockGoods();
 						stockGoods.setSurplusRouteQuantity(e.getQuantity());

+ 4 - 1
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/AllotController.java

@@ -300,7 +300,10 @@ public class AllotController extends BladeController {
 			BigDecimal stockQuantity = addQuantity.add(addDBQuantity).subtract(subQuantity).subtract(subDBQuantity);
 			stockGoods.setBalanceQuantity(stockQuantity);
 			stockGoods.setSurplusRouteQuantity(stockQuantity);
-			stockGoodsClient.updateStock(stockGoods);
+			R res = stockGoodsClient.updateStock(stockGoods);
+			if (!res.isSuccess()){
+				throw new RuntimeException(res.getMsg());
+			}
 		}
 		return R.success("操作成功");
 	}

+ 0 - 3
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/controller/DeliveryController.java

@@ -79,9 +79,6 @@ import java.util.Objects;
 public class DeliveryController extends BladeController {
 
 	private final IDeliveryService deliveryService;
-	private ICorpsDescClient corpsDescClient;//获取客户信息
-	private IUserClient iUserClient;//获取用户信息
-	private IStorageClient iStorageClient;//库区信息
 	private final IDeliveryItemsService deliveryItemsService;
 	private final IDeliveryFeesService deliveryFeesService;
 	private final IDeliveryFilesService deliveryFilesService;

+ 26 - 5
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryItemsServiceImpl.java

@@ -61,6 +61,7 @@ import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
@@ -337,7 +338,10 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 				deliveryItemsList1.add(deliveryItems);
 //				baseMapper.updateById(deliveryItems);
 			}
-			stockGoodsClient.updateStockList(stockGoodsList1);
+			R res = stockGoodsClient.updateStockList(stockGoodsList1);
+			if (!res.isSuccess()) {
+				throw new SecurityException(res.getMsg());
+			}
 			this.saveOrUpdateBatch(deliveryItemsList1);
 		}
 		if (CollectionUtils.isNotEmpty(itemsList)) {
@@ -959,6 +963,7 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 	 * @return
 	 */
 	@Override
+	@Transactional
 	public R affirmAllot(Long storageId, Long allotStorageId, List<DeliveryItems> list, int operate, String tradeType) {
 		//查询库存 判断原仓库是否有足够的库存调拨
 		if (operate == 1) {
@@ -976,9 +981,13 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 				stock.setBalanceQuantity(stock.getInQuantity().subtract(stock.getOutQuantity()));//结余数量 减
 				//出库金额加
 				stock.setOutAmount(stock.getOutAmount().add((stock.getInAmount().divide(stock.getInQuantity(), 5, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP).multiply(deliveryItems.getActualQuantity())));
-				boolean updateStock = stockGoodsClient.updateStock(stock);
+			/*	boolean updateStock = stockGoodsClient.updateStock(stock);
 				if (!updateStock) {
 					throw new RuntimeException("更新库存总账失败");
+				}*/
+				R res = stockGoodsClient.updateStock(stock);
+				if (!res.isSuccess()){
+					throw new RuntimeException(res.getMsg());
 				}
 				//新仓库添加库存
 				//入库金额等于原仓库的入库金额除以入库数量
@@ -992,9 +1001,13 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 					serviceStock.setBalanceQuantity(serviceStock.getInQuantity().add(serviceStock.getOutQuantity()));//结余数量 加
 					//入库金额加
 					serviceStock.setInAmount(serviceStock.getInAmount().add((stock.getInAmount().divide(stock.getInQuantity(), 5, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP).multiply(deliveryItems.getActualQuantity())));
-					boolean stockMessage = stockGoodsClient.updateStock(serviceStock);
+					/*boolean stockMessage = stockGoodsClient.updateStock(serviceStock);
 					if (!stockMessage) {
 						throw new RuntimeException("更新库存总账失败");
+					}*/
+					R ress = stockGoodsClient.updateStock(serviceStock);
+					if (!ress.isSuccess()){
+						throw new RuntimeException(ress.getMsg());
 					}
 				}
 			}
@@ -1018,9 +1031,13 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 					//出库金额减
 					serviceStock.setOutAmount(serviceStock.getOutAmount().subtract((serviceStock.getInAmount().divide(serviceStock.getInQuantity(), 5, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP).multiply(deliveryItems.getActualQuantity())));
 
-					boolean stockMessage = stockGoodsClient.updateStock(serviceStock);
+					/*boolean stockMessage = stockGoodsClient.updateStock(serviceStock);
 					if (!stockMessage) {
 						throw new RuntimeException("更新库存总账失败");
+					}*/
+					R res = stockGoodsClient.updateStock(serviceStock);
+					if (!res.isSuccess()){
+						throw new RuntimeException(res.getMsg());
 					}
 				}
 				//新仓库减去库存
@@ -1030,9 +1047,13 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 				//入库金额减
 				stock.setInAmount(stock.getInAmount().subtract((serviceStock.getInAmount().divide(serviceStock.getInQuantity(), 5, RoundingMode.HALF_UP)).setScale(2, RoundingMode.HALF_UP).multiply(deliveryItems.getActualQuantity())));
 
-				boolean updateStock = stockGoodsClient.updateStock(stock);
+				/*boolean updateStock = stockGoodsClient.updateStock(stock);
 				if (!updateStock) {
 					throw new RuntimeException("更新库存总账失败");
+				}*/
+				R res = stockGoodsClient.updateStock(stock);
+				if (!res.isSuccess()){
+					throw new RuntimeException(res.getMsg());
 				}
 			}
 		}

+ 24 - 8
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java

@@ -698,7 +698,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 
 	@Override
 	@Transactional(rollbackFor = Exception.class)
-	@GlobalTransactional(timeoutMills = 12000000)
+	@GlobalTransactional(rollbackFor = Exception.class,timeoutMills = 12000000)
 	public void comfire(Delivery delivery) {
 		//防重校验
 		Long deliveryId = delivery.getId();
@@ -805,10 +805,12 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 		//验证收货单库存与传入库存是否一致,如果一直则修改库存
 		List<DeliveryItems> deliveryItemsList = select.getDeliveryItemsList();
 		//从缓存中获得库存
-		List<StockGoods> stockGoodsList = castToList(redisTemplate.opsForValue().get("stockGoods"), StockGoods.class);
+		/*List<StockGoods> stockGoodsList = castToList(redisTemplate.opsForValue().get("stockGoods"), StockGoods.class);
 		if (stockGoodsList.size() == 0) {
-			stockGoodsList = stockGoodsClient.selectStockGoodsAll();
-		}
+			List<StockGoods> stockGoodsList = stockGoodsClient.selectStockGoodsAll();
+		}*/
+
+		List<StockGoods> stockGoodsList = stockGoodsClient.selectStockGoodsAll();
 
 		if (CollectionUtils.isNotEmpty(deliveryItemsList)) {
 			if ((ObjectUtils.isNotNull(sysClient.getParamService("inventory")) && "1".equals(sysClient.getParamService("inventory")))
@@ -839,6 +841,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 							//修改库存单 只修改库存  添加库存在上边
 							if (stock != null) {
 								StockGoods stockGoods = iDeliveryItemsService.receivingInventory(stock, e);
+								stockGoods.setVersion(stock.getVersion());
 								stockGoodsList2.add(stockGoods);
 							}
 						} else {
@@ -846,15 +849,19 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 								throw new SecurityException("更新库存失败,未找到库存");
 							} else {
 								StockGoods stockGoods = iDeliveryItemsService.receivingInventory(stock, e);
+								stockGoods.setVersion(stock.getVersion());
 								stockGoodsList2.add(stockGoods);
 							}
 						}
 					});
-					stockGoodsClient.updateStockList(stockGoodsList2);
+					R res = stockGoodsClient.updateStockList(stockGoodsList2);
+					if (!res.isSuccess()) {
+						throw new SecurityException(res.getMsg());
+					}
 				}
 			}
 			List<BusinessOverpaymentItem> list = new ArrayList<>();
-			List<StockGoods> finalStockGoodsList = stockGoodsList;
+			List<StockGoods> finalStockGoodsList = stockGoodsClient.selectStockGoodsAll();
 			List<StockGoods> stockGoodsList1 = new ArrayList<>();
 			deliveryItemsList.forEach(e -> {
 				if ("681169".equals(AuthUtil.getTenantId())) {
@@ -953,6 +960,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 						//更新收货单明细库存
 						e.setInventoryNumber(receiving.getSurplusRouteQuantity());
 						e.setInWeight(receiving.getInWeight());
+						receiving.setVersion(stock.getVersion());
 						stockGoodsList1.add(receiving);
 					}
 				} else {
@@ -971,6 +979,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 							//更新收货单明细库存
 							e.setInventoryNumber(receiving.getSurplusRouteQuantity());
 							e.setInWeight(receiving.getInWeight());
+							receiving.setVersion(stock.getVersion());
 							stockGoodsList1.add(receiving);
 						}
 					} else {
@@ -978,6 +987,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 							throw new SecurityException("更新库存失败,未找到库存");
 						} else {
 							StockGoods receiving = iDeliveryItemsService.receiving(select.getTradeType(), stock, e);
+							receiving.setVersion(stock.getVersion());
 							stockGoodsList1.add(receiving);
 						}
 					}
@@ -997,7 +1007,10 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 				}
 
 			});
-			stockGoodsClient.saveOrUpdateBatchList(stockGoodsList1);
+			R res = stockGoodsClient.saveOrUpdateBatchList(stockGoodsList1);
+			if (!res.isSuccess()){
+				throw new RuntimeException(res.getMsg());
+			}
 			//更新库存内容
 			iDeliveryItemsService.updateBatchById(deliveryItemsList);
 			if ("681169".equals(AuthUtil.getTenantId())) {
@@ -1291,7 +1304,10 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 				deliveryItemsList1.add(e);
 			}
 			iDeliveryItemsService.updateBatchById(deliveryItemsList1);
-			stockGoodsClient.updateStockList(stockGoodsList1);
+			R res = stockGoodsClient.updateStockList(stockGoodsList1);
+			if (!res.isSuccess()) {
+				throw new SecurityException(res.getMsg());
+			}
 			if ("681169".equals(AuthUtil.getTenantId())) {
 				Long corpId = select.getCorpId();
 				// ===================撤回添加益付款逻辑=========================

+ 4 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/feign/OrderDescClient.java

@@ -367,7 +367,10 @@ public class OrderDescClient implements IOrderDescClient {
 				r.getData().setBalanceQuantity(balanceQuantity);
 				r.getData().setBalanceAmount(balanceAmount);
 				r.getData().setStockPrice(stockPrice);
-				stockGoodsClient.updateStock(r.getData());
+				R res = stockGoodsClient.updateStock(r.getData());
+				if (!res.isSuccess()){
+					throw new RuntimeException(res.getMsg());
+				}
 
 			} else {
 				throw new RuntimeException("未找到库存,操作失败!");

+ 74 - 36
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/service/impl/OrderServiceImpl.java

@@ -520,7 +520,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				for (OrderItems orderItems : list) {
 					if (ObjectUtils.isNull(orderItems.getPurchaseRebatePrice()) || orderItems.getPurchaseRebatePrice().compareTo(new BigDecimal("0.00")) == 0) {
 						purchaseRebatePrice = purchaseRebatePrice.add(new BigDecimal("0.00"));
-					}else{
+					} else {
 						purchaseRebatePrice = purchaseRebatePrice.add((orderItems.getPurchaseAmount().subtract(orderItems.getPurchaseRebatePrice())).multiply(orderItems.getOrderQuantity()));
 					}
 				}
@@ -1228,12 +1228,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						oneStock.setSurplusRouteQuantity(surplusRouteQuantity.subtract(orderQuantity));
 						// 增加锁定库存
 						oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0").add(orderQuantity) : lockingQuantity.add(orderQuantity));
+						oneStock.setVersion(oneStock.getVersion());
 						stockGoods.add(oneStock);
 					}
 					// 更新库存
-					boolean goods = stockGoodsClient.updateStockList(stockGoods);
-					if (!goods) {
-						throw new SecurityException("锁定库存失败: " + salesOrder.getOrderNo() + "更新失败");
+					R goods = stockGoodsClient.updateStockList(stockGoods);
+					if (!goods.isSuccess()) {
+//						throw new SecurityException("锁定库存失败: " + salesOrder.getOrderNo() + "更新失败");
+						throw new SecurityException(goods.getMsg());
 					}
 				}
 			}
@@ -1676,9 +1678,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					// 减少锁定库存
 					oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0") : lockingQuantity.subtract(orderQuantity));
 					// 更新库存
-					boolean r = stockGoodsClient.updateStock(oneStock);
-					if (!r) {
-						throw new SecurityException("驳回失败: 更新库存失败");
+					R res = stockGoodsClient.updateStock(oneStock);
+					if (!res.isSuccess()) {
+//						throw new SecurityException("驳回失败: 更新库存失败");
+						throw new SecurityException(res.getMsg());
 					}
 				});
 			}
@@ -1747,9 +1750,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					// 减少锁定库存
 					oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0") : lockingQuantity.subtract(orderQuantity));
 					// 更新库存
-					boolean r = stockGoodsClient.updateStock(oneStock);
-					if (!r) {
-						throw new SecurityException("撤销失败: " + oneStock.getCode() + "更新库存失败");
+					R res = stockGoodsClient.updateStock(oneStock);
+					if (!res.isSuccess()) {
+//						throw new SecurityException("撤销失败: " + oneStock.getCode() + "更新库存失败");
+						throw new SecurityException(res.getMsg());
 					}
 
 				});
@@ -1972,12 +1976,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						oneStock.setSurplusRouteQuantity(surplusRouteQuantity.add(orderQuantity));
 						// 减少锁定库存
 						oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0") : lockingQuantity.subtract(orderQuantity));
+						oneStock.setVersion(oneStock.getVersion());
 						stockGoods.add(oneStock);
 					}
 					// 更新库存
-					boolean r = stockGoodsClient.updateStockList(stockGoods);
-					if (!r) {
-						throw new SecurityException("撤销失败:" + order.getOrderNo() + "更新库存失败");
+					R r = stockGoodsClient.updateStockList(stockGoods);
+					if (!r.isSuccess()) {
+//						throw new SecurityException("撤销失败:" + order.getOrderNo() + "更新库存失败");
+						throw new SecurityException(r.getMsg());
 					}
 				}
 			}
@@ -2074,7 +2080,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				data.setSurplusRouteQuantity(data.getSurplusRouteQuantity().subtract(item.getOrderQuantity()));
 				// 结余金额
 				data.setBalanceAmount(data.getInAmount().subtract(data.getOutAmount()));
-				stockGoodsClient.updateStock(data);
+				R res = stockGoodsClient.updateStock(data);
+				if (!res.isSuccess()) {
+					throw new RuntimeException(res.getMsg());
+				}
 				// 更改明细状态
 				item.setConfirmStatus(3);
 				item.setUpdateTime(new Date());
@@ -2106,7 +2115,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				data.setSurplusRouteQuantity(data.getSurplusRouteQuantity().add(item.getOrderQuantity()));
 				// 结余金额
 				data.setBalanceAmount(data.getInAmount().subtract(data.getOutAmount()));
-				stockGoodsClient.updateStock(data);
+				R res = stockGoodsClient.updateStock(data);
+				if (!res.isSuccess()) {
+					throw new RuntimeException(res.getMsg());
+				}
 				// 更改明细状态
 				item.setConfirmStatus(0);
 				item.setUpdateTime(new Date());
@@ -2788,7 +2800,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 					r.getData().setBalanceQuantity(balanceQuantity);
 					r.getData().setBalanceAmount(balanceAmount);
-					stockGoodsClient.updateStock(r.getData());
+					R res = stockGoodsClient.updateStock(r.getData());
+					if (!res.isSuccess()) {
+						throw new RuntimeException(res.getMsg());
+					}
 				} else {
 					StockGoods stockGoods = new StockGoods();
 					if ("CG".equals(order.getBillType())) {
@@ -2920,7 +2935,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 					r.getData().setBalanceQuantity(balanceQuantity);
 					r.getData().setBalanceAmount(balanceAmount);
-					stockGoodsClient.updateStock(r.getData());
+					R res = stockGoodsClient.updateStock(r.getData());
+					if (!res.isSuccess()) {
+						throw new RuntimeException(res.getMsg());
+					}
 				}
 			}
 			selectOrder.setOrderItemsList(orderItemsList);
@@ -3376,7 +3394,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 								r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 								r.getData().setBalanceQuantity(balanceQuantity);
 								r.getData().setBalanceAmount(balanceAmount);
-								stockGoodsClient.updateStock(r.getData());
+								R res = stockGoodsClient.updateStock(r.getData());
+								if (!res.isSuccess()) {
+									throw new RuntimeException(res.getMsg());
+								}
 
 							} else {
 								StockGoods stockGoods = new StockGoods();
@@ -3585,7 +3606,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 							r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 							r.getData().setBalanceQuantity(balanceQuantity);
 							r.getData().setBalanceAmount(balanceAmount);
-							stockGoodsClient.updateStock(r.getData());
+							R res = stockGoodsClient.updateStock(r.getData());
+							if (!res.isSuccess()) {
+								throw new RuntimeException(res.getMsg());
+							}
 
 						} else {
 							StockGoods stockGoods = new StockGoods();
@@ -4036,7 +4060,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 								r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 								r.getData().setBalanceQuantity(balanceQuantity);
 								r.getData().setBalanceAmount(balanceAmount);
-								stockGoodsClient.updateStock(r.getData());
+								R res = stockGoodsClient.updateStock(r.getData());
+								if (!res.isSuccess()) {
+									throw new RuntimeException(res.getMsg());
+								}
 
 							} else {
 								StockGoods stockGoods = new StockGoods();
@@ -4981,7 +5008,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 							r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 							r.getData().setBalanceQuantity(balanceQuantity);
 							r.getData().setBalanceAmount(balanceAmount);
-							stockGoodsClient.updateStock(r.getData());
+							R res = stockGoodsClient.updateStock(r.getData());
+							if (!res.isSuccess()) {
+								throw new RuntimeException(res.getMsg());
+							}
 						}
 						orderItems.setId(null);
 						orderItems.setPid(orderNew.getId());
@@ -5081,7 +5111,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 							r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 							r.getData().setBalanceQuantity(balanceQuantity);
 							r.getData().setBalanceAmount(balanceAmount);
-							stockGoodsClient.updateStock(r.getData());
+							R res = stockGoodsClient.updateStock(r.getData());
+							if (!res.isSuccess()) {
+								throw new RuntimeException(res.getMsg());
+							}
 
 						} else {
 							StockGoods stockGoods = new StockGoods();
@@ -5624,7 +5657,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		if (ObjectUtils.isNotNull(orderItemsList) && orderItemsList.size() > 0) {
 			List<Long> pidList = new ArrayList<>();
 			for (OrderItems orderItems : orderItemsList) {
-				orderItemsMapper.updateById(orderItems);
 				if (1 == order.getPurchaseStatusType()) {//排产中
 					if (ObjectUtils.isNotEmpty(orderItems.getDetailType())) {
 						if (OrderTypeEnum.PARTSTYPE.getType().equals(orderItems.getDetailType())) {
@@ -5685,9 +5717,9 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 		for (String arr : arrs) {
 			Order selectOrder = baseMapper.selectById(Long.parseLong(arr));
 			if (ObjectUtils.isNotNull(selectOrder)) {
-				selectOrder.setUpdateTime(new Date());
+				/*selectOrder.setUpdateTime(new Date());
 				selectOrder.setUpdateUser(AuthUtil.getUserId());
-				selectOrder.setUpdateUserName(AuthUtil.getUserName());
+				selectOrder.setUpdateUserName(AuthUtil.getUserName());*/
 
 				//循环发送消息
 				Message sendMessage = new Message();
@@ -5706,19 +5738,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					sendMessage.setToUserName(selectOrder.getCreateUserName());
 					if (1 == order.getPurchaseStatusType()) {
 						sendMessage.setMessageBody("您的销售订单" + selectOrder.getSysNo() + "正在排产中,请查看");
-						selectOrder.setProductionScheduling("排产中");
+						/*selectOrder.setProductionScheduling("排产中");
 						selectOrder.setOrderStatus("排产中");
-						selectOrder.setProductionSchedulingDate(order.getProductionSchedulingDate());
+						selectOrder.setProductionSchedulingDate(order.getProductionSchedulingDate());*/
 					} else if (2 == order.getPurchaseStatusType()) {
 						sendMessage.setMessageBody("您的销售订单" + selectOrder.getSysNo() + "已预计货好,请查看");
-						selectOrder.setProductionScheduling("预计货好");
+						/*selectOrder.setProductionScheduling("预计货好");
 						selectOrder.setOrderStatus("预计货好");
-						selectOrder.setProductionSchedulingDate(order.getEstimateGoodGoodsDate());
+						selectOrder.setProductionSchedulingDate(order.getEstimateGoodGoodsDate());*/
 					} else if (3 == order.getPurchaseStatusType()) {
 						sendMessage.setMessageBody("您的销售订单" + selectOrder.getSysNo() + "已采购完成,请查看");
-						selectOrder.setProductionScheduling("货备齐");
+					/*	selectOrder.setProductionScheduling("货备齐");
 						selectOrder.setOrderStatus("货备齐");
-						selectOrder.setProductionSchedulingDate(new Date());
+						selectOrder.setProductionSchedulingDate(new Date());*/
 						deliveryClient.updateBySrcId(selectOrder.getId(), "FH", selectOrder.getTradeType());
 					}
 					R save = messageClient.save(sendMessage);
@@ -5742,7 +5774,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						throw new SecurityException("发送消息失败");
 					}
 				}
-				baseMapper.updateById(selectOrder);
+//				baseMapper.updateById(selectOrder);
 			}
 		}
 		return R.data(detail);
@@ -6353,7 +6385,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 						r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 						r.getData().setBalanceQuantity(balanceQuantity);
 						r.getData().setBalanceAmount(balanceAmount);
-						stockGoodsClient.updateStock(r.getData());
+						R res = stockGoodsClient.updateStock(r.getData());
+						if (!res.isSuccess()) {
+							throw new RuntimeException(res.getMsg());
+						}
 					}
 					orderItems.setPid(order.getId());
 					orderItems.setUpdateTime(new Date());
@@ -6598,7 +6633,10 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					r.getData().setSurplusRouteQuantity(surplusRouteQuantity);
 					r.getData().setBalanceQuantity(balanceQuantity);
 					r.getData().setBalanceAmount(balanceAmount);
-					stockGoodsClient.updateStock(r.getData());
+					R res = stockGoodsClient.updateStock(r.getData());
+					if (!res.isSuccess()) {
+						throw new RuntimeException(res.getMsg());
+					}
 
 				} else {
 					StockGoods stockGoods = new StockGoods();
@@ -7392,7 +7430,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				//给角色为财务的人发送消息
 				R<String> clientDeptIds = sysClient.getRoleIds(SecureUtil.getTenantId(), "财务");
 				if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
-					R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()),null,null);
+					R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()), null, null);
 					if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
 						for (User datum : userList.getData()) {
 							//循环发送消息
@@ -7574,7 +7612,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 			//给角色为财务的人发送消息
 			R<String> clientDeptIds = sysClient.getRoleIds(SecureUtil.getTenantId(), "财务");
 			if (clientDeptIds.isSuccess() && StringUtils.isNotBlank(clientDeptIds.getData())) {
-				R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()),null,null);
+				R<List<User>> userList = userClient.listUserByRoleId(Long.valueOf(clientDeptIds.getData()), null, null);
 				if (userList.isSuccess() && CollectionUtils.isNotEmpty(userList.getData())) {
 					for (User datum : userList.getData()) {
 						//循环发送消息

+ 46 - 0
blade-service/blade-stock/src/main/java/org/springblade/stock/config/MyBatisPlusConfig.java

@@ -0,0 +1,46 @@
+package org.springblade.stock.config;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
+import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
+import net.sf.jsqlparser.expression.Expression;
+import net.sf.jsqlparser.expression.StringValue;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * @author :jixinyuan
+ * @date : 2023/7/4
+ */
+@Configuration
+public class MyBatisPlusConfig {
+
+
+	@Bean
+	public MybatisPlusInterceptor MybatisPlusInterceptor() {
+		MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
+		TenantLineHandler tenantLineHandler = new TenantLineHandler() {
+			@Override
+			public Expression getTenantId() {
+				return new StringValue(Func.toStr(AuthUtil.getTenantId(), "000000"));
+			}
+		};
+		mybatisPlusInterceptor.addInnerInterceptor(new TenantLineInnerInterceptor(tenantLineHandler));//自动填充租户插件
+		mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());//乐观锁插件
+		mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//自动分页插件
+		mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());//防止全表更新或删除
+		return mybatisPlusInterceptor;
+	}
+
+	@Bean
+	public ConfigurationCustomizer configurationCustomizer() {
+		return configuration -> configuration.setUseDeprecatedExecutor(false);
+	}
+}

+ 15 - 12
blade-service/blade-stock/src/main/java/org/springblade/stock/feign/StockGoodsClient.java

@@ -252,9 +252,10 @@ public class StockGoodsClient implements IStockGoodsClient {
 	@Override
 	@PostMapping(UPDATE_STOCK)
 	@Transactional(rollbackFor = Exception.class)
-	public boolean updateStock(StockGoods stockGoods) {
-		stockGoodsService.updateById(stockGoods);
-		return redisClient.basicData("stockGoods");
+	public R updateStock(StockGoods stockGoods) {
+		R res = stockGoodsService.updateByIdNew(stockGoods);
+		redisClient.basicData("stockGoods");
+		return res;
 	}
 
 	/**
@@ -266,9 +267,10 @@ public class StockGoodsClient implements IStockGoodsClient {
 	@Override
 	@PostMapping(UPDATE_STOCK_LIST)
 	@Transactional(rollbackFor = Exception.class)
-	public boolean updateStockList(List<StockGoods> stockGoods) {
-		stockGoodsService.updateBatchById(stockGoods);
-		return redisClient.basicData("stockGoods");
+	public R updateStockList(List<StockGoods> stockGoods) {
+		R res = stockGoodsService.updateBatchById(stockGoods);
+		redisClient.basicData("stockGoods");
+		return res;
 	}
 
 	/**
@@ -280,9 +282,10 @@ public class StockGoodsClient implements IStockGoodsClient {
 	@Override
 	@PostMapping(SAVE_OR_UPDATE_BATCH_LIST)
 	@Transactional(rollbackFor = Exception.class)
-	public boolean saveOrUpdateBatchList(List<StockGoods> stockGoods) {
-		stockGoodsService.saveOrUpdateBatch(stockGoods);
-		return redisClient.basicData("stockGoods");
+	public R saveOrUpdateBatchList(List<StockGoods> stockGoods) {
+		R res = stockGoodsService.saveOrUpdateBatch(stockGoods);
+		redisClient.basicData("stockGoods");
+		return res;
 	}
 
 	/**
@@ -294,12 +297,12 @@ public class StockGoodsClient implements IStockGoodsClient {
 	@Override
 	@PostMapping(UPDATE_STOCK_YCP)
 	@TenantIgnore
-	public boolean updateStockYCP(StockGoods stockGoods) {
-		return stockGoodsService.updateById(stockGoods);
+	public R updateStockYCP(StockGoods stockGoods) {
+		return stockGoodsService.updateByIdNew(stockGoods);
 	}
 
 	@Override
-	public boolean updateStockListYCP(List<StockGoods> stockGoods) {
+	public R updateStockListYCP(List<StockGoods> stockGoods) {
 		return stockGoodsService.updateBatchById(stockGoods);
 	}
 

+ 16 - 0
blade-service/blade-stock/src/main/java/org/springblade/stock/service/IStockGoodsService.java

@@ -143,4 +143,20 @@ public interface IStockGoodsService extends IService<StockGoods> {
 	List<AppStockPartsVO> selectAppStockPartsList(AppStockPartsVO appStockPartsVO);
 
 	R<Void> batchModifyLockingQuantity();
+
+	/**
+	 * 修改
+	 */
+
+	R updateByIdNew(StockGoods stockGoods);
+
+	/**
+	 * 修改(批量)
+	 */
+	R updateBatchById(List<StockGoods> stockGoods);
+
+	/**
+	 * 新增或修改(批量)
+	 */
+	R saveOrUpdateBatch(List<StockGoods> stockGoods);
 }

+ 53 - 3
blade-service/blade-stock/src/main/java/org/springblade/stock/service/impl/StockGoodsServiceImpl.java

@@ -23,6 +23,7 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import io.seata.spring.annotation.GlobalTransactional;
 import lombok.AllArgsConstructor;
 import org.springblade.client.entity.CorpsDesc;
 import org.springblade.client.entity.GoodsDesc;
@@ -103,7 +104,7 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
 	 * @return
 	 */
 	@Override
-	public StockGoodsVO selectStock(Long corpId, Long storageId,Long warehouseId, Long goodId, String itemType, String lotNo, String cntrNo, String billNo, String contractNumber, String tradeType) {
+	public StockGoodsVO selectStock(Long corpId, Long storageId, Long warehouseId, Long goodId, String itemType, String lotNo, String cntrNo, String billNo, String contractNumber, String tradeType) {
 		LambdaQueryWrapper<StockGoods> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(Func.isNotEmpty(corpId), StockGoods::getCorpId, corpId);//客户id
 		lambdaQueryWrapper.eq(Func.isNotEmpty(storageId), StockGoods::getWarehouseId, storageId);//仓库id
@@ -210,7 +211,7 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
 			stockGoods.setEnRouteQuantity(BigDecimal.ZERO);//在途数量
 			stockGoods.setTradeType("GN");
 			stockGoods.setTenantId(SecureUtil.getTenantId());
-			if ("681169".equals(AuthUtil.getTenantId())){
+			if ("681169".equals(AuthUtil.getTenantId())) {
 				stockGoods.setWarehouseId(1510440001509326849L);
 			}
 			//获取商品id
@@ -410,7 +411,7 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
 	public R<Void> batchModifyLockingQuantity() {
 		List<StockGoods> list = baseMapper.selectList(new LambdaQueryWrapper<>());
 		for (StockGoods stockGoods : list) {
-			List<OrderVO> orderVOList = orderDescClient.orderInventoryList("XS", stockGoods.getGoodsId(), stockGoods.getCorpId(),stockGoods.getStorageId());
+			List<OrderVO> orderVOList = orderDescClient.orderInventoryList("XS", stockGoods.getGoodsId(), stockGoods.getCorpId(), stockGoods.getStorageId());
 			if (ObjectUtils.isNull(orderVOList) || orderVOList.size() == 0) {
 				stockGoods.setLockingQuantity(new BigDecimal("0"));
 				stockGoods.setSurplusRouteQuantity(stockGoods.getBalanceQuantity().subtract(stockGoods.getLockingQuantity()));
@@ -423,4 +424,53 @@ public class StockGoodsServiceImpl extends ServiceImpl<StockGoodsMapper, StockGo
 		return R.success("操作成功");
 	}
 
+	@Override
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	@Transactional(rollbackFor = Exception.class)
+	public R updateByIdNew(StockGoods stockGoods) {
+		int count = baseMapper.update(stockGoods, new LambdaQueryWrapper<StockGoods>()
+			.eq(StockGoods::getId, stockGoods.getId())
+			.eq(StockGoods::getVersion, stockGoods.getVersion())
+			.setEntity(new StockGoods()));
+		if (count == 0) {
+			return R.fail(stockGoods.getCode() + "正在更新库存,请稍后再试");
+		} else {
+			StockGoods stockGoods1 = new StockGoods();
+			stockGoods1.setId(stockGoods.getId());
+			stockGoods1.setVersion(stockGoods.getVersion() + 1);
+			baseMapper.updateById(stockGoods1);
+			return R.success("操作成功");
+		}
+	}
+
+	@Override
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	@Transactional(rollbackFor = Exception.class)
+	public R updateBatchById(List<StockGoods> stockGoods) {
+		for (StockGoods item : stockGoods) {
+			R status = this.updateByIdNew(item);
+			if (!status.isSuccess()) {
+				return R.fail(item.getCode() + "正在更新库存,请稍后再试");
+			}
+		}
+		return R.success("操作成功");
+	}
+
+	@Override
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	@Transactional(rollbackFor = Exception.class)
+	public R saveOrUpdateBatch(List<StockGoods> stockGoods) {
+		for (StockGoods item : stockGoods) {
+			if (item.getId() == null) {
+				baseMapper.insert(item);
+			} else {
+				R status = this.updateByIdNew(item);
+				if (!status.isSuccess()) {
+					return R.fail(item.getCode() + "正在更新库存,请稍后再试");
+				}
+			}
+		}
+		return R.success("操作成功");
+	}
+
 }

+ 5 - 0
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/component/impl/DefaultOrderSaveImpl.java

@@ -236,6 +236,11 @@ public class DefaultOrderSaveImpl implements IOrderSave {
 							}
 						}
 					}
+					order.setStorageQuantity(order.getOrderItemsList().stream().map(OrderItems::getOrderQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
+					order.setOrderQuantity(order.getOrderItemsList().stream().map(OrderItems::getOrderQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
+					order.setActualQuantity(order.getOrderItemsList().stream().map(OrderItems::getActualQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
+					order.setPurchaseQuantity(order.getOrderItemsList().stream().map(OrderItems::getPurchaseQuantity).reduce(BigDecimal.ZERO, BigDecimal::add));
+					order.setPurchaseAmount(order.getOrderItemsList().stream().map(OrderItems::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add));
 				}
 				order.setBuyerName(order.get$buyerId());
 				order.setDocumenterName(order.get$documenterId());

+ 15 - 3
blade-service/trade-purchase/src/main/java/com/trade/purchase/order/service/impl/OrderServiceImpl.java

@@ -725,7 +725,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					data.setBalanceAmount(data.getInAmount().subtract(data.getOutAmount()));
 					// todo 新加库存价
 					data.setStockPrice(data.getBalanceAmount().divide(data.getBalanceQuantity(), MathContext.DECIMAL32));
-					boolean updateStock = stockGoodsClient.updateStock(data);
+//					boolean updateStock = stockGoodsClient.updateStock(data);
+					R res = stockGoodsClient.updateStock(data);
+					if (!res.isSuccess()){
+						throw new RuntimeException(res.getMsg());
+					}
 				}
 				//更改明细状态
 				item.setStatus(3);
@@ -762,7 +766,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 				data.setBalanceAmount(data.getInAmount().subtract(data.getOutAmount()));
 				// todo 新加库存价
 				data.setStockPrice(data.getBalanceAmount().divide(data.getBalanceQuantity(), MathContext.DECIMAL32));
-				boolean updateStock = stockGoodsClient.updateStock(data);
+//				boolean updateStock = stockGoodsClient.updateStock(data);
+				R res = stockGoodsClient.updateStock(data);
+				if (!res.isSuccess()){
+					throw new RuntimeException(res.getMsg());
+				}
 				//更改明细状态
 				item.setStatus(0);
 				item.setUpdateTime(new Date());
@@ -988,9 +996,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 					// 减少锁定库存
 					oneStock.setLockingQuantity(lockingQuantity == null ? new BigDecimal("0") : lockingQuantity.subtract(orderQuantity));
 					// 更新库存
-					boolean r = stockGoodsClient.updateStock(oneStock);
+					/*boolean r = stockGoodsClient.updateStock(oneStock);
 					if (!r) {
 						throw new SecurityException("撤销失败: 更新库存失败");
+					}*/
+					R res = stockGoodsClient.updateStock(oneStock);
+					if (!res.isSuccess()){
+						throw new RuntimeException(res.getMsg());
 					}
 				});
 			}