瀏覽代碼

设备之系统——保养检修 V2.1 OPT
更新保养库EXCEL导入

hyq 1 年之前
父節點
當前提交
9436d8a016

+ 13 - 11
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquMaintenanceStandardListener.java

@@ -3,11 +3,9 @@ package com.rongwei.bscommon.sys.config;
 import com.alibaba.excel.context.AnalysisContext;
 import com.alibaba.excel.event.AnalysisEventListener;
 import com.rongwei.bscommon.sys.excel.EquMaintenanceStandardTemplate;
-import com.rongwei.bscommon.sys.utils.CommonUtils;
 import com.rongwei.bsentity.domain.EquMaintenanceStandardDo;
-import com.rongwei.bsentity.enums.EquipmentTypeEnum;
 import com.rongwei.bsentity.enums.MaintenanceTypeEnum;
-import com.rongwei.rwadmincommon.system.vo.SysUserVo;
+import com.rongwei.bsentity.enums.PlantEnum;
 import com.rongwei.rwcommon.utils.SecurityUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
@@ -24,7 +22,7 @@ import java.util.*;
 @Slf4j
 public class EquMaintenanceStandardListener extends AnalysisEventListener<EquMaintenanceStandardTemplate> {
 
-    private static final String[] NON_SET = {"equipmenttype", "maintenancetype", "maintenancesite", "maintenancecontext", "precontrol", "means"};
+    private static final String[] NON_SET = {"plantName","equipmentName","maintenancetype", "maintenancesite", "maintenancecontext", "isoutsource"};
 
     private List<EquMaintenanceStandardDo> maintenanceStandardList = new ArrayList<>();
 
@@ -76,20 +74,24 @@ public class EquMaintenanceStandardListener extends AnalysisEventListener<EquMai
     private EquMaintenanceStandardDo migrateDate(EquMaintenanceStandardTemplate equMaintenanceStandardTemplate) {
         Date date = new Date();
         StringBuilder planMonth = new StringBuilder();
-        SysUserVo currentUser = CommonUtils.getCurrentUser();
+        // SysUserVo currentUser = CommonUtils.getCurrentUser();
         EquMaintenanceStandardDo equMaintenanceStandardDo = new EquMaintenanceStandardDo();
         BeanUtils.copyProperties(equMaintenanceStandardTemplate, equMaintenanceStandardDo);
         equMaintenanceStandardDo.setMaintenancetype(MaintenanceTypeEnum.messageOf(equMaintenanceStandardTemplate.getMaintenancetype()).toString())
-                .setEquipmenttype(EquipmentTypeEnum.messageOf(equMaintenanceStandardTemplate.getEquipmenttype()).toString())
+                // .setEquipmenttype(EquipmentTypeEnum.messageOf(equMaintenanceStandardTemplate.getEquipmenttype()).toString())
                 .setCreatedate(date)
                 .setModifydate(date)
                 .setId(SecurityUtil.getUUID())
-                .setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1])
+                // .setTenantid(currentUser.getOrganizationDoList().get(0).getFullpid().split(",")[1])
+                .setTenantid(PlantEnum.idOf(equMaintenanceStandardTemplate.getPlantName()))
+                .setPlant(equMaintenanceStandardTemplate.getPlantName())
                 //                .setTenantid("0001S31000000000J0TR")
