Explorar el Código

项目费用导入优化,新增导入日志删除功能

lw hace 1 año
padre
commit
0ab972db1f

+ 3 - 3
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -22,8 +22,8 @@ management:
 spring:
   servlet:
     multipart:
-      max-file-size: 10MB
-      max-request-size: 10MB
+      max-file-size: 1024MB
+      max-request-size: 1024MB
   mail:
     host: smtp.163.com
     username: jeecgos@163.com
@@ -110,7 +110,7 @@ spring:
         # 初始化大小,最小,最大
         initial-size: 5
         min-idle: 5
-        maxActive: 20
+        maxActive: 50
         # 配置获取连接等待超时的时间
         maxWait: 60000
         # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒

+ 6 - 0
module_kzks/pom.xml

@@ -20,6 +20,12 @@
 
 
         <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>easyexcel</artifactId>
+            <version>3.3.3</version>
+        </dependency>
+
+        <dependency>
             <groupId>org.jeecgframework.boot</groupId>
             <artifactId>jeecg-system-local-api</artifactId>
         </dependency>

+ 1 - 0
module_kzks/src/main/java/org/jeecg/modules/Index/util/CacheKey.java

@@ -22,4 +22,5 @@ public class CacheKey {
 
     public static final String CLF_COMPARE_RESULT_VOS= "clfCompareResultVOS";
 
+    public static final String ND_KMBH_MONEY_TYPE = "kmbh_nd_money_type";
 }

+ 1 - 1
module_kzks/src/main/java/org/jeecg/modules/costModelProductPrice/service/impl/KzksCostModelProductPriceServiceImpl.java

@@ -99,7 +99,7 @@ public class KzksCostModelProductPriceServiceImpl extends ServiceImpl<KzksCostMo
             BigDecimal oneSwf = BigDecimal.valueOf(0);
             // 单台 -- 外协费
             BigDecimal oneWxf = BigDecimal.valueOf(0);
-            // 单台 -- 外协
+            // 单台 -- 筛选
             BigDecimal oneSxf = BigDecimal.valueOf(0);
             // 单台 -- 专用费
             BigDecimal oneZyf = BigDecimal.valueOf(0);

+ 198 - 184
module_kzks/src/main/java/org/jeecg/modules/projectImportList/controller/ProjectImportListController.java

@@ -30,191 +30,205 @@ import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.File;
+import java.io.IOException;
 import java.util.Arrays;
+import java.util.concurrent.ExecutionException;
 
 /**
  * @Description: 导入并下载
  * @Author: jeecg-boot
- * @Date:   2023-08-10
+ * @Date: 2023-08-10
  * @Version: V1.0
  */
