Browse Source

Merge branch 'dev' of http://git.aseanbusiness.cn/qzyReal/market-server into dev

qzyReal 1 year ago
parent
commit
7a5d1a9718
39 changed files with 819 additions and 186 deletions
  1. 42 3
      sp-core/sp-base/pom.xml
  2. 39 3
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/MethodEnterpriseService.java
  3. 22 21
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java
  4. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java
  5. 18 6
      sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java
  6. 39 4
      sp-service/level-one-server/src/main/java/com/pj/tb_goods/MethodGoodsService.java
  7. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_goods/TbGoodsController.java
  8. 15 6
      sp-service/level-one-server/src/main/java/com/pj/tb_goods/TbGoodsService.java
  9. 41 4
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/MethodGoodsTransitService.java
  10. 3 2
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitController.java
  11. 15 6
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java
  12. 41 5
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/MethodGoodsTypeService.java
  13. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeController.java
  14. 17 7
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeService.java
  15. 41 5
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/MethodGoodsUnitsService.java
  16. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/TbGoodsUnitsController.java
  17. 16 7
      sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/TbGoodsUnitsService.java
  18. 40 5
      sp-service/level-one-server/src/main/java/com/pj/tb_group/MethodGroupService.java
  19. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupController.java
  20. 15 6
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java
  21. 41 5
      sp-service/level-one-server/src/main/java/com/pj/tb_people/MethodPeopleService.java
  22. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java
  23. 16 6
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java
  24. 41 5
      sp-service/level-one-server/src/main/java/com/pj/tb_shop/MethodShopService.java
  25. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopController.java
  26. 16 6
      sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopService.java
  27. 41 5
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/MethodTradeAreaService.java
  28. 21 5
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaController.java
  29. 16 6
      sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaService.java
  30. 40 5
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/MethodPurchaserService.java
  31. 26 1
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaser.java
  32. 10 2
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserController.java
  33. 17 7
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserService.java
  34. 40 5
      sp-service/transport-server/src/main/java/com/pj/project/tb_driver/MethodDriverService.java
  35. 2 2
      sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverController.java
  36. 17 7
      sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverService.java
  37. 40 5
      sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/MethodVehicleService.java
  38. 2 4
      sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleController.java
  39. 15 6
      sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleService.java

+ 42 - 3
sp-core/sp-base/pom.xml

@@ -39,9 +39,48 @@
             <artifactId>poi-ooxml</artifactId>
             <version>4.0.0</version>
         </dependency>
-    
-    
-	    <!-- nacos 注册中心 -->
+
+
+        <!-- 自定义验证注解 -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
+
+        <!-- EasyExcel -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.1.1</version>
+        </dependency>
+
+
+        <!-- Swagger3依赖 -->
+<!--        <dependency>-->
+<!--            <groupId>io.springfox</groupId>-->
+<!--            <artifactId>springfox-boot-starter</artifactId>-->
+<!--            <version>3.0.0</version>-->
+<!--            <exclusions>-->
+<!--                <exclusion>-->
+<!--                    <groupId>io.swagger</groupId>-->
+<!--                    <artifactId>swagger-models</artifactId>-->
+<!--                </exclusion>-->
+<!--            </exclusions>-->
+<!--        </dependency>-->
+
+        <!-- fastjson -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>1.2.73</version>
+        </dependency>
+        <dependency>
+            <groupId>com.alibaba.fastjson2</groupId>
+            <artifactId>fastjson2</artifactId>
+            <version>2.0.3.graal</version>
+        </dependency>
+
+        <!-- nacos 注册中心 -->
 	    <dependency>
 		    <groupId>com.alibaba.cloud</groupId>
 		    <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>

+ 39 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/MethodEnterpriseService.java

@@ -9,7 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
 
 /**
  * @Author Mechrevo
@@ -22,6 +26,8 @@ public class MethodEnterpriseService {
     @Autowired
     private TbEnterpriseMapper tbEnterpriseMapper;
 
+    @Autowired
+    private TbEnterpriseService tbEnterpriseService;
     /**
      * 方法抽取  导入
      * @param row
@@ -31,6 +37,8 @@ public class MethodEnterpriseService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        List<TbEnterprise> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -130,10 +138,38 @@ public class MethodEnterpriseService {
             //删除状态,默认可用
             tbEnterprise.setDeleteStatus(1);
 //			//添加到集合
-//			list.add(tbEnterprise);
-            int insert = tbEnterpriseMapper.insert(tbEnterprise);
-            count += insert;
+			list.add(tbEnterprise);
+//            int insert = tbEnterpriseMapper.insert(tbEnterprise);
+//            count += insert;
+        }
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbEnterprise> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbEnterpriseService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
         }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
 }

+ 22 - 21
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterprise.java

@@ -3,6 +3,7 @@ package com.pj.tb_enterprise;
 import java.io.Serializable;
 import java.util.Date;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -51,82 +52,82 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	/**
 	 * 名称 
 	 */
-	private String name;	
+	private String name;
 
 	/**
 	 * 国别 
 	 */
-	private String nationality;	
+	private String nationality;
 
 	/**
 	 * 商户分类(自营商铺=自营商铺,劳务商铺=劳务商铺) 
 	 */
