fix: 回退代码
This commit is contained in:
parent
a4f0d34776
commit
97982109ff
@ -13,7 +13,6 @@ import com.yfd.platform.qgc_export.mapper.SdHydropwdaySMapper;
|
|||||||
import com.yfd.platform.qgc_export.mapper.SdQecRMapper;
|
import com.yfd.platform.qgc_export.mapper.SdQecRMapper;
|
||||||
import com.yfd.platform.qgc_export.mapper.SdQecdaySMapper;
|
import com.yfd.platform.qgc_export.mapper.SdQecdaySMapper;
|
||||||
import com.yfd.platform.qgc_export.mapper.StationMappingMapper;
|
import com.yfd.platform.qgc_export.mapper.StationMappingMapper;
|
||||||
import com.yfd.platform.qgc_export.mapper.MsAlongdetBMapper;
|
|
||||||
import com.yfd.platform.qgc_export.processor.*;
|
import com.yfd.platform.qgc_export.processor.*;
|
||||||
import com.yfd.platform.qgc_export.service.IQgcExportService;
|
import com.yfd.platform.qgc_export.service.IQgcExportService;
|
||||||
import com.yfd.platform.qgc_eng.eq.entity.vo.EngEqRuleVo;
|
import com.yfd.platform.qgc_eng.eq.entity.vo.EngEqRuleVo;
|
||||||
@ -143,9 +142,6 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
|||||||
@Resource
|
@Resource
|
||||||
private EngEqDataService engEqDataService;
|
private EngEqDataService engEqDataService;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MsAlongdetBMapper msAlongdetBMapper;
|
|
||||||
|
|
||||||
private static final SimpleDateFormat SDF_TIME = new SimpleDateFormat("dd日 HH时");
|
private static final SimpleDateFormat SDF_TIME = new SimpleDateFormat("dd日 HH时");
|
||||||
private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
private static final SimpleDateFormat SDF = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
@ -178,8 +174,10 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 电站顺序:优先按沿程配置 MS_ALONG_B.ORDER_INDEX 排序,其余保持前端传入顺序
|
// 4. 电站顺序
|
||||||
List<String> stationOrder = buildAlongSortedOrder(stationCodes, stationRes);
|
List<String> stationOrder = new ArrayList<>(stationRes.displayNames.keySet());
|
||||||
|
|
||||||
|
// 5. 每月一个 ExcelData
|
||||||
String timestamp = String.valueOf(System.currentTimeMillis());
|
String timestamp = String.valueOf(System.currentTimeMillis());
|
||||||
List<ExportZipUtil.ExcelData> excelList = new ArrayList<>();
|
List<ExportZipUtil.ExcelData> excelList = new ArrayList<>();
|
||||||
for (String month : months) {
|
for (String month : months) {
|
||||||
@ -190,7 +188,6 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
|||||||
// 判断是否包含水质指标,后续用于追加 WQ 合规 Sheet
|
// 判断是否包含水质指标,后续用于追加 WQ 合规 Sheet
|
||||||
boolean hasWqIndicator = false;
|
boolean hasWqIndicator = false;
|
||||||
for (ExportIndicatorProcessor processor : processors) {
|
for (ExportIndicatorProcessor processor : processors) {
|
||||||
String sttp = processor.getSttpType();
|
|
||||||
List<List<Object>> rows;
|
List<List<Object>> rows;
|
||||||
// QEC 自定义三栏达标率格式
|
// QEC 自定义三栏达标率格式
|
||||||
if (processor instanceof QecProcessor) {
|
if (processor instanceof QecProcessor) {
|
||||||
@ -200,6 +197,7 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
|||||||
}
|
}
|
||||||
if (rows != null) {
|
if (rows != null) {
|
||||||
List<String> headers;
|
List<String> headers;
|
||||||
|
String sttp = processor.getSttpType();
|
||||||
if (processor instanceof QecProcessor) {
|
if (processor instanceof QecProcessor) {
|
||||||
// 分部标题作为列标题(合并单元格)
|
// 分部标题作为列标题(合并单元格)
|
||||||
String[] sectionTitles = {"生态流量达标率(环保部)", "生态流量达标率(水利部)", "生态流量达标率(多年平均)"};
|
String[] sectionTitles = {"生态流量达标率(环保部)", "生态流量达标率(水利部)", "生态流量达标率(多年平均)"};
|
||||||
@ -826,47 +824,6 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 按沿程配置 MS_ALONG_B.ORDER_INDEX 排序电站列表。
|
|
||||||
* 有沿程配置的电站排前面,无配置的保持原有顺序排后面。
|
|
||||||
*/
|
|
||||||
private List<String> buildAlongSortedOrder(List<String> rstcds, StationResolution stationRes) {
|
|
||||||
if (rstcds.isEmpty()) return Collections.emptyList();
|
|
||||||
|
|
||||||
// 查询沿程配置:MS_ALONGDET_B JOIN MS_ALONG_B,按 ORDER_INDEX, SORT 排序
|
|
||||||
List<Map<String, Object>> alongList = msAlongdetBMapper.selectAlongSortOrder(rstcds);
|
|
||||||
if (alongList.isEmpty()) {
|
|
||||||
return new ArrayList<>(stationRes.displayNames.keySet());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 按 ORDER_INDEX 分组去重,保留每站的最小 ORDER_INDEX
|
|
||||||
Map<String, Integer> rstcdOrderMap = new LinkedHashMap<>();
|
|
||||||
for (Map<String, Object> row : alongList) {
|
|
||||||
String rstcd = (String) row.get("RSTCD");
|
|
||||||
Object orderIdx = row.get("ORDER_INDEX");
|
|
||||||
if (rstcd != null && orderIdx != null && !rstcdOrderMap.containsKey(rstcd)) {
|
|
||||||
rstcdOrderMap.put(rstcd, ((Number) orderIdx).intValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 有沿程配置的电站按 ORDER_INDEX 升序,无配置的排后面
|
|
||||||
List<String> alongSorted = new ArrayList<>();
|
|
||||||
List<String> remaining = new ArrayList<>();
|
|
||||||
for (String rstcd : stationRes.displayNames.keySet()) {
|
|
||||||
if (rstcdOrderMap.containsKey(rstcd)) {
|
|
||||||
alongSorted.add(rstcd);
|
|
||||||
} else {
|
|
||||||
remaining.add(rstcd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
alongSorted.sort(Comparator.comparingInt(rstcdOrderMap::get));
|
|
||||||
|
|
||||||
List<String> result = new ArrayList<>(alongSorted);
|
|
||||||
result.addAll(remaining);
|
|
||||||
log.info("沿程排序完成,有沿程={}, 无沿程={}", alongSorted.size(), remaining.size());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ======================== 月份范围 ========================
|
// ======================== 月份范围 ========================
|
||||||
|
|
||||||
private MonthRange buildMonthRange(String month) {
|
private MonthRange buildMonthRange(String month) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user