fix: 优化代码
This commit is contained in:
parent
ef65db39bc
commit
45deee4a41
@ -63,6 +63,9 @@ public class SdDwBH implements Serializable {
|
||||
@FieldChinese("是否启用")
|
||||
private Integer usfl;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String usflName;
|
||||
|
||||
/** 数据是否接入:0=未接入 1=已接入 */
|
||||
@FieldChinese("数据是否接入")
|
||||
private Integer dtin;
|
||||
@ -154,10 +157,16 @@ public class SdDwBH implements Serializable {
|
||||
@FieldChinese("投资是否计入主体工程")
|
||||
private Integer invinmn;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String invinmnName;
|
||||
|
||||
/** 是否有调度规程分析:0=无调度规程 1=有调度规程 */
|
||||
@FieldChinese("是否有调度规程分析")
|
||||
private Integer dispatch;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String dispatchName;
|
||||
|
||||
/** 调度规程文字描述 */
|
||||
@FieldChinese("调度规程文字描述")
|
||||
private String dispatchDes;
|
||||
|
||||
@ -73,6 +73,8 @@ public class MsOperationLogServiceImpl extends ServiceImpl<MsOperationLogMapper,
|
||||
static {
|
||||
// Engine Info: 名称列是 ENNM 而非 STNM
|
||||
TABLE_NAME_CONFIG_MAP.put("SD_ENGINFO_B_H", TableNameConfig.self("STCD", "ENNM"));
|
||||
TABLE_NAME_CONFIG_MAP.put("SD_WE_B_H", TableNameConfig.self("STCD", "STNM"));
|
||||
|
||||
// Hydro Base: 主键列是 BASEID,名称列是 BASENAME
|
||||
TABLE_NAME_CONFIG_MAP.put("SD_HYDROBASE", TableNameConfig.self("BASEID", "BASENAME"));
|
||||
// Fish Dictionary: 需确认结构后配置
|
||||
|
||||
@ -59,6 +59,10 @@ public class SdDwBHServiceImpl extends ServiceImpl<SdDwBHMapper, SdDwBH> impleme
|
||||
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("sttp").modifyProperty("sttpName").dictType("DYNAMIC").dictSource("SD_STTP_B").codeColumn("STTP_CODE").nameColumn("STTP_NAME").filter("IS_DELETED = 0 ").build());
|
||||
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseId").modifyProperty("baseName").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("IS_DELETED = 0 ").build());
|
||||
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("rstcd").modifyProperty("ennm").dictType("DYNAMIC").dictSource("SD_ENGINFO_B_H").codeColumn("STCD").nameColumn("ENNM").filter("IS_DELETED = 0 ").build());
|
||||
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("usfl").modifyProperty("usflName").dictType("STATIC").dictSource("TY_SF").build());
|
||||
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("invinmn").modifyProperty("invinmnName").dictType("STATIC").dictSource("TY_SF").build());
|
||||
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dispatch").modifyProperty("dispatchName").dictType("STATIC").dictSource("DISPATCH").build());
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1806,7 +1806,7 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
if (details.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
MsOperationLog mainLog = buildRiverMainLog(recordId,"修改流量站小时数据", source);
|
||||
MsOperationLog mainLog = buildRiverMainLog(recordId,"修改流量站小时数据", source,"02");
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
detail.setMainId(mainLog.getId());
|
||||
@ -1823,7 +1823,7 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
for (Map<String, Object> row : rows) {
|
||||
String stcd = asString(row.get("STCD"));
|
||||
String recordId = asString(row.get("ID"));
|
||||
MsOperationLog mainLog = buildRiverMainLog(recordId,remark, source);
|
||||
MsOperationLog mainLog = buildRiverMainLog(recordId,remark, source,"03");
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
String fieldCode = entry.getKey();
|
||||
@ -1839,9 +1839,10 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
batchInsertRiverLogDetails(details);
|
||||
}
|
||||
|
||||
private MsOperationLog buildRiverMainLog(String recordId,String remark, String source) {
|
||||
private MsOperationLog buildRiverMainLog(String recordId,String remark, String source,String operationType) {
|
||||
MsOperationLog log = new MsOperationLog();
|
||||
log.setOperator(resolveRiverLogOperator());
|
||||
log.setOperationType(operationType);
|
||||
log.setOperateTime(new Date());
|
||||
log.setRecordId(recordId);
|
||||
log.setTableName(ZQ_HOUR_TABLE_NAME);
|
||||
|
||||
@ -1542,7 +1542,7 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
||||
}
|
||||
|
||||
// QEC 水电基地维度
|
||||
if (!baseIds.isEmpty()) {
|
||||
if (hasQec && !baseIds.isEmpty()) {
|
||||
ExportZipUtil.SheetData baseEpaSheet = buildYearQecBaseSheet(baseIds, year, "QEC");
|
||||
ExportZipUtil.SheetData baseMwrSheet = buildYearQecBaseSheet(baseIds, year, "MWR");
|
||||
ExportZipUtil.SheetData baseAvqSheet = buildYearQecBaseSheet(baseIds, year, "AVQ");
|
||||
@ -2052,22 +2052,20 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
||||
stcdDisplayMap.put(stcd, StrUtil.isNotBlank(name) ? name : stcd);
|
||||
}
|
||||
}
|
||||
if (stcds.isEmpty()) continue;
|
||||
|
||||
List<List<Object>> rows;
|
||||
List<String> headers;
|
||||
if (processor instanceof RwtProcessor) {
|
||||
if (stcds.isEmpty()) {
|
||||
// 无测站:仍生成带表头的空 sheet,保证有标题可下载
|
||||
rows = Collections.emptyList();
|
||||
headers = buildRawHeaders(processor, stcdDisplayMap, Collections.emptyList());
|
||||
} else if (processor instanceof RwtProcessor) {
|
||||
rows = buildRwtRawSheetRows(stcds, stcdDisplayMap, startTime, endTime);
|
||||
if (rows == null) rows = Collections.emptyList();
|
||||
headers = Arrays.asList("测站", "时间", "水深(m)", "水温(℃)");
|
||||
} else {
|
||||
rows = buildRawSheetRows(processor, stcds, stcdDisplayMap, startTime, endTime, isDaily);
|
||||
if (rows == null) continue;
|
||||
// 表头:时间 | 测站1 | 测站2 | ...
|
||||
headers = new ArrayList<>();
|
||||
headers.add("时间");
|
||||
for (String stcd : stcds) {
|
||||
headers.add(stcdDisplayMap.getOrDefault(stcd, stcd));
|
||||
}
|
||||
if (rows == null) rows = Collections.emptyList();
|
||||
headers = buildRawHeaders(processor, stcdDisplayMap, stcds);
|
||||
}
|
||||
|
||||
ExportZipUtil.SheetData sd = new ExportZipUtil.SheetData(processor.getSheetName(), headers, rows);
|
||||
@ -2075,8 +2073,10 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
||||
}
|
||||
|
||||
if (sheets.isEmpty()) {
|
||||
log.warn("hour/day 模式:没有可用数据");
|
||||
return;
|
||||
// 无可用数据时也返回 Excel 空表,保证前端能下载到文件
|
||||
log.warn("hour/day 模式:没有可用数据,返回空表");
|
||||
sheets.add(new ExportZipUtil.SheetData("数据",
|
||||
Collections.singletonList("无可用数据"), Collections.emptyList()));
|
||||
}
|
||||
|
||||
// 5. ZIP 导出
|
||||
@ -2133,6 +2133,19 @@ public class QgcExportServiceImpl implements IQgcExportService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建原始数据表头:时间 | 测站1 | 测站2 | ...(无测站时仅剩"时间"列)
|
||||
*/
|
||||
private List<String> buildRawHeaders(ExportIndicatorProcessor processor,
|
||||
Map<String, String> stcdDisplayMap, List<String> stcds) {
|
||||
List<String> headers = new ArrayList<>();
|
||||
headers.add("时间");
|
||||
for (String stcd : stcds) {
|
||||
headers.add(stcdDisplayMap.getOrDefault(stcd, stcd));
|
||||
}
|
||||
return headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建 RWT 垂向水温原始数据行
|
||||
* 格式:测站 | 时间 | 水深(m) | 水温(℃)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user