Ver código fonte

2024年4月3日19:06:10

纪新园 1 ano atrás
pai
commit
bed19645ec
12 arquivos alterados com 533 adições e 534 exclusões
  1. 3 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/CorpsDescExportExcel.java
  2. 9 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/CorpsDescImportExcel.java
  3. 33 0
      blade-service-api/blade-sales-part-api/src/main/java/org/springblade/salesPart/excel/CorpsImportBrandExcel.java
  4. 84 452
      blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/TemplateImportServiceImpl.java
  5. 12 6
      blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml
  6. 48 3
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/brand/controller/BrandDescController.java
  7. 24 7
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsDescController.java
  8. 2 5
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/mapper/CorpsDescMapper.xml
  9. 3 0
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/ICorpsDescService.java
  10. 232 27
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/service/impl/CorpsDescServiceImpl.java
  11. 75 26
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/controller/ProductLaunchController.java
  12. 8 8
      blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/ship/controller/ShipController.java

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

@@ -33,6 +33,9 @@ public class CorpsDescExportExcel implements Serializable {
 	@ExcelProperty(value = "发货仓库")
 	private String deliveryWarehouseName;
 
+	@ExcelProperty(value = "品牌")
+	private String brandName;
+
 	/**
 	 * 商城价格
 	 */

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

@@ -46,6 +46,9 @@ public class CorpsDescImportExcel implements Serializable {
 	@ExcelProperty(value = "业务员(必填)")
 	private String salesmanName;
 
+	@ExcelProperty(value = "品牌(必填,多个品牌用英文逗号‘,’拼接)")
+	private String brandName;
+
 	/**
 	 * 电话
 	 */
@@ -53,6 +56,12 @@ public class CorpsDescImportExcel implements Serializable {
 	private String tel;
 
 	/**
+	 * 地址
+	 */
+	@ExcelProperty(value = "地址")
+	private String address;
+
+	/**
 	 * 账期
 	 */
 	@ExcelProperty(value = "账期")

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

@@ -0,0 +1,33 @@
+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 lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * 客户导入模板实体类
+ */
+@Data
+@ColumnWidth(25)
+@HeadRowHeight(20)
+@ContentRowHeight(18)
+public class CorpsImportBrandExcel implements Serializable {
+
+	/**
+	 * 客户名称
+	 */
+	@ExcelProperty(value = "客户名称(必填)")
+	private String cname;
+
+	/**
+	 * 品牌
+	 */
+	@ExcelProperty(value = "品牌(必填,多个品牌用英文逗号‘,’拼接)")
+	private String brandName;
+
+
+}

+ 84 - 452
blade-service/blade-los/src/main/java/org/springblade/los/business/sea/service/impl/TemplateImportServiceImpl.java

@@ -3,8 +3,10 @@ package org.springblade.los.business.sea.service.impl;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import lombok.AllArgsConstructor;
 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
+import org.apache.poi.ss.usermodel.Row;
 import org.apache.poi.ss.usermodel.Sheet;
 import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springblade.core.tool.api.R;
 import org.springblade.los.business.sea.entity.Bills;
 import org.springblade.los.business.sea.entity.Containers;
@@ -17,6 +19,7 @@ import java.math.BigDecimal;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -156,13 +159,13 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 			throw new RuntimeException("签单方式不能为空");
 		}
 		//PAYMODE
-		if (ObjectUtils.isNotNull(sheet.getRow(21).getCell(4))) {
+		/*if (ObjectUtils.isNotNull(sheet.getRow(21).getCell(4))) {
 			String payMode = sheet.getRow(21).getCell(4).getStringCellValue();
 			System.out.println("payMode:" + payMode);
 			bills.setHpaymode(payMode);
 		} else {
 			throw new RuntimeException("运费支付方式不能为空");
-		}
+		}*/
 		//PLACE OF ISSUE
 		if (ObjectUtils.isNotNull(sheet.getRow(22).getCell(1))) {
 			String placeOfIssue = sheet.getRow(22).getCell(1).getStringCellValue();
@@ -180,21 +183,21 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 			throw new RuntimeException("付费地不能为空");
 		}
 		//CONTRACTNO
-		if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(1))) {
+		/*if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(1))) {
 			String contractno = sheet.getRow(23).getCell(1).getStringCellValue();
 			System.out.println("contractno:" + contractno);
 			bills.setCorpArgreementNo(contractno);
 		} else {
 			throw new RuntimeException("约号不能为空");
-		}
+		}*/
 		//VOLUME
-		if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(4))) {
+		/*if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(4))) {
 			String volume = sheet.getRow(23).getCell(4).getStringCellValue();
 			System.out.println("volume:" + volume);
 			bills.setQuantityCntrDescr(volume);
 		} else {
 			throw new RuntimeException("箱型箱量不能为空");
-		}
+		}*/
 		//MARKS
 		StringBuilder marks = new StringBuilder();
 		for (int i = 25; i <= 46; i++) {
@@ -364,55 +367,6 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 		} else {
 			throw new RuntimeException("通知人不能为空");
 		}
-		//VSL/VOY
-		if (ObjectUtils.isNotNull(sheet.getRow(24).getCell(0))) {
-			String vslVoy = sheet.getRow(24).getCell(0).getStringCellValue();
-			if (vslVoy.contains("/")) {
-				String vsl = vslVoy.substring(0, vslVoy.indexOf("/"));
-				String voy = vslVoy.substring(vslVoy.indexOf("/"));
-				bills.setVesselEnName(vsl);
-				bills.setVoyageNo(voy);
-				System.out.println("vsl:" + vsl);
-				System.out.println("voy:" + voy);
-				System.out.println("vslVoy:" + vslVoy);
-			} else {
-				throw new RuntimeException("船名或船期不能为空");
-			}
-		} else {
-			throw new RuntimeException("船名或船期不能为空");
-		}
-		//POL
-		if (ObjectUtils.isNotNull(sheet.getRow(24).getCell(3))) {
-			String pol = sheet.getRow(24).getCell(3).getStringCellValue();
-			System.out.println("pol:" + pol);
-			bills.setPolEnName(pol);
-		} else {
-			throw new RuntimeException("装货港不能为空");
-		}
-		//POD
-		if (ObjectUtils.isNotNull(sheet.getRow(24).getCell(5))) {
-			String pod = sheet.getRow(24).getCell(5).getStringCellValue();
-			System.out.println("pod:" + pod);
-			bills.setPodEnName(pod);
-		} else {
-			throw new RuntimeException("卸货港不能为空");
-		}
-		//POR
-		if (ObjectUtils.isNotNull(sheet.getRow(26).getCell(0))) {
-			String por = sheet.getRow(26).getCell(0).getStringCellValue();
-			System.out.println("por:" + por);
-			bills.setPlaceReceiptName(por);
-		} else {
-			throw new RuntimeException("收货港不能为空");
-		}
-		//PLACE OF DELIVERY
-		if (ObjectUtils.isNotNull(sheet.getRow(26).getCell(3))) {
-			String placeOfDelivery = sheet.getRow(26).getCell(3).getStringCellValue();
-			System.out.println("placeOfDelivery:" + placeOfDelivery);
-			bills.setDestinationName(placeOfDelivery);
-		} else {
-			throw new RuntimeException("交货地不能为空");
-		}
 		//B/L NO
 		if (ObjectUtils.isNotNull(sheet.getRow(26).getCell(5))) {
 			String blno = sheet.getRow(26).getCell(5).getStringCellValue();
@@ -421,183 +375,46 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 		} else {
 			throw new RuntimeException("提单号不能为空");
 		}
-		//KIND OF B/L
-		if (ObjectUtils.isNotNull(sheet.getRow(21).getCell(1))) {
-			String kindOfBl = sheet.getRow(21).getCell(1).getStringCellValue();
-			System.out.println("kindOfBl:" + kindOfBl);
-			bills.setIssueType(kindOfBl);
-		} else {
-			throw new RuntimeException("签单方式不能为空");
-		}
-		//PAYMODE
-		if (ObjectUtils.isNotNull(sheet.getRow(21).getCell(4))) {
-			String payMode = sheet.getRow(21).getCell(4).getStringCellValue();
-			System.out.println("payMode:" + payMode);
-			bills.setHpaymode(payMode);
-		} else {
-			throw new RuntimeException("运费支付方式不能为空");
-		}
-		//PLACE OF ISSUE
-		if (ObjectUtils.isNotNull(sheet.getRow(22).getCell(1))) {
-			String placeOfIssue = sheet.getRow(22).getCell(1).getStringCellValue();
-			System.out.println("placeOfIssue:" + placeOfIssue);
-			bills.setIssueAt(placeOfIssue);
-		} else {
-			throw new RuntimeException("签单地不能为空");
-		}
-		//FREIGHT PAYABLE AT
-		if (ObjectUtils.isNotNull(sheet.getRow(22).getCell(4))) {
-			String freightPayAbleAt = sheet.getRow(22).getCell(4).getStringCellValue();
-			System.out.println("freightPayAbleAt:" + freightPayAbleAt);
-			bills.setHpayplace(freightPayAbleAt);
-		} else {
-			throw new RuntimeException("付费地不能为空");
-		}
-		//CONTRACTNO
-		if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(1))) {
-			String contractno = sheet.getRow(23).getCell(1).getStringCellValue();
-			System.out.println("contractno:" + contractno);
-			bills.setCorpArgreementNo(contractno);
-		} else {
-			throw new RuntimeException("约号不能为空");
-		}
-		//VOLUME
-		if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(4))) {
-			String volume = sheet.getRow(23).getCell(4).getStringCellValue();
-			System.out.println("volume:" + volume);
-			bills.setQuantityCntrDescr(volume);
-		} else {
-			throw new RuntimeException("箱型箱量不能为空");
-		}
 		//MARKS
