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