Merge branch 'main' of http://121.37.111.42:3000/zhengsl/WholeProcessPlatform into main_hzz
This commit is contained in:
commit
a66909127e
@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@ServletComponentScan("com.yfd.platform.config")
|
||||
@MapperScan(basePackages = {"com.yfd.platform.*.mapper","com.yfd.platform.*.*.mapper", "com.yfd.platform.common"})
|
||||
//@ComponentScan("com.zny.dec")
|
||||
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class, DataRedisAutoConfiguration.class})
|
||||
@SpringBootApplication(exclude= {DataSourceAutoConfiguration.class})
|
||||
//@SpringBootApplication
|
||||
@Import({DynamicDataSourceConfig.class})
|
||||
@EnableCaching
|
||||
|
||||
@ -5,6 +5,8 @@ import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.ArrayList;
|
||||
@ -49,6 +51,20 @@ public interface MicroservicDynamicSQLMapper<T> {
|
||||
return convertList(allList, resultType);
|
||||
}
|
||||
|
||||
default List<String> getSingleColumnList(String sql, Map<String, Object> paramMap) {
|
||||
List<Map<String, Object>> rows = getAllList(sql, paramMap);
|
||||
if (rows == null || rows.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> result = new ArrayList<>(rows.size());
|
||||
for (Map<String, Object> row : rows) {
|
||||
// 获取第一个值并转为字符串
|
||||
Object firstValue = row.values().iterator().next();
|
||||
result.add(firstValue == null ? null : firstValue.toString());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Select({"select count(1) count from ${sql} and ${ew.sqlSegment}"})
|
||||
Integer count(@Param("select") String select, @Param("sql") String sql, @Param("ew") QueryWrapper queryWrapper);
|
||||
|
||||
|
||||
117
backend/src/main/java/com/yfd/platform/config/RedisConfig.java
Normal file
117
backend/src/main/java/com/yfd/platform/config/RedisConfig.java
Normal file
@ -0,0 +1,117 @@
|
||||
package com.yfd.platform.config;
|
||||
|
||||
import cn.hutool.crypto.digest.DigestUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import com.fasterxml.jackson.annotation.PropertyAccessor;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.annotation.EnableCaching;
|
||||
import org.springframework.cache.interceptor.KeyGenerator;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.redis.cache.RedisCacheConfiguration;
|
||||
import org.springframework.data.redis.cache.RedisCacheManager;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
|
||||
import org.springframework.data.redis.serializer.RedisSerializationContext;
|
||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Configuration
|
||||
@EnableCaching
|
||||
public class RedisConfig {
|
||||
|
||||
@Bean
|
||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
|
||||
redisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
|
||||
StringRedisSerializer stringSerializer = new StringRedisSerializer();
|
||||
|
||||
redisTemplate.setKeySerializer(stringSerializer);
|
||||
redisTemplate.setHashKeySerializer(stringSerializer);
|
||||
redisTemplate.setValueSerializer(genericJackson2JsonRedisSerializer());
|
||||
redisTemplate.setHashValueSerializer(genericJackson2JsonRedisSerializer());
|
||||
|
||||
redisTemplate.afterPropertiesSet();
|
||||
return redisTemplate;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public StringRedisTemplate stringRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
|
||||
StringRedisTemplate stringRedisTemplate = new StringRedisTemplate();
|
||||
stringRedisTemplate.setConnectionFactory(redisConnectionFactory);
|
||||
return stringRedisTemplate;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) {
|
||||
RedisCacheConfiguration defaultConfig = RedisCacheConfiguration.defaultCacheConfig()
|
||||
.prefixCacheNameWith("qgc:")
|
||||
.serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()))
|
||||
.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(genericJackson2JsonRedisSerializer()))
|
||||
.entryTtl(Duration.ofMinutes(30));
|
||||
|
||||
// Map<String, RedisCacheConfiguration> cacheConfigs = new HashMap<>();
|
||||
// cacheConfigs.put("dictCache", defaultConfig.entryTtl(Duration.ofHours(6)));
|
||||
// cacheConfigs.put("dataCache", defaultConfig.entryTtl(Duration.ofMinutes(5)));
|
||||
// cacheConfigs.put("engInfoCache", defaultConfig.entryTtl(Duration.ofHours(2)));
|
||||
|
||||
return RedisCacheManager.builder(redisConnectionFactory)
|
||||
.cacheDefaults(defaultConfig)
|
||||
// .withInitialCacheConfigurations(cacheConfigs)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
|
||||
objectMapper.registerModule(new JavaTimeModule());
|
||||
objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||
// ✅ 关键:启用默认类型信息(必须添加)
|
||||
objectMapper.activateDefaultTyping(
|
||||
objectMapper.getPolymorphicTypeValidator(),
|
||||
ObjectMapper.DefaultTyping.NON_FINAL,
|
||||
JsonTypeInfo.As.PROPERTY
|
||||
);
|
||||
|
||||
return new GenericJackson2JsonRedisSerializer(objectMapper);
|
||||
}
|
||||
|
||||
@Bean("customKeyGenerator")
|
||||
public KeyGenerator customKeyGenerator() {
|
||||
return (target, method, params) -> {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(target.getClass().getSimpleName());
|
||||
sb.append(":");
|
||||
sb.append(method.getName());
|
||||
sb.append(":");
|
||||
for (Object param : params) {
|
||||
sb.append(param != null ? param.toString() : "null");
|
||||
sb.append(",");
|
||||
}
|
||||
if (!sb.isEmpty() && sb.charAt(sb.length() - 1) == ',') {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
return sb.toString();
|
||||
};
|
||||
}
|
||||
|
||||
@Bean("cacheKeyGenerator")
|
||||
public KeyGenerator cacheKeyGenerator() {
|
||||
return (target, method, params) -> target.getClass().getName() + "." + method.getName() + ":" + DigestUtil.md5Hex(JSONUtil.toJsonStr(params));
|
||||
}
|
||||
}
|
||||
@ -65,6 +65,7 @@ public class SecurityConfig {
|
||||
.requestMatchers("/eq/**").permitAll()
|
||||
.requestMatchers("/env/**").permitAll()
|
||||
.requestMatchers("/warn/**").permitAll()
|
||||
.requestMatchers("/overview/**").permitAll()
|
||||
.requestMatchers("/wt/**").permitAll()
|
||||
.requestMatchers("/fb/**").permitAll()
|
||||
.requestMatchers("/zq/**").permitAll()
|
||||
@ -76,6 +77,9 @@ public class SecurityConfig {
|
||||
.requestMatchers("/fpr/**").permitAll()
|
||||
.requestMatchers("/fh/**").permitAll()
|
||||
.requestMatchers("/data/**").permitAll()
|
||||
.requestMatchers("/mapLayer/**").permitAll()
|
||||
.requestMatchers("/mapmodule/**").permitAll()
|
||||
.requestMatchers("/mapLegend/**").permitAll()
|
||||
.requestMatchers("/sms/**").permitAll()
|
||||
.requestMatchers(HttpMethod.GET, "/").permitAll()
|
||||
.requestMatchers(HttpMethod.GET,
|
||||
|
||||
@ -151,6 +151,15 @@ public class SwaggerConfig {
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi groupEnvOverviewApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("3.10 全过程-生态环保数据服务-首页(overview)")
|
||||
.packagesToScan("com.yfd.platform.qgc_env.overview.controller")
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -172,4 +181,20 @@ public class SwaggerConfig {
|
||||
.packagesToScan("com.yfd.platform.qgc_eng.eq.controller")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi groupSysApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("5. 图层管理")
|
||||
.packagesToScan("com.yfd.platform.qgc_sys.mapLayer.controller")
|
||||
.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public GroupedOpenApi groupSysMcfgApi() {
|
||||
return GroupedOpenApi.builder()
|
||||
.group("5.1 图例结构管理")
|
||||
.packagesToScan("com.yfd.platform.qgc_sys.mapcfg.controller")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@ -7,12 +7,15 @@ import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Configuration
|
||||
public class WebConfig implements WebMvcConfigurer {
|
||||
@Resource
|
||||
@ -21,11 +24,28 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
@Value("${app.zip-import.temp-dir}")
|
||||
private String platformPath;
|
||||
|
||||
|
||||
@Resource
|
||||
private StringRedisTemplate stringRedisTemplate;
|
||||
|
||||
@Bean
|
||||
public Cache<String, String> loginuserCache() {
|
||||
return CacheUtil.newLRUCache(200);//用户登录缓存数 缺省200
|
||||
return CacheUtil.newLRUCache(200);
|
||||
}
|
||||
|
||||
public void putLoginCache(String key, String value, long timeoutSeconds) {
|
||||
stringRedisTemplate.opsForValue().set(key, value, timeoutSeconds, TimeUnit.SECONDS);
|
||||
}
|
||||
|
||||
public void putLoginCache(String key, String value) {
|
||||
stringRedisTemplate.opsForValue().set(key, value);
|
||||
}
|
||||
|
||||
public String getLoginCache(String key) {
|
||||
return stringRedisTemplate.opsForValue().get(key);
|
||||
}
|
||||
|
||||
public void removeLoginCache(String key) {
|
||||
stringRedisTemplate.delete(key);
|
||||
}
|
||||
|
||||
@Bean
|
||||
|
||||
@ -93,6 +93,14 @@ public class SdEngInfoBHController {
|
||||
return ResponseResult.successData(engInfoBHService.getVmsstbprptKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/stbprpData/GetKendoListCust")
|
||||
@Operation(summary = "电站通用实时监测数据查询")
|
||||
public ResponseResult getStbprpDataKendoListCust(@RequestBody DataSourceRequest dataSourceRequest,
|
||||
@RequestParam("tbCode") String tbCode,
|
||||
@RequestParam(value = "ignorePageLimit", required = false) Boolean ignorePageLimit) {
|
||||
return ResponseResult.successData(engInfoBHService.getStbprpDataKendoListCust(dataSourceRequest, tbCode, ignorePageLimit));
|
||||
}
|
||||
|
||||
@Log(module = "电站管理", value = "新增电站")
|
||||
@PostMapping("/add")
|
||||
@Operation(summary = "新增电站")
|
||||
|
||||
@ -44,4 +44,10 @@ public class SdEngMonitorController {
|
||||
public ResponseResult getOperatKendoList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(engInfoBHService.getOperatKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/point/GetKendoListCust")
|
||||
@Operation(summary = "水电站-地图锚点")
|
||||
public ResponseResult getEngPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(engInfoBHService.getEngPointKendoListCust(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -29,4 +29,11 @@ public class MsOperationLog implements Serializable {
|
||||
|
||||
@TableField("REMARK")
|
||||
private String remark;
|
||||
|
||||
@TableField("TABLE_NAME")
|
||||
private String tableName;
|
||||
|
||||
@TableField("RECORD_ID")
|
||||
private String recordId;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
package com.yfd.platform.qgc_base.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "水电站描点")
|
||||
public class EngPointVo {
|
||||
|
||||
@Schema(description = "站码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "站点名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "电站名称")
|
||||
private String ennm;
|
||||
|
||||
@Schema(description = "电站图片")
|
||||
private String logo;
|
||||
|
||||
@Schema(description = "标题名称")
|
||||
private String titleName;
|
||||
|
||||
@Schema(description = "流域编码")
|
||||
private String rvcd;
|
||||
|
||||
@Schema(description = "行政区编码")
|
||||
private String addvcd;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lttd;
|
||||
|
||||
@Schema(description = "多年平均流量")
|
||||
private BigDecimal avq;
|
||||
|
||||
@Schema(description = "装机容量(MW)")
|
||||
private BigDecimal ttpwr;
|
||||
|
||||
@Schema(description = "正常蓄水位")
|
||||
private BigDecimal normz;
|
||||
|
||||
@Schema(description = "多年平均发电量")
|
||||
private BigDecimal yrge;
|
||||
|
||||
@Schema(description = "所属基地编码")
|
||||
private String baseId;
|
||||
|
||||
@Schema(description = "建成日期")
|
||||
private Date jcdt;
|
||||
|
||||
@Schema(description = "所属行政区名称")
|
||||
private String addvcdName;
|
||||
|
||||
@Schema(description = "站点类型")
|
||||
private String sttp;
|
||||
|
||||
@Schema(description = "站点类型编码")
|
||||
private String sttpCode;
|
||||
|
||||
@Schema(description = "站点类型映射")
|
||||
private String sttpMap;
|
||||
|
||||
@Schema(description = "遥测方式")
|
||||
private String dtmel;
|
||||
|
||||
@Schema(description = "站点排序")
|
||||
private Integer siteStepSort;
|
||||
|
||||
@Schema(description = "流域沿程")
|
||||
private Integer rvcdStepSort;
|
||||
|
||||
@Schema(description = "电站沿程")
|
||||
private Integer rstcdStepSort;
|
||||
|
||||
@Schema(description = "是否电站专题电站")
|
||||
private String ifEngSpecial;
|
||||
|
||||
@Schema(description = "电站装机类型")
|
||||
private Integer endInstalledType;
|
||||
|
||||
@Schema(description = "描点状态")
|
||||
private String anchoPointState;
|
||||
|
||||
@Schema(description = "工程规模")
|
||||
private Integer prsc;
|
||||
|
||||
@Schema(description = "图标旋转角度")
|
||||
private Integer iconRotate;
|
||||
|
||||
@Schema(description = "建设状态")
|
||||
private Integer bldsttCcode;
|
||||
|
||||
@Schema(description = "基地排序")
|
||||
private Integer baseStepSort;
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.yfd.platform.qgc_base.domain.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Schema(description = "电站通用监测数据动态行")
|
||||
public class EngStbprpDataVo extends LinkedHashMap<String, Object> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public EngStbprpDataVo() {
|
||||
super();
|
||||
}
|
||||
|
||||
public EngStbprpDataVo(Map<String, Object> source) {
|
||||
super();
|
||||
if (source != null && !source.isEmpty()) {
|
||||
putAll(source);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -12,6 +12,9 @@ public class BatchDeleteAo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Schema(description = "数据来源")
|
||||
private String source;
|
||||
|
||||
@Schema(description = "数据类型")
|
||||
private String dataType;
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import com.yfd.platform.qgc_base.domain.SdEngInfoBHRequest;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngBaseInfoVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngEiaapprovalVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngOperatVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngPointVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngStInfoResultVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngVmsstbprptVo;
|
||||
|
||||
@ -84,4 +85,8 @@ public interface ISdEngInfoBHService extends IService<SdEngInfoBH> {
|
||||
DataSourceResult<EngVmsstbprptVo> getVmsstbprptKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<EngOperatVo> getOperatKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult getStbprpDataKendoListCust(DataSourceRequest dataSourceRequest, String tbCode, Boolean ignorePageLimit);
|
||||
|
||||
DataSourceResult<EngPointVo> getEngPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ public class MsOperationLogServiceImpl implements IMsOperationLogService {
|
||||
if (engInfo == null) {
|
||||
return;
|
||||
}
|
||||
MsOperationLog mainLog = buildMainLog("新增电站", source);
|
||||
MsOperationLog mainLog = buildMainLog(null,"新增电站", source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
@ -311,7 +311,7 @@ public class MsOperationLogServiceImpl implements IMsOperationLogService {
|
||||
return;
|
||||
}
|
||||
|
||||
MsOperationLog mainLog = buildMainLog("修改电站", source);
|
||||
MsOperationLog mainLog = buildMainLog(before.getStcd(),"修改电站", source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
@ -348,7 +348,7 @@ public class MsOperationLogServiceImpl implements IMsOperationLogService {
|
||||
if (engInfo == null) {
|
||||
return;
|
||||
}
|
||||
MsOperationLog mainLog = buildMainLog("删除电站", source);
|
||||
MsOperationLog mainLog = buildMainLog(engInfo.getStcd(),"删除电站", source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
@ -378,10 +378,12 @@ public class MsOperationLogServiceImpl implements IMsOperationLogService {
|
||||
batchInsertDetails(details);
|
||||
}
|
||||
|
||||
private MsOperationLog buildMainLog(String remark, String source) {
|
||||
private MsOperationLog buildMainLog(String recordId,String remark, String source) {
|
||||
MsOperationLog log = new MsOperationLog();
|
||||
log.setOperator(resolveOperator());
|
||||
log.setOperateTime(new Date());
|
||||
log.setTableName(ENG_TABLE_NAME);
|
||||
log.setRecordId(recordId);
|
||||
log.setSource(StrUtil.trimToNull(source));
|
||||
log.setRemark(remark);
|
||||
return log;
|
||||
|
||||
@ -27,29 +27,26 @@ import com.yfd.platform.qgc_base.domain.SdEngInfoBHRequest;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngBaseInfoVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngEiaapprovalVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngOperatVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngPointVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngStbprpDataVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngStBaseInfoVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngStInfoResultVo;
|
||||
import com.yfd.platform.qgc_base.domain.vo.EngVmsstbprptVo;
|
||||
import com.yfd.platform.qgc_base.mapper.SdEngInfoBHMapper;
|
||||
import com.yfd.platform.qgc_base.service.IMsOperationLogService;
|
||||
import com.yfd.platform.qgc_base.service.ISdEngInfoBHService;
|
||||
import com.yfd.platform.system.service.IAdminAuthService;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -88,6 +85,9 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
@Resource
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Resource
|
||||
private IAdminAuthService adminAuthService;
|
||||
|
||||
@Override
|
||||
public Page<SdEngInfoBH> queryPageList(Page<SdEngInfoBH> page, String ennm, String rvcd, String baseId, String hycd) {
|
||||
LambdaQueryWrapper<SdEngInfoBH> wrapper = new LambdaQueryWrapper<>();
|
||||
@ -100,28 +100,32 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
||||
wrapper.in(SdEngInfoBH::getStcd, authorizedStations);
|
||||
}else if (!"admin".equals(SecurityUtils.getCurrentUsername())){
|
||||
}else if (!adminAuthService.isCurrentManagedAdmin()){
|
||||
return page;
|
||||
}
|
||||
return this.page(page, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "engInfoCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdEngInfoBH> getByBaseId(String baseId) {
|
||||
return engInfoBHMapper.selectByBaseId(baseId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "engInfoCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdEngInfoBH> getByHycd(String hycd) {
|
||||
return engInfoBHMapper.selectByHycd(hycd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "engInfoCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdEngInfoBH> getByRvcd(String rvcd,String reachcd) {
|
||||
return engInfoBHMapper.selectByRvcd(rvcd,reachcd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "engInfoCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdEngInfoBH> selectForDropdown(SdEngInfoBHRequest sdEngInfoBHRequest) {
|
||||
String baseId = sdEngInfoBHRequest.getBaseId();
|
||||
String hbrvcd = sdEngInfoBHRequest.getHbrvcd();
|
||||
@ -142,7 +146,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
.select(SdEngInfoBH::getStcd, SdEngInfoBH::getEnnm, SdEngInfoBH::getReachcdName, SdEngInfoBH::getYrgeb, SdEngInfoBH::getBaseId)
|
||||
.orderByAsc(SdEngInfoBH::getBaseId,SdEngInfoBH::getOrderIndex);
|
||||
|
||||
if("admin".equals(SecurityUtils.getCurrentUsername())){
|
||||
if(adminAuthService.isCurrentManagedAdmin()){
|
||||
return this.list(wrapper);
|
||||
}
|
||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||
@ -226,6 +230,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = "engInfoCache", allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addEngInfo(SdEngInfoBH engInfo, String source) {
|
||||
fillRelatedNameFields(engInfo);
|
||||
@ -242,6 +247,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = "engInfoCache", allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateEngInfo(SdEngInfoBH engInfo, String source) {
|
||||
SdEngInfoBH before = engInfo == null ? null : this.getById(engInfo.getStcd());
|
||||
@ -512,6 +518,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = "engInfoCache", allEntries = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteEngInfo(List<String> ids, String source) {
|
||||
List<String> stcdList = ids == null ? new ArrayList<>() : ids.stream()
|
||||
@ -709,6 +716,59 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
return queryOperatGroupList(dataSourceRequest, loadOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult getStbprpDataKendoListCust(DataSourceRequest dataSourceRequest, String tbCode, Boolean ignorePageLimit) {
|
||||
DataSourceResult<EngStbprpDataVo> result = new DataSourceResult<>();
|
||||
result.setAggregates(new HashMap<>());
|
||||
if (StrUtil.isBlank(tbCode)) {
|
||||
result.setData(new ArrayList<>());
|
||||
result.setTotal(0L);
|
||||
return result;
|
||||
}
|
||||
DataSourceRequest request = dataSourceRequest == null ? new DataSourceRequest() : dataSourceRequest;
|
||||
if (!Boolean.TRUE.equals(ignorePageLimit) && request.getTake() == 0) {
|
||||
request.setTake(2000);
|
||||
}
|
||||
|
||||
DataSourceLoadOptionsBase loadOptions = request.toDevRequest();
|
||||
List<StbprpTableMeta> tableMetaList = queryStbprpTableMeta(tbCode);
|
||||
if (CollUtil.isEmpty(tableMetaList)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
String firstTableName = tableMetaList.getFirst().tableName();
|
||||
String detailSql = buildStbprpDataDetailSql(request, tableMetaList);
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
String filterSql = buildStbprpDataFilterCondition(request.getFilter(), paramMap, new int[]{0}, tableMetaList);
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
detailSql = detailSql + " AND " + filterSql;
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(request.getGroup())) {
|
||||
String sql = detailSql + buildStbprpDataOrderBySql(request.getSort(), tableMetaList);
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.pageAllList(page, sql, paramMap);
|
||||
List<EngStbprpDataVo> list = new ArrayList<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
list.add(new EngStbprpDataVo(row));
|
||||
}
|
||||
result.setData(list);
|
||||
result.setTotal(page == null ? list.size() : page.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
GroupingInfo[] groupInfos = loadOptions == null ? new GroupingInfo[0] : loadOptions.getGroup();
|
||||
String groupSql = buildStbprpDataGroupSql(detailSql, request.getGroup(), tableMetaList);
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.pageAllList(null, groupSql, paramMap);
|
||||
if (Boolean.TRUE.equals(request.getGroupResultFlat())) {
|
||||
result.setData((List<EngStbprpDataVo>) (List<?>) new GroupHelper().faltGroup(rows, Arrays.asList(groupInfos)));
|
||||
} else {
|
||||
result.setData((List<EngStbprpDataVo>) (List<?>) new GroupHelper().group(rows, Arrays.asList(groupInfos)));
|
||||
}
|
||||
result.setTotal((long) rows.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
private DataSourceResult<EngOperatVo> queryOperatSummaryList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
@ -1039,6 +1099,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
"CAST(NULL AS NUMBER) AS actcp, " +
|
||||
"CAST(NULL AS NUMBER) AS ddcp, " +
|
||||
"eng.CPSC AS cpsc, " +
|
||||
"eng.PRSC AS prsc, " +
|
||||
"eng.RGCP AS rgcp, " +
|
||||
"CASE eng.RGCP " +
|
||||
" WHEN '1' THEN '多年调节' " +
|
||||
@ -1080,6 +1141,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
" WHEN '3' THEN '混合式' " +
|
||||
" ELSE NULL END AS dvtpName, " +
|
||||
"eng.DTIN AS dtin, " +
|
||||
"eng.RUN_STATE AS runSTATE, " +
|
||||
"eng.DTIN_ENV AS dtinEnv, " +
|
||||
"CASE NVL(eng.DTIN, 0) " +
|
||||
" WHEN 0 THEN '否' " +
|
||||
@ -1452,7 +1514,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
" UNION ALL " +
|
||||
buildOperatBaseSelectSql("dw.STCD", "dw.STNM", "dw.STTP", "dw.DTIN", "dw.BLDSTT_CODE",
|
||||
"eng.BASE_ID", "eng.HBRVCD", "eng.RVCD", "eng.RVCD_NAME", "eng.ADDVCD_NAME", "dw.RSTCD",
|
||||
"eng.ENNM", "SD_DFLTKW_B_H dw",
|
||||
"eng.ENNM", "SD_DW_B_H dw",
|
||||
"LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = dw.RSTCD AND NVL(eng.IS_DELETED, 0) = 0",
|
||||
"NVL(dw.IS_DELETED, 0) = 0") +
|
||||
" UNION ALL " +
|
||||
@ -1841,6 +1903,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
case "id" -> "t.id";
|
||||
case "sttp" -> "t.sttp";
|
||||
case "sttpCode" -> "t.sttpCode";
|
||||
case "runState" -> "t.runState";
|
||||
case "sttpName" -> "t.sttpName";
|
||||
case "stcd" -> "t.stcd";
|
||||
case "stnm", "ennm" -> "t.stnm";
|
||||
@ -1850,6 +1913,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
case "hbrvcd" -> "t.hbrvcd";
|
||||
case "hbrvcdName" -> "t.hbrvcdName";
|
||||
case "rvcd" -> "t.rvcd";
|
||||
case "prsc" -> "t.prsc";
|
||||
case "rvcdName" -> "t.rvcdName";
|
||||
case "addvcdName" -> "t.addvcdName";
|
||||
case "hynm" -> "t.hynm";
|
||||
@ -2303,4 +2367,565 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl<SdEngInfoBHMapper, SdEng
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private List<StbprpTableMeta> queryStbprpTableMeta(String tbCode) {
|
||||
// 1. 解析参数
|
||||
List<String> tbCodes = StrUtil.split(tbCode, ',')
|
||||
.stream()
|
||||
.map(StrUtil::trim)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.distinct()
|
||||
.toList();
|
||||
|
||||
if (tbCodes.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 2. 构建 SQL 和参数
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (int i = 0; i < tbCodes.size(); i++) {
|
||||
String key = "tbCode" + i;
|
||||
paramMap.put(key, tbCodes.get(i));
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
|
||||
String sql = "SELECT ID, TB, TB_CODE, STCD_MAPPING, TM_MAPPING " +
|
||||
"FROM ST_TB_B " +
|
||||
"WHERE NVL(IS_DELETED, 0) = 0 " +
|
||||
"AND TB_CODE IN (" + StrUtil.join(", ", placeholders) + ") " +
|
||||
"ORDER BY TB_CODE";
|
||||
|
||||
// 3. 执行查询
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.pageAllList(null, sql, paramMap);
|
||||
|
||||
// 4. 转换结果
|
||||
List<StbprpTableMeta> result = new ArrayList<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
result.add(new StbprpTableMeta(
|
||||
asString(row.get("ID")),
|
||||
asString(row.get("TB")),
|
||||
asString(row.get("TB_CODE")),
|
||||
StrUtil.blankToDefault(asString(row.get("STCD_MAPPING")), "STCD"),
|
||||
StrUtil.blankToDefault(asString(row.get("TM_MAPPING")), "TM")
|
||||
));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全转为字符串
|
||||
*/
|
||||
private String asString(Object obj) {
|
||||
return obj == null ? null : obj.toString();
|
||||
}
|
||||
|
||||
private String buildStbprpDataDetailSql(DataSourceRequest request, List<StbprpTableMeta> tableMetaList) {
|
||||
List<String> selectItems = resolveStbprpSelectItems(request == null ? null : request.getSelect(), tableMetaList);
|
||||
StringBuilder sql = new StringBuilder("SELECT ");
|
||||
sql.append(String.join(", ", selectItems)).append(" FROM ");
|
||||
for (int i = 0; i < tableMetaList.size(); i++) {
|
||||
StbprpTableMeta meta = tableMetaList.get(i);
|
||||
String alias = "t" + (i + 1);
|
||||
if (i == 0) {
|
||||
sql.append(meta.tableName()).append(" ").append(alias).append(" ");
|
||||
} else {
|
||||
StbprpTableMeta first = tableMetaList.getFirst();
|
||||
sql.append(" LEFT JOIN ").append(meta.tableName()).append(" ").append(alias)
|
||||
.append(" ON t1.").append(first.stcdMapping()).append(" = ").append(alias).append(".").append(meta.stcdMapping())
|
||||
.append(" AND t1.").append(first.tmMapping()).append(" = ").append(alias).append(".").append(meta.tmMapping()).append(" ");
|
||||
}
|
||||
}
|
||||
sql.append(" WHERE 1 = 1");
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private List<String> resolveStbprpSelectItems(List<String> selectFields, List<StbprpTableMeta> tableMetaList) {
|
||||
if (CollUtil.isEmpty(selectFields)) {
|
||||
return List.of("t1.*");
|
||||
}
|
||||
List<String> items = new ArrayList<>();
|
||||
for (String field : selectFields) {
|
||||
if (StrUtil.isBlank(field)) {
|
||||
continue;
|
||||
}
|
||||
String mapped = mapStbprpField(field, tableMetaList);
|
||||
if (StrUtil.isNotBlank(mapped)) {
|
||||
items.add(mapped + " AS \"" + field.trim() + "\"");
|
||||
}
|
||||
}
|
||||
if (items.isEmpty()) {
|
||||
items.add("t1.*");
|
||||
}
|
||||
return items;
|
||||
}
|
||||
|
||||
private String buildStbprpDataFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder,
|
||||
List<StbprpTableMeta> tableMetaList) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(filter.getField())) {
|
||||
return buildStbprpDataLeafCondition(filter, paramMap, indexHolder, tableMetaList);
|
||||
}
|
||||
if (CollUtil.isEmpty(filter.getFilters())) {
|
||||
return "";
|
||||
}
|
||||
List<String> childConditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildStbprpDataFilterCondition(child, paramMap, indexHolder, tableMetaList);
|
||||
if (StrUtil.isNotBlank(childSql)) {
|
||||
childConditions.add("(" + childSql + ")");
|
||||
}
|
||||
}
|
||||
if (childConditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
|
||||
return String.join(logic, childConditions);
|
||||
}
|
||||
|
||||
private String buildStbprpDataLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder,
|
||||
List<StbprpTableMeta> tableMetaList) {
|
||||
String column = mapStbprpField(filter.getField(), tableMetaList);
|
||||
if (StrUtil.isBlank(column)) {
|
||||
return "";
|
||||
}
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
Object value = filter.getValue();
|
||||
if ("isnull".equals(operator)) {
|
||||
return column + " IS NULL";
|
||||
}
|
||||
if ("isnotnull".equals(operator)) {
|
||||
return column + " IS NOT NULL";
|
||||
}
|
||||
if ("isempty".equals(operator)) {
|
||||
return "(" + column + " IS NULL OR " + column + " = '')";
|
||||
}
|
||||
if ("isnotempty".equals(operator)) {
|
||||
return "(" + column + " IS NOT NULL AND " + column + " <> '')";
|
||||
}
|
||||
boolean dateField = isStbprpDateField(filter);
|
||||
if ("in".equals(operator) || "ni".equals(operator)) {
|
||||
List<Object> values = normalizeFilterValues(value);
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String key = "stbprpParam" + indexHolder[0]++;
|
||||
paramMap.put(key, item);
|
||||
placeholders.add(buildStbprpDataValueExpr(key, dateField, item));
|
||||
}
|
||||
return column + ("ni".equals(operator) ? " NOT IN (" : " IN (") + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String key = "stbprpParam" + indexHolder[0]++;
|
||||
String expr = buildStbprpDataValueExpr(key, dateField, value);
|
||||
return switch (operator) {
|
||||
case "eq" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " = " + expr;
|
||||
}
|
||||
case "neq" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " <> " + expr;
|
||||
}
|
||||
case "contains" -> {
|
||||
paramMap.put(key, "%" + value + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "doesnotcontain" -> {
|
||||
paramMap.put(key, "%" + value + "%");
|
||||
yield column + " NOT LIKE #{map." + key + "}";
|
||||
}
|
||||
case "startswith" -> {
|
||||
paramMap.put(key, value + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "endswith" -> {
|
||||
paramMap.put(key, "%" + value);
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "gt" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " > " + expr;
|
||||
}
|
||||
case "gte" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " >= " + expr;
|
||||
}
|
||||
case "lt" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " < " + expr;
|
||||
}
|
||||
case "lte" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " <= " + expr;
|
||||
}
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private String buildStbprpDataValueExpr(String paramKey, boolean dateField, Object value) {
|
||||
if (!dateField || value == null) {
|
||||
return "#{map." + paramKey + "}";
|
||||
}
|
||||
String text = String.valueOf(value).trim();
|
||||
if (text.length() <= 10) {
|
||||
return "TO_DATE(#{map." + paramKey + "}, 'YYYY-MM-DD')";
|
||||
}
|
||||
return "TO_DATE(#{map." + paramKey + "}, 'YYYY-MM-DD HH24:MI:SS')";
|
||||
}
|
||||
|
||||
private boolean isStbprpDateField(DataSourceRequest.FilterDescriptor filter) {
|
||||
if (filter == null) {
|
||||
return false;
|
||||
}
|
||||
if ("date".equalsIgnoreCase(filter.getDataType())) {
|
||||
return true;
|
||||
}
|
||||
String field = StrUtil.blankToDefault(filter.getField(), "").trim().toLowerCase();
|
||||
if (field.contains(".")) {
|
||||
field = field.substring(field.lastIndexOf('.') + 1);
|
||||
}
|
||||
return "tm".equals(field) || "dt".equals(field);
|
||||
}
|
||||
|
||||
private String buildStbprpDataOrderBySql(List<DataSourceRequest.SortDescriptor> sortList, List<StbprpTableMeta> tableMetaList) {
|
||||
if (CollUtil.isEmpty(sortList)) {
|
||||
return "";
|
||||
}
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sort : sortList) {
|
||||
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapStbprpField(sort.getField(), tableMetaList);
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String dir = "desc".equalsIgnoreCase(sort.getDir()) || "des".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + dir);
|
||||
}
|
||||
if (orderItems.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
|
||||
private String buildStbprpDataGroupSql(String detailSql,
|
||||
List<DataSourceRequest.GroupDescriptor> groups,
|
||||
List<StbprpTableMeta> tableMetaList) {
|
||||
List<String> selectItems = new ArrayList<>();
|
||||
List<String> groupItems = new ArrayList<>();
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.GroupDescriptor descriptor : groups) {
|
||||
if (descriptor == null || StrUtil.isBlank(descriptor.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapStbprpField(descriptor.getField(), tableMetaList);
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String upperField = descriptor.getField().trim().toUpperCase();
|
||||
selectItems.add(column + " AS " + upperField);
|
||||
selectItems.add("COUNT(*) AS COUNT_" + upperField);
|
||||
groupItems.add(column);
|
||||
String dir = "desc".equalsIgnoreCase(descriptor.getDir()) || "des".equalsIgnoreCase(descriptor.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + dir);
|
||||
}
|
||||
if (selectItems.isEmpty()) {
|
||||
selectItems.add("t1.STCD AS STCD");
|
||||
selectItems.add("COUNT(*) AS COUNT_STCD");
|
||||
groupItems.add("t1.STCD");
|
||||
orderItems.add("t1.STCD ASC");
|
||||
}
|
||||
return "SELECT " + String.join(", ", selectItems) +
|
||||
" FROM (" + detailSql + ") t1 GROUP BY " + String.join(", ", groupItems) +
|
||||
" ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
|
||||
private String mapStbprpField(String field, List<StbprpTableMeta> tableMetaList) {
|
||||
if (StrUtil.isBlank(field) || CollUtil.isEmpty(tableMetaList)) {
|
||||
return null;
|
||||
}
|
||||
String normalized = field.trim();
|
||||
if (!normalized.contains(".")) {
|
||||
return "t1." + normalized.toUpperCase();
|
||||
}
|
||||
String[] parts = normalized.split("\\.", 2);
|
||||
if (parts.length != 2) {
|
||||
return null;
|
||||
}
|
||||
for (int i = 0; i < tableMetaList.size(); i++) {
|
||||
if (StrUtil.equalsIgnoreCase(tableMetaList.get(i).tbCode(), parts[0])) {
|
||||
return "t" + (i + 1) + "." + parts[1].toUpperCase();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private record StbprpTableMeta(String id, String tableName, String tbCode, String stcdMapping, String tmMapping) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<EngPointVo> getEngPointKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<EngPointVo> result = new DataSourceResult<>();
|
||||
result.setAggregates(new HashMap<>());
|
||||
|
||||
if (dataSourceRequest == null) {
|
||||
result.setData(new ArrayList<>());
|
||||
result.setTotal(0L);
|
||||
return result;
|
||||
}
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append("t.STCD AS stcd, ")
|
||||
.append("t.STNM AS ennm, ")
|
||||
.append("t.LOGO AS logo, ")
|
||||
.append("t.STNM AS stnm, ")
|
||||
.append("t.STNM AS titleName, ")
|
||||
.append("t.RVCD AS rvcd, ")
|
||||
.append("t.ADDVCD AS addvcd, ")
|
||||
.append("t.LGTD AS lgtd, ")
|
||||
.append("t.LTTD AS lttd, ")
|
||||
.append("t.AVQ AS avq, ")
|
||||
.append("t.YRGEB AS ttpwr, ")
|
||||
.append("t.FSLTDZ AS normz, ")
|
||||
.append("t.YRGEB AS yrge, ")
|
||||
.append("t.BASE_ID AS baseId, ")
|
||||
.append("t.JCDT AS jcdt, ")
|
||||
.append("t.ADDVCD_NAME AS addvcdName, ")
|
||||
.append("t.PRSC AS prsc, ")
|
||||
.append("CAST(NULL AS NUMBER) AS iconRotate, ")
|
||||
.append("t.BLDSTT_CODE AS bldsttCcode, ")
|
||||
.append("'ENG' AS sttpMap, ")
|
||||
.append("'ENG' AS sttp, ")
|
||||
.append("'ENG' AS sttpCode, ")
|
||||
.append("t.DTIN_ENV AS dtmel, ")
|
||||
.append("NVL(siteSort.SORT, 999999) AS siteStepSort, ")
|
||||
.append("NVL(along.ORDER_INDEX, 999999) AS rvcdStepSort, ")
|
||||
.append("NVL(rstSort.SORT, 999999) AS rstcdStepSort, ")
|
||||
.append("NVL(hb.ORDER_INDEX, 999999) AS baseStepSort, ")
|
||||
.append("CASE WHEN elec.configCount > 0 THEN 'true' WHEN elec.configCount IS NULL THEN 'false' ELSE 'false' END AS ifEngSpecial, ")
|
||||
.append("CASE ")
|
||||
.append(" WHEN t.PRSC IN ('1','2') AND t.BLDSTT_CODE = 2 THEN 'large_eng_built' ")
|
||||
.append(" WHEN t.PRSC IN ('1','2') AND t.BLDSTT_CODE = 1 THEN 'large_eng_ubuilt' ")
|
||||
.append(" WHEN t.PRSC IN ('1','2') AND (t.BLDSTT_CODE = 0 OR t.BLDSTT_CODE IS NULL) THEN 'large_eng_nbuilt' ")
|
||||
.append(" WHEN t.PRSC IN ('3') AND t.BLDSTT_CODE = 2 THEN 'mid_eng_built' ")
|
||||
.append(" WHEN t.PRSC IN ('3') AND t.BLDSTT_CODE = 1 THEN 'mid_eng_ubuilt' ")
|
||||
.append(" WHEN t.PRSC IN ('3') AND (t.BLDSTT_CODE = 0 OR t.BLDSTT_CODE IS NULL) THEN 'mid_eng_nbuilt' ")
|
||||
.append(" END AS anchoPointState, ")
|
||||
.append("CASE ")
|
||||
.append(" WHEN t.PRSC IN ('1','2') THEN 1 ")
|
||||
.append(" WHEN t.PRSC IN ('3') THEN 2 ")
|
||||
.append(" END AS endInstalledType ")
|
||||
.append("FROM SD_ENGINFO_B_H t ")
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = t.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN MS_ALONG_B along ON along.RVCD = t.HBRVCD AND along.CODE = 'common' AND NVL(along.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN ( ")
|
||||
.append(" SELECT det.SORT, cfg.RVCD, det.STCD ")
|
||||
.append(" FROM MS_ALONGDET_B det ")
|
||||
.append(" INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID ")
|
||||
.append(" WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common' ")
|
||||
.append(") rstSort ON rstSort.RVCD = t.HBRVCD AND rstSort.STCD = t.STCD ")
|
||||
.append("LEFT JOIN ( ")
|
||||
.append(" SELECT det.SORT, cfg.RVCD, det.STCD ")
|
||||
.append(" FROM MS_ALONGDET_B det ")
|
||||
.append(" INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID ")
|
||||
.append(" WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common' ")
|
||||
.append(") siteSort ON siteSort.RVCD = t.HBRVCD AND siteSort.STCD = t.STCD ")
|
||||
.append("LEFT JOIN ( ")
|
||||
.append(" SELECT STCD, COUNT(ID) AS configCount ")
|
||||
.append(" FROM SD_EQ_B_H ")
|
||||
.append(" WHERE NVL(IS_DELETED, 0) = 0 ")
|
||||
.append(" GROUP BY STCD ")
|
||||
.append(") elec ON t.STCD = elec.STCD ")
|
||||
.append("WHERE NVL(t.IS_DELETED, 0) = 0 ")
|
||||
.append("AND NVL(t.USFL, 1) = 1 ")
|
||||
.append("AND t.LGTD IS NOT NULL ")
|
||||
.append("AND t.LTTD IS NOT NULL ");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
String filterSql = buildEngPointFilterCondition(dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql);
|
||||
}
|
||||
|
||||
sql.append(buildEngPointOrderBySql(dataSourceRequest.getSort()));
|
||||
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<EngPointVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, EngPointVo.class);
|
||||
|
||||
result.setData(list);
|
||||
result.setTotal(page == null ? list.size() : page.getTotal());
|
||||
return result;
|
||||
}
|
||||
|
||||
private String buildEngPointFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (CollUtil.isNotEmpty(filter.getFilters())) {
|
||||
List<String> childConditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildEngPointFilterCondition(child, paramMap, indexHolder);
|
||||
if (StrUtil.isNotBlank(childSql)) {
|
||||
childConditions.add(childSql);
|
||||
}
|
||||
}
|
||||
if (childConditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
|
||||
return "(" + String.join(logic, childConditions) + ")";
|
||||
}
|
||||
String column = mapEngPointColumn(filter.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
return "";
|
||||
}
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
Object value = filter.getValue();
|
||||
if ("isnull".equals(operator)) {
|
||||
return column + " IS NULL";
|
||||
}
|
||||
if ("isnotnull".equals(operator)) {
|
||||
return column + " IS NOT NULL";
|
||||
}
|
||||
if ("isempty".equals(operator)) {
|
||||
return "(" + column + " IS NULL OR " + column + " = '')";
|
||||
}
|
||||
if ("isnotempty".equals(operator)) {
|
||||
return "(" + column + " IS NOT NULL AND " + column + " <> '')";
|
||||
}
|
||||
if ("in".equals(operator) || "ni".equals(operator)) {
|
||||
List<Object> values = normalizeFilterValues(value);
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String key = "engPointParam" + indexHolder[0]++;
|
||||
paramMap.put(key, item);
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
return column + ("ni".equals(operator) ? " NOT IN (" : " IN (") + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String key = "engPointParam" + indexHolder[0]++;
|
||||
return switch (operator) {
|
||||
case "eq" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " = #{map." + key + "}";
|
||||
}
|
||||
case "neq" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " <> #{map." + key + "}";
|
||||
}
|
||||
case "contains" -> {
|
||||
paramMap.put(key, "%" + value + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "doesnotcontain" -> {
|
||||
paramMap.put(key, "%" + value + "%");
|
||||
yield column + " NOT LIKE #{map." + key + "}";
|
||||
}
|
||||
case "startswith" -> {
|
||||
paramMap.put(key, value + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "endswith" -> {
|
||||
paramMap.put(key, "%" + value);
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "gt" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " > #{map." + key + "}";
|
||||
}
|
||||
case "gte" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " >= #{map." + key + "}";
|
||||
}
|
||||
case "lt" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " < #{map." + key + "}";
|
||||
}
|
||||
case "lte" -> {
|
||||
paramMap.put(key, value);
|
||||
yield column + " <= #{map." + key + "}";
|
||||
}
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private String mapEngPointColumn(String field) {
|
||||
if (StrUtil.isBlank(field)) {
|
||||
return null;
|
||||
}
|
||||
return switch (field) {
|
||||
case "stcd" -> "t.STCD";
|
||||
case "stnm", "ennm", "titleName" -> "t.STNM";
|
||||
case "rvcd" -> "t.RVCD";
|
||||
case "addvcd" -> "t.ADDVCD";
|
||||
case "lgtd" -> "t.LGTD";
|
||||
case "lttd" -> "t.LTTD";
|
||||
case "avq" -> "t.AVQ";
|
||||
case "ttpwr" -> "t.YRGEB";
|
||||
case "normz" -> "t.FSLTDZ";
|
||||
case "yrge" -> "t.YRGEB";
|
||||
case "baseId" -> "t.BASE_ID";
|
||||
case "jcdt" -> "t.JCDT";
|
||||
case "addvcdName" -> "t.ADDVCD_NAME";
|
||||
case "prsc" -> "t.PRSC";
|
||||
case "iconRotate" -> "t.ICON_ROTATE";
|
||||
case "bldsttCcode" -> "t.BLDSTT_CODE";
|
||||
case "sttp" -> "'ENG'";
|
||||
case "sttpCode" -> "'ENG'";
|
||||
case "sttpMap" -> "'ENG'";
|
||||
case "dtmel" -> "t.DTIN_ENV";
|
||||
case "siteStepSort" -> "siteStepSort";
|
||||
case "rvcdStepSort" -> "rvcdStepSort";
|
||||
case "rstcdStepSort" -> "rstcdStepSort";
|
||||
case "baseStepSort" -> "baseStepSort";
|
||||
case "ifEngSpecial" -> "ifEngSpecial";
|
||||
case "anchoPointState" -> "anchoPointState";
|
||||
case "endInstalledType" -> "endInstalledType";
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private String buildEngPointOrderBySql(List<DataSourceRequest.SortDescriptor> sortList) {
|
||||
if (CollUtil.isEmpty(sortList)) {
|
||||
return " ORDER BY baseStepSort ASC, rvcdStepSort ASC, rstcdStepSort ASC, siteStepSort ASC, stnm ASC";
|
||||
}
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sortDescriptor : sortList) {
|
||||
if (sortDescriptor == null || StrUtil.isBlank(sortDescriptor.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapEngPointColumn(sortDescriptor.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String dir = "desc".equalsIgnoreCase(sortDescriptor.getDir()) || "des".equalsIgnoreCase(sortDescriptor.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + dir);
|
||||
}
|
||||
if (orderItems.isEmpty()) {
|
||||
return " ORDER BY baseStepSort ASC, rvcdStepSort ASC, rstcdStepSort ASC, siteStepSort ASC, stnm ASC";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.yfd.platform.qgc_base.domain.SdFpssBH;
|
||||
import com.yfd.platform.qgc_base.mapper.SdEngInfoBHMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.SdFpssBHMapper;
|
||||
import com.yfd.platform.qgc_base.service.ISdFpssBHService;
|
||||
import com.yfd.platform.system.service.IAdminAuthService;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -29,6 +30,9 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
||||
@Resource
|
||||
private SdEngInfoBHMapper sdEngInfoBHMapper;
|
||||
|
||||
@Resource
|
||||
private IAdminAuthService adminAuthService;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<SdFpssBH> selectPage(String stcd, String sttp, String rstcd, Integer usfl, Page<SdFpssBH> page) {
|
||||
@ -50,7 +54,7 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||
if (authorizedStations != null && !authorizedStations.isEmpty()) {
|
||||
wrapper.in(SdFpssBH::getRstcd, authorizedStations);
|
||||
}else if (!"admin".equals(SecurityUtils.getCurrentUsername())){
|
||||
}else if (!adminAuthService.isCurrentManagedAdmin()){
|
||||
return page;
|
||||
}
|
||||
|
||||
@ -68,7 +72,7 @@ public class SdFpssBHServiceImpl extends ServiceImpl<SdFpssBHMapper, SdFpssBH> i
|
||||
@Override
|
||||
public List<SdFpssBH> selectForDropdown(String rstcd, String stnm, String baseId,String rvcd,String reachcd) {
|
||||
// 管理员直接查询,无需权限过滤
|
||||
if ("admin".equals(SecurityUtils.getCurrentUsername())) {
|
||||
if (adminAuthService.isCurrentManagedAdmin()) {
|
||||
return queryFpssList(rstcd, stnm, baseId,rvcd,reachcd);
|
||||
}
|
||||
|
||||
|
||||
@ -15,6 +15,9 @@ import com.yfd.platform.qgc_base.mapper.SdEngInfoBHMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.SdHbrvDicMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.SdHydrobaseMapper;
|
||||
import com.yfd.platform.qgc_base.service.ISdHbrvDicService;
|
||||
import com.yfd.platform.system.service.IAdminAuthService;
|
||||
import com.yfd.platform.utils.CodeToNameMetadataBo;
|
||||
import com.yfd.platform.utils.DictCodeToNameConverter;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -46,7 +49,39 @@ public class SdHbrvDicServiceImpl extends ServiceImpl<SdHbrvDicMapper, SdHbrvDic
|
||||
@Resource
|
||||
private SdHydrobaseMapper hydrobaseMapper;
|
||||
|
||||
@Resource
|
||||
private IAdminAuthService adminAuthService;
|
||||
|
||||
private SdHbrvDicMapper hbrvDicMapper;
|
||||
|
||||
|
||||
|
||||
@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("grd").modifyProperty("grdName").dictType("STATIC").dictSource("TEST").build());
|
||||
// CODE_TO_NAME_META_LIST.add(CodeToNameMetadataBo.builder().codeProperty("baseid").modifyProperty("basename").dictType("DYNAMIC").dictSource("SD_HYDROBASE").codeColumn("BASEID").nameColumn("BASENAME").filter("NVL(IS_DELETED, 0) = 0 ").build());
|
||||
// }
|
||||
|
||||
|
||||
@Override
|
||||
public Page<SdHbrvDic> queryPageList(Page<SdHbrvDic> page, String hbrvnm, String baseid) {
|
||||
return this.page(page, this.lambdaQuery()
|
||||
@ -110,7 +145,7 @@ public class SdHbrvDicServiceImpl extends ServiceImpl<SdHbrvDicMapper, SdHbrvDic
|
||||
.eq(baseid != null && !baseid.isEmpty(), SdHbrvDic::getBaseid, baseid)
|
||||
.eq(SdHbrvDic::getEnabled, 1)
|
||||
.orderByAsc(SdHbrvDic::getBaseid,SdHbrvDic::getOrderIndex);
|
||||
if("admin".equals(SecurityUtils.getCurrentUsername())){
|
||||
if(adminAuthService.isCurrentManagedAdmin()){
|
||||
return this.list(wrapper);
|
||||
}
|
||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||
|
||||
@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.qgc_base.domain.SdHycdDic;
|
||||
import com.yfd.platform.qgc_base.mapper.SdHycdDicMapper;
|
||||
import com.yfd.platform.qgc_base.service.ISdHycdDicService;
|
||||
import org.springframework.cache.annotation.CacheEvict;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@ -27,6 +29,7 @@ public class SdHycdDicServiceImpl extends ServiceImpl<SdHycdDicMapper, SdHycdDic
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "hycdCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdHycdDic> getByPhycd(String phycd) {
|
||||
return this.lambdaQuery()
|
||||
.eq(SdHycdDic::getPhycd, phycd)
|
||||
@ -35,6 +38,7 @@ public class SdHycdDicServiceImpl extends ServiceImpl<SdHycdDicMapper, SdHycdDic
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "hycdCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdHycdDic> getRootList() {
|
||||
return this.lambdaQuery()
|
||||
.eq(SdHycdDic::getPhycd, "0")
|
||||
@ -43,21 +47,25 @@ public class SdHycdDicServiceImpl extends ServiceImpl<SdHycdDicMapper, SdHycdDic
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = "hycdCache", allEntries = true)
|
||||
public boolean addHycdDic(SdHycdDic hycdDic) {
|
||||
return this.save(hycdDic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = "hycdCache", allEntries = true)
|
||||
public boolean updateHycdDic(SdHycdDic hycdDic) {
|
||||
return this.updateById(hycdDic);
|
||||
}
|
||||
|
||||
@Override
|
||||
@CacheEvict(cacheNames = "hycdCache", allEntries = true)
|
||||
public boolean deleteHycdDic(String hycd) {
|
||||
return this.removeById(hycd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "hycdCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdHycdDic> selectForDropdown(String hynm, Integer grd, Integer lx,String phycd) {
|
||||
return this.lambdaQuery()
|
||||
.like(hynm != null && !hynm.isEmpty(), SdHycdDic::getHynm, hynm)
|
||||
@ -69,6 +77,7 @@ public class SdHycdDicServiceImpl extends ServiceImpl<SdHycdDicMapper, SdHycdDic
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "hycdCache#3600", keyGenerator = "cacheKeyGenerator")
|
||||
public List<SdHycdDic> regDropdown(String hynm, Integer grd,Integer lx,String phycd) {
|
||||
return this.lambdaQuery()
|
||||
.like(hynm != null && !hynm.isEmpty(), SdHycdDic::getHynm, hynm)
|
||||
|
||||
@ -13,6 +13,7 @@ import com.yfd.platform.qgc_base.entity.vo.HydrobaseWbsVo;
|
||||
import com.yfd.platform.qgc_base.mapper.SdEngInfoBHMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.SdHydrobaseMapper;
|
||||
import com.yfd.platform.qgc_base.service.ISdHydrobaseService;
|
||||
import com.yfd.platform.system.service.IAdminAuthService;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -39,6 +40,9 @@ public class SdHydrobaseServiceImpl extends ServiceImpl<SdHydrobaseMapper, SdHyd
|
||||
@Resource
|
||||
private SdEngInfoBHMapper sdEngInfoBHMapper;
|
||||
|
||||
@Resource
|
||||
private IAdminAuthService adminAuthService;
|
||||
|
||||
@Override
|
||||
public Page<SdHydrobase> queryPageList(Page<SdHydrobase> page, String basename, String pbaseid) {
|
||||
return this.page(page, this.lambdaQuery()
|
||||
@ -91,7 +95,7 @@ public class SdHydrobaseServiceImpl extends ServiceImpl<SdHydrobaseMapper, SdHyd
|
||||
} else {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}else if (!"admin".equals(SecurityUtils.getCurrentUsername())){
|
||||
}else if (!adminAuthService.isCurrentManagedAdmin()){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
// else {
|
||||
|
||||
@ -11,6 +11,7 @@ import com.yfd.platform.qgc_base.mapper.SdRvcdDicMapper;
|
||||
import com.yfd.platform.qgc_base.service.ISdRvcdDicService;
|
||||
import com.yfd.platform.qgc_data.domain.SysUserDataScope;
|
||||
import com.yfd.platform.qgc_data.mapper.SysUserDataScopeMapper;
|
||||
import com.yfd.platform.system.service.IAdminAuthService;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -33,6 +34,9 @@ public class SdRvcdDicServiceImpl extends ServiceImpl<SdRvcdDicMapper, SdRvcdDic
|
||||
@Resource
|
||||
private SysUserDataScopeMapper sysUserDataScopeMapper;
|
||||
|
||||
@Resource
|
||||
private IAdminAuthService adminAuthService;
|
||||
|
||||
@Override
|
||||
public Page<SdRvcdDic> queryPageList(Page<SdRvcdDic> page, String rvnm, String prvcd) {
|
||||
return this.page(page, this.lambdaQuery()
|
||||
@ -120,7 +124,7 @@ public class SdRvcdDicServiceImpl extends ServiceImpl<SdRvcdDicMapper, SdRvcdDic
|
||||
@Override
|
||||
public List<SdRvcdDic> selectForDropdown(String rvnm, String rvcd) {
|
||||
List<SdRvcdDic> dropdownList = this.baseMapper.selectRegDropdown(rvnm, rvcd);
|
||||
if("admin".equals(SecurityUtils.getCurrentUsername())){
|
||||
if(adminAuthService.isCurrentManagedAdmin()){
|
||||
return dropdownList;
|
||||
}
|
||||
Set<String> authorizedStations = getUserAuthorizedStationCodes();
|
||||
|
||||
@ -1103,17 +1103,17 @@ public class FishImportServiceImpl implements IFishImportService {
|
||||
return null;
|
||||
}
|
||||
SdFishDictoryB exactMatch = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>()
|
||||
.select(SdFishDictoryB::getCode, SdFishDictoryB::getName)
|
||||
.select(SdFishDictoryB::getId, SdFishDictoryB::getName)
|
||||
.eq(SdFishDictoryB::getName, normalizedName)));
|
||||
if (exactMatch != null) {
|
||||
return exactMatch.getCode();
|
||||
return exactMatch.getId();
|
||||
}
|
||||
SdFishDictoryB fuzzyMatch = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>()
|
||||
.select(SdFishDictoryB::getCode, SdFishDictoryB::getName)
|
||||
.select(SdFishDictoryB::getId, SdFishDictoryB::getName)
|
||||
.and(wrapper -> wrapper.like(SdFishDictoryB::getName, normalizedName)
|
||||
.or()
|
||||
.like(SdFishDictoryB::getAlias, normalizedName))));
|
||||
return fuzzyMatch == null ? null : fuzzyMatch.getCode();
|
||||
return fuzzyMatch == null ? null : fuzzyMatch.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1125,11 +1125,11 @@ public class FishImportServiceImpl implements IFishImportService {
|
||||
}
|
||||
if (StringUtils.hasText(normalizedCode)) {
|
||||
SdFishDictoryB exact = findFirst(fishDictoryBMapper.selectList(new LambdaQueryWrapper<SdFishDictoryB>()
|
||||
.select(SdFishDictoryB::getCode, SdFishDictoryB::getName)
|
||||
.eq(SdFishDictoryB::getCode, normalizedCode)));
|
||||
.select(SdFishDictoryB::getId, SdFishDictoryB::getName)
|
||||
.eq(SdFishDictoryB::getId, normalizedCode)));
|
||||
// .eq(SdFishDictoryB::getName, normalizedName)));
|
||||
if (exact != null) {
|
||||
return exact.getCode();
|
||||
return exact.getId();
|
||||
}
|
||||
}
|
||||
// if (StringUtils.hasText(normalizedCode)) {
|
||||
|
||||
@ -16,11 +16,14 @@ import com.yfd.platform.qgc_eng.eq.entity.vo.EngEqVmsstbprptVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.EngEqRateCountVo;
|
||||
import com.yfd.platform.qgc_eng.eq.service.EngEqDataService;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.QgcQecStaticVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.StcdInfoVo;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -162,4 +165,20 @@ public class EngEqDataController {
|
||||
public ResponseResult getQecRateCount(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(engEqDataService.qecRateCount(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/operat/default/year")
|
||||
@Operation(summary = "环保设施点击描点默认展示有数据的年份,不包含过鱼设施描点")
|
||||
public ResponseResult getDefaultYear(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(engEqDataService.getDefaultYear(dataSourceRequest));
|
||||
}
|
||||
|
||||
@GetMapping("/eq/base/msstbprpt/getStInfoByStcd")
|
||||
@Operation(summary = "根据stcd编码获取所有关联站点的信息")
|
||||
public ResponseResult getStInfoByStcd(String stcd) {
|
||||
if (StrUtil.isBlank(stcd)) {
|
||||
return ResponseResult.error("站点编码(stcd)不能为空");
|
||||
}
|
||||
StcdInfoVo result = engEqDataService.getStInfoByStcd(stcd);
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,31 @@
|
||||
package com.yfd.platform.qgc_eng.eq.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class StBaseInfo {
|
||||
|
||||
private String stcd;
|
||||
|
||||
private String stnm;
|
||||
|
||||
private String sttpCode;
|
||||
|
||||
private String sttpName;
|
||||
|
||||
private String sttpFullPath;
|
||||
|
||||
private Integer sttpTreeLevel;
|
||||
|
||||
private String baseId;
|
||||
|
||||
private String baseName;
|
||||
|
||||
private String hbrvcd;
|
||||
|
||||
private String hbrvcdName;
|
||||
|
||||
private String rvcd;
|
||||
|
||||
private String rvcdName;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.platform.qgc_eng.eq.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class StcdInfoVo {
|
||||
|
||||
private StBaseInfo stBaseInfo;
|
||||
|
||||
private List<StBaseInfo> relList;
|
||||
}
|
||||
@ -18,6 +18,8 @@ import com.yfd.platform.qgc_eng.eq.entity.vo.EngEqRateCountVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.EngEqVmsstbprptVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.QgcQecStaticVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.SdEqMonitorCountVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.StBaseInfo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.StcdInfoVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.WbsbVo;
|
||||
|
||||
import java.util.List;
|
||||
@ -59,4 +61,8 @@ public interface EngEqDataService {
|
||||
DataSourceResult<SdEqMonitorCountVo> getEvnmAutoMonitorList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<EngEqRateCountVo> qecRateCount(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<String> getDefaultYear(DataSourceRequest dataSourceRequest);
|
||||
|
||||
StcdInfoVo getStInfoByStcd(String stcd);
|
||||
}
|
||||
|
||||
@ -33,6 +33,8 @@ import com.yfd.platform.qgc_eng.eq.entity.vo.QgcQecStaticVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.QgcQecVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.SdEqMonitorCountVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.WbsbVo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.StBaseInfo;
|
||||
import com.yfd.platform.qgc_eng.eq.entity.vo.StcdInfoVo;
|
||||
import com.yfd.platform.qgc_eng.eq.service.EngEqDataService;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -1131,6 +1133,44 @@ public class EngEqDataServiceImpl implements EngEqDataService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public StcdInfoVo getStInfoByStcd(String stcd) {
|
||||
if (StrUtil.isBlank(stcd)) {
|
||||
throw new IllegalArgumentException("站点编码(stcd)不能为空");
|
||||
}
|
||||
StcdInfoVo vo = new StcdInfoVo();
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("stcd", stcd);
|
||||
|
||||
StBaseInfo stBaseInfo = (StBaseInfo)microservicDynamicSQLMapper.getOneBySqlWithResultType(
|
||||
"SELECT STCD AS stcd, STNM AS stnm, STTP_CODE AS sttpCode, STTP_NAME AS sttpName, " +
|
||||
"STTP_FULL_PATH AS sttpFullPath, STTP_TREE_LEVEL AS sttpTreeLevel, " +
|
||||
"BASE_ID AS baseId, BASE_NAME AS baseName, HBRVCD AS hbrvcd, " +
|
||||
"HBRVCD_NAME AS hbrvcdName, RVCD AS rvcd, RVCD_NAME AS rvcdName " +
|
||||
"FROM V_MS_STBPRP_T " +
|
||||
"WHERE STCD = #{map.stcd} AND NVL(IS_DELETED, 0) = 0",
|
||||
paramMap,
|
||||
StBaseInfo.class
|
||||
);
|
||||
vo.setStBaseInfo(stBaseInfo);
|
||||
|
||||
List<StBaseInfo> relList = microservicDynamicSQLMapper.getAllListWithResultType(
|
||||
"SELECT STCD AS stcd, STNM AS stnm, STTP_CODE AS sttpCode, STTP_NAME AS sttpName, " +
|
||||
"STTP_FULL_PATH AS sttpFullPath, STTP_TREE_LEVEL AS sttpTreeLevel, " +
|
||||
"BASE_ID AS baseId, BASE_NAME AS baseName, HBRVCD AS hbrvcd, " +
|
||||
"HBRVCD_NAME AS hbrvcdName, RVCD AS rvcd, RVCD_NAME AS rvcdName " +
|
||||
"FROM V_MS_STBPRP_T " +
|
||||
"WHERE NVL(IS_DELETED, 0) = 0 " +
|
||||
"AND STCD != #{map.stcd} " +
|
||||
"AND STTP_FULL_PATH LIKE CONCAT(CONCAT('%', #{map.stcd}), '%')",
|
||||
paramMap,
|
||||
StBaseInfo.class
|
||||
);
|
||||
vo.setRelList(relList);
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<EngEqRateCountVo> qecRateCount(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
@ -3327,6 +3367,7 @@ public class EngEqDataServiceImpl implements EngEqDataService {
|
||||
"'ENG' AS sttpCode, " +
|
||||
"'电站' AS sttpName, " +
|
||||
"eng.STCD AS stcd, " +
|
||||
"pbh.TTPWR AS ttpwr, " +
|
||||
"eng.ENNM AS stnm, " +
|
||||
"eng.ENNM AS ennm, " +
|
||||
"eng.BASE_ID AS baseId, " +
|
||||
@ -3346,6 +3387,7 @@ public class EngEqDataServiceImpl implements EngEqDataService {
|
||||
"NVL(eng.ORDER_INDEX, 999999) AS rstcdStepSort, " +
|
||||
"NVL(eng.ORDER_INDEX, 999999) AS siteStepSort " +
|
||||
"FROM SD_ENGINFO_B_H eng " +
|
||||
"INNER JOIN SD_PWR_B_H pbh ON pbh.STCD= eng.STCD " +
|
||||
"LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 " +
|
||||
"LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.HBRVCD = eng.HBRVCD AND hbrv.BASEID = eng.BASE_ID " +
|
||||
" AND NVL(hbrv.IS_DELETED, 0) = 0 AND NVL(hbrv.ENABLED, 1) = 1 " +
|
||||
@ -5440,6 +5482,7 @@ public class EngEqDataServiceImpl implements EngEqDataService {
|
||||
case "sttpCode" -> "t.sttpCode";
|
||||
case "sttpName" -> "t.sttpName";
|
||||
case "stcd" -> "t.stcd";
|
||||
case "ttpwr" -> "t.ttpwr";
|
||||
case "stnm" -> "t.stnm";
|
||||
case "ennm" -> "t.ennm";
|
||||
case "baseId" -> "t.baseId";
|
||||
@ -5746,7 +5789,8 @@ public class EngEqDataServiceImpl implements EngEqDataService {
|
||||
}
|
||||
return switch (field) {
|
||||
case "id" -> "t.id";
|
||||
case "stcd" -> "t.stcd";
|
||||
case "rstcd" -> "t.stcd";
|
||||
// case "rstcd" -> "t.rstcd";
|
||||
case "stnm", "ennm" -> "t.ennm";
|
||||
case "baseId" -> "t.baseId";
|
||||
case "baseName" -> "t.baseName";
|
||||
@ -5801,4 +5845,48 @@ public class EngEqDataServiceImpl implements EngEqDataService {
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<String> getDefaultYear(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<String> dataSourceResult = new DataSourceResult<>();
|
||||
List<String> resultList = new ArrayList<>();
|
||||
dataSourceResult.setData(resultList);
|
||||
dataSourceResult.setTotal(resultList.size());
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
String stcd = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd");
|
||||
String sttpCode = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "sttpCode");
|
||||
if (StrUtil.isBlank(stcd) || StrUtil.isBlank(sttpCode)) {
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("stcd", stcd);
|
||||
|
||||
String sql = switch (sttpCode) {
|
||||
case "DW" -> "SELECT MAX(TM) AS TM FROM SD_DW_R WHERE STCD = #{map.stcd} AND NVL(IS_DELETED, 0) = 0";
|
||||
case "EQ" -> "SELECT MAX(TM) AS TM FROM SD_EQ_R WHERE STCD = #{map.stcd} AND NVL(IS_DELETED, 0) = 0";
|
||||
case "FB" -> "SELECT MAX(TM) AS TM FROM SD_ENGFR_R WHERE STCD = #{map.stcd} AND NVL(IS_DELETED, 0) = 0";
|
||||
case "VA" -> "SELECT MAX(TM) AS TM FROM SD_VA_R WHERE STCD = #{map.stcd} AND NVL(IS_DELETED, 0) = 0";
|
||||
case "VP" -> "SELECT MAX(TM) AS TM FROM SD_VP_R WHERE STCD = #{map.stcd} AND NVL(IS_DELETED, 0) = 0";
|
||||
default -> "";
|
||||
};
|
||||
|
||||
if (StrUtil.isBlank(sql)) {
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
List<Map<String, Object>> allList = microservicDynamicSQLMapper.getAllList(sql, paramMap);
|
||||
if (CollUtil.isEmpty(allList)) {
|
||||
return dataSourceResult;
|
||||
}
|
||||
Map<String, Object> map = allList.get(0);
|
||||
if (map == null) {
|
||||
return dataSourceResult;
|
||||
}
|
||||
Object tm = map.getOrDefault("TM", "");
|
||||
if (tm != null && StrUtil.isNotBlank(tm.toString())) {
|
||||
resultList.add(tm.toString());
|
||||
}
|
||||
return dataSourceResult;
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,4 +132,18 @@ public class FbStationController {
|
||||
public ResponseResult getResearchKendoList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(fbStationService.getResearchKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/fishhatchrecr/fish/GetKendoListCust")
|
||||
@Operation(summary = "(全过程)增殖站二级页面: 过程图-产卵和孵化")
|
||||
public ResponseResult getFishhatchrecrFishKendoListCust(
|
||||
@Parameter(description = "类型:1-鱼卵数量,2-出苗数量") @RequestParam("type") Integer type,
|
||||
@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(fbStationService.getFishhatchrecrFishKendoListCust(type, dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/fishbreedr/fish/GetKendoListCust")
|
||||
@Operation(summary = "(全过程)增殖站二级页面: 过程图-鱼苗")
|
||||
public ResponseResult getFishbreedrFishKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(fbStationService.getFishbreedrFishKendoListCust(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.yfd.platform.qgc_env.fb.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FishbreedRVo {
|
||||
|
||||
private String tm;
|
||||
|
||||
private String ftp;
|
||||
|
||||
private String ftpName;
|
||||
|
||||
private String counts;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.yfd.platform.qgc_env.fb.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FishhatchrecRVo {
|
||||
|
||||
private String tm;
|
||||
|
||||
private String ftp;
|
||||
|
||||
private String ftpName;
|
||||
|
||||
private String eggcount;
|
||||
|
||||
private String outcount;
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.yfd.platform.qgc_env.fb.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class HeadColunmsVo {
|
||||
|
||||
private String dataIndex;
|
||||
|
||||
private String title;
|
||||
|
||||
private Boolean visible = true;
|
||||
|
||||
private String key;
|
||||
|
||||
private String unit;
|
||||
|
||||
private boolean merge;
|
||||
|
||||
private String dataType;
|
||||
|
||||
private String dataFormat;
|
||||
|
||||
private List<HeadColunmsVo> children;
|
||||
|
||||
public HeadColunmsVo(String title, String dataIndex) {
|
||||
this.title = title;
|
||||
this.dataIndex = dataIndex;
|
||||
}
|
||||
|
||||
public HeadColunmsVo(String dataIndex, String title, Boolean visible, String key, boolean merge, List<HeadColunmsVo> children) {
|
||||
this.dataIndex = dataIndex;
|
||||
this.title = title;
|
||||
this.visible = visible;
|
||||
this.key = key;
|
||||
this.merge = merge;
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public HeadColunmsVo setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
return this;
|
||||
}
|
||||
|
||||
public HeadColunmsVo setDataFormat(String dataFormat) {
|
||||
this.dataFormat = dataFormat;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.yfd.platform.qgc_env.fb.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TableVo<T> {
|
||||
|
||||
private List<HeadColunmsVo> columns;
|
||||
|
||||
private Object dataSource;
|
||||
|
||||
private Long total;
|
||||
|
||||
private Integer wtDeviceType;
|
||||
|
||||
public TableVo() {
|
||||
}
|
||||
|
||||
public TableVo(List<T> dataSource, Long total) {
|
||||
this.dataSource = dataSource;
|
||||
if (total != null) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -16,6 +16,7 @@ import com.yfd.platform.qgc_env.fb.entity.vo.FbStInfoResultVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbStationStaticsDataVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.YearRpStatisticsVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbStationOverviewSecondVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.TableVo;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -57,4 +58,8 @@ public interface FbStationService {
|
||||
DataSourceResult<FbStationOverviewSecondVo> getOverviewSecond(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FbStationOverviewSecondVo> getQgcOverviewSecond(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<TableVo> getFishhatchrecrFishKendoListCust(Integer type, DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<TableVo> getFishbreedrFishKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -30,6 +30,10 @@ import com.yfd.platform.qgc_env.fb.entity.vo.FbStInfoResultVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbStationOverviewSecondVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbStationStaticsDataVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbStationStaticsRawVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FishbreedRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FishhatchrecRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.HeadColunmsVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.TableVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.YearRpStatisticsVo;
|
||||
import com.yfd.platform.qgc_env.fb.service.FbStationService;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
@ -4103,4 +4107,469 @@ public class FbStationServiceImpl implements FbStationService {
|
||||
}
|
||||
values.add(text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<TableVo> getFishhatchrecrFishKendoListCust(Integer type, DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<TableVo> dataSourceResult = new DataSourceResult<>();
|
||||
String unit = type == 1 ? "(万粒)" : "(万尾)";
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT tm, ")
|
||||
.append("LISTAGG(TO_CHAR(ftp), ',') WITHIN GROUP (ORDER BY ftp) AS ftp, ")
|
||||
.append("LISTAGG(TO_CHAR(NAME), ',') WITHIN GROUP (ORDER BY ftp) AS ftpName, ")
|
||||
.append("LISTAGG(eggcount, ',') WITHIN GROUP (ORDER BY ftp) AS eggcount, ")
|
||||
.append("LISTAGG(outcount, ',') WITHIN GROUP (ORDER BY ftp) AS outcount ")
|
||||
.append("FROM (")
|
||||
.append("SELECT ")
|
||||
.append("TO_CHAR(tm, 'YYYY-MM') AS tm, ftp, ")
|
||||
.append("CASE WHEN NAME IS NULL THEN TO_NCHAR(ftp) ELSE NAME END AS NAME, ")
|
||||
.append("CASE WHEN SUM(eggcount) IS NULL THEN '-' ELSE RTRIM(TO_CHAR(SUM(eggcount), 'FM999999999999990.99'), '.') END AS eggcount, ")
|
||||
.append("CASE WHEN SUM(outcount) IS NULL THEN '-' ELSE RTRIM(TO_CHAR(SUM(outcount), 'FM999999999999990.99'), '.') END AS outcount ")
|
||||
.append("FROM (")
|
||||
.append("SELECT ")
|
||||
.append("t.tm, ")
|
||||
.append("CASE WHEN fishViewZy.ZY_FISH_ID IS NULL THEN t.ftp ELSE fishViewZy.ZY_FISH_ID END AS ftp, ")
|
||||
.append("CASE WHEN fishViewZy.NAME IS NULL THEN fishViewRv.NAME ELSE fishViewZy.NAME END AS NAME, ")
|
||||
.append("t.eggcount, ")
|
||||
.append("t.outcount ")
|
||||
.append("FROM SD_FBFISHHATCHREC_R t ")
|
||||
.append("LEFT JOIN SD_FBRD_B_H fb ON t.stcd = fb.STCD ")
|
||||
.append("LEFT JOIN V_SD_FISHDICTORY_B fishViewRv ON t.FTP = fishViewRv.FISH_ID AND fb.HBRVCD = fishViewRv.RVCD ")
|
||||
.append("LEFT JOIN V_SD_FISHDICTORY_B fishViewZy ON t.FTP = fishViewZy.FISH_ID AND fishViewZy.RVCD = 'ZY' ")
|
||||
.append("WHERE NVL(t.IS_DELETED, 0) = 0 ");
|
||||
|
||||
appendFishhatchrecrFishFilterConditions(sql, dataSourceRequest, paramMap);
|
||||
|
||||
sql.append(") GROUP BY TO_CHAR(tm, 'YYYY-MM'), ftp, NAME ")
|
||||
.append(") GROUP BY tm ")
|
||||
.append("ORDER BY tm DESC ");
|
||||
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<FishhatchrecRVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page, sql.toString(), paramMap, FishhatchrecRVo.class
|
||||
);
|
||||
|
||||
long total = page != null ? page.getTotal() : list.size();
|
||||
TableVo tableVo = buildFishhatchrecrFishTableVo(list, total, type, unit);
|
||||
dataSourceResult.setData(Collections.singletonList(tableVo));
|
||||
dataSourceResult.setTotal(total);
|
||||
dataSourceResult.setAggregates(new HashMap<>());
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
private void appendFishhatchrecrFishFilterConditions(StringBuilder sql,
|
||||
DataSourceRequest dataSourceRequest,
|
||||
Map<String, Object> paramMap) {
|
||||
if (dataSourceRequest == null || dataSourceRequest.getFilter() == null) {
|
||||
return;
|
||||
}
|
||||
String filterSql = buildFishhatchrecrFishFilterCondition(dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
private String buildFishhatchrecrFishFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(filter.getField())) {
|
||||
return buildFishhatchrecrFishLeafCondition(filter, paramMap, indexHolder);
|
||||
}
|
||||
if (CollUtil.isEmpty(filter.getFilters())) {
|
||||
return "";
|
||||
}
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildFishhatchrecrFishFilterCondition(child, paramMap, indexHolder);
|
||||
if (StrUtil.isNotBlank(childSql)) {
|
||||
conditions.add("(" + childSql + ")");
|
||||
}
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
|
||||
return String.join(logic, conditions);
|
||||
}
|
||||
|
||||
private String buildFishhatchrecrFishLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
String field = filter.getField();
|
||||
String column = mapFishhatchrecrFishColumn(field);
|
||||
if (StrUtil.isBlank(column)) {
|
||||
return "";
|
||||
}
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
Object value = filter.getValue();
|
||||
if ("isnull".equals(operator)) {
|
||||
return column + " IS NULL";
|
||||
}
|
||||
if ("isnotnull".equals(operator)) {
|
||||
return column + " IS NOT NULL";
|
||||
}
|
||||
if ("in".equals(operator)) {
|
||||
List<Object> values = normalizeQgcBsmfRValues(value);
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String key = "hatchFishP" + indexHolder[0]++;
|
||||
paramMap.put(key, item);
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
return column + " IN (" + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String key = "hatchFishP" + indexHolder[0]++;
|
||||
Object normalizedValue = normalizeFishhatchrecrFishValue(field, value);
|
||||
return switch (operator) {
|
||||
case "eq" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " = #{map." + key + "}";
|
||||
}
|
||||
case "neq" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " <> #{map." + key + "}";
|
||||
}
|
||||
case "contains" -> {
|
||||
paramMap.put(key, "%" + normalizedValue + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "startswith" -> {
|
||||
paramMap.put(key, normalizedValue + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "endswith" -> {
|
||||
paramMap.put(key, "%" + normalizedValue);
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "gt" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " > #{map." + key + "}";
|
||||
}
|
||||
case "gte" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " >= #{map." + key + "}";
|
||||
}
|
||||
case "lt" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " < #{map." + key + "}";
|
||||
}
|
||||
case "lte" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " <= #{map." + key + "}";
|
||||
}
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private String mapFishhatchrecrFishColumn(String field) {
|
||||
return switch (field) {
|
||||
case "stcd" -> "t.STCD";
|
||||
case "ftp" -> "t.FTP";
|
||||
case "fishsrc" -> "t.FISHSRC";
|
||||
case "tm" -> "t.TM";
|
||||
case "rstcd" -> "fb.RSTCD";
|
||||
case "baseId" -> "fb.BASE_ID";
|
||||
case "hbrvcd" -> "fb.HBRVCD";
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private Object normalizeFishhatchrecrFishValue(String field, Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if ("tm".equalsIgnoreCase(field) && value instanceof String text) {
|
||||
return parseDateTimeSafely(text);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private TableVo buildFishhatchrecrFishTableVo(List<FishhatchrecRVo> list, long total, Integer type, String unit) {
|
||||
TableVo tableVo = new TableVo();
|
||||
List<Map<String, Object>> resultData = new ArrayList<>();
|
||||
List<HeadColunmsVo> columns = new ArrayList<>();
|
||||
Map<String, String> fishMap = new LinkedHashMap<>();
|
||||
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
for (FishhatchrecRVo vo : list) {
|
||||
Map<String, Object> rowMap = new LinkedHashMap<>();
|
||||
rowMap.put("tm", vo.getTm());
|
||||
|
||||
List<String> ftpList = splitCsv(vo.getFtp());
|
||||
List<String> ftpNameList = splitCsv(vo.getFtpName());
|
||||
List<String> eggCountList = splitCsv(vo.getEggcount());
|
||||
List<String> outCountList = splitCsv(vo.getOutcount());
|
||||
|
||||
int size = Math.min(ftpList.size(), Math.min(ftpNameList.size(),
|
||||
Math.min(eggCountList.size(), outCountList.size())));
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
String ftp = ftpList.get(i);
|
||||
String ftpName = ftpNameList.get(i);
|
||||
String value = type == 1 ? eggCountList.get(i) : outCountList.get(i);
|
||||
rowMap.put(ftp, "-".equals(value) ? null : value);
|
||||
fishMap.putIfAbsent(ftp, ftpName);
|
||||
}
|
||||
resultData.add(rowMap);
|
||||
}
|
||||
}
|
||||
|
||||
columns.add(new HeadColunmsVo("tm", "时间", true, "tm", false, new ArrayList<>())
|
||||
.setDataType("date")
|
||||
.setDataFormat("yyyy-MM"));
|
||||
for (Map.Entry<String, String> entry : fishMap.entrySet()) {
|
||||
columns.add(new HeadColunmsVo(entry.getKey(), entry.getValue() + unit, true, entry.getKey(), false, new ArrayList<>()));
|
||||
}
|
||||
|
||||
tableVo.setColumns(columns);
|
||||
tableVo.setDataSource(resultData);
|
||||
tableVo.setTotal(total);
|
||||
return tableVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<TableVo> getFishbreedrFishKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<TableVo> dataSourceResult = new DataSourceResult<>();
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT tm,\n")
|
||||
.append("LISTAGG(TO_CHAR(ftp), ',') WITHIN GROUP (ORDER BY ftp) AS ftp,\n")
|
||||
.append("LISTAGG(TO_CHAR(NAME), ',') WITHIN GROUP (ORDER BY ftp) AS ftpName,\n")
|
||||
.append("LISTAGG(counts, ',') WITHIN GROUP (ORDER BY ftp) AS counts\n")
|
||||
.append("FROM (\n")
|
||||
.append("SELECT \n")
|
||||
.append("to_CHAR(tm,'YYYY-MM') AS tm, ftp, CASE WHEN NAME IS NULL THEN TO_NCHAR(ftp) ELSE NAME END AS NAME, CASE WHEN SUM(counts) IS NULL THEN '-' ELSE TO_CHAR(SUM(counts)) END AS counts\n")
|
||||
.append("FROM (\n")
|
||||
.append("SELECT\n")
|
||||
.append("\tt.tm,\n")
|
||||
.append("\tCASE WHEN f.ZY_FISH_ID IS NULL THEN t.ftp ELSE f.ZY_FISH_ID END AS ftp,\n")
|
||||
.append("\tCASE WHEN f.NAME IS NULL THEN TO_NCHAR(t.ftp) ELSE f.NAME END AS NAME,\n")
|
||||
.append("\tt.counts\n")
|
||||
.append("FROM\n")
|
||||
.append("\t(\n")
|
||||
.append("\tSELECT\n")
|
||||
.append("\t\tstcd,\n")
|
||||
.append("\t\tftp AS ftp,\n")
|
||||
.append("\t\tcounts AS counts,\n")
|
||||
.append("\t\ttm AS tm\n")
|
||||
.append("\tFROM\n")
|
||||
.append("\t\tSD_FBFISHBREED_R\n")
|
||||
.append("\tWHERE\n")
|
||||
.append("\t\tNVL(is_deleted, 0) = 0 ");
|
||||
|
||||
appendFishbreedrFishFilterConditions(sql, dataSourceRequest, paramMap);
|
||||
|
||||
sql.append(") t\n")
|
||||
.append("LEFT JOIN SD_FBRD_B_H s ON\n")
|
||||
.append("\tt.stcd = s.STCD\n")
|
||||
.append("LEFT JOIN V_SD_FISHDICTORY_B f ON\n")
|
||||
.append("\tt.FTP = f.FISH_ID\n")
|
||||
.append("\tAND (s.HBRVCD = f.RVCD\n")
|
||||
.append("\t\tOR f.RVCD = 'ZY')\n")
|
||||
.append(") GROUP BY to_CHAR(tm,'YYYY-MM'), ftp, NAME\n")
|
||||
.append(") GROUP BY tm\n")
|
||||
.append("ORDER BY TM DESC");
|
||||
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<FishbreedRVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page, sql.toString(), paramMap, FishbreedRVo.class
|
||||
);
|
||||
|
||||
long total = page != null ? page.getTotal() : list.size();
|
||||
TableVo tableVo = buildFishbreedrFishTableVo(list, total);
|
||||
dataSourceResult.setData(Collections.singletonList(tableVo));
|
||||
dataSourceResult.setTotal(total);
|
||||
dataSourceResult.setAggregates(new HashMap<>());
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
private void appendFishbreedrFishFilterConditions(StringBuilder sql,
|
||||
DataSourceRequest dataSourceRequest,
|
||||
Map<String, Object> paramMap) {
|
||||
if (dataSourceRequest == null || dataSourceRequest.getFilter() == null) {
|
||||
return;
|
||||
}
|
||||
String filterSql = buildFishbreedrFishFilterCondition(dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql).append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
private String buildFishbreedrFishFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) {
|
||||
return "";
|
||||
}
|
||||
if (StrUtil.isNotBlank(filter.getField())) {
|
||||
return buildFishbreedrFishLeafCondition(filter, paramMap, indexHolder);
|
||||
}
|
||||
if (CollUtil.isEmpty(filter.getFilters())) {
|
||||
return "";
|
||||
}
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildFishbreedrFishFilterCondition(child, paramMap, indexHolder);
|
||||
if (StrUtil.isNotBlank(childSql)) {
|
||||
conditions.add("(" + childSql + ")");
|
||||
}
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
String logic = "or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ";
|
||||
return String.join(logic, conditions);
|
||||
}
|
||||
|
||||
private String buildFishbreedrFishLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
String field = filter.getField();
|
||||
String column = mapFishbreedrFishColumn(field);
|
||||
if (StrUtil.isBlank(column)) {
|
||||
return "";
|
||||
}
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
Object value = filter.getValue();
|
||||
if ("isnull".equals(operator)) {
|
||||
return column + " IS NULL";
|
||||
}
|
||||
if ("isnotnull".equals(operator)) {
|
||||
return column + " IS NOT NULL";
|
||||
}
|
||||
if ("in".equals(operator)) {
|
||||
List<Object> values = normalizeQgcBsmfRValues(value);
|
||||
if (values.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String key = "breedFishP" + indexHolder[0]++;
|
||||
paramMap.put(key, item);
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
return column + " IN (" + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) {
|
||||
return "";
|
||||
}
|
||||
String key = "breedFishP" + indexHolder[0]++;
|
||||
Object normalizedValue = normalizeFishbreedrFishValue(field, value);
|
||||
return switch (operator) {
|
||||
case "eq" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " = #{map." + key + "}";
|
||||
}
|
||||
case "neq" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " <> #{map." + key + "}";
|
||||
}
|
||||
case "contains" -> {
|
||||
paramMap.put(key, "%" + normalizedValue + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "startswith" -> {
|
||||
paramMap.put(key, normalizedValue + "%");
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "endswith" -> {
|
||||
paramMap.put(key, "%" + normalizedValue);
|
||||
yield column + " LIKE #{map." + key + "}";
|
||||
}
|
||||
case "gt" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " > #{map." + key + "}";
|
||||
}
|
||||
case "gte" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " >= #{map." + key + "}";
|
||||
}
|
||||
case "lt" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " < #{map." + key + "}";
|
||||
}
|
||||
case "lte" -> {
|
||||
paramMap.put(key, normalizedValue);
|
||||
yield column + " <= #{map." + key + "}";
|
||||
}
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private String mapFishbreedrFishColumn(String field) {
|
||||
return switch (field) {
|
||||
case "stcd" -> "STCD";
|
||||
case "ftp" -> "t.FTP";
|
||||
case "counts" -> "t.COUNTS";
|
||||
case "tm" -> "TM";
|
||||
case "rstcd" -> "s.RSTCD";
|
||||
case "baseId" -> "s.BASE_ID";
|
||||
case "hbrvcd" -> "s.HBRVCD";
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private Object normalizeFishbreedrFishValue(String field, Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if ("tm".equalsIgnoreCase(field) && value instanceof String text) {
|
||||
return parseDateTimeSafely(text);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
private TableVo buildFishbreedrFishTableVo(List<FishbreedRVo> list, long total) {
|
||||
TableVo tableVo = new TableVo();
|
||||
List<Map<String, Object>> resultData = new ArrayList<>();
|
||||
List<HeadColunmsVo> columns = new ArrayList<>();
|
||||
Map<String, String> fishMap = new LinkedHashMap<>();
|
||||
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
for (FishbreedRVo vo : list) {
|
||||
Map<String, Object> rowMap = new LinkedHashMap<>();
|
||||
rowMap.put("tm", vo.getTm());
|
||||
|
||||
List<String> ftpList = splitCsv(vo.getFtp());
|
||||
List<String> ftpNameList = splitCsv(vo.getFtpName());
|
||||
List<String> countsList = splitCsv(vo.getCounts());
|
||||
|
||||
int size = Math.min(ftpList.size(), Math.min(ftpNameList.size(), countsList.size()));
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
String ftp = ftpList.get(i);
|
||||
String ftpName = ftpNameList.get(i);
|
||||
String countStr = countsList.get(i);
|
||||
rowMap.put(ftp, "-".equals(countStr) ? null : countStr);
|
||||
fishMap.putIfAbsent(ftp, ftpName);
|
||||
}
|
||||
resultData.add(rowMap);
|
||||
}
|
||||
}
|
||||
|
||||
columns.add(new HeadColunmsVo("tm", "时间", true, "tm", false, new ArrayList<>())
|
||||
.setDataType("date")
|
||||
.setDataFormat("yyyy-MM"));
|
||||
for (Map.Entry<String, String> entry : fishMap.entrySet()) {
|
||||
columns.add(new HeadColunmsVo(entry.getKey(), entry.getValue() + "(尾)", true, entry.getKey(), false, new ArrayList<>()));
|
||||
}
|
||||
|
||||
tableVo.setColumns(columns);
|
||||
tableVo.setDataSource(resultData);
|
||||
tableVo.setTotal(total);
|
||||
return tableVo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
package com.yfd.platform.qgc_env.overview.controller;
|
||||
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_env.overview.service.OverviewService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/overview")
|
||||
@Tag(name = "首页概览")
|
||||
@Validated
|
||||
public class OverviewController {
|
||||
|
||||
@Resource
|
||||
private OverviewService overviewService;
|
||||
|
||||
@PostMapping("/msstbprpt/GetKendoList")
|
||||
@Operation(summary = "首页基础设施概览列表")
|
||||
public ResponseResult getMsstbprptList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(overviewService.getMsstbprptList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/oped/GetKendoListCust")
|
||||
@Operation(summary = "首页环保设施运行状况明细")
|
||||
public ResponseResult getOpedList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(overviewService.getOpedList(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package com.yfd.platform.qgc_env.overview.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "首页基础设施概览列表")
|
||||
public class OverviewMsstbprptVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
private String stcd;
|
||||
private String stnm;
|
||||
private String sttp;
|
||||
private String sttpCode;
|
||||
private String sttpName;
|
||||
private String sttpFullPath;
|
||||
private Integer sttpTreeLevel;
|
||||
private String blprdId;
|
||||
private Double lgtd;
|
||||
private Double lttd;
|
||||
private Double dtmel;
|
||||
private String stlc;
|
||||
private Integer usfl;
|
||||
private String rstcd;
|
||||
private String ennm;
|
||||
private String baseId;
|
||||
private String baseName;
|
||||
private String hbrvcd;
|
||||
private String hbrvcdName;
|
||||
private String rvcd;
|
||||
private String rvcdName;
|
||||
private String addvcd;
|
||||
private String addvcdName;
|
||||
private String country;
|
||||
private String countryName;
|
||||
private String stCode;
|
||||
private String stName;
|
||||
private Date stdsdt;
|
||||
private Date pststdt;
|
||||
private Date pesstdt;
|
||||
private Date ststdt;
|
||||
private Date jcdt;
|
||||
private Date stwddt;
|
||||
private String introduce;
|
||||
private String precis;
|
||||
private String logo;
|
||||
private String inffile;
|
||||
private Integer dtin;
|
||||
private String dtinName;
|
||||
private Date dtinTm;
|
||||
private Integer bldsttCode;
|
||||
private String bldsttCcode;
|
||||
private String bldsttCcodeName;
|
||||
private Double inv;
|
||||
private Integer invinmn;
|
||||
private String dsun;
|
||||
private String jbtxcs;
|
||||
private Integer dtfrqcy;
|
||||
private String remark;
|
||||
private String vlsr;
|
||||
private Date vlsrTm;
|
||||
private Integer orderIndex;
|
||||
private Integer baseStepSort;
|
||||
private Integer rvcdStepSort;
|
||||
private Integer rstcdStepSort;
|
||||
private Integer siteStepSort;
|
||||
}
|
||||
@ -0,0 +1,65 @@
|
||||
package com.yfd.platform.qgc_env.overview.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Schema(description = "首页环保设施运行状况明细")
|
||||
public class OverviewOpedVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private Map<String, Object> _tls = new HashMap<>();
|
||||
|
||||
private String id;
|
||||
private String recordUser;
|
||||
private Date recordTime;
|
||||
private Date modifyTime;
|
||||
private String displayRecordUser;
|
||||
private String repCode;
|
||||
private String pcode;
|
||||
private String pname;
|
||||
private String psttpName;
|
||||
private String sttpName;
|
||||
private String baseId;
|
||||
private String stcd;
|
||||
private String stnm;
|
||||
private String sttpCode;
|
||||
private String baseName;
|
||||
private String rstcd;
|
||||
private String ennm;
|
||||
private String bldsttCcode;
|
||||
private String bldsttCcodeName;
|
||||
private Date dtinTm;
|
||||
private Integer dtin;
|
||||
private String dtinName;
|
||||
private Integer runState;
|
||||
private String runStateName;
|
||||
private Integer stdState;
|
||||
private String stdStateName;
|
||||
private Integer stdSstate;
|
||||
private String stdSstateName;
|
||||
private Integer runSstate;
|
||||
private String runSstateName;
|
||||
private Integer mway;
|
||||
private String mwayName;
|
||||
private String hbrvcd;
|
||||
private String hbrvcdName;
|
||||
private String addvcdName;
|
||||
private String rvcdName;
|
||||
private Integer baseStepSort;
|
||||
private Integer baseStepsort;
|
||||
private Integer rvcdStepSort;
|
||||
private Integer rstcdStepSort;
|
||||
private Integer rstcdStepsort;
|
||||
private Integer siteStepSort;
|
||||
private Integer count;
|
||||
private Date jcdt;
|
||||
private String departmentId;
|
||||
private String displayDepartment;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.platform.qgc_env.overview.service;
|
||||
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewMsstbprptVo;
|
||||
import com.yfd.platform.qgc_env.overview.entity.vo.OverviewOpedVo;
|
||||
|
||||
public interface OverviewService {
|
||||
|
||||
DataSourceResult<OverviewMsstbprptVo> getMsstbprptList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<OverviewOpedVo> getOpedList(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -64,4 +64,16 @@ public class VapConstructionController {
|
||||
public ResponseResult getVarKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(vpConstructionService.processVarKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/var/year/GetKendoListCust")
|
||||
@Operation(summary = "动物救助站数据年份列表")
|
||||
public ResponseResult getVarYearKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(vpConstructionService.getVarYearList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/vpr/year/GetKendoListCust")
|
||||
@Operation(summary = "珍稀植物园数据年份列表")
|
||||
public ResponseResult getVprYearKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(vpConstructionService.getVprYearList(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,4 +23,8 @@ public interface VpConstructionService {
|
||||
DataSourceResult<VpVacVo> processVacKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<VpVarVo> processVarKendoList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult getVarYearList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult getVprYearList(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -1814,4 +1814,98 @@ public class VpConstructionServiceImpl implements VpConstructionService {
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult getVarYearList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult dataSourceResult = new DataSourceResult<>();
|
||||
DataSourceLoadOptionsBase loadOptionsBase = dataSourceRequest.toDevRequest();
|
||||
String baseId = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "baseId");
|
||||
String stcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "stcd");
|
||||
String rstcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "rstcd");
|
||||
|
||||
StringBuilder sql = new StringBuilder("SELECT TO_CHAR(r.TM, 'YYYY') year FROM SD_VA_R r " +
|
||||
"LEFT JOIN SD_VABASIC_B svb ON r.TETP = svb.ID " +
|
||||
"LEFT JOIN SD_VA_B_H a ON a.STCD = r.STCD WHERE NVL(r.IS_DELETED, 0) = 0 ");
|
||||
|
||||
if (StrUtil.isNotBlank(baseId)) {
|
||||
sql.append(" AND a.BASE_ID = #{map.baseId} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(stcd)) {
|
||||
sql.append(" AND a.STCD = #{map.stcd} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
sql.append(" AND a.RSTCD = #{map.rstcd} ");
|
||||
}
|
||||
sql.append(" GROUP BY TO_CHAR(r.TM, 'YYYY') ORDER BY TO_CHAR(r.TM, 'YYYY') DESC ");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
if (StrUtil.isNotBlank(baseId)) {
|
||||
paramMap.put("baseId", baseId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(stcd)) {
|
||||
paramMap.put("stcd", stcd);
|
||||
}
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
paramMap.put("rstcd", rstcd);
|
||||
}
|
||||
|
||||
Page<?> page = KendoUtil.getPage(dataSourceRequest);
|
||||
List<Map<String, Object>> list = microservicDynamicSQLMapper.pageAllList(page, sql.toString(), paramMap);
|
||||
List<String> yList = new ArrayList<>();
|
||||
for (Map<String, Object> it : list) {
|
||||
if (it.get("YEAR") != null && StrUtil.isNotBlank(it.get("YEAR").toString())) {
|
||||
yList.add(it.get("YEAR").toString());
|
||||
}
|
||||
}
|
||||
dataSourceResult.setData(yList);
|
||||
dataSourceResult.setTotal(page != null ? page.getTotal() : (long) yList.size());
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult getVprYearList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult dataSourceResult = new DataSourceResult<>();
|
||||
DataSourceLoadOptionsBase loadOptionsBase = dataSourceRequest.toDevRequest();
|
||||
String baseId = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "baseId");
|
||||
String stcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "stcd");
|
||||
String rstcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "rstcd");
|
||||
|
||||
StringBuilder sql = new StringBuilder("SELECT TO_CHAR(r.TM, 'YYYY') year FROM SD_VP_R r " +
|
||||
"LEFT JOIN SD_VPBASIC_B svb ON r.PLANT_ID = svb.ID " +
|
||||
"LEFT JOIN SD_VP_B_H a ON a.STCD = r.STCD WHERE NVL(r.IS_DELETED, 0) = 0 ");
|
||||
|
||||
if (StrUtil.isNotBlank(baseId)) {
|
||||
sql.append(" AND a.BASE_ID = #{map.baseId} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(stcd)) {
|
||||
sql.append(" AND a.STCD = #{map.stcd} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
sql.append(" AND a.RSTCD = #{map.rstcd} ");
|
||||
}
|
||||
sql.append(" GROUP BY TO_CHAR(r.TM, 'YYYY') ORDER BY TO_CHAR(r.TM, 'YYYY') DESC ");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
if (StrUtil.isNotBlank(baseId)) {
|
||||
paramMap.put("baseId", baseId);
|
||||
}
|
||||
if (StrUtil.isNotBlank(stcd)) {
|
||||
paramMap.put("stcd", stcd);
|
||||
}
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
paramMap.put("rstcd", rstcd);
|
||||
}
|
||||
|
||||
Page<?> page = KendoUtil.getPage(dataSourceRequest);
|
||||
List<Map<String, Object>> list = microservicDynamicSQLMapper.pageAllList(page, sql.toString(), paramMap);
|
||||
List<String> yList = new ArrayList<>();
|
||||
for (Map<String, Object> it : list) {
|
||||
if (it.get("YEAR") != null && StrUtil.isNotBlank(it.get("YEAR").toString())) {
|
||||
yList.add(it.get("YEAR").toString());
|
||||
}
|
||||
}
|
||||
dataSourceResult.setData(yList);
|
||||
dataSourceResult.setTotal(page != null ? page.getTotal() : (long) yList.size());
|
||||
return dataSourceResult;
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,4 +74,10 @@ public class WarnDataController {
|
||||
public ResponseResult getWarnStcdKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(warnDataService.getWarnStcdKendoListCust(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/ai/com/qgc/aiFile/GetKendoListCust")
|
||||
@Operation(summary = "全过程AI识别监测日历表(文件)")
|
||||
public ResponseResult getAiFileKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(warnDataService.getAiFileKendoListCust(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
package com.yfd.platform.qgc_env.warn.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* AI文件列表VO - 全过程AI识别监测日历表(文件)
|
||||
*
|
||||
* @author Generated
|
||||
* @since 2025-07-01
|
||||
*/
|
||||
@Data
|
||||
public class AiFileVo {
|
||||
|
||||
private String stcd;
|
||||
|
||||
private String stnm;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date tm;
|
||||
|
||||
private String fid;
|
||||
|
||||
private String rstcd;
|
||||
|
||||
private String ennm;
|
||||
|
||||
private String stCode;
|
||||
|
||||
private String stName;
|
||||
|
||||
private Integer baseStepSort;
|
||||
|
||||
private Integer rvcdStepSort;
|
||||
|
||||
private Integer rstcdStepSort;
|
||||
|
||||
private Integer siteStepSort;
|
||||
|
||||
private Integer dataType;
|
||||
}
|
||||
@ -8,6 +8,7 @@ import com.yfd.platform.qgc_env.warn.entity.vo.AiProtectVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiDmRunVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiComListVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiRstcdVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiFileVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.EngWarnCountVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.StcdWarnStateVo;
|
||||
|
||||
@ -32,4 +33,6 @@ public interface WarnDataService {
|
||||
DataSourceResult<AlarmPointVo> getAlarmPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<StcdWarnStateVo> getWarnStcdKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<AiFileVo> getAiFileKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@ import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AlarmPointVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiComListVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiDmRunVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiFileVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiProtectVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiRecordVo;
|
||||
import com.yfd.platform.qgc_env.warn.entity.vo.AiRstcdVo;
|
||||
@ -157,6 +158,7 @@ public class WarnDataServiceImpl implements WarnDataService {
|
||||
.append("ai.RSTCD AS rstcd, ")
|
||||
.append("eng.ENNM AS ennm, ")
|
||||
.append("ai.BASE_ID AS baseId, ")
|
||||
.append("hb.BASENAME AS baseName, ")
|
||||
.append("ai.HBRVCD AS hbrvcd, ")
|
||||
.append("ai.RVCD AS rvcd, ")
|
||||
.append("rec.TM AS tm, ")
|
||||
@ -172,6 +174,7 @@ public class WarnDataServiceImpl implements WarnDataService {
|
||||
.append("FROM SD_AICOM_R rec ")
|
||||
.append("LEFT JOIN SD_AIMONITOR_B_H ai ON ai.STCD = rec.STCD AND NVL(ai.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = ai.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = ai.BASE_ID AND hb.IS_DELETED = 0 ")
|
||||
.append("WHERE NVL(rec.IS_DELETED, 0) = 0 ");
|
||||
|
||||
String filterSql = buildAiComFilterCondition(dataSourceRequest == null ? null : dataSourceRequest.getFilter(), paramMap, new int[]{0});
|
||||
@ -356,6 +359,254 @@ public class WarnDataServiceImpl implements WarnDataService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<AiFileVo> getAiFileKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
String baseId = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "baseId");
|
||||
String tm = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "tm");
|
||||
String rstcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "rstcd");
|
||||
String stcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd");
|
||||
String type = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "type");
|
||||
String dataType = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "dataType");
|
||||
|
||||
Date startTime = null, endTime = null;
|
||||
if (StrUtil.isNotBlank(tm)) {
|
||||
String[] ll = tm.split(",");
|
||||
if (ll.length == 2) {
|
||||
startTime = DateUtil.parse(ll[0]);
|
||||
endTime = DateUtil.parse(ll[1]);
|
||||
if (startTime.after(endTime)) {
|
||||
Date tmp = startTime;
|
||||
startTime = endTime;
|
||||
endTime = tmp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
rstcd = rstcd.replace("[", "").replace("]", "").replaceAll("\"", "'");
|
||||
}
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT * FROM (");
|
||||
sql.append(buildAiFileHeartbeatSql(baseId, type, rstcd, stcd, startTime, endTime, paramMap, "hb"));
|
||||
sql.append(" UNION ");
|
||||
sql.append(buildAiFileComSql(baseId, type, rstcd, stcd, startTime, endTime, paramMap, "ac"));
|
||||
sql.append(") WHERE 1=1 ");
|
||||
|
||||
if (StrUtil.isNotBlank(dataType)) {
|
||||
paramMap.put("dataType", Integer.parseInt(dataType));
|
||||
sql.append("AND DATA_TYPE = #{map.dataType} ");
|
||||
}
|
||||
|
||||
sql.append(buildAiFileOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<AiFileVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page,
|
||||
sql.toString(),
|
||||
paramMap,
|
||||
AiFileVo.class
|
||||
);
|
||||
|
||||
DataSourceResult<AiFileVo> result = new DataSourceResult<>();
|
||||
result.setData(list);
|
||||
result.setTotal(page == null ? list.size() : page.getTotal());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private String buildAiFileHeartbeatSql(String baseId, String type, String rstcd, String stcd,
|
||||
Date startTime, Date endTime, Map<String, Object> paramMap, String keyPrefix) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append("a.STCD AS STCD, ")
|
||||
.append("b.RSTCD AS RSTCD, ")
|
||||
.append("eng.ENNM AS ENNM, ")
|
||||
.append("b.STCD AS STCODE, ")
|
||||
.append("b.STNM AS STNAME, ")
|
||||
.append("hb.ORDER_INDEX AS BASESTEPSORT, ")
|
||||
.append("along.ORDER_INDEX AS RVCDSTEPSORT, ")
|
||||
.append("rstSort.SORT AS RSTCDSTEPSORT, ")
|
||||
.append("siteSort.SORT AS SITESTEPSORT, ")
|
||||
.append("b.STNM AS STNM, ")
|
||||
.append("a.TM AS TM, ");
|
||||
|
||||
if (StrUtil.isNotBlank(type)) {
|
||||
if ("AI_5001".equals(type) || "AI_50011".equals(type)) {
|
||||
sql.append("3 AS DATA_TYPE, ");
|
||||
} else {
|
||||
sql.append("1 AS DATA_TYPE, ");
|
||||
}
|
||||
} else {
|
||||
sql.append("1 AS DATA_TYPE, ");
|
||||
}
|
||||
|
||||
sql.append("REGEXP_SUBSTR(a.FID, '[^,]+', 1, LEVEL) AS FID ");
|
||||
sql.append("FROM SD_AIHEARTBEAT_R a ");
|
||||
sql.append("INNER JOIN SD_AIMONITOR_B_H b ON a.STCD = b.STCD AND NVL(b.IS_DELETED, 0) = 0 AND b.STTP LIKE 'AI_%' ");
|
||||
sql.append("LEFT JOIN SD_ENGINFO_B_H eng ON b.RSTCD = eng.STCD AND NVL(eng.IS_DELETED, 0) = 0 ");
|
||||
sql.append("LEFT JOIN SD_HYDROBASE hb ON b.BASE_ID = hb.BASEID AND NVL(hb.IS_DELETED, 0) = 0 ");
|
||||
sql.append("LEFT JOIN MS_ALONG_B along ON b.HBRVCD = along.RVCD AND along.CODE = 'common' AND NVL(along.IS_DELETED, 0) = 0 ");
|
||||
sql.append("LEFT JOIN (SELECT det.SORT, cfg.RVCD, det.STCD FROM MS_ALONGDET_B det INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common') rstSort ON rstSort.RVCD = b.HBRVCD AND rstSort.STCD = b.RSTCD ");
|
||||
sql.append("LEFT JOIN (SELECT det.SORT, cfg.RVCD, det.STCD FROM MS_ALONGDET_B det INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common') siteSort ON siteSort.RVCD = b.HBRVCD AND siteSort.STCD = b.STCD ");
|
||||
sql.append("WHERE NVL(a.IS_DELETED, 0) = 0 ");
|
||||
sql.append("AND a.FID NOT LIKE '%ORA-%' AND a.FID NOT LIKE '%Out%' ");
|
||||
|
||||
if (StrUtil.isNotBlank(type)) {
|
||||
if ("AI_50011".equals(type)) {
|
||||
sql.append("AND b.STTP = 'AI_5001' ");
|
||||
} else {
|
||||
sql.append("AND b.STTP = '").append(type).append("' ");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(baseId)) {
|
||||
paramMap.put(keyPrefix + "BaseId", baseId);
|
||||
sql.append("AND b.BASE_ID = #{map.").append(keyPrefix).append("BaseId} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(stcd)) {
|
||||
paramMap.put(keyPrefix + "Stcd", stcd);
|
||||
sql.append("AND b.STCD = #{map.").append(keyPrefix).append("Stcd} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
sql.append("AND b.RSTCD IN (").append(rstcd).append(") ");
|
||||
}
|
||||
if (startTime != null) {
|
||||
paramMap.put(keyPrefix + "StartTime", startTime);
|
||||
sql.append("AND a.TM >= #{map.").append(keyPrefix).append("StartTime} ");
|
||||
}
|
||||
if (endTime != null) {
|
||||
paramMap.put(keyPrefix + "EndTime", endTime);
|
||||
sql.append("AND a.TM <= #{map.").append(keyPrefix).append("EndTime} ");
|
||||
}
|
||||
|
||||
sql.append("CONNECT BY REGEXP_SUBSTR(a.FID, '[^,]+', 1, LEVEL) IS NOT NULL ");
|
||||
sql.append("AND PRIOR a.ID = a.ID ");
|
||||
sql.append("AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL");
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private String buildAiFileComSql(String baseId, String type, String rstcd, String stcd,
|
||||
Date startTime, Date endTime, Map<String, Object> paramMap, String keyPrefix) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append("a.STCD AS STCD, ")
|
||||
.append("b.RSTCD AS RSTCD, ")
|
||||
.append("eng.ENNM AS ENNM, ")
|
||||
.append("b.STCD AS STCODE, ")
|
||||
.append("b.STNM AS STNAME, ")
|
||||
.append("hb.ORDER_INDEX AS BASESTEPSORT, ")
|
||||
.append("along.ORDER_INDEX AS RVCDSTEPSORT, ")
|
||||
.append("rstSort.SORT AS RSTCDSTEPSORT, ")
|
||||
.append("siteSort.SORT AS SITESTEPSORT, ")
|
||||
.append("b.STNM AS STNM, ")
|
||||
.append("a.TM AS TM, ");
|
||||
|
||||
if (StrUtil.isNotBlank(type)) {
|
||||
if ("AI_5001".equals(type) || "AI_50011".equals(type)) {
|
||||
sql.append("(CASE WHEN a.TYPE = 'AI_5001' AND (a.IS_BIG_DEBRIS_AREA IS NULL OR a.IS_BIG_DEBRIS_AREA = 0) THEN 4 WHEN a.TYPE = 'AI_5001' AND a.IS_BIG_DEBRIS_AREA > 0 THEN 5 END) AS DATA_TYPE, ");
|
||||
} else {
|
||||
sql.append("2 AS DATA_TYPE, ");
|
||||
}
|
||||
} else {
|
||||
sql.append("2 AS DATA_TYPE, ");
|
||||
}
|
||||
|
||||
sql.append("REGEXP_SUBSTR(a.FID, '[^,]+', 1, LEVEL) AS FID ");
|
||||
sql.append("FROM SD_AICOM_R a ");
|
||||
sql.append("INNER JOIN SD_AIMONITOR_B_H b ON a.STCD = b.STCD AND NVL(b.IS_DELETED, 0) = 0 AND b.STTP LIKE 'AI_%' ");
|
||||
sql.append("LEFT JOIN SD_ENGINFO_B_H eng ON b.RSTCD = eng.STCD AND NVL(eng.IS_DELETED, 0) = 0 ");
|
||||
sql.append("LEFT JOIN SD_HYDROBASE hb ON b.BASE_ID = hb.BASEID AND NVL(hb.IS_DELETED, 0) = 0 ");
|
||||
sql.append("LEFT JOIN MS_ALONG_B along ON b.HBRVCD = along.RVCD AND along.CODE = 'common' AND NVL(along.IS_DELETED, 0) = 0 ");
|
||||
sql.append("LEFT JOIN (SELECT det.SORT, cfg.RVCD, det.STCD FROM MS_ALONGDET_B det INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common') rstSort ON rstSort.RVCD = b.HBRVCD AND rstSort.STCD = b.RSTCD ");
|
||||
sql.append("LEFT JOIN (SELECT det.SORT, cfg.RVCD, det.STCD FROM MS_ALONGDET_B det INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common') siteSort ON siteSort.RVCD = b.HBRVCD AND siteSort.STCD = b.STCD ");
|
||||
sql.append("WHERE NVL(a.IS_DELETED, 0) = 0 ");
|
||||
sql.append("AND (a.TASK_STATUS IS NULL OR a.TASK_STATUS = 'Approved') ");
|
||||
sql.append("AND a.FID NOT LIKE '%ORA-%' AND a.FID NOT LIKE '%Out%' ");
|
||||
|
||||
if (StrUtil.isNotBlank(type)) {
|
||||
if ("AI_50011".equals(type)) {
|
||||
paramMap.put(keyPrefix + "Type", "AI_5001");
|
||||
sql.append("AND a.TYPE = #{map.").append(keyPrefix).append("Type} ");
|
||||
} else {
|
||||
paramMap.put(keyPrefix + "Type", type);
|
||||
sql.append("AND a.TYPE = #{map.").append(keyPrefix).append("Type} ");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(baseId)) {
|
||||
paramMap.put(keyPrefix + "BaseId", baseId);
|
||||
sql.append("AND b.BASE_ID = #{map.").append(keyPrefix).append("BaseId} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(stcd)) {
|
||||
paramMap.put(keyPrefix + "Stcd", stcd);
|
||||
sql.append("AND b.STCD = #{map.").append(keyPrefix).append("Stcd} ");
|
||||
}
|
||||
if (StrUtil.isNotBlank(rstcd)) {
|
||||
sql.append("AND b.RSTCD IN (").append(rstcd).append(") ");
|
||||
}
|
||||
if (startTime != null) {
|
||||
paramMap.put(keyPrefix + "StartTime", startTime);
|
||||
sql.append("AND a.TM >= #{map.").append(keyPrefix).append("StartTime} ");
|
||||
}
|
||||
if (endTime != null) {
|
||||
paramMap.put(keyPrefix + "EndTime", endTime);
|
||||
sql.append("AND a.TM <= #{map.").append(keyPrefix).append("EndTime} ");
|
||||
}
|
||||
|
||||
sql.append("CONNECT BY REGEXP_SUBSTR(a.FID, '[^,]+', 1, LEVEL) IS NOT NULL ");
|
||||
sql.append("AND PRIOR a.ID = a.ID ");
|
||||
sql.append("AND PRIOR DBMS_RANDOM.VALUE IS NOT NULL");
|
||||
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private String buildAiFileOrderBySql(List<DataSourceRequest.SortDescriptor> sortList) {
|
||||
if (CollUtil.isEmpty(sortList)) {
|
||||
return " ORDER BY STCD, TM DESC ";
|
||||
}
|
||||
List<String> orderItems = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor item : sortList) {
|
||||
if (item == null || StrUtil.isBlank(item.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = mapAiFileColumn(item.getField());
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String dir = "desc".equalsIgnoreCase(item.getDir()) ? "DESC" : "ASC";
|
||||
orderItems.add(column + " " + dir);
|
||||
}
|
||||
if (orderItems.isEmpty()) {
|
||||
return " ORDER BY STCD, TM DESC ";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderItems);
|
||||
}
|
||||
|
||||
private String mapAiFileColumn(String field) {
|
||||
if (StrUtil.isBlank(field)) {
|
||||
return null;
|
||||
}
|
||||
return switch (field) {
|
||||
case "stcd" -> "STCD";
|
||||
case "stnm" -> "STNM";
|
||||
case "tm" -> "TM";
|
||||
case "fid" -> "FID";
|
||||
case "rstcd" -> "RSTCD";
|
||||
case "ennm" -> "ENNM";
|
||||
case "stCode" -> "STCODE";
|
||||
case "stName" -> "STNAME";
|
||||
case "baseStepSort" -> "BASESTEPSORT";
|
||||
case "rvcdStepSort" -> "RVCDSTEPSORT";
|
||||
case "rstcdStepSort" -> "RSTCDSTEPSORT";
|
||||
case "siteStepSort" -> "SITESTEPSORT";
|
||||
case "dataType" -> "DATA_TYPE";
|
||||
default -> null;
|
||||
};
|
||||
}
|
||||
|
||||
private AiDmRunVo buildAiDmRunVo(Map<String, Object> row) {
|
||||
if (row == null || row.isEmpty()) {
|
||||
return null;
|
||||
@ -1624,6 +1875,7 @@ public class WarnDataServiceImpl implements WarnDataService {
|
||||
case "rstcd" -> "ai.RSTCD";
|
||||
case "ennm", "stnmEng" -> "eng.ENNM";
|
||||
case "baseId" -> "ai.BASE_ID";
|
||||
case "baseName" -> "hb.BASENAME";
|
||||
case "hbrvcd" -> "ai.HBRVCD";
|
||||
case "rvcd" -> "ai.RVCD";
|
||||
case "tm" -> "rec.TM";
|
||||
@ -1653,6 +1905,7 @@ public class WarnDataServiceImpl implements WarnDataService {
|
||||
case "rstcd" -> alias + ".rstcd";
|
||||
case "ennm", "stnmEng" -> alias + ".ennm";
|
||||
case "baseId" -> alias + ".baseId";
|
||||
case "baseName" -> alias + ".baseName";
|
||||
case "hbrvcd" -> alias + ".hbrvcd";
|
||||
case "rvcd" -> alias + ".rvcd";
|
||||
case "tm" -> alias + ".tm";
|
||||
|
||||
@ -2,7 +2,9 @@ package com.yfd.platform.qgc_env.wq.controller;
|
||||
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.annotation.Log;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_env.wq.entity.vo.WqOperateRequest;
|
||||
import com.yfd.platform.qgc_env.wq.service.EnvWqDataService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -57,13 +59,18 @@ public class EnvWqDataController {
|
||||
return ResponseResult.successData(envWqDataService.getDrtpKendoListCust(dataSourceRequest));
|
||||
}
|
||||
|
||||
@Log(module = "水质统计分析", value = "修改水质小时数据")
|
||||
@PostMapping("/updateWqRsData")
|
||||
@Operation(summary = "修改水质小时数据")
|
||||
public ResponseResult updateWqRsData(@RequestBody Map<String, Object> updateData) {
|
||||
envWqDataService.updateWqRsData(updateData);
|
||||
public ResponseResult updateWqRsData(@RequestBody WqOperateRequest wqOperateRequest) {
|
||||
envWqDataService.updateWqRsData(
|
||||
wqOperateRequest == null ? null : wqOperateRequest.getUpdateData(),
|
||||
wqOperateRequest == null ? null : wqOperateRequest.getSource()
|
||||
);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@Log(module = "水质统计分析", value = "删除水质小时/日/月数据")
|
||||
@PostMapping("/removeKendoByIds")
|
||||
@Operation(summary = "删除水质小时/日/月数据")
|
||||
public ResponseResult removeKendoByIds(@RequestBody BatchDeleteAo batchDeleteAo) {
|
||||
@ -149,4 +156,10 @@ public class EnvWqDataController {
|
||||
public ResponseResult getRuleKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(envWqDataService.getWqWarRuleList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/anchorPoint/GetKendoListCust")
|
||||
@Operation(summary = "水质锚点")
|
||||
public ResponseResult getAnchorPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(envWqDataService.getAnchorPointKendoListCust(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,228 @@
|
||||
package com.yfd.platform.qgc_env.wq.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
@Schema(description = "水质锚点VO")
|
||||
public class EnvWqAnchorPointVo {
|
||||
|
||||
@Schema(description = "断面")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "断面名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "电站名称")
|
||||
private String ennm;
|
||||
|
||||
@Schema(description = "数据接入类型:0=自建 1=国家建 2=人工")
|
||||
private Integer dtinType;
|
||||
|
||||
@Schema(description = "所在位置")
|
||||
private String stlc;
|
||||
|
||||
@Schema(description = "水质要求")
|
||||
private String wwqtg;
|
||||
|
||||
@Schema(description = "水质要求名称")
|
||||
private String wwqtgName;
|
||||
|
||||
@Schema(description = "水质是否达标")
|
||||
private Integer sfdb;
|
||||
|
||||
@Schema(description = "数据时间")
|
||||
private Date tm;
|
||||
|
||||
@Schema(description = "水质类别:监测结果")
|
||||
private String wqGrd;
|
||||
|
||||
@Schema(description = "水质类别名称")
|
||||
private String wqGrdName;
|
||||
|
||||
@Schema(description = "站点类型 - 用于锚点弹框显示")
|
||||
private String sttp;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lttd;
|
||||
|
||||
@Schema(description = "高程")
|
||||
private BigDecimal dtmel;
|
||||
|
||||
@Schema(description = "描点状态 - 用于图例")
|
||||
private String anchoPointState;
|
||||
|
||||
@Schema(description = "锚点类型 - 用于锚点浮框显示")
|
||||
private String sttpMap;
|
||||
|
||||
@Schema(description = "弹框站点名称")
|
||||
private String titleName;
|
||||
|
||||
@Schema(description = "基地id")
|
||||
private String baseId;
|
||||
|
||||
@Schema(description = "栖息地名称")
|
||||
private String fhstnm;
|
||||
|
||||
@Schema(description = "栖息地编码")
|
||||
private String fhstcd;
|
||||
|
||||
private String addvcdName;
|
||||
private String baseName;
|
||||
private String hbrvcd;
|
||||
private String hbrvcdName;
|
||||
private String rvcdName;
|
||||
private String rstcd;
|
||||
private Integer rstcdStepSort;
|
||||
private Integer siteStepSort;
|
||||
private Integer baseStepSort;
|
||||
private Integer rvcdStepSort;
|
||||
|
||||
@Schema(description = "地图避让")
|
||||
private Integer distance;
|
||||
|
||||
private String sttpCode;
|
||||
private String value;
|
||||
private String alias;
|
||||
|
||||
@Schema(description = "水温")
|
||||
private BigDecimal wtmp;
|
||||
|
||||
@Schema(description = "PH")
|
||||
private BigDecimal ph;
|
||||
|
||||
@Schema(description = "溶解氧")
|
||||
private BigDecimal dox;
|
||||
|
||||
@Schema(description = "高锰酸盐指数")
|
||||
private BigDecimal codmn;
|
||||
|
||||
@Schema(description = "化学需氧量")
|
||||
private BigDecimal codcr;
|
||||
|
||||
@Schema(description = "五日生化需氧量")
|
||||
private BigDecimal bod5;
|
||||
|
||||
@Schema(description = "氨氮")
|
||||
private BigDecimal nh3n;
|
||||
|
||||
@Schema(description = "总磷")
|
||||
private BigDecimal tp;
|
||||
|
||||
@Schema(description = "总氮")
|
||||
private BigDecimal tn;
|
||||
|
||||
@Schema(description = "铜")
|
||||
private BigDecimal cu;
|
||||
|
||||
@Schema(description = "锌")
|
||||
private BigDecimal zn;
|
||||
|
||||
@Schema(description = "氟化物")
|
||||
private BigDecimal f;
|
||||
|
||||
@Schema(description = "硒")
|
||||
private BigDecimal se;
|
||||
|
||||
@Schema(description = "砷")
|
||||
private BigDecimal ars;
|
||||
|
||||
@Schema(description = "汞")
|
||||
private BigDecimal hg;
|
||||
|
||||
@Schema(description = "镉")
|
||||
private BigDecimal cd;
|
||||
|
||||
@Schema(description = "铬(六价)")
|
||||
private BigDecimal cr6;
|
||||
|
||||
@Schema(description = "铅")
|
||||
private BigDecimal pb;
|
||||
|
||||
@Schema(description = "氰化物")
|
||||
private BigDecimal cn;
|
||||
|
||||
@Schema(description = "挥发酚")
|
||||
private BigDecimal vlph;
|
||||
|
||||
@Schema(description = "石油类")
|
||||
private BigDecimal oil;
|
||||
|
||||
@Schema(description = "阴离子表面活性剂")
|
||||
private BigDecimal las;
|
||||
|
||||
@Schema(description = "硫化物")
|
||||
private BigDecimal s2;
|
||||
|
||||
@Schema(description = "粪大肠菌群")
|
||||
private BigDecimal fcg;
|
||||
|
||||
@Schema(description = "氯化物")
|
||||
private BigDecimal cl;
|
||||
|
||||
@Schema(description = "硫酸盐")
|
||||
private BigDecimal so4;
|
||||
|
||||
@Schema(description = "硝酸盐氮")
|
||||
private BigDecimal no3;
|
||||
|
||||
@Schema(description = "总硬度")
|
||||
private BigDecimal thrd;
|
||||
|
||||
@Schema(description = "电导率")
|
||||
private BigDecimal cond;
|
||||
|
||||
@Schema(description = "铁")
|
||||
private BigDecimal fe;
|
||||
|
||||
@Schema(description = "锰")
|
||||
private BigDecimal mn;
|
||||
|
||||
@Schema(description = "铝")
|
||||
private BigDecimal al;
|
||||
|
||||
@Schema(description = "叶绿素a")
|
||||
private BigDecimal chla;
|
||||
|
||||
@Schema(description = "透明度")
|
||||
private BigDecimal clarity;
|
||||
|
||||
@Schema(description = "浊度")
|
||||
private BigDecimal tu;
|
||||
|
||||
@Schema(description = "总氧/总需氧量")
|
||||
private BigDecimal tod;
|
||||
|
||||
@Schema(description = "蓝绿藻")
|
||||
private BigDecimal cyano;
|
||||
|
||||
@Schema(description = "水质要素最小限值集合")
|
||||
private List<Map<String, Object>> min;
|
||||
|
||||
@Schema(description = "水质要素最大限值集合")
|
||||
private List<Map<String, Object>> max;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private Integer orderIndex;
|
||||
|
||||
private String engLctn1Code;
|
||||
private String engLctn3Code;
|
||||
|
||||
public void setWqGrd(String wqGrd) {
|
||||
this.wqGrd = wqGrd;
|
||||
this.value = wqGrd;
|
||||
}
|
||||
|
||||
public void setWqGrdName(String wqGrdName) {
|
||||
this.wqGrdName = wqGrdName;
|
||||
this.alias = wqGrdName;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.platform.qgc_env.wq.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class WqOperateRequest {
|
||||
|
||||
private String source;
|
||||
|
||||
private Map<String, Object> updateData;
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_env.wq.entity.vo.WqBaseInfoVo;
|
||||
import com.yfd.platform.qgc_env.wq.entity.vo.EnvWqAnchorPointVo;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@ -39,7 +40,9 @@ public interface EnvWqDataService {
|
||||
|
||||
DataSourceResult getStTbYsBVoKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
boolean updateWqRsData(Map<String, Object> updateData);
|
||||
boolean updateWqRsData(Map<String, Object> updateData, String source);
|
||||
|
||||
boolean removeKendoByIds(BatchDeleteAo batchDeleteAo);
|
||||
|
||||
DataSourceResult<EnvWqAnchorPointVo> getAnchorPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -1,15 +1,22 @@
|
||||
package com.yfd.platform.qgc_env.wq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.common.*;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLog;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLogDetail;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_base.entity.vo.DataParam;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogDetailMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogMapper;
|
||||
import com.yfd.platform.qgc_env.wq.entity.vo.*;
|
||||
import com.yfd.platform.qgc_env.wq.service.EnvWqDataService;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WbsbVo;
|
||||
import com.yfd.platform.qgc_env.wt.utils.SiteAvoidanceUtils;
|
||||
import com.yfd.platform.utils.KendoUtil;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import com.yfd.platform.utils.RequestHolder;
|
||||
@ -31,17 +38,121 @@ import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
|
||||
@Service
|
||||
public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
|
||||
private static final String WQ_HOUR_TABLE_NAME = "SD_WQ_R";
|
||||
private static final String WQ_DAY_TABLE_NAME = "SD_WQDAY_S";
|
||||
private static final String WQ_MONTH_TABLE_NAME = "SD_WQDRTP_S";
|
||||
private static final String WQ_STATION_TABLE_NAME = "SD_WQ_B_H";
|
||||
|
||||
private static final LinkedHashMap<String, String> WQ_UPDATE_COLUMN_MAP = new LinkedHashMap<>();
|
||||
private static final Map<String, String> WQ_FIELD_MEANING_MAP = new LinkedHashMap<>();
|
||||
static {
|
||||
WQ_UPDATE_COLUMN_MAP.put("wtmp", "WTMP");
|
||||
WQ_UPDATE_COLUMN_MAP.put("ph", "PH");
|
||||
WQ_UPDATE_COLUMN_MAP.put("dox", "DOX");
|
||||
WQ_UPDATE_COLUMN_MAP.put("codmn", "CODMN");
|
||||
WQ_UPDATE_COLUMN_MAP.put("codcr", "CODCR");
|
||||
WQ_UPDATE_COLUMN_MAP.put("bod5", "BOD5");
|
||||
WQ_UPDATE_COLUMN_MAP.put("nh3n", "NH3N");
|
||||
WQ_UPDATE_COLUMN_MAP.put("tp", "TP");
|
||||
WQ_UPDATE_COLUMN_MAP.put("tn", "TN");
|
||||
WQ_UPDATE_COLUMN_MAP.put("cu", "CU");
|
||||
WQ_UPDATE_COLUMN_MAP.put("zn", "ZN");
|
||||
WQ_UPDATE_COLUMN_MAP.put("f", "F");
|
||||
WQ_UPDATE_COLUMN_MAP.put("se", "SE");
|
||||
WQ_UPDATE_COLUMN_MAP.put("ars", "ARS");
|
||||
WQ_UPDATE_COLUMN_MAP.put("hg", "HG");
|
||||
WQ_UPDATE_COLUMN_MAP.put("cd", "CD");
|
||||
WQ_UPDATE_COLUMN_MAP.put("cr6", "CR6");
|
||||
WQ_UPDATE_COLUMN_MAP.put("pb", "PB");
|
||||
WQ_UPDATE_COLUMN_MAP.put("cn", "CN");
|
||||
WQ_UPDATE_COLUMN_MAP.put("vlph", "VLPH");
|
||||
WQ_UPDATE_COLUMN_MAP.put("oil", "OIL");
|
||||
WQ_UPDATE_COLUMN_MAP.put("las", "LAS");
|
||||
WQ_UPDATE_COLUMN_MAP.put("s2", "S2");
|
||||
WQ_UPDATE_COLUMN_MAP.put("fcg", "FCG");
|
||||
WQ_UPDATE_COLUMN_MAP.put("cl", "CL");
|
||||
WQ_UPDATE_COLUMN_MAP.put("so4", "SO4");
|
||||
WQ_UPDATE_COLUMN_MAP.put("no3", "NO3");
|
||||
WQ_UPDATE_COLUMN_MAP.put("thrd", "THRD");
|
||||
WQ_UPDATE_COLUMN_MAP.put("cond", "COND");
|
||||
WQ_UPDATE_COLUMN_MAP.put("fe", "FE");
|
||||
WQ_UPDATE_COLUMN_MAP.put("mn", "MN");
|
||||
WQ_UPDATE_COLUMN_MAP.put("al", "AL");
|
||||
WQ_UPDATE_COLUMN_MAP.put("chla", "CHLA");
|
||||
WQ_UPDATE_COLUMN_MAP.put("clarity", "CLARITY");
|
||||
WQ_UPDATE_COLUMN_MAP.put("tu", "TU");
|
||||
WQ_UPDATE_COLUMN_MAP.put("cyano", "CYANO");
|
||||
WQ_UPDATE_COLUMN_MAP.put("wqgrd", "WQGRD");
|
||||
WQ_UPDATE_COLUMN_MAP.put("sfdb", "SFDB");
|
||||
WQ_UPDATE_COLUMN_MAP.put("wqSfdbhnYs", "WQ_SFDBHN_YS");
|
||||
|
||||
WQ_FIELD_MEANING_MAP.put("STCD", "站点编码");
|
||||
WQ_FIELD_MEANING_MAP.put("TM", "监测时间");
|
||||
WQ_FIELD_MEANING_MAP.put("DT", "统计日期");
|
||||
WQ_FIELD_MEANING_MAP.put("DRTP", "统计类型");
|
||||
WQ_FIELD_MEANING_MAP.put("YEAR", "年份");
|
||||
WQ_FIELD_MEANING_MAP.put("MONTH", "月份");
|
||||
WQ_FIELD_MEANING_MAP.put("WTMP", "水温");
|
||||
WQ_FIELD_MEANING_MAP.put("PH", "酸碱度");
|
||||
WQ_FIELD_MEANING_MAP.put("DOX", "溶解氧");
|
||||
WQ_FIELD_MEANING_MAP.put("CODMN", "高锰酸盐指数");
|
||||
WQ_FIELD_MEANING_MAP.put("CODCR", "化学需氧量");
|
||||
WQ_FIELD_MEANING_MAP.put("BOD5", "五日生化需氧量");
|
||||
WQ_FIELD_MEANING_MAP.put("NH3N", "氨氮");
|
||||
WQ_FIELD_MEANING_MAP.put("TP", "总磷");
|
||||
WQ_FIELD_MEANING_MAP.put("TN", "总氮");
|
||||
WQ_FIELD_MEANING_MAP.put("CU", "铜");
|
||||
WQ_FIELD_MEANING_MAP.put("ZN", "锌");
|
||||
WQ_FIELD_MEANING_MAP.put("F", "氟化物");
|
||||
WQ_FIELD_MEANING_MAP.put("SE", "硒");
|
||||
WQ_FIELD_MEANING_MAP.put("ARS", "砷");
|
||||
WQ_FIELD_MEANING_MAP.put("HG", "汞");
|
||||
WQ_FIELD_MEANING_MAP.put("CD", "镉");
|
||||
WQ_FIELD_MEANING_MAP.put("CR6", "六价铬");
|
||||
WQ_FIELD_MEANING_MAP.put("PB", "铅");
|
||||
WQ_FIELD_MEANING_MAP.put("CN", "氰化物");
|
||||
WQ_FIELD_MEANING_MAP.put("VLPH", "挥发酚");
|
||||
WQ_FIELD_MEANING_MAP.put("OIL", "石油类");
|
||||
WQ_FIELD_MEANING_MAP.put("LAS", "阴离子表面活性剂");
|
||||
WQ_FIELD_MEANING_MAP.put("S2", "硫化物");
|
||||
WQ_FIELD_MEANING_MAP.put("FCG", "粪大肠菌群");
|
||||
WQ_FIELD_MEANING_MAP.put("CL", "氯化物");
|
||||
WQ_FIELD_MEANING_MAP.put("SO4", "硫酸盐");
|
||||
WQ_FIELD_MEANING_MAP.put("NO3", "硝酸盐");
|
||||
WQ_FIELD_MEANING_MAP.put("THRD", "总硬度");
|
||||
WQ_FIELD_MEANING_MAP.put("COND", "电导率");
|
||||
WQ_FIELD_MEANING_MAP.put("FE", "铁");
|
||||
WQ_FIELD_MEANING_MAP.put("MN", "锰");
|
||||
WQ_FIELD_MEANING_MAP.put("AL", "铝");
|
||||
WQ_FIELD_MEANING_MAP.put("CHLA", "叶绿素a");
|
||||
WQ_FIELD_MEANING_MAP.put("CLARITY", "透明度");
|
||||
WQ_FIELD_MEANING_MAP.put("TU", "浊度");
|
||||
WQ_FIELD_MEANING_MAP.put("CYANO", "蓝绿藻");
|
||||
WQ_FIELD_MEANING_MAP.put("WQGRD", "水质类别");
|
||||
WQ_FIELD_MEANING_MAP.put("WWQTG", "水功能区目标");
|
||||
WQ_FIELD_MEANING_MAP.put("SFDB", "是否达标");
|
||||
WQ_FIELD_MEANING_MAP.put("WQ_SFDBHN_YS", "是否达标湖内饮用水源");
|
||||
}
|
||||
|
||||
@Resource
|
||||
private MicroservicDynamicSQLMapper microservicDynamicSQLMapper;
|
||||
|
||||
@Resource
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogMapper msOperationLogMapper;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogDetailMapper msOperationLogDetailMapper;
|
||||
|
||||
@Override
|
||||
public DataSourceResult processKendoList(DataSourceRequest dataSourceRequest) {
|
||||
boolean calculated = CommonConstant.CALCULATE_SUCCESS.equals(
|
||||
@ -3671,15 +3782,18 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateWqRsData(Map<String, Object> updateData) {
|
||||
public boolean updateWqRsData(Map<String, Object> updateData, String source) {
|
||||
if (updateData == null || updateData.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
updateWqHourData(updateData);
|
||||
updateWqTargetIfNeeded(updateData);
|
||||
|
||||
String stcd = asString(updateData.get("stcd"));
|
||||
String tm = asString(updateData.get("tm"));
|
||||
Map<String, Object> beforeHour = queryWqHourRow(stcd, tm);
|
||||
Map<String, Object> beforeStation = queryWqStationRow(stcd);
|
||||
updateWqHourData(updateData);
|
||||
updateWqTargetIfNeeded(updateData);
|
||||
recordWqUpdateLog(beforeHour, beforeStation, updateData, source);
|
||||
|
||||
if (StrUtil.isNotBlank(stcd) && StrUtil.isNotBlank(tm) && tm.length() >= 10) {
|
||||
String dateStr = tm.substring(0, 10);
|
||||
statisticsDayDataFromHour(stcd, dateStr, dateStr);
|
||||
@ -3704,17 +3818,24 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
return true;
|
||||
}
|
||||
String dataType = StrUtil.blankToDefault(batchDeleteAo.getDataType(), "").toUpperCase();
|
||||
String source = batchDeleteAo == null ? null : batchDeleteAo.getSource();
|
||||
int batchSize = 500;
|
||||
for (int i = 0; i < dataList.size(); i += batchSize) {
|
||||
List<DataParam> subList = dataList.subList(i, Math.min(i + batchSize, dataList.size()));
|
||||
if ("MON".equals(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryWqMonthRows(subList);
|
||||
softDeleteWqMonthData(subList);
|
||||
recordWqDeleteLog(beforeRows, WQ_MONTH_TABLE_NAME, "删除水质月数据", source);
|
||||
}
|
||||
if ("DATE".equals(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryWqDayRows(subList);
|
||||
softDeleteWqDayData(subList);
|
||||
recordWqDeleteLog(beforeRows, WQ_DAY_TABLE_NAME, "删除水质日数据", source);
|
||||
}
|
||||
if ("TIME".equals(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryWqHourRows(subList);
|
||||
deleteWqHourData(subList);
|
||||
recordWqDeleteLog(beforeRows, WQ_HOUR_TABLE_NAME, "删除水质小时数据", source);
|
||||
|
||||
Map<String, String[]> dateRangeMap = new HashMap<>();
|
||||
Map<String, String[]> monthRangeMap = new HashMap<>();
|
||||
@ -3765,50 +3886,9 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
}
|
||||
|
||||
private void updateWqHourData(Map<String, Object> updateData) {
|
||||
LinkedHashMap<String, String> columnMap = new LinkedHashMap<>();
|
||||
columnMap.put("wtmp", "WTMP");
|
||||
columnMap.put("ph", "PH");
|
||||
columnMap.put("dox", "DOX");
|
||||
columnMap.put("codmn", "CODMN");
|
||||
columnMap.put("codcr", "CODCR");
|
||||
columnMap.put("bod5", "BOD5");
|
||||
columnMap.put("nh3n", "NH3N");
|
||||
columnMap.put("tp", "TP");
|
||||
columnMap.put("tn", "TN");
|
||||
columnMap.put("cu", "CU");
|
||||
columnMap.put("zn", "ZN");
|
||||
columnMap.put("f", "F");
|
||||
columnMap.put("se", "SE");
|
||||
columnMap.put("ars", "ARS");
|
||||
columnMap.put("hg", "HG");
|
||||
columnMap.put("cd", "CD");
|
||||
columnMap.put("cr6", "CR6");
|
||||
columnMap.put("pb", "PB");
|
||||
columnMap.put("cn", "CN");
|
||||
columnMap.put("vlph", "VLPH");
|
||||
columnMap.put("oil", "OIL");
|
||||
columnMap.put("las", "LAS");
|
||||
columnMap.put("s2", "S2");
|
||||
columnMap.put("fcg", "FCG");
|
||||
columnMap.put("cl", "CL");
|
||||
columnMap.put("so4", "SO4");
|
||||
columnMap.put("no3", "NO3");
|
||||
columnMap.put("thrd", "THRD");
|
||||
columnMap.put("cond", "COND");
|
||||
columnMap.put("fe", "FE");
|
||||
columnMap.put("mn", "MN");
|
||||
columnMap.put("al", "AL");
|
||||
columnMap.put("chla", "CHLA");
|
||||
columnMap.put("clarity", "CLARITY");
|
||||
columnMap.put("tu", "TU");
|
||||
columnMap.put("cyano", "CYANO");
|
||||
columnMap.put("wqgrd", "WQGRD");
|
||||
columnMap.put("sfdb", "SFDB");
|
||||
columnMap.put("wqSfdbhnYs", "WQ_SFDBHN_YS");
|
||||
|
||||
List<String> setClauses = new ArrayList<>();
|
||||
List<Object> params = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : columnMap.entrySet()) {
|
||||
for (Map.Entry<String, String> entry : WQ_UPDATE_COLUMN_MAP.entrySet()) {
|
||||
if (updateData.containsKey(entry.getKey())) {
|
||||
setClauses.add(entry.getValue() + " = ?");
|
||||
params.add(updateData.get(entry.getKey()));
|
||||
@ -3909,6 +3989,286 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
jdbcTemplate.update(sql.toString(), params.toArray());
|
||||
}
|
||||
|
||||
private Map<String, Object> queryWqHourRow(String stcd, String tm) {
|
||||
if (StrUtil.isBlank(stcd) || StrUtil.isBlank(tm)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
String sql = "SELECT " + buildWqHourLogSelectColumns() +
|
||||
" FROM SD_WQ_R WHERE STCD = ? AND TM = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')";
|
||||
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, stcd, tm);
|
||||
return rows.isEmpty() ? new HashMap<>() : normalizeLogRow(rows.getFirst());
|
||||
}
|
||||
|
||||
private Map<String, Object> queryWqStationRow(String stcd) {
|
||||
if (StrUtil.isBlank(stcd)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
String sql = "SELECT STCD, WWQTG FROM SD_WQ_B_H WHERE STCD = ? AND NVL(IS_DELETED, 0) = 0";
|
||||
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, stcd);
|
||||
return rows.isEmpty() ? new HashMap<>() : normalizeLogRow(rows.getFirst());
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryWqHourRows(List<DataParam> dataParamList) {
|
||||
if (CollUtil.isEmpty(dataParamList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ")
|
||||
.append(buildWqHourLogSelectColumns())
|
||||
.append(" FROM SD_WQ_R WHERE ");
|
||||
List<Object> params = new ArrayList<>();
|
||||
appendHourRowConditions(sql, params, dataParamList);
|
||||
return normalizeLogRows(jdbcTemplate.queryForList(sql.toString(), params.toArray()));
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryWqDayRows(List<DataParam> dataParamList) {
|
||||
if (CollUtil.isEmpty(dataParamList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ")
|
||||
.append(buildWqDayLogSelectColumns())
|
||||
.append(" FROM SD_WQDAY_S WHERE ");
|
||||
List<Object> params = new ArrayList<>();
|
||||
for (int i = 0; i < dataParamList.size(); i++) {
|
||||
if (i > 0) {
|
||||
sql.append(" OR ");
|
||||
}
|
||||
sql.append("(STCD = ? AND DT = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'))");
|
||||
DataParam item = dataParamList.get(i);
|
||||
params.add(item == null ? null : item.getId());
|
||||
params.add(item == null ? null : item.getDt());
|
||||
}
|
||||
return normalizeLogRows(jdbcTemplate.queryForList(sql.toString(), params.toArray()));
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryWqMonthRows(List<DataParam> dataParamList) {
|
||||
if (CollUtil.isEmpty(dataParamList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ")
|
||||
.append(buildWqMonthLogSelectColumns())
|
||||
.append(" FROM SD_WQDRTP_S WHERE ");
|
||||
List<Object> params = new ArrayList<>();
|
||||
for (int i = 0; i < dataParamList.size(); i++) {
|
||||
if (i > 0) {
|
||||
sql.append(" OR ");
|
||||
}
|
||||
sql.append("(STCD = ? AND DRTP = ? AND YEAR = ? AND MONTH = ?)");
|
||||
DataParam item = dataParamList.get(i);
|
||||
params.add(item == null ? null : item.getId());
|
||||
params.add(item == null ? null : item.getDrtp());
|
||||
params.add(item == null ? null : item.getYear());
|
||||
params.add(item == null ? null : item.getMonth());
|
||||
}
|
||||
return normalizeLogRows(jdbcTemplate.queryForList(sql.toString(), params.toArray()));
|
||||
}
|
||||
|
||||
private void appendHourRowConditions(StringBuilder sql, List<Object> params, List<DataParam> dataParamList) {
|
||||
for (int i = 0; i < dataParamList.size(); i++) {
|
||||
if (i > 0) {
|
||||
sql.append(" OR ");
|
||||
}
|
||||
sql.append("(STCD = ? AND TM = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'))");
|
||||
DataParam item = dataParamList.get(i);
|
||||
params.add(item == null ? null : item.getId());
|
||||
params.add(item == null ? null : item.getTm());
|
||||
}
|
||||
}
|
||||
|
||||
private String buildWqHourLogSelectColumns() {
|
||||
return "ID,STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, " +
|
||||
"WTMP, PH, DOX, CODMN, CODCR, BOD5, NH3N, TP, TN, CU, ZN, F, SE, ARS, HG, CD, CR6, PB, CN, " +
|
||||
"VLPH, OIL, LAS, S2, FCG, CL, SO4, NO3, THRD, COND, FE, MN, AL, CHLA, CLARITY, TU, CYANO, " +
|
||||
"WQGRD, SFDB, WQ_SFDBHN_YS";
|
||||
}
|
||||
|
||||
private String buildWqDayLogSelectColumns() {
|
||||
return "STCD, TO_CHAR(DT, 'YYYY-MM-DD HH24:MI:SS') AS DT, " +
|
||||
"WTMP, PH, DOX, CODMN, CODCR, BOD5, NH3N, TP, TN, CU, ZN, F, SE, ARS, HG, CD, CR6, PB, CN, " +
|
||||
"VLPH, OIL, LAS, S2, FCG, CL, SO4, NO3, THRD, COND, FE, MN, AL, CHLA, CLARITY, TU, CYANO, " +
|
||||
"WQGRD, SFDB, IS_DELETED";
|
||||
}
|
||||
|
||||
private String buildWqMonthLogSelectColumns() {
|
||||
return "STCD, DRTP, YEAR, MONTH, " +
|
||||
"WTMP, PH, DOX, CODMN, CODCR, BOD5, NH3N, TP, TN, CU, ZN, F, SE, ARS, HG, CD, CR6, PB, CN, " +
|
||||
"VLPH, OIL, LAS, S2, FCG, CL, SO4, NO3, THRD, COND, FE, MN, AL, CHLA, CLARITY, TU, CYANO, " +
|
||||
"WQGRD, SFDB, IS_DELETED";
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> normalizeLogRows(List<Map<String, Object>> rows) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return result;
|
||||
}
|
||||
for (Map<String, Object> row : rows) {
|
||||
result.add(normalizeLogRow(row));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> normalizeLogRow(Map<String, Object> row) {
|
||||
Map<String, Object> normalized = new LinkedHashMap<>();
|
||||
if (row == null || row.isEmpty()) {
|
||||
return normalized;
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
normalized.put(entry.getKey() == null ? null : entry.getKey().toUpperCase(), entry.getValue());
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private void recordWqUpdateLog(Map<String, Object> beforeHour,
|
||||
Map<String, Object> beforeStation,
|
||||
Map<String, Object> updateData,
|
||||
String source) {
|
||||
if (updateData == null || updateData.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String stcd = asString(updateData.get("stcd"));
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : WQ_UPDATE_COLUMN_MAP.entrySet()) {
|
||||
if (!updateData.containsKey(entry.getKey())) {
|
||||
continue;
|
||||
}
|
||||
String column = entry.getValue();
|
||||
Object oldValue = beforeHour == null ? null : beforeHour.get(column);
|
||||
Object newValue = updateData.get(entry.getKey());
|
||||
if (StrUtil.equals(formatLogValue(oldValue), formatLogValue(newValue))) {
|
||||
continue;
|
||||
}
|
||||
details.add(buildWqDetail(null, WQ_HOUR_TABLE_NAME, stcd, column,
|
||||
oldValue, resolveWqDisplayValue(column, oldValue),
|
||||
newValue, resolveWqDisplayValue(column, newValue), "修改字段值"));
|
||||
}
|
||||
if (updateData.containsKey("wwqtg")) {
|
||||
Object oldValue = beforeStation == null ? null : beforeStation.get("WWQTG");
|
||||
Object newValue = updateData.get("wwqtg");
|
||||
if (!StrUtil.equals(formatLogValue(oldValue), formatLogValue(newValue))) {
|
||||
details.add(buildWqDetail(null, WQ_STATION_TABLE_NAME, stcd, "WWQTG",
|
||||
oldValue, resolveWqDisplayValue("WWQTG", oldValue),
|
||||
newValue, resolveWqDisplayValue("WWQTG", newValue), "修改字段值"));
|
||||
}
|
||||
}
|
||||
if (details.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String recordId = ObjectUtil.isNotEmpty(beforeHour) && ObjectUtil.isNotEmpty(beforeHour.get("ID"))
|
||||
? beforeHour.get("ID").toString()
|
||||
: null; MsOperationLog mainLog = buildWqMainLog(recordId,"修改水质小时数据", source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
detail.setMainId(mainLog.getId());
|
||||
}
|
||||
batchInsertWqLogDetails(details);
|
||||
}
|
||||
|
||||
private void recordWqDeleteLog(List<Map<String, Object>> rows, String tableName, String remark, String source) {
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return;
|
||||
}
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
String stcd = asString(row.get("STCD"));
|
||||
String recordId = asString(row.get("ID"));
|
||||
MsOperationLog mainLog = buildWqMainLog(recordId,remark, source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
String fieldCode = entry.getKey();
|
||||
if (StrUtil.isBlank(fieldCode)) {
|
||||
continue;
|
||||
}
|
||||
Object oldValue = entry.getValue();
|
||||
if (oldValue == null) {
|
||||
continue;
|
||||
}
|
||||
details.add(buildWqDetail(mainLog.getId(), tableName, stcd, fieldCode,
|
||||
oldValue, resolveWqDisplayValue(fieldCode, oldValue),
|
||||
null, null, "删除字段值"));
|
||||
}
|
||||
}
|
||||
batchInsertWqLogDetails(details);
|
||||
}
|
||||
|
||||
private MsOperationLog buildWqMainLog(String recordId,String remark, String source) {
|
||||
MsOperationLog log = new MsOperationLog();
|
||||
log.setOperator(resolveLogOperator());
|
||||
log.setRecordId(recordId);
|
||||
log.setOperateTime(new Date());
|
||||
log.setTableName(WQ_HOUR_TABLE_NAME);
|
||||
log.setSource(StrUtil.trimToNull(source));
|
||||
log.setRemark(remark);
|
||||
return log;
|
||||
}
|
||||
|
||||
private MsOperationLogDetail buildWqDetail(String mainId,
|
||||
String tableName,
|
||||
String stationCode,
|
||||
String fieldCode,
|
||||
Object oldValueCode,
|
||||
Object oldValueName,
|
||||
Object newValueCode,
|
||||
Object newValueName,
|
||||
String remark) {
|
||||
MsOperationLogDetail detail = new MsOperationLogDetail();
|
||||
detail.setMainId(mainId);
|
||||
detail.setTableName(tableName);
|
||||
detail.setStationCode(stationCode);
|
||||
detail.setFieldCode(fieldCode);
|
||||
detail.setFieldMeaning(WQ_FIELD_MEANING_MAP.getOrDefault(fieldCode, fieldCode));
|
||||
detail.setOldValueCode(formatLogValue(oldValueCode));
|
||||
detail.setOldValueName(formatLogValue(oldValueName));
|
||||
detail.setNewValueCode(formatLogValue(newValueCode));
|
||||
detail.setNewValueName(formatLogValue(newValueName));
|
||||
detail.setRemark(remark);
|
||||
return detail;
|
||||
}
|
||||
|
||||
private void batchInsertWqLogDetails(List<MsOperationLogDetail> details) {
|
||||
if (CollUtil.isEmpty(details)) {
|
||||
return;
|
||||
}
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
if (detail == null) {
|
||||
continue;
|
||||
}
|
||||
msOperationLogDetailMapper.insert(detail);
|
||||
}
|
||||
}
|
||||
|
||||
private Object resolveWqDisplayValue(String fieldCode, Object rawValue) {
|
||||
String text = formatLogValue(rawValue);
|
||||
if (StrUtil.isBlank(text)) {
|
||||
return rawValue;
|
||||
}
|
||||
return switch (fieldCode) {
|
||||
case "WQGRD", "WWQTG" -> getWqLevelName(text);
|
||||
case "SFDB" -> parseInteger(text) == null ? text : getSfdbName(parseInteger(text));
|
||||
default -> text;
|
||||
};
|
||||
}
|
||||
|
||||
private String resolveLogOperator() {
|
||||
try {
|
||||
return SecurityUtils.getCurrentUsername();
|
||||
} catch (Exception ignored) {
|
||||
try {
|
||||
return SecurityUtils.getUserId();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String formatLogValue(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Date date) {
|
||||
return DateUtil.formatDateTime(date);
|
||||
}
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
private String getMonthEndDate(Integer year, Integer month) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(year, month - 1, 1);
|
||||
@ -4182,4 +4542,205 @@ public class EnvWqDataServiceImpl implements EnvWqDataService {
|
||||
")";
|
||||
jdbcTemplate.update(mergeSql, stcd, startDate, endDate);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<EnvWqAnchorPointVo> getAnchorPointKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<EnvWqAnchorPointVo> dataSourceResult = new DataSourceResult<>();
|
||||
dataSourceResult.setAggregates(new HashMap<>());
|
||||
|
||||
if (dataSourceRequest == null) {
|
||||
dataSourceResult.setData(new ArrayList<>());
|
||||
dataSourceResult.setTotal(0L);
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
DataSourceLoadOptionsBase loadOptionsBase = dataSourceRequest.toDevRequest();
|
||||
String sttpCode = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "sttpCode");
|
||||
String time = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "tm");
|
||||
String fhFlag = QgcQueryWrapperUtil.getFilterFieldValue(loadOptionsBase, "fhFlag");
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append("t.STCD AS stcd, ")
|
||||
.append("t.STNM AS stnm, ")
|
||||
.append("t.STTP AS sttp, ")
|
||||
.append("t.STTP AS sttpCode, ")
|
||||
.append("t.LGTD AS lgtd, ")
|
||||
.append("t.LTTD AS lttd, ")
|
||||
.append("t.ELEV AS dtmel, ")
|
||||
.append("t.STLC AS stlc, ")
|
||||
.append("t.WWQTG AS wwqtg, ")
|
||||
.append("t.DTIN_TYPE AS dtinType, ")
|
||||
.append("t.RSTCD AS rstcd, ")
|
||||
.append("t.FHSTCD AS fhstcd, ")
|
||||
.append("t.ORDER_INDEX AS orderIndex, ")
|
||||
.append("eng.ENNM AS ennm, ")
|
||||
.append("hb.BASE_NAME AS baseName, ")
|
||||
.append("hb.BASEID AS baseId, ")
|
||||
.append("eng.HBRVCD AS hbrvcd, ")
|
||||
.append("NVL(hbrv.NAME, '') AS hbrvcdName, ")
|
||||
.append("NVL(rvcd.NAME, '') AS rvcdName, ")
|
||||
.append("NVL(addvcd.NAME, '') AS addvcdName, ")
|
||||
.append("NVL(along.ORDER_INDEX, 999999) AS rvcdStepSort, ")
|
||||
.append("NVL(rstSort.SORT, 999999) AS rstcdStepSort, ")
|
||||
.append("NVL(siteSort.SORT, 999999) AS siteStepSort, ")
|
||||
.append("NVL(hb.ORDER_INDEX, 999999) AS baseStepSort, ")
|
||||
.append("'' AS engLctn1Code, ")
|
||||
.append("'' AS engLctn3Code ")
|
||||
.append("FROM SD_WQ_B_H t ")
|
||||
.append("LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = t.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.CODE = eng.HBRVCD AND NVL(hbrv.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_RVCD_DIC rvcd ON rvcd.CODE = eng.RVCD AND NVL(rvcd.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_ADDVCD_DIC addvcd ON addvcd.CODE = eng.ADDVCD AND NVL(addvcd.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN MS_ALONG_B along ON along.RVCD = eng.HBRVCD AND along.CODE = 'common' AND NVL(along.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN ( ")
|
||||
.append(" SELECT det.SORT, cfg.RVCD, det.STCD ")
|
||||
.append(" FROM MS_ALONGDET_B det ")
|
||||
.append(" INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID ")
|
||||
.append(" WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common' ")
|
||||
.append(") rstSort ON rstSort.RVCD = eng.HBRVCD AND rstSort.STCD = t.RSTCD ")
|
||||
.append("LEFT JOIN ( ")
|
||||
.append(" SELECT det.SORT, cfg.RVCD, det.STCD ")
|
||||
.append(" FROM MS_ALONGDET_B det ")
|
||||
.append(" INNER JOIN MS_ALONG_B cfg ON det.ALONG_ID = cfg.ID ")
|
||||
.append(" WHERE NVL(det.IS_DELETED, 0) = 0 AND NVL(cfg.IS_DELETED, 0) = 0 AND cfg.CODE = 'common' ")
|
||||
.append(") siteSort ON siteSort.RVCD = eng.HBRVCD AND siteSort.STCD = t.STCD ")
|
||||
.append("WHERE NVL(t.IS_DELETED, 0) = 0 ")
|
||||
.append("AND NVL(t.USFL, 1) = 1 ")
|
||||
.append("AND t.LGTD IS NOT NULL ")
|
||||
.append("AND t.LTTD IS NOT NULL ");
|
||||
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<EnvWqAnchorPointVo> wqVoList = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), new HashMap<>(), EnvWqAnchorPointVo.class);
|
||||
|
||||
if (CollectionUtils.isNotEmpty(wqVoList)) {
|
||||
List<String> stcdList = wqVoList.stream()
|
||||
.filter(w -> StrUtil.isNotBlank(w.getStcd()))
|
||||
.map(w -> w.getStcd().trim())
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
String wqDataSql = "SELECT STCD, TM, WQGRD, SFDB, WTMP, PH, DOX, CODMN, CODCR, BOD5, NH3N, TP, TN, CU, ZN, F, SE, ARS, HG, CD, CR6, PB, CN, VLPH, OIL, LAS, S2, FCG, CL, SO4, NO3, THRD, COND, FE, MN, AL, CHLA, CLARITY, TU, CYANO, TOD " +
|
||||
"FROM ( " +
|
||||
" SELECT t.*, ROW_NUMBER() OVER (PARTITION BY t.STCD ORDER BY t.TM DESC) AS rn " +
|
||||
" FROM SD_WQ_R t " +
|
||||
" WHERE t.STCD IN (" + String.join(",", stcdList.stream().map(s -> "'" + s + "'").collect(Collectors.toList())) + ") " +
|
||||
" AND NVL(t.IS_DELETED, 0) = 0 " +
|
||||
") WHERE rn = 1";
|
||||
|
||||
List<EnvWqDataVo> wqDataList = microservicDynamicSQLMapper.getAllListWithResultType(wqDataSql, new HashMap<>(), EnvWqDataVo.class);
|
||||
Map<String, EnvWqDataVo> wqDataMap = wqDataList.stream()
|
||||
.collect(Collectors.toMap(EnvWqDataVo::getStcd, Function.identity(), (oldValue, newValue) -> newValue));
|
||||
|
||||
for (EnvWqAnchorPointVo anchorPointVo : wqVoList) {
|
||||
EnvWqDataVo wqData = wqDataMap.get(anchorPointVo.getStcd());
|
||||
if (wqData != null) {
|
||||
anchorPointVo.setTm(wqData.getTm());
|
||||
anchorPointVo.setWqGrd(wqData.getWqgrd());
|
||||
anchorPointVo.setSfdb(wqData.getSfdb());
|
||||
anchorPointVo.setWtmp(wqData.getWtmp());
|
||||
anchorPointVo.setPh(wqData.getPh());
|
||||
anchorPointVo.setDox(wqData.getDox());
|
||||
anchorPointVo.setCodmn(wqData.getCodmn());
|
||||
anchorPointVo.setCodcr(wqData.getCodcr());
|
||||
anchorPointVo.setBod5(wqData.getBod5());
|
||||
anchorPointVo.setNh3n(wqData.getNh3n());
|
||||
anchorPointVo.setTp(wqData.getTp());
|
||||
anchorPointVo.setTn(wqData.getTn());
|
||||
anchorPointVo.setCu(wqData.getCu());
|
||||
anchorPointVo.setZn(wqData.getZn());
|
||||
anchorPointVo.setF(wqData.getF());
|
||||
anchorPointVo.setSe(wqData.getSe());
|
||||
anchorPointVo.setArs(wqData.getArs());
|
||||
anchorPointVo.setHg(wqData.getHg());
|
||||
anchorPointVo.setCd(wqData.getCd());
|
||||
anchorPointVo.setCr6(wqData.getCr6());
|
||||
anchorPointVo.setPb(wqData.getPb());
|
||||
anchorPointVo.setCn(wqData.getCn());
|
||||
anchorPointVo.setVlph(wqData.getVlph());
|
||||
anchorPointVo.setOil(wqData.getOil());
|
||||
anchorPointVo.setLas(wqData.getLas());
|
||||
anchorPointVo.setS2(wqData.getS2());
|
||||
anchorPointVo.setFcg(wqData.getFcg());
|
||||
anchorPointVo.setCl(wqData.getCl());
|
||||
anchorPointVo.setSo4(wqData.getSo4());
|
||||
anchorPointVo.setNo3(wqData.getNo3());
|
||||
anchorPointVo.setThrd(wqData.getThrd());
|
||||
anchorPointVo.setCond(wqData.getCond());
|
||||
anchorPointVo.setFe(wqData.getFe());
|
||||
anchorPointVo.setMn(wqData.getMn());
|
||||
anchorPointVo.setAl(wqData.getAl());
|
||||
anchorPointVo.setChla(wqData.getChla());
|
||||
anchorPointVo.setClarity(wqData.getClarity());
|
||||
anchorPointVo.setTu(wqData.getTu());
|
||||
anchorPointVo.setCyano(wqData.getCyano());
|
||||
anchorPointVo.setTod(wqData.getTod());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (EnvWqAnchorPointVo anchorPointVo : wqVoList) {
|
||||
anchorPointVo.setSttpMap(anchorPointVo.getSttp());
|
||||
anchorPointVo.setTitleName(anchorPointVo.getStnm());
|
||||
anchorPointVo.setAnchoPointState(getAnchorPoint(anchorPointVo));
|
||||
|
||||
if (StrUtil.isNotBlank(sttpCode) && "WQFB".equals(sttpCode)) {
|
||||
anchorPointVo.setAnchoPointState("wqfb_legend");
|
||||
}
|
||||
if (StrUtil.isNotBlank(fhFlag)) {
|
||||
anchorPointVo.setAnchoPointState("fhwq_legend");
|
||||
}
|
||||
}
|
||||
|
||||
SiteAvoidanceUtils.calcSiteMapLev(wqVoList,
|
||||
EnvWqAnchorPointVo::getStcd,
|
||||
EnvWqAnchorPointVo::getLgtd,
|
||||
EnvWqAnchorPointVo::getLttd,
|
||||
EnvWqAnchorPointVo::getAnchoPointState,
|
||||
EnvWqAnchorPointVo::setDistance);
|
||||
|
||||
dataSourceResult.setData(wqVoList);
|
||||
dataSourceResult.setTotal(page == null ? wqVoList.size() : page.getTotal());
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
private String getAnchorPoint(EnvWqAnchorPointVo anchorPointVo) {
|
||||
Integer dtinType = anchorPointVo.getDtinType();
|
||||
Integer sfdb = anchorPointVo.getSfdb();
|
||||
|
||||
if (dtinType == null) {
|
||||
dtinType = 2;
|
||||
}
|
||||
if (sfdb == null) {
|
||||
sfdb = 2;
|
||||
}
|
||||
|
||||
if (dtinType == 0) {
|
||||
if (sfdb == 0) {
|
||||
return "wq_station_4";
|
||||
} else if (sfdb == 1) {
|
||||
return "wq_station_3";
|
||||
} else {
|
||||
return "wq_station_8";
|
||||
}
|
||||
} else if (dtinType == 1) {
|
||||
if (sfdb == 0) {
|
||||
return "wq_station_2";
|
||||
} else if (sfdb == 1) {
|
||||
return "wq_station_1";
|
||||
} else {
|
||||
return "wq_station_7";
|
||||
}
|
||||
} else {
|
||||
if (sfdb == 0) {
|
||||
return "wq_station_6";
|
||||
} else if (sfdb == 1) {
|
||||
return "wq_station_5";
|
||||
} else {
|
||||
return "wq_station_9";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,12 +2,14 @@ package com.yfd.platform.qgc_env.wt.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.annotation.Log;
|
||||
import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtOperateRequest;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvInfo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvAmendSaveVo;
|
||||
import com.yfd.platform.qgc_env.wt.service.*;
|
||||
@ -54,10 +56,14 @@ public class SdWTMonitorController {
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
|
||||
@Log(module = "水温监测", value = "修改表层水温日数据")
|
||||
@PostMapping("/alongDetail/updateWtrvRData")
|
||||
@Operation(summary = "修改表层水温日数据")
|
||||
public ResponseResult updateWtrvRData(@RequestBody Map<String, Object> updateData) {
|
||||
alongDetailService.updateWtrvRData(updateData);
|
||||
public ResponseResult updateWtrvRData(@RequestBody WtOperateRequest wtOperateRequest) {
|
||||
alongDetailService.updateWtrvRData(
|
||||
wtOperateRequest == null ? null : wtOperateRequest.getUpdateData(),
|
||||
wtOperateRequest == null ? null : wtOperateRequest.getSource()
|
||||
);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ -75,6 +81,7 @@ public class SdWTMonitorController {
|
||||
return ResponseResult.successData(result);
|
||||
}
|
||||
|
||||
@Log(module = "水温监测", value = "删除出库水温周旬月季年数据")
|
||||
@PostMapping("/alongDetail/drtp/removeKendoByIds")
|
||||
@Operation(summary = "删除出库水温周旬月季年数据")
|
||||
public ResponseResult removeKendoByIds(@RequestBody BatchDeleteAo batchDeleteAo) {
|
||||
@ -236,6 +243,7 @@ public class SdWTMonitorController {
|
||||
return ResponseResult.successData(sdWtMonitorService.getCxDetailList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@Log(module = "水温监测", value = "删除垂向水温数据")
|
||||
@PostMapping("/cxDetail/removeKendoByIds")
|
||||
@Operation(summary = "删除垂向水温数据")
|
||||
public ResponseResult removeCxDetailByIds(@RequestBody BatchDeleteAo batchDeleteAo) {
|
||||
@ -243,10 +251,14 @@ public class SdWTMonitorController {
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@Log(module = "水温监测", value = "修改垂向水温数据")
|
||||
@PostMapping("/cxDetail/updateWtvtRData")
|
||||
@Operation(summary = "修改垂向水温数据")
|
||||
public ResponseResult updateWtvtRData(@RequestBody Map<String, Object> updateData) {
|
||||
sdWtvtRService.updateWtvtRData(updateData);
|
||||
public ResponseResult updateWtvtRData(@RequestBody WtOperateRequest wtOperateRequest) {
|
||||
sdWtvtRService.updateWtvtRData(
|
||||
wtOperateRequest == null ? null : wtOperateRequest.getUpdateData(),
|
||||
wtOperateRequest == null ? null : wtOperateRequest.getSource()
|
||||
);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@ -309,4 +321,10 @@ public class SdWTMonitorController {
|
||||
public ResponseResult getOneLevelListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(sdDzChuiXiangListService.processKendoList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/getFacilityPointList/GetKendoListCust")
|
||||
@Operation(summary = "低温水减缓设施描点")
|
||||
public ResponseResult getFacilityPointKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(sdWtMonitorService.getFacilityPointKendoListCust(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,83 @@
|
||||
package com.yfd.platform.qgc_env.wt.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Schema(description = "低温水减缓设施描点VO")
|
||||
public class DwSlowFacilityMapVO {
|
||||
|
||||
@Schema(description = "站点编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "关联电站编码")
|
||||
private String rstcd;
|
||||
|
||||
@Schema(description = "关联电站编码(冗余)")
|
||||
private String rstcds;
|
||||
|
||||
@Schema(description = "站名")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "标题名称")
|
||||
private String titleName;
|
||||
|
||||
@Schema(description = "站点类型编码")
|
||||
private String sttpCode;
|
||||
|
||||
@Schema(description = "站点类型映射")
|
||||
private String sttpMap;
|
||||
|
||||
@Schema(description = "描点状态")
|
||||
private String anchoPointState;
|
||||
|
||||
@Schema(description = "地图避让")
|
||||
private Integer distance;
|
||||
|
||||
@Schema(description = "建设状态 0=规划,1=在建,2=已建")
|
||||
private String bldstt;
|
||||
|
||||
@Schema(description = "经度")
|
||||
private BigDecimal lgtd;
|
||||
|
||||
@Schema(description = "纬度")
|
||||
private BigDecimal lttd;
|
||||
|
||||
@Schema(description = "遥测方式")
|
||||
private String dtmel;
|
||||
|
||||
@Schema(description = "流域编码")
|
||||
private String rvcd;
|
||||
|
||||
@Schema(description = "行政区编码")
|
||||
private String addvcd;
|
||||
|
||||
@Schema(description = "基地编码")
|
||||
private String baseId;
|
||||
|
||||
@Schema(description = "关联电站名称")
|
||||
private String ennm;
|
||||
|
||||
@Schema(description = "运行状态")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "站点类型")
|
||||
private String sttp;
|
||||
|
||||
@Schema(description = "设施类型")
|
||||
private String dwtp;
|
||||
|
||||
@Schema(description = "设施类型名称")
|
||||
private String dwtpName;
|
||||
|
||||
@Schema(description = "站点类型名称")
|
||||
private String sttpName;
|
||||
|
||||
@Schema(description = "是否接入:0=未接入 1=已接入")
|
||||
private Integer dtin;
|
||||
|
||||
@Schema(description = "达标状态子类型(1=正常运行,2=暂无数据,3=未正常运行)")
|
||||
private Integer stdSstate;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.platform.qgc_env.wt.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class WtOperateRequest {
|
||||
|
||||
private String source;
|
||||
|
||||
private Map<String, Object> updateData;
|
||||
}
|
||||
@ -43,6 +43,6 @@ public interface AlongDetailService extends IService<SdAlongDetailVO> {
|
||||
|
||||
boolean removeKendoByIds(BatchDeleteAo batchDeleteAo);
|
||||
|
||||
void updateWtrvRData(Map<String, Object> updateData);
|
||||
void updateWtrvRData(Map<String, Object> updateData, String source);
|
||||
|
||||
}
|
||||
@ -13,6 +13,7 @@ import com.yfd.platform.qgc_env.wt.entity.vo.WtBaseInfoVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvAmendSaveVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvAmendResultVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.DwSlowFacilityMapVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -51,4 +52,6 @@ public interface SdWtMonitorService {
|
||||
DataSourceResult<SdMonthDetailVO> getMonthDetailList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
List<RstcdTreeInfoVo> getWtvtDefaultTreeStcd(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<DwSlowFacilityMapVO> getFacilityPointKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -24,5 +24,5 @@ public interface SdWtvtRService {
|
||||
|
||||
boolean removeKendoByIds(BatchDeleteAo batchDeleteAo);
|
||||
|
||||
void updateWtvtRData(Map<String, Object> updateData);
|
||||
void updateWtvtRData(Map<String, Object> updateData, String source);
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.common.*;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLog;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLogDetail;
|
||||
import com.yfd.platform.qgc_env.wt.mapper.AlongDetailMapper;
|
||||
import com.yfd.platform.qgc_env.wt.mapper.SdWtrvdrtpSMapper;
|
||||
import com.yfd.platform.qgc_env.wt.service.AlongDetailService;
|
||||
@ -17,6 +19,8 @@ import com.yfd.platform.qgc_env.wt.entity.vo.SdAlongDrtpDetailVO;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvInfo;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_base.entity.vo.DataParam;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogDetailMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogMapper;
|
||||
import com.yfd.platform.utils.CollectionExtUtils;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
@ -37,6 +41,29 @@ import java.util.stream.Collectors;
|
||||
*/
|
||||
@Service
|
||||
public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlongDetailVO> implements AlongDetailService {
|
||||
private static final String WT_HOUR_TABLE_NAME = "SD_WTRV_R";
|
||||
private static final Map<String, String> WT_UPDATE_COLUMN_MAP = new LinkedHashMap<>();
|
||||
private static final Map<String, String> WT_FIELD_MEANING_MAP = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
WT_UPDATE_COLUMN_MAP.put("wt", "WT");
|
||||
|
||||
WT_FIELD_MEANING_MAP.put("ID", "主键ID");
|
||||
WT_FIELD_MEANING_MAP.put("STCD", "水温站编码");
|
||||
WT_FIELD_MEANING_MAP.put("TM", "数据时间");
|
||||
WT_FIELD_MEANING_MAP.put("WT", "水温");
|
||||
WT_FIELD_MEANING_MAP.put("REMARK", "备注");
|
||||
WT_FIELD_MEANING_MAP.put("FID", "附件ID");
|
||||
WT_FIELD_MEANING_MAP.put("WER_ID", "所属水生生态调查数据表ID");
|
||||
WT_FIELD_MEANING_MAP.put("RECORD_USER", "创建人");
|
||||
WT_FIELD_MEANING_MAP.put("RECORD_TIME", "创建时间");
|
||||
WT_FIELD_MEANING_MAP.put("MODIFY_USER", "更新人");
|
||||
WT_FIELD_MEANING_MAP.put("MODIFY_TIME", "更新时间");
|
||||
WT_FIELD_MEANING_MAP.put("IS_DELETED", "是否已删除");
|
||||
WT_FIELD_MEANING_MAP.put("DELETE_USER", "删除人");
|
||||
WT_FIELD_MEANING_MAP.put("DELETE_TIME", "删除时间");
|
||||
}
|
||||
|
||||
@Resource
|
||||
private DynamicSQLMapper dynamicSQLMapper;
|
||||
@Resource
|
||||
@ -50,6 +77,12 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
|
||||
@Resource
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogMapper msOperationLogMapper;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogDetailMapper msOperationLogDetailMapper;
|
||||
|
||||
@Override
|
||||
public DataSourceResult processKendoList(DataSourceRequest dataSourceRequest, Map<String, GroupResult> filterResult, Page page) {
|
||||
DataSourceResult dataSourceResult = new DataSourceResult();
|
||||
@ -799,6 +832,7 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
|
||||
public boolean removeKendoByIds(BatchDeleteAo batchDeleteAo) {
|
||||
String dataType = batchDeleteAo.getDataType();
|
||||
List<DataParam> dataList = batchDeleteAo.getDataList();
|
||||
String source = batchDeleteAo == null ? null : batchDeleteAo.getSource();
|
||||
if(CollUtil.isEmpty(dataList)){
|
||||
return true;
|
||||
}
|
||||
@ -816,7 +850,9 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
|
||||
|
||||
}
|
||||
if ("TIME".equals(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryWtHourRows(subList);
|
||||
sdWtrvdrtpSMapper.deleteWtrvRData(subList, DateUtil.now(), SecurityUtils.getCurrentUsername());
|
||||
recordWtDeleteLog(beforeRows, "删除表层水温日数据", source);
|
||||
// 删除小时数据后,需要重新统计对应的日数据和月数据
|
||||
Map<String, String[]> dateRangeMap = new HashMap<>();
|
||||
Map<String, String[]> monthRangeMap = new HashMap<>();
|
||||
@ -1048,13 +1084,14 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
|
||||
|
||||
|
||||
@Override
|
||||
public void updateWtrvRData(Map<String, Object> updateData) {
|
||||
public void updateWtrvRData(Map<String, Object> updateData, String source) {
|
||||
String stcd = asString(getValueIgnoreCase(updateData, "stcd"));
|
||||
String tm = asString(getValueIgnoreCase(updateData, "dt"));
|
||||
Map<String, Object> beforeRow = queryWtHourRow(stcd, tm);
|
||||
sdWtrvdrtpSMapper.updateWtrvRData(updateData);
|
||||
recordWtUpdateLog(beforeRow, updateData, source);
|
||||
|
||||
// 获取测站编码和时间
|
||||
String stcd = (String) updateData.get("stcd");
|
||||
String tm = (String) updateData.get("dt");
|
||||
|
||||
if (StrUtil.isNotBlank(stcd) && StrUtil.isNotBlank(tm)) {
|
||||
// 提取日期部分(yyyy-MM-dd)
|
||||
String dateStr = tm.substring(0, 10);
|
||||
@ -1074,4 +1111,204 @@ public class AlongDetailServiceImpl extends ServiceImpl<AlongDetailMapper, SdAlo
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Map<String, Object> queryWtHourRow(String stcd, String tm) {
|
||||
if (StrUtil.isBlank(stcd) || StrUtil.isBlank(tm)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
String sql = "SELECT ID, STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, WT, REMARK, FID, WER_ID, " +
|
||||
"RECORD_USER, RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME " +
|
||||
"FROM SD_WTRV_R WHERE STCD = ? AND TM = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')";
|
||||
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, stcd, tm);
|
||||
return rows.isEmpty() ? new HashMap<>() : normalizeWtLogRow(rows.getFirst());
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryWtHourRows(List<DataParam> dataParamList) {
|
||||
if (CollUtil.isEmpty(dataParamList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ID, STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, WT, REMARK, FID, WER_ID, ")
|
||||
.append("RECORD_USER, RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME ")
|
||||
.append("FROM SD_WTRV_R WHERE ");
|
||||
List<Object> params = new ArrayList<>();
|
||||
for (int i = 0; i < dataParamList.size(); i++) {
|
||||
if (i > 0) {
|
||||
sql.append(" OR ");
|
||||
}
|
||||
sql.append("(STCD = ? AND TM = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'))");
|
||||
DataParam item = dataParamList.get(i);
|
||||
params.add(item == null ? null : item.getId());
|
||||
params.add(item == null ? null : item.getDt());
|
||||
}
|
||||
return normalizeWtLogRows(jdbcTemplate.queryForList(sql.toString(), params.toArray()));
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> normalizeWtLogRows(List<Map<String, Object>> rows) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return result;
|
||||
}
|
||||
for (Map<String, Object> row : rows) {
|
||||
result.add(normalizeWtLogRow(row));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> normalizeWtLogRow(Map<String, Object> row) {
|
||||
Map<String, Object> normalized = new LinkedHashMap<>();
|
||||
if (row == null || row.isEmpty()) {
|
||||
return normalized;
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
normalized.put(entry.getKey() == null ? null : entry.getKey().toUpperCase(), entry.getValue());
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private void recordWtUpdateLog(Map<String, Object> beforeRow, Map<String, Object> updateData, String source) {
|
||||
if (updateData == null || updateData.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String stcd = asString(getValueIgnoreCase(updateData, "stcd"));
|
||||
String recordId = asString(getValueIgnoreCase(beforeRow, "id"));
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : WT_UPDATE_COLUMN_MAP.entrySet()) {
|
||||
if (!containsKeyIgnoreCase(updateData, entry.getKey())) {
|
||||
continue;
|
||||
}
|
||||
String column = entry.getValue();
|
||||
Object oldValue = beforeRow == null ? null : beforeRow.get(column);
|
||||
Object newValue = getValueIgnoreCase(updateData, entry.getKey());
|
||||
if (StrUtil.equals(formatWtLogValue(oldValue), formatWtLogValue(newValue))) {
|
||||
continue;
|
||||
}
|
||||
details.add(buildWtDetail(null, stcd, column,
|
||||
oldValue, resolveWtDisplayValue(column, oldValue),
|
||||
newValue, resolveWtDisplayValue(column, newValue), "修改字段值"));
|
||||
}
|
||||
if (details.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
MsOperationLog mainLog = buildWtMainLog(recordId,"修改表层水温日数据", source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
detail.setMainId(mainLog.getId());
|
||||
}
|
||||
batchInsertWtLogDetails(details);
|
||||
}
|
||||
|
||||
private void recordWtDeleteLog(List<Map<String, Object>> rows, String remark, String source) {
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
String stcd = asString(row.get("STCD"));
|
||||
String recordId = asString(row.get("ID"));
|
||||
MsOperationLog mainLog = buildWtMainLog(recordId,remark, source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
String fieldCode = entry.getKey();
|
||||
Object oldValue = entry.getValue();
|
||||
if (StrUtil.isBlank(fieldCode) || oldValue == null) {
|
||||
continue;
|
||||
}
|
||||
details.add(buildWtDetail(mainLog.getId(), stcd, fieldCode,
|
||||
oldValue, resolveWtDisplayValue(fieldCode, oldValue),
|
||||
null, null, "删除字段值"));
|
||||
}
|
||||
}
|
||||
batchInsertWtLogDetails(details);
|
||||
}
|
||||
|
||||
private MsOperationLog buildWtMainLog(String recordId,String remark, String source) {
|
||||
MsOperationLog log = new MsOperationLog();
|
||||
log.setOperator(resolveWtLogOperator());
|
||||
log.setOperateTime(new Date());
|
||||
log.setRecordId(recordId);
|
||||
log.setTableName(WT_HOUR_TABLE_NAME);
|
||||
log.setSource(StrUtil.trimToNull(source));
|
||||
log.setRemark(remark);
|
||||
return log;
|
||||
}
|
||||
|
||||
private MsOperationLogDetail buildWtDetail(String mainId,
|
||||
String stationCode,
|
||||
String fieldCode,
|
||||
Object oldValueCode,
|
||||
Object oldValueName,
|
||||
Object newValueCode,
|
||||
Object newValueName,
|
||||
String remark) {
|
||||
MsOperationLogDetail detail = new MsOperationLogDetail();
|
||||
detail.setMainId(mainId);
|
||||
detail.setTableName(WT_HOUR_TABLE_NAME);
|
||||
detail.setStationCode(stationCode);
|
||||
detail.setFieldCode(fieldCode);
|
||||
detail.setFieldMeaning(WT_FIELD_MEANING_MAP.getOrDefault(fieldCode, fieldCode));
|
||||
detail.setOldValueCode(formatWtLogValue(oldValueCode));
|
||||
detail.setOldValueName(formatWtLogValue(oldValueName));
|
||||
detail.setNewValueCode(formatWtLogValue(newValueCode));
|
||||
detail.setNewValueName(formatWtLogValue(newValueName));
|
||||
detail.setRemark(remark);
|
||||
return detail;
|
||||
}
|
||||
|
||||
private void batchInsertWtLogDetails(List<MsOperationLogDetail> details) {
|
||||
if (CollUtil.isEmpty(details)) {
|
||||
return;
|
||||
}
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
if (detail == null) {
|
||||
continue;
|
||||
}
|
||||
msOperationLogDetailMapper.insert(detail);
|
||||
}
|
||||
}
|
||||
|
||||
private Object resolveWtDisplayValue(String fieldCode, Object rawValue) {
|
||||
return formatWtLogValue(rawValue);
|
||||
}
|
||||
|
||||
private String resolveWtLogOperator() {
|
||||
try {
|
||||
return SecurityUtils.getCurrentUsername();
|
||||
} catch (Exception ignored) {
|
||||
try {
|
||||
return SecurityUtils.getUserId();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String formatWtLogValue(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Date date) {
|
||||
return DateUtil.formatDateTime(date);
|
||||
}
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
private String asString(Object value) {
|
||||
return value == null ? null : String.valueOf(value);
|
||||
}
|
||||
|
||||
private boolean containsKeyIgnoreCase(Map<String, Object> data, String key) {
|
||||
if (data == null || StrUtil.isBlank(key)) {
|
||||
return false;
|
||||
}
|
||||
if (data.containsKey(key)) {
|
||||
return true;
|
||||
}
|
||||
for (String mapKey : data.keySet()) {
|
||||
if (StrUtil.equalsIgnoreCase(mapKey, key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -20,7 +20,9 @@ import com.yfd.platform.qgc_env.wt.entity.vo.WtTreeStcdVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvAmendResultVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvAmendSaveVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.WtrvVo;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.DwSlowFacilityMapVO;
|
||||
import com.yfd.platform.qgc_env.wt.mapper.SdWtMonitorMapper;
|
||||
import com.yfd.platform.qgc_env.wt.utils.SiteAvoidanceUtils;
|
||||
import com.yfd.platform.qgc_env.wt.service.SdWtMonitorService;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import jakarta.annotation.Resource;
|
||||
@ -2830,4 +2832,93 @@ public class SdWtMonitorServiceImpl implements SdWtMonitorService {
|
||||
private String ennm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<DwSlowFacilityMapVO> getFacilityPointKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<DwSlowFacilityMapVO> dataSourceResult = new DataSourceResult<>();
|
||||
dataSourceResult.setAggregates(new HashMap<>());
|
||||
|
||||
if (dataSourceRequest == null) {
|
||||
dataSourceResult.setData(new ArrayList<>());
|
||||
dataSourceResult.setTotal(0L);
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
DataSourceLoadOptionsBase devRequest = dataSourceRequest.toDevRequest();
|
||||
String bldsttCcode = QgcQueryWrapperUtil.getFilterFieldValue(devRequest, "bldsttCcode");
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append("t.STCD AS stcd, ")
|
||||
.append("t.RSTCD AS rstcd, ")
|
||||
.append("t.RSTCD AS rstcds, ")
|
||||
.append("t.STNM AS stnm, ")
|
||||
.append("t.STNM AS titleName, ")
|
||||
.append("t.STTP AS sttpCode, ")
|
||||
.append("t.STTP AS sttpMap, ")
|
||||
.append("t.STTP AS anchoPointState, ")
|
||||
.append("t.BLDSTT_CODE AS bldstt, ")
|
||||
.append("t.LGTD AS lgtd, ")
|
||||
.append("t.LTTD AS lttd, ")
|
||||
.append("CAST(NULL AS NUMBER) AS dtmel, ")
|
||||
.append("eng.RVCD AS rvcd, ")
|
||||
.append("eng.ADDVCD AS addvcd, ")
|
||||
.append("eng.BASE_ID AS baseId, ")
|
||||
.append("eng.ENNM AS ennm, ")
|
||||
.append("NULL AS status, ")
|
||||
.append("t.STTP AS sttp, ")
|
||||
.append("t.STTP AS dwtp, ")
|
||||
.append("sttp.STTP_NAME AS dwtpName, ")
|
||||
.append("sttp.STTP_NAME AS sttpName, ")
|
||||
.append("t.DTIN AS dtin, ")
|
||||
.append("NULL AS stdSstate ")
|
||||
.append("FROM SD_DFLTKW_B_H t ")
|
||||
.append("LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = t.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_STTP_B sttp ON sttp.STTP_CODE = t.STTP AND NVL(sttp.IS_DELETED, 0) = 0 ")
|
||||
.append("WHERE NVL(t.IS_DELETED, 0) = 0 ")
|
||||
.append("AND NVL(t.USFL, 1) = 1 ")
|
||||
.append("AND t.LGTD IS NOT NULL ")
|
||||
.append("AND t.LTTD IS NOT NULL ");
|
||||
|
||||
if (StrUtil.isNotEmpty(bldsttCcode)) {
|
||||
sql.append(" AND t.BLDSTT_CODE = #{map.bldsttCcode} ");
|
||||
}
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
if (StrUtil.isNotEmpty(bldsttCcode)) {
|
||||
paramMap.put("bldsttCcode", bldsttCcode);
|
||||
}
|
||||
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<DwSlowFacilityMapVO> resultList = microservicDynamicSQLMapper.pageAllListWithResultType(page, sql.toString(), paramMap, DwSlowFacilityMapVO.class);
|
||||
|
||||
for (DwSlowFacilityMapVO vo : resultList) {
|
||||
String sttpCode = vo.getSttpCode();
|
||||
String bldstt = vo.getBldstt();
|
||||
boolean isBuilt = "2".equals(bldstt);
|
||||
|
||||
if ("DW_2".equals(sttpCode)) {
|
||||
vo.setAnchoPointState(isBuilt ? "dws_1" : "dws_1_incomplete");
|
||||
} else if ("DW_5".equals(sttpCode)) {
|
||||
vo.setAnchoPointState(isBuilt ? "dws_2" : "dws_2_incomplete");
|
||||
} else if ("DW_6".equals(sttpCode)) {
|
||||
vo.setAnchoPointState(isBuilt ? "dws_3" : "dws_3_incomplete");
|
||||
} else {
|
||||
vo.setAnchoPointState(isBuilt ? "dws_4" : "dws_4_incomplete");
|
||||
}
|
||||
vo.setSttpCode("DW");
|
||||
}
|
||||
|
||||
SiteAvoidanceUtils.calcSiteMapLev(resultList,
|
||||
DwSlowFacilityMapVO::getStcd,
|
||||
DwSlowFacilityMapVO::getLgtd,
|
||||
DwSlowFacilityMapVO::getLttd,
|
||||
DwSlowFacilityMapVO::getAnchoPointState,
|
||||
DwSlowFacilityMapVO::setDistance);
|
||||
|
||||
dataSourceResult.setData(resultList);
|
||||
dataSourceResult.setTotal(page == null ? resultList.size() : page.getTotal());
|
||||
return dataSourceResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,13 +1,18 @@
|
||||
package com.yfd.platform.qgc_env.wt.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.yfd.platform.common.DataSourceLoadOptionsBase;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLog;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLogDetail;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_base.entity.vo.DataParam;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogDetailMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogMapper;
|
||||
import com.yfd.platform.qgc_env.wt.entity.vo.SdWtvtYearVo;
|
||||
import com.yfd.platform.qgc_env.wt.mapper.SdWtvtRMapper;
|
||||
import com.yfd.platform.qgc_env.wt.service.SdWtvtRService;
|
||||
@ -22,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@ -37,6 +43,28 @@ import java.util.Set;
|
||||
*/
|
||||
@Service
|
||||
public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo> implements SdWtvtRService {
|
||||
private static final String WT_CX_TABLE_NAME = "SD_WTVT_R";
|
||||
private static final Map<String, String> WT_CX_FIELD_MEANING_MAP = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
WT_CX_FIELD_MEANING_MAP.put("ID", "主键ID");
|
||||
WT_CX_FIELD_MEANING_MAP.put("STCD", "垂向水温站编码");
|
||||
WT_CX_FIELD_MEANING_MAP.put("TM", "时间");
|
||||
WT_CX_FIELD_MEANING_MAP.put("WTHG", "水温深度");
|
||||
WT_CX_FIELD_MEANING_MAP.put("VWT", "水温");
|
||||
WT_CX_FIELD_MEANING_MAP.put("FID", "附件ID");
|
||||
WT_CX_FIELD_MEANING_MAP.put("RECORD_USER", "创建人");
|
||||
WT_CX_FIELD_MEANING_MAP.put("RECORD_TIME", "创建时间");
|
||||
WT_CX_FIELD_MEANING_MAP.put("MODIFY_USER", "更新人");
|
||||
WT_CX_FIELD_MEANING_MAP.put("MODIFY_TIME", "更新时间");
|
||||
WT_CX_FIELD_MEANING_MAP.put("IS_DELETED", "是否已删除");
|
||||
WT_CX_FIELD_MEANING_MAP.put("DELETE_USER", "删除人");
|
||||
WT_CX_FIELD_MEANING_MAP.put("DELETE_TIME", "删除时间");
|
||||
WT_CX_FIELD_MEANING_MAP.put("RZ", "坝前水位");
|
||||
WT_CX_FIELD_MEANING_MAP.put("HGT", "测点高程");
|
||||
WT_CX_FIELD_MEANING_MAP.put("REMARK", "备注");
|
||||
WT_CX_FIELD_MEANING_MAP.put("WER_ID", "所属水生生态调查数据表ID");
|
||||
}
|
||||
|
||||
@Resource
|
||||
private SdWtvtRMapper sdWtvtRMapper;
|
||||
@ -47,6 +75,12 @@ public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo>
|
||||
@Resource
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogMapper msOperationLogMapper;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogDetailMapper msOperationLogDetailMapper;
|
||||
|
||||
@Override
|
||||
public DataSourceResult getWtrvDefaultYear(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceResult<SdWtvtYearVo> dataSourceResult = new DataSourceResult<>();
|
||||
@ -91,6 +125,7 @@ public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo>
|
||||
public boolean removeKendoByIds(BatchDeleteAo batchDeleteAo) {
|
||||
String dataType = batchDeleteAo == null ? null : batchDeleteAo.getDataType();
|
||||
List<DataParam> dataList = batchDeleteAo == null ? null : batchDeleteAo.getDataList();
|
||||
String source = batchDeleteAo == null ? null : batchDeleteAo.getSource();
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return true;
|
||||
}
|
||||
@ -104,7 +139,9 @@ public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo>
|
||||
continue;
|
||||
}
|
||||
if ("TIME".equalsIgnoreCase(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryWtvtRows(subList);
|
||||
deleteWtvtRData(subList);
|
||||
recordWtvtDeleteLog(beforeRows, "删除垂向水温数据", source);
|
||||
Map<String, String[]> dateRangeMap = new HashMap<>();
|
||||
Map<String, String[]> monthRangeMap = new HashMap<>();
|
||||
for (DataParam param : subList) {
|
||||
@ -160,7 +197,7 @@ public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo>
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateWtvtRData(Map<String, Object> updateData) {
|
||||
public void updateWtvtRData(Map<String, Object> updateData, String source) {
|
||||
if (updateData == null || updateData.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
@ -171,7 +208,10 @@ public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo>
|
||||
return;
|
||||
}
|
||||
|
||||
Map<String, Map<String, Object>> beforeRowMap = buildWtvtBeforeRowMap(stcd, dt);
|
||||
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
List<MsOperationLogDetail> logDetails = new ArrayList<>();
|
||||
rawMap.forEach((wthgObj, vwtObj) -> {
|
||||
if (wthgObj == null) {
|
||||
return;
|
||||
@ -192,12 +232,32 @@ public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo>
|
||||
// item.put("recordUser", "admin");
|
||||
item.put("recordUser", SecurityUtils.getUserId());
|
||||
dataList.add(item);
|
||||
|
||||
String depthKey = buildWtvtDepthKey(item.get("wthg"));
|
||||
Map<String, Object> beforeRow = beforeRowMap.get(depthKey);
|
||||
Object oldValue = beforeRow == null ? null : beforeRow.get("VWT");
|
||||
Object newValue = item.get("vwt");
|
||||
if (StringUtils.equals(formatWtvtLogValue(oldValue), formatWtvtLogValue(newValue))) {
|
||||
return;
|
||||
}
|
||||
logDetails.add(buildWtvtDetail(null, stcd, "VWT",
|
||||
oldValue, resolveWtvtDisplayValue("VWT", oldValue),
|
||||
newValue, resolveWtvtDisplayValue("VWT", newValue),
|
||||
buildWtvtDepthRemark("修改字段值", item.get("wthg"))));
|
||||
});
|
||||
|
||||
if (dataList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
batchUpdateWtvtRData(dataList);
|
||||
if (CollUtil.isNotEmpty(logDetails)) {
|
||||
MsOperationLog mainLog = buildWtvtMainLog(null,"修改垂向水温数据", source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (MsOperationLogDetail detail : logDetails) {
|
||||
detail.setMainId(mainLog.getId());
|
||||
}
|
||||
batchInsertWtvtLogDetails(logDetails);
|
||||
}
|
||||
|
||||
String dateStr = dt.substring(0, 10);
|
||||
statisticsDayDataFromHour(stcd, dateStr, dateStr);
|
||||
@ -363,4 +423,163 @@ public class SdWtvtRServiceImpl extends ServiceImpl<SdWtvtRMapper, SdWtvtYearVo>
|
||||
private String asString(Object value) {
|
||||
return value == null ? null : String.valueOf(value);
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryWtvtRows(List<DataParam> dataParamList) {
|
||||
if (CollUtil.isEmpty(dataParamList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ID, STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, WTHG, VWT, FID, ")
|
||||
.append("RECORD_USER, RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME, RZ, HGT, REMARK, WER_ID ")
|
||||
.append("FROM SD_WTVT_R WHERE ");
|
||||
List<Object> params = new ArrayList<>();
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataParam item : dataParamList) {
|
||||
if (item == null || StringUtils.isBlank(item.getId()) || StringUtils.isBlank(item.getDt())) {
|
||||
continue;
|
||||
}
|
||||
conditions.add("(STCD = ? AND TM = TO_DATE(SUBSTR(?, 1, 19), 'YYYY-MM-DD HH24:MI:SS'))");
|
||||
params.add(item.getId());
|
||||
params.add(item.getDt());
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
sql.append(String.join(" OR ", conditions));
|
||||
return normalizeWtvtRows(jdbcTemplate.queryForList(sql.toString(), params.toArray()));
|
||||
}
|
||||
|
||||
private Map<String, Map<String, Object>> buildWtvtBeforeRowMap(String stcd, String dt) {
|
||||
Map<String, Map<String, Object>> result = new HashMap<>();
|
||||
if (StringUtils.isBlank(stcd) || StringUtils.isBlank(dt)) {
|
||||
return result;
|
||||
}
|
||||
String sql = "SELECT ID, STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, WTHG, VWT, FID, " +
|
||||
"RECORD_USER, RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME, RZ, HGT, REMARK, WER_ID " +
|
||||
"FROM SD_WTVT_R WHERE WTHG IS NOT NULL AND VWT IS NOT NULL AND STCD = ? AND TM = TO_DATE(SUBSTR(?, 1, 19), 'YYYY-MM-DD HH24:MI:SS')";
|
||||
List<Map<String, Object>> rows = normalizeWtvtRows(jdbcTemplate.queryForList(sql, stcd, dt));
|
||||
for (Map<String, Object> row : rows) {
|
||||
|
||||
result.put(String.valueOf(Double.parseDouble(row.get("WTHG").toString())), row);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> normalizeWtvtRows(List<Map<String, Object>> rows) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return result;
|
||||
}
|
||||
for (Map<String, Object> row : rows) {
|
||||
Map<String, Object> normalized = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
normalized.put(entry.getKey() == null ? null : entry.getKey().toUpperCase(), entry.getValue());
|
||||
}
|
||||
result.add(normalized);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void recordWtvtDeleteLog(List<Map<String, Object>> rows, String remark, String source) {
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return;
|
||||
}
|
||||
MsOperationLog mainLog = buildWtvtMainLog(null,remark, source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
String stcd = asString(row.get("STCD"));
|
||||
Object depth = row.get("WTHG");
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
String fieldCode = entry.getKey();
|
||||
Object oldValue = entry.getValue();
|
||||
if (StringUtils.isBlank(fieldCode) || oldValue == null) {
|
||||
continue;
|
||||
}
|
||||
details.add(buildWtvtDetail(mainLog.getId(), stcd, fieldCode,
|
||||
oldValue, resolveWtvtDisplayValue(fieldCode, oldValue),
|
||||
null, null, buildWtvtDepthRemark("删除字段值", depth)));
|
||||
}
|
||||
}
|
||||
batchInsertWtvtLogDetails(details);
|
||||
}
|
||||
|
||||
private MsOperationLog buildWtvtMainLog(String recordId,String remark, String source) {
|
||||
MsOperationLog log = new MsOperationLog();
|
||||
log.setOperator(resolveWtvtLogOperator());
|
||||
log.setOperateTime(new Date());
|
||||
log.setTableName(WT_CX_TABLE_NAME);
|
||||
log.setRecordId(remark);
|
||||
log.setSource(StringUtils.trimToNull(source));
|
||||
log.setRemark(remark);
|
||||
return log;
|
||||
}
|
||||
|
||||
private MsOperationLogDetail buildWtvtDetail(String mainId,
|
||||
String stationCode,
|
||||
String fieldCode,
|
||||
Object oldValueCode,
|
||||
Object oldValueName,
|
||||
Object newValueCode,
|
||||
Object newValueName,
|
||||
String remark) {
|
||||
MsOperationLogDetail detail = new MsOperationLogDetail();
|
||||
detail.setMainId(mainId);
|
||||
detail.setTableName(WT_CX_TABLE_NAME);
|
||||
detail.setStationCode(stationCode);
|
||||
detail.setFieldCode(fieldCode);
|
||||
detail.setFieldMeaning(WT_CX_FIELD_MEANING_MAP.getOrDefault(fieldCode, fieldCode));
|
||||
detail.setOldValueCode(formatWtvtLogValue(oldValueCode));
|
||||
detail.setOldValueName(formatWtvtLogValue(oldValueName));
|
||||
detail.setNewValueCode(formatWtvtLogValue(newValueCode));
|
||||
detail.setNewValueName(formatWtvtLogValue(newValueName));
|
||||
detail.setRemark(remark);
|
||||
return detail;
|
||||
}
|
||||
|
||||
private void batchInsertWtvtLogDetails(List<MsOperationLogDetail> details) {
|
||||
if (CollUtil.isEmpty(details)) {
|
||||
return;
|
||||
}
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
if (detail == null) {
|
||||
continue;
|
||||
}
|
||||
msOperationLogDetailMapper.insert(detail);
|
||||
}
|
||||
}
|
||||
|
||||
private Object resolveWtvtDisplayValue(String fieldCode, Object rawValue) {
|
||||
return formatWtvtLogValue(rawValue);
|
||||
}
|
||||
|
||||
private String resolveWtvtLogOperator() {
|
||||
try {
|
||||
return SecurityUtils.getCurrentUsername();
|
||||
} catch (Exception ignored) {
|
||||
try {
|
||||
return SecurityUtils.getUserId();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String formatWtvtLogValue(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Date date) {
|
||||
return DateUtil.formatDateTime(date);
|
||||
}
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
private String buildWtvtDepthKey(Object depth) {
|
||||
return formatWtvtLogValue(depth);
|
||||
}
|
||||
|
||||
private String buildWtvtDepthRemark(String action, Object depth) {
|
||||
String depthText = formatWtvtLogValue(depth);
|
||||
return depthText == null ? action : action + "(深度:" + depthText + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,282 @@
|
||||
package com.yfd.platform.qgc_env.wt.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SiteAvoidanceUtils {
|
||||
|
||||
private final static int DEFAULT_LEVEL = 50000000;
|
||||
private final static int LEVEL1 = 1500000;
|
||||
private final static double LEVEL1_DISTANCE = 1.2;
|
||||
private final static int LEVEL2 = 800000;
|
||||
private final static double LEVEL2_DISTANCE = 0.8;
|
||||
private final static int LEVEL3 = 400000;
|
||||
private final static double LEVEL3_DISTANCE = 0.4;
|
||||
private final static int LEVEL4 = 50000;
|
||||
private final static double LEVEL4_DISTANCE = 0.1;
|
||||
|
||||
public static <T> List<T> calcSiteMapLev(List<T> vos, Function<T, String> stcdGetter, Function<T, BigDecimal> lgtdGetter,
|
||||
Function<T, BigDecimal> lttdGetter, Function<T, String> anchoPointStateGetter,
|
||||
BiConsumer<T, Integer> valueSetter) {
|
||||
return calcSiteMapLev(vos, null, stcdGetter, lgtdGetter, lttdGetter, anchoPointStateGetter, valueSetter);
|
||||
}
|
||||
|
||||
public static <T> List<T> calcSiteMapLev(List<T> vos, BaseAnchoPointAo ao, Function<T, String> stcdGetter,
|
||||
Function<T, BigDecimal> lgtdGetter, Function<T, BigDecimal> lttdGetter,
|
||||
Function<T, String> anchoPointStateGetter, BiConsumer<T, Integer> valueSetter) {
|
||||
if (ao == null) {
|
||||
ao = new BaseAnchoPointAo();
|
||||
}
|
||||
if (ao.getDefaultLevel() == null) {
|
||||
ao.setDefaultLevel(DEFAULT_LEVEL);
|
||||
}
|
||||
if (ao.getLevel1() == null) {
|
||||
ao.setLevel1(LEVEL1);
|
||||
}
|
||||
if (ao.getLevel1Distance() == null) {
|
||||
ao.setLevel1Distance(LEVEL1_DISTANCE);
|
||||
}
|
||||
if (ao.getLevel2() == null) {
|
||||
ao.setLevel2(LEVEL2);
|
||||
}
|
||||
if (ao.getLevel2Distance() == null) {
|
||||
ao.setLevel2Distance(LEVEL2_DISTANCE);
|
||||
}
|
||||
if (ao.getLevel3() == null) {
|
||||
ao.setLevel3(LEVEL3);
|
||||
}
|
||||
if (ao.getLevel3Distance() == null) {
|
||||
ao.setLevel3Distance(LEVEL3_DISTANCE);
|
||||
}
|
||||
if (ao.getLevel4() == null) {
|
||||
ao.setLevel4(LEVEL4);
|
||||
}
|
||||
if (ao.getLevel4Distance() == null) {
|
||||
ao.setLevel4Distance(LEVEL4_DISTANCE);
|
||||
}
|
||||
if (ao.getCategory() == null) {
|
||||
ao.setCategory(true);
|
||||
}
|
||||
|
||||
if (ao.getMinX() != null && ao.getMinY() != null && ao.getMaxX() != null && ao.getMaxY() != null) {
|
||||
List<T> filterVos = new ArrayList<>(vos.size());
|
||||
for (T vo : vos) {
|
||||
if (lgtdGetter.apply(vo) == null || lgtdGetter.apply(vo).doubleValue() < ao.getMinX() || lgtdGetter.apply(vo).doubleValue() > ao.getMaxX()) {
|
||||
continue;
|
||||
}
|
||||
if (lttdGetter.apply(vo) == null || lttdGetter.apply(vo).doubleValue() < ao.getMinY() || lttdGetter.apply(vo).doubleValue() > ao.getMaxY()) {
|
||||
continue;
|
||||
}
|
||||
filterVos.add(vo);
|
||||
}
|
||||
if (filterVos.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
vos = filterVos;
|
||||
}
|
||||
|
||||
Set<String> meterMapData = new HashSet<>();
|
||||
for (int i = 0; i < vos.size(); i++) {
|
||||
fori(vos, i, meterMapData, ao, stcdGetter, lgtdGetter, lttdGetter, anchoPointStateGetter, valueSetter);
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
|
||||
private static <T> void fori(List<T> partitionLayerMeterList, int i, Set<String> meterMapData, BaseAnchoPointAo ao,
|
||||
Function<T, String> stcdGetter, Function<T, BigDecimal> lgtdGetter,
|
||||
Function<T, BigDecimal> lttdGetter, Function<T, String> anchoPointStateGetter,
|
||||
BiConsumer<T, Integer> valueSetter) {
|
||||
T siteAvoidanceDto = partitionLayerMeterList.get(i);
|
||||
|
||||
String category = anchoPointStateGetter.apply(siteAvoidanceDto);
|
||||
if (!ao.getCategory()) {
|
||||
category = null;
|
||||
}
|
||||
String stcd = stcdGetter.apply(siteAvoidanceDto);
|
||||
BigDecimal x1 = lgtdGetter.apply(siteAvoidanceDto);
|
||||
BigDecimal y1 = lttdGetter.apply(siteAvoidanceDto);
|
||||
if (meterMapData.contains(stcd + category)) {
|
||||
return;
|
||||
}
|
||||
valueSetter.accept(siteAvoidanceDto, ao.getDefaultLevel());
|
||||
for (int j = i + 1; j < partitionLayerMeterList.size(); j++) {
|
||||
forj(j, partitionLayerMeterList, meterMapData, category, stcd, x1, y1, ao, stcdGetter, lgtdGetter, lttdGetter, anchoPointStateGetter, valueSetter);
|
||||
}
|
||||
}
|
||||
|
||||
private static <T> void forj(int j, List<T> partitionLayerMeterList, Set<String> meterMapData, String category,
|
||||
String stcd, BigDecimal x1, BigDecimal y1, BaseAnchoPointAo ao,
|
||||
Function<T, String> stcdGetter, Function<T, BigDecimal> lgtdGetter,
|
||||
Function<T, BigDecimal> lttdGetter, Function<T, String> anchoPointStateGetter,
|
||||
BiConsumer<T, Integer> valueSetter) {
|
||||
T baseAnchoPointVo = partitionLayerMeterList.get(j);
|
||||
String category2 = anchoPointStateGetter.apply(baseAnchoPointVo);
|
||||
if (!ao.getCategory()) {
|
||||
category = null;
|
||||
}
|
||||
String stcd2 = stcdGetter.apply(baseAnchoPointVo);
|
||||
BigDecimal x2 = lgtdGetter.apply(baseAnchoPointVo);
|
||||
BigDecimal y2 = lttdGetter.apply(baseAnchoPointVo);
|
||||
if (!ao.getCategory()) {
|
||||
category = null;
|
||||
}
|
||||
if (meterMapData.contains(stcd2 + category2)) {
|
||||
return;
|
||||
}
|
||||
if (x1 == null || x2 == null || y1 == null || y2 == null) {
|
||||
return;
|
||||
}
|
||||
if (!(stcd + category).equals(stcd2 + category2)) {
|
||||
double dx = Math.abs(x1.doubleValue() - x2.doubleValue());
|
||||
double dy = Math.abs(y1.doubleValue() - y2.doubleValue());
|
||||
double distance = Math.sqrt(dx * dx + dy * dy);
|
||||
if (distance < ao.getLevel4Distance()) {
|
||||
valueSetter.accept(baseAnchoPointVo, ao.getLevel4());
|
||||
meterMapData.add(stcd2 + category2);
|
||||
} else if (distance < ao.getLevel3Distance()) {
|
||||
valueSetter.accept(baseAnchoPointVo, ao.getLevel3());
|
||||
meterMapData.add(stcd2 + category2);
|
||||
} else if (distance < ao.getLevel2Distance()) {
|
||||
valueSetter.accept(baseAnchoPointVo, ao.getLevel2());
|
||||
meterMapData.add(stcd2 + category2);
|
||||
} else if (distance < ao.getLevel1Distance()) {
|
||||
valueSetter.accept(baseAnchoPointVo, ao.getLevel1());
|
||||
meterMapData.add(stcd2 + category2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class BaseAnchoPointAo {
|
||||
private Integer defaultLevel;
|
||||
private Integer level1;
|
||||
private Double level1Distance;
|
||||
private Integer level2;
|
||||
private Double level2Distance;
|
||||
private Integer level3;
|
||||
private Double level3Distance;
|
||||
private Integer level4;
|
||||
private Double level4Distance;
|
||||
private Boolean category;
|
||||
private Double minX;
|
||||
private Double minY;
|
||||
private Double maxX;
|
||||
private Double maxY;
|
||||
|
||||
public Integer getDefaultLevel() {
|
||||
return defaultLevel;
|
||||
}
|
||||
|
||||
public void setDefaultLevel(Integer defaultLevel) {
|
||||
this.defaultLevel = defaultLevel;
|
||||
}
|
||||
|
||||
public Integer getLevel1() {
|
||||
return level1;
|
||||
}
|
||||
|
||||
public void setLevel1(Integer level1) {
|
||||
this.level1 = level1;
|
||||
}
|
||||
|
||||
public Double getLevel1Distance() {
|
||||
return level1Distance;
|
||||
}
|
||||
|
||||
public void setLevel1Distance(Double level1Distance) {
|
||||
this.level1Distance = level1Distance;
|
||||
}
|
||||
|
||||
public Integer getLevel2() {
|
||||
return level2;
|
||||
}
|
||||
|
||||
public void setLevel2(Integer level2) {
|
||||
this.level2 = level2;
|
||||
}
|
||||
|
||||
public Double getLevel2Distance() {
|
||||
return level2Distance;
|
||||
}
|
||||
|
||||
public void setLevel2Distance(Double level2Distance) {
|
||||
this.level2Distance = level2Distance;
|
||||
}
|
||||
|
||||
public Integer getLevel3() {
|
||||
return level3;
|
||||
}
|
||||
|
||||
public void setLevel3(Integer level3) {
|
||||
this.level3 = level3;
|
||||
}
|
||||
|
||||
public Double getLevel3Distance() {
|
||||
return level3Distance;
|
||||
}
|
||||
|
||||
public void setLevel3Distance(Double level3Distance) {
|
||||
this.level3Distance = level3Distance;
|
||||
}
|
||||
|
||||
public Integer getLevel4() {
|
||||
return level4;
|
||||
}
|
||||
|
||||
public void setLevel4(Integer level4) {
|
||||
this.level4 = level4;
|
||||
}
|
||||
|
||||
public Double getLevel4Distance() {
|
||||
return level4Distance;
|
||||
}
|
||||
|
||||
public void setLevel4Distance(Double level4Distance) {
|
||||
this.level4Distance = level4Distance;
|
||||
}
|
||||
|
||||
public Boolean getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(Boolean category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public Double getMinX() {
|
||||
return minX;
|
||||
}
|
||||
|
||||
public void setMinX(Double minX) {
|
||||
this.minX = minX;
|
||||
}
|
||||
|
||||
public Double getMinY() {
|
||||
return minY;
|
||||
}
|
||||
|
||||
public void setMinY(Double minY) {
|
||||
this.minY = minY;
|
||||
}
|
||||
|
||||
public Double getMaxX() {
|
||||
return maxX;
|
||||
}
|
||||
|
||||
public void setMaxX(Double maxX) {
|
||||
this.maxX = maxX;
|
||||
}
|
||||
|
||||
public Double getMaxY() {
|
||||
return maxY;
|
||||
}
|
||||
|
||||
public void setMaxY(Double maxY) {
|
||||
this.maxY = maxY;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,10 +7,7 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/wte")
|
||||
@ -21,6 +18,12 @@ public class WeFishController {
|
||||
@Resource
|
||||
private WeFishService weFishService;
|
||||
|
||||
@PostMapping("/we/fisht/GetKendoListCust")
|
||||
@Operation(summary = "条件过滤数据列表定制")
|
||||
public ResponseResult getWeFishTKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeFishTKendoListCust(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/qgc/GetKendoListCust")
|
||||
@Operation(summary = "全过程沿程鱼类变化情况")
|
||||
public ResponseResult getQgcWeFishTKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
@ -57,6 +60,30 @@ public class WeFishController {
|
||||
return ResponseResult.successData(weFishService.getWvaList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/wva/default/GetKendoListCust")
|
||||
@Operation(summary = "野生动物监测默认数据")
|
||||
public ResponseResult getWvaDefaultList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWvaDefaultList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/compareBar/GetKendoListCust")
|
||||
@Operation(summary = "水生生态调查对比(柱状图)")
|
||||
public ResponseResult getWeCompareBarList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeCompareBarList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fishPage/qgc/GetKendoListCust")
|
||||
@Operation(summary = "环保部-水生生态调查二级页面")
|
||||
public ResponseResult getQgcWeFishPageList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getQgcWeFishPageList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/base/evnmAutoMonitor/GetKendoListCust")
|
||||
@Operation(summary = "环保自动监测开展情况")
|
||||
public ResponseResult getEnvmAutoMonitorList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getEnvmAutoMonitorList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/year/qgc/GetKendoListCust")
|
||||
@Operation(summary = "全过程沿程鱼类变化情况有数据的流域和年份")
|
||||
public ResponseResult getQgcFishStaticsYearList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
@ -69,12 +96,48 @@ public class WeFishController {
|
||||
return ResponseResult.successData(weFishService.getQgcWeFishStatics(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/statics/getWeStaticsSecond")
|
||||
@Operation(summary = "水生生态调查概况二级页面")
|
||||
public ResponseResult getWeStaticsSecond(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeStaticsSecond(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/stat/qgc/GetKendoListCust")
|
||||
@Operation(summary = "环保部-沿程鱼类变化情况柱状图")
|
||||
public ResponseResult getQgcWeFishStatList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getQgcWeFishStatList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/stat/GetKendoListCust")
|
||||
@Operation(summary = "沿程鱼类变化情况柱状图")
|
||||
public ResponseResult getWeFishStatList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeFishStatList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/qgcDetail/GetKendoListCust")
|
||||
@Operation(summary = "沿程鱼类变化情况二级弹窗-按照新逻辑重写")
|
||||
public ResponseResult getQgcWeFishDetailList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getQgcWeFishDetailList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/qgcDetail/qgc/GetKendoListCust")
|
||||
@Operation(summary = "环保部-沿程鱼类变化情况二级弹窗")
|
||||
public ResponseResult getHbbQgcWeFishDetailList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getHbbQgcWeFishDetailList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/detail/GetKendoListCust")
|
||||
@Operation(summary = "沿程鱼类变化情况二级弹窗")
|
||||
public ResponseResult getWeFishDetailList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeFishDetailList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fisht/statTab/GetKendoListCust")
|
||||
@Operation(summary = "沿程鱼类变化情况二级页面tab页签数据")
|
||||
public ResponseResult getWeFishStatTabList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeFishStatTabList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fishList/stat/qgc/GetKendoListCust")
|
||||
@Operation(summary = "环保部-水生生态调查-水生生态面板")
|
||||
public ResponseResult getQgcFishListStat(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
@ -92,4 +155,34 @@ public class WeFishController {
|
||||
public ResponseResult getTeSpecialAnimalList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getTeSpecialAnimalList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@GetMapping("/we/wer/getWeDefaultData")
|
||||
@Operation(summary = "查询水生生态断面的年份及是否鱼类,水温,水质,流速数据")
|
||||
public ResponseResult getWeDefaultData(@RequestParam("stcd") String stcd) {
|
||||
return ResponseResult.successData(weFishService.getWeDefaultData(stcd));
|
||||
}
|
||||
|
||||
@GetMapping("/we/wer/getWeYr")
|
||||
@Operation(summary = "查询水生生态断面有数据的年份")
|
||||
public ResponseResult getWeYr(@RequestParam("stcd") String stcd) {
|
||||
return ResponseResult.successData(weFishService.getWeYr(stcd));
|
||||
}
|
||||
|
||||
@PostMapping("/we/wewtr/GetKendoListCust")
|
||||
@Operation(summary = "水生生态调查-水温数据列表")
|
||||
public ResponseResult getWeWtR(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeWtR(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/wewqr/GetKendoListCust")
|
||||
@Operation(summary = "水生生态调查-水质数据列表")
|
||||
public ResponseResult getWeWqR(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeWqR(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/we/fvR/GetKendoListCust")
|
||||
@Operation(summary = "水生生态调查-流速数据列表")
|
||||
public ResponseResult getWeFvR(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(weFishService.getWeFvR(dataSourceRequest));
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@AllArgsConstructor
|
||||
@Schema(description = "水生生态调查对比柱状图表头")
|
||||
public class WeCompareBarHeadColumnVo {
|
||||
|
||||
@Schema(description = "字段名")
|
||||
private String dataIndex;
|
||||
|
||||
@Schema(description = "标题")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "是否可见")
|
||||
private Boolean visible;
|
||||
|
||||
@Schema(description = "键")
|
||||
private String key;
|
||||
|
||||
@Schema(description = "单位")
|
||||
private boolean merge;
|
||||
|
||||
@Schema(description = "子列")
|
||||
private List<WeCompareBarHeadColumnVo> children;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "水生生态调查对比柱状图表格")
|
||||
public class WeCompareBarTableVo {
|
||||
|
||||
@Schema(description = "表头")
|
||||
private List<WeCompareBarHeadColumnVo> columns;
|
||||
|
||||
@Schema(description = "表格数据")
|
||||
private Object dataSource;
|
||||
|
||||
@Schema(description = "总数")
|
||||
private Long total;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "水生生态调查对比柱状图数据")
|
||||
public class WeCompareBarVo {
|
||||
|
||||
@Schema(description = "鱼类名称")
|
||||
private String ftp;
|
||||
|
||||
@Schema(description = "科属")
|
||||
private String genus;
|
||||
|
||||
@Schema(description = "调查批次")
|
||||
private String dcpc;
|
||||
|
||||
@Schema(description = "对比批次")
|
||||
private String dcpc2;
|
||||
|
||||
@Schema(description = "鱼类数量")
|
||||
private Integer fcnt;
|
||||
|
||||
@Schema(description = "对比鱼类数量")
|
||||
private Integer fcnt2;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "水生生态断面默认数据实体类")
|
||||
public class WeDefaultDataVo {
|
||||
|
||||
private String yr;
|
||||
private Integer hasFtp;
|
||||
private Integer hasFv;
|
||||
private Integer hasWq;
|
||||
private Integer hasWt;
|
||||
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "环保自动监测开展情况")
|
||||
public class WeEnvmAutoMonitorVo {
|
||||
|
||||
@Schema(description = "数量")
|
||||
private Integer cnt;
|
||||
|
||||
@Schema(description = "功能序号")
|
||||
private Integer orderInx;
|
||||
|
||||
@Schema(description = "功能序号名称")
|
||||
private String orderInxName;
|
||||
|
||||
@Schema(description = "类型路径")
|
||||
private String sttpFullPath;
|
||||
|
||||
@Schema(description = "站点类型")
|
||||
private String sttpCode;
|
||||
|
||||
@Schema(description = "站点类型名称")
|
||||
private String sttpName;
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "沿程鱼类变化情况二级弹窗")
|
||||
public class WeFishDetailVo {
|
||||
|
||||
@Schema(description = "电站编码")
|
||||
private String rsctd;
|
||||
|
||||
@Schema(description = "电站名称")
|
||||
private String rsctdName;
|
||||
|
||||
@Schema(description = "鱼类列表")
|
||||
private List<String> fishList;
|
||||
|
||||
@Schema(description = "断面列表")
|
||||
private List<StationItem> stcdList;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "断面信息")
|
||||
public static class StationItem {
|
||||
@Schema(description = "断面编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "断面名称")
|
||||
private String stnm;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "环保部-沿程鱼类变化情况二级弹窗")
|
||||
public class WeFishHbbQgcDetailVo {
|
||||
|
||||
@Schema(description = "电站编码")
|
||||
private String rstcd;
|
||||
|
||||
@Schema(description = "电站名称")
|
||||
private String rstcdName;
|
||||
|
||||
@Schema(description = "断面编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "断面名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "鱼类名称")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "鱼类对应ID")
|
||||
private String id;
|
||||
}
|
||||
@ -0,0 +1,37 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "环保部-水生生态调查二级页面数据")
|
||||
public class WeFishPageQgcVo {
|
||||
|
||||
@Schema(description = "鱼类名称")
|
||||
private String ftp;
|
||||
|
||||
@Schema(description = "科属")
|
||||
private String genus;
|
||||
|
||||
@Schema(description = "开始年份鱼类总量")
|
||||
private Integer startFtpCnt;
|
||||
|
||||
@Schema(description = "开始年份总量")
|
||||
private Integer startCnt;
|
||||
|
||||
@Schema(description = "开始年份占比")
|
||||
private BigDecimal startYear;
|
||||
|
||||
@Schema(description = "结束年份鱼类总量")
|
||||
private Integer endFtpCnt;
|
||||
|
||||
@Schema(description = "结束年份总量")
|
||||
private Integer endCnt;
|
||||
|
||||
@Schema(description = "结束年份占比")
|
||||
private BigDecimal endYear;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "环保部-水生生态调查二级页面表格")
|
||||
public class WeFishPageTableVo {
|
||||
|
||||
@Schema(description = "表头")
|
||||
private List<WeCompareBarHeadColumnVo> columns;
|
||||
|
||||
@Schema(description = "表格数据")
|
||||
private Object dataSource;
|
||||
|
||||
@Schema(description = "总数")
|
||||
private Long total;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "沿程鱼类变化情况二级页面tab页签数据")
|
||||
public class WeFishStatTabVo {
|
||||
|
||||
@Schema(description = "鱼类类型")
|
||||
private String ty;
|
||||
|
||||
@Schema(description = "鱼类类型名称")
|
||||
private String tyName;
|
||||
|
||||
@Schema(description = "鱼类数量")
|
||||
private Long num;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class WeFvVo {
|
||||
private String dcpc;
|
||||
private String stcd;
|
||||
private Date tm;
|
||||
private BigDecimal flowrate;
|
||||
private String fid;
|
||||
}
|
||||
@ -4,11 +4,37 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@Schema(description = "水生生态调查概况")
|
||||
public class WeStaticsVo {
|
||||
|
||||
@Schema(description = "断面编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "断面名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "调查批次")
|
||||
private String dcpc;
|
||||
|
||||
@Schema(description = "调查鱼类")
|
||||
private String ftp;
|
||||
|
||||
@Schema(description = "调查鱼类名称")
|
||||
private String ftpName;
|
||||
|
||||
@Schema(description = "鱼类数量")
|
||||
private Long fcnt;
|
||||
|
||||
@Schema(description = "附件ID")
|
||||
private String fid;
|
||||
|
||||
@Schema(description = "调查时间")
|
||||
private Date tm;
|
||||
|
||||
@Schema(description = "调查批次数量")
|
||||
private Long dcpcCount;
|
||||
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class WeWqVo {
|
||||
private String stcd;
|
||||
private String dcpc;
|
||||
private String name;
|
||||
private Date tm;
|
||||
private BigDecimal ph;
|
||||
private BigDecimal dox;
|
||||
private BigDecimal codmn;
|
||||
private BigDecimal codcr;
|
||||
private BigDecimal bod5;
|
||||
private BigDecimal nh3n;
|
||||
private BigDecimal tp;
|
||||
private BigDecimal tn;
|
||||
private BigDecimal cu;
|
||||
private BigDecimal zn;
|
||||
private BigDecimal f;
|
||||
private BigDecimal se;
|
||||
private BigDecimal ars;
|
||||
private BigDecimal hg;
|
||||
private BigDecimal cd;
|
||||
private BigDecimal cr6;
|
||||
private BigDecimal pb;
|
||||
private BigDecimal cn;
|
||||
private BigDecimal vlph;
|
||||
private BigDecimal oil;
|
||||
private BigDecimal las;
|
||||
private BigDecimal s2;
|
||||
private BigDecimal fcg;
|
||||
private BigDecimal cl;
|
||||
private BigDecimal so4;
|
||||
private BigDecimal no3;
|
||||
private BigDecimal thrd;
|
||||
private BigDecimal cond;
|
||||
private BigDecimal fe;
|
||||
private BigDecimal mn;
|
||||
private BigDecimal al;
|
||||
private BigDecimal chla;
|
||||
private BigDecimal clarity;
|
||||
private BigDecimal tu;
|
||||
private BigDecimal cyano;
|
||||
private String fid;
|
||||
private Integer parameter;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class WeWtVo {
|
||||
|
||||
private String dcpc;
|
||||
|
||||
private String stcd;
|
||||
|
||||
private Date tm;
|
||||
|
||||
private BigDecimal wt;
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Schema(description = "野生动物监测默认数据")
|
||||
public class WeWvaDefaultVo {
|
||||
|
||||
@Schema(description = "站点编码")
|
||||
private String stcd;
|
||||
|
||||
@Schema(description = "站点名称")
|
||||
private String stnm;
|
||||
|
||||
@Schema(description = "站类编码")
|
||||
private String sttpCode;
|
||||
|
||||
@Schema(description = "站类名称")
|
||||
private String sttpName;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Schema(description = "最新时间")
|
||||
private Date tm;
|
||||
}
|
||||
@ -2,23 +2,15 @@ package com.yfd.platform.qgc_env.wte.service;
|
||||
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishListQgcVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishListStatQgcVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeMsstbprptVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishPointQgcVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishStatQgcVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishTQgcVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeStaticsVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeTeSpecialAnimalVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeVmsstbprptVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeWvaQgcVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeWvaYearQgcVo;
|
||||
import com.yfd.platform.qgc_env.wte.entity.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface WeFishService {
|
||||
|
||||
DataSourceResult<WeFishTQgcVo> getWeFishTKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishTQgcVo> getQgcWeFishTKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishListQgcVo> getQgcWeFishList(DataSourceRequest dataSourceRequest);
|
||||
@ -29,17 +21,47 @@ public interface WeFishService {
|
||||
|
||||
DataSourceResult<WeWvaQgcVo> getWvaList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeWvaDefaultVo> getWvaDefaultList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeWvaYearQgcVo> getWvaDefaultYearList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeCompareBarTableVo> getWeCompareBarList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishPageTableVo> getQgcWeFishPageList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeEnvmAutoMonitorVo> getEnvmAutoMonitorList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<Map<String, List<String>>> getQgcFishStaticsYearList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeStaticsVo> getQgcWeFishStatics(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeStaticsVo> getWeStaticsSecond(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishStatQgcVo> getQgcWeFishStatList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishStatQgcVo> getWeFishStatList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishDetailVo> getQgcWeFishDetailList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishHbbQgcDetailVo> getHbbQgcWeFishDetailList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishDetailVo> getWeFishDetailList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishStatTabVo> getWeFishStatTabList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishListStatQgcVo> getQgcFishListStat(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishPointQgcVo> getQgcWeFishPoint(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeTeSpecialAnimalVo> getTeSpecialAnimalList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
List<WeDefaultDataVo> getWeDefaultData(String stcd);
|
||||
|
||||
DataSourceResult getWeYr(String stcd);
|
||||
|
||||
DataSourceResult<WeWtVo> getWeWtR(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeWqVo> getWeWqR(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFvVo> getWeFvR(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,10 @@
|
||||
package com.yfd.platform.qgc_env.zq.controller;
|
||||
|
||||
import com.yfd.platform.annotation.Log;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_env.zq.entity.vo.ZqOperateRequest;
|
||||
import com.yfd.platform.qgc_env.zq.service.ZqMonitorService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -56,6 +58,7 @@ public class ZqMonitorController {
|
||||
return ResponseResult.successData(zqMonitorService.getRiverDrtpKendoListCust(dataSourceRequest));
|
||||
}
|
||||
|
||||
@Log(module = "水文流量站监测", value = "删除流量站小时/日/月数据")
|
||||
@PostMapping("/river/removeKendoByIds")
|
||||
@Operation(summary = "删除流量站小时/日/月数据")
|
||||
public ResponseResult removeKendoByIds(@RequestBody BatchDeleteAo batchDeleteAo) {
|
||||
@ -63,10 +66,14 @@ public class ZqMonitorController {
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
@Log(module = "水文流量站监测", value = "修改流量站小时数据")
|
||||
@PostMapping("/river/updateRiverRData")
|
||||
@Operation(summary = "修改流量站小时数据")
|
||||
public ResponseResult updateRiverRData(@RequestBody Map<String, Object> updateData) {
|
||||
zqMonitorService.updateRiverRData(updateData);
|
||||
public ResponseResult updateRiverRData(@RequestBody ZqOperateRequest zqOperateRequest) {
|
||||
zqMonitorService.updateRiverRData(
|
||||
zqOperateRequest == null ? null : zqOperateRequest.getUpdateData(),
|
||||
zqOperateRequest == null ? null : zqOperateRequest.getSource()
|
||||
);
|
||||
return ResponseResult.success();
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,13 @@
|
||||
package com.yfd.platform.qgc_env.zq.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Data
|
||||
public class ZqOperateRequest {
|
||||
|
||||
private String source;
|
||||
|
||||
private Map<String, Object> updateData;
|
||||
}
|
||||
@ -22,7 +22,7 @@ public interface ZqMonitorService {
|
||||
|
||||
boolean removeKendoByIds(BatchDeleteAo batchDeleteAo);
|
||||
|
||||
boolean updateRiverRData(java.util.Map<String, Object> updateData);
|
||||
boolean updateRiverRData(java.util.Map<String, Object> updateData, String source);
|
||||
|
||||
ZqBaseInfoVo getStcdInfo(String stcd);
|
||||
}
|
||||
|
||||
@ -10,8 +10,12 @@ import com.yfd.platform.common.GroupHelper;
|
||||
import com.yfd.platform.common.GroupingInfo;
|
||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLog;
|
||||
import com.yfd.platform.qgc_base.domain.MsOperationLogDetail;
|
||||
import com.yfd.platform.qgc_base.entity.vo.BatchDeleteAo;
|
||||
import com.yfd.platform.qgc_base.entity.vo.DataParam;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogDetailMapper;
|
||||
import com.yfd.platform.qgc_base.mapper.MsOperationLogMapper;
|
||||
import com.yfd.platform.qgc_env.fh.entity.vo.HabitatVo;
|
||||
import com.yfd.platform.qgc_env.zq.entity.vo.ZqBaseInfoVo;
|
||||
import com.yfd.platform.qgc_env.zq.entity.vo.ZqRiverDayDataVo;
|
||||
@ -19,23 +23,59 @@ import com.yfd.platform.qgc_env.zq.entity.vo.ZqRiverDrtpDataVo;
|
||||
import com.yfd.platform.qgc_env.zq.entity.vo.ZqRiverDataVo;
|
||||
import com.yfd.platform.qgc_env.zq.service.ZqMonitorService;
|
||||
import com.yfd.platform.utils.QgcQueryWrapperUtil;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
@Service
|
||||
public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
private static final String ZQ_HOUR_TABLE_NAME = "SD_RIVER_R";
|
||||
private static final String ZQ_DAY_TABLE_NAME = "SD_RIVERDAY_S";
|
||||
private static final String ZQ_MONTH_TABLE_NAME = "SD_RIVERDRTP_S";
|
||||
private static final Map<String, String> ZQ_UPDATE_COLUMN_MAP = new LinkedHashMap<>();
|
||||
private static final Map<String, String> ZQ_FIELD_MEANING_MAP = new LinkedHashMap<>();
|
||||
|
||||
static {
|
||||
ZQ_UPDATE_COLUMN_MAP.put("z", "Z");
|
||||
ZQ_UPDATE_COLUMN_MAP.put("q", "Q");
|
||||
ZQ_UPDATE_COLUMN_MAP.put("v", "V");
|
||||
|
||||
ZQ_FIELD_MEANING_MAP.put("ID", "主键ID");
|
||||
ZQ_FIELD_MEANING_MAP.put("STCD", "站码");
|
||||
ZQ_FIELD_MEANING_MAP.put("TM", "时间");
|
||||
ZQ_FIELD_MEANING_MAP.put("DT", "时间");
|
||||
ZQ_FIELD_MEANING_MAP.put("DRTP", "维度类型");
|
||||
ZQ_FIELD_MEANING_MAP.put("YEAR", "年");
|
||||
ZQ_FIELD_MEANING_MAP.put("MONTH", "月");
|
||||
ZQ_FIELD_MEANING_MAP.put("DR", "时段类型");
|
||||
ZQ_FIELD_MEANING_MAP.put("Z", "水位");
|
||||
ZQ_FIELD_MEANING_MAP.put("Q", "流量");
|
||||
ZQ_FIELD_MEANING_MAP.put("V", "流速");
|
||||
ZQ_FIELD_MEANING_MAP.put("MSQMT", "测流方法");
|
||||
ZQ_FIELD_MEANING_MAP.put("RECORD_USER", "创建人");
|
||||
ZQ_FIELD_MEANING_MAP.put("RECORD_TIME", "创建时间");
|
||||
ZQ_FIELD_MEANING_MAP.put("MODIFY_USER", "更新人");
|
||||
ZQ_FIELD_MEANING_MAP.put("MODIFY_TIME", "更新时间");
|
||||
ZQ_FIELD_MEANING_MAP.put("IS_DELETED", "是否已删除");
|
||||
ZQ_FIELD_MEANING_MAP.put("DELETE_USER", "删除人");
|
||||
ZQ_FIELD_MEANING_MAP.put("DELETE_TIME", "删除时间");
|
||||
ZQ_FIELD_MEANING_MAP.put("FID", "附件ID");
|
||||
ZQ_FIELD_MEANING_MAP.put("REMARK", "备注");
|
||||
}
|
||||
|
||||
@Resource
|
||||
private MicroservicDynamicSQLMapper microservicDynamicSQLMapper;
|
||||
@ -43,12 +83,20 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
@Resource
|
||||
private JdbcTemplate jdbcTemplate;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogMapper msOperationLogMapper;
|
||||
|
||||
@Resource
|
||||
private MsOperationLogDetailMapper msOperationLogDetailMapper;
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "zqCache#7200", keyGenerator = "cacheKeyGenerator")
|
||||
public DataSourceResult getMsstbprptList(DataSourceRequest dataSourceRequest) {
|
||||
return getMsstbprptListInternal(dataSourceRequest, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Cacheable(cacheNames = "zqCache#7200", keyGenerator = "cacheKeyGenerator")
|
||||
public DataSourceResult getEngMsstbprptList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceRequest request = dataSourceRequest == null ? new DataSourceRequest() : dataSourceRequest;
|
||||
request.setSelect(Arrays.asList("stcd", "stnm", "wtDeviceType", "dtinType", "mway"));
|
||||
@ -63,13 +111,13 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
.append(buildMsstbprptDetailSelectSql(dataSourceRequest == null ? null : dataSourceRequest.getSelect()))
|
||||
.append(" FROM SD_RIVER_B_H t ")
|
||||
.append("LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = t.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 ")
|
||||
.append("LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.HBRVCD = eng.HBRVCD ")
|
||||
.append(" AND hbrv.BASEID = eng.BASE_ID ")
|
||||
.append(" AND hbrv.IS_DELETED = 0 ")
|
||||
.append(" AND hbrv.ENABLED = 1 ")
|
||||
.append("LEFT JOIN SD_RVCD_DIC rv ON rv.RVCD = eng.RVCD ")
|
||||
.append("LEFT JOIN SD_ADDVCD_DIC addv ON addv.ADDVCD = eng.ADDVCD ")
|
||||
// .append("LEFT JOIN SD_HYDROBASE hb ON hb.BASEID = eng.BASE_ID AND NVL(hb.IS_DELETED, 0) = 0 ")
|
||||
// .append("LEFT JOIN SD_HBRV_DIC hbrv ON hbrv.HBRVCD = eng.HBRVCD ")
|
||||
// .append(" AND hbrv.BASEID = eng.BASE_ID ")
|
||||
// .append(" AND hbrv.IS_DELETED = 0 ")
|
||||
// .append(" AND hbrv.ENABLED = 1 ")
|
||||
// .append("LEFT JOIN SD_RVCD_DIC rv ON rv.RVCD = eng.RVCD ")
|
||||
// .append("LEFT JOIN SD_ADDVCD_DIC addv ON addv.ADDVCD = eng.ADDVCD ")
|
||||
.append("WHERE t.IS_DELETED = 0 ");
|
||||
if (onlyZq) {
|
||||
sql.append("AND t.STTP = 'ZQ' ");
|
||||
@ -170,11 +218,14 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
}
|
||||
String dataType = batchDeleteAo.getDataType();
|
||||
List<DataParam> dataList = batchDeleteAo.getDataList();
|
||||
String source = batchDeleteAo.getSource();
|
||||
int batchSize = 500;
|
||||
for (int i = 0; i < dataList.size(); i += batchSize) {
|
||||
List<DataParam> subList = dataList.subList(i, Math.min(i + batchSize, dataList.size()));
|
||||
if ("TIME".equals(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryRiverHourRows(subList);
|
||||
deleteRiverRData(subList);
|
||||
recordRiverDeleteLog(beforeRows, ZQ_HOUR_TABLE_NAME, "删除流量站小时数据", source);
|
||||
Map<String, String[]> dateRangeMap = new HashMap<>();
|
||||
Map<String, String[]> monthRangeMap = new HashMap<>();
|
||||
for (DataParam param : subList) {
|
||||
@ -209,10 +260,14 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
}
|
||||
}
|
||||
if ("DATE".equals(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryRiverDayRows(subList);
|
||||
deleteRiverDayData(subList);
|
||||
recordRiverDeleteLog(beforeRows, ZQ_DAY_TABLE_NAME, "删除流量站日数据", source);
|
||||
}
|
||||
if ("MON".equals(dataType)) {
|
||||
List<Map<String, Object>> beforeRows = queryRiverMonthRows(subList);
|
||||
deleteRiverMonthData(subList);
|
||||
recordRiverDeleteLog(beforeRows, ZQ_MONTH_TABLE_NAME, "删除流量站月数据", source);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -220,10 +275,12 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateRiverRData(Map<String, Object> updateData) {
|
||||
updateRiverHourData(updateData);
|
||||
public boolean updateRiverRData(Map<String, Object> updateData, String source) {
|
||||
String stcd = updateData == null ? null : asString(updateData.get("stcd"));
|
||||
String tm = updateData == null ? null : asString(updateData.get("tm"));
|
||||
Map<String, Object> beforeRow = queryRiverHourRow(stcd, tm);
|
||||
updateRiverHourData(updateData);
|
||||
recordRiverUpdateLog(beforeRow, updateData, source);
|
||||
if (StrUtil.isNotBlank(stcd) && StrUtil.isNotBlank(tm) && tm.length() >= 10) {
|
||||
String dateStr = tm.substring(0, 10);
|
||||
statisticsDayDataFromHour(stcd, dateStr, dateStr);
|
||||
@ -1612,6 +1669,273 @@ public class ZqMonitorServiceImpl implements ZqMonitorService {
|
||||
return value == null ? null : String.valueOf(value);
|
||||
}
|
||||
|
||||
private Map<String, Object> queryRiverHourRow(String stcd, String tm) {
|
||||
if (StrUtil.isBlank(stcd) || StrUtil.isBlank(tm)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
String sql = "SELECT ID, STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, Z, Q, V, MSQMT, RECORD_USER, " +
|
||||
"RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME, FID, REMARK " +
|
||||
"FROM SD_RIVER_R WHERE STCD = ? AND TM = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS')";
|
||||
List<Map<String, Object>> rows = jdbcTemplate.queryForList(sql, stcd, tm);
|
||||
return rows.isEmpty() ? new HashMap<>() : normalizeRiverLogRow(rows.getFirst());
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryRiverHourRows(List<DataParam> dataList) {
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ID, STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, Z, Q, V, MSQMT, RECORD_USER, ")
|
||||
.append("RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME, FID, REMARK ")
|
||||
.append("FROM SD_RIVER_R WHERE ");
|
||||
List<Object> args = new ArrayList<>();
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataParam item : dataList) {
|
||||
if (item == null || StrUtil.isBlank(item.getId()) || StrUtil.isBlank(item.getTm())) {
|
||||
continue;
|
||||
}
|
||||
conditions.add("(STCD = ? AND TM = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'))");
|
||||
args.add(item.getId());
|
||||
args.add(item.getTm());
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
sql.append(String.join(" OR ", conditions));
|
||||
return normalizeRiverLogRows(jdbcTemplate.queryForList(sql.toString(), args.toArray()));
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryRiverDayRows(List<DataParam> dataList) {
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ID, STCD, TO_CHAR(DT, 'YYYY-MM-DD HH24:MI:SS') AS DT, Z, Q, V, MSQMT, RECORD_USER, ")
|
||||
.append("RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME ")
|
||||
.append("FROM SD_RIVERDAY_S WHERE ");
|
||||
List<Object> args = new ArrayList<>();
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataParam item : dataList) {
|
||||
if (item == null || StrUtil.isBlank(item.getId()) || StrUtil.isBlank(item.getDt())) {
|
||||
continue;
|
||||
}
|
||||
conditions.add("(STCD = ? AND DT = TO_DATE(?, 'YYYY-MM-DD HH24:MI:SS'))");
|
||||
args.add(item.getId());
|
||||
args.add(item.getDt());
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
sql.append(String.join(" OR ", conditions));
|
||||
return normalizeRiverLogRows(jdbcTemplate.queryForList(sql.toString(), args.toArray()));
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> queryRiverMonthRows(List<DataParam> dataList) {
|
||||
if (CollUtil.isEmpty(dataList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
StringBuilder sql = new StringBuilder("SELECT ID, STCD, TO_CHAR(TM, 'YYYY-MM-DD HH24:MI:SS') AS TM, DRTP, YEAR, MONTH, DR, Z, Q, V, MSQMT, ")
|
||||
.append("RECORD_USER, RECORD_TIME, MODIFY_USER, MODIFY_TIME, IS_DELETED, DELETE_USER, DELETE_TIME ")
|
||||
.append("FROM SD_RIVERDRTP_S WHERE ");
|
||||
List<Object> args = new ArrayList<>();
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataParam item : dataList) {
|
||||
if (item == null || StrUtil.isBlank(item.getId()) || StrUtil.isBlank(item.getDrtp())
|
||||
|| StrUtil.isBlank(item.getYear()) || StrUtil.isBlank(item.getMonth())) {
|
||||
continue;
|
||||
}
|
||||
conditions.add("(STCD = ? AND DRTP = ? AND YEAR = ? AND MONTH = ?)");
|
||||
args.add(item.getId());
|
||||
args.add(item.getDrtp());
|
||||
args.add(Integer.parseInt(item.getYear()));
|
||||
args.add(Integer.parseInt(item.getMonth()));
|
||||
}
|
||||
if (conditions.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
sql.append(String.join(" OR ", conditions));
|
||||
return normalizeRiverLogRows(jdbcTemplate.queryForList(sql.toString(), args.toArray()));
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> normalizeRiverLogRows(List<Map<String, Object>> rows) {
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return result;
|
||||
}
|
||||
for (Map<String, Object> row : rows) {
|
||||
result.add(normalizeRiverLogRow(row));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Map<String, Object> normalizeRiverLogRow(Map<String, Object> row) {
|
||||
Map<String, Object> normalized = new LinkedHashMap<>();
|
||||
if (row == null || row.isEmpty()) {
|
||||
return normalized;
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
normalized.put(entry.getKey() == null ? null : entry.getKey().toUpperCase(), entry.getValue());
|
||||
}
|
||||
return normalized;
|
||||
}
|
||||
|
||||
private void recordRiverUpdateLog(Map<String, Object> beforeRow, Map<String, Object> updateData, String source) {
|
||||
if (updateData == null || updateData.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
String stcd = asString(updateData.get("stcd"));
|
||||
String recordId = asString(beforeRow.get("ID"));
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
for (Map.Entry<String, String> entry : ZQ_UPDATE_COLUMN_MAP.entrySet()) {
|
||||
if (!containsKeyIgnoreCase(updateData, entry.getKey())) {
|
||||
continue;
|
||||
}
|
||||
String column = entry.getValue();
|
||||
Object oldValue = beforeRow == null ? null : beforeRow.get(column);
|
||||
Object newValue = getValueIgnoreCase(updateData, entry.getKey());
|
||||
if (StrUtil.equals(formatRiverLogValue(oldValue), formatRiverLogValue(newValue))) {
|
||||
continue;
|
||||
}
|
||||
details.add(buildRiverLogDetail(null, ZQ_HOUR_TABLE_NAME, stcd, column,
|
||||
oldValue, resolveRiverDisplayValue(column, oldValue),
|
||||
newValue, resolveRiverDisplayValue(column, newValue), "修改字段值"));
|
||||
}
|
||||
if (details.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
MsOperationLog mainLog = buildRiverMainLog(recordId,"修改流量站小时数据", source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
detail.setMainId(mainLog.getId());
|
||||
}
|
||||
batchInsertRiverLogDetails(details);
|
||||
}
|
||||
|
||||
private void recordRiverDeleteLog(List<Map<String, Object>> rows, String tableName, String remark, String source) {
|
||||
if (CollUtil.isEmpty(rows)) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<MsOperationLogDetail> details = new ArrayList<>();
|
||||
for (Map<String, Object> row : rows) {
|
||||
String stcd = asString(row.get("STCD"));
|
||||
String recordId = asString(row.get("ID"));
|
||||
MsOperationLog mainLog = buildRiverMainLog(recordId,remark, source);
|
||||
msOperationLogMapper.insert(mainLog);
|
||||
for (Map.Entry<String, Object> entry : row.entrySet()) {
|
||||
String fieldCode = entry.getKey();
|
||||
Object oldValue = entry.getValue();
|
||||
if (StrUtil.isBlank(fieldCode) || oldValue == null) {
|
||||
continue;
|
||||
}
|
||||
details.add(buildRiverLogDetail(mainLog.getId(), tableName, stcd, fieldCode,
|
||||
oldValue, resolveRiverDisplayValue(fieldCode, oldValue),
|
||||
null, null, "删除字段值"));
|
||||
}
|
||||
}
|
||||
batchInsertRiverLogDetails(details);
|
||||
}
|
||||
|
||||
private MsOperationLog buildRiverMainLog(String recordId,String remark, String source) {
|
||||
MsOperationLog log = new MsOperationLog();
|
||||
log.setOperator(resolveRiverLogOperator());
|
||||
log.setOperateTime(new Date());
|
||||
log.setRecordId(recordId);
|
||||
log.setTableName(ZQ_HOUR_TABLE_NAME);
|
||||
log.setSource(StrUtil.trimToNull(source));
|
||||
log.setRemark(remark);
|
||||
return log;
|
||||
}
|
||||
|
||||
private MsOperationLogDetail buildRiverLogDetail(String mainId,
|
||||
String tableName,
|
||||
String stationCode,
|
||||
String fieldCode,
|
||||
Object oldValueCode,
|
||||
Object oldValueName,
|
||||
Object newValueCode,
|
||||
Object newValueName,
|
||||
String remark) {
|
||||
MsOperationLogDetail detail = new MsOperationLogDetail();
|
||||
detail.setMainId(mainId);
|
||||
detail.setTableName(tableName);
|
||||
detail.setStationCode(stationCode);
|
||||
detail.setFieldCode(fieldCode);
|
||||
detail.setFieldMeaning(ZQ_FIELD_MEANING_MAP.getOrDefault(fieldCode, fieldCode));
|
||||
detail.setOldValueCode(formatRiverLogValue(oldValueCode));
|
||||
detail.setOldValueName(formatRiverLogValue(oldValueName));
|
||||
detail.setNewValueCode(formatRiverLogValue(newValueCode));
|
||||
detail.setNewValueName(formatRiverLogValue(newValueName));
|
||||
detail.setRemark(remark);
|
||||
return detail;
|
||||
}
|
||||
|
||||
private void batchInsertRiverLogDetails(List<MsOperationLogDetail> details) {
|
||||
if (CollUtil.isEmpty(details)) {
|
||||
return;
|
||||
}
|
||||
for (MsOperationLogDetail detail : details) {
|
||||
if (detail == null) {
|
||||
continue;
|
||||
}
|
||||
msOperationLogDetailMapper.insert(detail);
|
||||
}
|
||||
}
|
||||
|
||||
private Object resolveRiverDisplayValue(String fieldCode, Object rawValue) {
|
||||
return formatRiverLogValue(rawValue);
|
||||
}
|
||||
|
||||
private Object getValueIgnoreCase(Map<String, Object> data, String key) {
|
||||
if (data == null || StrUtil.isBlank(key)) {
|
||||
return null;
|
||||
}
|
||||
if (data.containsKey(key)) {
|
||||
return data.get(key);
|
||||
}
|
||||
for (Map.Entry<String, Object> entry : data.entrySet()) {
|
||||
if (StrUtil.equalsIgnoreCase(entry.getKey(), key)) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean containsKeyIgnoreCase(Map<String, Object> data, String key) {
|
||||
if (data == null || StrUtil.isBlank(key)) {
|
||||
return false;
|
||||
}
|
||||
if (data.containsKey(key)) {
|
||||
return true;
|
||||
}
|
||||
for (String mapKey : data.keySet()) {
|
||||
if (StrUtil.equalsIgnoreCase(mapKey, key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private String resolveRiverLogOperator() {
|
||||
try {
|
||||
return SecurityUtils.getCurrentUsername();
|
||||
} catch (Exception ignored) {
|
||||
try {
|
||||
return SecurityUtils.getUserId();
|
||||
} catch (Exception ex) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String formatRiverLogValue(Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
}
|
||||
if (value instanceof Date date) {
|
||||
return cn.hutool.core.date.DateUtil.formatDateTime(date);
|
||||
}
|
||||
return String.valueOf(value);
|
||||
}
|
||||
|
||||
private void statisticsDayDataFromHour(String stcd, String startDate, String endDate) {
|
||||
String deleteSql = "DELETE FROM SD_RIVERDAY_S T " +
|
||||
"WHERE T.STCD = ? " +
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplegendB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerAo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerBizService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图层管理
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mapLayer")
|
||||
@Tag(name = "地图图层管理")
|
||||
public class MapLayerController {
|
||||
|
||||
@Resource
|
||||
private IMapLayerBizService mapLayerBizService;
|
||||
|
||||
@Resource
|
||||
private IMapLayerService layerService;
|
||||
|
||||
/**
|
||||
* 地图图层管理图层树(所有)
|
||||
*/
|
||||
@Operation(summary = "地图图层管理图层树(所有)")
|
||||
@PostMapping("/getAllMapLayerTree")
|
||||
public ResponseResult getAllMapLayerTree(@RequestBody MapLayerAo flag) {
|
||||
List<MsMaplayerB> tree = mapLayerBizService.getMapLayerTree(flag);
|
||||
// 构建 Kendo 数据源结果
|
||||
DataSourceResult<MsMaplayerB> dataSourceResult = new DataSourceResult<>();
|
||||
dataSourceResult.setData(tree);
|
||||
// 计算总节点数
|
||||
long total = countTreeNodes(tree);
|
||||
dataSourceResult.setTotal(tree.size());
|
||||
return ResponseResult.successData(dataSourceResult);
|
||||
}
|
||||
private long countTreeNodes(List<MsMaplayerB> nodes) {
|
||||
if (nodes == null) return 0;
|
||||
long count = 0;
|
||||
for (MsMaplayerB node : nodes) {
|
||||
count++; // 当前节点
|
||||
if (node.getChildren() != null && !node.getChildren().isEmpty()) {
|
||||
count += countTreeNodes(node.getChildren());
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* 图层新增修改
|
||||
*/
|
||||
@Operation(summary = "图层新增修改")
|
||||
@PostMapping("/save")
|
||||
public ResponseResult addLayer(@RequestBody MsMaplayerB layer) {
|
||||
if (layer == null) {
|
||||
return ResponseResult.error("图层信息不能为空.");
|
||||
}
|
||||
if (StrUtil.isBlank(layer.getCode())) {
|
||||
throw new BizException("图层编码(code)不能为空.");
|
||||
}
|
||||
if (StrUtil.isBlank(layer.getTitle())) {
|
||||
throw new BizException("图层名称(title)不能为空.");
|
||||
}
|
||||
layerService.saveOrUpdate(layer);
|
||||
return ResponseResult.success("保存成功.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 图层删除
|
||||
*/
|
||||
@Operation(summary = "图层删除")
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult deleteLayer(@RequestBody List<String> ids) {
|
||||
layerService.delelteByIds(ids);
|
||||
return ResponseResult.success("删除成功.");
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,209 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.common.exception.BizException;
|
||||
import com.yfd.platform.config.ResponseResult;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplegendB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMaplayerBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLegendService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLegendBizService;
|
||||
import com.yfd.platform.utils.DataSourceRequestUtil;
|
||||
import com.yfd.platform.utils.SecurityUtils;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 地图图例管理
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/mapLegend")
|
||||
@Tag(name = "地图图例管理")
|
||||
public class MapLegendController {
|
||||
|
||||
@Resource
|
||||
private IMapLegendService mapLegendService;
|
||||
|
||||
@Resource
|
||||
private IMapLegendBizService mapLegendBizService;
|
||||
|
||||
@Resource
|
||||
private MsMaplayerBMapper msMaplayerBMapper; // 新增注入
|
||||
/**
|
||||
* 条件过滤数据列表(Kendo UI 数据源)
|
||||
*/
|
||||
@Operation(summary = "条件过滤数据列表")
|
||||
@PostMapping("/GetKendoList")
|
||||
public ResponseResult getKendoList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
// 构建查询条件
|
||||
QueryWrapper<MsMaplegendB> wrapper = DataSourceRequestUtil.buildQueryWrapper(
|
||||
dataSourceRequest, MsMaplegendB.class);
|
||||
|
||||
// 执行分页查询
|
||||
Page<MsMaplegendB> page = DataSourceRequestUtil.getPage(dataSourceRequest);
|
||||
Page<MsMaplegendB> resultPage;
|
||||
if (page != null) {
|
||||
resultPage = mapLegendService.page(page, wrapper);
|
||||
} else {
|
||||
List<MsMaplegendB> list = mapLegendService.list(wrapper);
|
||||
resultPage = new Page<>();
|
||||
resultPage.setRecords(list);
|
||||
resultPage.setTotal(list.size());
|
||||
}
|
||||
|
||||
List<MsMaplegendB> records = resultPage.getRecords();
|
||||
if (records != null && !records.isEmpty()) {
|
||||
// ---------- 2. 批量获取父级信息(用于 parentCode、parentName)----------
|
||||
Set<String> parentIds = records.stream()
|
||||
.filter(e -> e.getDataType() != null && e.getDataType() == 2) // 只处理图例数据
|
||||
.map(MsMaplegendB::getParentId)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, MsMaplegendB> parentMap = new HashMap<>();
|
||||
if (!parentIds.isEmpty()) {
|
||||
List<MsMaplegendB> parents = mapLegendService.listByIds(parentIds);
|
||||
parentMap = parents.stream()
|
||||
.collect(Collectors.toMap(MsMaplegendB::getId, Function.identity()));
|
||||
}
|
||||
|
||||
// ---------- 3. 批量获取图层名称(根据 layerCode 查 MS_MAPLAYER_B)----------
|
||||
Set<String> layerCodes = records.stream()
|
||||
.map(MsMaplegendB::getLayerCode)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, String> layerCodeNameMap = new HashMap<>();
|
||||
if (!layerCodes.isEmpty()) {
|
||||
// 使用 Mapper 查询
|
||||
List<MsMaplayerB> layerList = msMaplayerBMapper.selectList(
|
||||
new LambdaQueryWrapper<MsMaplayerB>()
|
||||
.in(MsMaplayerB::getCode, layerCodes)
|
||||
);
|
||||
layerCodeNameMap = layerList.stream()
|
||||
.collect(Collectors.toMap(MsMaplayerB::getCode, MsMaplayerB::getTitle));
|
||||
}
|
||||
|
||||
// ---------- 4. 遍历记录,填充三个额外字段 ----------
|
||||
for (MsMaplegendB entity : records) {
|
||||
// 4.1 填充 parentCode / parentName(仅 dataType=2)
|
||||
if (entity.getDataType() != null && entity.getDataType() == 2) {
|
||||
String parentId = entity.getParentId();
|
||||
if (parentId != null && parentMap.containsKey(parentId)) {
|
||||
MsMaplegendB parent = parentMap.get(parentId);
|
||||
entity.setParentCode(parent.getCode());
|
||||
entity.setParentName(parent.getName());
|
||||
} else {
|
||||
entity.setParentCode(null);
|
||||
entity.setParentName(null);
|
||||
}
|
||||
} else {
|
||||
// 非 dataType=2 的记录,这两个字段置空
|
||||
entity.setParentCode(null);
|
||||
entity.setParentName(null);
|
||||
}
|
||||
|
||||
// 4.2 填充 layerCodeName(所有记录均可填充,如果图层不存在则置空)
|
||||
String layerCode = entity.getLayerCode();
|
||||
if (layerCode != null && layerCodeNameMap.containsKey(layerCode)) {
|
||||
entity.setLayerCodeName(layerCodeNameMap.get(layerCode));
|
||||
} else {
|
||||
entity.setLayerCodeName(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 构建 Kendo 数据源结果
|
||||
DataSourceResult<MsMaplegendB> dataSourceResult = new DataSourceResult<>();
|
||||
dataSourceResult.setData(resultPage.getRecords());
|
||||
dataSourceResult.setTotal(resultPage.getTotal());
|
||||
|
||||
return ResponseResult.successData(dataSourceResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 图例新增修改
|
||||
*/
|
||||
@Operation(summary = "图例新增修改")
|
||||
@PostMapping("/save")
|
||||
public ResponseResult addLayer(@RequestBody MsMaplegendB legend) {
|
||||
if (legend == null) {
|
||||
return ResponseResult.error("图例信息不能为空.");
|
||||
}
|
||||
if (StrUtil.isBlank(legend.getCode())) {
|
||||
throw new BizException("图例类型(code: pointLayer=用于锚点,baseLayer=地图GIS)不能为空.");
|
||||
}
|
||||
if (StrUtil.isBlank(legend.getName())) {
|
||||
throw new BizException("图例名称(name)不能为空.");
|
||||
}
|
||||
if (StrUtil.isBlank(legend.getNameEn())) {
|
||||
throw new BizException("图例编码(nameEn)不能为空.");
|
||||
}
|
||||
if (legend.getDataType() == null) {
|
||||
throw new BizException("图例数据类型(dataType: 1=结构,2=数据)不能为空.");
|
||||
}
|
||||
if (legend.getDataType() == 2 && StrUtil.isBlank(legend.getLayerCode())) {
|
||||
throw new BizException("关联的图层编码(layerCode)不能为空.");
|
||||
}
|
||||
if (StrUtil.isNotBlank(legend.getName())){
|
||||
if(StrUtil.isBlank(legend.getGroupName())){
|
||||
legend.setGroupName(legend.getName());
|
||||
}
|
||||
if(StrUtil.isBlank(legend.getParentName())){
|
||||
legend.setGroupName(legend.getName());
|
||||
}
|
||||
}
|
||||
legend.setRecordUser(SecurityUtils.getUserId());
|
||||
mapLegendService.saveOrUpdate(legend);
|
||||
return ResponseResult.success("保存成功.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 图例删除
|
||||
*/
|
||||
@Operation(summary = "图例删除")
|
||||
@PostMapping("/delete")
|
||||
public ResponseResult deleteLayer(@RequestBody List<String> ids) {
|
||||
mapLegendService.delelteByIds(ids);
|
||||
return ResponseResult.success("删除成功.");
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图图例管理图层树(下拉选)
|
||||
*/
|
||||
@Operation(summary = "地图图例管理图层树(下拉选)")
|
||||
@GetMapping("/getAllMapLegendTree")
|
||||
public ResponseResult getAllMapLayerTree(Integer flag) {
|
||||
List<MapLegendVo> tree = mapLegendBizService.getMapLegendTree(flag);
|
||||
return ResponseResult.successData(tree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图图例列表
|
||||
*/
|
||||
@Operation(summary = "地图图例列表")
|
||||
@GetMapping("/getModuleMapLegendList")
|
||||
public ResponseResult getModuleMapLegendList(@RequestParam(required = false) String moduleId) {
|
||||
List<MapLegendVo> list = mapLegendBizService.getModuleMapLegendList(moduleId);
|
||||
return ResponseResult.successData(list);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,195 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图层表
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@TableName("MS_MAPLAYER_B")
|
||||
public class MsMaplayerB implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/** 类型 */
|
||||
@TableField("TYPE")
|
||||
private String type;
|
||||
|
||||
/** 标识字段 */
|
||||
@TableField("KEY")
|
||||
private String key;
|
||||
|
||||
/** 编码 */
|
||||
@TableField("CODE")
|
||||
private String code;
|
||||
|
||||
/** 名称 */
|
||||
@TableField("TITLE")
|
||||
private String title;
|
||||
|
||||
/** 名称英文 */
|
||||
@TableField("TITLE_EN")
|
||||
private String titleEn;
|
||||
|
||||
/** 所属父节点 */
|
||||
@TableField("PARENT_ID")
|
||||
private String parentId;
|
||||
|
||||
/** 树全路径 */
|
||||
@TableField("FULL_PATH")
|
||||
private String fullPath;
|
||||
|
||||
/** 层级 */
|
||||
@TableField("TREE_LEVEL")
|
||||
private Integer treeLevel;
|
||||
|
||||
/** 是否有子集:0=否 1=有 */
|
||||
@TableField("HAS_CHILDREN")
|
||||
private Integer hasChildren;
|
||||
|
||||
/** 对应锚点接口 */
|
||||
@TableField("URL")
|
||||
private String url;
|
||||
|
||||
/** 对应三维锚点接口 */
|
||||
@TableField("URL_THD")
|
||||
private String urlThd;
|
||||
|
||||
/** 参数设置 */
|
||||
@TableField("OPTIONS")
|
||||
private String options;
|
||||
|
||||
/** 访问令牌 */
|
||||
@TableField("TOKEN")
|
||||
private String token;
|
||||
|
||||
/** 用户名 */
|
||||
@TableField("USERNAME")
|
||||
private String username;
|
||||
|
||||
/** 密码 */
|
||||
@TableField("PASSWORD")
|
||||
private String password;
|
||||
|
||||
/** 地图中心点经度 */
|
||||
@TableField("CENTER_LGTD")
|
||||
private BigDecimal centerLgtd;
|
||||
|
||||
/** 地图中心点纬度 */
|
||||
@TableField("CENTER_LTTD")
|
||||
private BigDecimal centerLttd;
|
||||
|
||||
/** 默认缩放级别 */
|
||||
@TableField("DEFAULT_ZOOM")
|
||||
private String defaultZoom;
|
||||
|
||||
/** 所属国家 */
|
||||
@TableField("COUNTRY")
|
||||
private String country;
|
||||
|
||||
/** 图标 */
|
||||
@TableField("ICON")
|
||||
private String icon;
|
||||
|
||||
/** 是否可选择:0=否 1=是 */
|
||||
@TableField("CHECKABLE")
|
||||
private Integer checkable;
|
||||
|
||||
/** 图层上下层层级关系 */
|
||||
@TableField("Z_INDEX")
|
||||
private String zIndex;
|
||||
|
||||
/** 各类站点图层对应类型 */
|
||||
@TableField("STTP_TYPE")
|
||||
private String sttpType;
|
||||
|
||||
/** 图层展示数据格式 */
|
||||
@TableField("LAYERS")
|
||||
private String layers;
|
||||
|
||||
/** 图层透明度 */
|
||||
@TableField("OPACITY")
|
||||
private BigDecimal opacity;
|
||||
|
||||
/** 额外参数 */
|
||||
@TableField("PARAMJSON")
|
||||
private String paramJson;
|
||||
|
||||
/** 备注 */
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
/** 是否启用:0=禁用 1=启用 */
|
||||
@TableField("ENABLE")
|
||||
private Integer enable;
|
||||
|
||||
/** 排序 */
|
||||
@TableField("ORDER_INDEX")
|
||||
private Integer orderIndex;
|
||||
|
||||
/** 过滤内容 */
|
||||
@TableField("FILTER_CONTENT")
|
||||
private String filterContent;
|
||||
|
||||
/** 创建人 */
|
||||
@TableField("RECORD_USER")
|
||||
private String recordUser;
|
||||
|
||||
/** 创建时间 */
|
||||
@TableField("RECORD_TIME")
|
||||
private Date recordTime;
|
||||
|
||||
/** 更新人 */
|
||||
@TableField("MODIFY_USER")
|
||||
private String modifyUser;
|
||||
|
||||
/** 更新时间 */
|
||||
@TableField("MODIFY_TIME")
|
||||
private Date modifyTime;
|
||||
|
||||
/** 是否已删除:0=未删除 1=已删除 */
|
||||
@TableField("IS_DELETED")
|
||||
private Integer isDeleted;
|
||||
|
||||
/** 删除人 */
|
||||
@TableField("DELETE_USER")
|
||||
private String deleteUser;
|
||||
|
||||
/** 删除时间 */
|
||||
@TableField("DELETE_TIME")
|
||||
private Date deleteTime;
|
||||
|
||||
/** 数据类型:1=结构,2=数据 */
|
||||
@TableField("DATA_TYPE")
|
||||
private Integer dataType;
|
||||
|
||||
/** 标签层级 */
|
||||
@TableField("LABEL_LEVEL")
|
||||
private Integer labelLevel;
|
||||
|
||||
/** 标签层级 */
|
||||
@TableField("ANCHOR_PARAM_JSON")
|
||||
private String anchorParamJson;
|
||||
|
||||
/** 子级集合(非数据库字段) */
|
||||
@TableField(exist = false)
|
||||
private List<MsMaplayerB> children;
|
||||
|
||||
/** 创建人名称(非数据库字段) */
|
||||
@TableField(exist = false)
|
||||
private String displayRecordUser;
|
||||
}
|
||||
@ -0,0 +1,140 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 地图图例表
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@TableName("MS_MAPLEGEND_B")
|
||||
public class MsMaplegendB implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
@TableField("NAME")
|
||||
private String name;
|
||||
|
||||
@TableField("NAME_EN")
|
||||
private String nameEn;
|
||||
|
||||
@TableField("CODE")
|
||||
private String code;
|
||||
|
||||
@TableField("ICON")
|
||||
private String icon;
|
||||
|
||||
@TableField("GROUP_NAME")
|
||||
private String groupName;
|
||||
|
||||
@TableField("PARENT_NAME")
|
||||
private String parentName;
|
||||
|
||||
@TableField("LAYER_CODE")
|
||||
private String layerCode;
|
||||
|
||||
@TableField("MIN_ZOOM")
|
||||
private Integer minZoom;
|
||||
|
||||
@TableField("MAX_ZOOM")
|
||||
private Integer maxZoom;
|
||||
|
||||
@TableField("MIN_HEIGHT_THD")
|
||||
private BigDecimal minHeightThd;
|
||||
|
||||
@TableField("MAX_HEIGHT_THD")
|
||||
private BigDecimal maxHeightThd;
|
||||
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
@TableField("ENABLE")
|
||||
private Integer enable;
|
||||
|
||||
@TableField("INTERNAL")
|
||||
private Integer internal;
|
||||
|
||||
@TableField("ORDER_INDEX")
|
||||
private Integer orderIndex;
|
||||
|
||||
@TableField("FILTER_CONTENT")
|
||||
private String filterContent;
|
||||
|
||||
@TableField("RECORD_USER")
|
||||
private String recordUser;
|
||||
|
||||
@TableField("RECORD_TIME")
|
||||
private Date recordTime;
|
||||
|
||||
@TableField("MODIFY_USER")
|
||||
private String modifyUser;
|
||||
|
||||
@TableField("MODIFY_TIME")
|
||||
private Date modifyTime;
|
||||
|
||||
@TableField("IS_DELETED")
|
||||
private Integer isDeleted;
|
||||
|
||||
@TableField("DELETE_USER")
|
||||
private String deleteUser;
|
||||
|
||||
@TableField("DELETE_TIME")
|
||||
private Date deleteTime;
|
||||
|
||||
@TableField("IF_SHOW")
|
||||
private Integer ifShow;
|
||||
|
||||
@TableField("EXPRESSION")
|
||||
private String expression;
|
||||
|
||||
@TableField("EXT")
|
||||
private String ext;
|
||||
|
||||
@TableField("DATA_TYPE")
|
||||
private Integer dataType;
|
||||
|
||||
@TableField("PARENT_ID")
|
||||
private String parentId;
|
||||
|
||||
@TableField("FULL_PATH")
|
||||
private String fullPath;
|
||||
|
||||
@TableField("TREE_LEVEL")
|
||||
private Integer treeLevel;
|
||||
|
||||
@TableField("HAS_CHILDREN")
|
||||
private Integer hasChildren;
|
||||
|
||||
@TableField("COLOR")
|
||||
private String color;
|
||||
|
||||
@TableField("SHAPE")
|
||||
private String shape;
|
||||
|
||||
@TableField("MIN_VAL")
|
||||
private BigDecimal minVal;
|
||||
|
||||
@TableField("MAX_VAL")
|
||||
private BigDecimal maxVal;
|
||||
|
||||
@TableField("IS_FILTER")
|
||||
private Integer isFilter;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String layerCodeName;
|
||||
|
||||
@TableField(exist = false)
|
||||
private String parentCode;
|
||||
}
|
||||
@ -0,0 +1,98 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 地图与菜单映射表
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@TableName("MS_MAPMODULE_B")
|
||||
public class MsMapmoduleB implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
@TableField("MODULE_ID")
|
||||
private String moduleId;
|
||||
|
||||
@TableField("RES_TYPE")
|
||||
private String resType;
|
||||
|
||||
@TableField("RES_ID")
|
||||
private String resId;
|
||||
|
||||
@TableField("CHILD_NODE")
|
||||
private Integer childNode;
|
||||
|
||||
@TableField("MULTI_SELECT")
|
||||
private Integer multiSelect;
|
||||
|
||||
@TableField("CAN_BE_CHECKED")
|
||||
private Integer canBeChecked;
|
||||
|
||||
@TableField("CHECKED")
|
||||
private Integer checked;
|
||||
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
@TableField("ENABLE")
|
||||
private Integer enable;
|
||||
|
||||
@TableField("ORDER_INDEX")
|
||||
private Integer orderIndex;
|
||||
|
||||
@TableField("FILTER_CONTENT")
|
||||
private String filterContent;
|
||||
|
||||
@TableField("RECORD_USER")
|
||||
private String recordUser;
|
||||
|
||||
@TableField("RECORD_TIME")
|
||||
private Date recordTime;
|
||||
|
||||
@TableField("MODIFY_USER")
|
||||
private String modifyUser;
|
||||
|
||||
@TableField("MODIFY_TIME")
|
||||
private Date modifyTime;
|
||||
|
||||
@TableField("IS_DELETED")
|
||||
private Integer isDeleted;
|
||||
|
||||
@TableField("DELETE_USER")
|
||||
private String deleteUser;
|
||||
|
||||
@TableField("DELETE_TIME")
|
||||
private Date deleteTime;
|
||||
|
||||
@TableField("TEMPLATE_ID")
|
||||
private String templateId;
|
||||
|
||||
@TableField("SYSTEM_ID")
|
||||
private String systemId;
|
||||
|
||||
/**
|
||||
* 归属的系统ID(非数据库字段,用于字典翻译)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String systemName;
|
||||
|
||||
/**
|
||||
* 菜单名称(非数据库字段,用于字典翻译)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String moduleName;
|
||||
|
||||
}
|
||||
@ -0,0 +1,186 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图工具箱表
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@TableName("MS_MAPTOOLBOX_B")
|
||||
public class MsMaptoolboxB implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField("NAME")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 名称(英文)
|
||||
*/
|
||||
@TableField("NAME_EN")
|
||||
private String nameEn;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@TableField("CODE")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 地图模式
|
||||
*/
|
||||
@TableField("MAP_MODEL")
|
||||
private String mapModel;
|
||||
|
||||
/**
|
||||
* 所属父节点
|
||||
*/
|
||||
@TableField("PATENT_ID")
|
||||
private String patentId;
|
||||
|
||||
/**
|
||||
* 树全路径
|
||||
*/
|
||||
@TableField("FULL_PATH")
|
||||
private String fullPath;
|
||||
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
@TableField("TREE_LEVEL")
|
||||
private Integer treeLevel;
|
||||
|
||||
/**
|
||||
* 是否有子集
|
||||
*/
|
||||
@TableField("HAS_CHILDREN")
|
||||
private Integer hasChildren;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
@TableField("ICON")
|
||||
private String icon;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@TableField("DESCRIPTION")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
@TableField("ENABLE")
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 系统内置项
|
||||
*/
|
||||
@TableField("INTERNAL")
|
||||
private Integer internal;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField("ORDER_INDEX")
|
||||
private Integer orderIndex;
|
||||
|
||||
/**
|
||||
* 过滤内容
|
||||
*/
|
||||
@TableField("FILTER_CONTENT")
|
||||
private String filterContent;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@TableField("RECORD_USER")
|
||||
private String recordUser;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField("RECORD_TIME")
|
||||
private Date recordTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@TableField("MODIFY_USER")
|
||||
private String modifyUser;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField("MODIFY_TIME")
|
||||
private Date modifyTime;
|
||||
|
||||
/**
|
||||
* 是否已删除
|
||||
*/
|
||||
@TableField("IS_DELETED")
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
* 删除人
|
||||
*/
|
||||
@TableField("DELETE_USER")
|
||||
private String deleteUser;
|
||||
|
||||
/**
|
||||
* 删除时间
|
||||
*/
|
||||
@TableField("DELETE_TIME")
|
||||
private Date deleteTime;
|
||||
|
||||
/**
|
||||
* 类型:0-功能区 1-地形 2-图例
|
||||
*/
|
||||
@TableField("TOOL_TYPE")
|
||||
private Integer toolType;
|
||||
|
||||
/**
|
||||
* 归属的系统ID(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private String systemId;
|
||||
|
||||
/**
|
||||
* 是否默认勾选(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer checked;
|
||||
|
||||
/**
|
||||
* 是否可勾选(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer canBeChecked;
|
||||
|
||||
/**
|
||||
* 是否多选(非数据库字段,来自MS_MAPMODULE_B关联)
|
||||
*/
|
||||
@TableField(exist = false)
|
||||
private Integer multiSelect;
|
||||
|
||||
/** 子级集合(非数据库字段) */
|
||||
@TableField(exist = false)
|
||||
private List<MsMaptoolboxB> children;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 地图图层查询参数
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
public class MapLayerAo {
|
||||
|
||||
/** 图层名称(模糊查询) */
|
||||
private String title;
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图层管理封装VO
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "地图图层管理封装VO")
|
||||
public class MapLayerVo {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "父id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "标题名称")
|
||||
private String title;
|
||||
|
||||
@Schema(description = "图层标识")
|
||||
@JsonProperty(value = "key")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "标签层级")
|
||||
@JsonProperty(value = "labelLevel")
|
||||
private Integer labelLevel;
|
||||
|
||||
@Schema(description = "是否可以选择:0=否 1=是")
|
||||
private Integer checkable;
|
||||
|
||||
@Schema(description = "图层分类")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "图层上下层层级关系")
|
||||
@JsonProperty(value = "zIndex")
|
||||
private String zIndex;
|
||||
|
||||
@Schema(description = "各类站点图层对应类型")
|
||||
private String sttpType;
|
||||
|
||||
@Schema(description = "图层展示数据格式")
|
||||
private String layers;
|
||||
|
||||
@Schema(description = "url地址")
|
||||
private String url;
|
||||
|
||||
@Schema(description = "3D url地址")
|
||||
private String urlThd;
|
||||
|
||||
@Schema(description = "图层透明度")
|
||||
private BigDecimal opacity;
|
||||
|
||||
@Schema(description = "子级集合")
|
||||
private List<MapLayerVo> children;
|
||||
|
||||
@Schema(description = "参数json")
|
||||
private String paramJson;
|
||||
|
||||
@Schema(description = "参数ANCHOR_PARAM_JSON")
|
||||
private String anchorParamJson;
|
||||
|
||||
@Schema(description = "排序")
|
||||
private String orderIndex;
|
||||
|
||||
@Schema(description = "是否默认勾选:0=否 1=是")
|
||||
private Integer checked;
|
||||
|
||||
@Schema(description = "是否可勾选:0=否 1=是")
|
||||
private Integer canBeChecked;
|
||||
|
||||
@Schema(description = "是否多选:0=否 1=是")
|
||||
private Integer multiSelect;
|
||||
@Schema(description = "参数设置:steady=静态 dynamic=动态")
|
||||
private String options;
|
||||
}
|
||||
@ -0,0 +1,100 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.entity.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图例VO
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "地图图例VO")
|
||||
public class MapLegendVo {
|
||||
|
||||
@Schema(description = "图例id")
|
||||
private String id;
|
||||
|
||||
@Schema(description = "父级id")
|
||||
private String parentId;
|
||||
|
||||
@Schema(description = "分组名")
|
||||
private String groupName;
|
||||
|
||||
@Schema(description = "层级名称")
|
||||
private String parentName;
|
||||
|
||||
@Schema(description = "图例名")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "图例code")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "图例icon")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "图例英文(对应描点数据中的状态)")
|
||||
private String nameEn;
|
||||
|
||||
@Schema(description = "图层code")
|
||||
private String layerCode;
|
||||
|
||||
@Schema(description = "是否多选;0=否;1=是")
|
||||
private Integer multiSelect;
|
||||
|
||||
@Schema(description = "是否默认勾选;0=否;1=是")
|
||||
private Integer checked;
|
||||
|
||||
@Schema(description = "0=否;1=是")
|
||||
private Integer enable;
|
||||
|
||||
@Schema(description = "是否可勾选;0=否;1=是")
|
||||
private Integer canBeChecked;
|
||||
|
||||
@Schema(description = "子排序")
|
||||
private Integer orderIndex;
|
||||
|
||||
@Schema(description = "父排序")
|
||||
private Integer pSort;
|
||||
|
||||
@Schema(description = "最小缩放等级")
|
||||
private Integer minZoom;
|
||||
|
||||
@Schema(description = "最大缩放等级")
|
||||
private Integer maxZoom;
|
||||
|
||||
@Schema(description = "最小高程-三维")
|
||||
private BigDecimal minHeightThd;
|
||||
|
||||
@Schema(description = "最大高程-三维")
|
||||
private BigDecimal maxHeightThd;
|
||||
|
||||
@Schema(description = "是否显示;0=否;1=是")
|
||||
private Integer ifShow;
|
||||
|
||||
@Schema(description = "是否过滤;0=否;1=是")
|
||||
private Integer isFilter;
|
||||
|
||||
@JsonProperty(value = "color")
|
||||
@Schema(description = "图例颜色")
|
||||
private String color;
|
||||
|
||||
@JsonProperty(value = "shape")
|
||||
@Schema(description = "图例形状")
|
||||
private String shape;
|
||||
|
||||
@JsonProperty(value = "minVal")
|
||||
@Schema(description = "区间最小值")
|
||||
private BigDecimal minVal;
|
||||
|
||||
@JsonProperty(value = "maxVal")
|
||||
@Schema(description = "区间最大值")
|
||||
private BigDecimal maxVal;
|
||||
|
||||
@Schema(description = "子级")
|
||||
private List<MapLegendVo> childrenList;
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 地图图层表 Mapper 接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Mapper
|
||||
public interface MsMaplayerBMapper extends BaseMapper<MsMaplayerB> {
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplegendB;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 地图图例表 Mapper 接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Mapper
|
||||
public interface MsMaplegendBMapper extends BaseMapper<MsMaplegendB> {
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMapmoduleB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaptoolboxB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图与菜单映射表 Mapper 接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Mapper
|
||||
public interface MsMapmoduleBMapper extends BaseMapper<MsMapmoduleB> {
|
||||
|
||||
/**
|
||||
* 查询地图图层树(关联MS_MAPMODULE_B与MS_MAPLAYER_B)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT DISTINCT BML.ID,BML.ANCHOR_PARAM_JSON, BML.PARENT_ID AS parentId, BML.TITLE, BML.CODE, BML.LABEL_LEVEL AS labelLevel, "
|
||||
+ "BML.CHECKABLE, BML.TYPE, BML.Z_INDEX AS zIndex, BML.STTP_TYPE AS sttpType, BML.LAYERS, "
|
||||
+ "BML.PARAMJSON AS paramJson, BML.URL, BML.URL_THD AS urlThd, BML.OPACITY, BML.SYSTEM_ID AS systemId, "
|
||||
+ "BML.OPTIONS, BMM.MULTI_SELECT AS multiSelect, BMM.CAN_BE_CHECKED AS canBeChecked, "
|
||||
+ "CASE WHEN BMM.CHECKED IS NULL THEN 0 ELSE BMM.CHECKED END AS checked, BML.ORDER_INDEX "
|
||||
+ "FROM MS_MAPLAYER_B BML LEFT JOIN MS_MAPMODULE_B BMM ON BML.ID = BMM.RES_ID "
|
||||
+ "<if test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</if>"
|
||||
+ "<if test=\"sid != null and sid != ''\"> AND BMM.SYSTEM_ID = #{sid}</if>"
|
||||
+ "<choose>"
|
||||
+ "<when test=\"templateId != null and templateId != ''\"> AND BMM.TEMPLATE_ID = #{templateId}</when>"
|
||||
+ "<otherwise> AND (BMM.TEMPLATE_ID IS NULL OR BMM.TEMPLATE_ID = '00000000-0000-0000-0000-000000000000')</otherwise>"
|
||||
+ "</choose>"
|
||||
+ "WHERE BML.ENABLE = 1 AND (BML.TYPE NOT IN ('YXDT','DXDT','SLDT') OR BML.TYPE IS NULL) "
|
||||
+ "ORDER BY BML.ORDER_INDEX"
|
||||
+ "</script>")
|
||||
List<MapLayerVo> getMapLayerTree(@Param("moduleId") String moduleId, @Param("sid") String sid,
|
||||
@Param("templateId") String templateId);
|
||||
|
||||
/**
|
||||
* 查询地图工具箱(关联MS_MAPMODULE_B与MS_MAPTOOLBOX_B)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT DISTINCT MTB.ID, MTB.NAME, MTB.NAME_EN AS nameEn, MTB.MAP_MODEL AS mapModel, "
|
||||
+ "MTB.FULL_PATH AS fullPath, MTB.TREE_LEVEL AS treeLevel, MTB.HAS_CHILDREN AS hasChildren, "
|
||||
+ "MTB.PATENT_ID AS patentId, MTB.ICON, MTB.DESCRIPTION, MTB.ENABLE, MTB.INTERNAL, "
|
||||
+ "MTB.ORDER_INDEX AS orderIndex, MTB.RECORD_USER AS recordUser, MTB.RECORD_TIME AS recordTime, "
|
||||
+ "MTB.IS_DELETED AS isDeleted, MTB.TOOL_TYPE AS toolType, "
|
||||
+ "BMM.MULTI_SELECT AS multiSelect, BMM.CAN_BE_CHECKED AS canBeChecked, "
|
||||
+ "CASE WHEN BMM.CHECKED IS NULL AND MTB.NAME_EN NOT IN ('left','right','bottom') THEN 0 ELSE BMM.CHECKED END AS checked, "
|
||||
+ "BMM.SYSTEM_ID AS systemId, MTB.ORDER_INDEX "
|
||||
+ "FROM MS_MAPTOOLBOX_B MTB LEFT JOIN MS_MAPMODULE_B BMM ON MTB.ID = BMM.RES_ID "
|
||||
+ "<if test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</if>"
|
||||
+ "<if test=\"sid != null and sid != ''\"> AND BMM.SYSTEM_ID = #{sid}</if>"
|
||||
+ "<choose>"
|
||||
+ "<when test=\"templateId != null and templateId != ''\"> AND BMM.TEMPLATE_ID = #{templateId}</when>"
|
||||
+ "<otherwise> AND (BMM.TEMPLATE_ID IS NULL OR BMM.TEMPLATE_ID = '00000000-0000-0000-0000-000000000000')</otherwise>"
|
||||
+ "</choose>"
|
||||
+ "WHERE MTB.ENABLE = 1 ORDER BY MTB.ORDER_INDEX"
|
||||
+ "</script>")
|
||||
List<MsMaptoolboxB> getMapToolBox(@Param("moduleId") String moduleId, @Param("sid") String sid,
|
||||
@Param("templateId") String templateId);
|
||||
|
||||
/**
|
||||
* 查询模块关联的图例列表(关联MS_MAPMODULE_B与MS_MAPLEGEND_B)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT DISTINCT BML.PARENT_NAME AS parentName, BML.GROUP_NAME AS groupName, BML.NAME, BML.CODE, "
|
||||
+ "BML.ICON, BML.NAME_EN AS nameEn, BMM.MULTI_SELECT AS multiSelect, BMM.CHECKED AS checked, "
|
||||
+ "BMM.CAN_BE_CHECKED AS canBeChecked, BML.ORDER_INDEX, BMM.ORDER_INDEX AS pSort, "
|
||||
+ "BML.LAYER_CODE AS layerCode, BML.MIN_ZOOM AS minZoom, BML.MAX_ZOOM AS maxZoom, "
|
||||
+ "BML.MIN_HEIGHT_THD AS minHeightThd, BML.MAX_HEIGHT_THD AS maxHeightThd, "
|
||||
+ "BMM.ORDER_INDEX, BML.ORDER_INDEX "
|
||||
+ "FROM MS_MAPLEGEND_B BML LEFT JOIN MS_MAPMODULE_B BMM ON BML.ID = BMM.RES_ID AND BMM.IS_DELETED = 0 "
|
||||
+ "WHERE BMM.RES_TYPE = 'legend' AND BML.ENABLE = 1 AND BML.IS_DELETED = 0 "
|
||||
+ "<if test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</if>"
|
||||
+ "<if test=\"sid != null and sid != ''\"> AND BMM.SYSTEM_ID = #{sid}</if>"
|
||||
+ "<choose>"
|
||||
+ "<when test=\"templateId != null and templateId != ''\"> AND BMM.TEMPLATE_ID = #{templateId}</when>"
|
||||
+ "<otherwise> AND (BMM.TEMPLATE_ID IS NULL OR BMM.TEMPLATE_ID = '00000000-0000-0000-0000-000000000000')</otherwise>"
|
||||
+ "</choose>"
|
||||
+ "ORDER BY BMM.ORDER_INDEX, BML.ORDER_INDEX"
|
||||
+ "</script>")
|
||||
List<MapLegendVo> getModuleMapLegendList(@Param("moduleId") String moduleId, @Param("sid") String sid,
|
||||
@Param("templateId") String templateId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询模块关联的图例列表(单参数版本,用于地图图例管理页面)
|
||||
*/
|
||||
@Select("<script>"
|
||||
+ "SELECT BML.ID, BML.PARENT_ID AS parentId, BML.GROUP_NAME AS groupName, BML.PARENT_NAME AS parentName, "
|
||||
+ "BML.NAME, BML.CODE, BML.ICON, BML.NAME_EN AS nameEn, BML.LAYER_CODE AS layerCode, "
|
||||
+ "BML.MIN_ZOOM AS minZoom, BML.MAX_ZOOM AS maxZoom, "
|
||||
+ "BML.MIN_HEIGHT_THD AS minHeightThd, BML.MAX_HEIGHT_THD AS maxHeightThd, "
|
||||
+ "BML.IF_SHOW AS ifShow, BML.IS_FILTER AS isFilter, BML.COLOR, BML.SHAPE, BML.MIN_VAL AS minVal, BML.MAX_VAL AS maxVal, "
|
||||
+ "BML.ORDER_INDEX AS orderIndex, "
|
||||
+ "BMM.MULTI_SELECT AS multiSelect, BMM.CHECKED AS checked, BMM.CAN_BE_CHECKED AS canBeChecked, "
|
||||
+ "BMM.ORDER_INDEX AS pSort "
|
||||
+ "FROM MS_MAPLEGEND_B BML LEFT JOIN MS_MAPMODULE_B BMM ON BML.ID = BMM.RES_ID "
|
||||
+ "WHERE BMM.RES_TYPE = 'legend' AND BMM.IS_DELETED = 0 AND BML.IS_DELETED = 0 AND BML.ENABLE = 1 "
|
||||
+ "<choose>"
|
||||
+ "<when test=\"moduleId != null and moduleId != ''\"> AND BMM.MODULE_ID = #{moduleId}</when>"
|
||||
+ "<otherwise> AND BMM.MODULE_ID = 'common'</otherwise>"
|
||||
+ "</choose>"
|
||||
+ "ORDER BY BMM.ORDER_INDEX, BML.ORDER_INDEX"
|
||||
+ "</script>")
|
||||
List<MapLegendVo> getModuleMapLegendList(@Param("moduleId") String moduleId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaptoolboxB;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 地图工具箱表 Mapper 接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Mapper
|
||||
public interface MsMaptoolboxBMapper extends BaseMapper<MsMaptoolboxB> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.service;
|
||||
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerAo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图层业务服务接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
public interface IMapLayerBizService {
|
||||
|
||||
/**
|
||||
* 获取所有地图图层树
|
||||
*
|
||||
* @param flag 查询参数
|
||||
* @return 图层树列表
|
||||
*/
|
||||
List<MsMaplayerB> getMapLayerTree(MapLayerAo flag);
|
||||
|
||||
/**
|
||||
* 根据模块ID、系统ID、模板ID获取地图图层树(关联MS_MAPMODULE_B)
|
||||
*
|
||||
* @param moduleId 模块ID
|
||||
* @param systemId 系统ID
|
||||
* @param templateId 模板ID
|
||||
* @return 图层树列表
|
||||
*/
|
||||
List<MapLayerVo> getMapLayerTree(String moduleId, String systemId, String templateId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.service;
|
||||
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图层基础服务接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
public interface IMapLayerService {
|
||||
|
||||
/**
|
||||
* 新增或修改图层
|
||||
*
|
||||
* @param layer 图层实体
|
||||
* @return 是否成功
|
||||
*/
|
||||
boolean saveOrUpdate(MsMaplayerB layer);
|
||||
|
||||
/**
|
||||
* 根据ID列表删除图层
|
||||
*
|
||||
* @param ids 图层ID列表
|
||||
*/
|
||||
void delelteByIds(List<String> ids);
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.service;
|
||||
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLegendVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图例业务服务接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
public interface IMapLegendBizService {
|
||||
|
||||
/**
|
||||
* 获取地图图例树(下拉选)
|
||||
*
|
||||
* @param flag 数据类型过滤:null=全部, 1=结构, 2=数据
|
||||
* @return 图例树
|
||||
*/
|
||||
List<MapLegendVo> getMapLegendTree(Integer flag);
|
||||
|
||||
|
||||
/**
|
||||
* 根据模块ID、系统ID、模板ID获取模块关联的图例列表
|
||||
*
|
||||
* @param moduleId 模块ID
|
||||
* @param systemId 系统ID
|
||||
* @param templateId 模板ID
|
||||
* @return 图例列表
|
||||
*/
|
||||
List<MapLegendVo> getModuleMapLegendList(String moduleId, String systemId, String templateId);
|
||||
|
||||
/**
|
||||
* 根据模块ID获取模块关联的图例列表(单参数版本)
|
||||
*
|
||||
* @param moduleId 模块ID
|
||||
* @return 图例列表
|
||||
*/
|
||||
List<MapLegendVo> getModuleMapLegendList(String moduleId);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplegendB;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 地图图例基础服务接口
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
public interface IMapLegendService extends IService<MsMaplegendB> {
|
||||
|
||||
/**
|
||||
* 根据ID列表删除图例
|
||||
*
|
||||
* @param ids 图例ID列表
|
||||
*/
|
||||
void delelteByIds(List<String> ids);
|
||||
}
|
||||
@ -0,0 +1,214 @@
|
||||
package com.yfd.platform.qgc_sys.mapLayer.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.domain.MsMaplayerB;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerAo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.entity.vo.MapLayerVo;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMaplayerBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.mapper.MsMapmoduleBMapper;
|
||||
import com.yfd.platform.qgc_sys.mapLayer.service.IMapLayerBizService;
|
||||
import com.yfd.platform.system.domain.SysDictionary;
|
||||
import com.yfd.platform.system.domain.SysDictionaryItems;
|
||||
import com.yfd.platform.system.domain.SysUser;
|
||||
import com.yfd.platform.system.mapper.SysDictionaryItemsMapper;
|
||||
import com.yfd.platform.system.mapper.SysDictionaryMapper;
|
||||
import com.yfd.platform.system.mapper.SysUserMapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 地图图层业务服务实现
|
||||
*
|
||||
* @author migration
|
||||
*/
|
||||
@Service
|
||||
public class MapLayerBizServiceImpl implements IMapLayerBizService {
|
||||
|
||||
@Resource
|
||||
private MsMaplayerBMapper msMaplayerBMapper;
|
||||
|
||||
@Resource
|
||||
private SysDictionaryMapper sysDictionaryMapper;
|
||||
|
||||
@Resource
|
||||
private SysDictionaryItemsMapper sysDictionaryItemsMapper;
|
||||
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Resource
|
||||
private MsMapmoduleBMapper msMapmoduleBMapper;
|
||||
|
||||
@Override
|
||||
public List<MsMaplayerB> getMapLayerTree(MapLayerAo flag) {
|
||||
// 1. 查询字典 "DTZJLX" 获取需要排除的图层类型
|
||||
Set<String> excludeTypes = getExcludeTypes();
|
||||
|
||||
// 2. 查询所有未删除的图层数据,排除特殊类型,支持按名称模糊查询
|
||||
LambdaQueryWrapper<MsMaplayerB> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(MsMaplayerB::getIsDeleted, 0);
|
||||
|
||||
// 排除特殊类型
|
||||
if (!excludeTypes.isEmpty()) {
|
||||
wrapper.and(w -> w.notIn(MsMaplayerB::getType, excludeTypes).or().isNull(MsMaplayerB::getType));
|
||||
}
|
||||
|
||||
// 按名称模糊查询
|
||||
if (StrUtil.isNotBlank(flag.getTitle())) {
|
||||
wrapper.like(MsMaplayerB::getTitle, flag.getTitle());
|
||||
}
|
||||
|
||||
List<MsMaplayerB> mapLayers = msMaplayerBMapper.selectList(wrapper);
|
||||
|
||||
// 3. 当按名称过滤时,补充缺失的父级节点
|
||||
if (StrUtil.isNotBlank(flag.getTitle()) && !mapLayers.isEmpty()) {
|
||||
Set<String> hasKeys = mapLayers.stream()
|
||||
.filter(it -> StrUtil.isNotBlank(it.getKey()))
|
||||
.map(MsMaplayerB::getKey)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Set<String> idList = new HashSet<>();
|
||||
for (MsMaplayerB layer : mapLayers) {
|
||||
if (StrUtil.isNotBlank(layer.getFullPath()) && StrUtil.isNotBlank(layer.getKey())) {
|
||||
String[] ids = layer.getFullPath().replace(layer.getKey() + ",", "").split(",");
|
||||
for (String id : ids) {
|
||||
if (StrUtil.isNotBlank(id) && !hasKeys.contains(id)) {
|
||||
idList.add(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!idList.isEmpty()) {
|
||||
LambdaQueryWrapper<MsMaplayerB> parentWrapper = new LambdaQueryWrapper<>();
|
||||
parentWrapper.eq(MsMaplayerB::getIsDeleted, 0)
|
||||
.in(MsMaplayerB::getKey, idList);
|
||||
List<MsMaplayerB> parentLayers = msMaplayerBMapper.selectList(parentWrapper);
|
||||
if (!parentLayers.isEmpty()) {
|
||||
mapLayers.addAll(parentLayers);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 填充创建人名称
|
||||
if (!mapLayers.isEmpty()) {
|
||||
LambdaQueryWrapper<SysUser> userWrapper = new LambdaQueryWrapper<>();
|
||||
List<SysUser> users = sysUserMapper.selectList(userWrapper);
|
||||
Map<String, String> userMap = users.stream()
|
||||
.collect(Collectors.toMap(SysUser::getId, SysUser::getNickname, (v1, v2) -> v1));
|
||||
|
||||
for (MsMaplayerB layer : mapLayers) {
|
||||
if (StrUtil.isNotBlank(layer.getRecordUser())) {
|
||||
layer.setDisplayRecordUser(userMap.get(layer.getRecordUser()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 5. 构建树结构:取第一级
|
||||
List<MsMaplayerB> parents = mapLayers.stream()
|
||||
.filter(p -> StrUtil.isBlank(p.getParentId()))
|
||||
.sorted(Comparator.comparing(MsMaplayerB::getRecordTime, Comparator.nullsLast(Comparator.reverseOrder())))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 通过父级id分组子节点
|
||||
Map<String, List<MsMaplayerB>> childrenMap = mapLayers.stream()
|
||||
.filter(p -> StrUtil.isNotBlank(p.getParentId()))
|
||||
.collect(Collectors.groupingBy(MsMaplayerB::getParentId));
|
||||
|
||||
// 递归构建树
|
||||
convertTree(parents, childrenMap);
|
||||
|
||||
return parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典 "DTZJLX" 中需要排除的图层类型值
|
||||
*/
|
||||
private Set<String> getExcludeTypes() {
|
||||
Set<String> excludeTypes = new HashSet<>();
|
||||
try {
|
||||
LambdaQueryWrapper<SysDictionary> dictWrapper = new LambdaQueryWrapper<>();
|
||||
dictWrapper.eq(SysDictionary::getDictCode, "DTZJLX");
|
||||
SysDictionary dictionary = sysDictionaryMapper.selectOne(dictWrapper);
|
||||
if (dictionary != null) {
|
||||
LambdaQueryWrapper<SysDictionaryItems> itemWrapper = new LambdaQueryWrapper<>();
|
||||
itemWrapper.eq(SysDictionaryItems::getDictId, dictionary.getId());
|
||||
List<SysDictionaryItems> items = sysDictionaryItemsMapper.selectList(itemWrapper);
|
||||
if (items != null) {
|
||||
excludeTypes = items.stream()
|
||||
.map(SysDictionaryItems::getDictName)
|
||||
.filter(StrUtil::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 字典查询失败时不中断主流程
|
||||
}
|
||||
return excludeTypes;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归转换图层数据为树结构
|
||||
*/
|
||||
private void convertTree(List<MsMaplayerB> parents, Map<String, List<MsMaplayerB>> childrenMap) {
|
||||
if (parents == null || parents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (MsMaplayerB parent : parents) {
|
||||
String id = parent.getId();
|
||||
List<MsMaplayerB> children = childrenMap.get(id);
|
||||
if (children != null && !children.isEmpty()) {
|
||||
parent.setChildren(children);
|
||||
convertTree(children, childrenMap);
|
||||
}else {
|
||||
// 当没有子节点时,显式设置为空列表,保证 JSON 输出为 [] 而不是 null
|
||||
parent.setChildren(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MapLayerVo> getMapLayerTree(String moduleId, String systemId, String templateId) {
|
||||
// 通过 JOIN 查询 MS_MAPLAYER_B 和 MS_MAPMODULE_B
|
||||
List<MapLayerVo> allLayers = msMapmoduleBMapper.getMapLayerTree(moduleId, systemId, templateId);
|
||||
|
||||
if (allLayers == null || allLayers.isEmpty()) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
// 取第一级
|
||||
List<MapLayerVo> parents = allLayers.stream()
|
||||
.filter(p -> StrUtil.isBlank(p.getParentId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
// 通过父级id分组子节点
|
||||
Map<String, List<MapLayerVo>> childrenMap = allLayers.stream()
|
||||
.filter(p -> StrUtil.isNotBlank(p.getParentId()))
|
||||
.collect(Collectors.groupingBy(MapLayerVo::getParentId));
|
||||
|
||||
// 递归构建树
|
||||
convertLayerVoTree(parents, childrenMap);
|
||||
return parents;
|
||||
}
|
||||
|
||||
/**
|
||||
* 递归转换图层VO为树结构
|
||||
*/
|
||||
private void convertLayerVoTree(List<MapLayerVo> parents, Map<String, List<MapLayerVo>> childrenMap) {
|
||||
if (parents == null || parents.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for (MapLayerVo parent : parents) {
|
||||
String id = parent.getId();
|
||||
List<MapLayerVo> children = childrenMap.get(id);
|
||||
if (children != null && !children.isEmpty()) {
|
||||
parent.setChildren(children);
|
||||
convertLayerVoTree(children, childrenMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user