-		StringBuilder marks = new StringBuilder();
-		for (int i = 25; i <= 46; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(0))) {
-				marks.append(sheet.getRow(i).getCell(0).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(marks)) {
-			System.out.println("marks:" + marks);
-			bills.setMarks(marks.toString());
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(0))) {
+			String marks = sheet.getRow(28).getCell(0).getStringCellValue();
+			System.out.println("blno:" + marks);
+			bills.setMarks(marks);
 		} else {
 			throw new RuntimeException("唛头不能为空");
 		}
 		//BAGS
-		if (ObjectUtils.isNotNull(sheet.getRow(25).getCell(1))) {
-			double bags = sheet.getRow(25).getCell(1).getNumericCellValue();
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(2))) {
+			double bags = sheet.getRow(28).getCell(2).getNumericCellValue();
 			System.out.println("bags:" + bags);
 			bills.setQuantity(new BigDecimal(bags));
 		} else {
 			throw new RuntimeException("件数不能为空");
 		}
 		//DESCRIPTION
-		StringBuilder description = new StringBuilder();
-		for (int i = 25; i <= 46; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(2))) {
-				description.append(sheet.getRow(i).getCell(2).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(description)) {
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(3))) {
+			String description = sheet.getRow(28).getCell(3).getStringCellValue();
 			System.out.println("description:" + description);
-			bills.setCommodityDescr(description.toString());
+			bills.setCommodityDescr(description);
 		} else {
-			throw new RuntimeException("提单上货物描述不能为空");
+			throw new RuntimeException("件数不能为空");
 		}
 		//G.W.
-		if (ObjectUtils.isNotNull(sheet.getRow(25).getCell(4))) {
-			double gw = sheet.getRow(25).getCell(4).getNumericCellValue();
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(6))) {
+			double gw = sheet.getRow(28).getCell(6).getNumericCellValue();
 			System.out.println("gw:" + gw);
 			bills.setGrossWeight(new BigDecimal(gw));
 		} else {
 			throw new RuntimeException("毛重不能为空");
 		}
 		//MEAS
-		if (ObjectUtils.isNotNull(sheet.getRow(25).getCell(6))) {
-			double meas = sheet.getRow(25).getCell(6).getNumericCellValue();
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(7))) {
+			double meas = sheet.getRow(28).getCell(7).getNumericCellValue();
 			System.out.println("meas:" + meas);
 			bills.setMeasurement(new BigDecimal(meas));
 		} else {
 			throw new RuntimeException("体积不能为空");
 		}
-		//REMARK
-		StringBuilder remark = new StringBuilder();
-		for (int i = 47; i <= 50; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(1))) {
-				remark.append(sheet.getRow(i).getCell(1).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(remark)) {
-			System.out.println("remark:" + remark);
-			bills.setRemarks(remark.toString());
-		}
-		//FINAL DESTINATION FOR THE MERCHANT’S REFERENCE
-		if (ObjectUtils.isNotNull(sheet.getRow(51).getCell(4))) {
-			String finalDestination = sheet.getRow(51).getCell(4).getStringCellValue();
-			System.out.println("finalDestination:" + finalDestination);
-			bills.setFinalDestinationName(finalDestination);
-		}
-
-		/*for (int i = 0; i <= sheet.getLastRowNum(); i++) {
-			String rowStr = "";
-			//循环获取sheet页的每一行
-			Row row = sheet.getRow(i);
-			//循环每一行的每一个单元格
-			for (int l = 0; l <= 6; l++) {
-				//判断是否是合并单元格并返回值
-				String value = getValue(sheet, i, row.getCell(l).getColumnIndex());
-				//数值为空说明不是合并单元格或者当前单元格为空,则直接获取当前单元格值
-				if ("".equals(value)) {
-					if (ObjectUtils.isNull(row.getCell(l))) {
-						value = "";
-					} else {
-						CellType cellType = row.getCell(l).getCellTypeEnum();
-						switch (cellType.name()) {
-							case "STRING":
-								value = row.getCell(l).getStringCellValue();
-								// 处理字符串类型的值
-								break;
-							case "NUMERIC":
-								value = row.getCell(l).getNumericCellValue() + "";
-								// 处理数字类型的值
-								break;
-							case "FORMULA":
-								value = row.getCell(l).getNumericCellValue() + "";
-								// 处理数字类型的值
-								break;
-							case "_NONE":
-								value = "";
-								// 处理数字类型的值
-								break;
-							case "BLANK":
-								value = "";
-								// 处理数字类型的值
-								break;
-							case "BOOLEAN":
-								value = "";
-								// 处理数字类型的值
-								break;
-							case "ERROR":
-								value = "";
-								// 处理数字类型的值
-								break;
-							// 可以添加其他类型的处理
-							default:
-								System.out.println("cellType:" + cellType.name());
-								throw new RuntimeException("数据类型错误");
-						}
-					}
-				}
-				rowStr += "--" + value;
-			}
-			for (Cell cell : row) {
-				//判断是否是合并单元格并返回值
-				String value = getValue(sheet, i, cell.getColumnIndex());
-				//数值为空说明不是合并单元格或者当前单元格为空,则直接获取当前单元格值
-				if("".equals(value)){
-					value=cell.getStringCellValue();
-				}
-				rowStr+="--"+value;
-			}*/
 		return R.data(bills);
 	}
 
