jinlin
1 天以前 bf5b01b14dc7bfc214e646425a62f5593890d7e3
src/main/java/com/example/server/progressTrack/service/DjJdgzNetworkLevel3Service.java
@@ -16,15 +16,13 @@
import com.example.server.progressTrack.model.DjJdgzNetworkLevel3List;
import com.example.server.progressTrack.model.DjJdgzTrackRecord;
import com.example.server.teamGroup.service.SysTeamGroupClassService;
import com.example.server.utils.ExcelImportException;
import com.example.server.utils.FileUtils;
import com.example.server.utils.ImportUtil;
import com.example.server.utils.UUIDUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -241,11 +239,13 @@
                String teamGroupStr = ImportUtil.getCellValue(row, 4, pattern);
                String cabinStr = ImportUtil.getCellValue(row, 5, pattern);
                String typeStr = ImportUtil.getCellValue(row, 6, pattern);
                String time1 = ImportUtil.getCellValue(row, 7, pattern);
                String time2 = ImportUtil.getCellValue(row, 8, pattern);
                String time3 = ImportUtil.getCellValue(row, 9, pattern);
                String time4 = ImportUtil.getCellValue(row, 10, pattern);
                String time5 = ImportUtil.getCellValue(row, 11, pattern);
                Cell time1 = row.getCell(7);
                Cell time2 = row.getCell(8);
                Cell time3 = row.getCell(9);
                Cell time4 = row.getCell(10);
                Cell time5 = row.getCell(11);
                String repairUnit = ImportUtil.getCellValue(row, 12, pattern);
                String repairUnitDirector = ImportUtil.getCellValue(row, 13, pattern);
                String repairUnitContact = ImportUtil.getCellValue(row, 14, pattern);
