From 411d79af7b1b755535fa9a9ee6ed94f682fca09a Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期四, 21 十二月 2023 17:19:18 +0800
Subject: [PATCH] 保养标准导入

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/MaintenanceStandardController.java   |  175 +++++++++++++++++++++++--------------------
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java |    6 
 2 files changed, 98 insertions(+), 83 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java
index 595167d..bbe7f0b 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EquipmentReportRepairController.java
@@ -264,14 +264,14 @@
                 FaultInfo faultInfo = faultInfoService.getOne(new QueryWrapper<FaultInfo>().eq("quanlity_id",quanlityConfirm.getId()),false);
                 if(ObjectUtils.isNotNull(faultInfo)){
                     String isConfirm2 = faultInfo.getIsConfirm();
-                    if(!isConfirm1.equals("yes")||isConfirm2.equals("yes")){
-                        return Result.error("楠屾敹澶辫触锛屼骇鍝佽川閲忛殣鎮g‘璁ゅ拰浜嬫晠鐧昏灏氭湭瀹屽満锛岃瀹屾垚纭鍚庡啀杩涜楠屾敹");
+                    if(!isConfirm1.equals("yes")||!isConfirm2.equals("yes")){
+                        return Result.error("楠屾敹澶辫触锛屼骇鍝佽川閲忛殣鎮g‘璁ゅ拰浜嬫晠鐧昏灏氭湭瀹屾垚锛岃瀹屾垚纭鍚庡啀杩涜楠屾敹");
                     }
                 }else {
                     return Result.error("楠屾敹澶辫触锛屾湭鐢熸垚浜嬫晠鐧昏鍗�");
                 }
             }else {
-                return Result.error("楠屾敹澶辫触锛屾湭鐢熸垚浜у钩璐ㄩ噺纭");
+                return Result.error("楠屾敹澶辫触锛屾湭鐢熸垚浜у搧璐ㄩ噺纭");
             }
         }
         LoginUser user= (LoginUser)SecurityUtils.getSubject().getPrincipal();
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/MaintenanceStandardController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/MaintenanceStandardController.java
index 297644f..03caa52 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/MaintenanceStandardController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/MaintenanceStandardController.java
@@ -336,7 +336,7 @@
                                     equipmentNum =cellEquipmentNum.getText();
                                     equipment = equipmentService.getOne(new QueryWrapper<Equipment>().eq("num",equipmentNum).eq("del_flag",0),false);
                                     if(ObjectUtils.isNotNull(equipment)){
-                                        maintenanceStandard = maintenanceStandardService.getOne(new QueryWrapper<MaintenanceStandard>().eq("version_status","2").eq("del_flag",0).eq("equipment_id",equipment.getId()),false);
+                                        maintenanceStandard = maintenanceStandardService.getOne(new QueryWrapper<MaintenanceStandard>().eq("maintenance_type","2").eq("version_status","2").eq("del_flag",0).eq("equipment_id",equipment.getId()),false);
                                         if(ObjectUtils.isNull(maintenanceStandard)){
                                             maintenanceStandard = new MaintenanceStandard();
                                             maintenanceStandard.setNum(sysIdentityService.getNumByTypeAndLength("DailyMaintenanceStandard",4));
@@ -344,6 +344,7 @@
                                             maintenanceStandard.setAssignMode("1");
                                             maintenanceStandard.setVersion("1.0");
                                             maintenanceStandard.setType("daily");
+                                            maintenanceStandard.setMaintenanceType("2");
                                             maintenanceStandard.setVersionStatus("2");
                                             maintenanceStandard.setDelFlag(0);
                                             maintenanceStandard.setApprovalStatus("5");
@@ -409,6 +410,99 @@
                             }
                         }
                     }