-                .setCreateusername(currentUser.getName())
-                .setCreateuserid(currentUser.getId())
-                .setModifyusername(currentUser.getName())
-                .setModifyuserid(currentUser.getId())
+                // .setCreateusername(currentUser.getName())
+                // .setCreateuserid(currentUser.getId())
+                // .setModifyusername(currentUser.getName())
+                // .setModifyuserid(currentUser.getId())
+                .setEquipmentNumber(equMaintenanceStandardTemplate.getEquipmentnumber())
+                .setEquipmentName(equMaintenanceStandardTemplate.getEquipmentName())
                 .setIsoutsource(String.valueOf("是".equals(equMaintenanceStandardTemplate.getIsoutsource()) ? 0 : 1));
         if("是".equals(equMaintenanceStandardTemplate.getJan()) ){
             equMaintenanceStandardDo.setJan(1);

+ 34 - 22
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/excel/EquMaintenanceStandardTemplate.java

@@ -15,20 +15,32 @@ import lombok.EqualsAndHashCode;
 public class EquMaintenanceStandardTemplate {
 
 
+    /**
+     * 工厂名称
+     */
+    @ExcelProperty(index = 1)
+    private String plantName;
+
+    /**
+     * 设备名称
+     */
+    @ExcelProperty(index = 2)
+    private String equipmentName;
+
     /**
      * table name:EQUIPMENTTYPE
      * table type:varchar(20)
-     * table comment:设备分类
+     * table comment:设备编号
      */
-    @ExcelProperty(index = 1)
-    private String equipmenttype;
+    @ExcelProperty(index = 3)
+    private String equipmentnumber;
 
     /**
      * table name:MAINTENANCETYPE
      * table type:varchar(20)
      * table comment:保养分类
      */
-    @ExcelProperty(index = 2)
+    @ExcelProperty(index = 4)
     private String maintenancetype;
 
     /**
@@ -36,7 +48,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:text
      * table comment:保养部位
      */
-    @ExcelProperty(index = 3)
+    @ExcelProperty(index = 5)
     private String maintenancesite;
 
     /**
@@ -44,7 +56,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:text
      * table comment:保养内容
      */
-    @ExcelProperty(index = 4)
+    @ExcelProperty(index = 6)
     private String maintenancecontext;
 
     /**
@@ -52,7 +64,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:text
      * table comment:预控标准要求
      */
-    @ExcelProperty(index = 5)
+    @ExcelProperty(index = 7)
     private String precontrol;
 
     /**
@@ -60,7 +72,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:text
      * table comment:设备保障域控措施
      */
-    @ExcelProperty(index = 6)
+    @ExcelProperty(index = 8)
     private String equipmentsupport;
 
     /**
@@ -68,7 +80,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:text
      * table comment:保养/预防方法
      */
-    @ExcelProperty(index = 7)
+    @ExcelProperty(index = 9)
     private String means;
 
     /**
@@ -76,7 +88,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:varchar(10)
      * table comment:是否委外
      */
-    @ExcelProperty(index = 8)
+    @ExcelProperty(index = 10)
     private String isoutsource;
 
     /**
@@ -84,7 +96,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:1月
      */
-    @ExcelProperty(index = 9)
+    @ExcelProperty(index = 11)
     private String jan;
 
     /**
@@ -92,7 +104,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:2月
      */
-    @ExcelProperty(index = 10)
+    @ExcelProperty(index = 12)
     private String feb;
 
     /**
@@ -100,7 +112,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:3月
      */
-    @ExcelProperty(index = 11)
+    @ExcelProperty(index = 13)
     private String mar;
 
     /**
@@ -108,7 +120,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:4月
      */
-    @ExcelProperty(index = 12)
+    @ExcelProperty(index = 14)
     private String apr;
 
     /**
@@ -116,7 +128,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:5月
      */
-    @ExcelProperty(index = 13)
+    @ExcelProperty(index = 15)
     private String may;
 
     /**
@@ -124,7 +136,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:6月
      */
-    @ExcelProperty(index = 14)
+    @ExcelProperty(index = 16)
     private String jun;
 
     /**
@@ -132,7 +144,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:7月
      */
-    @ExcelProperty(index = 15)
+    @ExcelProperty(index = 17)
     private String jul;
 
     /**
@@ -140,7 +152,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:8月
      */
-    @ExcelProperty(index = 16)
+    @ExcelProperty(index = 18)
     private String aug;
 
     /**
@@ -148,7 +160,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:9月
      */
-    @ExcelProperty(index = 17)
+    @ExcelProperty(index = 19)
     private String sep;
 
     /**
@@ -156,7 +168,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:10月
      */
-    @ExcelProperty(index = 18)
+    @ExcelProperty(index = 20)
     private String oct;
 
     /**
@@ -164,7 +176,7 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:11月
      */
-    @ExcelProperty(index = 19)
+    @ExcelProperty(index = 21)
     private String nov;
 
     /**
@@ -172,6 +184,6 @@ public class EquMaintenanceStandardTemplate {
      * table type:int
      * table comment:12月
      */
-    @ExcelProperty(index = 20)
+    @ExcelProperty(index = 22)
     private String december;
 }

+ 20 - 0
cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/MaintenanceController.java

@@ -90,6 +90,16 @@ public class MaintenanceController {
         }
     }
 
+    /**
+     * 生成年度任务
+     *
+     * @param planYearCopy
+     * @return {@link R}
+     * @date 2024/2/5 10:36
+     * @author shangmi
+     *
+     */
+
     @PostMapping("saveYearByTask")
     public R saveYearByTask(@RequestBody PlanYearCopyDTO planYearCopy){
         try {
@@ -101,6 +111,16 @@ public class MaintenanceController {
         }
     }
 
+    /**
+     * 附件导入
+     *
+     * @param multipartFile
+     * @return {@link R}
+     * @date 2024/2/5 10:35
+     * @author shangmi
+     *
+     */
+
     @PostMapping("importStandardSave")
     public R uploadStandardSave(@RequestParam("file") MultipartFile multipartFile){
         try {