@@ -338,7 +338,7 @@
                    data.setCabinId(idBuilder.toString());
                }
                if (StringUtils.isNotBlank(time1)) {
                if (time1 != null) {
                    String Pname = "";
                    if (typeStr.equals("改换装")||typeStr.equals("改进性修理")){
                        Pname = "设备到厂";
@@ -347,30 +347,27 @@
                    }else if(typeStr.equals("不复装设备")){
                        Pname = "拆卸出舱";
                    }
                    if (time1.matches("[0-9/]+")) {
                        time1 = time1.replace("/", "-");
                        node.setRequiredCompletionTime(time1);
                        node.setProcessName(Pname);
                        node.setSort(1);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time1.matches("[0-9.]+")) {
                        time1 = time1.replace(".", "-");
                        node.setRequiredCompletionTime(time1);
                        node.setProcessName(Pname);
                        node.setSort(1);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time1.matches("[0-9-]+")) {
                        node.setRequiredCompletionTime(time1);
                        node.setProcessName(Pname);
                        node.setSort(1);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else {
                        result = "第" + j + "行" + "第" + 1 + "个" + "节点时间日期格式不规范";
                    try {
                        String date = ImportUtil.getDateStrFromCell(time1);
                        if (date == null) {
                            result = "第" + j + "行" + "节点时间不能为空";
                            ImportUtil.updateErrMap(errMap, "节点时间不能为空", sheetName, row1);
                            isErr = true;
                        } else {
                            node.setRequiredCompletionTime(date);
                            node.setProcessName(Pname);
                            node.setSort(1);
                            DjJdgzNetworkLevel3ListService.insert(node);
                        }
                    } catch (ExcelImportException e) {
                        result = "第" + j + "行" + "第" + 1 + "个" + "节点时间日期格式不正确";
                        ImportUtil.updateErrMap(errMap, "节点时间日期格式不正确", sheetName, row1);
                        isErr = true;
                    }
                }
                if (StringUtils.isNotBlank(time2)) {
                if (time2 != null) {
                    if (node.getId() != null) {
                        node.setId(null);
                    }
@@ -382,29 +379,27 @@
                    }else if(typeStr.equals("不复装设备")){
                        Pname = "入库";
                    }
                    if (time2.matches("[0-9/]+")) {
                        node.setRequiredCompletionTime(time2);
                        node.setProcessName(Pname);
                        node.setSort(2);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time2.matches("[0-9.]+")) {
                        time2 = time2.replace(".", "-");
                        node.setRequiredCompletionTime(time2);
                        node.setProcessName(Pname);
                        node.setSort(2);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time2.matches("[0-9-]+")) {
                        node.setRequiredCompletionTime(time2);
                        node.setProcessName(Pname);
                        node.setSort(2);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else {
                        result = "第" + j + "行" + "第" + 2 + "个" + "节点时间的日期格式不规范";
                    try {
                        String date = ImportUtil.getDateStrFromCell(time2);
                        if (date == null) {
                            result = "第" + j + "行" + "节点时间不能为空";
                            ImportUtil.updateErrMap(errMap, "节点时间不能为空", sheetName, row1);
                            isErr = true;
                        } else {
                            node.setRequiredCompletionTime(date);
                            node.setProcessName(Pname);
                            node.setSort(2);
                            DjJdgzNetworkLevel3ListService.insert(node);
                        }
                    } catch (ExcelImportException e) {
                        result = "第" + j + "行" + "第" + 2 + "个" + "节点时间的日期格式不正确";
                        ImportUtil.updateErrMap(errMap, "节点时间日期格式不正确", sheetName, row1);
                        isErr = true;
                    }
                }
                if (StringUtils.isNotBlank(time3)) {
                if (time3 != null) {
                    if (node.getId() != null) {
                        node.setId(null);
                    }
@@ -414,30 +409,28 @@
                    }else if(typeStr.equals("不复装设备")){
                        Pname = "存放位置";
                    }
                    if (time3.matches("[0-9/]+")) {
                        time3 = time3.replace("/", "-");
                        node.setRequiredCompletionTime(time3);
                        node.setProcessName(Pname);
                        node.setSort(3);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time3.matches("[0-9.]+")) {
                        time3 = time3.replace(".", "-");
                        node.setRequiredCompletionTime(time3);
                        node.setProcessName(Pname);
                        node.setSort(3);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time3.matches("[0-9-]+")) {
                        node.setRequiredCompletionTime(time3);
                        node.setProcessName(Pname);
                        node.setSort(3);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else {
                        result = "第" + j + "行" + "第" + 3 + "个" + "节点时间的日期格式不规范";
                    try {
                        String date = ImportUtil.getDateStrFromCell(time3);
                        if (date == null) {
                            result = "第" + j + "行" + "节点时间不能为空";
                            ImportUtil.updateErrMap(errMap, "节点时间不能为空", sheetName, row1);
                            isErr = true;
                        } else {
                            node.setRequiredCompletionTime(date);
                            node.setProcessName(Pname);
                            node.setSort(3);
                            DjJdgzNetworkLevel3ListService.insert(node);
                        }
                    } catch (ExcelImportException e) {
                        result = "第" + j + "行" + "第" + 3 + "个" + "节点时间的日期格式不正确";
                        ImportUtil.updateErrMap(errMap, "节点时间日期格式不正确", sheetName, row1);
                        isErr = true;
                    }
                }
                if (StringUtils.isNotBlank(time4)) {
                if (time4 != null) {
                    if (node.getId() != null) {
                        node.setId(null);
                    }
@@ -447,52 +440,52 @@
                    }else if(typeStr.equals("不复装设备")){
                        Pname = "移交T队";
                    }
                    if (time4.matches("[0-9/]+")) {
                        time4 = time4.replace("/", "-");
                        node.setRequiredCompletionTime(time4);
                        node.setProcessName(Pname);
                        node.setSort(4);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time4.matches("[0-9.]+")) {
                        time4 = time4.replace(".", "-");
                        node.setRequiredCompletionTime(time4);
                        node.setProcessName(Pname);
                        node.setSort(4);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time4.matches("[0-9-]+")) {
                        node.setRequiredCompletionTime(time4);
                        node.setProcessName(Pname);
                        node.setSort(4);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else {
                        result = "第" + j + "行" + "第" + 4 + "个" + "节点时间的日期格式不规范";
                    try {
                        String date = ImportUtil.getDateStrFromCell(time4);
                        if (date == null) {
                            result = "第" + j + "行" + "节点时间不能为空";
                            ImportUtil.updateErrMap(errMap, "节点时间不能为空", sheetName, row1);
                            isErr = true;
                        } else {
                            node.setRequiredCompletionTime(date);
                            node.setProcessName(Pname);
                            node.setSort(4);
                            DjJdgzNetworkLevel3ListService.insert(node);
                        }
                    } catch (ExcelImportException e) {
                        result = "第" + j + "行" + "第" + 4 + "个" + "节点时间的日期格式不正确";
                        ImportUtil.updateErrMap(errMap, "节点时间日期格式不正确", sheetName, row1);
                        isErr = true;
                    }
                }
                if (StringUtils.isNotBlank(time5)) {
                if (time5 != null) {
                    if (node.getId() != null) {
                        node.setId(null);
                    }
                    if (time5.matches("[0-9/]+")) {
                        time5 = time5.replace("/", "-");
                        node.setRequiredCompletionTime(time5);
                        node.setProcessName("回装");
                        node.setSort(5);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time5.matches("[0-9.]+")) {
                        time5 = time5.replace(".", "-");
                        node.setRequiredCompletionTime(time5);
                        node.setProcessName("回装");
                        node.setSort(5);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else if (time5.matches("[0-9-]+")) {
                        node.setRequiredCompletionTime(time5);
                        node.setProcessName("回装");
                        node.setSort(5);
                        DjJdgzNetworkLevel3ListService.insert(node);
                    } else {
                        result = "第" + j + "行" + "第" + 5 + "个" + "要求完成时间的日期格式不规范";
                    String Pname = "";
                    if(typeStr.equals("修理")){
                        Pname = "设备返厂";
                    }else if(typeStr.equals("不复装设备")){
                        Pname = "移交T队";
                    }
                    try {
                        String date = ImportUtil.getDateStrFromCell(time5);
                        if (date == null) {
                            result = "第" + j + "行" + "节点时间不能为空";
                            ImportUtil.updateErrMap(errMap, "节点时间不能为空", sheetName, row1);
                            isErr = true;
                        } else {
                            node.setRequiredCompletionTime(date);
                            node.setProcessName(Pname);
                            node.setSort(5);
                            DjJdgzNetworkLevel3ListService.insert(node);
                        }
                    } catch (ExcelImportException e) {
                        result = "第" + j + "行" + "第" + 5 + "个" + "节点时间的日期格式不正确";
                        ImportUtil.updateErrMap(errMap, "节点时间日期格式不正确", sheetName, row1);
                        isErr = true;
                    }
                }