浏览代码

cpms优化
LO LC状态记录表

jiangbiao 1 年之前
父节点
当前提交
85199d14d5

+ 5 - 5
ruoyi-admin/src/main/java/com/ruoyi/project/approval/domain/TApproval.java

@@ -30,7 +30,7 @@ public class TApproval extends BaseEntity
     private String division;
 
     /** 批准日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "批准日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date effetivedate;
 
@@ -99,7 +99,7 @@ public class TApproval extends BaseEntity
     private String reviewer;
 
     /** 回顾时间 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "回顾时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date reviewdate;
 
@@ -108,7 +108,7 @@ public class TApproval extends BaseEntity
     private String isCompliance;
 
     /** 下次回顾时间 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "下次回顾时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date nextreviewdate;
 
@@ -124,7 +124,7 @@ public class TApproval extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -133,7 +133,7 @@ public class TApproval extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 0 - 14
ruoyi-admin/src/main/java/com/ruoyi/project/asset/controller/TLeakagePointsController.java

@@ -133,46 +133,32 @@ public class TLeakagePointsController extends BaseController
                     String cellValue = ExcelUtils.getCellValue(cell);
                     logger.info("cellValue:" + cellValue);
                     if (j == 0) {
-                        //type
                         entity.setPointNo(cellValue);
                     } else if (j == 1) {
-                        //内容
                         entity.setLeakagePosition(cellValue);
                     } else if (j == 2) {
-                        //PID图号/管线号
                         entity.setLeakageMedium(cellValue);
                     } else if (j == 3) {
-                        //是分解具体位置及描述
                         entity.setDiscoveryTime(DateUtils.parseDate(cellValue));
                     } else if (j == 4) {
-                        //According to
                         entity.setDiscoveryName(cellValue);
                     } else if (j == 5) {
-                        //资产
                         entity.setLeakageAmount(cellValue);
                     } else if (j == 6) {
-                        //DCS操作
                         entity.setSapNo(cellValue);
                     } else if (j == 7) {
-                        //现场操作8小时
                         entity.setLeakageEliminationTime(DateUtils.parseDate(cellValue));
                     } else if (j == 8) {
-                        //现场操作8小时外
                         entity.setLeakageEliminationFunc(cellValue);
                     } else if (j == 9) {
-                        //巡检8小时
                         entity.setListing(cellValue);
                     } else if (j == 10) {
-                        //巡检8小时外
                         entity.setPressurePlugging(cellValue);
                     } else if (j == 11) {
-                        //维修8小时
                         entity.setLeakageEliminationResult(cellValue);
                     } else if (j == 12) {
-                        //维修8小时外
                         entity.setNextCheckDate(DateUtils.parseDate(cellValue));
                     } else if (j == 13) {
-                        //维修协调8小时
                         entity.setRemarks(cellValue);
                     }
                 }

+ 5 - 5
ruoyi-admin/src/main/java/com/ruoyi/project/asset/domain/TLeakagePoints.java

@@ -33,7 +33,7 @@ public class TLeakagePoints extends BaseEntity
     private String leakageMedium;
 
     /** 发现时间 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "发现时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date discoveryTime;
 
@@ -50,7 +50,7 @@ public class TLeakagePoints extends BaseEntity
     private String sapNo;
 
     /** 消漏时间 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "消漏时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date leakageEliminationTime;
 
@@ -71,7 +71,7 @@ public class TLeakagePoints extends BaseEntity
     private String leakageEliminationResult;
 
     /** 下次检修日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "下次检修日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date nextCheckDate;
 
@@ -87,7 +87,7 @@ public class TLeakagePoints extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -96,7 +96,7 @@ public class TLeakagePoints extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 4 - 4
ruoyi-admin/src/main/java/com/ruoyi/project/asset/domain/TLeakagePointsPatrol.java

@@ -27,7 +27,7 @@ public class TLeakagePointsPatrol extends BaseEntity
     private String teamM;
 
     /** 日期 */
-    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+   @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date checkDateM;
 