@@ -614,294 +431,109 @@ public class TemplateImportServiceImpl implements ITemplateImportService {
 		Workbook workbook = new HSSFWorkbook(fis);
 		Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
 
-		//TO
-		if (ObjectUtils.isNotNull(sheet.getRow(1).getCell(1))) {
-			String to = sheet.getRow(1).getCell(1).getStringCellValue();
-			System.out.println("TO:" + to);
-		}
-		//ATTN
-		if (ObjectUtils.isNotNull(sheet.getRow(2).getCell(1))) {
-			String attn = sheet.getRow(2).getCell(1).getStringCellValue();
-			System.out.println("attn:" + attn);
-		}
 		//SHIPPER
-		StringBuilder shipper = new StringBuilder();
-		for (int i = 3; i <= 7; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(1))) {
-				shipper.append(sheet.getRow(i).getCell(1).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(shipper)) {
-			bills.setHshipperDetails(shipper.toString());
+		if (ObjectUtils.isNotNull(sheet.getRow(2).getCell(0))) {
+			String shipper = sheet.getRow(2).getCell(0).getStringCellValue();
+			bills.setHshipperDetails(shipper);
 			System.out.println("shipper:" + shipper);
 		} else {
-			throw new RuntimeException("发货人提单描述不能为空");
+			throw new RuntimeException("托运人不能为空");
 		}
 		//CONSIGNEE
-		StringBuilder consignee = new StringBuilder();
-		for (int i = 8; i <= 12; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(1))) {
-				consignee.append(sheet.getRow(i).getCell(1).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(consignee)) {
-			bills.setHconsigneeDetails(consignee.toString());
+		if (ObjectUtils.isNotNull(sheet.getRow(9).getCell(0))) {
+			String consignee = sheet.getRow(9).getCell(0).getStringCellValue();
+			bills.setHconsigneeDetails(consignee);
 			System.out.println("consignee:" + consignee);
 		} else {
-			throw new RuntimeException("收货人提单描述不能为空");
+			throw new RuntimeException("收货人不能为空");
 		}
 		//NOTIFY PARTY
-		StringBuilder notifyParty = new StringBuilder();
-		for (int i = 13; i <= 17; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(1))) {
-				notifyParty.append(sheet.getRow(i).getCell(1).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(notifyParty)) {
-			bills.setHnotifyDetails(notifyParty.toString());
+		if (ObjectUtils.isNotNull(sheet.getRow(16).getCell(0))) {
+			String notifyParty = sheet.getRow(16).getCell(0).getStringCellValue();
+			bills.setHnotifyDetails(notifyParty);
 			System.out.println("notifyParty:" + notifyParty);
 		} else {
-			throw new RuntimeException("通知人提单描述不能为空");
-		}
-		//B/L NO
-		if (ObjectUtils.isNotNull(sheet.getRow(18).getCell(1))) {
-			String blno = sheet.getRow(18).getCell(1).getStringCellValue();
-			System.out.println("blno:" + blno);
-			bills.setMblno(blno);
-		} else {
-			throw new RuntimeException("提单号不能为空");
-		}
-		//VSL/VOY
-		if (ObjectUtils.isNotNull(sheet.getRow(18).getCell(4))) {
-			String vslVoy = sheet.getRow(18).getCell(4).getStringCellValue();
-			if (vslVoy.contains("/")) {
-				String vsl = vslVoy.substring(0, vslVoy.indexOf("/"));
-				String voy = vslVoy.substring(vslVoy.indexOf("/"));
-				bills.setVesselEnName(vsl);
-				bills.setVoyageNo(voy);
-				System.out.println("vsl:" + vsl);
-				System.out.println("voy:" + voy);
-				System.out.println("vslVoy:" + vslVoy);
-			} else {
-				throw new RuntimeException("船名航次不能为空");
-			}
-		} else {
-			throw new RuntimeException("船名航次不能为空");
-		}
-		//POR
-		if (ObjectUtils.isNotNull(sheet.getRow(19).getCell(1))) {
-			String por = sheet.getRow(19).getCell(1).getStringCellValue();
-			System.out.println("por:" + por);
-			bills.setPlaceReceiptName(por);
-		} else {
-			throw new RuntimeException("收货港不能为空");
-		}
-		//POL
-		if (ObjectUtils.isNotNull(sheet.getRow(19).getCell(4))) {
-			String pol = sheet.getRow(19).getCell(4).getStringCellValue();
-			System.out.println("pol:" + pol);
-			bills.setPolEnName(pol);
-		} else {
-			throw new RuntimeException("装运港不能为空");
-		}
-		//POD
-		if (ObjectUtils.isNotNull(sheet.getRow(20).getCell(1))) {
-			String pod = sheet.getRow(20).getCell(1).getStringCellValue();
-			System.out.println("pod:" + pod);
-			bills.setPodEnName(pod);
-		} else {
-			throw new RuntimeException("卸货港不能为空");
-		}
-		//PLACE OF DELIVERY
-		if (ObjectUtils.isNotNull(sheet.getRow(20).getCell(4))) {
-			String placeOfDelivery = sheet.getRow(20).getCell(4).getStringCellValue();
-			System.out.println("placeOfDelivery:" + placeOfDelivery);
-			bills.setDestinationName(placeOfDelivery);
-		} else {
-			throw new RuntimeException("目的港不能为空");
-		}
-		//KIND OF B/L
-		if (ObjectUtils.isNotNull(sheet.getRow(21).getCell(1))) {
-			String kindOfBl = sheet.getRow(21).getCell(1).getStringCellValue();
-			System.out.println("kindOfBl:" + kindOfBl);
-			bills.setIssueType(kindOfBl);
-		} else {
-			throw new RuntimeException("签单方式不能为空");
-		}
-		//PAYMODE
-		if (ObjectUtils.isNotNull(sheet.getRow(21).getCell(4))) {
-			String payMode = sheet.getRow(21).getCell(4).getStringCellValue();
-			System.out.println("payMode:" + payMode);
-			bills.setHpaymode(payMode);
-		} else {
-			throw new RuntimeException("运费支付方式不能为空");
-		}
-		//PLACE OF ISSUE
-		if (ObjectUtils.isNotNull(sheet.getRow(22).getCell(1))) {
-			String placeOfIssue = sheet.getRow(22).getCell(1).getStringCellValue();
-			System.out.println("placeOfIssue:" + placeOfIssue);
-			bills.setIssueAt(placeOfIssue);
-		} else {
-			throw new RuntimeException("签单地不能为空");
-		}
-		//FREIGHT PAYABLE AT
-		if (ObjectUtils.isNotNull(sheet.getRow(22).getCell(4))) {
-			String freightPayAbleAt = sheet.getRow(22).getCell(4).getStringCellValue();
-			System.out.println("freightPayAbleAt:" + freightPayAbleAt);
-			bills.setHpayplace(freightPayAbleAt);
-		} else {
-			throw new RuntimeException("付费地不能为空");
-		}
-		//CONTRACTNO
-		if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(1))) {
-			String contractno = sheet.getRow(23).getCell(1).getStringCellValue();
-			System.out.println("contractno:" + contractno);
-			bills.setCorpArgreementNo(contractno);
-		} else {
-			throw new RuntimeException("约号不能为空");
-		}
-		//VOLUME
-		if (ObjectUtils.isNotNull(sheet.getRow(23).getCell(4))) {
-			String volume = sheet.getRow(23).getCell(4).getStringCellValue();
-			System.out.println("volume:" + volume);
-			bills.setQuantityCntrDescr(volume);
-		} else {
-			throw new RuntimeException("箱型箱量不能为空");
+			throw new RuntimeException("通知人不能为空");
 		}
 		//MARKS
-		StringBuilder marks = new StringBuilder();
-		for (int i = 25; i <= 46; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(0))) {
-				marks.append(sheet.getRow(i).getCell(0).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(marks)) {
-			System.out.println("marks:" + marks);
-			bills.setMarks(marks.toString());
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(0))) {
+			String marks = sheet.getRow(28).getCell(0).getStringCellValue();
+			System.out.println("blno:" + marks);
+			bills.setMarks(marks);
 		} else {
 			throw new RuntimeException("唛头不能为空");
 		}
 		//BAGS
-		if (ObjectUtils.isNotNull(sheet.getRow(25).getCell(1))) {
-			double bags = sheet.getRow(25).getCell(1).getNumericCellValue();
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(2))) {
+			double bags = sheet.getRow(28).getCell(2).getNumericCellValue();
 			System.out.println("bags:" + bags);
 			bills.setQuantity(new BigDecimal(bags));
 		} else {
 			throw new RuntimeException("件数不能为空");
 		}
 		//DESCRIPTION
-		StringBuilder description = new StringBuilder();
-		for (int i = 25; i <= 46; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(2))) {
-				description.append(sheet.getRow(i).getCell(2).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(description)) {
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(3))) {
+			String description = sheet.getRow(28).getCell(3).getStringCellValue();
 			System.out.println("description:" + description);
-			bills.setCommodityDescr(description.toString());
+			bills.setCommodityDescr(description);
 		} else {
-			throw new RuntimeException("提单上货物描述不能为空");
+			throw new RuntimeException("件数不能为空");
 		}
 		//G.W.
-		if (ObjectUtils.isNotNull(sheet.getRow(25).getCell(4))) {
-			double gw = sheet.getRow(25).getCell(4).getNumericCellValue();
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(6))) {
+			double gw = sheet.getRow(28).getCell(6).getNumericCellValue();
 			System.out.println("gw:" + gw);
 			bills.setGrossWeight(new BigDecimal(gw));
 		} else {
 			throw new RuntimeException("毛重不能为空");
 		}
 		//MEAS
-		if (ObjectUtils.isNotNull(sheet.getRow(25).getCell(6))) {
-			double meas = sheet.getRow(25).getCell(6).getNumericCellValue();
+		if (ObjectUtils.isNotNull(sheet.getRow(28).getCell(7))) {
+			double meas = sheet.getRow(28).getCell(7).getNumericCellValue();
 			System.out.println("meas:" + meas);
 			bills.setMeasurement(new BigDecimal(meas));
 		} else {
 			throw new RuntimeException("体积不能为空");
 		}
-		//REMARK
-		StringBuilder remark = new StringBuilder();
-		for (int i = 47; i <= 50; i++) {
-			if (ObjectUtils.isNotNull(sheet.getRow(i).getCell(1))) {
-				remark.append(sheet.getRow(i).getCell(1).getStringCellValue());
-			}
-		}
-		if (ObjectUtils.isNotNull(remark)) {
-			System.out.println("remark:" + remark);
-			bills.setRemarks(remark.toString());
-		}
-		//FINAL DESTINATION FOR THE MERCHANT’S REFERENCE
-		if (ObjectUtils.isNotNull(sheet.getRow(51).getCell(4))) {
-			String finalDestination = sheet.getRow(51).getCell(4).getStringCellValue();
-			System.out.println("finalDestination:" + finalDestination);
-			bills.setFinalDestinationName(finalDestination);
-		}
-
-		/*for (int i = 0; i <= sheet.getLastRowNum(); i++) {
-			String rowStr = "";
-			//循环获取sheet页的每一行
-			Row row = sheet.getRow(i);
-			//循环每一行的每一个单元格
-			for (int l = 0; l <= 6; l++) {
-				//判断是否是合并单元格并返回值
-				String value = getValue(sheet, i, row.getCell(l).getColumnIndex());
-				//数值为空说明不是合并单元格或者当前单元格为空,则直接获取当前单元格值
-				if ("".equals(value)) {
-					if (ObjectUtils.isNull(row.getCell(l))) {
-						value = "";
-					} else {
-						CellType cellType = row.getCell(l).getCellTypeEnum();
-						switch (cellType.name()) {
-							case "STRING":
-								value = row.getCell(l).getStringCellValue();
-								// 处理字符串类型的值
-								break;
-							case "NUMERIC":
-								value = row.getCell(l).getNumericCellValue() + "";
-								// 处理数字类型的值
-								break;
-							case "FORMULA":
-								value = row.getCell(l).getNumericCellValue() + "";
-								// 处理数字类型的值
-								break;
-							case "_NONE":
-								value = "";
-								// 处理数字类型的值
-								break;
-							case "BLANK":
-								value = "";
-								// 处理数字类型的值
-								break;
-							case "BOOLEAN":
-								value = "";
-								// 处理数字类型的值
-								break;
-							case "ERROR":
-								value = "";
-								// 处理数字类型的值
-								break;
-							// 可以添加其他类型的处理
-							default:
-								System.out.println("cellType:" + cellType.name());
-								throw new RuntimeException("数据类型错误");
-						}
-					}
-				}
-				rowStr += "--" + value;
-			}
-			for (Cell cell : row) {
-				//判断是否是合并单元格并返回值
-				String value = getValue(sheet, i, cell.getColumnIndex());
-				//数值为空说明不是合并单元格或者当前单元格为空,则直接获取当前单元格值
-				if("".equals(value)){
-					value=cell.getStringCellValue();
-				}
-				rowStr+="--"+value;
-			}*/
 		return R.data(bills);
 	}
 
 	@Override
 	public R<List<Containers>> importHisense(MultipartFile file) throws Exception {
-		return null;
+		List<Containers> containersList = new ArrayList<>();
+
+		// 创建临时文件
+		Path tempFile = Files.createTempFile("prefix", "suffix");
+		// 将MultipartFile的内容复制到临时文件
+		Files.copy(file.getInputStream(), tempFile, StandardCopyOption.REPLACE_EXISTING);
+
+		// 创建FileInputStream来读取临时文件
+		FileInputStream fis = new FileInputStream(tempFile.toFile());
+//		Workbook workbook = new HSSFWorkbook(fis);
+		Workbook workbook = new XSSFWorkbook(fis);
+		Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表
+
+		for (int i = 1; i <= sheet.getLastRowNum(); i++) {
+			Containers containers = new Containers();
+			//循环获取sheet页的每一行
+			Row row = sheet.getRow(i);
+			if (ObjectUtils.isNotNull(row.getCell(1))) {
+				containers.setCntrNo(row.getCell(1).getStringCellValue());
+			}
+			if (ObjectUtils.isNotNull(row.getCell(2))) {
+				containers.setSealNo(row.getCell(2).getStringCellValue());
+			}
+			if (ObjectUtils.isNotNull(row.getCell(3))) {
+				containers.setQuantity(BigDecimal.valueOf(row.getCell(3).getNumericCellValue()));
+			}
+			if (ObjectUtils.isNotNull(row.getCell(4))) {
+				containers.setGrossWeight(BigDecimal.valueOf(row.getCell(4).getNumericCellValue()));
+			}
+			if (ObjectUtils.isNotNull(row.getCell(5))) {
+				containers.setMeasurement(BigDecimal.valueOf(row.getCell(5).getNumericCellValue()));
+			}
+			containersList.add(containers);
+		}
+		return R.data(containersList);
 	}
 }

