feat: 重点陆生动物二级页面
This commit is contained in:
parent
ebfd668d06
commit
4ab11f3b94
@ -86,4 +86,10 @@ public class WeFishController {
|
|||||||
public ResponseResult getQgcWeFishPoint(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getQgcWeFishPoint(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
return ResponseResult.successData(weFishService.getQgcWeFishPoint(dataSourceRequest));
|
return ResponseResult.successData(weFishService.getQgcWeFishPoint(dataSourceRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/te/tet/spec/GetKendoListCust")
|
||||||
|
@Operation(summary = "重点陆生动物二级页面")
|
||||||
|
public ResponseResult getTeSpecialAnimalList(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
return ResponseResult.successData(weFishService.getTeSpecialAnimalList(dataSourceRequest));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
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 WeTeSpecialAnimalVo {
|
||||||
|
|
||||||
|
@Schema(description = "动物主键")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Schema(description = "动物名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "动物英文名称")
|
||||||
|
private String nameEn;
|
||||||
|
|
||||||
|
@Schema(description = "保护级别编码")
|
||||||
|
private String protectlvl;
|
||||||
|
|
||||||
|
@Schema(description = "保护级别名称")
|
||||||
|
private String protectlvlName;
|
||||||
|
|
||||||
|
@Schema(description = "LOGO")
|
||||||
|
private String logo;
|
||||||
|
|
||||||
|
@Schema(description = "介绍")
|
||||||
|
private String introduce;
|
||||||
|
}
|
||||||
@ -9,6 +9,7 @@ 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;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeStaticsVo;
|
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.WeVmsstbprptVo;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeWvaQgcVo;
|
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.WeWvaYearQgcVo;
|
||||||
@ -39,4 +40,6 @@ public interface WeFishService {
|
|||||||
DataSourceResult<WeFishListStatQgcVo> getQgcFishListStat(DataSourceRequest dataSourceRequest);
|
DataSourceResult<WeFishListStatQgcVo> getQgcFishListStat(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
DataSourceResult<WeFishPointQgcVo> getQgcWeFishPoint(DataSourceRequest dataSourceRequest);
|
DataSourceResult<WeFishPointQgcVo> getQgcWeFishPoint(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
|
DataSourceResult<WeTeSpecialAnimalVo> getTeSpecialAnimalList(DataSourceRequest dataSourceRequest);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ 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;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeRvcdYearVo;
|
import com.yfd.platform.qgc_env.wte.entity.vo.WeRvcdYearVo;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeStaticsVo;
|
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.WeVmsstbprptVo;
|
||||||
import com.yfd.platform.qgc_env.wte.entity.vo.WeWvaQgcVo;
|
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.WeWvaYearQgcVo;
|
||||||
@ -486,6 +487,44 @@ public class WeFishServiceImpl implements WeFishService {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DataSourceResult<WeTeSpecialAnimalVo> getTeSpecialAnimalList(DataSourceRequest dataSourceRequest) {
|
||||||
|
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("SELECT ")
|
||||||
|
.append(buildTeSpecialAnimalSelectSql(dataSourceRequest == null ? null : dataSourceRequest.getSelect()))
|
||||||
|
.append(" FROM (")
|
||||||
|
.append(buildTeSpecialAnimalDetailSql())
|
||||||
|
.append(") t WHERE 1 = 1 ");
|
||||||
|
|
||||||
|
String filterSql = buildTeSpecialAnimalFilterCondition(
|
||||||
|
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||||
|
paramMap,
|
||||||
|
new int[]{0}
|
||||||
|
);
|
||||||
|
if (StrUtil.isNotBlank(filterSql)) {
|
||||||
|
sql.append("AND ").append(filterSql).append(" ");
|
||||||
|
}
|
||||||
|
sql.append(buildTeSpecialAnimalOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||||
|
|
||||||
|
Page<?> page = loadOptions == null ? null
|
||||||
|
: QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||||
|
List<WeTeSpecialAnimalVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||||
|
page,
|
||||||
|
sql.toString(),
|
||||||
|
paramMap,
|
||||||
|
WeTeSpecialAnimalVo.class
|
||||||
|
);
|
||||||
|
|
||||||
|
DataSourceResult<WeTeSpecialAnimalVo> result = new DataSourceResult<>();
|
||||||
|
result.setData(list);
|
||||||
|
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||||
|
result.setAggregates(new HashMap<>());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private String buildWeFishQgcGroupSql(String baseSql, GroupingInfo[] groupInfos) {
|
private String buildWeFishQgcGroupSql(String baseSql, GroupingInfo[] groupInfos) {
|
||||||
if (groupInfos == null || groupInfos.length == 0) {
|
if (groupInfos == null || groupInfos.length == 0) {
|
||||||
return baseSql;
|
return baseSql;
|
||||||
@ -820,6 +859,189 @@ public class WeFishServiceImpl implements WeFishService {
|
|||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildTeSpecialAnimalDetailSql() {
|
||||||
|
return "SELECT DISTINCT " +
|
||||||
|
"b.ID AS id, " +
|
||||||
|
"b.NAME AS name, " +
|
||||||
|
"b.NAME_EN AS nameEn, " +
|
||||||
|
"b.PROTECTLVL AS protectlvl, " +
|
||||||
|
"b.PROTECTLVL AS protectlvlName, " +
|
||||||
|
"b.LOGO AS logo, " +
|
||||||
|
"b.INTRODUCE AS introduce " +
|
||||||
|
"FROM MS_SPECANIMALS_B a " +
|
||||||
|
"INNER JOIN SD_VABASIC_B b ON a.ANIMAL_ID = b.ID " +
|
||||||
|
"WHERE NVL(a.IS_DELETED, 0) = 0 " +
|
||||||
|
"AND NVL(b.IS_DELETED, 0) = 0 " +
|
||||||
|
"AND NVL(b.ENABLE, 1) = 1 ";
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildTeSpecialAnimalSelectSql(List<String> selectFields) {
|
||||||
|
Map<String, String> columnMap = buildTeSpecialAnimalColumnMap();
|
||||||
|
List<String> columns = new ArrayList<>();
|
||||||
|
if (CollUtil.isNotEmpty(selectFields)) {
|
||||||
|
for (String field : selectFields) {
|
||||||
|
String column = columnMap.get(field);
|
||||||
|
if (StrUtil.isNotBlank(column)) {
|
||||||
|
columns.add(column);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (columns.isEmpty()) {
|
||||||
|
columns.addAll(columnMap.values());
|
||||||
|
}
|
||||||
|
return String.join(", ", columns);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Map<String, String> buildTeSpecialAnimalColumnMap() {
|
||||||
|
Map<String, String> columnMap = new LinkedHashMap<>();
|
||||||
|
columnMap.put("id", "t.id AS id");
|
||||||
|
columnMap.put("name", "t.name AS name");
|
||||||
|
columnMap.put("nameEn", "t.nameEn AS nameEn");
|
||||||
|
columnMap.put("protectlvl", "t.protectlvl AS protectlvl");
|
||||||
|
columnMap.put("protectlvlName", "t.protectlvlName AS protectlvlName");
|
||||||
|
columnMap.put("logo", "t.logo AS logo");
|
||||||
|
columnMap.put("introduce", "t.introduce AS introduce");
|
||||||
|
return columnMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildTeSpecialAnimalFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||||
|
Map<String, Object> paramMap,
|
||||||
|
int[] indexHolder) {
|
||||||
|
if (filter == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(filter.getField())) {
|
||||||
|
return buildTeSpecialAnimalLeafCondition(filter, paramMap, indexHolder);
|
||||||
|
}
|
||||||
|
if (CollUtil.isEmpty(filter.getFilters())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
List<String> conditions = new ArrayList<>();
|
||||||
|
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||||
|
String childSql = buildTeSpecialAnimalFilterCondition(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 buildTeSpecialAnimalLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||||
|
Map<String, Object> paramMap,
|
||||||
|
int[] indexHolder) {
|
||||||
|
String column = mapTeSpecialAnimalColumn(filter == null ? null : filter.getField());
|
||||||
|
if (StrUtil.isBlank(column)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||||
|
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 = normalizeWeFishQgcValues(filter.getValue());
|
||||||
|
if (values.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
List<String> placeholders = new ArrayList<>();
|
||||||
|
for (Object value : values) {
|
||||||
|
String text = safeWeFishString(value);
|
||||||
|
if (StrUtil.isBlank(text)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String key = "teSpecP" + indexHolder[0]++;
|
||||||
|
paramMap.put(key, text);
|
||||||
|
placeholders.add("#{map." + key + "}");
|
||||||
|
}
|
||||||
|
if (placeholders.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return column + ("ni".equals(operator) ? " NOT IN (" : " IN (") + String.join(", ", placeholders) + ")";
|
||||||
|
}
|
||||||
|
String text = safeWeFishString(filter.getValue());
|
||||||
|
if (StrUtil.isBlank(text)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
String key = "teSpecP" + indexHolder[0]++;
|
||||||
|
return switch (operator) {
|
||||||
|
case "eq" -> {
|
||||||
|
paramMap.put(key, text);
|
||||||
|
yield column + " = #{map." + key + "}";
|
||||||
|
}
|
||||||
|
case "neq" -> {
|
||||||
|
paramMap.put(key, text);
|
||||||
|
yield column + " <> #{map." + key + "}";
|
||||||
|
}
|
||||||
|
case "contains" -> {
|
||||||
|
paramMap.put(key, "%" + text + "%");
|
||||||
|
yield column + " LIKE #{map." + key + "}";
|
||||||
|
}
|
||||||
|
case "doesnotcontain" -> {
|
||||||
|
paramMap.put(key, "%" + text + "%");
|
||||||
|
yield column + " NOT LIKE #{map." + key + "}";
|
||||||
|
}
|
||||||
|
case "startswith" -> {
|
||||||
|
paramMap.put(key, text + "%");
|
||||||
|
yield column + " LIKE #{map." + key + "}";
|
||||||
|
}
|
||||||
|
case "endswith" -> {
|
||||||
|
paramMap.put(key, "%" + text);
|
||||||
|
yield column + " LIKE #{map." + key + "}";
|
||||||
|
}
|
||||||
|
default -> "";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String mapTeSpecialAnimalColumn(String field) {
|
||||||
|
if (StrUtil.isBlank(field)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return switch (field) {
|
||||||
|
case "id" -> "t.id";
|
||||||
|
case "name" -> "t.name";
|
||||||
|
case "nameEn" -> "t.nameEn";
|
||||||
|
case "protectlvl" -> "t.protectlvl";
|
||||||
|
case "protectlvlName" -> "t.protectlvlName";
|
||||||
|
case "logo" -> "t.logo";
|
||||||
|
case "introduce" -> "t.introduce";
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String buildTeSpecialAnimalOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
|
||||||
|
if (CollUtil.isEmpty(sorts)) {
|
||||||
|
return " ORDER BY t.name ASC NULLS LAST, t.id ASC";
|
||||||
|
}
|
||||||
|
List<String> orderByParts = new ArrayList<>();
|
||||||
|
for (DataSourceRequest.SortDescriptor sort : sorts) {
|
||||||
|
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String column = mapTeSpecialAnimalColumn(sort.getField());
|
||||||
|
if (StrUtil.isBlank(column)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String direction = "desc".equalsIgnoreCase(sort.getDir()) || "des".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||||
|
orderByParts.add(column + " " + direction + " NULLS LAST");
|
||||||
|
}
|
||||||
|
if (orderByParts.isEmpty()) {
|
||||||
|
return " ORDER BY t.name ASC NULLS LAST, t.id ASC";
|
||||||
|
}
|
||||||
|
return " ORDER BY " + String.join(", ", orderByParts);
|
||||||
|
}
|
||||||
|
|
||||||
private String buildWeWvaYearFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
private String buildWeWvaYearFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||||
Map<String, Object> paramMap,
|
Map<String, Object> paramMap,
|
||||||
int[] indexHolder) {
|
int[] indexHolder) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user