-@Api(tags="导入并下载")
+@Api(tags = "导入并下载")
 @RestController
 @RequestMapping("/projectImportList/projectImportList")
 @Slf4j
 public class ProjectImportListController extends JeecgController<ProjectImportList, IProjectImportListService> {
-	@Autowired
-	private IProjectImportListService projectImportListService;
-	@Autowired
-	@SuppressWarnings("all")
-	private IProjectBudgetService budgetService;
-	@Autowired
-	@SuppressWarnings("all")
-	private JeecgBaseConfig jeecgBaseConfig;
-	@Autowired
-	@SuppressWarnings("all")
-	private IKzksProjectKmbhService kmbhService;
-	@Autowired
-	@SuppressWarnings("all")
-	private ICostModelWxPriceService wxPriceService;
-	@Autowired
-	@SuppressWarnings("all")
-	private IKyTaskTempService kyTaskTempService;
-
-	@Autowired
-	@SuppressWarnings("all")
-	private IKpiImportListService kpiImportListService;
-
-
-
-	 /**
-	  * 通过excel导入其他表的数据
-	  *项目预算 1
-	  *外协费 2
-	  *事务费 3
-	  *专用费 4
-	  * 年指标  8
-	  * @param request
-	  * @param response
-	  * @return
-	  */
-	 @ApiOperation(value="导入并解析数据——专用费4", notes="导入并解析数据——专用费4")
-	 @RequestMapping(value = "/importOtherExcel", method = RequestMethod.POST)
-	 public Result<?> importOtherExcel(@RequestBody ProjectImportList projectImportList,HttpServletRequest request, HttpServletResponse response) {
-
-		 Result<?> result = new Result<>();
-
-		 String url = jeecgBaseConfig.getPath().getUpload() + "/"+  projectImportList.getFileAddress();
-		 //		 String url =  "D:/opt/upFiles/" +
-		 System.out.println(projectImportList.getFileType());
-		 System.out.println("文件地址为:"+url);
-
-		 if(projectImportList.getFileType().equals("1")){ //项目预算
-			 return budgetService.importExcel1(url, ProjectBudget.class);
-		 }else if(projectImportList.getFileType().equals("2")){ //项目费用
-			 return projectImportListService.importExcel1(url, ProjectChb.class);
-		 }else if(projectImportList.getFileType().equals("3")){ //科目编号
-			 return kmbhService.importExcel1(url, KzksProjectKmbh.class);
-		 }else if(projectImportList.getFileType().equals("4")){ //4外协价格库
-			 return wxPriceService.importExcel1(url, CostModelWxPrice.class);
-		 }else if(projectImportList.getFileType().equals("7")){ //7任务关系映射
-			 return kyTaskTempService.importExcel1(url, KyTaskTemp.class);
-		 }else if(projectImportList.getFileType().equals("8")){ //8部门年指标导入表
-			 return kpiImportListService.importExcel1(url, KpiImportList.class);
-		 }else if(projectImportList.getFileType().equals("9")){ //导入数据包至服务器
-			 return result.success("");
-		 }else {
-			 result.setCode(500);
-			 result.setMessage("请选择正确的导入类型!");
-			 return result;
-		 }
-	 }
-
-	/**
-	 * 分页列表查询
-	 *
-	 * @param projectImportList
-	 * @param pageNo
-	 * @param pageSize
-	 * @param req
-	 * @return
-	 */
-	//@AutoLog(value = "导入并下载-分页列表查询")
-	@ApiOperation(value="导入并下载-分页列表查询", notes="导入并下载-分页列表查询")
-	@GetMapping(value = "/list")
-	public Result<IPage<ProjectImportList>> queryPageList(ProjectImportList projectImportList,
-								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
-								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
-								   HttpServletRequest req) {
-		QueryWrapper<ProjectImportList> queryWrapper = QueryGenerator.initQueryWrapper(projectImportList, req.getParameterMap());
-		Page<ProjectImportList> page = new Page<ProjectImportList>(pageNo, pageSize);
-		IPage<ProjectImportList> pageList = projectImportListService.page(page, queryWrapper);
-		return Result.OK(pageList);
-	}
-
-	/**
-	 *   添加
-	 *
-	 * @param projectImportList
-	 * @return
-	 */
-	@AutoLog(value = "导入并下载-添加")
-	@ApiOperation(value="导入并下载-添加", notes="导入并下载-添加")
-	//@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:add")
-	@PostMapping(value = "/add")
-	public Result<String> add(@RequestBody ProjectImportList projectImportList) {
-		projectImportListService.save(projectImportList);
-		return Result.OK("添加成功!");
-	}
-
-	/**
-	 *  编辑
-	 *
-	 * @param projectImportList
-	 * @return
-	 */
-	@AutoLog(value = "导入并下载-编辑")
-	@ApiOperation(value="导入并下载-编辑", notes="导入并下载-编辑")
-	//@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:edit")
-	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
-	public Result<String> edit(@RequestBody ProjectImportList projectImportList) {
-		projectImportListService.updateById(projectImportList);
-		return Result.OK("编辑成功!");
-	}
-
-	/**
-	 *   通过id删除
-	 *
-	 * @param id
-	 * @return
-	 */
-	@AutoLog(value = "导入并下载-通过id删除")
-	@ApiOperation(value="导入并下载-通过id删除", notes="导入并下载-通过id删除")
-	//@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:delete")
-	@DeleteMapping(value = "/delete")
-	public Result<String> delete(@RequestParam(name="id",required=true) String id) {
-		projectImportListService.removeById(id);
-		return Result.OK("删除成功!");
-	}
-
-	/**
-	 *  批量删除
-	 *
-	 * @param ids
-	 * @return
-	 */
-	@AutoLog(value = "导入并下载-批量删除")
-	@ApiOperation(value="导入并下载-批量删除", notes="导入并下载-批量删除")
-	//@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:deleteBatch")
-	@DeleteMapping(value = "/deleteBatch")
-	public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
-		this.projectImportListService.removeByIds(Arrays.asList(ids.split(",")));
-		return Result.OK("批量删除成功!");
-	}
-
-	/**
-	 * 通过id查询
-	 *
-	 * @param id
-	 * @return
-	 */
-	//@AutoLog(value = "导入并下载-通过id查询")
-	@ApiOperation(value="导入并下载-通过id查询", notes="导入并下载-通过id查询")
-	@GetMapping(value = "/queryById")
-	public Result<ProjectImportList> queryById(@RequestParam(name="id",required=true) String id) {
-		ProjectImportList projectImportList = projectImportListService.getById(id);
-		if(projectImportList==null) {
-			return Result.error("未找到对应数据");
-		}
-		return Result.OK(projectImportList);
-	}
+    @Autowired
+    private IProjectImportListService projectImportListService;
+    @Autowired
+    @SuppressWarnings("all")
+    private IProjectBudgetService budgetService;
+    @Autowired
+    @SuppressWarnings("all")
+    private JeecgBaseConfig jeecgBaseConfig;
+    @Autowired
+    @SuppressWarnings("all")
+    private IKzksProjectKmbhService kmbhService;
+    @Autowired
+    @SuppressWarnings("all")
+    private ICostModelWxPriceService wxPriceService;
+    @Autowired
+    @SuppressWarnings("all")
+    private IKyTaskTempService kyTaskTempService;
+
+    @Autowired
+    @SuppressWarnings("all")
+    private IKpiImportListService kpiImportListService;
+
+
+    /**
+     * 通过excel导入其他表的数据
+     * 项目预算 1
+     * 外协费 2
+     * 事务费 3
+     * 专用费 4
+     * 年指标  8
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @ApiOperation(value = "导入并解析数据——专用费4", notes = "导入并解析数据——专用费4")
+    @RequestMapping(value = "/importOtherExcel", method = RequestMethod.POST)
+    public Result<?> importOtherExcel(@RequestBody ProjectImportList projectImportList, HttpServletRequest request, HttpServletResponse response) throws InterruptedException, ExecutionException, IOException {
+
+        Result<?> result = new Result<>();
+
+        String url = jeecgBaseConfig.getPath().getUpload() + "/" + projectImportList.getFileAddress();
+        //		 String url =  "D:/opt/upFiles/" +
+        System.out.println(projectImportList.getFileType());
+        System.out.println("文件地址为:" + url);
+
+        if (projectImportList.getFileType().equals("1")) { //项目预算
+            return budgetService.importExcel1(url, ProjectBudget.class);
+        } else if (projectImportList.getFileType().equals("2")) { //项目费用
+            return projectImportListService.importExcel1(url, ProjectChb.class);
+        } else if (projectImportList.getFileType().equals("3")) { //科目编号
+            return kmbhService.importExcel1(url, KzksProjectKmbh.class);
+        } else if (projectImportList.getFileType().equals("4")) { //4外协价格库
+            return wxPriceService.importExcel1(url, CostModelWxPrice.class);
+        } else if (projectImportList.getFileType().equals("7")) { //7任务关系映射
+            return kyTaskTempService.importExcel1(url, KyTaskTemp.class);
+        } else if (projectImportList.getFileType().equals("8")) { //8部门年指标导入表
+            return kpiImportListService.importExcel1(url, KpiImportList.class);
+        } else if (projectImportList.getFileType().equals("9")) { //导入数据包至服务器
+            return result.success("");
+        } else {
+            result.setCode(500);
+            result.setMessage("请选择正确的导入类型!");
+            return result;
+        }
+    }
+
+    /**
+     * 分页列表查询
+     *
+     * @param projectImportList
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "导入并下载-分页列表查询")
+    @ApiOperation(value = "导入并下载-分页列表查询", notes = "导入并下载-分页列表查询")
+    @GetMapping(value = "/list")
+    public Result<IPage<ProjectImportList>> queryPageList(ProjectImportList projectImportList,
+                                                          @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                          @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                          HttpServletRequest req) {
+        QueryWrapper<ProjectImportList> queryWrapper = QueryGenerator.initQueryWrapper(projectImportList, req.getParameterMap());
+        Page<ProjectImportList> page = new Page<ProjectImportList>(pageNo, pageSize);
+        IPage<ProjectImportList> pageList = projectImportListService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 添加
+     *
+     * @param projectImportList
+     * @return
+     */
+    @AutoLog(value = "导入并下载-添加")
+    @ApiOperation(value = "导入并下载-添加", notes = "导入并下载-添加")
+    //@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:add")
+    @PostMapping(value = "/add")
+    public Result<String> add(@RequestBody ProjectImportList projectImportList) {
+        projectImportListService.save(projectImportList);
+        return Result.OK("添加成功!");
+    }
+
+    /**
+     * 编辑
+     *
+     * @param projectImportList
+     * @return
+     */
+    @AutoLog(value = "导入并下载-编辑")
+    @ApiOperation(value = "导入并下载-编辑", notes = "导入并下载-编辑")
+    //@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:edit")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> edit(@RequestBody ProjectImportList projectImportList) {
+        projectImportListService.updateById(projectImportList);
+        return Result.OK("编辑成功!");
+    }
+
+    /**
+     * 通过id删除
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "导入并下载-通过id删除")
+    @ApiOperation(value = "导入并下载-通过id删除", notes = "导入并下载-通过id删除")
+    //@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:delete")
+    @DeleteMapping(value = "/delete")
+    public Result<String> delete(@RequestParam(name = "id", required = true) String id) {
+        ProjectImportList info = projectImportListService.getById(id);
+        String url = jeecgBaseConfig.getPath().getUpload() + "/" + info.getFileAddress();
+        File file = new File(url);
+        if (!file.exists()) {
+            projectImportListService.removeById(id);
+            return Result.ok("删除成功");
+        }
+        boolean delete = file.delete();
+        if (delete){
+            projectImportListService.removeById(id);
+            return Result.ok("删除成功");
+        }
+        return Result.error("删除失败");
+    }
+
+    /**
+     * 批量删除
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "导入并下载-批量删除")
+    @ApiOperation(value = "导入并下载-批量删除", notes = "导入并下载-批量删除")
+    //@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:deleteBatch")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<String> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.projectImportListService.removeByIds(Arrays.asList(ids.split(",")));
+        return Result.OK("批量删除成功!");
+    }
+
+    /**
+     * 通过id查询
+     *
+     * @param id
+     * @return
+     */
+    //@AutoLog(value = "导入并下载-通过id查询")
+    @ApiOperation(value = "导入并下载-通过id查询", notes = "导入并下载-通过id查询")
+    @GetMapping(value = "/queryById")
+    public Result<ProjectImportList> queryById(@RequestParam(name = "id", required = true) String id) {
+        ProjectImportList projectImportList = projectImportListService.getById(id);
+        if (projectImportList == null) {
+            return Result.error("未找到对应数据");
+        }
+        return Result.OK(projectImportList);
+    }
 
     /**
-    * 导出excel
-    *
-    * @param request
-    * @param projectImportList
-    */
+     * 导出excel
+     *
+     * @param request
+     * @param projectImportList
+     */
     //@RequiresPermissions("org.jeecg.modules:kzks_project_import_list:exportXls")
     @RequestMapping(value = "/exportXls")
     public ModelAndView exportXls(HttpServletRequest request, ProjectImportList projectImportList) {
@@ -222,16 +236,16 @@ public class ProjectImportListController extends JeecgController<ProjectImportLi
     }
 
 
