纪新园 2 лет назад
Родитель
Сommit
a5aa74630c

+ 6 - 0
blade-service-api/blade-mocha-item-api/src/main/java/org/springblade/mocha/entity/SalesPolicyItem.java

@@ -220,4 +220,10 @@ public class SalesPolicyItem implements Serializable {
 	@TableField(exist = false)
 	private String cname;
 
+	/**
+	 * 商品名称
+	 */
+	@TableField(exist = false)
+	private BigDecimal purchaseRebatePrice =new BigDecimal("0.00");
+
 }

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

@@ -39,6 +39,7 @@ public interface IStockGoodsClient {
 	String SELECT_STOCK_PARTS_YCP = API_PREFIX + "/selectStockPartsYCP";
 	String SELECT_LIST_BY_GOODS_ID = API_PREFIX + "/selectListByGoodsId";
 	String UPDATE_STOCK_LIST = API_PREFIX + "/updateStockList";
+	String SAVE_OR_UPDATE_BATCH_LIST = API_PREFIX + "/saveOrUpdateBatchList";
 
 
 	@GetMapping("/stockgoods/stocklist")
@@ -175,6 +176,14 @@ public interface IStockGoodsClient {
 	 */
 	@PostMapping(UPDATE_STOCK_LIST)
 	boolean updateStockList(@RequestBody List<StockGoods> stockGoods);
+/**
+	 * 修改库存总账
+	 *
+	 * @param stockGoods
+	 * @return
+	 */
+	@PostMapping(SAVE_OR_UPDATE_BATCH_LIST)
+	boolean saveOrUpdateBatchList(@RequestBody List<StockGoods> stockGoods);
 
 	/**
 	 * 修改库存总账

+ 1 - 1
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/feign/DeliveryClient.java

@@ -255,7 +255,7 @@ public class DeliveryClient implements IDeliveryClient {
 					deliveryItems.setCreateTime(new Date());
 					deliveryItems.setTenantId(SecureUtil.getTenantId());
 					deliveryItems.setEname(orderItems.getEname());
-					deliveryItems1.setRemarks(orderItems.getRemarks());
+					deliveryItems.setRemarks(orderItems.getRemarks());
 					deliveryItemsService.save(deliveryItems);
 					deliveryItemsList.add(deliveryItems);
 				}

+ 2 - 1
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/IDeliveryItemsService.java

@@ -22,6 +22,7 @@ import org.springblade.deliver.goods.vo.*;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.purchase.sales.entity.OrderItems;
+import org.springblade.stock.entity.StockGoods;
 
 import java.util.List;
 
@@ -82,6 +83,6 @@ public interface IDeliveryItemsService extends IService<DeliveryItems> {
 	 */
 	boolean submitPay(Long id);
 
-    void receivingInventory(String tradeType, Long id, OrderItems e);
+	StockGoods receivingInventory(String tradeType, Long id, OrderItems e);
 
 }

+ 10 - 7
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryItemsServiceImpl.java

@@ -463,6 +463,7 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 				stockGoods.setBalanceQuantity(stockGoods.getBalanceQuantity().subtract(deliveryItems.getArrivalQuantity()));//结余数量 减
 				stockGoods.setSurplusRouteQuantity(stockGoods.getSurplusRouteQuantity().add(deliveryItems.getActualQuantity()).subtract(deliveryItems.getArrivalQuantity()));//可用数量 减
 				stockGoods.setLockingQuantity(stockGoods.getLockingQuantity().subtract(deliveryItems.getActualQuantity()));//锁定数量 减
+				stockGoods.setBalanceAmount(stockGoods.getBalanceAmount().subtract(deliveryItems.getPurchaseAmount()));
 			} else {
 				stockGoods.setBalanceQuantity(stockGoods.getBalanceQuantity().subtract(deliveryItems.getArrivalQuantity()));//结余数量 减
 				stockGoods.setSurplusRouteQuantity(stockGoods.getSurplusRouteQuantity().add(deliveryItems.getActualQuantity()).subtract(deliveryItems.getArrivalQuantity()));//可用数量 减
@@ -529,6 +530,7 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 				&& "1".equals(sysClient.getParamService("synchronous"))) {
 				stockGoods.setLockingQuantity(stockGoods.getLockingQuantity().add(deliveryItems.getActualQuantity()));//锁定数量 加
 				stockGoods.setSurplusRouteQuantity(stockGoods.getBalanceQuantity().subtract(stockGoods.getLockingQuantity()));//可用数量 加
+				stockGoods.setBalanceAmount(stockGoods.getBalanceAmount().add(deliveryItems.getPurchaseAmount()));
 			}
 		} else {
 			stockGoods.setBalanceQuantity(stockGoods.getBalanceQuantity().subtract(deliveryItems.getArrivalQuantity()));//结余数量 加
@@ -697,10 +699,10 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 		stockGoods.setCntrNo(deliveryItems.getCntrNo());
 		stockGoods.setUpdateTime(new Date());
 		stockGoods.setUpdateUser(SecureUtil.getUserId());
-		boolean updateStock = stockGoodsClient.updateStock(stockGoods);
+		/*boolean updateStock = stockGoodsClient.updateStock(stockGoods);
 		if (!updateStock) {
 			throw new RuntimeException(stockGoods.getCode() + "更新库存总账失败");
-		}
+		}*/
 		return stockGoods;
 	}
 