-	private String type;	
+	private String type;
 
 	/**
 	 * 法人 
 	 */
-	private String legalPerson;	
+	private String legalPerson;
 
 	/**
 	 * 身份证号 
 	 */
-	private String idCard;	
+	private String idCard;
 
 	/**
 	 * 手机号码 
 	 */
-	private String contact;	
+	private String contact;
 
 	/**
 	 * 营业执照 
 	 */
-	private String businessLicense;	
+	private String businessLicense;
 
 	/**
 	 * 所在铺位ID 
 	 */
-	private Long shopId;	
+	private Long shopId;
 
 	/**
 	 * 所在铺位名称(1=100-2) 
 	 */
-	private String shopName;	
+	private String shopName;
 
 	/**
 	 * 银行编号(CMB= 招商银行) 
 	 */
-	private String bankNo;	
+	private String bankNo;
 
 	/**
-	 *  
+	 *
 	 */
-	private String bankName;	
+	private String bankName;
 
 	/**
 	 * 银行账号 
 	 */
-	private String bankAccount;	
+	private String bankAccount;
 
 	/**
 	 * 税号 
 	 */
-	private String dutyParagraph;	
+	private String dutyParagraph;
 
 	/**
-	 *  
+	 *
 	 */
-	private String addressIds;	
+	private String addressIds;
 
 	/**
-	 *  
+	 *
 	 */
-	private String address;	
+	private String address;
 
 	/**
 	 *  
 	 */
-	private String agreement;	
+	private String agreement;
 
 	/**
 	 *  
@@ -136,7 +137,7 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	/**
 	 *  
 	 */
-	private String judgeContent;	
+	private String judgeContent;
 
 	/**
 	 *  
@@ -153,7 +154,7 @@ public class TbEnterprise extends Model<TbEnterprise> implements Serializable {
 	/**
 	 *  
 	 */