+ 12 - 6
blade-service/blade-purchase-sales/src/main/java/org/springblade/purchase/sales/mapper/OrderMapper.xml

@@ -1710,8 +1710,9 @@ ORDER BY
     <select id="salesmanProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
         SELECT
             BO.charge_member as chargeMember,
-            SUM( bdf.delivery_amount ) AS amount,
+            SUM( bdf.delivery_amount ) AS arrivalAmount,
             SUM( bdf.actual_quantity ) AS quantity,
+            SUM(BO.debit_amount) AS amount,
             SUM(BOI.purchaseAmount) AS purchaseAmount,
             SUM(BO.this_used_profit) AS thisUsedProfit,
             SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
@@ -1834,8 +1835,9 @@ ORDER BY
     <select id="salesmanProfitExport" resultType="org.springblade.purchase.sales.excel.SalesmanProfitExcel">
         SELECT
         BO.charge_member as chargeMember,
-        SUM( bdf.delivery_amount ) AS amount,
+        SUM( bdf.delivery_amount ) AS arrivalAmount,
         SUM( bdf.actual_quantity ) AS quantity,
+        SUM(BO.debit_amount) AS amount,
         SUM(BOI.purchaseAmount) AS purchaseAmount,
         SUM(BO.this_used_profit) AS thisUsedProfit,
         SUM( BO.debit_amount ) - SUM( BOI.purchaseAmount ) AS grossProfit,
@@ -1903,7 +1905,8 @@ ORDER BY
     <select id="customerProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
         SELECT
             BCD.cname AS corpName,
-            SUM( bdf.delivery_amount ) AS amount,
+            SUM( bdf.delivery_amount ) AS arrivalAmount,
+            SUM( BO.debit_amount ) AS amount,
             SUM( bdf.actual_quantity ) AS quantity,
             SUM( BOI.purchaseAmount ) AS purchaseAmount,
             SUM( BO.this_used_profit ) AS thisUsedProfit,
@@ -2041,7 +2044,8 @@ ORDER BY
     <select id="customerProfitExport" resultType="org.springblade.purchase.sales.excel.CustomerProfitExcel">
         SELECT
         BCD.cname AS corpName,
-        SUM( bdf.delivery_amount ) AS amount,
+        SUM( bdf.delivery_amount ) AS arrivalAmount,
+        SUM( BO.debit_amount ) AS amount,
         SUM( bdf.actual_quantity ) AS quantity,
         SUM( BOI.purchaseAmount ) AS purchaseAmount,
         SUM( BO.this_used_profit ) AS thisUsedProfit,
@@ -2108,7 +2112,8 @@ ORDER BY
     <select id="brandProfit" resultType="org.springblade.purchase.sales.vo.OrderStatisticsVo">
         SELECT
             BGD.brand AS brand,
-            SUM( bdf.delivery_amount ) AS amount,
+            SUM( bdf.delivery_amount ) AS arrivalAmount,
+            SUM( BO.debit_amount ) AS amount,
             SUM( bdf.actual_quantity ) AS quantity,
             SUM( BOI.purchaseAmount ) AS purchaseAmount,
             SUM( BO.this_used_profit ) AS thisUsedProfit,
@@ -2224,7 +2229,8 @@ ORDER BY
     <select id="brandProfitExport" resultType="org.springblade.purchase.sales.excel.BrandProfitExcel">
         SELECT
         BGD.brand AS brand,
-        SUM( bdf.delivery_amount ) AS amount,
+        SUM( bdf.delivery_amount ) AS arrivalAmount,
+        SUM( BO.debit_amount ) AS amount,
         SUM( bdf.actual_quantity ) AS quantity,
         SUM( BOI.purchaseAmount ) AS purchaseAmount,
         SUM( BO.this_used_profit ) AS thisUsedProfit,

+ 48 - 3
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/brand/controller/BrandDescController.java

@@ -36,9 +36,9 @@ import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.salesPart.brand.service.IBrandDescService;
 import org.springblade.salesPart.brand.service.IBrandFilesService;
-import org.springblade.salesPart.entity.PjBrandDesc;
-import org.springblade.salesPart.entity.PjBrandFiles;
-import org.springblade.salesPart.entity.PjGoodsDesc;
+import org.springblade.salesPart.corps.service.ICorpsAttnService;
+import org.springblade.salesPart.corps.service.ICorpsDescService;
+import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.goods.service.IGoodsDescService;
 import org.springblade.salesPart.vo.BrandDescVO;
 import org.springblade.system.user.entity.User;
@@ -64,6 +64,8 @@ public class BrandDescController extends BladeController {
 	private final IUserClient iUserClient;//获取用户信息
 	private final IBrandFilesService brandFilesService;
 	private final IGoodsDescService goodsDescService;
+	private final ICorpsAttnService corpsAttnService;//客户联系人
+	private final ICorpsDescService corpsDescService;//客户
 
 	/**
 	 * 详情
@@ -273,4 +275,47 @@ public class BrandDescController extends BladeController {
 		});
 		return R.data(list);
 	}
+
+	/**
+	 * 品牌下拉
+	 */
+	@GetMapping("/listAllApp")
+	@ApiOperationSupport(order = 10)
+	@ApiOperation(value = "品牌下拉", notes = "传入brandDesc")
+	public R<List<PjBrandDesc>> listAllApp(PjBrandDesc brandDesc) {
+		PjCorpsDesc corpsDesc = null;
+		//根据当前登录人获得客户
+		PjCorpsAttn corpsAttn = corpsAttnService.getAttn(AuthUtil.getUserId());
+		if (ObjectUtil.isNotEmpty(corpsAttn)) {
+			corpsDesc = corpsDescService.getCorpsDesc(corpsAttn.getPid());
+			if (ObjectUtil.isEmpty(corpsDesc)) {
+				throw new RuntimeException("未查到用户信息");
+			}
+		} else {
+			throw new RuntimeException("未查到用户信息");
+		}
+		LambdaQueryWrapper<PjBrandDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
+		lambdaQueryWrapper.eq(PjBrandDesc::getTenantId, AuthUtil.getTenantId())
+			.eq(PjBrandDesc::getIsDeleted, 0)
+			.eq(PjBrandDesc::getType, "PP")
+			.eq(PjBrandDesc::getEnableOrNot, 1)
+			.like(ObjectUtils.isNotEmpty(brandDesc.getCname()), PjBrandDesc::getCname, brandDesc.getCname())
+			.orderByDesc(PjBrandDesc::getSort);
+		if (ObjectUtils.isNotNull(corpsDesc.getBrandId())) {
+			lambdaQueryWrapper.apply("find_in_set(id,'" + corpsDesc.getBrandId() + "')");
+		}
+		if (!AuthUtil.getUserRole().contains("admin") && !AuthUtil.getUserRole().contains("老板")) {
+			lambdaQueryWrapper.eq(PjBrandDesc::getSalesCompanyId, AuthUtil.getDeptId());//公司
+		}
+		List<PjBrandDesc> list = brandDescService.list(lambdaQueryWrapper);
+		if (ObjectUtil.isNotEmpty(list)) {
+			list.forEach(e -> {
+				//获取附件
+				e.setBrandFilesList(brandFilesService.list(new QueryWrapper<PjBrandFiles>().eq("pid", e.getId()).eq("is_deleted", 0)
+					.eq("version", 0)));
+			});
+		}
+		return R.data(list);
+	}
+
 }

