feat: 鱼类人工催产记录列表
This commit is contained in:
parent
e949f0ed55
commit
23208f2572
@ -107,6 +107,12 @@ public class FbStationController {
|
||||
return ResponseResult.successData(fbStationService.getOutfishRList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/fishartinlr/GetKendoListCust")
|
||||
@Operation(summary = "鱼类人工催产记录列表")
|
||||
public ResponseResult getFishartinlRKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
return ResponseResult.successData(fbStationService.getFishartinlRList(dataSourceRequest));
|
||||
}
|
||||
|
||||
@PostMapping("/bsmfr/qgc/GetKendoListCust")
|
||||
@Operation(summary = "(全过程)增殖站二级页面: 亲鱼选配与培育->亲鱼信息")
|
||||
public ResponseResult getBsmfrQgcKendoListCust(@RequestBody DataSourceRequest dataSourceRequest) {
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
package com.yfd.platform.qgc_env.fb.entity.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 鱼类人工催产记录 VO
|
||||
*/
|
||||
@Data
|
||||
public class FbFishartinlRVo {
|
||||
|
||||
/** 主键 */
|
||||
private String id;
|
||||
|
||||
/** 设施编码 */
|
||||
private String stcd;
|
||||
|
||||
/** 鱼种类 */
|
||||
private String ftp;
|
||||
|
||||
/** 催产日期 */
|
||||
private Date tm;
|
||||
|
||||
/** 雌鱼数量 */
|
||||
private Long ffisht;
|
||||
|
||||
/** 雌鱼催产剂种类 */
|
||||
private Integer fpitocintype;
|
||||
|
||||
/** 雌鱼总剂量 */
|
||||
private BigDecimal fdose;
|
||||
|
||||
/** 雌鱼注射方式 */
|
||||
private String finjmo;
|
||||
|
||||
/** 气温(℃) */
|
||||
private BigDecimal air;
|
||||
|
||||
/** 水温(℃) */
|
||||
private BigDecimal wartem;
|
||||
|
||||
/** 溶解氧(mg/L) */
|
||||
private BigDecimal dox;
|
||||
|
||||
/** 记录人 */
|
||||
private String recorder;
|
||||
|
||||
/** 性别:1=雄鱼 2=雌鱼 */
|
||||
private Integer sex;
|
||||
|
||||
/** 附件ID */
|
||||
private String fid;
|
||||
|
||||
/** 雄鱼注射方式 */
|
||||
private Long mfisht;
|
||||
|
||||
/** 雄鱼催产剂种类 */
|
||||
private Integer mpitocintype;
|
||||
|
||||
/** 雄鱼总剂量 */
|
||||
private BigDecimal mdose;
|
||||
|
||||
/** 雄鱼注射方式 */
|
||||
private String minjmo;
|
||||
|
||||
/** 创建人 */
|
||||
private String recordUser;
|
||||
|
||||
/** 创建时间 */
|
||||
private Date recordTime;
|
||||
|
||||
/** 更新人 */
|
||||
private String modifyUser;
|
||||
|
||||
/** 更新时间 */
|
||||
private Date modifyTime;
|
||||
|
||||
/** 是否已删除 */
|
||||
private Integer isDeleted;
|
||||
|
||||
/** 删除人 */
|
||||
private String deleteUser;
|
||||
|
||||
/** 删除时间 */
|
||||
private Date deleteTime;
|
||||
}
|
||||
@ -10,6 +10,7 @@ import com.yfd.platform.qgc_env.fb.entity.vo.FbFbbwtRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFbcwqRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsrfiRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbOutfishRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFishartinlRVo;
|
||||
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.FbEngFishVo;
|
||||
@ -126,4 +127,9 @@ public interface FbStationService {
|
||||
* 淘汰亲鱼基本信息记录列表
|
||||
*/
|
||||
DataSourceResult<FbOutfishRVo> getOutfishRList(DataSourceRequest dataSourceRequest);
|
||||
|
||||
/**
|
||||
* 鱼类人工催产记录列表
|
||||
*/
|
||||
DataSourceResult<FbFishartinlRVo> getFishartinlRList(DataSourceRequest dataSourceRequest);
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ import com.yfd.platform.qgc_env.fb.entity.vo.FbFbbwtRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFbcwqRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbBsrfiRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbOutfishRVo;
|
||||
import com.yfd.platform.qgc_env.fb.entity.vo.FbFishartinlRVo;
|
||||
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;
|
||||
@ -7086,4 +7087,264 @@ public class FbStationServiceImpl implements FbStationService {
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
// ==================== 鱼类人工催产记录列表 ====================
|
||||
|
||||
@Override
|
||||
public DataSourceResult<FbFishartinlRVo> getFishartinlRList(DataSourceRequest dataSourceRequest) {
|
||||
DataSourceLoadOptionsBase loadOptions = dataSourceRequest == null ? null : dataSourceRequest.toDevRequest();
|
||||
GroupingInfo[] groups = loadOptions == null ? null : loadOptions.getGroup();
|
||||
if (groups != null && groups.length > 0) {
|
||||
return queryFishartinlRGroupList(dataSourceRequest, loadOptions, groups);
|
||||
}
|
||||
return queryFishartinlRDetailList(dataSourceRequest, loadOptions);
|
||||
}
|
||||
|
||||
private DataSourceResult<FbFishartinlRVo> queryFishartinlRDetailList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions) {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT ")
|
||||
.append(buildFishartinlRDetailSelectSql(dataSourceRequest == null ? null : dataSourceRequest.getSelect()))
|
||||
.append(" FROM (")
|
||||
.append(buildFishartinlRCoreSql())
|
||||
.append(") t WHERE 1 = 1 ");
|
||||
String filterSql = buildFishartinlRFilterCondition(
|
||||
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||
paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql).append(" ");
|
||||
}
|
||||
sql.append(buildFishartinlROrderBySql(dataSourceRequest == null ? null : dataSourceRequest.getSort()));
|
||||
Page<?> page = loadOptions == null ? null : QgcQueryWrapperUtil.buildPage(loadOptions, loadOptions.getSkip(), loadOptions.getTake());
|
||||
List<FbFishartinlRVo> list = microservicDynamicSQLMapper.pageAllListWithResultType(
|
||||
page, sql.toString(), paramMap, FbFishartinlRVo.class);
|
||||
DataSourceResult<FbFishartinlRVo> result = new DataSourceResult<>();
|
||||
result.setData(list);
|
||||
result.setTotal(page != null ? page.getTotal() : list.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
private DataSourceResult<FbFishartinlRVo> queryFishartinlRGroupList(DataSourceRequest dataSourceRequest,
|
||||
DataSourceLoadOptionsBase loadOptions,
|
||||
GroupingInfo[] groupInfos) {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.append("SELECT * FROM (")
|
||||
.append(buildFishartinlRCoreSql())
|
||||
.append(") t WHERE 1 = 1 ");
|
||||
String filterSql = buildFishartinlRFilterCondition(
|
||||
dataSourceRequest == null ? null : dataSourceRequest.getFilter(),
|
||||
paramMap, new int[]{0});
|
||||
if (StrUtil.isNotBlank(filterSql)) {
|
||||
sql.append(" AND ").append(filterSql).append(" ");
|
||||
}
|
||||
String groupedSql = buildFishartinlRGroupSql(sql.toString(),
|
||||
dataSourceRequest == null ? null : dataSourceRequest.getGroup());
|
||||
List<Map<String, Object>> rows = microservicDynamicSQLMapper.pageAllList(
|
||||
null, groupedSql, paramMap);
|
||||
DataSourceResult<FbFishartinlRVo> result = new DataSourceResult<>();
|
||||
if (Boolean.TRUE.equals(dataSourceRequest == null ? false : dataSourceRequest.getGroupResultFlat())) {
|
||||
result.setData((List<FbFishartinlRVo>) (List<?>) new GroupHelper().faltGroup(
|
||||
rows, groupInfos == null ? Collections.emptyList() : Arrays.asList(groupInfos)));
|
||||
} else {
|
||||
result.setData((List<FbFishartinlRVo>) (List<?>) new GroupHelper().group(
|
||||
rows, groupInfos == null ? Collections.emptyList() : Arrays.asList(groupInfos)));
|
||||
}
|
||||
result.setTotal(rows.size());
|
||||
result.setAggregates(new HashMap<>());
|
||||
return result;
|
||||
}
|
||||
|
||||
private String buildFishartinlRCoreSql() {
|
||||
return "SELECT ID AS id, "
|
||||
+ "STCD AS stcd, "
|
||||
+ "FTP AS ftp, "
|
||||
+ "TM AS tm, "
|
||||
+ "FFISHT AS ffisht, "
|
||||
+ "FPITOCINTYPE AS fpitocintype, "
|
||||
+ "FDOSE AS fdose, "
|
||||
+ "FINJMO AS finjmo, "
|
||||
+ "AIR AS air, "
|
||||
+ "WARTEM AS wartem, "
|
||||
+ "DOX AS dox, "
|
||||
+ "RECORDER AS recorder, "
|
||||
+ "SEX AS sex, "
|
||||
+ "FID AS fid, "
|
||||
+ "MFISHT AS mfisht, "
|
||||
+ "MPITOCINTYPE AS mpitocintype, "
|
||||
+ "MDOSE AS mdose, "
|
||||
+ "MINJMO AS minjmo, "
|
||||
+ "RECORD_USER AS recordUser, "
|
||||
+ "RECORD_TIME AS recordTime, "
|
||||
+ "MODIFY_USER AS modifyUser, "
|
||||
+ "MODIFY_TIME AS modifyTime, "
|
||||
+ "IS_DELETED AS isDeleted, "
|
||||
+ "DELETE_USER AS deleteUser, "
|
||||
+ "DELETE_TIME AS deleteTime "
|
||||
+ "FROM SD_FBFISHARTINL_R "
|
||||
+ "WHERE NVL(IS_DELETED, 0) = 0";
|
||||
}
|
||||
|
||||
private String buildFishartinlRDetailSelectSql(List<String> select) {
|
||||
List<String> fields = CollUtil.isEmpty(select)
|
||||
? List.of("id", "stcd", "ftp", "tm", "ffisht", "fpitocintype", "fdose", "finjmo",
|
||||
"air", "wartem", "dox", "recorder", "sex", "fid", "mfisht", "mpitocintype", "mdose", "minjmo",
|
||||
"recordUser", "recordTime", "modifyUser", "modifyTime", "isDeleted", "deleteUser", "deleteTime")
|
||||
: select;
|
||||
List<String> selectParts = new ArrayList<>();
|
||||
for (String field : fields) {
|
||||
String column = mapFishartinlRColumn(field);
|
||||
if (StrUtil.isNotBlank(column)) {
|
||||
selectParts.add(column + " AS " + field);
|
||||
}
|
||||
}
|
||||
if (selectParts.isEmpty()) {
|
||||
selectParts.add("t.id AS id");
|
||||
}
|
||||
return String.join(", ", selectParts);
|
||||
}
|
||||
|
||||
private String buildFishartinlRFilterCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
if (filter == null) return "";
|
||||
if (StrUtil.isNotBlank(filter.getField())) return buildFishartinlRLeafCondition(filter, paramMap, indexHolder);
|
||||
if (CollUtil.isEmpty(filter.getFilters())) return "";
|
||||
List<String> conditions = new ArrayList<>();
|
||||
for (DataSourceRequest.FilterDescriptor child : filter.getFilters()) {
|
||||
String childSql = buildFishartinlRFilterCondition(child, paramMap, indexHolder);
|
||||
if (StrUtil.isNotBlank(childSql)) conditions.add("(" + childSql + ")");
|
||||
}
|
||||
if (conditions.isEmpty()) return "";
|
||||
return String.join("or".equalsIgnoreCase(filter.getLogic()) ? " OR " : " AND ", conditions);
|
||||
}
|
||||
|
||||
private String buildFishartinlRLeafCondition(DataSourceRequest.FilterDescriptor filter,
|
||||
Map<String, Object> paramMap,
|
||||
int[] indexHolder) {
|
||||
String column = mapFishartinlRColumn(filter.getField());
|
||||
if (StrUtil.isBlank(column)) return "";
|
||||
String operator = StrUtil.blankToDefault(filter.getOperator(), "eq").toLowerCase();
|
||||
Object value = filter.getValue();
|
||||
if ("isnull".equals(operator)) return column + " IS NULL";
|
||||
if ("isnotnull".equals(operator)) return column + " IS NOT NULL";
|
||||
if ("in".equals(operator)) {
|
||||
List<Object> values = normalizeFishartinlRValues(value);
|
||||
if (values.isEmpty()) return "";
|
||||
List<String> placeholders = new ArrayList<>();
|
||||
for (Object item : values) {
|
||||
String key = "farP" + indexHolder[0]++;
|
||||
paramMap.put(key, normalizeFishartinlRValue(filter.getField(), item));
|
||||
placeholders.add("#{map." + key + "}");
|
||||
}
|
||||
return column + " IN (" + String.join(", ", placeholders) + ")";
|
||||
}
|
||||
if (value == null) return "";
|
||||
String key = "farP" + indexHolder[0]++;
|
||||
Object normalizedValue = normalizeFishartinlRValue(filter.getField(), value);
|
||||
return switch (operator) {
|
||||
case "eq" -> { paramMap.put(key, normalizedValue); yield column + " = #{map." + key + "}"; }
|
||||
case "neq" -> { paramMap.put(key, normalizedValue); yield column + " <> #{map." + key + "}"; }
|
||||
case "gt" -> { paramMap.put(key, normalizedValue); yield column + " > #{map." + key + "}"; }
|
||||
case "gte" -> { paramMap.put(key, normalizedValue); yield column + " >= #{map." + key + "}"; }
|
||||
case "lt" -> { paramMap.put(key, normalizedValue); yield column + " < #{map." + key + "}"; }
|
||||
case "lte" -> { paramMap.put(key, normalizedValue); yield column + " <= #{map." + key + "}"; }
|
||||
case "contains" -> { paramMap.put(key, "%" + normalizedValue + "%"); yield column + " LIKE #{map." + key + "}"; }
|
||||
case "doesnotcontain" -> { paramMap.put(key, "%" + normalizedValue + "%"); yield column + " NOT LIKE #{map." + key + "}"; }
|
||||
case "startswith" -> { paramMap.put(key, normalizedValue + "%"); yield column + " LIKE #{map." + key + "}"; }
|
||||
case "endswith" -> { paramMap.put(key, "%" + normalizedValue); yield column + " LIKE #{map." + key + "}"; }
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private String buildFishartinlROrderBySql(List<DataSourceRequest.SortDescriptor> sortDescriptors) {
|
||||
if (CollUtil.isEmpty(sortDescriptors)) return " ORDER BY t.tm DESC";
|
||||
List<String> parts = new ArrayList<>();
|
||||
for (DataSourceRequest.SortDescriptor descriptor : sortDescriptors) {
|
||||
String column = mapFishartinlRColumn(descriptor.getField());
|
||||
if (StrUtil.isBlank(column)) continue;
|
||||
parts.add(column + ("desc".equalsIgnoreCase(descriptor.getDir()) ? " DESC" : " ASC"));
|
||||
}
|
||||
if (parts.isEmpty()) return " ORDER BY t.tm DESC";
|
||||
return " ORDER BY " + String.join(", ", parts);
|
||||
}
|
||||
|
||||
private String buildFishartinlRGroupSql(String baseSql, List<DataSourceRequest.GroupDescriptor> groups) {
|
||||
if (CollUtil.isEmpty(groups)) return baseSql;
|
||||
List<DataSourceRequest.GroupDescriptor> validGroups = groups.stream()
|
||||
.filter(group -> StrUtil.isNotBlank(mapFishartinlRColumn(group.getField()))).toList();
|
||||
if (validGroups.isEmpty()) return baseSql;
|
||||
List<String> groupFields = validGroups.stream().map(DataSourceRequest.GroupDescriptor::getField).toList();
|
||||
StringBuilder sql = new StringBuilder("SELECT ");
|
||||
for (int i = 0; i < groupFields.size(); i++) {
|
||||
if (i > 0) sql.append(", ");
|
||||
sql.append("t.").append(groupFields.get(i)).append(" AS ").append(groupFields.get(i));
|
||||
}
|
||||
sql.append(", COUNT(1) AS \"aggregates.count\" FROM (").append(baseSql).append(") t GROUP BY ");
|
||||
for (int i = 0; i < groupFields.size(); i++) {
|
||||
if (i > 0) sql.append(", ");
|
||||
sql.append("t.").append(groupFields.get(i));
|
||||
}
|
||||
return sql.toString();
|
||||
}
|
||||
|
||||
private String mapFishartinlRColumn(String field) {
|
||||
return switch (field) {
|
||||
case "id" -> "t.id";
|
||||
case "stcd" -> "t.stcd";
|
||||
case "ftp" -> "t.ftp";
|
||||
case "tm" -> "t.tm";
|
||||
case "ffisht" -> "t.ffisht";
|
||||
case "fpitocintype" -> "t.fpitocintype";
|
||||
case "fdose" -> "t.fdose";
|
||||
case "finjmo" -> "t.finjmo";
|
||||
case "air" -> "t.air";
|
||||
case "wartem" -> "t.wartem";
|
||||
case "dox" -> "t.dox";
|
||||
case "recorder" -> "t.recorder";
|
||||
case "sex" -> "t.sex";
|
||||
case "fid" -> "t.fid";
|
||||
case "mfisht" -> "t.mfisht";
|
||||
case "mpitocintype" -> "t.mpitocintype";
|
||||
case "mdose" -> "t.mdose";
|
||||
case "minjmo" -> "t.minjmo";
|
||||
case "recordUser" -> "t.recordUser";
|
||||
case "recordTime" -> "t.recordTime";
|
||||
case "modifyUser" -> "t.modifyUser";
|
||||
case "modifyTime" -> "t.modifyTime";
|
||||
case "isDeleted" -> "t.isDeleted";
|
||||
case "deleteUser" -> "t.deleteUser";
|
||||
case "deleteTime" -> "t.deleteTime";
|
||||
default -> "";
|
||||
};
|
||||
}
|
||||
|
||||
private List<Object> normalizeFishartinlRValues(Object value) {
|
||||
List<Object> values = new ArrayList<>();
|
||||
if (value == null) return values;
|
||||
if (value instanceof Collection<?> collection) { values.addAll(collection); return values; }
|
||||
if (value instanceof Object[] array) { values.addAll(Arrays.asList(array)); return values; }
|
||||
String text = String.valueOf(value).trim();
|
||||
if (text.startsWith("[") && text.endsWith("]")) text = text.substring(1, text.length() - 1);
|
||||
if (text.contains(",")) {
|
||||
for (String item : text.split(",")) {
|
||||
String trimmed = StrUtil.trim(item);
|
||||
if (StrUtil.isNotBlank(trimmed)) values.add(trimmed);
|
||||
}
|
||||
return values;
|
||||
}
|
||||
values.add(value);
|
||||
return values;
|
||||
}
|
||||
|
||||
private Object normalizeFishartinlRValue(String field, Object value) {
|
||||
if (value == null) return null;
|
||||
if (Set.of("tm", "recordTime", "modifyTime", "deleteTime").contains(field) && value instanceof String text) {
|
||||
return parseDateTimeSafely(text);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user