-	/**
-	 * 通过excel导入数据——————原表数据
-	 *
-	 * @param request
-	 * @param response
-	 * @return
-	 */
-	//@RequiresPermissions("kzks_project_import_list:importExcel")
-	@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
-	public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
-		return super.importExcel(request, response, ProjectImportList.class);
-	}
+    /**
+     * 通过excel导入数据——————原表数据
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    //@RequiresPermissions("kzks_project_import_list:importExcel")
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, ProjectImportList.class);
+    }
 }

+ 25 - 0
module_kzks/src/main/java/org/jeecg/modules/projectImportList/dto/ProjectChb.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.projectImportList.dto;
 
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -17,96 +18,120 @@ public class ProjectChb implements Serializable {
     /**id*/
     @TableId(type = IdType.ASSIGN_ID)
     @ApiModelProperty(value = "id")
+    @ExcelProperty(value = "id")
     private java.lang.String id;
     /**创建人*/
     @ApiModelProperty(value = "创建人")
+    @ExcelProperty(value = "创建人")
     private java.lang.String createBy;
     /**创建日期*/
     @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "创建日期")
+    @ExcelProperty(value = "创建日期")
     private java.util.Date createTime;
     /**更新人*/
     @ApiModelProperty(value = "更新人")
+    @ExcelProperty(value = "更新人")
     private java.lang.String updateBy;
     /**更新日期*/
     @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
     @DateTimeFormat(pattern="yyyy-MM-dd")
     @ApiModelProperty(value = "更新日期")
+    @ExcelProperty(value = "更新日期")
     private java.util.Date updateTime;
     /**所属部门*/
     @ApiModelProperty(value = "所属部门")
+    @ExcelProperty(value = "所属部门")
     private java.lang.String sysOrgCode;
     /**年度*/
     @Excel(name = "年度", width = 15)
     @ApiModelProperty(value = "年度")
+    @ExcelProperty(value = "年度")
     private java.lang.String nd;
     /**凭证日期*/
     @Excel(name = "凭证日期", width = 15)
     @ApiModelProperty(value = "凭证日期")
+    @ExcelProperty(value = "凭证日期")
     private java.lang.String pzrq;
     /**凭证号*/
     @Excel(name = "凭证号", width = 15)
     @ApiModelProperty(value = "凭证号")
+    @ExcelProperty(value = "凭证号")
     private java.lang.String pzh;
     /**摘要*/
     @Excel(name = "摘要", width = 15)
     @ApiModelProperty(value = "摘要")
+    @ExcelProperty(value = "摘要")
     private java.lang.String zy;
     /**科目编号*/
     @Excel(name = "科目编号", width = 15)
     @ApiModelProperty(value = "科目编号")
+    @ExcelProperty(value = "科目编号")
     private java.lang.String kmbh;
     /**科目名称*/
     @Excel(name = "科目名称", width = 15)
     @ApiModelProperty(value = "科目名称")
+    @ExcelProperty(value = "科目名称")
     private java.lang.String km;
     /**方向*/
     @Excel(name = "方向", width = 15)
     @ApiModelProperty(value = "方向")
+    @ExcelProperty(value = "方向")
     private java.lang.String fx;
     /**金额*/
     @Excel(name = "金额", width = 15)
     @ApiModelProperty(value = "金额")
+    @ExcelProperty(value = "金额")
     private java.lang.String je;
     /**部门*/
     @Excel(name = "部门", width = 15)
     @ApiModelProperty(value = "部门")
+    @ExcelProperty(value = "部门")
     private java.lang.String bm;
     /**往来单位*/
     @Excel(name = "往来单位", width = 15)
     @ApiModelProperty(value = "往来单位")
+    @ExcelProperty(value = "往来单位")
     private java.lang.String wldw;
     /**辅助金额*/
     @Excel(name = "辅助金额", width = 15)
     @ApiModelProperty(value = "辅助金额")
+    @ExcelProperty(value = "辅助金额")
     private java.lang.String fzje;
     /**制单人*/
     @Excel(name = "制单人", width = 15)
     @ApiModelProperty(value = "制单人")
+    @ExcelProperty(value = "制单人")
     private java.lang.String zdr;
     /**会计期间*/
     @Excel(name = "会计期间", width = 15)
     @ApiModelProperty(value = "会计期间")
+    @ExcelProperty(value = "会计期间")
     private java.lang.String kjqj;
     /**凭证内码*/
     @Excel(name = "凭证内码", width = 15)
     @ApiModelProperty(value = "凭证内码")
