完善表格显示以及风险点隐患点计数
This commit is contained in:
@@ -147,11 +147,15 @@ public class IReportOutputServiceImpl implements ReportOutputService {
|
||||
}
|
||||
|
||||
/**
|
||||
* 全部行政区名称
|
||||
* 全部行政区名称(按降雨量降序)
|
||||
*/
|
||||
private List<String> allDistrictNames(List<RainfallDistrictSummaryResponseDTO> rainData) {
|
||||
return rainData.stream()
|
||||
.filter(d -> d.getDistrictName() != null && !d.getDistrictName().isEmpty())
|
||||
.filter(d -> d.getRainfall() != null && !d.getRainfall().isEmpty())
|
||||
.sorted((a, b) -> Double.compare(
|
||||
Double.parseDouble(b.getRainfall()),
|
||||
Double.parseDouble(a.getRainfall())))
|
||||
.map(RainfallDistrictSummaryResponseDTO::getDistrictName)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.deepoove.poi.data.RowRenderData;
|
||||
import com.deepoove.poi.data.Rows;
|
||||
import com.deepoove.poi.data.TableRenderData;
|
||||
import com.deepoove.poi.data.Tables;
|
||||
import com.deepoove.poi.data.style.TableStyle;
|
||||
import com.gis.xian.dto.DisasterRiskData;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
@@ -16,6 +17,18 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public class ReportTableBuilder {
|
||||
|
||||
private static final DecimalFormat PCT_FMT = new DecimalFormat("0.00");
|
||||
/**
|
||||
* 小四号 = 12pt = 24 half-pts
|
||||
*/
|
||||
private static final int XIAO_SI_FONT = 10;
|
||||
/**
|
||||
* 列宽(twips):序号窄 / 位置最宽 / 概率中等 / 等级中等
|
||||
*/
|
||||
private static final int[] COL_WIDTHS = {700, 5000, 1500, 1500};
|
||||
/**
|
||||
* 表格总宽 = 列宽之和
|
||||
*/
|
||||
private static final String TABLE_WIDTH = "8700";
|
||||
|
||||
/**
|
||||
* 构建灾害风险表(四列:序号、位置、发生概率、灾害等级)
|
||||
@@ -26,7 +39,7 @@ public class ReportTableBuilder {
|
||||
"位置",
|
||||
disasterType + "发生概率",
|
||||
"灾害等级"
|
||||
).textBold().center().create();
|
||||
).textFontFamily("黑体").textFontSize(XIAO_SI_FONT).textBold().center().create();
|
||||
|
||||
Tables.TableBuilder builder = Tables.of(header);
|
||||
AtomicInteger idx = new AtomicInteger(1);
|
||||
@@ -36,8 +49,14 @@ public class ReportTableBuilder {
|
||||
spot.getPosition(),
|
||||
PCT_FMT.format(spot.getProbability()) + "%",
|
||||
spot.getRiskLevel()
|
||||
).center().create());
|
||||
).textFontFamily("仿宋_GB2312").textFontSize(XIAO_SI_FONT).center().create());
|
||||
}
|
||||
return builder.create();
|
||||
|
||||
TableRenderData table = builder.create();
|
||||
TableStyle style = new TableStyle();
|
||||
style.setWidth(TABLE_WIDTH);
|
||||
style.setColWidths(COL_WIDTHS);
|
||||
table.setTableStyle(style);
|
||||
return table;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
</select>
|
||||
|
||||
<select id="queryHiddenDangerNumberByDistrictName" resultMap="RiskAndHiddenSpotDTOMap">
|
||||
SELECT county, COUNT(*) AS number FROM xian_risk_spots
|
||||
SELECT county, COUNT(*) AS number FROM xian_hidden_danger_spots
|
||||
<where>
|
||||
is_delete = 0
|
||||
<if test="districtNames != null and districtNames.size() > 0">
|
||||
|
||||
Reference in New Issue
Block a user