工程质量分析

This commit is contained in:
liang.chao 2025-07-24 14:23:46 +08:00
parent 9a2793c5ec
commit 653f1712f4
3 changed files with 55 additions and 26 deletions

View File

@ -13,10 +13,6 @@ import java.math.BigDecimal;
@Data @Data
public class ProjectQualityVo { public class ProjectQualityVo {
private String projectName; private String projectName;
private String projectNumber;
private String projectAddress;
private String contractorName;
private String qualityLevel;
private String projectManager; private String projectManager;
private String team; private String team;
private String startTime; private String startTime;

View File

@ -40,32 +40,33 @@ public class DataAnalysisController extends BaseController {
@ApiOperation("根据类型获取数据分析应用") @ApiOperation("根据类型获取数据分析应用")
@GetMapping("getDataAnalysisByType") @GetMapping("getDataAnalysisByType")
public AjaxResult getDataAnalysisByType(ScreenParamDto dto){ public AjaxResult getDataAnalysisByType(ScreenParamDto dto) {
return service.getDataAnalysisByType(dto); return service.getDataAnalysisByType(dto);
} }
@ApiOperation(value = "数据应用分析") @ApiOperation(value = "数据应用分析")
@GetMapping("getListByType") @GetMapping("getListByType")
public TableDataInfo getListByType(ScreenParamDto dto) { public TableDataInfo getListByType(ScreenParamDto dto) {
try{ try {
startLayPage(); startLayPage();
List<DataAnalysisDetailVo> list = service.getListByType(dto); List<DataAnalysisDetailVo> list = service.getListByType(dto);
return getDataTableLayui(list); return getDataTableLayui(list);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
return getDataTableBadLayui(new ArrayList<>(),"请求出错了"); return getDataTableBadLayui(new ArrayList<>(), "请求出错了");
} }
} }
@ApiOperation(value = "工程质量分析") @ApiOperation(value = "工程质量分析")
@GetMapping("getEngqualityAnalysis") @GetMapping("getEngqualityAnalysis")
public TableDataInfo getEngqualityAnalysis(ScreenParamDto dto) { public TableDataInfo getEngqualityAnalysis(ScreenParamDto dto) {
try{ try {
startLayPage(); startLayPage();
List<ProjectQualityVo> list = service.getEngqualityAnalysis(dto); List<ProjectQualityVo> list = service.getEngqualityAnalysis(dto);
return getDataTableLayui(list); return getDataTableLayui(list);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
return getDataTableBadLayui(new ArrayList<>(),"请求出错了"); return getDataTableBadLayui(new ArrayList<>(), "请求出错了");
} }
} }
@ -73,15 +74,15 @@ public class DataAnalysisController extends BaseController {
@GetMapping("getListByType2") @GetMapping("getListByType2")
public AjaxResult getListByType2(ScreenParamDto dto) { public AjaxResult getListByType2(ScreenParamDto dto) {
List<DataAnalysisDetailVo> list = null; List<DataAnalysisDetailVo> list = null;
try{ try {
list = service.getListByType(dto); list = service.getListByType(dto);
}catch (Exception e){ } catch (Exception e) {
log.error(e.toString(),e); log.error(e.toString(), e);
} }
return AjaxResult.success(list); return AjaxResult.success(list);
} }
@PostMapping("uploadProQuality") @PostMapping("uploadProQualityFile")
public Map<String, List<List<String>>> extractTablesFromWord(@RequestParam("file") MultipartFile file) { public Map<String, List<List<String>>> extractTablesFromWord(@RequestParam("file") MultipartFile file) {
Map<String, List<List<String>>> result = new HashMap<>(); Map<String, List<List<String>>> result = new HashMap<>();
@ -105,25 +106,61 @@ public class DataAnalysisController extends BaseController {
XWPFTable table = tables.get(i); XWPFTable table = tables.get(i);
List<List<String>> tableData = new ArrayList<>(); List<List<String>> tableData = new ArrayList<>();
// 处理每一行 // 从第二行开始索引1遍历到最后一行
for (XWPFTableRow row : table.getRows()) { for (int j = 1; j < table.getRows().size(); j++) {
XWPFTableRow row = table.getRows().get(j);
List<String> rowData = new ArrayList<>(); List<String> rowData = new ArrayList<>();
// 处理每个单元格
for (XWPFTableCell cell : row.getTableCells()) { for (XWPFTableCell cell : row.getTableCells()) {
rowData.add(cell.getText()); rowData.add(cell.getText());
} }
tableData.add(rowData); tableData.add(rowData);
} }
result.put("表格" + (i + 1), tableData); result.put("表格" + (i + 1), tableData);
} }
} }
if (!result.isEmpty()) {
List<List<String>> table1 = result.get("表格1");
List<String> list = table1.get(0);
ProjectQualityVo vo = new ProjectQualityVo();
vo.setProjectName(list.get(0));
vo.setProjectManager(list.get(1));
vo.setTeam(list.get(2));
vo.setStartTime(list.get(3));
int allValues = 0;
int passValues = 0;
List<List<String>> table2 = result.get("表格2");
for (List<String> row : table2) {
for (String cell : row) {
allValues++;
if (cell.equals("合格"))
passValues++;
}
}
List<List<String>> table3 = result.get("表格3");
for (List<String> row : table3) {
for (String cell : row) {
allValues++;
if (cell.equals("合格"))
passValues++;
}
}
List<List<String>> table4 = result.get("表格4");
for (List<String> row : table4) {
for (String cell : row) {
allValues++;
if (cell.equals("合格"))
passValues++;
}
}
System.out.println(allValues + " haha" + passValues);
}
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("处理Word文档时出错: " + e.getMessage(), e); throw new RuntimeException("处理Word文档时出错: " + e.getMessage(), e);
} }
return result; return result;
} }
} }

View File

@ -35,10 +35,6 @@
</select> </select>
<select id="getEngqualityAnalysis" resultType="com.securitycontrol.entity.screen.vo.ProjectQualityVo"> <select id="getEngqualityAnalysis" resultType="com.securitycontrol.entity.screen.vo.ProjectQualityVo">
select project_name as projectName, select project_name as projectName,
project_number as projectNumber,
project_address as projectAddress,
contractor_name as contractorName,
case when quality_level = 1 then '初级' when quality_level = 2 then '中级' else '高级' end as qualityLevel,
project_manager as projectManager, project_manager as projectManager,
team, team,
start_time as startTime, start_time as startTime,