+    @ExcelProperty(value = "凭证内码")
     private java.lang.String pznm;
     /**项目编号*/
     @Excel(name = "项目编号", width = 15)
     @ApiModelProperty(value = "项目编号")
+    @ExcelProperty(value = "项目编号")
     private java.lang.String xmbh;
     /**项目名称*/
     @Excel(name = "项目名称", width = 15)
     @ApiModelProperty(value = "项目名称")
+    @ExcelProperty(value = "项目名称")
     private java.lang.String xmmc;
     /**项目类别*/
     @Excel(name = "项目类别", width = 15)
     @ApiModelProperty(value = "项目类别")
+    @ExcelProperty(value = "项目类别")
     private java.lang.String xmlb;
     /**任务号*/
     @Excel(name = "任务号", width = 15)
     @ApiModelProperty(value = "任务号")
+    @ExcelProperty(value = "任务号")
     private java.lang.String taskno;
 }

+ 351 - 0
module_kzks/src/main/java/org/jeecg/modules/projectImportList/readListener/ProjectChbImportListener.java

@@ -0,0 +1,351 @@
+package org.jeecg.modules.projectImportList.readListener;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.jeecg.common.util.RedisUtil;
+import org.jeecg.modules.Index.util.CacheKey;
+import org.jeecg.modules.projectChbGlf.entity.ProjectChbGlf;
+import org.jeecg.modules.projectChbGlf.service.IKzksProjectChbGlfService;
+import org.jeecg.modules.projectChbRdf.entity.ProjectChbRdf;
+import org.jeecg.modules.projectChbRdf.service.IKzksProjectChbRdfService;
+import org.jeecg.modules.projectChbRgf.entity.ProjectChbRgf;
+import org.jeecg.modules.projectChbRgf.service.IKzksProjectChbRgfService;
+import org.jeecg.modules.projectChbSwf.entity.ProjectChbSwf;
+import org.jeecg.modules.projectChbSwf.service.IProjectChbSwfService;
+import org.jeecg.modules.projectChbSxf.entity.ProjectChbSxf;
+import org.jeecg.modules.projectChbSxf.service.IProjectChbSxfService;
+import org.jeecg.modules.projectChbWxf.entity.ProjectChbWxf;
+import org.jeecg.modules.projectChbWxf.service.IProjectChbWxfService;
+import org.jeecg.modules.projectChbZjf.entity.ProjectChbZjf;
+import org.jeecg.modules.projectChbZjf.service.IKzksProjectChbZjfService;
+import org.jeecg.modules.projectChbZyf.entity.ProjectChbZyf;
+import org.jeecg.modules.projectChbZyf.service.IProjectChbZyfService;
+import org.jeecg.modules.projectImportList.convert.CHBConvert;
+import org.jeecg.modules.projectImportList.dto.ProjectChb;
+import org.jeecg.modules.projectImportList.service.impl.ProjectImportListServiceImpl;
+import org.jeecg.modules.projectKmbh.entity.KzksProjectKmbh;
+import org.jeecg.modules.projectKmbh.service.IKzksProjectKmbhService;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import java.util.concurrent.*;
+import java.util.concurrent.atomic.AtomicInteger;
+
+@Slf4j
+public class ProjectChbImportListener extends AnalysisEventListener<ProjectChb> {
+    private static final List<ProjectChbSwf> swfList = new CopyOnWriteArrayList<>();//事务费
+    private static final List<ProjectChbZyf> zyfList = new CopyOnWriteArrayList<>();//专用费
+    private static final List<ProjectChbWxf> wxfList = new CopyOnWriteArrayList<>();//外协费
+    private static final List<ProjectChbRdf> rdfList = new CopyOnWriteArrayList<>();//燃动费
+    private static final List<ProjectChbZjf> zjfList = new CopyOnWriteArrayList<>();//折旧费
+    private static final List<ProjectChbGlf> glfList = new CopyOnWriteArrayList<>();//管理费
+    private static final List<ProjectChbRgf> rgfList = new CopyOnWriteArrayList<>();//人工费
+    private static final List<ProjectChbSxf> sxfList = new CopyOnWriteArrayList<>(); // 筛选费
+
+    private static final ConcurrentSkipListSet<String> swfDe = new ConcurrentSkipListSet<>();//事务费任务号年度集合——用于删除
+    private static final ConcurrentSkipListSet<String> zyfDe = new ConcurrentSkipListSet<>();//专用费任务号年度集合——用于删除
+    private static final ConcurrentSkipListSet<String> wxfDe = new ConcurrentSkipListSet<>();//外协费任务号年度集合——用于删除
+    private static final ConcurrentSkipListSet<String> rdfDe = new ConcurrentSkipListSet<>();//燃动费费任务号年度集合——用于删除
+    private static final ConcurrentSkipListSet<String> zjfDe = new ConcurrentSkipListSet<>();//折旧费任务号年度集合——用于删除
+    private static final ConcurrentSkipListSet<String> glfDe = new ConcurrentSkipListSet<>();//管理费任务号年度集合——用于删除
+    private static final ConcurrentSkipListSet<String> rgfDe = new ConcurrentSkipListSet<>();//人工费任务号年度集合——用于删除
+    private static final ConcurrentSkipListSet<String> sxfDe = new ConcurrentSkipListSet<>();//筛选费任务号年度集合——用于删除
+
+    private final IKzksProjectKmbhService kmbhService;
+    private final IProjectChbSwfService swfService;
+    private final IProjectChbZyfService zyfService;
+    private final IKzksProjectChbRdfService rdfService;
+    private final IKzksProjectChbZjfService zjfService;
+    private final IKzksProjectChbGlfService glfService;
+    private final IKzksProjectChbRgfService rgfService;
+    private final IProjectChbSxfService sxfService;
+    private final IProjectChbWxfService wxfService;
+
+    private final RedisUtil redisUtil;
+    private static final AtomicInteger overTaskCount = new AtomicInteger();
+
+    private final ThreadPoolExecutor threadPoolExecutor;
+
+    public ProjectChbImportListener(IKzksProjectKmbhService kmbhService, IProjectChbSwfService swfService, IProjectChbZyfService zyfService, IKzksProjectChbRdfService rdfService, IKzksProjectChbZjfService zjfService, IKzksProjectChbGlfService glfService, IKzksProjectChbRgfService rgfService, IProjectChbSxfService sxfService, IProjectChbWxfService wxfService, RedisUtil redisUtil, ThreadPoolExecutor threadPoolExecutor) {
+        this.kmbhService = kmbhService;
+        this.swfService = swfService;
+        this.zyfService = zyfService;
+        this.rdfService = rdfService;
+        this.zjfService = zjfService;
+        this.glfService = glfService;
+        this.rgfService = rgfService;
+        this.sxfService = sxfService;
+        this.wxfService = wxfService;
+        this.redisUtil = redisUtil;
+        this.threadPoolExecutor = threadPoolExecutor;
+    }
+
+    @Override
+    public void invoke(ProjectChb projectChb, AnalysisContext analysisContext) {
+        try {
+            String sheetName = analysisContext.readSheetHolder().getSheetName();
+            Integer rowIndex = analysisContext.readRowHolder().getRowIndex();
+            log.info("当前读的是{},第{}行", sheetName, rowIndex);
+            String taskno = projectChb.getTaskno();
+            String nd = projectChb.getNd();
+            String kmbh = projectChb.getKmbh();
+            if (StringUtils.isEmpty(taskno) || StringUtils.isEmpty(nd) || StringUtils.isEmpty(kmbh)) return;
+            if (!taskno.equals("") && !nd.equals("") && !kmbh.equals("")) {
+                String fylb = (String) redisUtil.hget(CacheKey.ND_KMBH_MONEY_TYPE + ":" + nd, kmbh);
+                if (StringUtils.isEmpty(fylb)) return;
+                switch (fylb) {
+                    case "事务费":
+                        swfList.add(CHBConvert.INSTANCE.toSWF(projectChb));
+                        swfDe.add(nd);
+                        break;
+                    case "专用费":
+                        zyfList.add(CHBConvert.INSTANCE.toZYF(projectChb));
+                        zyfDe.add(nd);
+                        break;
+                    case "外协费":
+                        wxfList.add(CHBConvert.INSTANCE.toWXF(projectChb));
+                        wxfDe.add(nd);
+                        break;
+                    case "燃动费":
+                        rdfList.add(CHBConvert.INSTANCE.toRDF(projectChb));
+                        rdfDe.add(nd);
+                        break;
+                    case "折旧费":
+                        zjfList.add(CHBConvert.INSTANCE.toZJF(projectChb));
+                        zjfDe.add(nd);
+                        break;
+                    case "管理费":
+                        glfList.add(CHBConvert.INSTANCE.toGLF(projectChb));
+                        glfDe.add(nd);
+                        break;
+                    case "人工费":
+                        rgfList.add(CHBConvert.INSTANCE.toRGF(projectChb));
+                        rgfDe.add(nd);
+                        break;
+                    case "筛选费":
+                        sxfList.add(CHBConvert.INSTANCE.toSXF(projectChb));
+                        sxfDe.add(nd);
+                        break;
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            clear();
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+        try {
+            log.info("一个sheet执行完毕");
+            int taskCount = ProjectImportListServiceImpl.taskCount;
+            int ovTaskCount = overTaskCount.incrementAndGet();
+            if (taskCount != ovTaskCount) return;
+        } catch (Exception e) {
+            e.printStackTrace();
+            clear();
+            throw new RuntimeException(e);
+        }
+        try {
+            if (!swfDe.isEmpty()) {
+                for (String nd : swfDe) {
+                    int counnt = swfService.getIfHaveThisNd(nd);
+                    if (counnt != 0) {
+                        swfService.deleteSwfByNd(nd);
+                    }
+                }
+            }
+            if (!swfList.isEmpty()) {
+                List<List<ProjectChbSwf>> lists = splitList(swfList);
+                for (List<ProjectChbSwf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        swfService.saveBatch(list);
+                    });
+                }
+            }
+
+            if (!zyfDe.isEmpty()) {
+                for (String nd : zyfDe) {
+                    int count = zyfService.getIfHaveThisNd(nd);
+                    if (count != 0) {
+                        zyfService.deleteZyfByNd(nd);
+                    }
+                }
+            }
+            if (!zyfList.isEmpty()) {
+                List<List<ProjectChbZyf>> lists = splitList(zyfList);
+                for (List<ProjectChbZyf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        zyfService.saveBatch(list);
+                    });
+                }
+            }
+            if (!wxfDe.isEmpty()) {
+                for (String nd : wxfDe) {
+                    int count = wxfService.getIfHaveThisNd(nd);
+                    if (count != 0) {
+                        wxfService.deleteWxfByNd(nd);
+                    }
+                }
+            }
+            if (!wxfList.isEmpty()) {
+                List<List<ProjectChbWxf>> lists = splitList(wxfList);
+                for (List<ProjectChbWxf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        wxfService.saveBatch(list);
+                    });
+                }
+            }
+            if (!rdfDe.isEmpty()) {
+                for (String nd : rdfDe) {
+                    int count = rdfService.getIfHaveThisNd(nd);
+                    if (count != 0) {
+                        rdfService.deleteWxfByNd(nd);
+                    }
+                }
+            }
+
+            if (!rdfList.isEmpty()) {
+                List<List<ProjectChbRdf>> lists = splitList(rdfList);
+                for (List<ProjectChbRdf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        rdfService.saveBatch(list);
+                    });
+                }
+            }
+
+            if (!zjfDe.isEmpty()) {
+                for (String nd : zjfDe) {
+                    int count = zjfService.getIfHaveThisNd(nd);
+                    if (count != 0) {
+                        zjfService.deleteWxfByNd(nd);
+                    }
+                }
+            }
+            if (!zjfList.isEmpty()) {
+                List<List<ProjectChbZjf>> lists = splitList(zjfList);
+                for (List<ProjectChbZjf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        zjfService.saveBatch(list);
+                    });
+                }
+            }
+
+            if (!glfDe.isEmpty()) {
+                for (String nd : glfDe) {
+                    int count = glfService.getIfHaveThisNd(nd);
+                    if (count != 0) {
+                        glfService.deleteWxfByNd(nd);
+                    }
+                }
+            }
+            if (!glfList.isEmpty()) {
+                List<List<ProjectChbGlf>> lists = splitList(glfList);
+                for (List<ProjectChbGlf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        glfService.saveBatch(list);
+                    });
+                }
+            }
+
+            if (!rgfDe.isEmpty()) {
+                for (String nd : rgfDe) {
+                    int count = rgfService.getIfHaveThisNd(nd);
+                    if (count != 0) {
+                        rgfService.deleteWxfByNd(nd);
+                    }
+                }
+            }
+            if (!rgfList.isEmpty()) {
+                List<List<ProjectChbRgf>> lists = splitList(rgfList);
+                for (List<ProjectChbRgf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        rgfService.saveBatch(list);
+                    });
+                }
+            }
+
+            if (!sxfDe.isEmpty()) {
+                for (String nd : sxfDe) {
+                    int count = sxfService.getIfHaveThisNd(nd);
+                    if (count != 0) {
+                        sxfService.deleteWxfByNd(nd);
+                    }
+                }
+            }
+
+            if (!sxfList.isEmpty()) {
+                List<List<ProjectChbSxf>> lists = splitList(sxfList);
+                for (List<ProjectChbSxf> list : lists) {
+                    threadPoolExecutor.submit(() -> {
+                        sxfService.saveBatch(list);
+                    });
+                }
+            }
+            ProjectImportListServiceImpl.taskCount = 0;
+            threadPoolExecutor.shutdown();
+            threadPoolExecutor.awaitTermination(5,TimeUnit.HOURS);
+            log.info("数据成功入库");
+        } catch (InterruptedException e) {
+            throw new RuntimeException(e);
+        } finally {
+            clear();
+            threadPoolExecutor.shutdown();
+        }
+    }
+
+    public void initRedisCache() {
+        List<KzksProjectKmbh> kmbhs = kmbhService.getAll();
+        for (KzksProjectKmbh kmbh : kmbhs) {
+            redisUtil.hset(CacheKey.ND_KMBH_MONEY_TYPE + ":" + kmbh.getYear(), kmbh.getKemuNo(), kmbh.getMoneyType());
+        }
+    }
+
+    public void clear() {
+        swfList.clear();
+        swfDe.clear();
+        wxfList.clear();
+        wxfDe.clear();
+        zyfList.clear();
+        zyfDe.clear();
+        rdfList.clear();
+        rdfDe.clear();
+        rgfList.clear();
+        rgfDe.clear();
+        glfList.clear();
+        glfDe.clear();
+        zjfList.clear();
+        zjfDe.clear();
+        sxfList.clear();
+        sxfDe.clear();
+        redisUtil.removeAll(CacheKey.ND_KMBH_MONEY_TYPE + ":*");
+        overTaskCount.set(0);
+    }
+
+    public <T> List<List<T>> splitList(List<T> list) {
+        List<List<T>> lists = new ArrayList<>();
+        if (list.size() <= 1000) {
+            lists.add(list);
+            return lists;
+        }
+
+        int num = list.size() / 1000;
+        int mo = list.size() % 1000;
+        int mark = num * 1000;
+        if (mo != 0) num++;
+        int start;
+        int end;
+        for (int i = 0; i < num; i++) {
+            start = i * 1000;
+            if (start == mark) end = start + mo;
+            else end = start + 1000;
+            lists.add(list.subList(start, end));
+        }
+        return lists;
+    }
+
+}

