纪新园 2 лет назад
Родитель
Сommit
507a5a4e68
27 измененных файлов с 803 добавлено и 95 удалено
  1. 1 2
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjProductLaunch.java
  2. 1 2
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjStockDesc.java
  3. 1 1
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjCorpsDescGYSExportExcel.java
  4. 125 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjOrderExportExcelCG.java
  5. 157 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjOrderExportExcelXS.java
  6. 5 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjShipStockDetails.java
  7. 15 9
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/OrderStatistics.java
  8. 59 8
      blade-service/blade-deliver-goods/src/main/java/org/springblade/deliver/goods/service/impl/DeliveryServiceImpl.java
  9. 14 1
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportOrderController.java
  10. 5 1
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/config/MyBatisPlusConfig.java
  11. 2 2
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsStatisticsController.java
  12. 3 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/mapper/CorpsDescMapper.xml
  13. 1 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/impl/CorpsDescServiceImpl.java
  14. 99 5
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/goods/controller/GoodsDescController.java
  15. 105 5
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java
  16. 2 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderMapper.java
  17. 78 15
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderMapper.xml
  18. 2 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IOrderService.java
  19. 33 21
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java
  20. 4 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/service/IProductLaunchService.java
  21. 30 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/service/impl/ProductLaunchServiceImpl.java
  22. 1 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/controller/ShipController.java
  23. 3 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/mapper/ShipMapper.xml
  24. 26 20
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java
  25. 3 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/stock/service/IStockDescService.java
  26. 19 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/stock/service/impl/StockDescServiceImpl.java
  27. 9 3
      blade-service/blade-stock/src/main/java/org/springblade/stock/config/MyBatisPlusConfig.java

+ 1 - 2
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjProductLaunch.java

@@ -306,6 +306,5 @@ public class PjProductLaunch implements Serializable {
 	 * 版本
 	 */
 	@ApiModelProperty(value = "版本")
-	@Version
-	private int version;
+	private Integer version;
 }

+ 1 - 2
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/entity/PjStockDesc.java