@@ -40,7 +40,7 @@ public class TLeakagePointsPatrol extends BaseEntity
     private String teamN;
 
     /** 日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date checkDateN;
 
@@ -60,7 +60,7 @@ public class TLeakagePointsPatrol extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -69,7 +69,7 @@ public class TLeakagePointsPatrol extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/project/asset/domain/TLeakagePointsRecord.java

@@ -64,7 +64,7 @@ public class TLeakagePointsRecord extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -73,7 +73,7 @@ public class TLeakagePointsRecord extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/project/asset/domain/TSpecdevTypemgr.java

@@ -40,7 +40,7 @@ public class TSpecdevTypemgr extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -49,7 +49,7 @@ public class TSpecdevTypemgr extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 1 - 1
ruoyi-admin/src/main/java/com/ruoyi/project/file/domain/TFile.java

@@ -30,7 +30,7 @@ public class TFile extends BaseEntity
     private String fileName;
 
     /** 上传时间 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd")
     private Date uploadDate;
 

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/project/plant/domain/TStaffmgrRecord.java

@@ -30,7 +30,7 @@ public class TStaffmgrRecord extends BaseEntity
     private String type;
 
     /** 日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date actionDate;
 
@@ -48,7 +48,7 @@ public class TStaffmgrRecord extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -57,7 +57,7 @@ public class TStaffmgrRecord extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 122 - 30
ruoyi-admin/src/main/java/com/ruoyi/project/process/controller/TLockValveController.java

@@ -1,36 +1,39 @@
 package com.ruoyi.project.process.controller;
 
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import com.alibaba.fastjson2.JSON;
 import com.ruoyi.common.annotation.Log;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
+import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.enums.BusinessType;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.file.ExcelUtils;
+import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.project.process.domain.TLockValve;
 import com.ruoyi.project.process.service.ITLockValveService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
+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 javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 阀门锁开锁关状态记录Controller
- * 
+ *
  * @author ruoyi
  * @date 2024-04-03
  */
 @RestController
 @RequestMapping("/process/valve")