+ 3 - 5
module_kzks/src/main/java/org/jeecg/modules/projectImportList/service/IProjectImportListService.java

@@ -6,7 +6,9 @@ import org.jeecg.modules.projectImportList.dto.TasknoAndNd;
 import org.jeecg.modules.projectImportList.entity.ProjectImportList;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.io.IOException;
 import java.util.List;
+import java.util.concurrent.ExecutionException;
 
 /**
  * @Description: 导入并下载
@@ -16,16 +18,12 @@ import java.util.List;
  */
 public interface IProjectImportListService extends IService<ProjectImportList> {
 
-
-    public List<TasknoAndNd> addTNlist(List<TasknoAndNd> tnList, String nd);
-//    public List<TasknoAndNd> addTNlist(List<TasknoAndNd> tnList, String taskno, String nd);
-
     /**
      * 通过excel导入数据
      * 判断费用类别
      * 根据年度、费用类别删除对应数据
      * 对各个表进行新增
      */
-    public Result<?> importExcel1(String strUrl, Class<ProjectChb> clazz);
+    public Result<?> importExcel1(String strUrl, Class<ProjectChb> clazz) throws InterruptedException, ExecutionException, IOException;
 
 }

+ 37 - 174
module_kzks/src/main/java/org/jeecg/modules/projectImportList/service/impl/ProjectImportListServiceImpl.java