+ 24 - 7
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/corps/controller/CorpsDescController.java

@@ -41,6 +41,7 @@ import org.springblade.salesPart.corps.service.*;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.excel.CorpsDescExportExcel;
 import org.springblade.salesPart.excel.CorpsDescImportExcel;
+import org.springblade.salesPart.excel.CorpsImportBrandExcel;
 import org.springblade.salesPart.excel.SupplierImportExcel;
 import org.springblade.salesPart.order.service.IOrderService;
 import org.springblade.salesPart.storage.service.IStorageDescService;
@@ -659,11 +660,27 @@ public class CorpsDescController extends BladeController {
 		return R.data(map);
 	}
 
-}
 
-/**
- * 鸿鹰轮胎235/50ZR19RUBYG-31  103WXL    331   鸿鹰轮胎 235/50ZR19 RUBYG-31 103WXL ****
- * 鸿鹰轮胎245/40R18G31  93Y    289   鸿鹰轮胎 245/40R18 G-31 93Y  ***
- * 鸿鹰轮胎265/65R17G60    460       鸿鹰轮胎 265/65R17 G60   **
- * 鸿鹰轮胎275/35RF19G-31-RFT  593   鸿鹰轮胎 275/35RF19 G-31-RFT   ***
- */
+	/**
+	 * 下载客户模板(品牌)
+	 */
+	@GetMapping("/corpsExportBrand")
+	public void corpsExportBrand(HttpServletResponse response) {
+		List<CorpsImportBrandExcel> list = new ArrayList<>();
+		System.out.println(response);
+		ExcelUtil.export(response, "导入模板-修改客户品牌", "导入数据表", list, CorpsImportBrandExcel.class);
+	}
+
+	/**
+	 * 导入客户品牌
+	 */
+	@PostMapping("/importBrand")
+	public R importBrand(@RequestParam("file") MultipartFile file) {
+		List<CorpsImportBrandExcel> excelList = ExcelUtil.read(file, CorpsImportBrandExcel.class);
+		if (CollectionUtils.isEmpty(excelList)) {
+			throw new SecurityException("数据不能为空");
+		}
+		return corpsDescService.importBrand(excelList);
+	}
+
+}

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

@@ -51,11 +51,8 @@
         <if test="corpsDesc.isDeleted!=null">
             and is_deleted = #{corpsDesc.isDeleted}
         </if>