-	private String personId;	
+	private String personId;
 
 	/**
 	 * 创建时间 

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseController.java

@@ -114,9 +114,9 @@ public class TbEnterpriseController {
 	 */
 	@RequestMapping("enterpriseOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbEnterpriseService.outportExcel(keyword);
+			String importData = tbEnterpriseService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 18 - 6
sp-service/level-one-server/src/main/java/com/pj/tb_enterprise/TbEnterpriseService.java

@@ -6,6 +6,8 @@ import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
 import java.util.List;
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.event.AnalysisEventListener;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.pj.utils.so.SoMap;
 import org.apache.commons.lang3.StringUtils;
@@ -19,6 +21,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 
 /**
  * Service: tb_enterprise -- 商家
@@ -93,11 +97,15 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "商家数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\商家数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbEnterprise> selectedList = tbEnterpriseMapper.selectList(new LambdaQueryWrapper<TbEnterprise>().eq(StringUtils.isNoneBlank(keyword), TbEnterprise::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -137,6 +145,8 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 		row.createCell(27).setCellValue("更新人名称");
 		row.createCell(28).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -169,6 +179,7 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -178,9 +189,10 @@ public class TbEnterpriseService extends ServiceImpl<TbEnterpriseMapper, TbEnter
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 
+
 }

+ 39 - 4
sp-service/level-one-server/src/main/java/com/pj/tb_goods/MethodGoodsService.java

@@ -1,5 +1,6 @@
 package com.pj.tb_goods;
 
+import com.pj.tb_enterprise.TbEnterprise;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -9,6 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 
 /**
  * @Author Mechrevo
@@ -19,7 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodGoodsService {
 
     @Autowired
-    private TbGoodsMapper tbGoodsMapper;
+    private TbGoodsService tbGoodsService;
 
 
     /**
@@ -31,6 +37,9 @@ public class MethodGoodsService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接受集合
+        List<TbGoods> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -91,10 +100,36 @@ public class MethodGoodsService {
             //删除状态,默认可用
             tbGoods.setDeleteStatus(1);
 //			//添加到集合
-//			list.add(tbGoods);
-            int insert = tbGoodsMapper.insert(tbGoods);
-            count += insert;
+			list.add(tbGoods);
+        }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbGoods> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbGoodsService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
         }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
 

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_goods/TbGoodsController.java

@@ -111,9 +111,9 @@ public class TbGoodsController {
 	 */
 	@RequestMapping("goodsOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbGoodsService.outportExcel(keyword);
+			String importData = tbGoodsService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 15 - 6
sp-service/level-one-server/src/main/java/com/pj/tb_goods/TbGoodsService.java

@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_goods -- 商品
  * @author qzy 
@@ -93,11 +95,15 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "商品数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\商品数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbGoods> selectedList = tbGoodsMapper.selectList(new LambdaQueryWrapper<TbGoods>().eq(StringUtils.isNoneBlank(keyword), TbGoods::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -127,6 +133,8 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
 		row.createCell(17).setCellValue("更新人名称");
 		row.createCell(18).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -149,6 +157,7 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -158,8 +167,8 @@ public class TbGoodsService extends ServiceImpl<TbGoodsMapper, TbGoods> implemen
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 

+ 41 - 4
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/MethodGoodsTransitService.java

@@ -1,5 +1,7 @@
 package com.pj.tb_goods_transit;
 
+import com.pj.tb_goods.TbGoods;
+import com.pj.tb_goods_type.TbGoodsTypeService;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -9,6 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 
 /**
  * @Author Mechrevo
@@ -19,7 +26,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodGoodsTransitService {
     
     @Autowired
-    private TbGoodsTransitMapper tbGoodsTransitMapper;
+    private TbGoodsTransitService tbGoodsTransitService;
 
     /**
      * 方法抽取  导入
@@ -30,6 +37,9 @@ public class MethodGoodsTransitService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接受集合
+        List<TbGoodsTransit> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -106,10 +116,37 @@ public class MethodGoodsTransitService {
             //删除状态,默认可用
             tbGoodsTransit.setDeleteStatus(1);
 //			//添加到集合
-//			list.add(tbGoodsTransit);
-            int insert = tbGoodsTransitMapper.insert(tbGoodsTransit);
-            count += insert;
+			list.add(tbGoodsTransit);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbGoodsTransit> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbGoodsTransitService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
     

+ 3 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitController.java

@@ -126,13 +126,14 @@ public class TbGoodsTransitController {
 	/**
 	 * 导出
 	 * @param keyword
+	 * @param filepath
 	 * @return
 	 */
 	@RequestMapping("goodsTransitOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbGoodsTransitService.outportExcel(keyword);
+			String importData = tbGoodsTransitService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 15 - 6
sp-service/level-one-server/src/main/java/com/pj/tb_goods_transit/TbGoodsTransitService.java

@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_goods_transit -- 审核商户在APP端发布的商品
  * @author qzy 
@@ -94,11 +96,15 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "商家商品审核数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\商家商品审核数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbGoodsTransit> selectedList = tbGoodsTransitMapper.selectList(new LambdaQueryWrapper<TbGoodsTransit>().eq(StringUtils.isNoneBlank(keyword), TbGoodsTransit::getMerchantName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -130,6 +136,8 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		row.createCell(19).setCellValue("更新人名称");
 		row.createCell(20).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -155,6 +163,7 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -164,8 +173,8 @@ public class TbGoodsTransitService extends ServiceImpl<TbGoodsTransitMapper, TbG
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 }

+ 41 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/MethodGoodsTypeService.java

@@ -1,5 +1,6 @@
 package com.pj.tb_goods_type;
 
+import com.pj.tb_goods.TbGoods;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -9,6 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 21 17 16
@@ -19,7 +25,7 @@ public class MethodGoodsTypeService {
 
 
     @Autowired
-    private TbGoodsTypeMapper tbGoodsTypeMapper;
+    private TbGoodsTypeService tbGoodsTypeService;
 
     /**
      * 方法抽取  导入
@@ -30,6 +36,9 @@ public class MethodGoodsTypeService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbGoodsType> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -70,11 +79,38 @@ public class MethodGoodsTypeService {
             }
             //删除状态,默认可用
             tbGoodsType.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbGoodsType);
-            int insert = tbGoodsTypeMapper.insert(tbGoodsType);
-            count += insert;
+			//添加到集合
+			list.add(tbGoodsType);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbGoodsType> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbGoodsTypeService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
 }

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeController.java

@@ -114,9 +114,9 @@ public class TbGoodsTypeController {
 	 */
 	@RequestMapping("goodsTypeOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepathh",required = false)String filepath){
 		try {
-			String importData = tbGoodsTypeService.outportExcel(keyword);
+			String importData = tbGoodsTypeService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 17 - 7
sp-service/level-one-server/src/main/java/com/pj/tb_goods_type/TbGoodsTypeService.java

@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_goods_type -- 商品分类
  * @author qzy 
@@ -93,13 +95,18 @@ public class TbGoodsTypeService extends ServiceImpl<TbGoodsTypeMapper, TbGoodsTy
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "商品分类数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\商品分类数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
-		List<TbGoodsType> selectedList = tbGoodsTypeMapper.selectList(new LambdaQueryWrapper<TbGoodsType>().eq(StringUtils.isNoneBlank(keyword), TbGoodsType::getName, keyword));
+		List<TbGoodsType> selectedList = tbGoodsTypeMapper.selectList
+				(new LambdaQueryWrapper<TbGoodsType>().eq(StringUtils.isNoneBlank(keyword), TbGoodsType::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
 		//建立excel对象封装数据
 		HSSFWorkbook workbook = new HSSFWorkbook();
@@ -119,6 +126,8 @@ public class TbGoodsTypeService extends ServiceImpl<TbGoodsTypeMapper, TbGoodsTy
 		row.createCell(17).setCellValue("更新人名称");
 		row.createCell(18).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -133,6 +142,7 @@ public class TbGoodsTypeService extends ServiceImpl<TbGoodsTypeMapper, TbGoodsTy
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -142,8 +152,8 @@ public class TbGoodsTypeService extends ServiceImpl<TbGoodsTypeMapper, TbGoodsTy
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 

+ 41 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/MethodGoodsUnitsService.java

@@ -1,11 +1,17 @@
 package com.pj.tb_goods_units;
 
+import com.pj.tb_goods.TbGoods;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 21 17 30
@@ -15,7 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodGoodsUnitsService {
     
     @Autowired
-    private TbGoodsUnitsMapper tbGoodsUnitsMapper;
+    private TbGoodsUnitsService tbGoodsUnitsService;
 
     /**
      * 方法抽取  导入
@@ -26,6 +32,9 @@ public class MethodGoodsUnitsService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbGoodsUnits> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -63,11 +72,38 @@ public class MethodGoodsUnitsService {
 //            }
 //            //删除状态,默认可用
 //            tbGoodsUnits.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbGoodsUnits);
-            int insert = tbGoodsUnitsMapper.insert(tbGoodsUnits);
-            count += insert;
+			//添加到集合
+			list.add(tbGoodsUnits);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbGoodsUnits> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbGoodsUnitsService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
 }

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/TbGoodsUnitsController.java

@@ -101,9 +101,9 @@ public class TbGoodsUnitsController {
 	 */
 	@RequestMapping("goodsUnitsOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbGoodsUnitsService.outportExcel(keyword);
+			String importData = tbGoodsUnitsService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 16 - 7
sp-service/level-one-server/src/main/java/com/pj/tb_goods_units/TbGoodsUnitsService.java

@@ -20,6 +20,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_goods_units -- 商品单位
  * @author qzy 
@@ -92,11 +94,15 @@ public class TbGoodsUnitsService extends ServiceImpl<TbGoodsUnitsMapper, TbGoods
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "商品分类数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\商品分类数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbGoodsUnits> selectedList = tbGoodsUnitsMapper.selectList(new LambdaQueryWrapper<TbGoodsUnits>().eq(StringUtils.isNoneBlank(keyword), TbGoodsUnits::getUnits, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -110,13 +116,16 @@ public class TbGoodsUnitsService extends ServiceImpl<TbGoodsUnitsMapper, TbGoods
 		row.createCell(1).setCellValue("食品单位编号");
 		row.createCell(2).setCellValue("管理商品的单位");
 
-
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
 			sheetRow.createCell(0).setCellValue(i + 1);
 			sheetRow.createCell(1).setCellValue((selectedList.get(i).getUnitsNo() + "").equals("null")? "": selectedList.get(i).getUnitsNo() + "");
 			sheetRow.createCell(2).setCellValue((selectedList.get(i).getUnits() + "").equals("null")? "": selectedList.get(i).getUnits() + "");
+
+			count += 1;
 					}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -126,8 +135,8 @@ public class TbGoodsUnitsService extends ServiceImpl<TbGoodsUnitsMapper, TbGoods
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 

+ 40 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_group/MethodGroupService.java

@@ -1,5 +1,6 @@
 package com.pj.tb_group;
 
+
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -9,6 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 21 17 38
@@ -18,7 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodGroupService {
     
     @Autowired
-    private TbGroupMapper tbGroupMapper;
+    private TbGroupService tbGroupService;
 
 
 
@@ -31,6 +37,9 @@ public class MethodGroupService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbGroup> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -92,11 +101,37 @@ public class MethodGroupService {
             }
             //删除状态,默认可用
             tbGroup.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbGroup);
-            int insert = tbGroupMapper.insert(tbGroup);
-            count += insert;
+			//添加到集合
+			list.add(tbGroup);
+
         }
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbGroup> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbGroupService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
 }

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupController.java

@@ -115,9 +115,9 @@ public class TbGroupController {
 	 */
 	@RequestMapping("groupOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbGroupService.outportExcel(keyword);
+			String importData = tbGroupService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 15 - 6
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java

@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_group -- 互助组
  * @author qzy 
@@ -93,11 +95,15 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "互助组数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\互助组数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbGroup> selectedList = tbGroupMapper.selectList(new LambdaQueryWrapper<TbGroup>().eq(StringUtils.isNoneBlank(keyword), TbGroup::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -126,6 +132,8 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		row.createCell(19).setCellValue("更新人名称");
 		row.createCell(20).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -148,6 +156,7 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -157,8 +166,8 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 

+ 41 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_people/MethodPeopleService.java

@@ -1,5 +1,6 @@
 package com.pj.tb_people;
 
+import com.pj.tb_goods.TbGoods;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -9,6 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 21 17 52
@@ -18,7 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodPeopleService {
     
     @Autowired
-    private TbPeopleMapper tbPeopleMapper;
+    private TbPeopleService tbPeopleService;
 
 
     /**
@@ -30,6 +36,9 @@ public class MethodPeopleService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbPeople> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -160,11 +169,38 @@ public class MethodPeopleService {
             }
             //删除状态,默认可用
             tbPeople.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbPeople);
-            int insert = tbPeopleMapper.insert(tbPeople);
-            count += insert;
+			//添加到集合
+			list.add(tbPeople);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbPeople> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbPeopleService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
     

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java

@@ -114,9 +114,9 @@ public class TbPeopleController {
 	 */
 	@RequestMapping("peopleOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbPeopleService.outportExcel(keyword);
+			String importData = tbPeopleService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 16 - 6
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_people -- 边民
  * @author qzy 
@@ -93,11 +95,15 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "边民数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\边民数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbPeople> selectedList = tbPeopleMapper.selectList(new LambdaQueryWrapper<TbPeople>().eq(StringUtils.isNoneBlank(keyword), TbPeople::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -142,6 +148,9 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 		row.createCell(32).setCellValue("更新人编号");
 		row.createCell(33).setCellValue("更新人名称");
 		row.createCell(34).setCellValue("删除状态");
+
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -181,6 +190,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -190,7 +200,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 }

+ 41 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_shop/MethodShopService.java

@@ -1,5 +1,6 @@
 package com.pj.tb_shop;
 
+import com.pj.tb_goods.TbGoods;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -9,6 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 21 20 37
@@ -18,7 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodShopService {
     
     @Autowired
-    private TbShopMapper tbShopMapper;
+    private TbShopService tbShopService;
 
 
     /**
@@ -30,6 +36,9 @@ public class MethodShopService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbShop> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -97,11 +106,38 @@ public class MethodShopService {
             }
             //删除状态,默认可用
             tbShop.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbShop);
-            int insert = tbShopMapper.insert(tbShop);
-            count += insert;
+			//添加到集合
+			list.add(tbShop);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbShop> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbShopService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
     

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopController.java

@@ -117,9 +117,9 @@ public class TbShopController {
 	 */
 	@RequestMapping("shopOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbShopService.outportExcel(keyword);
+			String importData = tbShopService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 16 - 6
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopService.java

@@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_shop -- 铺位
  * @author qzy 
@@ -92,11 +94,15 @@ public class TbShopService extends ServiceImpl<TbShopMapper, TbShop> implements
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "铺位数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\铺位数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbShop> selectedList = tbShopMapper.selectList(new LambdaQueryWrapper<TbShop>().eq(StringUtils.isNoneBlank(keyword), TbShop::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -126,6 +132,9 @@ public class TbShopService extends ServiceImpl<TbShopMapper, TbShop> implements
 		row.createCell(32).setCellValue("更新人编号");
 		row.createCell(33).setCellValue("更新人名称");
 		row.createCell(34).setCellValue("删除状态");
+
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -149,6 +158,7 @@ public class TbShopService extends ServiceImpl<TbShopMapper, TbShop> implements
 			sheetRow.createCell(16).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(17).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(18).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -158,8 +168,8 @@ public class TbShopService extends ServiceImpl<TbShopMapper, TbShop> implements
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 }

+ 41 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/MethodTradeAreaService.java

@@ -1,5 +1,6 @@
 package com.pj.tb_trade_area;
 
+import com.pj.tb_goods.TbGoods;
 import org.apache.poi.hssf.usermodel.HSSFCell;
 import org.apache.poi.hssf.usermodel.HSSFRow;
 import org.apache.poi.hssf.usermodel.HSSFSheet;
@@ -9,6 +10,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 21 21 01
@@ -18,7 +24,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodTradeAreaService {
     
     @Autowired
-    private TbTradeAreaMapper tbTradeAreaMapper;
+    private TbTradeAreaService tbTradeAreaService;
 
 
     /**
@@ -30,6 +36,9 @@ public class MethodTradeAreaService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbTradeArea> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -72,11 +81,38 @@ public class MethodTradeAreaService {
             }
             //删除状态,默认可用
             tbTradeArea.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbTradeArea);
-            int insert = tbTradeAreaMapper.insert(tbTradeArea);
-            count += insert;
+			//添加到集合
+			list.add(tbTradeArea);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbTradeArea> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbTradeAreaService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
     

+ 21 - 5
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaController.java

@@ -2,6 +2,8 @@ package com.pj.tb_trade_area;
 
 import java.io.IOException;
 import java.util.List;
+
+import com.pj.common.core.utils.poi.ExcelUtil;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
@@ -14,6 +16,8 @@ import com.pj.current.satoken.StpUserUtil;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+
 
 /**
  * Controller: tb_trade_area -- 贸易区域
@@ -89,12 +93,20 @@ public class TbTradeAreaController {
 	 */
 	@RequestMapping("tradeAreaImport")
 	@ResponseBody
-	public AjaxJson dataImport(@RequestParam("file") MultipartFile file){
+	public AjaxJson dataImport( @RequestParam("file") MultipartFile file){
+		List<TbTradeArea> areaList = tbTradeAreaService.list();
+		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
+
 		try {
-			String importData = tbTradeAreaService.importData(file);
-			AjaxJson.getSuccess(importData);
+			List<TbTradeArea> tbTradeAreas = excelUtil.importExcel(file.getInputStream());
+			System.out.println(tbTradeAreas);
+
+//			String importData = tbTradeAreaService.importData(file);
+//			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);
+		} catch (Exception e) {
+			throw new RuntimeException(e);
 		}
 		return AjaxJson.getError();
 	}
@@ -106,9 +118,13 @@ public class TbTradeAreaController {
 	 */
 	@RequestMapping("tradeAreaOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(HttpServletResponse response,@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
+
+		List<TbTradeArea> areaList = tbTradeAreaService.list();
+		ExcelUtil<TbTradeArea> excelUtil = new ExcelUtil<>(TbTradeArea.class);
+		excelUtil.exportExcel(response,areaList,"区域表");
 		try {
-			String importData = tbTradeAreaService.outportExcel(keyword);
+			String importData = tbTradeAreaService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 16 - 6
sp-service/level-one-server/src/main/java/com/pj/tb_trade_area/TbTradeAreaService.java

@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_trade_area -- 贸易区域
  * @author qzy 
@@ -93,11 +95,15 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "贸易区域审核数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\贸易区域审核数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbTradeArea> selectedList = tbTradeAreaMapper.selectList(new LambdaQueryWrapper<TbTradeArea>().eq(StringUtils.isNoneBlank(keyword), TbTradeArea::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -120,6 +126,9 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 		row.createCell(32).setCellValue("更新人编号");
 		row.createCell(33).setCellValue("更新人名称");
 		row.createCell(34).setCellValue("删除状态");
+
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -137,6 +146,7 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -146,8 +156,8 @@ public class TbTradeAreaService extends ServiceImpl<TbTradeAreaMapper, TbTradeAr
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 }

+ 40 - 5
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/MethodPurchaserService.java

@@ -9,6 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 21 21 13
@@ -18,7 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodPurchaserService {
     
     @Autowired
-    private TbPurchaserMapper tbPurchaserMapper;
+    private TbPurchaserService tbPurchaserService;
 
     /**
      * 方法抽取  导入
@@ -29,6 +34,9 @@ public class MethodPurchaserService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbPurchaser> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -115,11 +123,38 @@ public class MethodPurchaserService {
             }
             //删除状态,默认可用
             tbPurchaser.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbPurchaser);
-            int insert = tbPurchaserMapper.insert(tbPurchaser);
-            count += insert;
+			//添加到集合
+			list.add(tbPurchaser);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbPurchaser> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbPurchaserService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
 }

+ 26 - 1
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaser.java

@@ -5,6 +5,7 @@ import java.util.*;
 import com.baomidou.mybatisplus.annotation.*;
 import com.baomidou.mybatisplus.extension.activerecord.Model;
 import com.fasterxml.jackson.annotation.JsonFormat;
+import com.pj.common.core.annotation.Excel;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
@@ -44,126 +45,150 @@ public class TbPurchaser extends Model<TbPurchaser> implements Serializable {
 	/**
 	 * 主键 
 	 */
+	@Excel(name = "id")
 	@TableId(type = IdType.AUTO)
 	private Long id;	
 
 	/**
 	 * 名称 
 	 */
-	private String name;	
+	@Excel(name = "名称")
+	private String name;
 
 	/**
 	 * 法人 
 	 */
+	@Excel(name = "法人")
 	private String legalPerson;	
 
 	/**
 	 * 身份证号 
 	 */
+	@Excel(name = "身份证号码")
 	private String idCard;	
 
 	/**
 	 * 手机号码 
 	 */
+	@Excel(name = "手机号码")
 	private String contact;	
 
 	/**
 	 * 营业执照 
 	 */
+	@Excel(name = "营业执照")
 	private String businessLicense;	
 
 	/**
 	 * 银行编号 
 	 */
+	@Excel(name = "银行编号")
 	private String bankNo;	
 
 	/**
 	 * 银行名称 
 	 */
+	@Excel(name = "银行名称")
 	private String bankName;	
 
 	/**
 	 * 银行账号 
 	 */
+	@Excel(name = "银行账号")
 	private String bankAccount;	
 
 	/**
 	 * 税号 
 	 */
+	@Excel(name = "税号")
 	private String dutyParagraph;	
 
 	/**
 	 * 地址编号 
 	 */
+	@Excel(name = "地址编号")
 	private String addressIds;	
 
 	/**
 	 * 地址 
 	 */
+	@Excel(name = "地址")
 	private String address;	
 
 	/**
 	 * 审核状态(0=未通过,1=已通过) 
 	 */
+	@Excel(name = "审核状态")
 	private Integer judgeStatus;
 
 	/**
 	 * 审核意见 
 	 */
+	@Excel(name = "审核意见")
 	private String judgeContent;	
 
 	/**
 	 * 上次审核时间 
 	 */
+	@Excel(name = "上次审核时间")
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date judgeTime;	
 
 	/**
 	 * 注册时间 
 	 */
+	@Excel(name = "注册时间")
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date registerTime;	
 
 	/**
 	 * 人脸编号 
 	 */
+	@Excel(name = "人脸编号")
 	private String personId;	
 
 	/**
 	 * 创建时间 
 	 */
+	@Excel(name = "创建时间")
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date createTime;
 
 	/**
 	 * 创建人编号 
 	 */
+	@Excel(name = "创建人编号")
 	private String createBy;	
 
 	/**
 	 * 创建人名称 
 	 */
+	@Excel(name = "创建人名称")
 	private String createName;	
 
 	/**
 	 * 更新时间 
 	 */
+	@Excel(name = "更新时间")
 	@JsonFormat(pattern = "yyyy-MM-dd")
 	private Date updateTime;
 
 	/**
 	 * 更新人编号 
 	 */
+	@Excel(name = "更信人编号")
 	private String updateBy;	
 
 	/**
 	 * 更新人名称 
 	 */
+	@Excel(name = "更新人名称")
 	private String updateName;	
 
 	/**
 	 * 删除状态(0=禁用,1=启用) 
 	 */
+	@Excel(name = "删除状态")
 	private Integer deleteStatus;	
 
 

+ 10 - 2
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserController.java

@@ -2,6 +2,8 @@ package com.pj.tb_purchaser;
 
 import java.io.IOException;
 import java.util.List;
+
+import com.pj.common.core.utils.poi.ExcelUtil;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -12,6 +14,8 @@ import com.pj.project4sp.SP;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.servlet.http.HttpServletResponse;
+
 
 /**
  * Controller: tb_purchaser -- 收购商
@@ -111,9 +115,13 @@ public class TbPurchaserController {
 	 */
 	@RequestMapping("purchaserOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(HttpServletResponse response, @RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
+		List<TbPurchaser> list = tbPurchaserService.list();
+		ExcelUtil<TbPurchaser> tbPurchaserExcelUtil = new ExcelUtil<>(TbPurchaser.class);
+		tbPurchaserExcelUtil.exportExcel(response,list,"测试");
+
 		try {
-			String importData = tbPurchaserService.outportExcel(keyword);
+			String importData = tbPurchaserService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 17 - 7
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserService.java

@@ -19,6 +19,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_purchaser -- 收购商
  * @author qzy 
@@ -92,13 +94,18 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "收购商数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\收购商数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
-		List<TbPurchaser> selectedList = tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(StringUtils.isNoneBlank(keyword), TbPurchaser::getName, keyword));
+		List<TbPurchaser> selectedList = tbPurchaserMapper.selectList
+				(new LambdaQueryWrapper<TbPurchaser>().eq(StringUtils.isNoneBlank(keyword), TbPurchaser::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
 		//建立excel对象封装数据
 		HSSFWorkbook workbook = new HSSFWorkbook();
@@ -132,6 +139,8 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
 		row.createCell(19).setCellValue("更新人名称");
 		row.createCell(20).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -160,6 +169,7 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -169,7 +179,7 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 }

+ 40 - 5
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/MethodDriverService.java

@@ -9,6 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 22 12 08
@@ -18,7 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodDriverService {
     
     @Autowired
-    private TbDriverMapper tbDriverMapper;
+    private TbDriverService tbDriverService;
 
 
 
@@ -31,6 +36,9 @@ public class MethodDriverService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbDriver> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -133,11 +141,38 @@ public class MethodDriverService {
             }
             //删除状态,默认可用
             tbDriver.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbDriver);
-            int insert = tbDriverMapper.insert(tbDriver);
-            count += insert;
+			//添加到集合
+			list.add(tbDriver);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbDriver> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbDriverService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
     

+ 2 - 2
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverController.java

@@ -107,9 +107,9 @@ public class TbDriverController {
 	 */
 	@RequestMapping("driverOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbDriverService.outportExcel(keyword);
+			String importData = tbDriverService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 17 - 7
sp-service/transport-server/src/main/java/com/pj/project/tb_driver/TbDriverService.java

@@ -20,6 +20,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_driver -- 司机
  * @author qzy 
@@ -91,13 +93,18 @@ public class TbDriverService extends ServiceImpl<TbDriverMapper, TbDriver> imple
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "货运司机数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\货运司机数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
-		List<TbDriver> selectedList = tbDriverMapper.selectList(new LambdaQueryWrapper<TbDriver>().eq(StringUtils.isNoneBlank(keyword), TbDriver::getName, keyword));
+		List<TbDriver> selectedList = tbDriverMapper.selectList
+				(new LambdaQueryWrapper<TbDriver>().eq(StringUtils.isNoneBlank(keyword), TbDriver::getName, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
 		//建立excel对象封装数据
 		HSSFWorkbook workbook = new HSSFWorkbook();
@@ -135,6 +142,8 @@ public class TbDriverService extends ServiceImpl<TbDriverMapper, TbDriver> imple
 		row.createCell(26).setCellValue("更新人名称");
 		row.createCell(27).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -166,6 +175,7 @@ public class TbDriverService extends ServiceImpl<TbDriverMapper, TbDriver> imple
 			sheetRow.createCell(26).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(27).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(28).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -175,8 +185,8 @@ public class TbDriverService extends ServiceImpl<TbDriverMapper, TbDriver> imple
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 
 }

+ 40 - 5
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/MethodVehicleService.java

@@ -9,6 +9,11 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
 /**
  * @Author Mechrevo
  * @Date 2023 07 22 12 32
@@ -18,7 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
 public class MethodVehicleService {
 
     @Autowired
-    private TbVehicleMapper tbVehicleMapper;
+    private TbVehicleService tbVehicleService;
 
     /**
      * 方法抽取  导入
@@ -29,6 +34,9 @@ public class MethodVehicleService {
      */
     public int importMethod(HSSFRow row, HSSFSheet sheet, int count){
 
+        //创建接收集合
+        List<TbVehicle> list = new ArrayList<>();
+
         for (int i = 1; i < sheet.getPhysicalNumberOfRows(); i++) {
             //封装数据到行对象
             row = sheet.getRow(i);
@@ -102,11 +110,38 @@ public class MethodVehicleService {
             }
             //删除状态,默认可用
             tbVehicle.setDeleteStatus(1);
-//			//添加到集合
-//			list.add(tbVehicle);
-            int insert = tbVehicleMapper.insert(tbVehicle);
-            count += insert;
+			//添加到集合
+			list.add(tbVehicle);
+
         }
+
+        System.out.println("待处理数据量为: " + list.size() + " 条。");
+
+        //创建多线程
+        ExecutorService executorService = Executors.newFixedThreadPool(6);
+
+        //每次100条
+        int bai = 100;
+        //计算需要创建的线程数
+        int threads = (int) Math.ceil((double) list.size() / bai);
+        for (int i = 0; i < threads; i++) {
+            int start = i * bai;
+            int end = Math.min(start + bai,list.size());
+
+            //截取集合数量
+            List<TbVehicle> enterpriseList = list.subList(start, end);
+
+            //多线程执行任务
+            executorService.submit(() -> {
+                tbVehicleService.saveBatch(enterpriseList);
+            });
+            //计数
+            count += enterpriseList.size();
+
+        }
+        //关闭线程池
+        executorService.shutdown();
+
         return count;
     }
 

+ 2 - 4
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleController.java

@@ -4,13 +4,11 @@ import java.io.IOException;
 import java.util.List;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import com.pj.utils.sg.*;
 import com.pj.project4sp.SP;
 
-import com.pj.current.satoken.StpUserUtil;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -106,9 +104,9 @@ public class TbVehicleController {
 	 */
 	@RequestMapping("vehicleOutport")
 	@ResponseBody
-	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword){
+	public AjaxJson dataOutport(@RequestParam(value = "keyword",required = false) String keyword,@RequestParam(value = "filepath",required = false)String filepath){
 		try {
-			String importData = tbVehicleService.outportExcel(keyword);
+			String importData = tbVehicleService.outportExcel(keyword,filepath);
 			AjaxJson.getSuccess(importData);
 		} catch (IOException e) {
 			throw new RuntimeException(e);

+ 15 - 6
sp-service/transport-server/src/main/java/com/pj/project/tb_vehicle/TbVehicleService.java

@@ -21,6 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
 import com.pj.utils.sg.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import javax.swing.filechooser.FileSystemView;
+
 /**
  * Service: tb_vehicle -- 车辆
  * @author loovi 
@@ -93,11 +95,15 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
 	 * @param keyword
 	 * @return
 	 */
-	public String outportExcel(String keyword) throws IOException {
+	public String outportExcel(String keyword,String filepath) throws IOException {
 		System.out.println("\n开始执行文件导出....\n");
-		//路径
-		String localPath = "C:\\Users\\Administrator\\Desktop\\generate\\";
-		String filepath = localPath + "车辆信息数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
+		//导出的文件的路径
+		if(filepath == null){
+			// 获取当前用户的桌面路径
+			FileSystemView fileSystemView = FileSystemView.getFileSystemView();
+			filepath = fileSystemView.getHomeDirectory().getPath();
+		}
+		filepath = filepath + "\\车辆信息数据表_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")) + ".xlsx";
 		//根据需求查询数据
 		List<TbVehicle> selectedList = tbVehicleMapper.selectList(new LambdaQueryWrapper<TbVehicle>().eq(StringUtils.isNoneBlank(keyword), TbVehicle::getOwner, keyword));
 		if(selectedList.size() == 0)return "没有可导出的数据。";
@@ -129,6 +135,8 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
 		row.createCell(18).setCellValue("更新人名称");
 		row.createCell(19).setCellValue("删除状态");
 
+		//定义计数器
+		int count = 0;
 		//遍历集合
 		for (int i = 0; i < selectedList.size(); i++) {
 			HSSFRow sheetRow = sheet.createRow(sheet.getLastRowNum() + 1);
@@ -153,6 +161,7 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
 			sheetRow.createCell(17).setCellValue((selectedList.get(i).getUpdateBy() + "").equals("null")? "": selectedList.get(i).getUpdateBy() + "");
 			sheetRow.createCell(18).setCellValue((selectedList.get(i).getUpdateName() + "").equals("null")? "": selectedList.get(i).getUpdateName() + "");
 			sheetRow.createCell(19).setCellValue((selectedList.get(i).getDeleteStatus() + "").equals("null")? "": selectedList.get(i).getDeleteStatus() + "");
+			count += 1;
 		}
 		//建立输出流,输出文件
 		FileOutputStream fos = new FileOutputStream(filepath);
@@ -162,7 +171,7 @@ public class TbVehicleService extends ServiceImpl<TbVehicleMapper, TbVehicle> im
 		//关闭输出流
 		fos.close();
 		workbook.close();
-		System.out.println("\n数据导出完成!");
-		return "数据导出完成!";
+		System.out.println("\n数据导出完成!共导出 " + count + " 条数据。");
+		return "数据导出完成!共导出 " + count + " 条数据。";
 	}
 }