feat: 水生生态AI监测装置基础信息查询
This commit is contained in:
parent
03c43a5e8a
commit
adee795bed
@ -33,6 +33,12 @@ public class WeFishController {
|
|||||||
return ResponseResult.successData(weFishService.getQgcWeFishList(dataSourceRequest));
|
return ResponseResult.successData(weFishService.getQgcWeFishList(dataSourceRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/msstbprpt/GetKendoList")
|
||||||
|
@Operation(summary = "水生生态AI监测装置基础信息查询")
|
||||||
|
public ResponseResult getMsstbprptList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
return ResponseResult.successData(weFishService.getMsstbprptList(dataSourceRequest));
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/we/fisht/year/qgc/GetKendoListCust")
|
@PostMapping("/we/fisht/year/qgc/GetKendoListCust")
|
||||||
@Operation(summary = "全过程沿程鱼类变化情况有数据的流域和年份")
|
@Operation(summary = "全过程沿程鱼类变化情况有数据的流域和年份")
|
||||||
public ResponseResult getQgcFishStaticsYearList(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getQgcFishStaticsYearList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
|||||||
@ -0,0 +1,38 @@
|
|||||||
|
package com.yfd.platform.qgc_env.wte.entity.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Schema(description = "水生生态AI监测装置基础信息查询")
|
||||||
|
public class WeMsstbprptVo {
|
||||||
|
|
||||||
|
@Schema(description = "主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "站点编码")
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
@Schema(description = "所属电站编码")
|
||||||
|
private String rstcd;
|
||||||
|
|
||||||
|
@Schema(description = "电站名称")
|
||||||
|
private String ennm;
|
||||||
|
|
||||||
|
@Schema(description = "站点名称")
|
||||||
|
private String stnm;
|
||||||
|
|
||||||
|
@Schema(description = "站类编码")
|
||||||
|
private String sttpCode;
|
||||||
|
|
||||||
|
@Schema(description = "排序")
|
||||||
|
private Integer orderIndex;
|
||||||
|
|
||||||
|
@Schema(description = "经度")
|
||||||
|
private BigDecimal lgtd;
|
||||||
|
|
||||||
|
@Schema(description = "纬度")
|
||||||
|
private BigDecimal lttd;
|
||||||
|
}
|
||||||
@ -4,6 +4,7 @@ import com.yfd.platform.common.DataSourceRequest;
|
|||||||
import com.yfd.platform.common.DataSourceResult;
|
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.WeFishListQgcVo;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishListStatQgcVo;
|
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.WeFishPointQgcVo;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishStatQgcVo;
|
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.WeFishTQgcVo;
|
||||||
@ -18,6 +19,8 @@ public interface WeFishService {
|
|||||||
|
|
||||||
DataSourceResult<WeFishListQgcVo> getQgcWeFishList(DataSourceRequest dataSourceRequest);
|
DataSourceResult<WeFishListQgcVo> getQgcWeFishList(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
|
DataSourceResult<WeMsstbprptVo> getMsstbprptList(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
DataSourceResult<Map<String, List<String>>> getQgcFishStaticsYearList(DataSourceRequest dataSourceRequest);
|
DataSourceResult<Map<String, List<String>>> getQgcFishStaticsYearList(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
DataSourceResult<WeStaticsVo> getQgcWeFishStatics(DataSourceRequest dataSourceRequest);
|
DataSourceResult<WeStaticsVo> getQgcWeFishStatics(DataSourceRequest dataSourceRequest);
|
||||||
|
|||||||
@ -12,6 +12,7 @@ import com.yfd.platform.common.GroupingInfo;
|
|||||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishListQgcVo;
|
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.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.WeFishPointQgcVo;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeFishStatQgcVo;
|
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.WeFishTQgcVo;
|
||||||
@ -146,6 +147,44 @@ public class WeFishServiceImpl implements WeFishService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceResult<WeMsstbprptVo> getMsstbprptList(DataSourceRequest dataSourceRequest) {
|
||||||
|
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("SELECT ")
|
||||||
|
.append(buildWeMsstbprptSelectSql(dataSourceRequest == null ? null : dataSourceRequest.getSelect()))
|
||||||
|
.append(" FROM (")
|
||||||
|
.append(buildWeMsstbprptViewSql())
|
||||||
|
.append(") t WHERE 1 = 1 ");
|
||||||
|
|
||||||
|
String filterSql = buildWeMsstbprptFilterCondition(
|
||||||
|
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||||
|
paramMap,
|
||||||
|
new int[]{0}
|
||||||
|
);
|
||||||
|
if (StrUtil.isNotBlank(filterSql)) {
|
||||||
|
sql.append("AND ").append(filterSql).append(" ");
|
||||||
|
}
|
||||||
|
sql.append(buildWeMsstbprptOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||||
|
|
||||||
|
Page<?> page = loadOptions == null ? null
|
||||||
|
: QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||||
|
List<WeMsstbprptVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||||
|
page,
|
||||||
|
sql.toString(),
|
||||||
|
paramMap,
|
||||||
|
WeMsstbprptVo.class
|
||||||
|
);
|
||||||
|
|
||||||
|
DataSourceResult<WeMsstbprptVo> result = new DataSourceResult<>();
|
||||||
|
result.setData(list);
|
||||||
|
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||||
|
result.setAggregates(new HashMap<>());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataSourceResult<Map<String, List<String>>> getQgcFishStaticsYearList(DataSourceRequest dataSourceRequest) {
|
public DataSourceResult<Map<String, List<String>>> getQgcFishStaticsYearList(DataSourceRequest dataSourceRequest) {
|
||||||
Map<String, Object> paramMap = new HashMap<>();
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
@ -656,6 +695,169 @@ public class WeFishServiceImpl implements WeFishService {
|
|||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildWeMsstbprptViewSql() {
|
||||||
|
return "SELECT " +
|
||||||
|
"ai.STCD AS id, " +
|
||||||
|
"ai.STCD AS stcd, " +
|
||||||
|
"ai.RSTCD AS rstcd, " +
|
||||||
|
"eng.ENNM AS ennm, " +
|
||||||
|
"ai.STNM AS stnm, " +
|
||||||
|
"ai.STTP AS sttpCode, " +
|
||||||
|
"ai.ORDER_INDEX AS orderIndex, " +
|
||||||
|
"ai.LGTD AS lgtd, " +
|
||||||
|
"ai.LTTD AS lttd " +
|
||||||
|
"FROM SD_AIMONITOR_B_H ai " +
|
||||||
|
"LEFT JOIN SD_ENGINFO_B_H eng ON eng.STCD = ai.RSTCD AND NVL(eng.IS_DELETED, 0) = 0 " +
|
||||||
|
"WHERE NVL(ai.IS_DELETED, 0) = 0";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildWeMsstbprptSelectSql(List<String> selectFields) {
|
||||||
|
Map<String, String> columns = weMsstbprptFieldColumns();
|
||||||
|
List<String> selected = new ArrayList<>();
|
||||||
|
if (CollUtil.isEmpty(selectFields)) {
|
||||||
|
selected.addAll(columns.values());
|
||||||
|
} else {
|
||||||
|
for (String field : selectFields) {
|
||||||
|
String column = columns.get(field);
|
||||||
|
if (StrUtil.isNotBlank(column)) {
|
||||||
|
selected.add(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (selected.isEmpty()) {
|
||||||
|
selected.addAll(columns.values());
|
||||||
|
}
|
||||||
|
return String.join(", ", selected);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> weMsstbprptFieldColumns() {
|
||||||
|
Map<String, String> columns = new LinkedHashMap<>();
|
||||||
|
columns.put("id", "t.id AS id");
|
||||||
|
columns.put("stcd", "t.stcd AS stcd");
|
||||||
|
columns.put("rstcd", "t.rstcd AS rstcd");
|
||||||
|
columns.put("ennm", "t.ennm AS ennm");
|
||||||
|
columns.put("stnm", "t.stnm AS stnm");
|
||||||
|
columns.put("sttpCode", "t.sttpCode AS sttpCode");
|
||||||
|
columns.put("orderIndex", "t.orderIndex AS orderIndex");
|
||||||
|
columns.put("lgtd", "t.lgtd AS lgtd");
|
||||||
|
columns.put("lttd", "t.lttd AS lttd");
|
||||||
|
return columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildWeMsstbprptFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||||
|
Map<String, Object> paramMap,
|
||||||
|
int[] indexHolder) {
|
||||||
|
if (filter == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(filter.getField())) {
|
||||||
|
return buildWeMsstbprptLeafCondition(filter, paramMap, indexHolder);
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(filter.getFilters())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
List<String> conditions = new ArrayList<>();
|
||||||
|
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||||
|
String childSql = buildWeMsstbprptFilterCondition(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 buildWeMsstbprptLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||||
|
Map<String, Object> paramMap,
|
||||||
|
int[] indexHolder) {
|
||||||
|
String column = mapWeMsstbprptColumn(filter.getField());
|
||||||
|
if (StrUtil.isBlank(column)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||||
|
if ("in".equals(operator) || "ni".equals(operator)) {
|
||||||
|
List<Object> values = normalizeWeFishQgcValues(filter.getValue());
|
||||||
|
if (values.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
List<String> placeholders = new ArrayList<>();
|
||||||
|
for (Object value : values) {
|
||||||
|
if (value == null || StrUtil.isBlank(String.valueOf(value).trim())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String key = "weMsstbprptP" + indexHolder[0]++;
|
||||||
|
paramMap.put(key, String.valueOf(value).trim());
|
||||||
|
placeholders.add("#{map." + key + "}");
|
||||||
|
}
|
||||||
|
if (placeholders.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return column + ("ni".equals(operator) ? " NOT IN (" : " IN (") + String.join(", ", placeholders) + ")";
|
||||||
|
}
|
||||||
|
Object rawValue = filter.getValue();
|
||||||
|
if (rawValue == null || StrUtil.isBlank(String.valueOf(rawValue).trim())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String key = "weMsstbprptP" + indexHolder[0]++;
|
||||||
|
paramMap.put(key, String.valueOf(rawValue).trim());
|
||||||
|
return switch (operator) {
|
||||||
|
case "eq" -> column + " = #{map." + key + "}";
|
||||||
|
case "neq" -> column + " <> #{map." + key + "}";
|
||||||
|
case "contains" -> {
|
||||||
|
paramMap.put(key, "%" + String.valueOf(rawValue).trim() + "%");
|
||||||
|
yield column + " LIKE #{map." + key + "}";
|
||||||
|
}
|
||||||
|
case "doesnotcontain" -> {
|
||||||
|
paramMap.put(key, "%" + String.valueOf(rawValue).trim() + "%");
|
||||||
|
yield column + " NOT LIKE #{map." + key + "}";
|
||||||
|
}
|
||||||
|
default -> "";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String mapWeMsstbprptColumn(String field) {
|
||||||
|
if (StrUtil.isBlank(field)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return switch (field) {
|
||||||
|
case "id" -> "t.id";
|
||||||
|
case "stcd" -> "t.stcd";
|
||||||
|
case "rstcd" -> "t.rstcd";
|
||||||
|
case "ennm" -> "t.ennm";
|
||||||
|
case "stnm" -> "t.stnm";
|
||||||
|
case "sttpCode" -> "t.sttpCode";
|
||||||
|
case "orderIndex" -> "t.orderIndex";
|
||||||
|
case "lgtd" -> "t.lgtd";
|
||||||
|
case "lttd" -> "t.lttd";
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildWeMsstbprptOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
|
||||||
|
if (CollUtil.isEmpty(sorts)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
List<String> orderByParts = new ArrayList<>();
|
||||||
|
for (DataSourceRequest.SortDescriptor sort : sorts) {
|
||||||
|
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String column = mapWeMsstbprptColumn(sort.getField());
|
||||||
|
if (StrUtil.isBlank(column)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String direction = "desc".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||||
|
orderByParts.add(column + " " + direction + " NULLS LAST");
|
||||||
|
}
|
||||||
|
if (orderByParts.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return " ORDER BY " + String.join(", ", orderByParts);
|
||||||
|
}
|
||||||
|
|
||||||
private String buildWeFishListQgcGroupSql(String baseSql, GroupingInfo[] groupInfos) {
|
private String buildWeFishListQgcGroupSql(String baseSql, GroupingInfo[] groupInfos) {
|
||||||
if (groupInfos == null || groupInfos.length == 0) {
|
if (groupInfos == null || groupInfos.length == 0) {
|
||||||
return baseSql;
|
return baseSql;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user