qushaowei
2024-01-15 cb7eb6fa3477e624f7112a2eac632783b96bf4b4
点检标准 多sheet页导入
已修改1个文件
20 ■■■■ 文件已修改
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/DailyInspectionStandardController.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/DailyInspectionStandardController.java
@@ -269,9 +269,11 @@
        int successLines = 0, errorLines = 0;
        //a = 1开始读取点检项目;b = 1开始读取周保养项目;c = 1该设备导入信息存在错误;projectColumnIndex点检项目所在列;maintenanceColumnIndex周保养项目所在列
        int a = 0,b = 0,c = 0,projectColumnIndex = -1,maintenanceColumnIndex = 0;
        //表头标题
        String title = "";
        String dailyInspectionStandardId = null;
        String equipmentNum = null;
        DailyInspectionStandard dailyInspectionStandard = new DailyInspectionStandard();
        DailyInspectionStandard dailyInspectionStandard = null;
        List<DailyInspectionStandardDetail> dailyInspectionStandardDetailList = new ArrayList<>();
        for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
            MultipartFile file = entity.getValue();
@@ -301,6 +303,9 @@
                                if("STRING".equals(cell.getCellType().toString())|| "BLANK".equals(cell.getCellType().toString())){
                                    //点检周期存在,判断设备统一编码是否存在
                                    String strCell = cell.getStringCellValue();
                                    if(strCell.contains("生产设备自主维护点检表")){
                                        title = strCell.trim().substring(11).trim();
                                    }
                                    if(strCell.contains("设备名称:")){
                                        String[] tybh1  = strCell.split("统一编号:");
                                        String[] tybh2 = tybh1[1].split("年");
@@ -325,12 +330,15 @@
                                                errorLines++;
                                            }else {
                                                c = 0;
                                                dailyInspectionStandard.setNum(identityService.getNumByTypeAndLength("DailylnspectionStandard",4));
                                                String num = identityService.getNumByTypeAndLength("DailylnspectionStandard", 4);
                                                dailyInspectionStandard = new DailyInspectionStandard();
                                                dailyInspectionStandard.setNum(num);
                                                dailyInspectionStandard.setVersionStatus("2");
                                                dailyInspectionStandard.setVersion("1.0");
                                                dailyInspectionStandard.setAssignMode("1");
                                                dailyInspectionStandard.setEquipmentId(equipment.getId());
                                                dailyInspectionStandard.setApprovalStatus("5");
                                                dailyInspectionStandard.setDisUda1(title);
                                                //dailyInspectionStandardService.save(dailyInspectionStandard);
                                                //dailyInspectionStandardId = dailyInspectionStandard.getId();
                                            }
@@ -353,9 +361,10 @@
                                            dailyInspectionStandardDetail.setDailyInspectionStandardId(dailyInspectionStandardId);
                                            String dayInspectionProjectName = row.getCell(projectColumnIndex).toString();
                                            String standard = row.getCell(projectColumnIndex+3).toString();
                                            //查询点击项目,如果没有新增点检项目
                                            //查询点检项目,如果没有新增点检项目
                                            if(StringUtils.isNotBlank(dayInspectionProjectName)){
                                                List<InspectionProject> inspectionProjectList = inspectionProjectService.lambdaQuery().eq(InspectionProject::getName,dayInspectionProjectName).eq(InspectionProject::getDelFlag,CommonConstant.DEL_FLAG_0).list();
                                                List<InspectionProject> inspectionProjectList = inspectionProjectService.lambdaQuery().eq(InspectionProject::getName,dayInspectionProjectName)
                                                        .eq(InspectionProject::getDetectionStandard,standard).eq(InspectionProject::getDelFlag,CommonConstant.DEL_FLAG_0).list();
                                                if(CollectionUtils.isEmpty(inspectionProjectList)){
                                                    InspectionProject inspectionProject = new InspectionProject();
                                                    inspectionProject.setNum(identityService.getNumByTypeAndLength("InspectionProject",4));
@@ -400,7 +409,8 @@
                                            String weekInspectionProjectName = row.getCell(maintenanceColumnIndex).toString();
                                            String inspectionStandardName = row.getCell(maintenanceColumnIndex+3).toString();
                                            if(StringUtils.isNotBlank(weekInspectionProjectName)){
                                                List<InspectionProject> inspectionProjectList = inspectionProjectService.lambdaQuery().eq(InspectionProject::getName,weekInspectionProjectName).eq(InspectionProject::getDelFlag,CommonConstant.DEL_FLAG_0).list();
                                                List<InspectionProject> inspectionProjectList = inspectionProjectService.lambdaQuery().eq(InspectionProject::getName,weekInspectionProjectName)
                                                        .eq(InspectionProject::getDetectionStandard,inspectionStandardName).eq(InspectionProject::getDelFlag,CommonConstant.DEL_FLAG_0).list();
                                                if(CollectionUtils.isEmpty(inspectionProjectList)){
                                                    InspectionProject inspectionProject = new InspectionProject();
                                                    inspectionProject.setNum(identityService.getNumByTypeAndLength("InspectionProject",4));