浏览代码

导师带徒 模板数据导入

jiangbiao 11 月之前
父节点
当前提交
c911f88ab3
共有 20 个文件被更改,包括 664 次插入242 次删除
  1. 15 0
      master/src/main/java/com/ruoyi/project/common/CommonController.java
  2. 7 5
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFirstplanController.java
  3. 88 1
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFirstplanTmplController.java
  4. 7 5
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFlplanController.java
  5. 107 26
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFlplanTmplController.java
  6. 7 6
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFtplanController.java
  7. 108 26
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFtplanTmplController.java
  8. 7 5
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsLjplanController.java
  9. 108 26
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsLjplanTmplController.java
  10. 7 5
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsYsplanController.java
  11. 107 26
      master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsYsplanTmplController.java
  12. 11 22
      master/src/main/java/com/ruoyi/project/training/bccnew/domain/TTsFirstplanTmpl.java
  13. 1 4
      master/src/main/java/com/ruoyi/project/training/bccnew/domain/TTsFlplanTmpl.java
  14. 二进制
      master/src/main/resources/static/template/training/bccnewDsdt.xlsx
  15. 二进制
      master/src/main/resources/static/template/training/bccnewJz.xlsx
  16. 12 9
      ui/src/views/training/bccnew/firstPlanTmpl/index.vue
  17. 18 19
      ui/src/views/training/bccnew/flPlan/index.vue
  18. 18 19
      ui/src/views/training/bccnew/ftPlan/index.vue
  19. 18 19
      ui/src/views/training/bccnew/ljPlan/index.vue
  20. 18 19
      ui/src/views/training/bccnew/ysPlan/index.vue

+ 15 - 0
master/src/main/java/com/ruoyi/project/common/CommonController.java

@@ -315,6 +315,21 @@ public class CommonController extends BaseController
         }else if( type.equals("trainingMatrix") ) {
             downloadname = "培训矩阵导入模板.xlsx";
             url = "static/template/training/trainingMatrix.xlsx";
+        }else if( type.equals("ljPlanTmpl") ) {
+            downloadname = "裂解培训导入模板.xlsx";
+            url = "static/template/training/bccnewDsdt.xlsx";
+        }else if( type.equals("ysPlanTmpl") ) {
+            downloadname = "压缩培训导入模板.xlsx";
+            url = "static/template/training/bccnewDsdt.xlsx";
+        }else if( type.equals("flPlanTmpl") ) {
+            downloadname = "分离培训导入模板.xlsx";
+            url = "static/template/training/bccnewDsdt.xlsx";
+        }else if( type.equals("ftPlanTmpl") ) {
+            downloadname = "芳烃培训导入模板.xlsx";
+            url = "static/template/training/bccnewDsdt.xlsx";
+        }else if( type.equals("jzPlanTmpl") ) {
+            downloadname = "装置级培训导入模板.xlsx";
+            url = "static/template/training/bccnewJz.xlsx";
         }
 
         InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(url);

+ 7 - 5
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFirstplanController.java

