fix: 优化代码

This commit is contained in:
tangwei 2026-09-01 16:57:07 +08:00
parent 45deee4a41
commit f641e40c15
2 changed files with 8 additions and 6 deletions

View File

@ -4168,7 +4168,7 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
} }
String recordId = ObjectUtil.isNotEmpty(beforeHour) && ObjectUtil.isNotEmpty(beforeHour.get("ID")) String recordId = ObjectUtil.isNotEmpty(beforeHour) && ObjectUtil.isNotEmpty(beforeHour.get("ID"))
? beforeHour.get("ID").toString() ? beforeHour.get("ID").toString()
: null; MsOperationLog mainLog = buildWqMainLog(recordId,"修改水质小时数据", source); : null; MsOperationLog mainLog = buildWqMainLog(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());
@ -4184,7 +4184,7 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
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 = buildWqMainLog(recordId,remark, source); MsOperationLog mainLog = buildWqMainLog(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();
@ -4203,11 +4203,12 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
batchInsertWqLogDetails(details); batchInsertWqLogDetails(details);
} }
private MsOperationLog buildWqMainLog(String recordId,String remark, String source) { private MsOperationLog buildWqMainLog(String recordId,String remark, String source,String operatorType) {
MsOperationLog log = new MsOperationLog(); MsOperationLog log = new MsOperationLog();
log.setOperator(resolveLogOperator()); log.setOperator(resolveLogOperator());
log.setRecordId(recordId); log.setRecordId(recordId);
log.setOperateTime(new Date()); log.setOperateTime(new Date());
log.setOperationType(operatorType);
log.setTableName(WQ_HOUR_TABLE_NAME); log.setTableName(WQ_HOUR_TABLE_NAME);
log.setSource(StrUtil.trimToNull(source)); log.setSource(StrUtil.trimToNull(source));
log.setRemark(remark); log.setRemark(remark);

View File

@ -1189,7 +1189,7 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
if (details.isEmpty()) { if (details.isEmpty()) {
return; return;
} }
MsOperationLog mainLog = buildWtMainLog(recordId,"修改表层水温日数据", source); MsOperationLog mainLog = buildWtMainLog(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());
@ -1206,7 +1206,7 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
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 = buildWtMainLog(recordId,remark, source); MsOperationLog mainLog = buildWtMainLog(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();
@ -1222,11 +1222,12 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
batchInsertWtLogDetails(details); batchInsertWtLogDetails(details);
} }
private MsOperationLog buildWtMainLog(String recordId,String remark, String source) { private MsOperationLog buildWtMainLog(String recordId,String remark, String source,String operatorType) {
MsOperationLog log = new MsOperationLog(); MsOperationLog log = new MsOperationLog();
log.setOperator(resolveWtLogOperator()); log.setOperator(resolveWtLogOperator());
log.setOperateTime(new Date()); log.setOperateTime(new Date());
log.setRecordId(recordId); log.setRecordId(recordId);
log.setOperationType(operatorType);
log.setTableName(WT_HOUR_TABLE_NAME); log.setTableName(WT_HOUR_TABLE_NAME);
log.setSource(StrUtil.trimToNull(source)); log.setSource(StrUtil.trimToNull(source));
log.setRemark(remark); log.setRemark(remark);