@@ -1,41 +1,35 @@
 package org.jeecg.modules.projectImportList.service.impl;
 
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.excel.EasyExcelFactory;
+import com.alibaba.excel.ExcelReader;
+import com.alibaba.excel.cache.MapCache;
+import com.alibaba.excel.read.metadata.ReadSheet;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
-import org.jeecg.modules.projectChbGlf.entity.ProjectChbGlf;
+import org.jeecg.common.util.RedisUtil;
 import org.jeecg.modules.projectChbGlf.service.IKzksProjectChbGlfService;
-import org.jeecg.modules.projectChbRdf.entity.ProjectChbRdf;
 import org.jeecg.modules.projectChbRdf.service.IKzksProjectChbRdfService;
-import org.jeecg.modules.projectChbRgf.entity.ProjectChbRgf;
 import org.jeecg.modules.projectChbRgf.service.IKzksProjectChbRgfService;
-import org.jeecg.modules.projectChbSwf.entity.ProjectChbSwf;
 import org.jeecg.modules.projectChbSwf.service.IProjectChbSwfService;
-import org.jeecg.modules.projectChbSxf.entity.ProjectChbSxf;
 import org.jeecg.modules.projectChbSxf.service.IProjectChbSxfService;
-import org.jeecg.modules.projectChbWxf.entity.ProjectChbWxf;
 import org.jeecg.modules.projectChbWxf.service.IProjectChbWxfService;
-import org.jeecg.modules.projectChbZjf.entity.ProjectChbZjf;
 import org.jeecg.modules.projectChbZjf.service.IKzksProjectChbZjfService;
-import org.jeecg.modules.projectChbZyf.entity.ProjectChbZyf;
 import org.jeecg.modules.projectChbZyf.service.IProjectChbZyfService;
-import org.jeecg.modules.projectImportList.convert.CHBConvert;
 import org.jeecg.modules.projectImportList.dto.ProjectChb;
-import org.jeecg.modules.projectImportList.dto.TasknoAndNd;
 import org.jeecg.modules.projectImportList.entity.ProjectImportList;
 import org.jeecg.modules.projectImportList.mapper.ProjectImportListMapper;
+import org.jeecg.modules.projectImportList.readListener.ProjectChbImportListener;
 import org.jeecg.modules.projectImportList.service.IProjectImportListService;
 import org.jeecg.modules.projectKmbh.service.IKzksProjectKmbhService;
-import org.jeecgframework.poi.excel.ExcelImportUtil;
-import org.jeecgframework.poi.excel.entity.ImportParams;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.*;
+import java.io.*;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.*;
 
 /**
  * @Description: 导入并下载
@@ -69,20 +63,10 @@ public class ProjectImportListServiceImpl extends ServiceImpl<ProjectImportListM
     private IKzksProjectChbRgfService rgfService;
     @Autowired
     private IProjectChbSxfService sxfService;
+    @Autowired
+    private RedisUtil redisUtil;
 
-    //    public List<TasknoAndNd> addTNlist(List<TasknoAndNd> tnList, String taskno, String nd){
-    public List<TasknoAndNd> addTNlist(List<TasknoAndNd> tnList, String nd) {
-        for (TasknoAndNd tasknoAndNd : tnList) {
-            if (nd.equals(tasknoAndNd.getNd())) return tnList;
-//            if(taskno.equals(tasknoAndNd.getTaskno()) && nd.equals(tasknoAndNd.getNd())) return tnList;
-            else continue;
-        }
-        TasknoAndNd tn = new TasknoAndNd();
-        tn.setNd(nd);
-//        tn.setTaskno(taskno);
-        tnList.add(tn);
-        return tnList;
-    }
+    public static int taskCount = 0;
 
     /**
      * 通过excel导入数据
@@ -90,155 +74,34 @@ public class ProjectImportListServiceImpl extends ServiceImpl<ProjectImportListM
      * 根据年度、费用类别删除对应数据
      * 对各个表进行新增
      */