-public class TLockValveController extends BaseController
-{
+public class TLockValveController extends BaseController {
     @Autowired
     private ITLockValveService tLockValveService;
 
@@ -39,8 +42,7 @@ public class TLockValveController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('process:valve:list')")
     @GetMapping("/list")
-    public TableDataInfo list(TLockValve tLockValve)
-    {
+    public TableDataInfo list(TLockValve tLockValve) {
         startPage();
         List<TLockValve> list = tLockValveService.selectTLockValveList(tLockValve);
         return getDataTable(list);
@@ -52,8 +54,7 @@ public class TLockValveController extends BaseController
     @PreAuthorize("@ss.hasPermi('process:valve:export')")
     @Log(title = "阀门锁开锁关状态记录", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, TLockValve tLockValve)
-    {
+    public void export(HttpServletResponse response, TLockValve tLockValve) {
         List<TLockValve> list = tLockValveService.selectTLockValveList(tLockValve);
         ExcelUtil<TLockValve> util = new ExcelUtil<TLockValve>(TLockValve.class);
         util.exportExcel(response, list, "阀门锁开锁关状态记录数据");
@@ -64,8 +65,7 @@ public class TLockValveController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('process:valve:query')")
     @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") Long id) {
         return success(tLockValveService.selectTLockValveById(id));
     }
 
@@ -75,8 +75,7 @@ public class TLockValveController extends BaseController
     @PreAuthorize("@ss.hasPermi('process:valve:add')")
     @Log(title = "阀门锁开锁关状态记录", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody TLockValve tLockValve)
-    {
+    public AjaxResult add(@RequestBody TLockValve tLockValve) {
         return toAjax(tLockValveService.insertTLockValve(tLockValve));
     }
 
@@ -86,8 +85,7 @@ public class TLockValveController extends BaseController
     @PreAuthorize("@ss.hasPermi('process:valve:edit')")
     @Log(title = "阀门锁开锁关状态记录", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody TLockValve tLockValve)
-    {
+    public AjaxResult edit(@RequestBody TLockValve tLockValve) {
         return toAjax(tLockValveService.updateTLockValve(tLockValve));
     }
 
@@ -96,9 +94,103 @@ public class TLockValveController extends BaseController
      */
     @PreAuthorize("@ss.hasPermi('process:valve:remove')")
     @Log(title = "阀门锁开锁关状态记录", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Long[] ids) {
         return toAjax(tLockValveService.deleteTLockValveByIds(ids));
     }
+
+
+    @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<>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<TLockValve> list = new ArrayList<>();
+        int rowNum = sheet.getPhysicalNumberOfRows();
+        int failNumber = 0;
+        for (int i = 2; i < rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                int cellNum = row.getLastCellNum();
+                TLockValve entity = new TLockValve();
+                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.setUnit(cellValue);
+                    } else if (j == 1) {
+                        entity.setVtNo(cellValue);
+                    } else if (j == 2) {
+                        entity.setPidNo(cellValue);
+                    } else if (j == 3) {
+                        entity.setLocationDes(cellValue);
+                    } else if (j == 4) {
+                        entity.setMedium(cellValue);
+                    } else if (j == 5) {
+                        entity.setValveType(cellValue);
+                    } else if (j == 6) {
+                        entity.setValveSize(cellValue);
+                    } else if (j == 7) {
+                        entity.setIdentifier(cellValue);
+                    } else if (j == 8) {
+                        entity.setValvePosition(cellValue);
+                    } else if (j == 9) {
+                        entity.setFirmlySecured(cellValue);
+                    } else if (j == 10) {
+                        entity.setResponsibility(cellValue);
+                    } else if (j == 11) {
+                        entity.setCheckedBy(cellValue);
+                    } else if (j == 12) {
+                        entity.setCheckBeforeSu(cellValue);
+                    } else if (j == 13) {
+                        entity.setPidStatus(cellValue);
+                    } else if (j == 14) {
+                        entity.setRiskLevel(cellValue);
+                    } else if (j == 15) {
+                        entity.setSheReview(cellValue);
+                    } else if (j == 16) {
+                        entity.setCheckDate(DateUtils.parseDate(cellValue));
+                    } else if (j == 17) {
+                        entity.setRemarks(cellValue);
+                    }
+                }
+                entity.setCreaterCode(String.valueOf(userId));
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + JSON.toJSONString(e));
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (TLockValve t : list
+        ) {
+            failNum++;
+            try {
+                //根据使用证、注册编号、位号,进行数据更新
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + e);
+                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);
+    }
 }

+ 3 - 3
ruoyi-admin/src/main/java/com/ruoyi/project/process/domain/TLockValve.java

@@ -85,7 +85,7 @@ public class TLockValve extends BaseEntity
     private String sheReview;
 
     /** 检查日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "检查日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date checkDate;
 
@@ -101,7 +101,7 @@ public class TLockValve extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -110,7 +110,7 @@ public class TLockValve extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 2 - 2
ruoyi-admin/src/main/java/com/ruoyi/project/shiftmgr/domain/TShiftLog.java

@@ -175,7 +175,7 @@ public class TShiftLog extends BaseEntity
     private String createrCode;
 
     /** 创建日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "创建日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date createdate;
 
@@ -184,7 +184,7 @@ public class TShiftLog extends BaseEntity
     private String updaterCode;
 
     /** 更新日期 */
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "更新日期", width = 30, dateFormat = "yyyy-MM-dd")
     private Date updatedate;
 

+ 59 - 0
ruoyi-generator/src/main/resources/vm/java/controller.java.vm

@@ -112,4 +112,63 @@ public class ${ClassName}Controller extends BaseController
     {
         return toAjax(${className}Service.delete${ClassName}By${pkColumn.capJavaField}s(${pkColumn.javaField}s));
     }
+
+
+    @Log(title = "${functionName}批量导入", businessType = BusinessType.INSERT)
+    @PostMapping("/importData")
+    public AjaxResult importData(@RequestParam("file") MultipartFile file) throws IOException {
+        //获取操作人员ID
+        Long userId = getUserId();
+        //报错行数统计
+        List<Integer> failRow = new ArrayList<>();
+        Workbook workbook = ExcelUtils.getWorkBook(file);
+        Sheet sheet = workbook.getSheetAt(0);
+        List<${ClassName}> list = new ArrayList<>();
+        int rowNum = sheet.getPhysicalNumberOfRows();
+        int failNumber = 0;
+        for (int i = 2; i < rowNum; i++) {
+            try {
+                logger.info("读取行数:" + i);
+                Row row = sheet.getRow(i);
+                int cellNum = row.getLastCellNum();
+                ${ClassName} entity = new ${ClassName}();
+                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);
+                    // TODO 添加属性值
+                }
+                entity.setCreaterCode(String.valueOf(userId));
+                logger.info("entity:" + entity);
+                list.add(entity);
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + JSON.toJSONString(e));
+                failRow.add(i + 1);
+            }
+        }
+        int successNumber = 0;
+        int failNum = 0;
+        for (${ClassName} t : list
+        ) {
+            failNum++;
+            try {
+                //根据使用证、注册编号、位号,进行数据更新
+                add(t);
+                successNumber++;
+            } catch (Exception e) {
+                failNumber++;
+                logger.info("e:" + e);
+                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);
+    }
 }