@@ -103,11 +103,13 @@ public class TTsFirstplanController extends BaseController {
         if (userId.equals(sysUser.getUserId())) {
             TTsFirstplan need = tTsFirstplanService.selectTTsFirstplanById(tTsFirstplan.getId());
             long timer = need.getTimer() == null ? 0 : need.getTimer();
-            need.setTimer(timer + 1);
-            if (need.getTimerNeed() == null)
-                need.setTimerNeed(0L);
-            if (need.getTimerNeed() != null && need.getTimerNeed() <= timer + 1) {
-                need.setPlanStatus(2L);
+            if (timer < need.getTimerNeed()) {
+                need.setTimer(timer + 1);
+                if (need.getTimerNeed() == null)
+                    need.setTimerNeed(0L);
+                if (need.getTimerNeed() != null && need.getTimerNeed() <= timer + 1) {
+                    need.setPlanStatus(2L);
+                }
             }
             return toAjax(tTsFirstplanService.updateTTsFirstplan(need));
         }

+ 88 - 1
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFirstplanTmplController.java

@@ -1,5 +1,7 @@
 package com.ruoyi.project.training.bccnew.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
@@ -8,15 +10,20 @@ import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
-import com.ruoyi.project.ehs.domain.TRcfile;
 import com.ruoyi.project.training.bccnew.domain.TTsFirstplanTmpl;
 import com.ruoyi.project.training.bccnew.service.ITTsFirstplanTmplService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -106,4 +113,84 @@ public class TTsFirstplanTmplController extends BaseController {
         }
         return AjaxResult.error("上传失败,请联系管理员");
     }
+
+
+    @PreAuthorize("@ss.hasPermi('training:firstPlanTmpl:add')")
+    @Log(title = "进组培训模版", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<Integer>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TTsFirstplanTmpl> list = new ArrayList<>();
+        int rowNum = sheet.getLastRowNum();
+        int failNumber = 0;
+        for (int i = 1; i <= rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                if (row == null) {
+                    sheet.removeRow(row);
+                    rowNum++;
+                    continue;
+                }
+                int cellNum = row.getLastCellNum();
+                TTsFirstplanTmpl entity = new TTsFirstplanTmpl();
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        entity.setSortTmpl(cellValue);
+                    } else if (j == 1) {
+                        entity.setCourseCode(cellValue);
+                    } else if (j == 2) {
+                        entity.setTopic(cellValue);
+                    } else if (j == 3) {
+                        entity.setMaterialVer(cellValue);
+                    } else if (j == 4) {
+                        entity.setCourseHour(Long.valueOf(cellValue));
+                    } else if (j == 5) {
+                        entity.setTrainer(cellValue);
+                    } else if (j == 6) {
+                        entity.setExamType(cellValue);
+                    } else if (j == 7) {
+                        entity.setTimerNeed(Long.valueOf(cellValue));
+                    } else if (j == 8) {
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(userId.toString());
+                entity.setCreatedate(new Date());
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TTsFirstplanTmpl t : list) {
+            failNum++;
+            try {
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:{}", successNumber);
+        logger.info("failNumber:{}", failNumber);
+        logger.info("failRow:{}", failRow);
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 7 - 5
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFlplanController.java

@@ -89,11 +89,13 @@ public class TTsFlplanController extends BaseController {
         if (userId.equals(sysUser.getUserId())) {
             TTsFlplan need = tTsFlplanService.selectTTsFlplanById(tTsFlplan.getId());
             long timer = need.getTimer() == null ? 0 : need.getTimer();
-            need.setTimer(timer + 1);
-            if (need.getTimerNeed()==null)
-                need.setTimerNeed(0L);
-            if (need.getTimerNeed() != null && need.getTimerNeed()<=timer + 1) {
-                need.setPlanStatus(2L);
+            if (timer < need.getTimerNeed()) {
+                need.setTimer(timer + 1);
+                if (need.getTimerNeed() == null)
+                    need.setTimerNeed(0L);
+                if (need.getTimerNeed() != null && need.getTimerNeed() <= timer + 1) {
+                    need.setPlanStatus(2L);
+                }
             }
             return toAjax(tTsFlplanService.updateTTsFlplan(need));
         }

+ 107 - 26
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFlplanTmplController.java

@@ -1,24 +1,31 @@
 package com.ruoyi.project.training.bccnew.controller;
 
-import java.io.IOException;
-import java.util.List;
-
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.framework.config.RuoYiConfig;
-import com.ruoyi.project.training.bccnew.domain.TTsFirstplanTmpl;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.project.training.bccnew.domain.TTsFlplanTmpl;
-import com.ruoyi.project.training.bccnew.service.ITTsFlplanTmplService;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.training.bccnew.domain.TTsFlplanTmpl;
+import com.ruoyi.project.training.bccnew.service.ITTsFlplanTmplService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * 分离培训模版Controller
  *
@@ -27,8 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
  */
 @RestController
 @RequestMapping("/training/flPlan")
-public class TTsFlplanTmplController extends BaseController
-{
+public class TTsFlplanTmplController extends BaseController {
     @Autowired
     private ITTsFlplanTmplService tTsFlplanTmplService;
 
@@ -37,8 +43,7 @@ public class TTsFlplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('training:flPlan:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TTsFlplanTmpl tTsFlplanTmpl)
-    {
+    public TableDataInfo list(TTsFlplanTmpl tTsFlplanTmpl) {
         startPage();
         List<TTsFlplanTmpl> list = tTsFlplanTmplService.selectTTsFlplanTmplList(tTsFlplanTmpl);
         return getDataTable(list);
@@ -50,8 +55,7 @@ public class TTsFlplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('training:flPlan:export')")
     @Log(title = "分离培训模版", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(TTsFlplanTmpl tTsFlplanTmpl)
-    {
+    public AjaxResult export(TTsFlplanTmpl tTsFlplanTmpl) {
         List<TTsFlplanTmpl> list = tTsFlplanTmplService.selectTTsFlplanTmplList(tTsFlplanTmpl);
         ExcelUtil<TTsFlplanTmpl> util = new ExcelUtil<TTsFlplanTmpl>(TTsFlplanTmpl.class);
         return util.exportExcel(list, "flPlan");
@@ -62,8 +66,7 @@ public class TTsFlplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('training:flPlan:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(tTsFlplanTmplService.selectTTsFlplanTmplById(id));
     }
 
@@ -73,8 +76,7 @@ public class TTsFlplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('training:flPlan:add')")
     @Log(title = "分离培训模版", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TTsFlplanTmpl tTsFlplanTmpl)
-    {
+    public AjaxResult add(@RequestBody TTsFlplanTmpl tTsFlplanTmpl) {
         return toAjax(tTsFlplanTmplService.insertTTsFlplanTmpl(tTsFlplanTmpl));
     }
 
@@ -84,8 +86,7 @@ public class TTsFlplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('training:flPlan:edit')")
     @Log(title = "分离培训模版", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TTsFlplanTmpl tTsFlplanTmpl)
-    {
+    public AjaxResult edit(@RequestBody TTsFlplanTmpl tTsFlplanTmpl) {
         return toAjax(tTsFlplanTmplService.updateTTsFlplanTmpl(tTsFlplanTmpl));
     }
 
@@ -94,9 +95,8 @@ public class TTsFlplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('training:flPlan:remove')")
     @Log(title = "分离培训模版", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tTsFlplanTmplService.deleteTTsFlplanTmplByIds(ids));
     }
 
@@ -113,4 +113,85 @@ public class TTsFlplanTmplController extends BaseController
         }
         return AjaxResult.error("上传失败,请联系管理员");
     }
+
+    @PreAuthorize("@ss.hasPermi('training:flPlan:add')")
+    @Log(title = "分离培训模版", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<Integer>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TTsFlplanTmpl> list = new ArrayList<>();
+        int rowNum = sheet.getLastRowNum();
+        int failNumber = 0;
+        for (int i = 1; i <= rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                if (row == null) {
+                    sheet.removeRow(row);
+                    rowNum++;
+                    continue;
+                }
+                int cellNum = row.getLastCellNum();
+                TTsFlplanTmpl entity = new TTsFlplanTmpl();
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        entity.setSortTmpl(cellValue);
+                    } else if (j == 1) {
+                        entity.setCourseCode(cellValue);
+                    } else if (j == 2) {
+                        entity.setTopic(cellValue);
+                    } else if (j == 3) {
+                        entity.setContent(cellValue);
+                    } else if (j == 4) {
+                        entity.setCourseDay(Long.valueOf(cellValue));
+                    } else if (j == 5) {
+                        entity.setCourseHour(Long.valueOf(cellValue));
+                    } else if (j == 6) {
+                        entity.setDetailPlan(cellValue);
+                    } else if (j == 7) {
+                        entity.setTrainer(cellValue);
+                    } else if (j == 8) {
+                        entity.setTimerNeed(Long.valueOf(cellValue));
+                    } else if (j == 9) {
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(userId.toString());
+                entity.setCreatedate(new Date());
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TTsFlplanTmpl t : list) {
+            failNum++;
+            try {
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:{}", successNumber);
+        logger.info("failNumber:{}", failNumber);
+        logger.info("failRow:{}", failRow);
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 7 - 6
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFtplanController.java

@@ -8,7 +8,6 @@ import com.ruoyi.framework.web.domain.AjaxResult;
 import com.ruoyi.framework.web.page.TableDataInfo;
 import com.ruoyi.project.system.domain.SysUser;
 import com.ruoyi.project.system.service.ISysUserService;
-import com.ruoyi.project.training.bccnew.domain.TTsFlplan;
 import com.ruoyi.project.training.bccnew.domain.TTsFtplan;
 import com.ruoyi.project.training.bccnew.domain.TTsNew;
 import com.ruoyi.project.training.bccnew.service.ITTsApproveService;
@@ -89,11 +88,13 @@ public class TTsFtplanController extends BaseController {
         if (userId.equals(sysUser.getUserId())) {
             TTsFtplan need = tTsFtplanService.selectTTsFtplanById(tTsFtplan.getId());
             long timer = need.getTimer() == null ? 0 : need.getTimer();
-            need.setTimer(timer + 1);
-            if (need.getTimerNeed()==null)
-                need.setTimerNeed(0L);
-            if (need.getTimerNeed() != null && need.getTimerNeed()<=timer + 1) {
-                need.setPlanStatus(2L);
+            if (timer < need.getTimerNeed()) {
+                need.setTimer(timer + 1);
+                if (need.getTimerNeed() == null)
+                    need.setTimerNeed(0L);
+                if (need.getTimerNeed() != null && need.getTimerNeed() <= timer + 1) {
+                    need.setPlanStatus(2L);
+                }
             }
             return toAjax(tTsFtplanService.updateTTsFtplan(need));
         }

+ 108 - 26
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsFtplanTmplController.java

@@ -1,24 +1,31 @@
 package com.ruoyi.project.training.bccnew.controller;
 
-import java.io.IOException;
-import java.util.List;
-
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.framework.config.RuoYiConfig;
-import com.ruoyi.project.training.bccnew.domain.TTsFlplanTmpl;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.project.training.bccnew.domain.TTsFtplanTmpl;
-import com.ruoyi.project.training.bccnew.service.ITTsFtplanTmplService;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.training.bccnew.domain.TTsFtplanTmpl;
+import com.ruoyi.project.training.bccnew.service.ITTsFtplanTmplService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * 芳烃培训模版Controller
  *
@@ -27,8 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
  */
 @RestController
 @RequestMapping("/bccnew/ftPlan")
-public class TTsFtplanTmplController extends BaseController
-{
+public class TTsFtplanTmplController extends BaseController {
     @Autowired
     private ITTsFtplanTmplService tTsFtplanTmplService;
 
@@ -37,8 +43,7 @@ public class TTsFtplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ftPlan:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TTsFtplanTmpl tTsFtplanTmpl)
-    {
+    public TableDataInfo list(TTsFtplanTmpl tTsFtplanTmpl) {
         startPage();
         List<TTsFtplanTmpl> list = tTsFtplanTmplService.selectTTsFtplanTmplList(tTsFtplanTmpl);
         return getDataTable(list);
@@ -50,8 +55,7 @@ public class TTsFtplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ftPlan:export')")
     @Log(title = "芳烃培训模版", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(TTsFtplanTmpl tTsFtplanTmpl)
-    {
+    public AjaxResult export(TTsFtplanTmpl tTsFtplanTmpl) {
         List<TTsFtplanTmpl> list = tTsFtplanTmplService.selectTTsFtplanTmplList(tTsFtplanTmpl);
         ExcelUtil<TTsFtplanTmpl> util = new ExcelUtil<TTsFtplanTmpl>(TTsFtplanTmpl.class);
         return util.exportExcel(list, "ftPlan");
@@ -62,8 +66,7 @@ public class TTsFtplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ftPlan:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(tTsFtplanTmplService.selectTTsFtplanTmplById(id));
     }
 
@@ -73,8 +76,7 @@ public class TTsFtplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ftPlan:add')")
     @Log(title = "芳烃培训模版", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TTsFtplanTmpl tTsFtplanTmpl)
-    {
+    public AjaxResult add(@RequestBody TTsFtplanTmpl tTsFtplanTmpl) {
         return toAjax(tTsFtplanTmplService.insertTTsFtplanTmpl(tTsFtplanTmpl));
     }
 
@@ -84,8 +86,7 @@ public class TTsFtplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ftPlan:edit')")
     @Log(title = "芳烃培训模版", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TTsFtplanTmpl tTsFtplanTmpl)
-    {
+    public AjaxResult edit(@RequestBody TTsFtplanTmpl tTsFtplanTmpl) {
         return toAjax(tTsFtplanTmplService.updateTTsFtplanTmpl(tTsFtplanTmpl));
     }
 
@@ -94,9 +95,8 @@ public class TTsFtplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ftPlan:remove')")
     @Log(title = "芳烃培训模版", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tTsFtplanTmplService.deleteTTsFtplanTmplByIds(ids));
     }
 
@@ -113,4 +113,86 @@ public class TTsFtplanTmplController extends BaseController
         }
         return AjaxResult.error("上传失败,请联系管理员");
     }
+
+
+    @PreAuthorize("@ss.hasPermi('training:ftPlan:add')")
+    @Log(title = "芳烃培训模版", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<Integer>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TTsFtplanTmpl> list = new ArrayList<>();
+        int rowNum = sheet.getLastRowNum();
+        int failNumber = 0;
+        for (int i = 1; i <= rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                if (row == null) {
+                    sheet.removeRow(row);
+                    rowNum++;
+                    continue;
+                }
+                int cellNum = row.getLastCellNum();
+                TTsFtplanTmpl entity = new TTsFtplanTmpl();
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        entity.setSortTmpl(cellValue);
+                    } else if (j == 1) {
+                        entity.setCourseCode(cellValue);
+                    } else if (j == 2) {
+                        entity.setTopic(cellValue);
+                    } else if (j == 3) {
+                        entity.setContent(cellValue);
+                    } else if (j == 4) {
+                        entity.setCourseDay(Long.valueOf(cellValue));
+                    } else if (j == 5) {
+                        entity.setCourseHour(Long.valueOf(cellValue));
+                    } else if (j == 6) {
+                        entity.setDetailPlan(cellValue);
+                    } else if (j == 7) {
+                        entity.setTrainer(cellValue);
+                    } else if (j == 8) {
+                        entity.setTimerNeed(Long.valueOf(cellValue));
+                    } else if (j == 9) {
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(userId.toString());
+                entity.setCreatedate(new Date());
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TTsFtplanTmpl t : list) {
+            failNum++;
+            try {
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:{}", successNumber);
+        logger.info("failNumber:{}", failNumber);
+        logger.info("failRow:{}", failRow);
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 7 - 5
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsLjplanController.java

@@ -92,11 +92,13 @@ public class TTsLjplanController extends BaseController {
         if (userId.equals(sysUser.getUserId())) {
             TTsLjplan need = tTsLjplanService.selectTTsLjplanById(tTsLjplan.getId());
             long timer = need.getTimer() == null ? 0 : need.getTimer();
-            need.setTimer(timer + 1);
-            if (need.getTimerNeed()==null)
-                need.setTimerNeed(0L);
-            if (need.getTimerNeed() != null && need.getTimerNeed()<=timer + 1) {
-                need.setPlanStatus(2L);
+            if (timer < need.getTimerNeed()) {
+                need.setTimer(timer + 1);
+                if (need.getTimerNeed() == null)
+                    need.setTimerNeed(0L);
+                if (need.getTimerNeed() != null && need.getTimerNeed() <= timer + 1) {
+                    need.setPlanStatus(2L);
+                }
             }
             return toAjax(tTsLjplanService.updateTTsLjplan(need));
         }

+ 108 - 26
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsLjplanTmplController.java

@@ -1,24 +1,31 @@
 package com.ruoyi.project.training.bccnew.controller;
 
-import java.io.IOException;
-import java.util.List;
-
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.framework.config.RuoYiConfig;
-import com.ruoyi.project.training.bccnew.domain.TTsFlplanTmpl;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.project.training.bccnew.domain.TTsLjplanTmpl;
-import com.ruoyi.project.training.bccnew.service.ITTsLjplanTmplService;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.training.bccnew.domain.TTsLjplanTmpl;
+import com.ruoyi.project.training.bccnew.service.ITTsLjplanTmplService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * 裂解培训模版Controller
  *
@@ -27,8 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
  */
 @RestController
 @RequestMapping("/bccnew/ljPlan")
-public class TTsLjplanTmplController extends BaseController
-{
+public class TTsLjplanTmplController extends BaseController {
     @Autowired
     private ITTsLjplanTmplService tTsLjplanTmplService;
 
@@ -37,8 +43,7 @@ public class TTsLjplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ljPlan:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TTsLjplanTmpl tTsLjplanTmpl)
-    {
+    public TableDataInfo list(TTsLjplanTmpl tTsLjplanTmpl) {
         startPage();
         List<TTsLjplanTmpl> list = tTsLjplanTmplService.selectTTsLjplanTmplList(tTsLjplanTmpl);
         return getDataTable(list);
@@ -50,8 +55,7 @@ public class TTsLjplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ljPlan:export')")
     @Log(title = "裂解培训模版", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(TTsLjplanTmpl tTsLjplanTmpl)
-    {
+    public AjaxResult export(TTsLjplanTmpl tTsLjplanTmpl) {
         List<TTsLjplanTmpl> list = tTsLjplanTmplService.selectTTsLjplanTmplList(tTsLjplanTmpl);
         ExcelUtil<TTsLjplanTmpl> util = new ExcelUtil<TTsLjplanTmpl>(TTsLjplanTmpl.class);
         return util.exportExcel(list, "ljPlan");
@@ -62,8 +66,7 @@ public class TTsLjplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ljPlan:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(tTsLjplanTmplService.selectTTsLjplanTmplById(id));
     }
 
@@ -73,8 +76,7 @@ public class TTsLjplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ljPlan:add')")
     @Log(title = "裂解培训模版", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TTsLjplanTmpl tTsLjplanTmpl)
-    {
+    public AjaxResult add(@RequestBody TTsLjplanTmpl tTsLjplanTmpl) {
         return toAjax(tTsLjplanTmplService.insertTTsLjplanTmpl(tTsLjplanTmpl));
     }
 
@@ -84,8 +86,7 @@ public class TTsLjplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ljPlan:edit')")
     @Log(title = "裂解培训模版", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TTsLjplanTmpl tTsLjplanTmpl)
-    {
+    public AjaxResult edit(@RequestBody TTsLjplanTmpl tTsLjplanTmpl) {
         return toAjax(tTsLjplanTmplService.updateTTsLjplanTmpl(tTsLjplanTmpl));
     }
 
@@ -94,9 +95,8 @@ public class TTsLjplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ljPlan:remove')")
     @Log(title = "裂解培训模版", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tTsLjplanTmplService.deleteTTsLjplanTmplByIds(ids));
     }
 
@@ -113,4 +113,86 @@ public class TTsLjplanTmplController extends BaseController
         }
         return AjaxResult.error("上传失败,请联系管理员");
     }
+
+
+    @PreAuthorize("@ss.hasPermi('training:ljPlan:add')")
+    @Log(title = "裂解培训模版", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<Integer>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TTsLjplanTmpl> list = new ArrayList<>();
+        int rowNum = sheet.getLastRowNum();
+        int failNumber = 0;
+        for (int i = 1; i <= rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                if (row == null) {
+                    sheet.removeRow(row);
+                    rowNum++;
+                    continue;
+                }
+                int cellNum = row.getLastCellNum();
+                TTsLjplanTmpl entity = new TTsLjplanTmpl();
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        entity.setSortTmpl(cellValue);
+                    } else if (j == 1) {
+                        entity.setCourseCode(cellValue);
+                    } else if (j == 2) {
+                        entity.setTopic(cellValue);
+                    } else if (j == 3) {
+                        entity.setContent(cellValue);
+                    } else if (j == 4) {
+                        entity.setCourseDay(Long.valueOf(cellValue));
+                    } else if (j == 5) {
+                        entity.setCourseHour(Long.valueOf(cellValue));
+                    } else if (j == 6) {
+                        entity.setDetailPlan(cellValue);
+                    } else if (j == 7) {
+                        entity.setTrainer(cellValue);
+                    } else if (j == 8) {
+                        entity.setTimerNeed(Long.valueOf(cellValue));
+                    } else if (j == 9) {
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(userId.toString());
+                entity.setCreatedate(new Date());
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TTsLjplanTmpl t : list) {
+            failNum++;
+            try {
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:{}", successNumber);
+        logger.info("failNumber:{}", failNumber);
+        logger.info("failRow:{}", failRow);
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 7 - 5
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsYsplanController.java

@@ -90,11 +90,13 @@ public class TTsYsplanController extends BaseController {
         if (userId.equals(sysUser.getUserId())) {
             TTsYsplan need = tTsYsplanService.selectTTsYsplanById(tTsYsplan.getId());
             long timer = need.getTimer() == null ? 0 : need.getTimer();
-            need.setTimer(timer + 1);
-            if (need.getTimerNeed()==null)
-                need.setTimerNeed(0L);
-            if (need.getTimerNeed() != null && need.getTimerNeed()<=timer + 1) {
-                need.setPlanStatus(2L);
+            if (timer < need.getTimerNeed()) {
+                need.setTimer(timer + 1);
+                if (need.getTimerNeed() == null)
+                    need.setTimerNeed(0L);
+                if (need.getTimerNeed() != null && need.getTimerNeed() <= timer + 1) {
+                    need.setPlanStatus(2L);
+                }
             }
             return toAjax(tTsYsplanService.updateTTsYsplan(need));
         }

+ 107 - 26
master/src/main/java/com/ruoyi/project/training/bccnew/controller/TTsYsplanTmplController.java

@@ -1,24 +1,31 @@
 package com.ruoyi.project.training.bccnew.controller;
 
-import java.io.IOException;
-import java.util.List;
-
+import com.alibaba.fastjson.JSON;
+import com.ruoyi.common.utils.file.ExcelUtils;
 import com.ruoyi.common.utils.file.FileUploadUtils;
-import com.ruoyi.framework.config.RuoYiConfig;
-import com.ruoyi.project.training.bccnew.domain.TTsFlplanTmpl;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.aspectj.lang.annotation.Log;
 import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
-import com.ruoyi.project.training.bccnew.domain.TTsYsplanTmpl;
-import com.ruoyi.project.training.bccnew.service.ITTsYsplanTmplService;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.framework.web.domain.AjaxResult;
-import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.web.page.TableDataInfo;
+import com.ruoyi.project.training.bccnew.domain.TTsYsplanTmpl;
+import com.ruoyi.project.training.bccnew.service.ITTsYsplanTmplService;
+import org.apache.poi.ss.usermodel.Cell;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.ss.usermodel.Workbook;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
 /**
  * 压缩培训模版Controller
  *
@@ -27,8 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
  */
 @RestController
 @RequestMapping("/bccnew/ysPlan")
-public class TTsYsplanTmplController extends BaseController
-{
+public class TTsYsplanTmplController extends BaseController {
     @Autowired
     private ITTsYsplanTmplService tTsYsplanTmplService;
 
@@ -37,8 +43,7 @@ public class TTsYsplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ysPlan:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TTsYsplanTmpl tTsYsplanTmpl)
-    {
+    public TableDataInfo list(TTsYsplanTmpl tTsYsplanTmpl) {
         startPage();
         List<TTsYsplanTmpl> list = tTsYsplanTmplService.selectTTsYsplanTmplList(tTsYsplanTmpl);
         return getDataTable(list);
@@ -50,8 +55,7 @@ public class TTsYsplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ysPlan:export')")
     @Log(title = "压缩培训模版", businessType = BusinessType.EXPORT)
     @GetMapping("/export")
-    public AjaxResult export(TTsYsplanTmpl tTsYsplanTmpl)
-    {
+    public AjaxResult export(TTsYsplanTmpl tTsYsplanTmpl) {
         List<TTsYsplanTmpl> list = tTsYsplanTmplService.selectTTsYsplanTmplList(tTsYsplanTmpl);
         ExcelUtil<TTsYsplanTmpl> util = new ExcelUtil<TTsYsplanTmpl>(TTsYsplanTmpl.class);
         return util.exportExcel(list, "ysPlan");
@@ -62,8 +66,7 @@ public class TTsYsplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ysPlan:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return AjaxResult.success(tTsYsplanTmplService.selectTTsYsplanTmplById(id));
     }
 
@@ -73,8 +76,7 @@ public class TTsYsplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ysPlan:add')")
     @Log(title = "压缩培训模版", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TTsYsplanTmpl tTsYsplanTmpl)
-    {
+    public AjaxResult add(@RequestBody TTsYsplanTmpl tTsYsplanTmpl) {
         return toAjax(tTsYsplanTmplService.insertTTsYsplanTmpl(tTsYsplanTmpl));
     }
 
@@ -84,8 +86,7 @@ public class TTsYsplanTmplController extends BaseController
     @PreAuthorize("@ss.hasPermi('bccnew:ysPlan:edit')")
     @Log(title = "压缩培训模版", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TTsYsplanTmpl tTsYsplanTmpl)
-    {
+    public AjaxResult edit(@RequestBody TTsYsplanTmpl tTsYsplanTmpl) {
         return toAjax(tTsYsplanTmplService.updateTTsYsplanTmpl(tTsYsplanTmpl));
     }
 
@@ -94,9 +95,8 @@ public class TTsYsplanTmplController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('bccnew:ysPlan:remove')")
     @Log(title = "压缩培训模版", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tTsYsplanTmplService.deleteTTsYsplanTmplByIds(ids));
     }
 
@@ -113,4 +113,85 @@ public class TTsYsplanTmplController extends BaseController
         }
         return AjaxResult.error("上传失败,请联系管理员");
     }
+
+    @PreAuthorize("@ss.hasPermi('training:ysPlan:add')")
+    @Log(title = "压缩培训模版", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<Integer>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TTsYsplanTmpl> list = new ArrayList<>();
+        int rowNum = sheet.getLastRowNum();
+        int failNumber = 0;
+        for (int i = 1; i <= rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                if (row == null) {
+                    sheet.removeRow(row);
+                    rowNum++;
+                    continue;
+                }
+                int cellNum = row.getLastCellNum();
+                TTsYsplanTmpl entity = new TTsYsplanTmpl();
+                for (int j = 0; j < cellNum; j++) {
+                    Cell cell = row.getCell(j);
+                    if (cell == null) {
+                        continue;
+                    }
+                    String cellValue = ExcelUtils.getCellValue(cell);
+                    logger.info("cellValue:" + cellValue);
+                    if (j == 0) {
+                        entity.setSortTmpl(cellValue);
+                    } else if (j == 1) {
+                        entity.setCourseCode(cellValue);
+                    } else if (j == 2) {
+                        entity.setTopic(cellValue);
+                    } else if (j == 3) {
+                        entity.setContent(cellValue);
+                    } else if (j == 4) {
+                        entity.setCourseDay(Long.valueOf(cellValue));
+                    } else if (j == 5) {
+                        entity.setCourseHour(Long.valueOf(cellValue));
+                    } else if (j == 6) {
+                        entity.setDetailPlan(cellValue);
+                    } else if (j == 7) {
+                        entity.setTrainer(cellValue);
+                    } else if (j == 8) {
+                        entity.setTimerNeed(Long.valueOf(cellValue));
+                    } else if (j == 9) {
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(userId.toString());
+                entity.setCreatedate(new Date());
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TTsYsplanTmpl t : list) {
+            failNum++;
+            try {
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                failRow.add(failNum + 1);
+            }
+        }
+        logger.info("list:" + JSON.toJSONString(list));
+        logger.info("successNumber:{}", successNumber);
+        logger.info("failNumber:{}", failNumber);
+        logger.info("failRow:{}", failRow);
+        return AjaxResult.success(String.valueOf(successNumber), failRow);
+    }
 }

+ 11 - 22
master/src/main/java/com/ruoyi/project/training/bccnew/domain/TTsFirstplanTmpl.java

@@ -21,7 +21,6 @@ public class TTsFirstplanTmpl extends BaseEntity
     private Long id;
 
     /** 培训员工编号 */
-    @Excel(name = "培训员工编号")
     private Long newId;
 
     /** 课程编号 */
@@ -32,62 +31,61 @@ public class TTsFirstplanTmpl extends BaseEntity
     @Excel(name = "培训主题")
     private String topic;
 
+    /** 材料版本 */
+    @Excel(name = "材料版本")
+    private String materialVer;
+
     /** 培训内容 */
-    @Excel(name = "培训内容")
     private String content;
 
     /** 培训天 */
-    @Excel(name = "培训天")
     private Long courseDay;
 
     /** 培训小时 */
-    @Excel(name = "培训时")
+    @Excel(name = "培训时长h")
     private Long courseHour;
 
     /** 培训类型 */
-    @Excel(name = "培训类型")
     private String courseType;
 
+    /** 考试评估方式 */
+    private String examType;
+
     /** 讲师 */
     @Excel(name = "讲师")
     private String trainer;
 
+    /** 应学习时长 */
+    private Long timerNeed;
+
     /** 培训日期 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
-    @Excel(name = "培训日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date courseDate;
 
     /** 考核情况 */
-    @Excel(name = "考核情况")
     private String assess;
 
     /** 删除状态 */
     private Long delFlag;
 
     /** 创建人 */
-    @Excel(name = "创建人")
     private String createrCode;
 
     /** 创建时间 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
-    @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
     /** 修改人 */
-    @Excel(name = "修改人")
     private String updaterCode;
 
     /** 修改时间 */
     @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
-    @Excel(name = "修改时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 
     /** 部门编号 */
-    @Excel(name = "部门编号")
     private Long deptId;
 
     /** 部门名称 */
-    @Excel(name = "部门名称")
     private String deptName;
 
     /** 备注 */
@@ -98,18 +96,9 @@ public class TTsFirstplanTmpl extends BaseEntity
 
     private String fileName;
 
-    /** 应学习时长 */
-    private Long timerNeed;
-
     /** 模板排序 */
     private String sortTmpl;
 
-    /** 材料版本 */
-    private String materialVer;
-
-    /** 考试评估方式 */
-    private String examType;
-
     private Long examId;
 
     public Long getExamId() {

+ 1 - 4
master/src/main/java/com/ruoyi/project/training/bccnew/domain/TTsFlplanTmpl.java

@@ -21,7 +21,6 @@ public class TTsFlplanTmpl extends BaseEntity
     private Long id;
 
     /** 培训员工编号 */
-    @Excel(name = "培训员工编号")
     private Long newId;
 
     /** 课程编号 */
@@ -33,15 +32,13 @@ public class TTsFlplanTmpl extends BaseEntity
     private String topic;
 
     /** 培训内容 */
-    @Excel(name = "培训内容")
     private String content;
 
     /** 培训天 */
-    @Excel(name = "培训天")
     private Long courseDay;
 
     /** 培训小时 */
-    @Excel(name = "培训时")
+    @Excel(name = "培训时长h")
     private Long courseHour;
 
     /** 详细计划 */

二进制
master/src/main/resources/static/template/training/bccnewDsdt.xlsx


二进制
master/src/main/resources/static/template/training/bccnewJz.xlsx


+ 12 - 9
ui/src/views/training/bccnew/firstPlanTmpl/index.vue

@@ -200,15 +200,17 @@
       >
         <i class="el-icon-upload"></i>
         <div class="el-upload__text">
-          将文件拖到此处,或
-          <em>点击上传</em>
+          {{ $t('将文件拖到此处,或') }}
+          <em>{{ $t('点击上传') }}</em>
         </div>
         <div class="el-upload__tip" slot="tip">
-          <el-checkbox v-model="upload.updateSupport"/>
-          是否更新已经存在的用户数据
-          <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+          <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+          <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
         </div>
-        <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+        <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+          <input name="type" :value="upload.type" hidden />
+        </form>
+        <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
       </el-upload>
       <div slot="footer" class="dialog-footer">
         <el-button type="primary" @click="submitFileForm">确 定</el-button>
@@ -381,6 +383,9 @@ export default {
       open: false,
       // 用户导入参数
       upload: {
+        downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+        //下载模板类型
+        type: "jzPlanTmpl",
         // 是否显示弹出层(用户导入)
         open: false,
         // 弹出层标题(用户导入)
@@ -633,9 +638,7 @@ export default {
     },
     /** 下载模板操作 */
     importTemplate() {
-      importTemplate().then(response => {
-        this.download(response.msg);
-      });
+      this.$refs['downloadFileForm'].submit()
     },
     // 文件上传中处理
     handleFileUploadProgress(event, file, fileList) {

+ 18 - 19
ui/src/views/training/bccnew/flPlan/index.vue

@@ -94,12 +94,7 @@
       <el-table-column label="培训小时" align="center" prop="courseHour" :show-overflow-tooltip="true"/>
       <el-table-column label="详细计划" align="center" prop="detailPlan" :show-overflow-tooltip="true"/>
       <el-table-column label="讲师" align="center" prop="trainer" :show-overflow-tooltip="true"/>
-      <el-table-column label="培训日期" align="center" prop="courseDate" width="100">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.courseDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="考核情况" align="center" prop="assess" :show-overflow-tooltip="true"/>
+      <el-table-column label="应学习时长" align="center" prop="timerNeed" :show-overflow-tooltip="true"/>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -201,16 +196,19 @@
                   :auto-upload="false"
                   drag
           >
-              <i class="el-icon-upload"></i>
-              <div class="el-upload__text">
-                  将文件拖到此处,或
-                  <em>点击上传</em>
-              </div>
-              <div class="el-upload__tip" slot="tip">
-                  <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
-                  <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
-              </div>
-              <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+              {{ $t('将文件拖到此处,或') }}
+              <em>{{ $t('点击上传') }}</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">
+              <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+              <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
+            </div>
+            <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+              <input name="type" :value="upload.type" hidden />
+            </form>
+            <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
           </el-upload>
           <div slot="footer" class="dialog-footer">
               <el-button type="primary" @click="submitFileForm">确 定</el-button>
@@ -375,6 +373,9 @@ export default {
       open: false,
         // 用户导入参数
         upload: {
+          downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+          //下载模板类型
+          type: "flPlanTmpl",
             // 是否显示弹出层(用户导入)
             open: false,
             // 弹出层标题(用户导入)
@@ -625,9 +626,7 @@ export default {
       },
       /** 下载模板操作 */
       importTemplate() {
-          importTemplate().then(response => {
-              this.download(response.msg);
-          });
+        this.$refs['downloadFileForm'].submit()
       },
       // 文件上传中处理
       handleFileUploadProgress(event, file, fileList) {

+ 18 - 19
ui/src/views/training/bccnew/ftPlan/index.vue

@@ -94,12 +94,7 @@
       <el-table-column label="培训小时" align="center" prop="courseHour" :show-overflow-tooltip="true"/>
       <el-table-column label="详细计划" align="center" prop="detailPlan" :show-overflow-tooltip="true"/>
       <el-table-column label="讲师" align="center" prop="trainer" :show-overflow-tooltip="true"/>
-      <el-table-column label="培训日期" align="center" prop="courseDate" width="100">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.courseDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="考核情况" align="center" prop="assess" :show-overflow-tooltip="true"/>
+      <el-table-column label="应学习时长" align="center" prop="timerNeed" :show-overflow-tooltip="true"/>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -201,16 +196,19 @@
                   :auto-upload="false"
                   drag
           >
-              <i class="el-icon-upload"></i>
-              <div class="el-upload__text">
-                  将文件拖到此处,或
-                  <em>点击上传</em>
-              </div>
-              <div class="el-upload__tip" slot="tip">
-                  <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
-                  <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
-              </div>
-              <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+              {{ $t('将文件拖到此处,或') }}
+              <em>{{ $t('点击上传') }}</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">
+              <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+              <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
+            </div>
+            <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+              <input name="type" :value="upload.type" hidden />
+            </form>
+            <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
           </el-upload>
           <div slot="footer" class="dialog-footer">
               <el-button type="primary" @click="submitFileForm">确 定</el-button>
@@ -374,6 +372,9 @@ export default {
       open: false,
         // 用户导入参数
         upload: {
+          downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+          //下载模板类型
+          type: "ftPlanTmpl",
             // 是否显示弹出层(用户导入)
             open: false,
             // 弹出层标题(用户导入)
@@ -624,9 +625,7 @@ export default {
       },
       /** 下载模板操作 */
       importTemplate() {
-          importTemplate().then(response => {
-              this.download(response.msg);
-          });
+        this.$refs['downloadFileForm'].submit()
       },
       // 文件上传中处理
       handleFileUploadProgress(event, file, fileList) {

+ 18 - 19
ui/src/views/training/bccnew/ljPlan/index.vue

@@ -94,12 +94,7 @@
       <el-table-column label="培训小时" align="center" prop="courseHour" :show-overflow-tooltip="true"/>
       <el-table-column label="详细计划" align="center" prop="detailPlan" :show-overflow-tooltip="true"/>
       <el-table-column label="讲师" align="center" prop="trainer" :show-overflow-tooltip="true"/>
-      <el-table-column label="培训日期" align="center" prop="courseDate" width="100">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.courseDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="考核情况" align="center" prop="assess" :show-overflow-tooltip="true"/>
+      <el-table-column label="应学习时长" align="center" prop="timerNeed" :show-overflow-tooltip="true"/>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -201,16 +196,19 @@
                   :auto-upload="false"
                   drag
           >
-              <i class="el-icon-upload"></i>
-              <div class="el-upload__text">
-                  将文件拖到此处,或
-                  <em>点击上传</em>
-              </div>
-              <div class="el-upload__tip" slot="tip">
-                  <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
-                  <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
-              </div>
-              <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+              {{ $t('将文件拖到此处,或') }}
+              <em>{{ $t('点击上传') }}</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">
+              <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+              <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
+            </div>
+            <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+              <input name="type" :value="upload.type" hidden />
+            </form>
+            <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
           </el-upload>
           <div slot="footer" class="dialog-footer">
               <el-button type="primary" @click="submitFileForm">确 定</el-button>
@@ -374,6 +372,9 @@ export default {
       open: false,
         // 用户导入参数
         upload: {
+          downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+          //下载模板类型
+          type: "ljPlanTmpl",
             // 是否显示弹出层(用户导入)
             open: false,
             // 弹出层标题(用户导入)
@@ -624,9 +625,7 @@ export default {
       },
       /** 下载模板操作 */
       importTemplate() {
-          importTemplate().then(response => {
-              this.download(response.msg);
-          });
+        this.$refs['downloadFileForm'].submit()
       },
       // 文件上传中处理
       handleFileUploadProgress(event, file, fileList) {

+ 18 - 19
ui/src/views/training/bccnew/ysPlan/index.vue

@@ -94,12 +94,7 @@
       <el-table-column label="培训小时" align="center" prop="courseHour" :show-overflow-tooltip="true"/>
       <el-table-column label="详细计划" align="center" prop="detailPlan" :show-overflow-tooltip="true"/>
       <el-table-column label="讲师" align="center" prop="trainer" :show-overflow-tooltip="true"/>
-      <el-table-column label="培训日期" align="center" prop="courseDate" width="100">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.courseDate, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="考核情况" align="center" prop="assess" :show-overflow-tooltip="true"/>
+      <el-table-column label="应学习时长" align="center" prop="timerNeed" :show-overflow-tooltip="true"/>
       <el-table-column label="备注" align="center" prop="remarks" :show-overflow-tooltip="true"/>
       <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
         <template slot-scope="scope">
@@ -204,16 +199,19 @@
                   :auto-upload="false"
                   drag
           >
-              <i class="el-icon-upload"></i>
-              <div class="el-upload__text">
-                  将文件拖到此处,或
-                  <em>点击上传</em>
-              </div>
-              <div class="el-upload__tip" slot="tip">
-                  <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
-                  <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
-              </div>
-              <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+            <i class="el-icon-upload"></i>
+            <div class="el-upload__text">
+              {{ $t('将文件拖到此处,或') }}
+              <em>{{ $t('点击上传') }}</em>
+            </div>
+            <div class="el-upload__tip" slot="tip">
+              <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+              <el-link type="info" style="font-size:12px" @click="importTemplate">{{ $t('下载模板') }}</el-link>
+            </div>
+            <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+              <input name="type" :value="upload.type" hidden />
+            </form>
+            <div class="el-upload__tip" style="color:red" slot="tip">{{ $t('提示:仅允许导入“xls”或“xlsx”格式文件!') }}</div>
           </el-upload>
           <div slot="footer" class="dialog-footer">
               <el-button type="primary" @click="submitFileForm">确 定</el-button>
@@ -377,6 +375,9 @@ export default {
       open: false,
         // 用户导入参数
         upload: {
+          downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+          //下载模板类型
+          type: "ysPlanTmpl",
             // 是否显示弹出层(用户导入)
             open: false,
             // 弹出层标题(用户导入)
@@ -627,9 +628,7 @@ export default {
       },
       /** 下载模板操作 */
       importTemplate() {
-          importTemplate().then(response => {
-              this.download(response.msg);
-          });
+        this.$refs['downloadFileForm'].submit()
       },
       // 文件上传中处理
       handleFileUploadProgress(event, file, fileList) {