-        <if test="corpsDesc.strTenantId != null">
-            and sales_company_id in
-            <foreach collection="corpsDesc.strTenantId" item="item" open="(" close=")" separator="," >
-                #{item}
-            </foreach>
+        <if test="corpsDesc.salesCompanyId != null">
+            and sales_company_id  = #{corpsDesc.salesCompanyId}
         </if>
         <if test="corpsDesc.corpType!=null and corpsDesc.corpType != ''">
             and corp_type like CONCAT(CONCAT('%', #{corpsDesc.corpType}), '%')

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

@@ -23,6 +23,7 @@ import org.springblade.client.entity.CorpsDesc;
 import org.springblade.core.tool.api.R;
 import org.springblade.salesPart.entity.PjCorpsDesc;
 import org.springblade.salesPart.excel.CorpsDescImportExcel;
+import org.springblade.salesPart.excel.CorpsImportBrandExcel;
 import org.springblade.salesPart.excel.SupplierImportExcel;
 import org.springblade.salesPart.vo.CorpsDescVO;
 
@@ -120,4 +121,6 @@ public interface ICorpsDescService extends IService<PjCorpsDesc> {
 	R saveCorpsDescApp(PjCorpsDesc corpsDesc);
 
 	R appDetailsV1(Long id);
+
+	R importBrand(List<CorpsImportBrandExcel> excelList);
 }

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

@@ -30,12 +30,14 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.salesPart.brand.service.IBrandDescService;
 import org.springblade.salesPart.corps.mapper.CorpsDescMapper;
 import org.springblade.salesPart.corps.mapper.CorpsTypeDescMapper;
 import org.springblade.salesPart.corps.mapper.CorpsTypeMapper;
 import org.springblade.salesPart.corps.service.ICorpsDescService;
 import org.springblade.salesPart.entity.*;
 import org.springblade.salesPart.excel.CorpsDescImportExcel;
+import org.springblade.salesPart.excel.CorpsImportBrandExcel;
 import org.springblade.salesPart.excel.SupplierImportExcel;
 import org.springblade.salesPart.storage.service.IStorageDescService;
 import org.springblade.salesPart.vo.CorpsDescVO;
@@ -45,15 +47,11 @@ import org.springblade.system.user.entity.User;
 import org.springblade.system.user.entity.UserInfo;
 import org.springblade.system.user.enums.UserEnum;
 import org.springblade.system.user.feign.IUserClient;
-import org.springblade.weChat.feign.IWechatClient;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -78,7 +76,7 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 	private final IUserClient userClient;
 	private final ISysClient sysClient;
 
-	private final IWechatClient wechatClient;
+	private final IBrandDescService brandDescService;
 
 
 	static final int GB_SP_DIFF = 160;
@@ -183,6 +181,18 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 			corpsDesc.setInitials(initials.substring(0, 1));
 		}
 
+		if (ObjectUtils.isNotNull(corpsDesc.getBrandId())) {
+			List<PjBrandDesc> pjBrandDescList = brandDescService.list(new LambdaQueryWrapper<PjBrandDesc>()
+				.eq(PjBrandDesc::getTenantId, AuthUtil.getTenantId())
+				.eq(PjBrandDesc::getIsDeleted, 0)
+				.eq(PjBrandDesc::getType, "PP")
+				.eq(PjBrandDesc::getEnableOrNot, 1)
+				.apply("find_in_set(id,'" + corpsDesc.getBrandId() + "')"));
+			if (!pjBrandDescList.isEmpty()) {
+				corpsDesc.setBrandName(pjBrandDescList.stream().map(PjBrandDesc::getCname).collect(Collectors.joining(",")));
+			}
+		}
+
 		//保存客户信息
 		if (corpsDesc.getId() == null) {
 			corpsDesc.setTenantId(SecureUtil.getTenantId());
@@ -237,10 +247,58 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 				throw new SecurityException("导入数据不能为空");
 			}
 			List<Boolean> countList = new ArrayList<>();
-
-			data.forEach(e -> {
-				String type = e.getType();
-				PjCorpsType corpsType = corpsTypeMapper.selectCorpsTypeCname(type, AuthUtil.getTenantId(), AuthUtil.getDeptId());
+			List<String> typeList = data.stream().map(CorpsDescImportExcel::getType).filter(Objects::nonNull).distinct().collect(Collectors.toList());
+			String type = String.join(",", typeList);
+			List<PjCorpsType> pjCorpsTypeList = corpsTypeMapper.selectList(new LambdaQueryWrapper<PjCorpsType>()
+				.eq(PjCorpsType::getTenantId, AuthUtil.getTenantId())
+				.eq(PjCorpsType::getIsDeleted, 0)
+				.eq(PjCorpsType::getSalesCompanyId, Long.parseLong(AuthUtil.getDeptId()))
+				.apply("find_in_set(cname,'" + type + "')")
+			);
+			if (typeList.isEmpty()) {
+				throw new RuntimeException("分类不能为空");
+			}
+			if (pjCorpsTypeList.isEmpty()) {
+				throw new RuntimeException("分类不能为空");
+			}
+			if (pjCorpsTypeList.size() < typeList.size()) {
+				throw new RuntimeException("导入中的数据,分类字段不存在或者未填分类字段");
+			}
+			List<User> user = userClient.getUserByRole();
+			if (user.isEmpty()) {
+				throw new RuntimeException("未查到业务员信息");
+			}
+			//获得所属公司
+			Long salesCompanyId;
+			String salesCompanyName;
+			String appletsId;
+			R<Dept> dept = sysClient.getDept(Long.valueOf(AuthUtil.getDeptId()));
+			if (ObjectUtil.isNotEmpty(dept)) {
+				salesCompanyId = dept.getData().getId();
+				salesCompanyName = dept.getData().getFullName();
+				appletsId = dept.getData().getAppletsId();
+			} else {
+				throw new SecurityException("数据异常请联系管理员");
+			}
+			String deliveryWarehouse = data.stream().map(CorpsDescImportExcel::getDeliveryWarehouseName).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
+			List<PjStorageDesc> storageDescList = storageDescService.list(new LambdaQueryWrapper<PjStorageDesc>()
+				.eq(PjStorageDesc::getTenantId, AuthUtil.getTenantId())
+				.eq(PjStorageDesc::getIsDeleted, 0)
+				.apply("find_in_set(cname,'" + deliveryWarehouse + "')"));
+			if (storageDescList.isEmpty()) {
+				throw new RuntimeException("未查到仓库信息");
+			}
+			String brandName = data.stream().map(CorpsDescImportExcel::getBrandName).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
+			List<PjBrandDesc> pjBrandDescList = brandDescService.list(new LambdaQueryWrapper<PjBrandDesc>()
+				.eq(PjBrandDesc::getTenantId, AuthUtil.getTenantId())
+				.eq(PjBrandDesc::getIsDeleted, 0)
+				.apply("find_in_set(cname,'" + brandName + "')"));
+			if (pjBrandDescList.isEmpty()) {
+				throw new RuntimeException("未查到品牌信息");
+			}
+			R<String> r = sysClient.getRoleIds(AuthUtil.getTenantId(), "客户");
+			for (CorpsDescImportExcel e : data) {
+				PjCorpsType corpsType = pjCorpsTypeList.stream().filter(item -> item.getCname().equals(e.getType())).findFirst().orElse(null);
 				if (corpsType != null) {
 					countList.add(true);
 					PjCorpsDesc corpsDesc = new PjCorpsDesc();
@@ -251,30 +309,23 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 					corpsDesc.setAccountPeriod(e.getAccountPeriod());
 					//获得业务员
 					if (StringUtils.isNotBlank(e.getSalesmanName())) {
-						List<User> user = userClient.userInfoByName(e.getSalesmanName(), AuthUtil.getTenantId());
-						if (ObjectUtils.isNotNull(user)) {
-							corpsDesc.setSalesmanId(user.get(0).getId());
-							corpsDesc.setSalesmanName(user.get(0).getRealName());
+						User user1 = user.stream().filter(item -> item.getRealName().equals(e.getSalesmanName())).findFirst().orElse(null);
+						if (user1 != null) {
+							corpsDesc.setSalesmanId(user1.getId());
+							corpsDesc.setSalesmanName(user1.getRealName());
 						} else {
 							throw new SecurityException("请输入正确的业务员");
 						}
 					}
-					//获得所属公司
-					R<Dept> dept = sysClient.getDept(Long.valueOf(AuthUtil.getDeptId()));
-					if (ObjectUtil.isNotEmpty(dept)) {
-						corpsDesc.setSalesCompanyId(dept.getData().getId());
-						corpsDesc.setSalesCompanyName(dept.getData().getFullName());
-					} else {
-						throw new SecurityException("数据异常请联系管理员");
-					}
-
+					corpsDesc.setSalesCompanyId(salesCompanyId);
+					corpsDesc.setSalesCompanyName(salesCompanyName);
 					corpsDesc.setCreditLimit(e.getCreditLimit());
 					corpsDesc.setUseCreditLimit(e.getUseCreditLimit());
 
 					//获得仓库
 					if (StringUtils.isNotBlank(e.getDeliveryWarehouseName())) {
-						PjStorageDesc storageDesc = storageDescService.getMessageByName(e.getDeliveryWarehouseName());
-						if (ObjectUtil.isNotEmpty(storageDesc)) {
+						PjStorageDesc storageDesc = storageDescList.stream().filter(item -> item.getCname().equals(e.getDeliveryWarehouseName())).findFirst().orElse(null);
+						if (storageDesc != null) {
 							corpsDesc.setDeliveryWarehouseId(storageDesc.getId());
 							corpsDesc.setDeliveryWarehouseName(storageDesc.getCname());
 						} else {
@@ -284,6 +335,21 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 
 					corpsDesc.setCorpsTypeId(String.valueOf(corpsType.getId()));
 					corpsDesc.setCorpType("KH");
+					List<String> list = Arrays.asList(e.getBrandName().split(","));
+					List<PjBrandDesc> pjBrandDescs = pjBrandDescList.stream().filter(item -> list.contains(item.getCname())).distinct().collect(Collectors.toList());
+					if (!pjBrandDescs.isEmpty()) {
+						corpsDesc.setBrandName(pjBrandDescList.stream().map(PjBrandDesc::getCname).distinct().collect(Collectors.joining(",")));
+						StringBuilder brandIds = new StringBuilder();
+						for (PjBrandDesc item : pjBrandDescList) {
+							brandIds.append(item.getId()).append(",");
+						}
+						if (ObjectUtils.isNotNull(brandIds.toString())) {
+							corpsDesc.setBrandId(brandIds.substring(0, brandIds.length() - 1));
+						}
+						corpsDesc.setBrandName(pjBrandDescList.stream().map(PjBrandDesc::getCname).distinct().collect(Collectors.joining(",")));
+					} else {
+						throw new RuntimeException("未查到" + e.getBrandName() + "品牌信息");
+					}
 					//名称相等视为重复数据
 					LambdaQueryWrapper<PjCorpsDesc> queryWrapper = new LambdaQueryWrapper<>();
 					queryWrapper.eq(PjCorpsDesc::getCname, corpsDesc.getCname());
@@ -297,6 +363,37 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 
 						baseMapper.insert(corpsDesc);
 
+						User userData = userClient.loginByAccount("", corpsDesc.getTel(), "4", AuthUtil.getTenantId(), appletsId);
+						if (ObjectUtils.isNull(userData)) {
+							//用户不存在,注册用户
+							User saveUser = new User();
+							saveUser.setAppletsId(appletsId);
+							saveUser.setTenantId(AuthUtil.getTenantId());
+							saveUser.setAccount(corpsDesc.getTel());
+							saveUser.setName(corpsDesc.getTel());
+							saveUser.setRealName(corpsDesc.getTel());
+							saveUser.setUserType(4);
+							saveUser.setPhone(corpsDesc.getTel());
+							saveUser.setDeptId(AuthUtil.getDeptId());
+							//获取注册用户类型
+							if (r.isSuccess() && ObjectUtils.isNotNull(r.getData())) {
+								saveUser.setRoleId(r.getData());
+							} else {
+								saveUser.setRoleId("");
+							}
+							saveUser.setPassword("123456");
+							R<Boolean> result = userClient.saveUser(saveUser);
+							if (!result.isSuccess()) {
+								throw new RuntimeException(result.getMsg());
+							}
+							R<UserInfo> resu = userClient.userInfo(AuthUtil.getTenantId(), corpsDesc.getTel(), UserEnum.WECHAT.getName());
+							if (resu.isSuccess()) {
+								userData = resu.getData().getUser();
+							} else {
+								throw new RuntimeException("创建用户失败");
+							}
+						}
+
 						PjCorpsTypeDesc middle = new PjCorpsTypeDesc();
 						middle.setCorpId(corpsDesc.getId());
 						middle.setCorpTypeId(corpsType.getId());
@@ -305,6 +402,43 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 						middle.setCreateUser(AuthUtil.getUserId());
 						middle.setCreateDept(Long.valueOf(AuthUtil.getDeptId()));
 						corpsTypeDescMapper.insert(middle);
+						//保存客户联系人信息
+						PjCorpsAttn corpsAttn = new PjCorpsAttn();
+						if (ObjectUtils.isNotNull(userData)) {
+							long count = corpsAttnService.count(new LambdaQueryWrapper<PjCorpsAttn>()
+								.eq(PjCorpsAttn::getUserId, userData.getId())
+								.eq(PjCorpsAttn::getTel, corpsDesc.getTel())
+								.eq(PjCorpsAttn::getTenantId, AuthUtil.getTenantId())
+								.eq(PjCorpsAttn::getIsDeleted, 0));
+							if (count > 0) {
+								throw new RuntimeException("手机号已存在,提交失败");
+							}
+							corpsAttn.setUserId(userData.getId());
+						}
+						corpsAttn.setCname(corpsDesc.getAttn());
+						corpsAttn.setTel(corpsDesc.getTel());
+						corpsAttn.setTenantId(AuthUtil.getTenantId());
+						corpsAttn.setPid(corpsDesc.getId());
+						corpsAttn.setCreateTime(new Date());
+						corpsAttn.setTenantId(AuthUtil.getTenantId());
+						corpsAttn.setCreateUser(AuthUtil.getUserId());
+						corpsAttn.setSalesCompanyId(salesCompanyId);
+						corpsAttn.setSalesCompanyName(salesCompanyName);
+						corpsAttnService.save(corpsAttn);
+
+						//保存客户地址信息
+						PjCorpsAddr corpsAddr = new PjCorpsAddr();
+						corpsAddr.setContacts(corpsDesc.getAttn());
+						corpsAddr.setTel(corpsDesc.getTel());
+						corpsAddr.setBelongtoarea(corpsDesc.getAddr());
+						corpsAddr.setDetailedAddress(corpsDesc.getDetails());
+						corpsAddr.setTenantId(AuthUtil.getTenantId());
+						corpsAddr.setPid(corpsDesc.getId());
+						corpsAddr.setCreateTime(new Date());
+						corpsAddr.setTenantId(AuthUtil.getTenantId());
+						corpsAddr.setCreateUser(AuthUtil.getUserId());
+						corpsAddr.setDefaultAddres("1");
+						corpsAddrService.save(corpsAddr);
 					} else {
 						corpsDesc.setId(selectOne.getId());
 						corpsDesc.setUpdateTime(new Date());
@@ -314,8 +448,8 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 				} else {
 					countList.add(false);
 				}
-			});
-			List<Boolean> booleanList = countList.stream().filter(e -> e == true).collect(Collectors.toList());
+			}
+			List<Boolean> booleanList = countList.stream().filter(e -> e).collect(Collectors.toList());
 			if (data.size() > booleanList.size()) {
 				return R.fail("导入中的数据,分类字段不存在或者未填分类字段");
 			} else if (data.size() == booleanList.size()) {
@@ -676,6 +810,19 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 			String initials = getSpells(corpsDesc.getCname());
 			corpsDesc.setInitials(initials.substring(0, 1));
 		}
+
+		if (ObjectUtils.isNotNull(corpsDesc.getBrandId())) {
+			List<PjBrandDesc> pjBrandDescList = brandDescService.list(new LambdaQueryWrapper<PjBrandDesc>()
+				.eq(PjBrandDesc::getTenantId, AuthUtil.getTenantId())
+				.eq(PjBrandDesc::getIsDeleted, 0)
+				.eq(PjBrandDesc::getType, "PP")
+				.eq(PjBrandDesc::getEnableOrNot, 1)
+				.apply("find_in_set(id,'" + corpsDesc.getBrandId() + "')"));
+			if (!pjBrandDescList.isEmpty()) {
+				corpsDesc.setBrandName(pjBrandDescList.stream().map(PjBrandDesc::getCname).collect(Collectors.joining(",")));
+			}
+		}
+
 		R<Dept> resDept = sysClient.getDept(Long.parseLong(AuthUtil.getDeptId()));
 		if (!resDept.isSuccess() || ObjectUtils.isNull(resDept.getData())) {
 			throw new RuntimeException("未找到小程序id");
@@ -873,6 +1020,64 @@ public class CorpsDescServiceImpl extends ServiceImpl<CorpsDescMapper, PjCorpsDe
 		return R.data(corpsDesc);
 	}
 
+	@Override
+	@Transactional(rollbackFor = Exception.class)
+	@GlobalTransactional(rollbackFor = Exception.class, timeoutMills = 12000000)
+	public R importBrand(List<CorpsImportBrandExcel> data) {
+		if (CollectionUtils.isEmpty(data)) {
+			throw new SecurityException("导入数据不能为空");
+		}
+		String corpName = data.stream().map(CorpsImportBrandExcel::getCname).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
+		List<PjCorpsDesc> pjCorpsDescList = baseMapper.selectList(new LambdaQueryWrapper<PjCorpsDesc>()
+			.eq(PjCorpsDesc::getTenantId, AuthUtil.getTenantId())
+			.eq(PjCorpsDesc::getIsDeleted, 0)
+			.eq(PjCorpsDesc::getSalesCompanyId, AuthUtil.getDeptId())
+			.apply("find_in_set(cname,'" + corpName + "')"));
+		if (pjCorpsDescList.isEmpty()) {
+			throw new RuntimeException("未查到客户信息");
+		}
+		String brandName = data.stream().map(CorpsImportBrandExcel::getBrandName).filter(Objects::nonNull).distinct().collect(Collectors.joining(","));
+		List<PjBrandDesc> pjBrandDescList = brandDescService.list(new LambdaQueryWrapper<PjBrandDesc>()
+			.eq(PjBrandDesc::getTenantId, AuthUtil.getTenantId())
+			.eq(PjBrandDesc::getIsDeleted, 0)
+			.apply("find_in_set(cname,'" + brandName + "')"));
+		if (pjBrandDescList.isEmpty()) {
+			throw new RuntimeException("未查到品牌信息");
+		}
+		List<PjCorpsDesc> pjCorpsDescs = new ArrayList<>();
+		for (CorpsImportBrandExcel e : data) {
+			if (ObjectUtils.isNull(e.getCname())) {
+				throw new RuntimeException("客户名称不能为空");
+			}
+			if (ObjectUtils.isNull(e.getBrandName())) {
+				throw new RuntimeException("品牌不能为空");
+			}
+			PjCorpsDesc corpsDesc = pjCorpsDescList.stream().filter(item -> item.getCname().equals(e.getCname())).findFirst().orElse(null);
+			if (corpsDesc != null) {
+				List<String> list = Arrays.asList(e.getBrandName().split(","));
+				List<PjBrandDesc> pjBrandDescs = pjBrandDescList.stream().filter(item -> list.contains(item.getCname())).distinct().collect(Collectors.toList());
+				if (!pjBrandDescs.isEmpty()) {
+					corpsDesc.setBrandName(pjBrandDescList.stream().map(PjBrandDesc::getCname).distinct().collect(Collectors.joining(",")));
+					StringBuilder brandIds = new StringBuilder();
+					for (PjBrandDesc item : pjBrandDescList) {
+						brandIds.append(item.getId()).append(",");
+					}
+					if (ObjectUtils.isNotNull(brandIds.toString())) {
+						corpsDesc.setBrandId(brandIds.substring(0, brandIds.length() - 1));
+					}
+					corpsDesc.setBrandName(pjBrandDescList.stream().map(PjBrandDesc::getCname).distinct().collect(Collectors.joining(",")));
+				} else {
+					throw new RuntimeException("未查到" + e.getBrandName() + "品牌信息");
+				}
+				pjCorpsDescs.add(corpsDesc);
+			} else {
+				throw new RuntimeException("未查到" + e.getCname() + "客户信息");
+			}
+		}
+		this.updateBatchById(pjCorpsDescs);
+		return R.success("操作成功");
+	}
+
 	/**
 	 * 小程序新增或修改 客户详情
 	 *

+ 75 - 26
blade-service/blade-sales-part/src/main/java/org/springblade/salesPart/productLaunch/controller/ProductLaunchController.java

@@ -36,6 +36,7 @@ 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.salesPart.brand.service.IBrandDescService;
 import org.springblade.salesPart.brand.service.IBrandFigureService;
 import org.springblade.salesPart.brand.service.IBrandFilesService;
 import org.springblade.salesPart.corps.service.ICorpsAttnService;
@@ -58,6 +59,8 @@ import javax.validation.Valid;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 /**
@@ -74,6 +77,7 @@ public class ProductLaunchController extends BladeController {
 
 	private final IProductLaunchService productLaunchService;
 	private final IBrandFilesService brandFilesService;
+	private final IBrandDescService brandDescService;
 	private final IProductLaunchFilesService productLaunchFilesService;
 	private final ICorpsAttnService corpsAttnService;//客户联系人
 	private final ICorpsDescService corpsDescService;//客户
@@ -118,7 +122,28 @@ public class ProductLaunchController extends BladeController {
 		lambdaQueryWrapper.like(ObjectUtils.isNotEmpty(productLaunch.getSpecificationAndModel()), PjProductLaunch::getSpecificationAndModel, productLaunch.getSpecificationAndModel())//规格型号
 			.eq(ObjectUtil.isNotEmpty(productLaunch.getUpAndDownShelves()), PjProductLaunch::getUpAndDownShelves, productLaunch.getUpAndDownShelves());//上下架
 		if (ObjectUtil.isNotEmpty(productLaunch.getCname())) {
-			lambdaQueryWrapper.and(ObjectUtils.isNotNull(productLaunch.getCname()), i -> i.like(PjProductLaunch::getCname, productLaunch.getCname()).or().like(PjProductLaunch::getCnameInt, productLaunch.getCname()));
+			if (productLaunch.getCname().contains(",")) {
+				String brandName = productLaunch.getCname().substring(0, productLaunch.getCname().indexOf(","));
+				String cname = productLaunch.getCname().substring(productLaunch.getCname().indexOf(",") + 1);
+				lambdaQueryWrapper.and(i -> i.like(PjProductLaunch::getCname, cname)
+					.or().like(PjProductLaunch::getCnameInt, cname)
+					.or().like(PjProductLaunch::getBrandItem, cname)
+					.or().like(PjProductLaunch::getSpecificationAndModel, cname)
+				);
+				lambdaQueryWrapper.like(PjProductLaunch::getBrandName, brandName);
+			} else {
+				String[] chineseWords = productLaunch.getCname().split("[^一-龥]");
+				if (chineseWords.length > 0){
+					String cname = productLaunch.getCname().substring(chineseWords[0].length());
+					lambdaQueryWrapper.and(i -> i.like(PjProductLaunch::getCname, cname)
+						.or().like(PjProductLaunch::getCnameInt, cname)
+						.or().like(PjProductLaunch::getBrandItem, cname)
+						.or().like(PjProductLaunch::getSpecificationAndModel, cname)
+					);
+					lambdaQueryWrapper.like(PjProductLaunch::getBrandName, chineseWords[0]);
+				}
+			}
+//			lambdaQueryWrapper.and(ObjectUtils.isNotNull(productLaunch.getCname()), i -> i.like(PjProductLaunch::getCname, productLaunch.getCname()).or().like(PjProductLaunch::getCnameInt, productLaunch.getCname()));
 		}
 		lambdaQueryWrapper.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId());
 		if (ObjectUtils.isNotNull(productLaunch.getBillType()) && productLaunch.getBillType() == 1) {
@@ -458,12 +483,34 @@ public class ProductLaunchController extends BladeController {
 	@ApiOperationSupport(order = 12)
 	@ApiOperation(value = "小程序配件批发产品上架", notes = "传入productLaunch")
 	public R<IPage<PjProductLaunch>> appList(PjProductLaunch productLaunch, Query query) {
+		PjCorpsDesc corpsDesc = null;
+		//根据当前登录人获得客户
+		PjCorpsAttn corpsAttn = corpsAttnService.getAttn(AuthUtil.getUserId());
+		if (ObjectUtil.isNotEmpty(corpsAttn)) {
+			corpsDesc = corpsDescService.getCorpsDesc(corpsAttn.getPid());
+			if (ObjectUtil.isEmpty(corpsDesc)) {
+				throw new RuntimeException("未查到用户信息");
+			}
+		} else {
+			throw new RuntimeException("未查到用户信息");
+		}
 		LambdaQueryWrapper<PjProductLaunch> lambdaQueryWrapper = new LambdaQueryWrapper<>();
 		lambdaQueryWrapper.eq(PjProductLaunch::getTenantId, AuthUtil.getTenantId())
 			.eq(PjProductLaunch::getIsDeleted, 0)
 			.eq(PjProductLaunch::getUpAndDownShelves, 1)
 			.eq(PjProductLaunch::getSalesCompanyId, AuthUtil.getDeptId())//公司
 			.eq(ObjectUtils.isNotEmpty(productLaunch.getBrandId()), PjProductLaunch::getBrandId, productLaunch.getBrandId());//品牌
+		if (ObjectUtils.isNotNull(corpsDesc.getBrandId())) {
+			List<PjBrandDesc> pjBrandDescList = brandDescService.list(new LambdaQueryWrapper<PjBrandDesc>()
+				.eq(PjBrandDesc::getTenantId, AuthUtil.getTenantId())
+				.eq(PjBrandDesc::getIsDeleted, 0)
+				.eq(PjBrandDesc::getType, "PP")
+				.eq(PjBrandDesc::getEnableOrNot, 1)
+				.apply("find_in_set(id,'" + corpsDesc.getBrandId() + "')"));
+			if (!pjBrandDescList.isEmpty()) {
+				lambdaQueryWrapper.in(PjProductLaunch::getBrandId, pjBrandDescList.stream().map(PjBrandDesc::getId).collect(Collectors.toList()));
+			}
+		}
 		if (ObjectUtils.isNotEmpty(productLaunch.getExplosionProof())
 			|| ObjectUtils.isNotEmpty(productLaunch.getOriginalFactory())
 			|| ObjectUtils.isNotEmpty(productLaunch.getSelfRecovery())) {
@@ -472,16 +519,31 @@ public class ProductLaunchController extends BladeController {
 				.or().eq(ObjectUtils.isNotEmpty(productLaunch.getSelfRecovery()), PjProductLaunch::getSelfRecovery, productLaunch.getSelfRecovery())//自修补
 			);
 		}
-		lambdaQueryWrapper.like(ObjectUtils.isNotEmpty(productLaunch.getBrandName()), PjProductLaunch::getBrandName, productLaunch.getBrandName())
-			.ne(PjProductLaunch::getWhetherShare, 1)
+		lambdaQueryWrapper.ne(PjProductLaunch::getWhetherShare, 1)
 			.orderByAsc(PjProductLaunch::getBillType);
 
 		if (ObjectUtil.isNotEmpty(productLaunch.getCname())) {
-			lambdaQueryWrapper.and(i -> i.like(PjProductLaunch::getCname, productLaunch.getCname())
-				.or().like(PjProductLaunch::getCnameInt, productLaunch.getCname())
-				.or().like(PjProductLaunch::getBrandItem, productLaunch.getCname())
-				.or().like(PjProductLaunch::getSpecificationAndModel, productLaunch.getCname())
-			);
+			if (productLaunch.getCname().contains(",")) {
+				String brandName = productLaunch.getCname().substring(0, productLaunch.getCname().indexOf(","));
+				String cname = productLaunch.getCname().substring(productLaunch.getCname().indexOf(",") + 1);
+				lambdaQueryWrapper.and(i -> i.like(PjProductLaunch::getCname, cname)
+					.or().like(PjProductLaunch::getCnameInt, cname)
+					.or().like(PjProductLaunch::getBrandItem, cname)
+					.or().like(PjProductLaunch::getSpecificationAndModel, cname)
+				);
+				lambdaQueryWrapper.like(PjProductLaunch::getBrandName, brandName);
+			} else {
+				String[] chineseWords = productLaunch.getCname().split("[^一-龥]");
+				if (chineseWords.length > 0){
+					String cname = productLaunch.getCname().substring(chineseWords[0].length());
+					lambdaQueryWrapper.and(i -> i.like(PjProductLaunch::getCname, cname)
+						.or().like(PjProductLaunch::getCnameInt, cname)
+						.or().like(PjProductLaunch::getBrandItem, cname)
+						.or().like(PjProductLaunch::getSpecificationAndModel, cname)
+					);
+					lambdaQueryWrapper.like(PjProductLaunch::getBrandName, chineseWords[0]);
+				}
+			}
 		}
 		if ("1".equals(productLaunch.getWhetherIntegral())) {
 			List<PjGoodsDesc> pjGoodsDescList = goodsDescService.list(new LambdaQueryWrapper<PjGoodsDesc>()
@@ -501,18 +563,6 @@ public class ProductLaunchController extends BladeController {
 		IPage<PjProductLaunch> pages = productLaunchService.page(Condition.getPage(query), lambdaQueryWrapper);
 
 		if (CollectionUtils.isNotEmpty(pages.getRecords())) {
-
-			PjCorpsDesc corpsDesc = null;
-			//根据当前登录人获得客户
-			PjCorpsAttn corpsAttn = corpsAttnService.getAttn(AuthUtil.getUserId());
-			if (ObjectUtil.isNotEmpty(corpsAttn)) {
-				corpsDesc = corpsDescService.getCorpsDesc(corpsAttn.getPid());
-				if (ObjectUtil.isEmpty(corpsDesc)) {
-					throw new RuntimeException("未查到用户信息");
-				}
-			} else {
-				throw new RuntimeException("未查到用户信息");
-			}
 			List<PjProductLaunchFiles> pjProductLaunchFilesList = new ArrayList<>();
 			List<PjBrandFiles> pjBrandFilesList = new ArrayList<>();
 			List<BrandFigure> brandFigureList = new ArrayList<>();
@@ -528,7 +578,6 @@ public class ProductLaunchController extends BladeController {
 				brandFigureList = brandFigureService.list(new QueryWrapper<BrandFigure>()
 					.in("pid", brandIds).eq("is_deleted", 0));
 			}
-			PjCorpsDesc finalCorpsDesc = corpsDesc;
 			for (PjProductLaunch item : pages.getRecords()) {
 				if (!pjProductLaunchFilesList.isEmpty()) {
 					List<PjProductLaunchFiles> list = pjProductLaunchFilesList.stream().filter(e -> e.getPid().equals(item.getId())).collect(Collectors.toList());
@@ -594,14 +643,14 @@ public class ProductLaunchController extends BladeController {
 						}
 					}
 				}
-				if (StringUtils.isNotBlank(finalCorpsDesc.getPriceSystem())) {
-					if ("售价1".equals(finalCorpsDesc.getPriceSystem())) {
+				if (StringUtils.isNotBlank(corpsDesc.getPriceSystem())) {
+					if ("售价1".equals(corpsDesc.getPriceSystem())) {
 						item.setMallPrice(item.getPriceOne());
-					} else if ("售价2".equals(finalCorpsDesc.getPriceSystem())) {
+					} else if ("售价2".equals(corpsDesc.getPriceSystem())) {
 						item.setMallPrice(item.getPriceTwo());
-					} else if ("售价3".equals(finalCorpsDesc.getPriceSystem())) {
+					} else if ("售价3".equals(corpsDesc.getPriceSystem())) {
 						item.setMallPrice(item.getPriceThree());
-					} else if ("售价4".equals(finalCorpsDesc.getPriceSystem())) {
+					} else if ("售价4".equals(corpsDesc.getPriceSystem())) {
 						item.setMallPrice(item.getPriceFour());
 					} else {
 						item.setMallPrice(item.getPriceOne());

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

@@ -126,21 +126,21 @@ public class ShipController extends BladeController {
 		}
 		IPage<PjShip> pages = shipService.page(Condition.getPage(query), lambdaQueryWrapper);
 
-		String updateUserIds = "";//修改人id拼接
-		String createUserIds = "";//创建人id拼接
+		StringBuilder updateUserIds = new StringBuilder();//修改人id拼接
+		StringBuilder createUserIds = new StringBuilder();//创建人id拼接
 		for (PjShip items : pages.getRecords()) {
 			if (ObjectUtil.isNotEmpty(items.getUpdateUser())) {
-				updateUserIds = updateUserIds + items.getUpdateUser() + ",";
+				updateUserIds.append(items.getUpdateUser()).append(",");
 			}
 			if (ObjectUtil.isNotEmpty(items.getCreateUser())) {
-				createUserIds = createUserIds + items.getCreateUser() + ",";
+				createUserIds.append(items.getCreateUser()).append(",");
 			}
 		}
 
 		//获得修改人信息
-		List<User> updateUserList = userClient.selectUserIds(updateUserIds);
+		List<User> updateUserList = userClient.selectUserIds(updateUserIds.toString());
 		//获得创建人信息
-		List<User> createUserList = userClient.selectUserIds(createUserIds);
+		List<User> createUserList = userClient.selectUserIds(createUserIds.toString());
 
 		if (CollectionUtils.isNotEmpty(pages.getRecords())) {
 			List<Long> ids = pages.getRecords().stream().map(PjShip::getId).collect(Collectors.toList());
@@ -149,14 +149,14 @@ public class ShipController extends BladeController {
 			pages.getRecords().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)) {
+					if (user != null) {
 						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)) {
+					if (user != null) {
 						item.setCreateUserName(user.getName());
 					}
 				}