feat: 水生生态调查概况二级页面
This commit is contained in:
parent
329343c371
commit
b1b7cacef7
@ -69,6 +69,12 @@ 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) {
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ public interface WeFishService {
|
||||
|
||||
DataSourceResult<WeStaticsVo> getQgcWeFishStatics(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeStaticsVo> getWeStaticsSecond(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishStatQgcVo> getQgcWeFishStatList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<WeFishListStatQgcVo> getQgcFishListStat(DataSourceRequest dataSourceRequest);
|
||||
|
||||
@ -372,6 +372,58 @@ public class WeFishServiceImpl implements WeFishService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<WeStaticsVo> getWeStaticsSecond(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
GroupingInfo[] groupInfos = loadOptions == null ? null : loadOptions.getGroup();
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
|
||||
String filterSql = buildWeFishQgcFilterCondition(
|
||||
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||
paramMap,
|
||||
new int[]{0}
|
||||
);
|
||||
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append(buildWeStaticsSecondSelectSql(dataSourceRequest == null ? null : dataSourceRequest.getSelect()))
|
||||
.append(" FROM (")
|
||||
.append(buildWeFishQgcDetailSql())
|
||||
.append(") r WHERE 1 = 1 ");
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql).append(" ");
|
||||
}
|
||||
|
||||
DataSourceResult<WeStaticsVo> result = new DataSourceResult<>();
|
||||
if (CollUtil.isNotEmpty(dataSourceRequest == null ? null : dataSourceRequest.getGroup())) {
|
||||
String groupedSql = buildWeFishQgcGroupSql(sql.toString(), groupInfos);
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.getAllList(groupedSql, paramMap);
|
||||
if (Boolean.TRUE.equals(dataSourceRequest.getGroupResultFlat())) {
|
||||
result.setData((List<WeStaticsVo>) (List<?>) new GroupHelper().faltGroup(rows, Arrays.asList(groupInfos)));
|
||||
} else {
|
||||
result.setData((List<WeStaticsVo>) (List<?>) new GroupHelper().group(rows, Arrays.asList(groupInfos)));
|
||||
}
|
||||
result.setTotal((long) rows.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
sql.append(buildWeFishQgcOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||
Page<?> page = loadOptions == null ? null
|
||||
: QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<WeStaticsVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page,
|
||||
sql.toString(),
|
||||
paramMap,
|
||||
WeStaticsVo.class
|
||||
);
|
||||
|
||||
result.setData(list);
|
||||
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<WeFishStatQgcVo> getQgcWeFishStatList(DataSourceRequest dataSourceRequest) {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
@ -2084,9 +2136,11 @@ public class WeFishServiceImpl implements WeFishService {
|
||||
case "hbrvcdName" -> "r.hbrvcdName";
|
||||
case "dcpc" -> "r.dcpc";
|
||||
case "tm" -> "r.tm";
|
||||
case "year" -> "r.yr";
|
||||
case "werFid" -> "r.werFid";
|
||||
case "werId" -> "r.werId";
|
||||
case "ftp" -> "r.ftp";
|
||||
case "ftpName" -> "r.name";
|
||||
case "fsz" -> "r.fsz";
|
||||
case "fcnt" -> "r.fcnt";
|
||||
case "fwgh" -> "r.fwgh";
|
||||
@ -2142,6 +2196,34 @@ public class WeFishServiceImpl implements WeFishService {
|
||||
return " ORDER BY " + String.join(", ", orderByParts);
|
||||
}
|
||||
|
||||
private String buildWeStaticsSecondSelectSql(List<String> selectFields) {
|
||||
Map<String, String> columns = new LinkedHashMap<>();
|
||||
columns.put("stcd", "r.stcd AS stcd");
|
||||
columns.put("stnm", "r.stnm AS stnm");
|
||||
columns.put("ftp", "r.ftp AS ftp");
|
||||
columns.put("ftpName", "r.name AS ftpName");
|
||||
columns.put("dcpc", "r.dcpc AS dcpc");
|
||||
columns.put("tm", "r.tm AS tm");
|
||||
columns.put("fcnt", "r.fcnt AS fcnt");
|
||||
columns.put("fid", "r.werFid AS fid");
|
||||
|
||||
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 Object normalizeWeFishQgcValue(String field, Object value) {
|
||||
if (value == null) {
|
||||
return null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user