+ 1 - 1
ruoyi-generator/src/main/resources/vm/java/domain.java.vm

@@ -40,7 +40,7 @@ public class ${ClassName} extends ${Entity}
 #if($parentheseIndex != -1)
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
 #elseif($column.javaType == 'Date')
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
 #else
     @Excel(name = "${comment}")

+ 1 - 1
ruoyi-generator/src/main/resources/vm/java/sub-domain.java.vm

@@ -31,7 +31,7 @@ public class ${subClassName} extends BaseEntity
 #if($parentheseIndex != -1)
     @Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
 #elseif($column.javaType == 'Date')
-     @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
+    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
     @Excel(name = "${comment}", width = 30, dateFormat = "yyyy-MM-dd")
 #else
     @Excel(name = "${comment}")

+ 104 - 0
ruoyi-generator/src/main/resources/vm/vue/index.vue.vm

@@ -100,6 +100,17 @@
           v-hasPermi="['${moduleName}:${businessName}:remove']"
         >删除</el-button>
       </el-col>
+      <el-col :span="1.5">
+        <el-button
+            type="warning"
+            plain
+            icon="el-icon-upload2"
+            size="mini"
+            @click="handleImport"
+            v-hasPermi="['${moduleName}:${businessName}:add']"
+        >导入
+        </el-button>
+      </el-col>
       <el-col :span="1.5">
         <el-button
           type="warning"
@@ -349,11 +360,51 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+
+
+    <!-- 用户导入对话框 -->
+    <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" append-to-body
+               width="400px">
+      <el-upload
+          ref="upload"
+          :action="upload.url + '?updateSupport=' + upload.updateSupport"
+          :auto-upload="false"
+          :disabled="upload.isUploading"
+          :headers="upload.headers"
+          :limit="1"
+          :on-progress="handleFileUploadProgress"
+          :on-success="handleFileSuccess"
+          accept=".xlsx, .xls"
+          drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div slot="tip" class="el-upload__tip">
+          <!--          <el-checkbox v-model="upload.updateSupport"/>-->
+          <!--          是否更新已经存在的用户数据-->
+          <el-link style="font-size:12px" type="info" @click="importTemplate">下载模板</el-link>
+        </div>
+        <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button v-loading.fullscreen.lock="fullscreenLoading" type="primary" @click="submitFileForm">确 定
+        </el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+      <input :value="upload.type" hidden name="type"/>
+    </form>
   </div>
 </template>
 
 <script>
 import { list${BusinessName}, get${BusinessName}, del${BusinessName}, add${BusinessName}, update${BusinessName} } from "@/api/${moduleName}/${businessName}";