-    public Result<?> importExcel1(String strUrl, Class<ProjectChb> clazz) {
+    public Result<?> importExcel1(String strUrl, Class<ProjectChb> clazz) throws InterruptedException, ExecutionException, IOException {
+        File file = new File(strUrl);
+        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(8, 8, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(100));
+        ThreadPoolExecutor poolExecutor = new ThreadPoolExecutor(8, 8, 60, TimeUnit.SECONDS, new ArrayBlockingQueue<>(2000));
+        ProjectChbImportListener projectChbImportListener =
+                new ProjectChbImportListener(kmbhService, swfService, zyfService, rdfService, zjfService, glfService, rgfService, sxfService, wxfService, redisUtil, poolExecutor);
+        projectChbImportListener.initRedisCache();
+        ExcelReader build = EasyExcel.read(file, clazz, projectChbImportListener).build();
+        List<ReadSheet> readSheets = build.excelExecutor().sheetList();
 
-        InputStream inputStream = null;
-        try {
-            inputStream = new FileInputStream(strUrl);
-        } catch (FileNotFoundException e) {
-            e.printStackTrace();
+        ArrayList<Callable<Object>> task = new ArrayList<>();
+        for (ReadSheet readSheet : readSheets) {
+            task.add(() -> {
+                ExcelReader buildTwo = EasyExcel.read(file, clazz, projectChbImportListener).readCache(new MapCache()).build();
+                buildTwo.read(EasyExcelFactory.readSheet(readSheet.getSheetNo()).build());
+                return null;
+            });
         }
-
-        // 获取上传文件对象
-        ImportParams params = new ImportParams();
-        params.setTitleRows(0);/*表格标题所占行数(默认是0)*/
-        params.setHeadRows(1);/*表头所占据的行数行数,默认1,代表标题占据一行*/
-        params.setNeedSave(true);
+        taskCount = readSheets.size();
         try {
-            List<ProjectChb> list = ExcelImportUtil.importExcel(inputStream, clazz, params);//导入的所有数据
-
-            //间接费用(燃动费、折旧费、管理费、人工费)
-            List<ProjectChbSwf> swfList = new ArrayList<>();//事务费
-            List<ProjectChbZyf> zyfList = new ArrayList<>();//专用费
-            List<ProjectChbWxf> wxfList = new ArrayList<>();//外协费
-            List<ProjectChbRdf> rdfList = new ArrayList<>();//燃动费
-            List<ProjectChbZjf> zjfList = new ArrayList<>();//折旧费
-            List<ProjectChbGlf> glfList = new ArrayList<>();//管理费
-            List<ProjectChbRgf> rgfList = new ArrayList<>();//人工费
-            ArrayList<ProjectChbSxf> sxfList = new ArrayList<>(); // 筛选费
-
-            List<TasknoAndNd> tnSWFList = new ArrayList<>();//事务费任务号年度集合——用于删除
-            List<TasknoAndNd> tnZYFList = new ArrayList<>();//专用费任务号年度集合——用于删除
-            List<TasknoAndNd> tnWXFList = new ArrayList<>();//外协费任务号年度集合——用于删除
-            List<TasknoAndNd> tnRDFList = new ArrayList<>();//燃动费费任务号年度集合——用于删除
-            List<TasknoAndNd> tnZJFList = new ArrayList<>();//折旧费任务号年度集合——用于删除
-            List<TasknoAndNd> tnGLFList = new ArrayList<>();//管理费任务号年度集合——用于删除
-            List<TasknoAndNd> tnRGFList = new ArrayList<>();//人工费任务号年度集合——用于删除
-            List<TasknoAndNd> tnSXFList = new ArrayList<>();//筛选费任务号年度集合——用于删除
-
-            for (ProjectChb chb : list) {
-                String taskno = chb.getTaskno();
-                String nd = chb.getNd();
-                String kmbh = chb.getKmbh();
-                if (taskno != null && !taskno.equals("") && nd != null && !nd.equals("") && kmbh != null && !kmbh.equals("")) {
-                    String fylb = kmbhService.getByNdAndKmbh(nd, kmbh);//费用类别
-                    if (Objects.equals(fylb, "事务费")) {
-                        swfList.add(CHBConvert.INSTANCE.toSWF(chb));
-                        tnSWFList = addTNlist(tnSWFList, nd);
-                    } else if (Objects.equals(fylb, "专用费")) {
-                        zyfList.add(CHBConvert.INSTANCE.toZYF(chb));
-                        tnZYFList = addTNlist(tnZYFList, nd);
-                    } else if (Objects.equals(fylb, "外协费")) {
-                        wxfList.add(CHBConvert.INSTANCE.toWXF(chb));
-                        tnWXFList = addTNlist(tnWXFList, nd);
-                    } else if (Objects.equals(fylb, "燃动费")) {
-                        rdfList.add(CHBConvert.INSTANCE.toRDF(chb));
-                        tnRDFList = addTNlist(tnRDFList, nd);
-                    } else if (Objects.equals(fylb, "折旧费")) {
-                        zjfList.add(CHBConvert.INSTANCE.toZJF(chb));
-                        tnZJFList = addTNlist(tnZJFList, nd);
-                    } else if (Objects.equals(fylb, "管理费")) {
-                        glfList.add(CHBConvert.INSTANCE.toGLF(chb));
-                        tnGLFList = addTNlist(tnGLFList, nd);
-                    } else if (Objects.equals(fylb, "人工费")) {
-                        rgfList.add(CHBConvert.INSTANCE.toRGF(chb));
-                        tnRGFList = addTNlist(tnRGFList, nd);
-                    }else if (Objects.equals(fylb, "筛选费")) {
-                        sxfList.add(CHBConvert.INSTANCE.toSXF(chb));
-                        tnSXFList = addTNlist(tnSXFList, nd);
-                    }
-                }
-            }
-
-            //update-begin-author:taoyan date:20190528 for:批量插入数据
-            long start = System.currentTimeMillis();
-            for (TasknoAndNd tasknoAndNd : tnSWFList) {
-                // 如果导入的年份在数据库当中存在,则删除掉该年份的数据,然后重新导入
-                int counnt = swfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (counnt != 0) {
-                    swfService.deleteSwfByNd(tasknoAndNd.getNd());
-                }
+            List<Future<Object>> futures = threadPoolExecutor.invokeAll(task);
+            for (Future<Object> future : futures) {
+                future.get();
             }
-            swfService.saveBatch(swfList);
-            for (TasknoAndNd tasknoAndNd : tnZYFList) {
-                int count = zyfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (count != 0) {
-                    zyfService.deleteZyfByNd(tasknoAndNd.getNd());
-                }
-            }
-            zyfService.saveBatch(zyfList);
-            for (TasknoAndNd tasknoAndNd : tnWXFList) {
-                int count = wxfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (count != 0) {
-                    wxfService.deleteWxfByNd(tasknoAndNd.getNd());
-                }
-            }
-            wxfService.saveBatch(wxfList);
-            for (TasknoAndNd tasknoAndNd : tnRDFList) {
-                int count = rdfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (count != 0) {
-                    rdfService.deleteWxfByNd(tasknoAndNd.getNd());
-                }
-            }
-            rdfService.saveBatch(rdfList);
-            for (TasknoAndNd tasknoAndNd : tnZJFList) {
-                int count = zjfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (count != 0) {
-                    zjfService.deleteWxfByNd(tasknoAndNd.getNd());
-                }
-            }
-            zjfService.saveBatch(zjfList);
-            for (TasknoAndNd tasknoAndNd : tnGLFList) {
-                int count = glfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (count != 0) {
-                    glfService.deleteWxfByNd(tasknoAndNd.getNd());
-                }
-            }
-            glfService.saveBatch(glfList);
-            for (TasknoAndNd tasknoAndNd : tnRGFList) {
-                int count = rgfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (count != 0) {
-                    rgfService.deleteWxfByNd(tasknoAndNd.getNd());
-                }
-            }
-            rgfService.saveBatch(rgfList);
-            for (TasknoAndNd tasknoAndNd : tnSXFList) {
-                int count = sxfService.getIfHaveThisNd(tasknoAndNd.getNd());
-                if (count != 0) {
-                    sxfService.deleteWxfByNd(tasknoAndNd.getNd());
-                }
-            }
-            sxfService.saveBatch(sxfList);
-            log.info("消耗时间" + (System.currentTimeMillis() - start) + "毫秒," + "数据行数:" + list.size());
-            //update-end-author:taoyan date:20190528 for:批量插入数据
-            return Result.ok("文件导入成功!数据行数:" + list.size());
-        } catch (Exception e) {
-            //update-begin-author:taoyan date:20211124 for: 导入数据重复增加提示
-            String msg = e.getMessage();
-            log.error(msg, e);
-            if (msg != null && msg.indexOf("Duplicate entry") >= 0) {
-                return Result.error("文件导入失败:有重复数据!");
-            } else {
-                return Result.error("文件导入失败:" + e.getMessage());
-            }
-            //update-end-author:taoyan date:20211124 for: 导入数据重复增加提示
+            threadPoolExecutor.shutdown();
         } finally {
-            try {
-                inputStream.close();
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
+            taskCount = 0;
         }
+        return Result.ok();
     }
-
 }

+ 3 - 0
module_kzks/src/main/java/org/jeecg/modules/projectKmbh/mapper/KzksProjectKmbhMapper.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
+import org.jeecg.modules.projectImportList.dto.ProjectChb;
 import org.jeecg.modules.projectKmbh.entity.KzksProjectKmbh;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 
@@ -23,4 +24,6 @@ public interface KzksProjectKmbhMapper extends BaseMapper<KzksProjectKmbh> {
     @Select("select money_type from kzks_project_kmbh where year = #{nd} and kemu_no = #{kmbh}")
     public String getByNdAndKmbh(String nd, String kmbh);
 
+    @Select("select money_type,year,kemu_no from kzks_project_kmbh")
+    List<KzksProjectKmbh> getAll();
 }

+ 4 - 0
module_kzks/src/main/java/org/jeecg/modules/projectKmbh/service/IKzksProjectKmbhService.java

@@ -2,8 +2,11 @@ package org.jeecg.modules.projectKmbh.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.modules.projectImportList.dto.ProjectChb;
 import org.jeecg.modules.projectKmbh.entity.KzksProjectKmbh;
 
+import java.util.List;
+
 /**
  * @Description: 科目编号
  * @Author: jeecg-boot
@@ -22,4 +25,5 @@ public interface IKzksProjectKmbhService extends IService<KzksProjectKmbh> {
     /**根据年度和科目编号查询费用类别*/
     public String getByNdAndKmbh(String nd, String kmbh);
 
+    List<KzksProjectKmbh> getAll();
 }

+ 5 - 0
module_kzks/src/main/java/org/jeecg/modules/projectKmbh/service/impl/KzksProjectKmbhServiceImpl.java

@@ -3,6 +3,7 @@ package org.jeecg.modules.projectKmbh.service.impl;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.projectChbZyf.entity.ProjectChbZyf;
+import org.jeecg.modules.projectImportList.dto.ProjectChb;
 import org.jeecg.modules.projectKmbh.entity.KzksProjectKmbh;
 import org.jeecg.modules.projectKmbh.mapper.KzksProjectKmbhMapper;
 import org.jeecg.modules.projectKmbh.service.IKzksProjectKmbhService;
@@ -93,4 +94,8 @@ public class KzksProjectKmbhServiceImpl extends ServiceImpl<KzksProjectKmbhMappe
         return kmbhMapper.getByNdAndKmbh(nd,kmbh);
     }
 
+    @Override
+    public List<KzksProjectKmbh> getAll() {
+        return kmbhMapper.getAll();
+    }
 }

