fix: 优化电站新增逻辑

This commit is contained in:
tangwei 2026-07-29 15:21:29 +08:00
parent 7502e63cef
commit 3819262ee6
2 changed files with 75 additions and 6 deletions

View File

@ -60,6 +60,10 @@ public class SdEngInfoBH implements Serializable {
@FieldChinese("是否启用") @FieldChinese("是否启用")
private Integer usfl; private Integer usfl;
/** 是否启用名称 */
@TableField(exist = false)
private String usflName;
/** 水能利用数据是否接入 */ /** 水能利用数据是否接入 */
@FieldChinese("水能利用数据是否接入") @FieldChinese("水能利用数据是否接入")
private Integer dtin; private Integer dtin;
@ -219,11 +223,23 @@ public class SdEngInfoBH implements Serializable {
@FieldChinese("建设状态") @FieldChinese("建设状态")
private String bldstt; private String bldstt;
/** 站类 */
@FieldChinese("站类")
private String sttp;
/** 站类名称 */
@TableField(exist = false)
private String sttpName;
/** 建设状态分类 */ /** 建设状态分类 */
@TableField("BLDSTT_CODE") @TableField("BLDSTT_CODE")
@FieldChinese("建设状态分类") @FieldChinese("建设状态分类")
private Integer bldsttCode; private Integer bldsttCode;
/** 建设状态分类名称 */
@TableField(exist = false)
private String bldsttCodeName;
/** 工程类别 */ /** 工程类别 */
@FieldChinese("工程类别") @FieldChinese("工程类别")
private Integer engtp; private Integer engtp;
@ -236,6 +252,10 @@ public class SdEngInfoBH implements Serializable {
@FieldChinese("工程规模(水库库容)") @FieldChinese("工程规模(水库库容)")
private Integer scrsc; private Integer scrsc;
/** 工程规模(水库库容)名称 */
@TableField(exist = false)
private String scrscName;
/** 工程等别 */ /** 工程等别 */
@FieldChinese("工程等别") @FieldChinese("工程等别")
private String prgr; private String prgr;
@ -1037,18 +1057,34 @@ public class SdEngInfoBH implements Serializable {
@FieldChinese("环境监测数据接入情况") @FieldChinese("环境监测数据接入情况")
private Integer dtinEnv; private Integer dtinEnv;
/** 环境监测数据接入情况描述 */
@TableField(exist = false)
private String dtinEnvName;
/** 最新运行状态1=运行中 2=未运行 */ /** 最新运行状态1=运行中 2=未运行 */
@FieldChinese("最新运行状态") @FieldChinese("最新运行状态")
private Integer runState; private Integer runState;
/** 最新运行状态描述 */
@TableField(exist = false)
private String runStateName;
/** 告警状态 */ /** 告警状态 */
@FieldChinese("告警状态") @FieldChinese("告警状态")
private String warnState; private String warnState;
/** 告警状态描述 */
@TableField(exist = false)
private String warnStateName;
/** 开展环保自动检测工作状态0=暂无数据 1=正常 */ /** 开展环保自动检测工作状态0=暂无数据 1=正常 */
@FieldChinese("开展环保自动检测工作状态") @FieldChinese("开展环保自动检测工作状态")
private Integer coenvwState; private Integer coenvwState;
/** 开展环保自动检测工作状态描述 */
@TableField(exist = false)
private String coenvwStateName;
/** 在线地址 */ /** 在线地址 */
@FieldChinese("在线地址") @FieldChinese("在线地址")
private String url; private String url;

View File

@ -16,6 +16,7 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonMappingException; import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yfd.platform.annotation.FieldChinese;
import com.yfd.platform.common.DataSourceLoadOptionsBase; import com.yfd.platform.common.DataSourceLoadOptionsBase;
import com.yfd.platform.common.DataSourceRequest; import com.yfd.platform.common.DataSourceRequest;
import com.yfd.platform.common.DataSourceResult; import com.yfd.platform.common.DataSourceResult;
@ -45,9 +46,7 @@ import com.yfd.platform.qgc_base.service.IMsOperationLogService;
import com.yfd.platform.qgc_base.service.ISdEngInfoBHService; import com.yfd.platform.qgc_base.service.ISdEngInfoBHService;
import com.yfd.platform.qgc_eng.eq.entity.vo.LastTmEngEqDataVo; import com.yfd.platform.qgc_eng.eq.entity.vo.LastTmEngEqDataVo;
import com.yfd.platform.system.service.IAdminAuthService; import com.yfd.platform.system.service.IAdminAuthService;
import com.yfd.platform.utils.QgcQueryWrapperUtil; import com.yfd.platform.utils.*;
import com.yfd.platform.utils.RedisCacheUtil;
import com.yfd.platform.utils.SecurityUtils;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable; import org.springframework.cache.annotation.Cacheable;
@ -66,13 +65,46 @@ import java.util.stream.Collectors;
*/ */
@Service @Service
public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEngInfoBH> implements ISdEngInfoBHService { public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEngInfoBH> implements ISdEngInfoBHService {
private static final String TABLE_NAME = "SD_FISHDICTORY_B";
private static final Map<String, String> ENG_CODE_NAME_FIELD_MAP = new LinkedHashMap<>(); private static final Map<String, String> ENG_CODE_NAME_FIELD_MAP = new LinkedHashMap<>();
@Resource @Resource
private RedisCacheUtil redisCacheUtil; private RedisCacheUtil redisCacheUtil;
@Resource @Resource
private IDataScopeFilterService dataScopeFilterService; private IDataScopeFilterService dataScopeFilterService;
@Resource
private DictCodeToNameConverter dictCodeToNameConverter;
/**
* 代码转名称元数据配置列表静态初始化
* <p>
* 每个模块的 ServiceImpl 中可按需定义自己的 codeToNameMetadataBoList
* 在查询方法返回前调用 dictCodeToNameConverter.convertCodeToName(voList, codeToNameMetadataBoList)
* 即可自动将 code 字段转为对应的 name 字段
* </p>
*
* <pre>
* 使用示例
* // 在查询方法末尾调用
* dictCodeToNameConverter.convertCodeToName(voList, CODE_TO_NAME_META_LIST);
* </pre>
*/
private static final List<CodeToNameMetadataBo> CODE_TO_NAME_META_LIST = new ArrayList<>();
static {
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dtin").modifyProperty("dtinName").dictType("STATIC").dictSource("DTIN").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("mway").modifyProperty("mwayName").dictType("STATIC").dictSource("MWAY").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("bldsttCode").modifyProperty("bldsttCodeName").dictType("STATIC").dictSource("BLDSTT_CODE").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("dtinEnv").modifyProperty("dtinEnvName").dictType("STATIC").dictSource("DTIN_ENV").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("NVL(IS_DELETED, 0) = 0 ").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("usfl").modifyProperty("usflName").dictType("STATIC").dictSource("USFL").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("runState").modifyProperty("runStateName").dictType("STATIC").dictSource("RUN_STATE").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("warnState").modifyProperty("warnStateName").dictType("STATIC").dictSource("WARN_STATE").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("coenvwState").modifyProperty("coenvwStateName").dictType("STATIC").dictSource("COENVW_STATE").build());
CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("scrsc").modifyProperty("scrscStateName").dictType("STATIC").dictSource("SCRSC").build());
}
static { static {
ENG_CODE_NAME_FIELD_MAP.put("baseId", "baseName"); ENG_CODE_NAME_FIELD_MAP.put("baseId", "baseName");
ENG_CODE_NAME_FIELD_MAP.put("hbrvcd", "hbrvcdName"); ENG_CODE_NAME_FIELD_MAP.put("hbrvcd", "hbrvcdName");
@ -252,10 +284,11 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
@CacheEvict(cacheNames = "engInfoCache", allEntries = true) @CacheEvict(cacheNames = "engInfoCache", allEntries = true)
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public boolean addEngInfo(SdEngInfoBH engInfo, String source) { public boolean addEngInfo(SdEngInfoBH engInfo, String source) {
fillRelatedNameFields(engInfo); // fillRelatedNameFields(engInfo);
boolean result = this.save(engInfo); boolean result = this.save(engInfo);
if (result) { if (result) {
msOperationLogService.recordEngAddLog(engInfo, source); dictCodeToNameConverter.convertCodeToName(engInfo, CODE_TO_NAME_META_LIST);
msOperationLogService.recordAddDetailLog(engInfo.getStcd(),TABLE_NAME, engInfo, source, CODE_TO_NAME_META_LIST);
} }
return result; return result;
} }