feat: 增殖站鱼数量完成情况统计
This commit is contained in:
parent
64ef59380d
commit
101c60e8c0
@ -85,6 +85,12 @@ public class FbStationController {
|
||||
return ResponseResult.successData(fbStationService.getFbFlDataKendoListCust(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/fishCount/GetKendoListCust")
|
||||
@Operation(summary = "增殖站鱼数量完成情况统计")
|
||||
public ResponseResult getFishCountKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(fbStationService.getFishCountKendoListCust(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/fishType/GetKendoListCust")
|
||||
@Operation(summary = "增殖站鱼种完成情况统计")
|
||||
public ResponseResult getFishTypeKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
package com.yfd.platform.qgc_env.fb.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class FbFishCountFinishVo {
|
||||
|
||||
private String stcd;
|
||||
|
||||
private BigDecimal finished;
|
||||
|
||||
private BigDecimal unfinished;
|
||||
}
|
||||
@ -5,6 +5,7 @@ import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRQgcVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishTableVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFlDataVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFishCountFinishVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFishTypeFinishVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbRelatedYrVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbMsfbrdmQgcVo;
|
||||
@ -27,6 +28,8 @@ public interface FbStationService {
|
||||
|
||||
DataSourceResult<FbFlDataVo> getFbFlDataKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FbFishCountFinishVo> getFishCountKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FbFishTypeFinishVo> getFishTypeKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FbMsfbrdmQgcVo> getMsfbrdmKendoListCust(DataSourceRequest dataSourceRequest);
|
||||
|
||||
@ -15,6 +15,7 @@ import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRQgcVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishHeadColumnVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishSummaryVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishTableVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFishCountFinishVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFishTypeFinishVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFtpStatisticsVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFlDataVo;
|
||||
@ -84,6 +85,38 @@ public class FbStationServiceImpl implements FbStationService {
|
||||
return queryFbFlDataDetailList(dataSourceRequest, loadOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FbFishCountFinishVo> getFishCountKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
String rstcdFilter = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "rstcd");
|
||||
String stcd = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd");
|
||||
String startTime = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "startTime");
|
||||
String endTime = loadOptions == null ? null : QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "endTime");
|
||||
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
String sql = buildFishCountFinishSql(
|
||||
stcd,
|
||||
parseFishTypeFilterValues(rstcdFilter),
|
||||
parseFishTypeDate(startTime),
|
||||
parseFishTypeDate(endTime),
|
||||
paramMap
|
||||
) + buildFishCountOrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort());
|
||||
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<FbFishCountFinishVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page,
|
||||
sql,
|
||||
paramMap,
|
||||
FbFishCountFinishVo.class
|
||||
);
|
||||
|
||||
DataSourceResult<FbFishCountFinishVo> result = new DataSourceResult<>();
|
||||
result.setData(list);
|
||||
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FbFishTypeFinishVo> getFishTypeKendoListCust(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
@ -840,6 +873,63 @@ public class FbStationServiceImpl implements FbStationService {
|
||||
return null;
|
||||
}
|
||||
|
||||
private String buildFishCountFinishSql(String stcd,
|
||||
List<String> rstcdList,
|
||||
Date startTime,
|
||||
Date endTime,
|
||||
Map<String, Object> paramMap) {
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT jh.RSTCD AS stcd, ")
|
||||
.append("CASE WHEN imn.FCNT IS NULL THEN 0 ELSE imn.FCNT END AS finished, ")
|
||||
.append("CASE WHEN imn.FCNT IS NULL THEN jh.FCNT ")
|
||||
.append("WHEN jh.FCNT - imn.FCNT < 0 THEN 0 ")
|
||||
.append("ELSE (jh.FCNT - imn.FCNT) END AS unfinished ")
|
||||
.append("FROM ( ")
|
||||
.append("SELECT jhr.RSTCD, SUM(jhrs.FCNT) AS FCNT ")
|
||||
.append("FROM SD_ENGFRPLAN_B jhr ")
|
||||
.append("JOIN SD_ENGFRPLANDET_B jhrs ON jhr.ID = jhrs.RPJH_ID ")
|
||||
.append("WHERE NVL(jhr.IS_DELETED, 0) = 0 AND NVL(jhrs.IS_DELETED, 0) = 0 ");
|
||||
appendFishTypeFilterSql(sql, "jhr", stcd, rstcdList, startTime, endTime, true, paramMap);
|
||||
sql.append("GROUP BY jhr.RSTCD ")
|
||||
.append(") jh ")
|
||||
.append("LEFT JOIN ( ")
|
||||
.append("SELECT imnr.RSTCD, SUM(imnrs.FCNT) AS FCNT ")
|
||||
.append("FROM SD_ENGFR_R imnr ")
|
||||
.append("JOIN SD_RPIMNFISH_R imnrs ON imnr.ID = imnrs.RPIMN_ID ")
|
||||
.append("WHERE NVL(imnr.IS_DELETED, 0) = 0 AND NVL(imnrs.IS_DELETED, 0) = 0 ");
|
||||
appendFishTypeFilterSql(sql, "imnr", stcd, rstcdList, startTime, endTime, false, paramMap);
|
||||
sql.append("GROUP BY imnr.RSTCD ")
|
||||
.append(") imn ON jh.RSTCD = imn.RSTCD");
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private String buildFishCountOrderBySql(List<DataSourceRequest.SortDescriptor> sorts) {
|
||||
if (CollUtil.isEmpty(sorts)) {
|
||||
return " ORDER BY stcd ASC";
|
||||
}
|
||||
List<String> orderByParts = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor sort : sorts) {
|
||||
if (sort == null || StrUtil.isBlank(sort.getField())) {
|
||||
continue;
|
||||
}
|
||||
String column = switch (sort.getField()) {
|
||||
case "stcd" -> "stcd";
|
||||
case "finished" -> "finished";
|
||||
case "unfinished" -> "unfinished";
|
||||
default -> null;
|
||||
};
|
||||
if (StrUtil.isBlank(column)) {
|
||||
continue;
|
||||
}
|
||||
String direction = "desc".equalsIgnoreCase(sort.getDir()) ? "DESC" : "ASC";
|
||||
orderByParts.add(column + " " + direction);
|
||||
}
|
||||
if (orderByParts.isEmpty()) {
|
||||
return " ORDER BY stcd ASC";
|
||||
}
|
||||
return " ORDER BY " + String.join(", ", orderByParts);
|
||||
}
|
||||
|
||||
private String buildFishTypeFinishSql(String stcd,
|
||||
List<String> rstcdList,
|
||||
Date startTime,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user