修改山洪表格显示以及模版简单修改
This commit is contained in:
@@ -48,6 +48,8 @@ public class DisasterRiskData {
|
||||
private int index;
|
||||
/** 位置 */
|
||||
private String position;
|
||||
/** 灾害点名称 */
|
||||
private String disasterName;
|
||||
/** 乡镇/街道 */
|
||||
private String village;
|
||||
/** 发生概率(小数 0-1) */
|
||||
|
||||
@@ -130,7 +130,7 @@ public class IReportOutputServiceImpl implements ReportOutputService {
|
||||
inferenceResultFileMapper.upsert(id, relativePath, baseName);
|
||||
log.info("文件记录已写入: inference_id={}, file_name={}, file_path={}", id, baseName, relativePath);
|
||||
|
||||
return fileServerPath.replaceAll("/+$", "") + "/" + relativePath;
|
||||
return relativePath;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,6 +223,7 @@ public class IReportOutputServiceImpl implements ReportOutputService {
|
||||
String level = prob >= 70 ? "高" : "中";
|
||||
return new DisasterRiskData.SpotRisk()
|
||||
.setPosition(spot.getPosition())
|
||||
.setDisasterName(spot.getDisasterName())
|
||||
.setVillage(spot.getVillage())
|
||||
.setProbability(prob)
|
||||
.setRiskLevel(level);
|
||||
|
||||
@@ -34,22 +34,27 @@ public class ReportTableBuilder {
|
||||
* 构建灾害风险表(四列:序号、位置、发生概率、灾害等级)
|
||||
*/
|
||||
public static TableRenderData buildRiskTable(String disasterType, List<DisasterRiskData.SpotRisk> spots) {
|
||||
// 山洪第二列用灾害点名称,其他用位置
|
||||
boolean useDisasterName = "山洪".equals(disasterType);
|
||||
String col2Header = useDisasterName ? "灾害名称" : "位置";
|
||||
|
||||
RowRenderData header = Rows.of(
|
||||
"序号",
|
||||
"位置",
|
||||
col2Header,
|
||||
disasterType + "发生概率",
|
||||
"灾害等级"
|
||||
).textFontFamily("黑体").textFontSize(XIAO_SI_FONT).textBold().center().create();
|
||||
).textFontFamily("黑体").textFontSize(XIAO_SI_FONT).textBold().center().verticalCenter().create();
|
||||
|
||||
Tables.TableBuilder builder = Tables.of(header);
|
||||
AtomicInteger idx = new AtomicInteger(1);
|
||||
for (DisasterRiskData.SpotRisk spot : spots) {
|
||||
String col2 = useDisasterName ? spot.getDisasterName() : spot.getPosition();
|
||||
builder.addRow(Rows.of(
|
||||
String.valueOf(idx.getAndIncrement()),
|
||||
spot.getPosition(),
|
||||
col2,
|
||||
PCT_FMT.format(spot.getProbability()) + "%",
|
||||
spot.getRiskLevel()
|
||||
).textFontFamily("仿宋_GB2312").textFontSize(XIAO_SI_FONT).center().create());
|
||||
).textFontFamily("仿宋_GB2312").textFontSize(XIAO_SI_FONT).center().verticalCenter().create());
|
||||
}
|
||||
|
||||
TableRenderData table = builder.create();
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user