feat: 鱼类产卵月份和适宜水温
This commit is contained in:
parent
8086fa8064
commit
5824c2c106
@ -187,6 +187,12 @@ public class SdWTMonitorController {
|
||||
return ResponseResult.successData(sdWtMonitorService.getWtFishAnalysis(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/wtrv/fish/info/GetKendoListCust")
|
||||
@Operation(summary = "鱼类产卵月份和适宜水温")
|
||||
public ResponseResult getWtFishInfo(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(sdWtMonitorService.getWtFishInfo(dataSourceRequest));
|
||||
}
|
||||
|
||||
@GetMapping("/wtrv/getIoWtrvFlag")
|
||||
@Operation(summary = "根据站点编码判断是否出入水温站且关联的电站是否有垂向水温站")
|
||||
public ResponseResult getFlagByStcd(@RequestParam String stcd) {
|
||||
|
||||
@ -2,6 +2,7 @@ package com.yfd.platform.env.service;
|
||||
|
||||
import com.yfd.platform.common.DataSourceRequest;
|
||||
import com.yfd.platform.common.DataSourceResult;
|
||||
import com.yfd.platform.env.entity.vo.FishSpawnVo;
|
||||
import com.yfd.platform.env.entity.vo.WtrvVo;
|
||||
|
||||
public interface SdWtMonitorService {
|
||||
@ -14,5 +15,7 @@ public interface SdWtMonitorService {
|
||||
|
||||
DataSourceResult getWtFishAnalysis(DataSourceRequest dataSourceRequest);
|
||||
|
||||
DataSourceResult<FishSpawnVo> getWtFishInfo(DataSourceRequest dataSourceRequest);
|
||||
|
||||
WtrvVo getFlagByStcd(String stcd);
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
@ -147,6 +148,47 @@ public class SdWtMonitorServiceImpl implements SdWtMonitorService {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FishSpawnVo> getWtFishInfo(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
String stcd = QgcQueryWrapperUtil.getFilterFieldValue(loadOptions, "stcd");
|
||||
|
||||
DataSourceResult<FishSpawnVo> result = new DataSourceResult<>();
|
||||
if (StrUtil.isBlank(stcd)) {
|
||||
result.setData(new ArrayList<>());
|
||||
result.setTotal(0L);
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
String sql = "SELECT DISTINCT " +
|
||||
"t2.ID AS id, " +
|
||||
"t2.NAME AS name, " +
|
||||
"t2.PRETEMP AS pretempStr, " +
|
||||
"t2.SPAWN_MONTH AS spawnMonthStr " +
|
||||
"FROM SD_WT_B_H t1 " +
|
||||
"INNER JOIN SD_ENGINFO_B_H eng ON eng.STCD = t1.RSTCD " +
|
||||
"INNER JOIN SD_FISHDICTORY_RLTN_B t3 ON eng.HBRVCD = t3.RVCD " +
|
||||
"INNER JOIN SD_FISHDICTORY_B t2 ON t2.ID = t3.ZY_FISH_ID " +
|
||||
"WHERE t1.STCD = #{map.stcd} " +
|
||||
" AND t1.IS_DELETED = 0 " +
|
||||
" AND t1.STTP = 'WTRV' " +
|
||||
" AND t2.IS_DELETED = 0 " +
|
||||
" AND t3.IS_DELETED = 0 " +
|
||||
" AND t2.PRETEMP IS NOT NULL " +
|
||||
" AND t2.SPAWN_MONTH IS NOT NULL";
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("stcd", stcd);
|
||||
List<FishSpawnVo> list = microservicDynamicSQLMapper.getAllListWithResultType(sql, paramMap, FishSpawnVo.class);
|
||||
for (FishSpawnVo fishSpawnVo : list) {
|
||||
fillFishSpawnMeta(fishSpawnVo);
|
||||
}
|
||||
result.setData(list);
|
||||
result.setTotal((long) list.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataSourceResult getVmsstbprptList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest.toDevRequest();
|
||||
@ -694,6 +736,36 @@ public class SdWtMonitorServiceImpl implements SdWtMonitorService {
|
||||
}
|
||||
}
|
||||
|
||||
private void fillFishSpawnMeta(FishSpawnVo fishSpawnVo) {
|
||||
if (fishSpawnVo == null) {
|
||||
return;
|
||||
}
|
||||
BigDecimal[] range = parsePretempRange(fishSpawnVo.getPretempStr());
|
||||
if (range != null) {
|
||||
List<String> preTempList = new ArrayList<>(2);
|
||||
preTempList.add(range[0].stripTrailingZeros().toPlainString());
|
||||
preTempList.add(range[1].stripTrailingZeros().toPlainString());
|
||||
fishSpawnVo.setPretemp(preTempList);
|
||||
}
|
||||
if (StrUtil.isNotBlank(fishSpawnVo.getSpawnMonthStr())) {
|
||||
List<String> spawnList = new ArrayList<>();
|
||||
for (String str : Arrays.asList(fishSpawnVo.getSpawnMonthStr().split(","))) {
|
||||
if (StrUtil.isBlank(str)) {
|
||||
continue;
|
||||
}
|
||||
String month = str.trim();
|
||||
try {
|
||||
if (Integer.parseInt(month) < 10 && month.length() == 1) {
|
||||
month = "0" + month;
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
spawnList.add(month);
|
||||
}
|
||||
fishSpawnVo.setSpawnMonth(spawnList);
|
||||
}
|
||||
}
|
||||
|
||||
private WtrvVo buildDefaultWtrvVo(String stcd) {
|
||||
WtrvVo vo = new WtrvVo();
|
||||
vo.setStcd(stcd);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user