+import {getToken} from "@/utils/auth";
 
 export default {
   name: "${BusinessName}",
@@ -362,6 +413,25 @@ export default {
 #end
   data() {
     return {
+      // 批量导入全屏遮罩
+      fullscreenLoading: false,
+      // 用户导入参数
+      upload: {
+        downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+        type: "${moduleName}${businessName}",
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: {Authorization: "Bearer " + getToken()},
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/${moduleName}/${businessName}/importData"
+      },
       // 页面高度
       clientHeight: 300,
       // 遮罩层
@@ -602,6 +672,40 @@ export default {
       this.download('${moduleName}/${businessName}/export', {
         ...this.queryParams
       }, `${businessName}_#[[${new Date().getTime()}]]#.xlsx`)
+    },
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = "用户导入";
+      this.upload.open = true;
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+      this.fullscreenLoading = true;
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.fullscreenLoading = false;
+      if (response.data.length > 0) {
+        let failrow = ''
+        for (let i = 0; i < response.data.length; i++) {
+          failrow += response.data[i] + ','
+        }
+        this.$alert('导入成功条数:' + response.msg + '<br>' + '失败行数:' + failrow, '导入结果', {dangerouslyUseHTMLString: true});
+      } else {
+        this.$alert('导入成功条数:' + response.msg, '导入结果', {dangerouslyUseHTMLString: true});
+      }
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.$refs['downloadFileForm'].submit()
     }
   }
 };

+ 141 - 31
ruoyi-ui/src/views/process/valve/index.vue

@@ -48,7 +48,8 @@
           size="mini"
           @click="handleAdd"
           v-hasPermi="['process:valve:add']"
-        >新增</el-button>
+        >新增
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -59,7 +60,8 @@
           :disabled="single"
           @click="handleUpdate"
           v-hasPermi="['process:valve:edit']"
-        >修改</el-button>
+        >修改
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -70,7 +72,19 @@
           :disabled="multiple"
           @click="handleDelete"
           v-hasPermi="['process:valve:remove']"
-        >删除</el-button>
+        >删除
+        </el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-upload2"
+          size="mini"
+          @click="handleImport"
+          v-hasPermi="['asset:points:add']"
+        >导入
+        </el-button>
       </el-col>
       <el-col :span="1.5">
         <el-button
@@ -80,13 +94,15 @@
           size="mini"
           @click="handleExport"
           v-hasPermi="['process:valve:export']"
-        >导出</el-button>
+        >导出
+        </el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="valveList" @selection-change="handleSelectionChange" :height="clientHeight" border>
-      <el-table-column type="selection" width="55" align="center" />
+    <el-table v-loading="loading" :data="valveList" @selection-change="handleSelectionChange" :height="clientHeight"
+              border>
+      <el-table-column type="selection" width="55" align="center"/>
       <el-table-column label="单元" align="center" prop="unit" width="180"/>
       <el-table-column label="阀门标签号" align="center" prop="vtNo" width="180"/>
       <el-table-column label="PID管线号" align="center" prop="pidNo" width="180"/>
@@ -117,14 +133,16 @@
             icon="el-icon-edit"
             @click="handleUpdate(scope.row)"
             v-hasPermi="['process:valve:edit']"
-          >修改</el-button>
+          >修改
+          </el-button>
           <el-button
             size="mini"
             type="text"
             icon="el-icon-delete"
             @click="handleDelete(scope.row)"
             v-hasPermi="['process:valve:remove']"
-          >删除</el-button>
+          >删除
+          </el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -141,25 +159,25 @@
     <el-dialog :title="title" :visible.sync="open" width="700px" append-to-body :close-on-click-modal="false">
       <el-form ref="form" :model="form" :rules="rules" label-width="140px">
         <el-form-item label="单元" prop="unit">
-          <el-input v-model="form.unit" placeholder="请输入单元" />
+          <el-input v-model="form.unit" placeholder="请输入单元"/>
         </el-form-item>
         <el-form-item label="阀门标签号" prop="vtNo">
-          <el-input v-model="form.vtNo" placeholder="请输入阀门标签号" />
+          <el-input v-model="form.vtNo" placeholder="请输入阀门标签号"/>
         </el-form-item>
         <el-form-item label="PID管线号" prop="pidNo">
-          <el-input v-model="form.pidNo" placeholder="请输入PID管线号" />
+          <el-input v-model="form.pidNo" placeholder="请输入PID管线号"/>
         </el-form-item>
         <el-form-item label="位置描述" prop="locationDes">
-          <el-input v-model="form.locationDes" placeholder="请输入位置描述" />
+          <el-input v-model="form.locationDes" placeholder="请输入位置描述"/>
         </el-form-item>
         <el-form-item label="介质" prop="medium">
-          <el-input v-model="form.medium" placeholder="请输入介质" />
+          <el-input v-model="form.medium" placeholder="请输入介质"/>
         </el-form-item>
         <el-form-item label="阀门类型" prop="valveType">
-          <el-input v-model="form.valveType" placeholder="请输入阀门类型" />
+          <el-input v-model="form.valveType" placeholder="请输入阀门类型"/>
         </el-form-item>
         <el-form-item label="阀门尺寸" prop="valveSize">
-          <el-input v-model="form.valveSize" placeholder="请输入阀门尺寸" />
+          <el-input v-model="form.valveSize" placeholder="请输入阀门尺寸"/>
         </el-form-item>
         <el-form-item label="标识信息" prop="identifier">
           <el-radio-group v-model="form.identifier">
@@ -180,30 +198,30 @@
           </el-radio-group>
         </el-form-item>
         <el-form-item label="负责人" prop="responsibility">
-          <el-input v-model="form.responsibility" placeholder="请输入负责人" />
+          <el-input v-model="form.responsibility" placeholder="请输入负责人"/>
         </el-form-item>
         <el-form-item label="现场检查人" prop="checkedBy">
-          <el-input v-model="form.checkedBy" placeholder="请输入现场检查人" />
+          <el-input v-model="form.checkedBy" placeholder="请输入现场检查人"/>
         </el-form-item>
         <el-form-item label="开车前检查" prop="checkBeforeSu">
-          <el-input v-model="form.checkBeforeSu" placeholder="请输入开车前检查" />
+          <el-input v-model="form.checkBeforeSu" placeholder="请输入开车前检查"/>
         </el-form-item>
         <el-form-item label="风险等级" prop="riskLevel">
-          <el-input v-model="form.riskLevel" placeholder="请输入风险等级" />
+          <el-input v-model="form.riskLevel" placeholder="请输入风险等级"/>
         </el-form-item>
         <el-form-item label="SHE Review" prop="sheReview">
-          <el-input v-model="form.sheReview" placeholder="请输入SHE Review" />
+          <el-input v-model="form.sheReview" placeholder="请输入SHE Review"/>
         </el-form-item>
         <el-form-item label="检查日期" prop="checkDate">
           <el-date-picker clearable
-            v-model="form.checkDate"
-            type="date"
-            value-format="yyyy-MM-dd"
-            placeholder="请选择检查日期">
+                          v-model="form.checkDate"
+                          type="date"
+                          value-format="yyyy-MM-dd"
+                          placeholder="请选择检查日期">
           </el-date-picker>
         </el-form-item>
         <el-form-item label="备注" prop="remarks">
-          <el-input v-model="form.remarks" placeholder="请输入备注" />
+          <el-input v-model="form.remarks" placeholder="请输入备注"/>
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -211,16 +229,73 @@
         <el-button @click="cancel">取 消</el-button>
       </div>
     </el-dialog>
+
+
+    <!-- 用户导入对话框 -->
+    <el-dialog :close-on-click-modal="false" :title="upload.title" :visible.sync="upload.open" append-to-body
+               width="400px">
+      <el-upload
+        ref="upload"
+        :action="upload.url + '?updateSupport=' + upload.updateSupport"
+        :auto-upload="false"
+        :disabled="upload.isUploading"
+        :headers="upload.headers"
+        :limit="1"
+        :on-progress="handleFileUploadProgress"
+        :on-success="handleFileSuccess"
+        accept=".xlsx, .xls"
+        drag
+      >
+        <i class="el-icon-upload"></i>
+        <div class="el-upload__text">
+          将文件拖到此处,或
+          <em>点击上传</em>
+        </div>
+        <div slot="tip" class="el-upload__tip">
+          <!--          <el-checkbox v-model="upload.updateSupport"/>-->
+          <!--          是否更新已经存在的用户数据-->
+          <el-link style="font-size:12px" type="info" @click="importTemplate">下载模板</el-link>
+        </div>
+        <div slot="tip" class="el-upload__tip" style="color:red">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+      </el-upload>
+      <div slot="footer" class="dialog-footer">
+        <el-button v-loading.fullscreen.lock="fullscreenLoading" type="primary" @click="submitFileForm">确 定
+        </el-button>
+        <el-button @click="upload.open = false">取 消</el-button>
+      </div>
+    </el-dialog>
+    <form ref="downloadFileForm" :action="upload.downloadAction" target="FORMSUBMIT">
+      <input :value="upload.type" hidden name="type"/>
+    </form>
   </div>
 </template>
 
 <script>
-import { listValve, getValve, delValve, addValve, updateValve } from "@/api/process/valve";
+import {listValve, getValve, delValve, addValve, updateValve} from "@/api/process/valve";
+import {getToken} from "@/utils/auth";
 
 export default {
   name: "Valve",
   data() {
     return {
+      fullscreenLoading: false,
+      // 用户导入参数
+      upload: {
+        downloadAction: process.env.VUE_APP_BASE_API + '/common/template',
+        type: "processvalve",
+        // 是否显示弹出层(用户导入)
+        open: false,
+        // 弹出层标题(用户导入)
+        title: "",
+        // 是否禁用上传
+        isUploading: false,
+        // 是否更新已经存在的用户数据
+        updateSupport: 0,
+        // 设置上传的请求头部
+        headers: {Authorization: "Bearer " + getToken()},
+        // 上传的地址
+        url: process.env.VUE_APP_BASE_API + "/process/valve/importData"
+      },
       // 页面高度
       clientHeight: 300,
       // 遮罩层
@@ -272,8 +347,7 @@ export default {
       // 表单参数
       form: {},
       // 表单校验
-      rules: {
-      }
+      rules: {}
     };
   },
   created() {
@@ -284,6 +358,41 @@ export default {
     });
   },
   methods: {
+    /** 导入按钮操作 */
+    handleImport() {
+      this.upload.title = "用户导入";
+      this.upload.open = true;
+    },
+    // 提交上传文件
+    submitFileForm() {
+      this.$refs.upload.submit();
+      this.fullscreenLoading = true;
+    },
+    // 文件上传中处理
+    handleFileUploadProgress(event, file, fileList) {
+      this.upload.isUploading = true;
+    },
+    // 文件上传成功处理
+    handleFileSuccess(response, file, fileList) {
+      this.upload.open = false;
+      this.upload.isUploading = false;
+      this.$refs.upload.clearFiles();
+      this.fullscreenLoading = false;
+      if (response.data.length > 0) {
+        let failrow = ''
+        for (let i = 0; i < response.data.length; i++) {
+          failrow += response.data[i] + ','
+        }
+        this.$alert('导入成功条数:' + response.msg + '<br>' + '失败行数:' + failrow, '导入结果', {dangerouslyUseHTMLString: true});
+        this.getList();
+      } else {
+        this.$alert('导入成功条数:' + response.msg, '导入结果', {dangerouslyUseHTMLString: true});
+      }
+    },
+    /** 下载模板操作 */
+    importTemplate() {
+      this.$refs['downloadFileForm'].submit()
+    },
     /** 查询阀门锁开锁关状态记录列表 */
     getList() {
       this.loading = true;
@@ -342,7 +451,7 @@ export default {
     // 多选框选中数据
     handleSelectionChange(selection) {
       this.ids = selection.map(item => item.id)
-      this.single = selection.length!==1
+      this.single = selection.length !== 1
       this.multiple = !selection.length
     },
     /** 新增按钮操作 */
@@ -384,12 +493,13 @@ export default {
     /** 删除按钮操作 */
     handleDelete(row) {
       const ids = row.id || this.ids;
-      this.$modal.confirm('是否确认删除阀门锁开锁关状态记录编号为"' + ids + '"的数据项?').then(function() {
+      this.$modal.confirm('是否确认删除阀门锁开锁关状态记录编号为"' + ids + '"的数据项?').then(function () {
         return delValve(ids);
       }).then(() => {
         this.getList();
         this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+      }).catch(() => {
+      });
     },
     /** 导出按钮操作 */
     handleExport() {