lyh
2025-07-05 1b7f266af71b91254a22295f1bafc6a905e0b41f
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamMaintenanceStandardServiceImpl.java
@@ -420,6 +420,10 @@
            if (result.isSuccess()) {
                if (eamMaintenanceStandardVo.getRepairManagerApproveResult() != null) {
                    if (eamMaintenanceStandardVo.getRepairManagerApproveResult().equals("1")){
                        List<FlowMyBusiness> newbusinessList = flowMyBusinessService.list(
                                new QueryWrapper<FlowMyBusiness>()
                                        .eq("process_instance_id", eamMaintenanceStandardVo.getInstanceId()));
                        FlowMyBusiness newflowMyBusiness = newbusinessList.get(0);
                        eamMaintenanceStandard.setStandardStatus(MaintenanceStandardStatusEnum.WAIT_TECHNICAL_DIRECTOR.name());
                        //获取flow的流程实例id,设置下一步的处理人员
                        EamMaintenanceStandard maintenanceStandard=this.getById(eamMaintenanceStandardVo.getDataId());
@@ -428,8 +432,8 @@
                        List<UserSelector> userSelectorList=sysUserService.selectOperatorFactoryList(eamEquipment.getEquipmentCode(),baseFactory.getId(), BusinessCodeConst.PCR0008);
                        if (!CollectionUtils.isEmpty(userSelectorList)) {
                            List<String> usernameList=userSelectorList.stream().map(UserSelector::getUsername).collect(Collectors.toList());
                            flowMyBusiness.setTodoUsers(JSON.toJSONString(usernameList));
                            flowMyBusinessService.updateById(flowMyBusiness);
                            newflowMyBusiness.setTodoUsers(JSON.toJSONString(usernameList));
                            flowMyBusinessService.updateById(newflowMyBusiness);
                        }
                    }else {
                        eamMaintenanceStandard.setStandardStatus(MaintenanceStandardStatusEnum.WAIT_SUBMIT.name());
@@ -517,4 +521,135 @@
    /*流程业务代码--------------------------结束*/
    /*导入文件--------------------------开始*/
    /**
     * 导入点检表数据
     * @param file Excel文件
     * @return 导入结果
     */
//    public Result<?> importInspectionData(MultipartFile file) {
//        int successCount = 0;
//
//        try (Workbook workbook = WorkbookFactory.create(file.getInputStream())) {
//            Sheet sheet = workbook.getSheetAt(0);
//            // 1. 解析表头信息
//            Map<String, String> header = parseHeader(sheet, errors);
//
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//
//        return new ImportResult(successCount, errors);
//    }
    /**
     * 解析表头信息
     */
//    private Map<String, String> parseHeader(Sheet sheet, List<ImportError> errors) {
//        Map<String, String> header = new HashMap<>();
//        try {
//            Row headerRow = sheet.getRow(0);
//            // 示例:第一行:设备名称:割炬  型号:gta001  统一编号:xc001
//            String cellValue = getCellStringValue(headerRow.getCell(0));
//
//            // 使用正则表达式解析关键信息
//            Pattern pattern = Pattern.compile("设备名称[::](\\S+)\\s+型号[::](\\S+)\\s+统一编号[::](\\S+)\\s+日期[::](\\S+)\\s+单位[::](\\S+)");
//            Matcher matcher = pattern.matcher(cellValue);
//
//            if (matcher.find()) {
//                header.put("deviceName", matcher.group(1));
//                header.put("deviceModel", matcher.group(2));
//                header.put("deviceCode", matcher.group(3));
//                header.put("inspectionMonth", matcher.group(4));
//                header.put("unit", matcher.group(5));
//            } else {
//                errors.add(new ImportError("表头格式错误", cellValue, 1));
//            }
//        } catch (Exception e) {
//            errors.add(new ImportError("解析表头异常", e.getMessage(), 1));
//        }
//        return header;
//    }
//
//    /**
//     * 解析每日点检项目
//     */
//    private List<InspectionItem> parseDailyItems(Sheet sheet, List<ImportError> errors) {
//        List<InspectionItem> items = new ArrayList<>();
//
//        // 点检项目从第3行开始(序号从1开始)
//        int startRow = 2;
//        int rowNum = startRow;
//
//        try {
//            // 找到每日点检表的结束位置(维护责任人签字)
//            while (rowNum <= sheet.getLastRowNum()) {
//                Row row = sheet.getRow(rowNum);
//                if (row == null) {
//                    rowNum++;
//                    continue;
//                }
//
//                // 判断是否到达结束位置
//                String sequenceValue = getCellStringValue(row.getCell(0));
//                if ("9".equals(sequenceValue) || "维护责任人签字".contains(sequenceValue)) {
//                    break;
//                }
//
//                // 解析项目行
//                InspectionItem item = new InspectionItem();
//                item.setSequence(Integer.parseInt(sequenceValue));
//                item.setProjectName(getCellStringValue(row.getCell(1)));
//                item.setRequirement(getCellStringValue(row.getCell(2)));
//
//                items.add(item);
//                rowNum++;
//            }
//        } catch (Exception e) {
//            errors.add(new ImportError("解析每日项目异常", e.getMessage(), rowNum + 1));
//        }
//
//        return items;
//    }
//
//    /**
//    * 解析周保养项目
//     */
//    private List<InspectionItem> parseWeeklyItems(Sheet sheet, List<ImportError> errors) {
//        List<InspectionItem> items = new ArrayList<>();
//
//        try {
//            // 定位周保养标题行(行号11)
//            int startRow = 10;
//
//            // 从第12行开始是周保养项目
//            for (int rowNum = startRow + 1; rowNum <= sheet.getLastRowNum(); rowNum++) {
//                Row row = sheet.getRow(rowNum);
//                if (row == null) continue;
//
//                String sequenceValue = getCellStringValue(row.getCell(0));
//
//                // 遇到结束标志则停止解析
//                if ("周保养操作者执行".contains(sequenceValue)) break;
//
//                try {
//                    InspectionItem item = new InspectionItem();
//                    item.setSequence(Integer.parseInt(sequenceValue));
//                    item.setProjectName(getCellStringValue(row.getCell(1)));
//                    item.setStandard(getCellStringValue(row.getCell(2)));
//                    item.setRequirement(getCellStringValue(row.getCell(3))); // 执行记录
//
//                    items.add(item);
//                } catch (Exception e) {
//                    errors.add(new ImportError("解析周保养项目异常", e.getMessage(), rowNum + 1));
//                }
//            }
//        } catch (Exception e) {
//            errors.add(new ImportError("定位周保养项目异常", e.getMessage(), 0));
//        }
//
//        return items;
//    }
    /*导入文件--------------------------结束*/
}