@@ -216,8 +216,7 @@ public class PjStockDesc implements Serializable {
 	 * 版本
 	 */
 	@ApiModelProperty(value = "版本")
-	@Version
-	private int version;
+	private Integer version;
 
 	@TableField(exist = false)
 	private List<Long> goodsIds;

+ 1 - 1
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjCorpsDescGYSExportExcel.java

@@ -20,7 +20,7 @@ import com.alibaba.excel.annotation.write.style.ColumnWidth;
 import com.alibaba.excel.annotation.write.style.ContentRowHeight;
 import com.alibaba.excel.annotation.write.style.HeadRowHeight;
 import lombok.Data;
-import com.alibaba.excel.annotation.ExcelProperty;
+import org.springblade.common.execl.ExcelProperty;
 
 import java.io.Serializable;
 import java.math.BigDecimal;

+ 125 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjOrderExportExcelCG.java

@@ -0,0 +1,125 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * 配件销售采购表实体类
+ *
+ * @author BladeX
+ * @since 2023-04-21
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class PjOrderExportExcelCG implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 订单编号
+	 */
+	@ExcelProperty(value = "采购单号")
+	private String ordNo;
+
+	/**
+	 * 所属公司名称
+	 */
+	@ExcelProperty(value = "所属公司")
+	private String salesCompanyName;
+
+	/**
+	 * 客户名称
+	 */
+	@ExcelProperty(value = "业务对象")
+	private String customerName;
+
+	/**
+	 * 发货仓库名称
+	 */
+	@ExcelProperty(value = "仓库")
+	private String storageName;
+
+	/**
+	 * 行数
+	 */
+	@ExcelProperty(value = "行数")
+	private Integer numberRows;
+	/**
+	 * 数量
+	 */
+	@ExcelProperty(value = "数量")
+	private BigDecimal goodsTotalNum;
+	/**
+	 * 总金额
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal totalMoney;
+
+	/**
+	 * 订单状态
+	 */
+	@ExcelProperty(value = "状态")
+	private String status;
+	/**
+	 * 业务日期
+	 */
+	@ExcelProperty(value = "业务日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date businesDate;
+
+	/**
+	 * 创建人名称
+	 */
+	@ExcelProperty(value = "制单人")
+	private String createUserName;
+	/**
+	 * 创建时间
+	 */
+	@ExcelProperty(value = "制单日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date createTime;
+
+	/**
+	 * 修改人名称
+	 */
+	@ExcelProperty(value = "更新人")
+	private String updateUserName;
+
+	/**
+	 * 修改时间
+	 */
+	@ExcelProperty(value = "更新日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date updateTime;
+
+}

+ 157 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjOrderExportExcelXS.java

@@ -0,0 +1,157 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.salesPart.excel;
+
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.pay.tonglianPayment.entity.WechatMark;
+import org.springblade.salesPart.entity.PjOrderItems;
+import org.springblade.salesPart.entity.PjShip;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 配件销售采购表实体类
+ *
+ * @author BladeX
+ * @since 2023-04-21
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class PjOrderExportExcelXS implements Serializable {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	 * 订单编号
+	 */
+	@ExcelProperty(value = "销售单号")
+	private String ordNo;
+	/**
+	 * 源单编号
+	 */
+	@ExcelProperty(value = "来源单号")
+	private String srcOrdNo;
+
+	/**
+	 * 业务来源
+	 */
+	@ExcelProperty(value = "业务来源")
+	private String businessSource;
+
+	/**
+	 * 所属公司名称
+	 */
+	@ExcelProperty(value = "所属公司")
+	private String salesCompanyName;
+
+	/**
+	 * 客户名称
+	 */
+	@ExcelProperty(value = "业务对象")
+	private String customerName;
+
+	/**
+	 * 业务员名称
+	 */
+	@ExcelProperty(value = "业务员")
+	private String salerName;
+
+	/**
+	 * 发货仓库名称
+	 */
+	@ExcelProperty(value = "仓库")
+	private String storageName;
+
+	/**
+	 * 行数
+	 */
+	@ExcelProperty(value = "行数")
+	private Integer numberRows;
+	/**
+	 * 数量
+	 */
+	@ExcelProperty(value = "数量")
+	private BigDecimal goodsTotalNum;
+	/**
+	 * 总金额
+	 */
+	@ExcelProperty(value = "金额")
+	private BigDecimal totalMoney;
+
+	/**
+	 * 订单状态
+	 */
+	@ExcelProperty(value = "状态")
+	private String status;
+
+	/**
+	 * 应结日期
+	 */
+	@ExcelProperty(value = "应结日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date dueDate;
+	/**
+	 * 业务日期
+	 */
+	@ExcelProperty(value = "业务日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
+	@DateTimeFormat(pattern = "yyyy-MM-dd")
+	private Date businesDate;
+
+	/**
+	 * 创建人名称
+	 */
+	@ExcelProperty(value = "制单人")
+	private String createUserName;
+	/**
+	 * 创建时间
+	 */
+	@ExcelProperty(value = "制单日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date createTime;
+
+	/**
+	 * 修改人名称
+	 */
+	@ExcelProperty(value = "更新人")
+	private String updateUserName;
+
+	/**
+	 * 修改时间
+	 */
+	@ExcelProperty(value = "更新日期")
+	@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+	private Date updateTime;
+
+}

+ 5 - 0
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/PjShipStockDetails.java

@@ -100,4 +100,9 @@ public class PjShipStockDetails implements Serializable {
 	 */
 	private Long storageId;
 
+	/**
+	 * 所属公司
+	 */
+	private String salesCompanyId;
+
 }

+ 15 - 9
blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/vo/OrderStatistics.java

@@ -16,8 +16,12 @@
  */
 package org.springblade.salesPart.vo;
 
+import com.alibaba.excel.annotation.write.style.ColumnWidth;
+import com.alibaba.excel.annotation.write.style.ContentRowHeight;
+import com.alibaba.excel.annotation.write.style.HeadRowHeight;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+import org.springblade.common.execl.ExcelProperty;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
@@ -29,6 +33,9 @@ import java.math.BigDecimal;
  * @since 2023-04-21
  */
 @Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
 public class OrderStatistics implements Serializable {
 
 	private static final long serialVersionUID = 1L;
@@ -37,48 +44,47 @@ public class OrderStatistics implements Serializable {
 	/**
 	 * 客户id
 	 */
-	@ApiModelProperty(value = "客户id")
 	private Long customerId;
 	/**
 	 * 客户名称
 	 */
-	@ApiModelProperty(value = "客户名称")
+	@ExcelProperty(value = "客户名称")
 	private String customerName;
 	/**
 	 * 区域
 	 */
-	@ApiModelProperty(value = "区域")
+	@ExcelProperty(value = "区域")
 	private String region;
 	/**
 	 * 业务员名称
 	 */
-	@ApiModelProperty(value = "业务员名称")
+	@ExcelProperty(value = "业务员名称")
 	private String salerName;
 	/**
 	 * 期初金额
 	 */
-	@ApiModelProperty(value = "期初金额")
+	@ExcelProperty(value = "期初金额")
 	private BigDecimal opening;
 
 	/**
 	 * 新增金额
 	 */
-	@ApiModelProperty(value = "新增金额")
+	@ExcelProperty(value = "新增金额")
 	private BigDecimal addAmount;
 	/**
 	 * 实收
 	 */
-	@ApiModelProperty(value = "实收金额")
+	@ExcelProperty(value = "实收金额")
 	private BigDecimal chargeAmount;
 	/**
 	 * 未收
 	 */
-	@ApiModelProperty(value = "未收金额")
+	@ExcelProperty(value = "未收金额")
 	private BigDecimal unpaidAmount;
 	/**
 	 * 期末
 	 */
-	@ApiModelProperty(value = "期末金额")
+	@ExcelProperty(value = "期末金额")
 	private BigDecimal closingAmount;
 
 

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

@@ -805,9 +805,9 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 		//String acoount = CollectionUtils.isEmpty(deliveryItems) ? "0" : pricetotal.toString();
 		//采购金额
 		String acoount = "";
-		if (deliveryR.isSuccess()){
+		if (deliveryR.isSuccess()) {
 			acoount = deliveryR.getData().getPurchaseAmount().toString();
-		}else{
+		} else {
 			acoount = select.getPurchaseAmount().toString();
 		}
 
@@ -1153,16 +1153,66 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 			}
 		}
 
-		// 创建线程池
-		ExecutorService executor = Executors.newSingleThreadExecutor();
-		// 启动任务并提交给线程池
 		String finalBrand = brand;
 		String finalCorpName = corpName;
 		String finalCorpNumber = corpNumber;
 		String finalWareHouse = wareHouse;
+		String finalAcoount = acoount;
+		if ("681169".equals(AuthUtil.getTenantId())){
+			try {
+				String accountName = select.getBelongCompany();
+				if (ObjectUtils.isNull(accountName)) {
+//				accountName = "山东登马轮胎科技有限公司";
+					throw new RuntimeException("请维护所属公司");
+				}
+				JdTenant jdTenant = getJdTenant(accountName, select.getTenantId());
+				if (jdTenant != null) {
+					//测试账套-工厂发货生成凭证
+					try {
+						Delivery details = this.testTakeGoodsSaveVoucher(finalBrand, select, accountName, finalCorpName, finalCorpNumber, finalWareHouse, finalAcoount, orderNo);
+						if (ObjectUtils.isNotNull(details)) {
+							delivery.setVoucherStatus("1");
+							delivery.setVoucherNo(details.getVoucherNo());
+							delivery.setVoucherId(details.getVoucherId());
+							baseMapper.updateById(delivery);
+						}
+					} catch (RuntimeException exception) {
+						LocalDateTime now = LocalDateTime.now();
+						DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+						String formatted = now.format(formatter);
+						Message sendMessage = new Message();
+						sendMessage.setParameter(select.getId() + "");
+						sendMessage.setUserName("外部用户");
+						sendMessage.setUserId(null);
+						sendMessage.setToUserId(AuthUtil.getUserId());
+						sendMessage.setToUserName(AuthUtil.getUserName());
+						sendMessage.setMessageType(1);
+						sendMessage.setTenantId(AuthUtil.getTenantId());
+						sendMessage.setCreateUser(null);
+						sendMessage.setCreateTime(new Date());
+						sendMessage.setUrl("/businessManagement/receipt/index");
+						sendMessage.setPageLabel("工厂发货");
+						sendMessage.setPageStatus("this.$store.getters.domSaleStatus");
+						sendMessage.setMessageBody("工厂发货生成凭证失败!单号:" + select.getSysNo()
+							+ "时间:" + formatted + "原因:" + exception.getMessage());
+						R save = messageClient.save(sendMessage);
+						System.out.println("发送结果:" + save);
+						if (!save.isSuccess()) {
+							throw new SecurityException("发送消息失败");
+						}
+					}
+
+				}
+			} catch (Exception e) {
+				throw new RuntimeException(e.getMessage());
+			}
+		}
+		/*// 创建线程池
+		ExecutorService executor = Executors.newSingleThreadExecutor();
+		// 启动任务并提交给线程池
+
 		try {
 			// 启动任务并提交给线程池
-			String finalAcoount = acoount;
 			Future<?> future = executor.submit(new Callable<Void>() {
 				@Override
 				public Void call() throws Exception {
@@ -1175,7 +1225,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 						JdTenant jdTenant = getJdTenant(accountName, select.getTenantId());
 						if (jdTenant != null) {
 							//测试账套-工厂发货生成凭证
-							voucher(finalBrand, select, accountName, finalCorpName, finalCorpNumber, finalWareHouse, finalAcoount, orderNo);
+							voucher(finalBrand, delivery, accountName, finalCorpName, finalCorpNumber, finalWareHouse, finalAcoount, orderNo);
 						}
 					} catch (Exception e) {
 						System.out.println(e.getMessage());
@@ -1190,7 +1240,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 		} finally {
 			// 关闭线程池
 			executor.shutdown();
-		}
+		}*/
 		return select;
 	}
 
@@ -1200,6 +1250,7 @@ public class DeliveryServiceImpl extends ServiceImpl<DeliveryMapper, Delivery> i
 			Delivery delivery = this.testTakeGoodsSaveVoucher(brand, select, accountName, copsName, corpNumber, warehouse, acoount, orderNo);
 			if (ObjectUtils.isNotNull(delivery)) {
 				delivery.setVoucherStatus("1");
+				delivery.setId(select.getId());
 				baseMapper.updateById(delivery);
 			}
 		} catch (RuntimeException exception) {

+ 14 - 1
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/export/ExportOrderController.java

@@ -1708,7 +1708,6 @@ public class ExportOrderController extends BladeController {
 		order1.setConfirmStatus(null);
 		order1.setOrderFeesList(new ArrayList<>());
 		order1.setOrderFilesList(new ArrayList<>());
-		order1.setOrderItemsList(new ArrayList<>());
 		order1.setOrderModifyList(new ArrayList<>());
 		order1.setOrderItemIds(new ArrayList<>());
 		order1.setSettlementList(new ArrayList<>());
@@ -1729,6 +1728,20 @@ public class ExportOrderController extends BladeController {
 		order1.setEstimateGoodGoodsDate(null);
 		order1.setDocumentaryDate(null);
 		order1.setCheckDate(null);
+		if (ObjectUtils.isNotNull(order1.getOrderItemsList())) {
+			for (OrderItems item : order1.getOrderItemsList()) {
+				item.setId(null);
+				item.setPid(null);
+				item.setSrcItemId(null);
+				item.setSrcId(null);
+				item.setSrcOrderNo(null);
+				item.setPurchaseAmount(new BigDecimal("0.00"));
+				item.setPurchaseQuantity(new BigDecimal("0.00"));
+				item.setFudaPurchaseStatus(null);
+				item.setBillNo(null);
+				item.setBusinesDate(null);
+			}
+		}
 		return R.data(order1);
 	}
 

+ 5 - 1
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/config/MyBatisPlusConfig.java

@@ -1,3 +1,4 @@
+/*
 package org.springblade.salesPart.config;
 
 import com.baomidou.mybatisplus.annotation.DbType;
@@ -20,10 +21,12 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.core.annotation.AnnotationAwareOrderComparator;
 
+*/
 /**
  * @author :jixinyuan
  * @date : 2023/7/4
- */
+ *//*
+
 @Configuration
 public class MyBatisPlusConfig extends MybatisPlusConfiguration {
 
@@ -55,3 +58,4 @@ public class MyBatisPlusConfig extends MybatisPlusConfiguration {
 		return interceptor;
 	}
 }
+*/

+ 2 - 2
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsStatisticsController.java

@@ -64,7 +64,7 @@ public class CorpsStatisticsController {
 			} else {
 				lambdaQueryWrapper.eq(PjOrder::getBsType, "CG");
 			}
-			lambdaQueryWrapper.eq(PjOrder::getSalesCompanyId, AuthUtil.getTenantId());
+			lambdaQueryWrapper.eq(PjOrder::getSalesCompanyId, AuthUtil.getDeptId());
 			if (ObjectUtils.isNotNull(corpsDescDto1.getCreditLimit()) && ObjectUtils.isNotNull(corpsDescDto1.getUseCreditLimit())) {
 				corpsDescDto1.setCreditLimitBalance(corpsDescDto1.getCreditLimit().subtract(corpsDescDto1.getUseCreditLimit()));
 			}
@@ -115,7 +115,7 @@ public class CorpsStatisticsController {
 			} else {
 				lambdaQueryWrapper.eq(PjOrder::getBsType, "CG");
 			}
-			lambdaQueryWrapper.eq(PjOrder::getSalesCompanyId, AuthUtil.getTenantId());
+			lambdaQueryWrapper.eq(PjOrder::getSalesCompanyId, AuthUtil.getDeptId());
 			List<PjOrder> orderList = orderService.list(lambdaQueryWrapper);
 			if (ObjectUtils.isNotNull(orderList)) {
 				BigDecimal sumAmount = orderList.stream().map(PjOrder::getTotalMoney).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);

+ 3 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/mapper/CorpsDescMapper.xml

@@ -250,6 +250,9 @@
         <if test="CorpsDesc.status!=null">
             and status = #{CorpsDesc.status}
         </if>
+        <if test="CorpsDesc.salesCompanyId!=null">
+            and sales_company_id = #{CorpsDesc.salesCompanyId}
+        </if>
         <if test="CorpsDesc.enableOrNot != null">
             and enable_or_not = #{CorpsDesc.enableOrNot}
         </if>

+ 1 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/impl/CorpsDescServiceImpl.java

@@ -626,6 +626,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 		}
 		corpsDescDto.setTenantId(AuthUtil.getTenantId());
 		corpsDescDto.setId(corpsDescDto.getId());
+		corpsDescDto.setSalesCompanyId(Long.parseLong(AuthUtil.getDeptId()));
 		return baseMapper.selectPartsCorpsDesc(corpsDescDto);
 	}
 

+ 99 - 5
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/goods/controller/GoodsDescController.java

@@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 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.plugins.pagination.Page;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -37,7 +38,10 @@ import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.salesPart.corps.service.ICorpsDescService;
-import org.springblade.salesPart.entity.*;
+import org.springblade.salesPart.entity.PjCorpsDesc;
+import org.springblade.salesPart.entity.PjGoodsDesc;
+import org.springblade.salesPart.entity.PjGoodsType;
+import org.springblade.salesPart.entity.PjProductLaunch;
 import org.springblade.salesPart.excel.GoodsDescExportExcel;
 import org.springblade.salesPart.excel.GoodsExcel;
 import org.springblade.salesPart.goods.service.IGoodsDescService;
@@ -295,6 +299,16 @@ public class GoodsDescController extends BladeController {
 		if (goodsDesc.getId() == null) {
 			return R.fail(500, "请选择数据");
 		}
+		if (0 == goodsDesc.getEnableOrNot()) {
+			long count = productLaunchService.count(new LambdaQueryWrapper<PjProductLaunch>()
+				.eq(PjProductLaunch::getIsDeleted, 0)
+				.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
+				.eq(PjProductLaunch::getGoodsId, goodsDesc.getId())
+				.eq(PjProductLaunch::getUpAndDownShelves, 1));
+			if (count > 0) {
+				return R.fail(500, "该轮胎以上架,请先下架轮胎在进行操作");
+			}
+		}
 		boolean status = goodsDescService.updateById(goodsDesc);
 		return R.status(status);
 	}
@@ -333,9 +347,9 @@ public class GoodsDescController extends BladeController {
 			.eq(PjProductLaunch::getUpAndDownShelves, 1);
 		queryWrapper.apply("find_in_set(sales_company_id,'" + AuthUtil.getDeptId() + "')");
 		if (ObjectUtils.isNotNull(goods.getStock())) {
-			queryWrapper.eq(PjProductLaunch::getBillType,0);
+			queryWrapper.eq(PjProductLaunch::getBillType, 0);
 		} else {
-			queryWrapper.eq(PjProductLaunch::getBillType,1);
+			queryWrapper.eq(PjProductLaunch::getBillType, 1);
 		}
 		List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(queryWrapper);
 		List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).distinct().collect(Collectors.toList());
@@ -361,6 +375,86 @@ public class GoodsDescController extends BladeController {
 	}
 
 	/**
+	 * 商品下拉 配件批发商品表
+	 */
+	@GetMapping("/goodsPageXs")
+	@ApiOperationSupport(order = 12)
+	@ApiOperation(value = "商品下拉", notes = "传入goods")
+	public R<IPage<PjGoodsDesc>> goodsPageXs(PjGoodsDesc goods, Query query) {
+		LambdaQueryWrapper<PjProductLaunch> queryWrapper = new LambdaQueryWrapper<PjProductLaunch>()
+			.eq(PjProductLaunch::getIsDeleted, 0)
+			.ne(PjProductLaunch::getInventory, 0)
+			.eq(PjProductLaunch::getUpAndDownShelves, 1);
+		queryWrapper.apply("find_in_set(sales_company_id,'" + AuthUtil.getDeptId() + "')");
+		if (ObjectUtils.isNotNull(goods.getStock())) {
+			queryWrapper.eq(PjProductLaunch::getBillType, 0);
+		} else {
+			queryWrapper.eq(PjProductLaunch::getBillType, 1);
+		}
+		List<PjProductLaunch> pjProductLaunchList = productLaunchService.list(queryWrapper);
+		List<Long> ids = pjProductLaunchList.stream().map(PjProductLaunch::getGoodsId).distinct().collect(Collectors.toList());
+		PjCorpsDesc pjCorpsDesc = corpsDescService.getById(goods.getCustomId());
+		String priceSystem = "";
+		if (ObjectUtils.isNotNull(pjCorpsDesc)) {
+			priceSystem = pjCorpsDesc.getPriceSystem();
+		}
+		LambdaQueryWrapper<PjGoodsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(PjGoodsDesc::getTenantId, AuthUtil.getTenantId())
+			.eq(PjGoodsDesc::getIsDeleted, 0)
+			.eq(ObjectUtils.isNotNull(goods.getEnableOrNot()), PjGoodsDesc::getEnableOrNot, goods.getEnableOrNot())
+			.eq(ObjectUtils.isNotNull(goods.getBrandId()), PjGoodsDesc::getBrandId, goods.getBrandId())
+			.eq(ObjectUtils.isNotNull(goods.getSpecificationAndModel()), PjGoodsDesc::getSpecificationAndModel, goods.getSpecificationAndModel())
+			.eq(ObjectUtils.isNotNull(goods.getBrandItem()), PjGoodsDesc::getBrandItem, goods.getBrandItem());
+		if (ObjectUtil.isNotEmpty(goods.getCname())) {//商品名称
+			lambdaQueryWrapper.and(i -> i.like(PjGoodsDesc::getCname, goods.getCname()).or().like(PjGoodsDesc::getCnameInt, goods.getCname()));
+		}
+		//指定分类为一级分类,查询此分类所有二级分类的商品
+		if (StringUtils.isNotBlank(goods.getGoodsTypeId())) {
+			Long goodsId = Long.parseLong(goods.getGoodsTypeId());
+			List<Long> goodsIdList = new ArrayList<>();
+			selectChildById(goodsId, goodsIdList);
+			goodsIdList.add(goodsId);
+
+			lambdaQueryWrapper.in(PjGoodsDesc::getGoodsTypeId, goodsIdList);
+		}
+		if (ObjectUtils.isNotNull(ids) && ids.size() > 0) {
+			lambdaQueryWrapper.in(PjGoodsDesc::getId, ids);
+		} else {
+			return R.data(new Page<>());
+		}
+		IPage<PjGoodsDesc> list = goodsDescService.page(Condition.getPage(query), lambdaQueryWrapper);
+		for (PjGoodsDesc item : list.getRecords()) {
+			if (pjProductLaunchList.size() > 0) {
+				PjProductLaunch pjProductLaunch = pjProductLaunchList.stream().filter(e -> e.getGoodsId().equals(item.getId())).findFirst().orElse(new PjProductLaunch());
+				if ("售价1".equals(priceSystem)) {
+					item.setPrice(pjProductLaunch.getPriceOne());
+				} else if ("售价2".equals(priceSystem)) {
+					item.setPrice(pjProductLaunch.getPriceTwo());
+				} else if ("售价3".equals(priceSystem)) {
+					item.setPrice(pjProductLaunch.getPriceThree());
+				} else if ("售价4".equals(priceSystem)) {
+					item.setPrice(pjProductLaunch.getPriceFour());
+				}
+				item.setSharedCompanyId(pjProductLaunch.getSourceCompanyId());
+				item.setSharedCompanyName(pjProductLaunch.getSourceCompanyName());
+				item.setInventory(pjProductLaunch.getInventory());
+			}
+			String typeId = item.getGoodsTypeId();
+			String[] split = typeId.split(",");
+			List<String> stringList = Arrays.asList(split);
+			LambdaQueryWrapper<PjGoodsType> goodsTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
+			goodsTypeLambdaQueryWrapper.in(PjGoodsType::getId, stringList);
+			List<PjGoodsType> types = goodsDescType.list(goodsTypeLambdaQueryWrapper);
+			if (CollectionUtils.isNotEmpty(types)) {
+				List<String> typeStr = types.stream().map(PjGoodsType::getCname).collect(Collectors.toList());
+				item.setGoodsTypeName(typeStr.toString().replace("[", "").replace("]", ""));
+			}
+
+		}
+		return R.data(list);
+	}
+
+	/**
 	 * 递归查询ID
 	 */
 	private void selectChildById(Long id, List<Long> idList) {
@@ -390,9 +484,9 @@ public class GoodsDescController extends BladeController {
 			.eq(PjProductLaunch::getUpAndDownShelves, 1);
 		lambdaQueryWrapper.apply("find_in_set(sales_company_id,'" + AuthUtil.getDeptId() + "')");
 		if (ObjectUtils.isNotNull(goods.getStock())) {
-			lambdaQueryWrapper.eq(PjProductLaunch::getBillType,0);
+			lambdaQueryWrapper.eq(PjProductLaunch::getBillType, 0);
 		} else {
-			lambdaQueryWrapper.eq(PjProductLaunch::getBillType,1);
+			lambdaQueryWrapper.eq(PjProductLaunch::getBillType, 1);
 		}
 
 		List<PjProductLaunch> pjProductLaunch = productLaunchService.list(lambdaQueryWrapper);

+ 105 - 5
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/controller/OrderController.java

@@ -17,7 +17,6 @@
 package org.springblade.salesPart.order.controller;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -27,19 +26,22 @@ import io.swagger.annotations.ApiParam;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 
+import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
 
+import org.springblade.core.excel.util.ExcelUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.purchase.sales.entity.Order;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.enums.OrderTypeEnum;
+import org.springblade.salesPart.excel.PjOrderExportExcelCG;
+import org.springblade.salesPart.excel.PjOrderExportExcelXS;
 import org.springblade.salesPart.order.service.IOrderItemsService;
-import org.springblade.salesPart.productLaunch.service.IProductLaunchFilesService;
 import org.springblade.salesPart.vo.OrderStatistics;
 import org.springblade.salesPart.vo.OrderVO;
 import org.springblade.system.user.entity.User;
@@ -126,8 +128,6 @@ public class OrderController extends BladeController {
 			lambdaQueryWrapper.eq(PjOrder::getSalerId, AuthUtil.getUserId());
 		} else if (AuthUtil.getUserRole().contains("客户")) {
 			lambdaQueryWrapper.eq(PjOrder::getCustomerId, AuthUtil.getUserId());
-		} else if (AuthUtil.getUserRole().contains("销售")) {
-			lambdaQueryWrapper.eq(PjOrder::getCreateUser, AuthUtil.getUserId());
 		}
 		IPage<PjOrder> pages = orderService.page(Condition.getPage(query), lambdaQueryWrapper);
 
@@ -171,6 +171,94 @@ public class OrderController extends BladeController {
 	}
 
 	/**
+	 * 订单(导出)
+	 */
+	@GetMapping("/listExport")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入order")
+	public void  listExport(PjOrder order, HttpServletResponse response) {
+		LambdaQueryWrapper<PjOrder> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(PjOrder::getTenantId, AuthUtil.getTenantId())
+			.eq(PjOrder::getIsDeleted, 0)
+			.eq(PjOrder::getBsType, order.getBsType())
+			.eq(PjOrder::getSalesCompanyId, AuthUtil.getDeptId())//公司
+			.eq(ObjectUtils.isNotEmpty(order.getStorageId()), PjOrder::getStorageId, order.getStorageId())//仓库
+			.like(ObjectUtils.isNotEmpty(order.getStorageName()), PjOrder::getStorageName, order.getStorageName())
+			.eq(ObjectUtils.isNotEmpty(order.getCustomerId()), PjOrder::getCustomerId, order.getCustomerId())//客户
+			.eq(ObjectUtils.isNotEmpty(order.getGenerateTask()), PjOrder::getGenerateTask, order.getGenerateTask())//客户
+			.eq(ObjectUtils.isNotEmpty(order.getSalerId()), PjOrder::getSalerId, order.getSalerId())//业务员
+			.like(ObjectUtils.isNotEmpty(order.getCustomerName()), PjOrder::getCustomerName, order.getCustomerName())
+			.like(ObjectUtils.isNotEmpty(order.getSrcOrdNo()), PjOrder::getSrcOrdNo, order.getSrcOrdNo())//来源单号
+			.like(ObjectUtils.isNotEmpty(order.getOrdNo()), PjOrder::getOrdNo, order.getOrdNo())//来源单号
+			.like(ObjectUtils.isNotEmpty(order.getBusinessSource()), PjOrder::getBusinessSource, order.getBusinessSource())//来源
+			.apply(ObjectUtils.isNotEmpty(order.getStatus()), "find_in_set(status,'" + order.getStatus() + "')");
+		if (order.getDueDateList() != null && order.getDueDateList().size() > 1) {//创建日期
+			lambdaQueryWrapper.ge(PjOrder::getDueDate, order.getDueDateList().get(0));
+			lambdaQueryWrapper.le(PjOrder::getDueDate, order.getDueDateList().get(1));
+		}
+		if (order.getBusinesDateList() != null && order.getBusinesDateList().size() > 1) {//创建日期
+			lambdaQueryWrapper.ge(PjOrder::getBusinesDate, order.getBusinesDateList().get(0));
+			lambdaQueryWrapper.le(PjOrder::getBusinesDate, order.getBusinesDateList().get(1));
+		}
+		if (ObjectUtils.isNotNull(order.getActualPaymentType())) {
+			lambdaQueryWrapper.eq(PjOrder::getActualPaymentStatus, order.getActualPaymentType());
+		} else {
+			lambdaQueryWrapper.ne(ObjectUtils.isNotEmpty(order.getActualPaymentStatus()), PjOrder::getActualPaymentStatus, order.getActualPaymentStatus());//来源单号
+		}
+		lambdaQueryWrapper.apply("(( business_source = '外部销售' AND actual_payment_status = 2 ) OR (business_source = '内部销售' AND FIND_IN_SET( actual_payment_status, '0,1,2,3' )))");
+		lambdaQueryWrapper.orderByDesc(PjOrder::getCreateTime);
+
+		if (AuthUtil.getUserRole().contains("业务员")) {
+			lambdaQueryWrapper.eq(PjOrder::getSalerId, AuthUtil.getUserId());
+		} else if (AuthUtil.getUserRole().contains("客户")) {
+			lambdaQueryWrapper.eq(PjOrder::getCustomerId, AuthUtil.getUserId());
+		}
+		List<PjOrder> pages = orderService.list(lambdaQueryWrapper);
+
+		String updateUserIds = "";//修改人id拼接
+		String createUserIds = "";//创建人id拼接
+		for (PjOrder items : pages) {
+			if (ObjectUtil.isNotEmpty(items.getUpdateUser())) {
+				updateUserIds = updateUserIds + items.getUpdateUser() + ",";
+			}
+			if (ObjectUtil.isNotEmpty(items.getCreateUser())) {
+				createUserIds = createUserIds + items.getCreateUser() + ",";
+			}
+		}
+
+		//获得修改人信息
+		List<User> updateUserList = iUserClient.selectUserIds(updateUserIds);
+		//获得创建人信息
+		List<User> createUserList = iUserClient.selectUserIds(createUserIds);
+
+		if (CollectionUtils.isNotEmpty(pages)) {
+			pages.forEach(item -> {
+				if (ObjectUtil.isNotEmpty(updateUserList)) {
+					User user = updateUserList.stream().anyMatch(e -> e.getId().equals(item.getUpdateUser())) ? updateUserList.stream().filter(e -> e.getId().equals(item.getUpdateUser())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						item.setUpdateUserName(user.getName());
+					}
+				}
+
+				if (ObjectUtil.isNotEmpty(createUserList)) {
+					User user = createUserList.stream().anyMatch(e -> e.getId().equals(item.getCreateUser())) ? createUserList.stream().filter(e -> e.getId().equals(item.getCreateUser())).findFirst().get() : null;
+					if (ObjectUtils.isNotNull(user)) {
+						item.setCreateUserName(user.getName());
+					}
+				}
+				item.setItem(orderItemsService.count(new LambdaQueryWrapper<PjOrderItems>().eq(PjOrderItems::getIsDeleted, 0)
+					.eq(PjOrderItems::getPid, item.getId())) + "");
+			});
+		}
+		if ("XS".equals(order.getBsType())){
+			ExcelUtil.export(response, "销售订单", "订单数据", BeanUtil.copy(pages, PjOrderExportExcelXS.class), PjOrderExportExcelXS.class);
+		}else{
+			ExcelUtil.export(response, "采购订单", "订单数据", BeanUtil.copy(pages, PjOrderExportExcelCG.class), PjOrderExportExcelCG.class);
+		}
+
+	}
+
+	/**
 	 * 自定义分页 配件销售
 	 */
 	@GetMapping("/page")
@@ -494,4 +582,16 @@ public class OrderController extends BladeController {
 		return R.data(pages);
 	}
 
+	/**
+	 * 收款统计(导出)
+	 */
+	@GetMapping("/collectionExport")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入order")
+	public void  collectionExport(OrderVO order, HttpServletResponse response) {
+		List<OrderStatistics> list = orderService.collectionStatisticsList(order);
+		ExcelUtil.export(response, "应收款统计", "应收款统计", list, OrderStatistics.class);
+
+	}
+
 }

+ 2 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderMapper.java

@@ -53,6 +53,8 @@ public interface OrderMapper extends BaseMapper<PjOrder> {
 	 */
 	List<OrderStatistics> collectionStatistics(IPage page, @Param("order") OrderVO order);
 
+	List<OrderStatistics> collectionStatisticsList(@Param("order") OrderVO order);
+
 	List<PjOrder> salesman(@Param("order") PjOrder order);
 
 	Map<String, BigDecimal> columnar(LocalDate firstDay, LocalDate lastDay,String tenantId);

+ 78 - 15
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/mapper/OrderMapper.xml

@@ -53,6 +53,7 @@
         SELECT DISTINCT
         pcd.id AS customerId,
         pcd.cname AS customerName,
+        bu.`name` as salerName,
         SUBSTRING_INDEX(SUBSTRING_INDEX(pca.belongtoarea, ',', 2), ',', -1) AS region,
         IF(po2.total_money,po2.total_money,0.00 ) AS opening ,
         IF(po1.addAmount,po1.addAmount,0.00 ) AS addAmount ,
@@ -62,7 +63,8 @@
         ),IF(po2.total_money,po2.total_money,0.00 ) +IF(po1.addAmount,po1.addAmount,0.00 ),0.00 ) AS closingAmount
         FROM
         pjpf_corps_desc pcd
-        LEFT JOIN pjpf_corps_addr pca ON pcd.id = pca.pid
+        LEFT JOIN pjpf_corps_addr pca ON pcd.id = pca.pid and pca.default_addres = '1'
+        LEFT JOIN blade_user bu ON pcd.salesman_id = bu.id
         LEFT JOIN (SELECT
         sum( po.total_money ) as addAmount,
         sum( po.payment_amount_tl ) as chargeAmount ,
@@ -71,8 +73,7 @@
         FROM
         pjpf_order po
         WHERE
-        DATE_FORMAT(po.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
-        AND po.is_deleted = 0
+         po.is_deleted = 0
         AND po.tenant_id = '883868'
         AND po.bs_type = 'XS'
         AND po.business_source ='内部销售'
@@ -80,11 +81,11 @@
         <if test="order.salesCompanyId!=null">
             and po.sales_company_id = #{order.salesCompanyId}
         </if>
-        <if test="order.businesDateList != null and order.businesDateList[0] != null and order.businesDateList[0]!= ''">
-            and po.busines_date &gt;= #{order.businesDateList[0]}
+        <if test="order.businesDate == null">
+            AND DATE_FORMAT(po.busines_date, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
         </if>
-        <if test="order.createTimeList != null and order.businesDateList[1] != null and order.businesDateList[1]!= ''">
-            and po.busines_date &lt;= #{order.businesDateList[1]}
+        <if test="order.salesCompanyId !=null">
+            AND DATE_FORMAT(po.busines_date, '%Y-%m') = DATE_FORMAT(#{order.businesDate}, '%Y-%m')
         </if>
         GROUP BY po.customer_id) as po1 on pcd.id = po1.customer_id
         LEFT JOIN (SELECT
@@ -93,8 +94,7 @@
         FROM
         pjpf_order po
         WHERE
-        DATE_FORMAT(po.create_time, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
-        AND po.is_deleted = 0
+         po.is_deleted = 0
         AND po.tenant_id = '883868'
         AND po.bs_type = 'XS'
         AND po.business_source ='内部销售'
@@ -102,15 +102,11 @@
         <if test="order.salesCompanyId!=null">
             and po.sales_company_id = #{order.salesCompanyId}
         </if>
-        <if test="order.businesDateList != null and order.businesDateList[0] != null and order.businesDateList[0]!= ''">
-            and po.busines_date &gt;= #{order.businesDateList[0]}
-        </if>
-        <if test="order.businesDateList != null and order.businesDateList[1] != null and order.businesDateList[1]!= ''">
-            and po.busines_date &lt;= #{order.businesDateList[1]}
+        <if test="order.salesCompanyId !=null">
+            AND DATE_FORMAT(po.busines_date, '%Y-%m') = DATE_FORMAT(#{order.businesDate}, '%Y-%m')
         </if>
         GROUP BY po.customer_id) as po2 on pcd.id = po2.customer_id
         where pcd.corp_type = 'KH'
-        and pcd.enable_or_not = '0'
         and pcd.is_deleted = '0'
         and (po2.total_money is not null or po1.addAmount is not null or  po1.chargeAmount is not null)
         <if test="order.customerId!=null">
@@ -157,5 +153,72 @@
             and po.busines_date &lt;= #{lastDay}
         </if>
     </select>
+    <select id="collectionStatisticsList" resultType="org.springblade.salesPart.vo.OrderStatistics">
+        SELECT DISTINCT
+        pcd.id AS customerId,
+        pcd.cname AS customerName,
+        bu.`name` as salerName,
+        SUBSTRING_INDEX(SUBSTRING_INDEX(pca.belongtoarea, ',', 2), ',', -1) AS region,
+        IF(po2.total_money,po2.total_money,0.00 ) AS opening ,
+        IF(po1.addAmount,po1.addAmount,0.00 ) AS addAmount ,
+        IF(po1.chargeAmount,po1.chargeAmount,0.00 ) AS chargeAmount ,
+        IF(po1.addAmount - po1.chargeAmount,po1.addAmount - po1.chargeAmount,0.00 ) AS unpaidAmount ,
+        IF(IF(po2.total_money,po2.total_money,0.00 ) +IF(po1.addAmount,po1.addAmount,0.00
+        ),IF(po2.total_money,po2.total_money,0.00 ) +IF(po1.addAmount,po1.addAmount,0.00 ),0.00 ) AS closingAmount
+        FROM
+        pjpf_corps_desc pcd
+        LEFT JOIN pjpf_corps_addr pca ON pcd.id = pca.pid and pca.default_addres = '1'
+        LEFT JOIN blade_user bu ON pcd.salesman_id = bu.id
+        LEFT JOIN (SELECT
+        sum( po.total_money ) as addAmount,
+        sum( po.payment_amount_tl ) as chargeAmount ,
+        sum( po.total_money ) -sum( po.payment_amount_tl ) as unpaidAmount,
+        po.customer_id as customer_id
+        FROM
+        pjpf_order po
+        WHERE
+        po.is_deleted = 0
+        AND po.tenant_id = '883868'
+        AND po.bs_type = 'XS'
+        AND po.business_source ='内部销售'
+        and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,退款请核')
+        <if test="order.salesCompanyId!=null">
+            and po.sales_company_id = #{order.salesCompanyId}
+        </if>
+        <if test="order.businesDate == null">
+            AND DATE_FORMAT(po.busines_date, '%Y-%m') = DATE_FORMAT(CURDATE(), '%Y-%m')
+        </if>
+        <if test="order.salesCompanyId !=null">
+            AND DATE_FORMAT(po.busines_date, '%Y-%m') = DATE_FORMAT(#{order.businesDate}, '%Y-%m')
+        </if>
+        GROUP BY po.customer_id) as po1 on pcd.id = po1.customer_id
+        LEFT JOIN (SELECT
+        sum( po.total_money ) as total_money,
+        po.customer_id as customer_id
+        FROM
+        pjpf_order po
+        WHERE
+        po.is_deleted = 0
+        AND po.tenant_id = '883868'
+        AND po.bs_type = 'XS'
+        AND po.business_source ='内部销售'
+        and FIND_IN_SET(po.`status`,'待确认,待发货,已发货,退款请核')
+        <if test="order.salesCompanyId!=null">
+            and po.sales_company_id = #{order.salesCompanyId}
+        </if>
+        <if test="order.salesCompanyId !=null">
+            AND DATE_FORMAT(po.busines_date, '%Y-%m') = DATE_FORMAT(#{order.businesDate}, '%Y-%m')
+        </if>
+        GROUP BY po.customer_id) as po2 on pcd.id = po2.customer_id
+        where pcd.corp_type = 'KH'
+        and pcd.is_deleted = '0'
+        and (po2.total_money is not null or po1.addAmount is not null or  po1.chargeAmount is not null)
+        <if test="order.customerId!=null">
+            and pcd.id = #{order.customerId}
+        </if>
+        <if test="order.salerId!=null">
+            and pcd.salesman_id = #{order.salerId}
+        </if>
+    </select>
 
 </mapper>

+ 2 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/IOrderService.java

@@ -141,6 +141,8 @@ public interface IOrderService extends IService<PjOrder> {
 	 */
 	IPage<OrderStatistics> collectionStatistics(IPage<OrderStatistics> page, OrderVO order);
 
+	List<OrderStatistics> collectionStatisticsList(OrderVO order);
+
 	List<PjOrder> salesman(PjOrder order);
 
 	Map<String, List<BigDecimal>> columnar(PjOrder order);

+ 33 - 21
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/order/service/impl/OrderServiceImpl.java

@@ -47,14 +47,12 @@ import org.springblade.salesPart.order.mapper.OrderItemsMapper;
 import org.springblade.salesPart.order.mapper.OrderMapper;
 import org.springblade.salesPart.order.service.IOrderService;
 import org.springblade.salesPart.payMethod.PayService;
-import org.springblade.salesPart.payment.mapper.PaymentMapper;
-import org.springblade.salesPart.productLaunch.mapper.ProductLaunchMapper;
+import org.springblade.salesPart.productLaunch.service.IProductLaunchService;
 import org.springblade.salesPart.settlement.mapper.SettlementMapper;
 import org.springblade.salesPart.settlement.service.ISettlementItemsService;
-import org.springblade.salesPart.settlement.service.ISettlementService;
 import org.springblade.salesPart.ship.mapper.ShipItemsMapper;
 import org.springblade.salesPart.ship.mapper.ShipMapper;
-import org.springblade.salesPart.stock.mapper.StockDescMapper;
+import org.springblade.salesPart.stock.service.IStockDescService;
 import org.springblade.salesPart.storage.mapper.StorageDescMapper;
 import org.springblade.salesPart.vo.OrderStatistics;
 import org.springblade.salesPart.vo.OrderVO;
@@ -98,8 +96,8 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 	private final ShipItemsMapper shipItemsMapper;
 	private final CorpsDescMapper corpsDescMapper;
 	private final StorageDescMapper storageDescMapper;
-	private final StockDescMapper stockDescMapper;
-	private final ProductLaunchMapper productLaunchMapper;
+	private final IStockDescService stockDescService;
+	private final IProductLaunchService productLaunchService;
 	private final GoodsDescMapper goodsDescMapper;
 	private final ISysClient sysClient;
 	private final HistoryMapper historyMapper;
@@ -200,6 +198,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 		return page.setRecords(baseMapper.collectionStatistics(page, order));
 	}
 
+	/**
+	 * 自定义分页
+	 *
+	 * @param order
+	 * @return
+	 */
+	@Override
+	public List<OrderStatistics> collectionStatisticsList(OrderVO order) {
+		return baseMapper.collectionStatisticsList(order);
+	}
+
 	@Override
 	public List<PjOrder> salesman(PjOrder order) {
 		return baseMapper.salesman(order);
@@ -359,7 +368,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 						} else {
 							lambdaQueryWrapper.and(i -> i.eq(PjStockDesc::getDot, "").or().isNull(PjStockDesc::getDot));
 						}
-						PjStockDesc stockDesc = stockDescMapper.selectOne(lambdaQueryWrapper);
+						PjStockDesc stockDesc = stockDescService.getOne(lambdaQueryWrapper);
 						if (ObjectUtil.isNotEmpty(stockDesc)) {
 							item.setCostprie(item.getGoodsNum().multiply(stockDesc.getInventoryCostPrice()));
 						} else {
@@ -373,7 +382,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 							.eq(PjProductLaunch::getGoodsId, item.getGoodsId())
 							.eq(PjProductLaunch::getSalesCompanyId, order.getSalesCompanyId())
 							.eq(PjProductLaunch::getSourceCompanyId, order.getSharedCompanyId());
-						PjProductLaunch productLaunch = productLaunchMapper.selectOne(lambdaQueryWrapper);
+						PjProductLaunch productLaunch = productLaunchService.getOne(lambdaQueryWrapper);
 						if (ObjectUtils.isNotNull(productLaunch)) {
 							item.setCostprie(item.getGoodsNum().multiply(productLaunch.getShareCost()));
 						} else {
@@ -564,14 +573,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 						.eq(PjProductLaunch::getIsDeleted, 0)
 						.and(i -> i.eq(PjProductLaunch::getSalesCompanyId, pjOrder.getSalesCompanyId()).or().in(PjProductLaunch::getSourceCompanyId, pjOrder.getSalesCompanyId()))
 						.eq(PjProductLaunch::getGoodsId, e.getGoodsId());
-					List<PjProductLaunch> launchList = productLaunchMapper.selectList(queryWrapper);
+					List<PjProductLaunch> launchList = productLaunchService.list(queryWrapper);
 					if (ObjectUtil.isNotEmpty(launchList)) {
 						launchList.forEach(productLaunch -> {
 							productLaunch.setInventory(productLaunch.getInventory().subtract(e.getGoodsNum()));
 							productLaunch.setVersion(productLaunch.getVersion());
-							int count = productLaunchMapper.updateById(productLaunch);
-							if (count == 0) {
-								throw new RuntimeException(productLaunch.getCname() + "该产品上架库存正在操作,请稍后刷新在进行操作!");
+							R res = productLaunchService.updateByIdNew(productLaunch);
+							if (!res.isSuccess()) {
+								throw new RuntimeException(res.getMsg());
 							}
 						});
 					}
@@ -664,14 +673,14 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 						.eq(PjProductLaunch::getIsDeleted, 0)
 						.and(i -> i.eq(PjProductLaunch::getSalesCompanyId, pjOrder.getSalesCompanyId()).or().in(PjProductLaunch::getSourceCompanyId, pjOrder.getSalesCompanyId()))
 						.eq(PjProductLaunch::getGoodsId, e.getGoodsId());
-					List<PjProductLaunch> launchList = productLaunchMapper.selectList(queryWrapper);
+					List<PjProductLaunch> launchList = productLaunchService.list(queryWrapper);
 					if (ObjectUtil.isNotEmpty(launchList)) {
 						launchList.forEach(productLaunch -> {
 							productLaunch.setInventory(productLaunch.getInventory().add(e.getGoodsNum()));
 							productLaunch.setVersion(productLaunch.getVersion());
-							int count = productLaunchMapper.updateById(productLaunch);
-							if (count == 0) {
-								throw new RuntimeException(productLaunch.getCname() + "该产品上架库存正在操作,请稍后刷新在进行操作!");
+							R res = productLaunchService.updateByIdNew(productLaunch);
+							if (!res.isSuccess()) {
+								throw new RuntimeException(res.getMsg());
 							}
 						});
 					}
@@ -1008,16 +1017,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 
 						/** ----------------------修改上架库存---------------------- */
 						//查询所有该商品的库存
-						LambdaQueryWrapper<PjStockDesc> lambdaQueryWrapperList = new LambdaQueryWrapper<>();
+						/*LambdaQueryWrapper<PjStockDesc> lambdaQueryWrapperList = new LambdaQueryWrapper<>();
 						lambdaQueryWrapperList.eq(PjStockDesc::getTenantId, AuthUtil.getTenantId())
 							.eq(PjStockDesc::getIsDeleted, 0)
 							.eq(PjStockDesc::getSalesCompanyId, order.getSalesCompanyId())
 							.eq(PjStockDesc::getGoodsId, goodsDesc.getId());
-						List<PjStockDesc> stockDescList = stockDescMapper.selectList(lambdaQueryWrapperList);
+						List<PjStockDesc> stockDescList = stockDescService.list(lambdaQueryWrapperList);
 
 						//库存总数量
 						BigDecimal balanceQuantity = stockDescList.stream().map(PjStockDesc::getBalanceQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
-
+*/
 						//查询所有上架商品
 						LambdaQueryWrapper<PjProductLaunch> productLaunchQueryWrapper = new LambdaQueryWrapper<>();
 						productLaunchQueryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
@@ -1025,12 +1034,15 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, PjOrder> implemen
 							.eq(PjProductLaunch::getSalesCompanyId, order.getSalesCompanyId())
 							.and(i -> i.eq(PjProductLaunch::getSalesCompanyId, order.getSalesCompanyId()).or().in(PjProductLaunch::getSourceCompanyId, order.getSalesCompanyId()))
 							.eq(PjProductLaunch::getGoodsId, goodsDesc.getId());
-						List<PjProductLaunch> productLaunch = productLaunchMapper.selectList(productLaunchQueryWrapper);
+						List<PjProductLaunch> productLaunch = productLaunchService.list(productLaunchQueryWrapper);
 						//修改上架数量
 						if (ObjectUtil.isNotEmpty(productLaunch)) {
 							productLaunch.forEach(e -> {
 								e.setInventory(e.getInventory().add(item.getGoodsNum()));
-								productLaunchMapper.updateById(e);
+								R res = productLaunchService.updateByIdNew(e);
+								if (!res.isSuccess()) {
+									throw new RuntimeException(res.getMsg());
+								}
 							});
 						}
 

+ 4 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/service/IProductLaunchService.java

@@ -102,4 +102,8 @@ public interface IProductLaunchService extends IService<PjProductLaunch> {
 
 
 	R productLaunch(List<PjProductLaunch> list);
+
+    R updateByIdNew(PjProductLaunch productLaunch);
+
+    R updateBatchById(List<PjProductLaunch> productLaunch);
 }

+ 30 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/service/impl/ProductLaunchServiceImpl.java

@@ -39,6 +39,7 @@ import org.springblade.salesPart.productLaunch.service.IProductLaunchService;
 import org.springblade.salesPart.shoppingCart.mapper.ShoppingCartMapper;
 import org.springblade.salesPart.stock.service.IStockDescService;
 import org.springblade.salesPart.vo.ProductLaunchVO;
+import org.springblade.stock.entity.StockGoods;
 import org.springblade.system.entity.Dept;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.beans.BeanUtils;
@@ -779,4 +780,33 @@ public class ProductLaunchServiceImpl extends ServiceImpl<ProductLaunchMapper, P
 		return R.success("ok");
 	}
 
+	@Override
+	public R updateByIdNew(PjProductLaunch productLaunch) {
+		int version = baseMapper.selectById(productLaunch.getId()).getVersion();
+		int count = baseMapper.update(productLaunch, new LambdaQueryWrapper<PjProductLaunch>()
+			.eq(PjProductLaunch::getId, productLaunch.getId())
+			.eq(PjProductLaunch::getVersion, version)
+			.setEntity(new PjProductLaunch()));
+		if (count == 0) {
+			return R.fail(productLaunch.getCname() + "正在更新库存,请稍后再试");
+		} else {
+			PjProductLaunch productLaunch1 = new PjProductLaunch();
+			productLaunch1.setId(productLaunch.getId());
+			productLaunch1.setVersion(version + 1);
+			baseMapper.updateById(productLaunch1);
+			return R.success("操作成功");
+		}
+	}
+
+	@Override
+	public R updateBatchById(List<PjProductLaunch> productLaunch) {
+		for (PjProductLaunch item : productLaunch) {
+			R status = this.updateByIdNew(item);
+			if (!status.isSuccess()) {
+				return R.fail(item.getCname() + "系统正忙,请稍后再试");
+			}
+		}
+		return R.success("操作成功");
+	}
+
 }

+ 1 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/controller/ShipController.java

@@ -370,6 +370,7 @@ public class ShipController extends BladeController {
 	@ApiOperationSupport(order = 3)
 	@ApiOperation(value = "分页", notes = "传入order")
 	public R<List<PjShipStockDetails>> stockDataDetails(PjShipStockDetails pjShipStockDetails) {
+		pjShipStockDetails.setSalesCompanyId(AuthUtil.getDeptId());
 		List<PjShipStockDetails> pages = shipService.stockDataDetails(pjShipStockDetails);
 		return R.data(pages);
 	}

+ 3 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/mapper/ShipMapper.xml

@@ -84,6 +84,9 @@
         <if test="order.goodsId!=null">
             and psi.goods_id = #{order.goodsId}
         </if>
+        <if test="order.salesCompanyId!=null and order.salesCompanyId!=''">
+            and psi.sales_company_id = #{order.salesCompanyId}
+        </if>
         <if test="order.corpName!=null and order.corpName!=''">
             and ps.customer_name = #{order.corpName}
         </if>

+ 26 - 20
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/service/impl/ShipServiceImpl.java

@@ -390,8 +390,8 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				.eq(PjShip::getTenantId, AuthUtil.getTenantId())
 				.eq(PjShip::getIsDeleted, 0)
 				.eq(PjShip::getTaskId, id)
-				.and(i-> i.eq(PjShip::getStatusName, OrderTypeEnum.TOBESHIPPEDOUT.getType())
-				.or().eq(PjShip::getStatusName, OrderTypeEnum.TREATWAREHOUSING.getType())));
+				.and(i -> i.eq(PjShip::getStatusName, OrderTypeEnum.TOBESHIPPEDOUT.getType())
+					.or().eq(PjShip::getStatusName, OrderTypeEnum.TREATWAREHOUSING.getType())));
 			if (ObjectUtil.isEmpty(pjShipList)) {
 				throw new RuntimeException("数据异常 请联系管理员");
 			}
@@ -500,9 +500,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					stockOne.setStoreInventory(stockOne.getBalanceQuantity());
 					stockOne.setInventoryAmount(stockOne.getInventoryAmount().subtract(item.getSendNum().multiply(stockOne.getInventoryCostPrice())));
 					stockOne.setVersion(stockOne.getVersion());
-					boolean count = iStockDescService.updateById(stockOne);
-					if (!count) {
-						throw new RuntimeException(stockOne.getCname() + "该产品库存正在操作,请稍后刷新在进行操作!");
+					R res = iStockDescService.updateByIdNew(stockOne);
+					if (!res.isSuccess()) {
+						throw new RuntimeException(res.getMsg());
 					}
 					pjStockDescArrayList.add(stockOne);
 				} else {
@@ -511,7 +511,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			}
 			shipItemsService.saveOrUpdateBatch(shipItemsList);
 			orderItemsService.updateBatchById(pjOrderItemsList);
-//			iStockDescService.updateBatchById(pjStockDescArrayList);
 			ship.setShipItemsList(ship.getShipItemsList());
 			ship.setNumberRows(ship.getShipItemsList().size());
 			//修改任务发货数量
@@ -610,9 +609,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 					stockOne.setInventoryAmount(stockOne.getInventoryAmount().add(item.getSendNum().multiply(stockOne.getInventoryCostPrice())));
 					stockOne.setVersion(stockOne.getVersion());
 					pjStockDescArrayList.add(stockOne);
-					boolean count = iStockDescService.updateById(stockOne);
-					if (!count) {
-						throw new RuntimeException(stockOne.getCname() + "该产品库存正在操作,请稍后刷新在进行操作!");
+					R res = iStockDescService.updateByIdNew(stockOne);
+					if (!res.isSuccess()) {
+						throw new RuntimeException(res.getMsg());
 					}
 				} else {
 					throw new RuntimeException("未查到库存账");
@@ -621,7 +620,6 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			}
 			shipItemsService.updateBatchById(itemsList);
 			orderItemsService.updateBatchById(pjOrderItemsList);
-//			iStockDescService.updateBatchById(pjStockDescArrayList);
 			ship.setShipItemsList(ship.getShipItemsList());
 			ship.setNumberRows(ship.getShipItemsList().size());
 
@@ -965,8 +963,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 				/** ----------------------修改上架库存---------------------- */
 			}
-			;
-			productLaunchService.updateBatchById(pjProductLaunchList);
+			R res = productLaunchService.updateBatchById(pjProductLaunchList);
+			if (!res.isSuccess()) {
+				throw new RuntimeException(res.getMsg());
+			}
 			ship.setShipItemsList(ship.getShipItemsList());
 			ship.setNumberRows(ship.getShipItemsList().size());
 		}
@@ -1202,7 +1202,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 			});
 			shipItemsService.saveOrUpdateBatch(shipItemsList);
 			iStockDescService.saveOrUpdateBatch(pjStockDescArrayList);
-			productLaunchService.updateBatchById(pjProductLaunchList);
+			R res = productLaunchService.updateBatchById(pjProductLaunchList);
+			if (!res.isSuccess()) {
+				throw new RuntimeException(res.getMsg());
+			}
 			ship.setShipItemsList(ship.getShipItemsList());
 			ship.setNumberRows(ship.getShipItemsList().size());
 		}
@@ -1248,6 +1251,9 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 
 				PjStockDesc stockOne = iStockDescService.getOne(lambdaQueryWrapper);
 				if (ObjectUtils.isNotNull(stockOne)) {
+					if (stockOne.getBalanceQuantity().compareTo(item.getSendNum()) < 0) {
+						throw new RuntimeException(goodsDesc.getCname() + "库存不足,禁止撤销");
+					}
 					stockOne.setUpdateTime(new Date());
 					stockOne.setUpdateUser(AuthUtil.getUserId());
 					stockOne.setBalanceQuantity(stockOne.getBalanceQuantity().subtract(item.getSendNum()));
@@ -1259,16 +1265,13 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 						stockOne.setInventoryCostPrice(stockOne.getInventoryAmount().divide(stockOne.getBalanceQuantity(), MathContext.DECIMAL32).setScale(2, RoundingMode.HALF_UP));
 					}
 					stockOne.setVersion(stockOne.getVersion());
-//					iStockDescService.updateById(stockOne);
-					boolean count = iStockDescService.updateById(stockOne);
-					if (!count) {
-						throw new RuntimeException(stockOne.getCname() + "该产品库存正在操作,请稍后刷新在进行操作!");
+					R res = iStockDescService.updateByIdNew(stockOne);
+					if (!res.isSuccess()) {
+						throw new RuntimeException(res.getMsg());
 					}
 					pjStockDescArrayList.add(stockOne);
 				}
 			}
-			;
-//			iStockDescService.updateBatchById(pjStockDescArrayList);
 			List<PjProductLaunch> pjProductLaunchList = new ArrayList<>();
 			List<PjOrderItems> pjOrderItemsList = new ArrayList<>();
 			ship.getShipItemsList().forEach(item -> {
@@ -1310,7 +1313,10 @@ public class ShipServiceImpl extends ServiceImpl<ShipMapper, PjShip> implements
 				/** ----------------------修改上架库存---------------------- */
 			});
 			orderItemsService.updateBatchById(pjOrderItemsList);
-			productLaunchService.updateBatchById(pjProductLaunchList);
+			R res = productLaunchService.updateBatchById(pjProductLaunchList);
+			if (!res.isSuccess()) {
+				throw new RuntimeException(res.getMsg());
+			}
 			ship.setShipItemsList(ship.getShipItemsList());
 			ship.setNumberRows(ship.getShipItemsList().size());
 		}

+ 3 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/stock/service/IStockDescService.java

@@ -17,6 +17,7 @@
 package org.springblade.salesPart.stock.service;
 
 import org.springblade.core.tool.api.R;
+import org.springblade.salesPart.entity.PjProductLaunch;
 import org.springblade.salesPart.entity.PjStockDesc;
 import org.springblade.salesPart.vo.StockDescVO;
 import com.baomidou.mybatisplus.extension.service.IService;
@@ -51,4 +52,6 @@ public interface IStockDescService extends IService<PjStockDesc> {
 	 */
 	R submitProductLaunch(PjStockDesc stockDesc);
 
+	R updateByIdNew(PjStockDesc stockDesc);
+
 }

+ 19 - 0
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/stock/service/impl/StockDescServiceImpl.java

@@ -16,6 +16,7 @@
  */
 package org.springblade.salesPart.stock.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.AllArgsConstructor;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
@@ -100,4 +101,22 @@ public class StockDescServiceImpl extends ServiceImpl<StockDescMapper, PjStockDe
 		return R.success("操作成功");
 	}
 
+	@Override
+	public R updateByIdNew(PjStockDesc stockDesc) {
+		int version = baseMapper.selectById(stockDesc.getId()).getVersion();
+		int count = baseMapper.update(stockDesc, new LambdaQueryWrapper<PjStockDesc>()
+			.eq(PjStockDesc::getId, stockDesc.getId())
+			.eq(PjStockDesc::getVersion, version)
+			.setEntity(new PjStockDesc()));
+		if (count == 0) {
+			return R.fail(stockDesc.getCname() + "正在更新库存,请稍后再试");
+		} else {
+			PjStockDesc stockDesc1 = new PjStockDesc();
+			stockDesc1.setId(stockDesc.getId());
+			stockDesc1.setVersion(version + 1);
+			baseMapper.updateById(stockDesc1);
+			return R.success("操作成功");
+		}
+	}
+
 }

+ 9 - 3
blade-service/blade-stock/src/main/java/org/springblade/stock/config/MyBatisPlusConfig.java

@@ -1,3 +1,4 @@
+/*
 package org.springblade.stock.config;
 
 import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
@@ -14,15 +15,18 @@ import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.core.annotation.AnnotationAwareOrderComparator;
 
+*/
 /**
  * @author :jixinyuan
  * @date : 2023/7/4
- */
+ *//*
+
 @Configuration
 public class MyBatisPlusConfig extends MybatisPlusConfiguration {
 
 
-	/*@Bean
+	*/
+/*@Bean
 	@ConditionalOnMissingBean({MybatisPlusInterceptor.class})
 	public MybatisPlusInterceptor MybatisPlusInterceptor() {
 		MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
@@ -31,7 +35,8 @@ public class MyBatisPlusConfig extends MybatisPlusConfiguration {
 		mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));//自动分页插件
 		mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());//防止全表更新或删除
 		return mybatisPlusInterceptor;
-	}*/
+	}*//*
+
 
 	@Bean
 	public MybatisPlusProperties mybatisPlusProperties() {
@@ -60,3 +65,4 @@ public class MyBatisPlusConfig extends MybatisPlusConfiguration {
 		return interceptor;
 	}
 }
+*/