+ 0 - 23
module_kzks/src/main/java/org/jeecg/modules/wzOutboundOrder/controller/WzOutboundOrderHController.java

@@ -392,29 +392,6 @@ public class WzOutboundOrderHController extends JeecgController<WzOutboundOrderH
     @GetMapping(value = "/getCLFList")
     public List<WzOutboundOrderBDetailListVO> getCLFList(String taskno) {
         return wzOutboundOrderHService.getClfList(taskno);
-
-
-/*        List<WzOutboundOrderBDetailListVO> bList = new ArrayList<>();
-
-        QueryWrapper<WzOutboundOrderH> wrapper = new QueryWrapper<>();
-        wrapper.eq("rwh", taskno);
-        List<WzOutboundOrderH> list = wzOutboundOrderHService.wzHlist(wrapper);
-        List<WzOutboundOrderH> list1 = new ArrayList<>();
-        if (list != null && !list.isEmpty()) {
-            for (WzOutboundOrderH h : list) {
-                //出库单号对应的物料单数量——大于5000被认为是异常数据,舍弃
-                Integer count = bService.getckDetailDataCountByCkdh(h.getCkdh());
-                if (count > 5000) continue;
-                list1.add(h);
-                System.out.println(count);
-            }
-            if (!list1.isEmpty()) {
-                List<String> list2 = list1.stream().map(i -> i.getCkdh()).collect(Collectors.toList());
-                if (!list2.isEmpty()) bList = bService.wzDetailList(list2);
-            }
-        }*/
-
-        //return bList;
     }
 
     /**