feat: 条件过滤数据列表定制
This commit is contained in:
parent
64c97585a2
commit
7502e63cef
@ -1,12 +1,15 @@
|
|||||||
package com.yfd.platform.qgc_env.fb.controller;
|
package com.yfd.platform.qgc_env.fb.controller;
|
||||||
|
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.yfd.platform.common.DataSourceRequest;
|
||||||
|
import com.yfd.platform.common.DataSourceResult;
|
||||||
import com.yfd.platform.config.ResponseResult;
|
import com.yfd.platform.config.ResponseResult;
|
||||||
|
import com.yfd.platform.qgc_env.fb.entity.vo.BreedStageVO;
|
||||||
import com.yfd.platform.qgc_env.fb.service.FbStationService;
|
import com.yfd.platform.qgc_env.fb.service.FbStationService;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -15,6 +18,8 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/fb")
|
@RequestMapping("/fb")
|
||||||
@Tag(name = "鱼类增殖站模块")
|
@Tag(name = "鱼类增殖站模块")
|
||||||
@ -91,6 +96,26 @@ public class FbStationController {
|
|||||||
return ResponseResult.successData(fbStationService.getEngKendoListCust(dataSourceRequest));
|
return ResponseResult.successData(fbStationService.getEngKendoListCust(dataSourceRequest));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/breedStage/GetKendoListCust")
|
||||||
|
@Operation(summary = "条件过滤数据列表定制")
|
||||||
|
public ResponseResult getBreedStageKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
String stcd = null;
|
||||||
|
List<DataSourceRequest.FilterDescriptor> filters = dataSourceRequest.getFilter().getFilters();
|
||||||
|
for (DataSourceRequest.FilterDescriptor filter : filters) {
|
||||||
|
if ("stcd".equals(filter.getField())) {
|
||||||
|
stcd = (String) filter.getValue();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StrUtil.isEmpty(stcd)) {
|
||||||
|
return ResponseResult.error("增殖站stcd不能为空!");
|
||||||
|
}
|
||||||
|
List<BreedStageVO> breedStageList = fbStationService.getBreedStageList(stcd);
|
||||||
|
DataSourceResult<BreedStageVO> dataSourceResult = new DataSourceResult<>();
|
||||||
|
dataSourceResult.setData(breedStageList);
|
||||||
|
dataSourceResult.setTotal(breedStageList.size());
|
||||||
|
return ResponseResult.successData(dataSourceResult);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/msfbrdm/fbFlData/GetKendoListCust")
|
@PostMapping("/msfbrdm/fbFlData/GetKendoListCust")
|
||||||
@Operation(summary = "增殖站增殖情况(app)")
|
@Operation(summary = "增殖站增殖情况(app)")
|
||||||
public ResponseResult getFbFlData(@RequestBody DataSourceRequest dataSourceRequest) {
|
public ResponseResult getFbFlData(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.yfd.platform.qgc_env.fb.entity.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 鱼类增殖阶段
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class BreedStageVO {
|
||||||
|
|
||||||
|
/** 增殖站编码 */
|
||||||
|
private String stcd;
|
||||||
|
|
||||||
|
/** 阶段名称 */
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
/** 阶段状态:1=有数据 2=无数据 */
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
/** 是否为最新数据 */
|
||||||
|
private Boolean newest;
|
||||||
|
|
||||||
|
/** 最新表 */
|
||||||
|
private String newSurface;
|
||||||
|
|
||||||
|
/** 主菜单 */
|
||||||
|
private String firstGrade;
|
||||||
|
}
|
||||||
@ -2,6 +2,7 @@ package com.yfd.platform.qgc_env.fb.service;
|
|||||||
|
|
||||||
import com.yfd.platform.common.DataSourceRequest;
|
import com.yfd.platform.common.DataSourceRequest;
|
||||||
import com.yfd.platform.common.DataSourceResult;
|
import com.yfd.platform.common.DataSourceResult;
|
||||||
|
import com.yfd.platform.qgc_env.fb.entity.vo.BreedStageVO;
|
||||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRQgcVo;
|
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.FbBsmfRFishTableVo;
|
||||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbEngFishVo;
|
import com.yfd.platform.qgc_env.fb.entity.vo.FbEngFishVo;
|
||||||
@ -78,4 +79,9 @@ public interface FbStationService {
|
|||||||
* 电站放流统计列表
|
* 电站放流统计列表
|
||||||
*/
|
*/
|
||||||
DataSourceResult<FbEngFishVo> getEngKendoListCust(DataSourceRequest dataSourceRequest);
|
DataSourceResult<FbEngFishVo> getEngKendoListCust(DataSourceRequest dataSourceRequest);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取增殖站各阶段数据状态(选配/繁殖/培育/防治)
|
||||||
|
*/
|
||||||
|
List<BreedStageVO> getBreedStageList(String stcd);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import com.yfd.platform.common.Group;
|
|||||||
import com.yfd.platform.common.GroupHelper;
|
import com.yfd.platform.common.GroupHelper;
|
||||||
import com.yfd.platform.common.GroupingInfo;
|
import com.yfd.platform.common.GroupingInfo;
|
||||||
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
import com.yfd.platform.common.MicroservicDynamicSQLMapper;
|
||||||
|
import com.yfd.platform.qgc_env.fb.entity.vo.BreedStageVO;
|
||||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRQgcVo;
|
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.FbBsmfRFishHeadColumnVo;
|
||||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishSummaryVo;
|
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsmfRFishSummaryVo;
|
||||||
@ -5026,6 +5027,69 @@ public class FbStationServiceImpl implements FbStationService {
|
|||||||
return sql.toString();
|
return sql.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<BreedStageVO> getBreedStageList(String stcd) {
|
||||||
|
List<BreedStageVO> stageVOList = new ArrayList<>();
|
||||||
|
|
||||||
|
// 阶段1:选配 --- SD_FBBSMF_R(亲鱼档案管理记录表)+ SD_FBBSDEATH_R(亲鱼死亡记录表)
|
||||||
|
boolean bsmfExists = existsDataInTable("SD_FBBSMF_R", stcd);
|
||||||
|
boolean bsdeathExists = existsDataInTable("SD_FBBSDEATH_R", stcd);
|
||||||
|
BreedStageVO stage1 = new BreedStageVO();
|
||||||
|
stage1.setKey("选配");
|
||||||
|
stage1.setValue((bsmfExists || bsdeathExists) ? "1" : "2");
|
||||||
|
stageVOList.add(stage1);
|
||||||
|
|
||||||
|
// 阶段2:繁殖 --- SD_FBFISHARTINL_R(鱼类人工催产记录)
|
||||||
|
boolean fishArtinlExists = existsDataInTable("SD_FBFISHARTINL_R", stcd);
|
||||||
|
BreedStageVO stage2 = new BreedStageVO();
|
||||||
|
stage2.setKey("繁殖");
|
||||||
|
stage2.setValue(fishArtinlExists ? "1" : "2");
|
||||||
|
stageVOList.add(stage2);
|
||||||
|
|
||||||
|
// 阶段3:培育 --- SD_FBFISHBREED_R(鱼苗和鱼种培育记录)+ SD_FBSCWEM_R(苗种培育水环境监测记录表)
|
||||||
|
boolean fishbreedExists = existsDataInTable("SD_FBFISHBREED_R", stcd);
|
||||||
|
boolean scwemExists = existsDataInTable("SD_FBSCWEM_R", stcd);
|
||||||
|
BreedStageVO stage3 = new BreedStageVO();
|
||||||
|
stage3.setKey("培育");
|
||||||
|
stage3.setValue((fishbreedExists || scwemExists) ? "1" : "2");
|
||||||
|
stageVOList.add(stage3);
|
||||||
|
|
||||||
|
// 阶段4:防治 --- SD_FBFISHDPAC_R(鱼病防治记录表)
|
||||||
|
boolean fishDpacExists = existsDataInTable("SD_FBFISHDPAC_R", stcd);
|
||||||
|
BreedStageVO stage4 = new BreedStageVO();
|
||||||
|
stage4.setKey("防治");
|
||||||
|
stage4.setValue(fishDpacExists ? "1" : "2");
|
||||||
|
stageVOList.add(stage4);
|
||||||
|
|
||||||
|
return stageVOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查指定表在指定 stcd 下是否存在未删除的数据
|
||||||
|
*/
|
||||||
|
private boolean existsDataInTable(String tableName, String stcd) {
|
||||||
|
Map<String, Object> paramMap = new HashMap<>();
|
||||||
|
paramMap.put("stcd", stcd);
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("SELECT 1 AS existFlag FROM ").append(tableName);
|
||||||
|
sql.append(" WHERE STCD = #{map.stcd} AND NVL(IS_DELETED, 0) = 0 AND ROWNUM = 1");
|
||||||
|
List<DataExistsVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||||
|
null, sql.toString(), paramMap, DataExistsVo.class);
|
||||||
|
return CollUtil.isNotEmpty(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class DataExistsVo {
|
||||||
|
private Integer existFlag;
|
||||||
|
|
||||||
|
public Integer getExistFlag() {
|
||||||
|
return existFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExistFlag(Integer existFlag) {
|
||||||
|
this.existFlag = existFlag;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class FbPointCountVo {
|
private static class FbPointCountVo {
|
||||||
private String stcd;
|
private String stcd;
|
||||||
private Long fcnt;
|
private Long fcnt;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user