| | |
| | | |
| | | @Query("select p from Problem p where p.hierarchyId = :hierarchyId " + |
| | | "and p.hierarchyPath in :hierarchyPaths " + |
| | | "and (:keyword is null or :keyword = '' or p.description like %:keyword% ) " + |
| | | "and (:keyword is null or :keyword = '' " + |
| | | "or p.description like %:keyword% " + |
| | | "or function('json_search', p.specificTerms, 'one', concat(concat('%', :keyword), '%')) is not null) " + |
| | | "and p.deleted = false") |
| | | Page<Problem> findProblems(@Param("hierarchyId") Integer hierarchyId, |
| | | @Param("hierarchyPaths") List<String> hierarchyPaths, |
| | |
| | | |
| | | protected abstract List<String> buildRowData(T data); |
| | | |
| | | /** |
| | | * 构建行数据(支持不同类型) |
| | | * 子类可以重写此方法以返回包含不同类型数据的列表(如数字、字符串等) |
| | | * 如果子类重写了此方法,writeSheet 将使用此方法而不是 buildRowData |
| | | * |
| | | * @param data 数据对象 |
| | | * @return 行数据列表,可以包含 String、Number 等类型 |
| | | */ |
| | | protected List<Object> buildRowDataObjects(T data) { |
| | | return null; |
| | | } |
| | | |
| | | protected T parseRowData(int rowIndex, List<String> rowData) { |
| | | return null; |
| | | } |
| | |
| | | |
| | | int index = 1; |
| | | for (var d : data) { |
| | | var rowData = buildRowData(d); |
| | | // 优先使用 buildRowDataObjects,如果未实现则使用 buildRowData |
| | | List<Object> rowDataObjects = buildRowDataObjects(d); |
| | | List<?> rowData; |
| | | |
| | | if (rowDataObjects != null) { |
| | | rowData = rowDataObjects; |
| | | } else { |
| | | rowData = buildRowData(d); |
| | | } |
| | | |
| | | if (rowData == null) |
| | | continue; |
| | | |
| | |
| | | |
| | | var row = sheet.createRow(index++); |
| | | for (int i = 0; i < rowData.size(); i++) { |
| | | row.createCell(i).setCellValue(rowData.get(i)); |
| | | var cell = row.createCell(i); |
| | | var value = rowData.get(i); |
| | | |
| | | // 根据数据类型设置单元格值 |
| | | if (value == null || value.equals("-")) { |
| | | cell.setCellValue("-"); |
| | | } else if (value instanceof Number) { |
| | | cell.setCellValue(((Number) value).doubleValue()); |
| | | } else if (value instanceof Boolean) { |
| | | cell.setCellValue((Boolean) value); |
| | | } else { |
| | | cell.setCellValue(value.toString()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | protected List<String> buildRowData(ErrorRecord data) { |
| | | // 保留此方法以保持兼容性,实际使用 buildRowDataObjects |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected List<Object> buildRowDataObjects(ErrorRecord data) { |
| | | if(data.getDevice() == null) // 有设备信息的为设备记录 |
| | | return null; |
| | | |
| | |
| | | props.get("工程起重机械租赁单位") == null ? "" : props.get("工程起重机械租赁单位"), |
| | | props.get("工程起重机械维保单位") == null ? "" : props.get("工程起重机械维保单位"), |
| | | props.get("工程起重机械生产单位") == null ? "" : props.get("工程起重机械生产单位"), |
| | | getDeviceScore(data.getCheckTask().getDeviceScoreMap(), data.getDevice().getId()), |
| | | getDeviceScore(data.getCheckTask().getDeviceFuzzyMap(), data.getDevice().getId()), |
| | | getDeviceScoreObject(data.getCheckTask().getDeviceScoreMap(), data.getDevice().getId()), |
| | | getDeviceScoreObject(data.getCheckTask().getDeviceFuzzyMap(), data.getDevice().getId()), |
| | | data.getProblem().getDescription(), |
| | | data.getRemark(), |
| | | ProcessorHelper.getSpec(data), |
| | |
| | | return "-"; |
| | | return deviceScoreMap.get(deviceId) == null ? "-" : deviceScoreMap.get(deviceId).toString(); |
| | | } |
| | | |
| | | private Object getDeviceScoreObject(Map<Integer, Float> deviceScoreMap, Integer deviceId){ |
| | | if(deviceScoreMap == null) |
| | | return "-"; |
| | | Float score = deviceScoreMap.get(deviceId); |
| | | return score != null ? score : "-"; |
| | | } |
| | | } |
| | |
| | | |
| | | @Override |
| | | protected List<String> buildRowData(ErrorRecord data) { |
| | | // 保留此方法以保持兼容性,实际使用 buildRowDataObjects |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | protected List<Object> buildRowDataObjects(ErrorRecord data) { |
| | | if(data.getDevice() != null) // 没有设备信息的为综合问题记录 |
| | | return null; |
| | | |
| | |
| | | project.getConstructionCompanyInfo() != null ? project.getConstructionCompanyInfo().getName() : "", |
| | | project.getSupervisorCompanyInfo() != null ? project.getSupervisorCompanyInfo().getName() : "", |
| | | project.getConstructionCompanyInfo() != null ? project.getConstructionCompanyInfo().getName() : "", |
| | | checkTask.getSystemScore() == null ? "-" : checkTask.getSystemScore().toString(), |
| | | checkTask.getSystemFuzzy() == null ? "-" : checkTask.getSystemFuzzy().toString(), |
| | | checkTask.getSystemScore() != null ? checkTask.getSystemScore() : "-", |
| | | checkTask.getSystemFuzzy() != null ? checkTask.getSystemFuzzy() : "-", |
| | | plan.getType().getDesc(), |
| | | ProcessorHelper.getHierarchyName(data, 5), |
| | | ProcessorHelper.getHierarchyName(data, 4), |