@@ -786,10 +788,10 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 			stockGoods.setStockPrice(new BigDecimal("0.00"));
 		}
 
-		R saveStock = stockGoodsClient.saveStock(stockGoods);
+		/*R saveStock = stockGoodsClient.saveStock(stockGoods);
 		if (!saveStock.isSuccess()) {
 			throw new SecurityException("插入库存失败");
-		}
+		}*/
 		return stockGoods;
 	}
 
@@ -1098,7 +1100,7 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 	}
 
 	@Override
-	public void receivingInventory(String tradeType, Long id, OrderItems e) {
+	public StockGoods receivingInventory(String tradeType, Long id, OrderItems e) {
 		//查询库存账
 		R<StockGoods> stockById = stockGoodsClient.getStockById(id);
 		if (!stockById.isSuccess()) {
@@ -1128,10 +1130,11 @@ public class DeliveryItemsServiceImpl extends ServiceImpl<DeliveryItemsMapper, D
 		}
 		stockGoods.setUpdateTime(new Date());
 		stockGoods.setUpdateUser(SecureUtil.getUserId());
-		boolean updateStock = stockGoodsClient.updateStock(stockGoods);
+		/*boolean updateStock = stockGoodsClient.updateStock(stockGoods);
 		if (!updateStock) {
 			throw new RuntimeException(stockGoods.getCode() + "更新库存总账失败");
-		}
+		}*/
+		return stockGoods;
 	}
 
 	/**

+ 14 - 3
blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java

@@ -821,6 +821,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 						stockGoodsList1 = stockGoodsClient.selectStockGoodsAll();
 					}
 					List<StockGoods> finalStockGoodsList1 = stockGoodsList1;
+					List<StockGoods> stockGoodsList2 = new ArrayList<>();
 					r.getData().forEach(e -> {
 						//实际库存有没有库存
 						StockGoods model = new StockGoods();
@@ -842,20 +843,24 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 						if (ObjectUtils.isNotNull(sysClient.getParamService("inventory")) && "1".equals(sysClient.getParamService("inventory"))) {
 							//修改库存单 只修改库存  添加库存在上边
 							if (stock != null) {
-								iDeliveryItemsService.receivingInventory(select.getTradeType(), stock.getId(), e);
+								StockGoods stockGoods = iDeliveryItemsService.receivingInventory(select.getTradeType(), stock.getId(), e);
+								stockGoodsList2.add(stockGoods);
 							}
 						} else {
 							if (stock == null) {
 								throw new SecurityException("更新库存失败,未找到库存");
 							} else {
-								iDeliveryItemsService.receivingInventory(select.getTradeType(), stock.getId(), e);
+								StockGoods stockGoods = iDeliveryItemsService.receivingInventory(select.getTradeType(), stock.getId(), e);
+								stockGoodsList2.add(stockGoods);
 							}
 						}
 					});
+					stockGoodsClient.updateStockList(stockGoodsList2);
 				}
 			}
 			List<BusinessOverpaymentItem> list = new ArrayList<>();
 			List<StockGoods> finalStockGoodsList = stockGoodsList;
+			List<StockGoods> stockGoodsList1 = new ArrayList<>();
 			deliveryItemsList.forEach(e -> {
 				if ("681169".equals(AuthUtil.getTenantId())) {
 					// ===================增加益付款逻辑=========================
@@ -945,6 +950,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 						//更新收货单明细库存
 						e.setInventoryNumber(stockGoods.getSurplusRouteQuantity());
 						e.setInWeight(stockGoods.getInWeight());
+						stockGoodsList1.add(stockGoods);
 					}
 					//修改库存单
 					else {
@@ -952,6 +958,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 						//更新收货单明细库存
 						e.setInventoryNumber(receiving.getSurplusRouteQuantity());
 						e.setInWeight(receiving.getInWeight());
+						stockGoodsList1.add(receiving);
 					}
 				} else {
 					if (ObjectUtils.isNotNull(sysClient.getParamService("inventory")) && "1".equals(sysClient.getParamService("inventory"))) {
@@ -961,6 +968,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 							//更新收货单明细库存
 							e.setInventoryNumber(stockGoods.getSurplusRouteQuantity());
 							e.setInWeight(stockGoods.getInWeight());
+							stockGoodsList1.add(stockGoods);
 						}
 						//修改库存单
 						else {
@@ -968,12 +976,14 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 							//更新收货单明细库存
 							e.setInventoryNumber(receiving.getSurplusRouteQuantity());
 							e.setInWeight(receiving.getInWeight());
+							stockGoodsList1.add(receiving);
 						}
 					} else {
 						if (stock == null) {
 							throw new SecurityException("更新库存失败,未找到库存");
 						} else {
-							iDeliveryItemsService.receiving(select.getTradeType(), stock.getId(), e);
+							StockGoods receiving = iDeliveryItemsService.receiving(select.getTradeType(), stock.getId(), e);
+							stockGoodsList1.add(receiving);
 						}
 					}
 				}
@@ -992,6 +1002,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 				}
 
 			});
+			stockGoodsClient.saveOrUpdateBatchList(stockGoodsList1);
 			//更新库存内容
 			iDeliveryItemsService.updateBatchById(deliveryItemsList);
 			if ("681169".equals(AuthUtil.getTenantId())) {

+ 8 - 5
blade-service/blade-pay/src/main/java/org/springblade/pay/tonglianPayment/service/impl/PaymentServiceImpl.java

@@ -30,6 +30,7 @@ import org.springblade.purchase.sales.entity.OrderItems;
 import org.springblade.purchase.sales.feign.IOrderDescClient;
 import org.springblade.purchase.sales.feign.IOrderItemsClient;
 import org.springblade.salesPart.entity.PjOrder;
+import org.springblade.salesPart.enums.OrderTypeEnum;
 import org.springblade.salesPart.feign.IPJOrderClient;
 import org.springblade.stock.entity.StockGoods;
 import org.springblade.stock.feign.IStockGoodsClient;
@@ -356,12 +357,14 @@ public class PaymentServiceImpl implements IPaymentService {
 						wechatMark.setRemark("未找到租户,异常支付");
 					}
 
-					R<PjOrder> re = ipjOrderClient.getByOrder(order);
+					R<List<PjOrder>> re = ipjOrderClient.getByOrder(order);
 					if (re.isSuccess() && ObjectUtils.isNotNull(re.getData())) {
-						PjOrder selectOrder = re.getData();
-						selectOrder.setStatus("待确认");
-						selectOrder.setActualPaymentStatus(2);
-						ipjOrderClient.updateOrder(selectOrder);
+						for (PjOrder selectOrder : re.getData()) {
+							selectOrder.setActualPaymentStatus(2);
+							selectOrder.setStatus(OrderTypeEnum.XSDQR.getType());
+							selectOrder.setXcxStatus(OrderTypeEnum.XSDFH.getType());
+						}
+						ipjOrderClient.updateOrder(re.getData());
 						wechatMark.setCause("订单" + AnalysisMapUtils.getString("cusorderid", params) + "支付成功");
 						wechatMark.setStatus(1);
 					} else {

+ 6 - 3
blade-service/blade-pay/src/main/java/org/springblade/pay/tonglianPayment/utils/AnalysisMapUtils.java

@@ -5,13 +5,16 @@ import java.util.Map;
 public class AnalysisMapUtils {
 
 	public static String getString(String key, Map<String, String> map) {
-		if (map == null || key == null)
+		if (map == null || key == null) {
 			throw new IllegalArgumentException();
-		if (!map.containsKey(key))
+		}
+		if (!map.containsKey(key)) {
 			return null;
+		}
 		Object value = map.get(key);
-		if (value == null)
+		if (value == null){
 			return null;
+		}
 		return value.toString();
 	}
 

+ 14 - 0
blade-service/blade-stock/src/main/java/org/springblade/stock/feign/StockGoodsClient.java

@@ -278,6 +278,20 @@ public class StockGoodsClient implements IStockGoodsClient {
 	 * @return
 	 */
 	@Override
+	@PostMapping(SAVE_OR_UPDATE_BATCH_LIST)
+	@Transactional(rollbackFor = Exception.class)
+	public boolean saveOrUpdateBatchList(List<StockGoods> stockGoods) {
+		stockGoodsService.saveOrUpdateBatch(stockGoods);
+		return redisClient.basicData("stockGoods");
+	}
+
+	/**
+	 * 修改库存总账
+	 *
+	 * @param stockGoods
+	 * @return
+	 */
+	@Override
 	@PostMapping(UPDATE_STOCK_YCP)
 	@TenantIgnore
 	public boolean updateStockYCP(StockGoods stockGoods) {