+                    if(mainTitle.equals("鐢熶骇璁惧涓夌骇淇濆吇瑙勮寖")){
+
+                        for (XWPFTable table : document.getTables()) {
+                            // 閬嶅巻琛ㄦ牸涓殑鎵�鏈夎
+                            int rowNumber = 0;
+                            String equipmentNum = "";
+                            Equipment equipment = null;
+                            MaintenanceStandard maintenanceStandard = null;
+                            MaintenanceCycle maintenanceCycle = null;
+                            XWPFTableRow row0= table.getRow(0);
+                            if(ObjectUtils.isNotNull(row0)){
+                                XWPFTableCell cellEquipmentNum = row0.getCell(3);
+                                if(ObjectUtils.isNotNull(cellEquipmentNum)){
+                                    equipmentNum =cellEquipmentNum.getText();
+                                    equipment = equipmentService.getOne(new QueryWrapper<Equipment>().eq("num",equipmentNum).eq("del_flag",0),false);
+                                    if(ObjectUtils.isNotNull(equipment)){
+                                        maintenanceStandard = maintenanceStandardService.getOne(new QueryWrapper<MaintenanceStandard>().eq("maintenance_type","3").eq("version_status",2).eq("del_flag",0).eq("equipment_id",equipment.getId()),false);
+                                        String abc = equipment.getEquipmentImportanceId();
+                                        if(StringUtils.isNotBlank(abc)){
+                                            if(abc.equals("A")){
+                                                maintenanceCycle = maintenanceCycleService.getOne(new QueryWrapper<MaintenanceCycle>().eq("name","3骞�").eq("version_status",2).eq("del_flag",0),false);
+                                            }else {
+                                                maintenanceCycle = maintenanceCycleService.getOne(new QueryWrapper<MaintenanceCycle>().eq("name","4骞�").eq("version_status",2).eq("del_flag",0),false);
+                                            }
+                                        }
+                                        else{
+                                            return Result.error("瀵煎叆澶辫触锛岃璁惧娌℃湁缁存姢ABC鏍囪瘑");
+                                        }
+                                        if(ObjectUtils.isNull(maintenanceStandard)){
+                                            maintenanceStandard = new MaintenanceStandard();
+                                            maintenanceStandard.setNum(sysIdentityService.getNumByTypeAndLength("DailyMaintenanceStandard",4));
+                                            maintenanceStandard.setEquipmentId(equipment.getId());
+                                            maintenanceStandard.setAssignMode("1");
+                                            maintenanceStandard.setVersion("1.0");
+                                            maintenanceStandard.setVersionStatus("2");
+                                            maintenanceStandard.setType("daily");
+                                            maintenanceStandard.setMaintenanceType("3");
+                                            maintenanceStandard.setApprovalStatus("5");
+                                            maintenanceStandardService.save(maintenanceStandard);
+                                        }
+                                        else {
+                                            continue;
+                                        }
+                                    }
+                                    else {
+                                        continue;
+                                    }
+                                }
+                                else {
+                                    continue;
+                                }
+                            }
+                            else {
+                                continue;
+                            }
+                            String location0 = "";
+                            for (XWPFTableRow row : table.getRows()) {
+                                XWPFTableCell cell0 = row.getCell(0);
+                                XWPFTableCell cell1 = row.getCell(1);
+                                XWPFTableCell cell2 = row.getCell(2);
+                                if(rowNumber>2){
+                                    String location = cell0.getText();
+                                    if(StringUtils.isNotBlank(location)){
+                                        location0=location;
+                                    }
+                                    String projectName = cell1.getText();
+                                    String projectStandard = cell2.getText();
+                                    MaintenanceStandardDetail maintenanceStandardDetail = new MaintenanceStandardDetail();
+                                    MaintenanceProjectCategory maintenanceProjectCategory = maintenanceProjectCategoryService.getOne(new QueryWrapper<MaintenanceProjectCategory>().eq("name","涓夌骇淇濆吇").eq("del_flag",0),false);
+                                    if(ObjectUtils.isNotNull(maintenanceProjectCategory)){
+                                        MaintenanceProject maintenanceProject = maintenanceProjectService.getOne(new QueryWrapper<MaintenanceProject>().eq("name",projectName).eq("standard",projectStandard).eq("del_flag",0).eq("maintenance_project_category_id",maintenanceProjectCategory.getId()),false);
+                                        if (!ObjectUtils.isNotNull(maintenanceProject)) {
+                                            maintenanceProject = new MaintenanceProject();
+                                            maintenanceProject.setNum(sysIdentityService.getNumByTypeAndLength("MainOfTwo", 4));
+                                            maintenanceProject.setName(projectName);
+                                            maintenanceProject.setStandard(projectStandard);
+                                            maintenanceProject.setLocation(location0);
+                                            maintenanceProject.setMaintenanceProjectCategoryId(maintenanceProjectCategory.getId());
+                                            maintenanceProject.setDelFlag(0);
+                                            maintenanceProjectService.save(maintenanceProject);
+                                        }
+                                        maintenanceStandardDetail.setMaintenanceProjectId(maintenanceProject.getId());
+                                        maintenanceStandardDetail.setLocation(location0);
+                                        maintenanceStandardDetail.setMaintenanceCycleId(maintenanceCycle.getId());
+                                        maintenanceStandardDetail.setMaintenanceStandardId(maintenanceStandard.getId());
+                                        maintenanceStandardDetailService.save(maintenanceStandardDetail);
+                                    }
+
+                                }
+                                rowNumber++;
+                            }
+                        }
+                    }
                     return Result.OK("瀵煎叆鎴愬姛");
                 } else {
                     System.out.println("鏃犳硶瑙f瀽璇ユ枃浠�");
@@ -445,86 +539,7 @@
                 if (mainTitleParagraph != null) {
                     // 鑾峰彇涓绘爣棰樻枃鏈唴瀹�
                     String mainTitle = mainTitleParagraph.getText();
-                    if(mainTitle.equals("鐢熶骇璁惧涓夌骇淇濆吇瑙勮寖")){
-                        for (XWPFTable table : document.getTables()) {
-                            // 閬嶅巻琛ㄦ牸涓殑鎵�鏈夎
-                            int rowNumber = 0;
-                            String equipmentNum = "";
-                            Equipment equipment = null;
-                            MaintenanceStandard maintenanceStandard = null;
-                            XWPFTableRow row0= table.getRow(0);
-                            if(ObjectUtils.isNotNull(row0)){
-                                XWPFTableCell cellEquipmentNum = row0.getCell(3);
-                                if(ObjectUtils.isNotNull(cellEquipmentNum)){
-                                    equipmentNum =cellEquipmentNum.getText();
-                                    equipment = equipmentService.getOne(new QueryWrapper<Equipment>().eq("num",equipmentNum).eq("del_flag",0),false);
-                                    if(ObjectUtils.isNotNull(equipment)){
-                                        maintenanceStandard = maintenanceStandardService.getOne(new QueryWrapper<MaintenanceStandard>().eq("version_status",2).eq("del_flag",0).eq("equipment_id",equipment.getId()),false);
-                                        if(ObjectUtils.isNull(maintenanceStandard)){
-                                            maintenanceStandard = new MaintenanceStandard();
-                                            maintenanceStandard.setNum(sysIdentityService.getNumByTypeAndLength("DailyMaintenanceStandard",4));
-                                            maintenanceStandard.setEquipmentId(equipment.getId());
-                                            maintenanceStandard.setAssignMode("1");
-                                            maintenanceStandard.setVersion("1.0");
-                                            maintenanceStandard.setVersionStatus("2");
-                                            maintenanceStandard.setType("daily");
-                                            maintenanceStandard.setApprovalStatus("5");
-                                            maintenanceStandardService.save(maintenanceStandard);
-                                        }
-                                        else {
-                                            continue;
-                                        }
-                                    }
-                                    else {
-                                        continue;
-                                    }
-                                }
-                                else {
-                                    continue;
-                                }
-                            }
-                            else {
-                                continue;
-                            }
-                            for (XWPFTableRow row : table.getRows()) {
-                                XWPFTableCell cell0 = row.getCell(0);
-                                XWPFTableCell cell1 = row.getCell(1);
-                                XWPFTableCell cell2 = row.getCell(2);
-                                if(rowNumber>2){
-                                    String location = getMergedCellValue(cell0);
-                                    String projectName = cell1.getText();
-                                    String projectStandard = cell2.getText();
-                                    MaintenanceStandardDetail maintenanceStandardDetail = new MaintenanceStandardDetail();
-                                    MaintenanceProjectCategory maintenanceProjectCategory = maintenanceProjectCategoryService.getOne(new QueryWrapper<MaintenanceProjectCategory>().eq("name","涓夌骇淇濆吇").eq("del_flag",0),false);
-                                    if(ObjectUtils.isNotNull(maintenanceProjectCategory)){
-                                        MaintenanceProject maintenanceProject = maintenanceProjectService.getOne(new QueryWrapper<MaintenanceProject>().eq("name",projectName).eq("standard",projectStandard).eq("del_flag",0).eq("maintenance_project_category_id",maintenanceProjectCategory.getId()),false);
-                                        MaintenanceCycle maintenanceCycle = null;
-                                        if(equipment.getEquipmentImportanceId().equals("A")){
-                                             maintenanceCycle = maintenanceCycleService.getOne(new QueryWrapper<MaintenanceCycle>().eq("name","3骞�").eq("version_status",2).eq("del_flag",0),false);
-                                        }else {
-                                             maintenanceCycle = maintenanceCycleService.getOne(new QueryWrapper<MaintenanceCycle>().eq("name","4骞�").eq("version_status",2).eq("del_flag",0),false);
-                                        }
-                                        if (!ObjectUtils.isNotNull(maintenanceProject)) {
-                                            maintenanceProject = new MaintenanceProject();
-                                            maintenanceProject.setNum(sysIdentityService.getNumByTypeAndLength("MainOfTwo", 4));
-                                            maintenanceProject.setName(projectName);
-                                            maintenanceProject.setLocation(location);
-                                            maintenanceProject.setMaintenanceProjectCategoryId(maintenanceProjectCategory.getId());
-                                            maintenanceProject.setDelFlag(0);
-                                            maintenanceProjectService.save(maintenanceProject);
-                                        }
-                                        maintenanceStandardDetail.setMaintenanceProjectId(maintenanceProject.getId());
-                                        maintenanceStandardDetail.setLocation(location);
-                                        maintenanceStandardDetail.setMaintenanceCycleId(maintenanceCycle.getId());
-                                        maintenanceStandardDetail.setMaintenanceStandardId(maintenanceStandard.getId());
-                                        maintenanceStandardDetailService.save(maintenanceStandardDetail);
-                                    }
 
-                                }
-                                rowNumber++;
-                            }
-                        }
-                    }
                 } else {
                     System.out.println("鏃犳硶瑙f瀽璇ユ枃浠�");
                 }

--
Gitblit v1.9.3