优化属性类型

master
chenxiwang 2024-08-06 14:00:43 +08:00
parent a2624d4510
commit 6e0b120ec6
2 changed files with 31 additions and 24 deletions

View File

@ -57,8 +57,8 @@ public class ForecastUseparam extends GenericPageParams implements Serializable
@TableField(value="param_code") @TableField(value="param_code")
@Schema(description="参数名") @Schema(description="参数名")
@Size(max = 255,message = "参数名最大长度要小于 255") @Size(max = 255,message = "参数名最大长度要小于 255")
// @NotBlank(message = "参数名不能为空") @NotBlank(message = "参数名不能为空")
// @NotNull(message = "参数名不能为空") @NotNull(message = "参数名不能为空")
private String paramCode; private String paramCode;
/** /**
@ -67,18 +67,8 @@ public class ForecastUseparam extends GenericPageParams implements Serializable
@TableField(value="param_value") @TableField(value="param_value")
@Schema(description="参数值") @Schema(description="参数值")
@Size(max = 255,message = "参数值最大长度要小于 255") @Size(max = 255,message = "参数值最大长度要小于 255")
@NotBlank(message = "参数值不能为空")
@NotNull(message = "参数值不能为空")
private String paramValue; private String paramValue;
/**
*
*/
@TableField(value="param_unit")
@Schema(description="参数单位")
@Size(max = 255,message = "参数单位最大长度要小于 255")
private String paramUnit;
/** /**
* *
*/ */
@ -92,7 +82,7 @@ public class ForecastUseparam extends GenericPageParams implements Serializable
@TableField(value="param_remarks") @TableField(value="param_remarks")
@Schema(description="参数描述") @Schema(description="参数描述")
@Size(max = 255,message = "参数描述最大长度要小于 255") @Size(max = 255,message = "参数描述最大长度要小于 255")
private String paramRemarks; private String paramDesc;
/** /**
* *
@ -110,4 +100,26 @@ public class ForecastUseparam extends GenericPageParams implements Serializable
@JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8") @JsonFormat(pattern = DateFormatString.YYYY_MM_DD_HH_MM_SS, timezone = "GMT+8")
private Date updateTime; private Date updateTime;
/**
* 12k3PPaR
*/
@TableField(value="param_type")
@Schema(description="参数类型1普通类型一对一2一对多3多对多")
private String paramType;
/**
*
*/
@TableField(value="ability_code")
@Schema(description="功能码(前端调用引导)")
@Size(max = 255,message = "功能码最大长度要小于 255")
private String abilityCode;
/**
*
*/
@TableField(value="remarks")
@Schema(description="备注")
@Size(max = 255,message = "备注最大长度要小于 255")
private String remarks;
} }

View File

@ -192,18 +192,15 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
ForecastPa forecastPa = paMap.get(sdfDay.format(cal.getTime())); ForecastPa forecastPa = paMap.get(sdfDay.format(cal.getTime()));
// 根据降雨数据按照△t的颗粒度均分 // 根据降雨数据按照△t的颗粒度均分
List<String> pResultList = new ArrayList<>(); List<String> pResultList = new ArrayList<>();
// 筛选时间段内的降雨数据。第一个条件:时间大于等开始时间;第二个条件:时间小于等于结束时间(包前不包后但是需要使用最后的tm计算间隔值 // 筛选时间段内的降雨数据。第一个条件:时间大于等开始时间;第二个条件:时间小于等于结束时间(不包前但包后比如从8点开始就要拆下一个时间9点的数据
List<StPptnR> filterList = pptnRAllList.stream().filter(e -> e.getTm().compareTo(period[0]) >= 0).filter(e -> e.getTm().compareTo(period[1]) <= 0).collect(Collectors.toList()); List<StPptnR> filterList = pptnRAllList.stream().filter(e -> e.getTm().compareTo(period[0]) >= 0).filter(e -> e.getTm().compareTo(period[1]) <= 0).collect(Collectors.toList());
for (int i = 0; i < filterList.size(); i++) { // 从第二条数据开始
// 到第二天早八,包前不包后,最后一条的第二天早八剔除 for (int i = 1; i <= filterList.size(); i++) {
if (i + 1 == filterList.size()) {
break;
}
StPptnR stPptnR = filterList.get(i); StPptnR stPptnR = filterList.get(i);
String drp = stPptnR.getDrp(); String drp = stPptnR.getDrp();
StPptnR stPptnRNext = filterList.get(i + 1); StPptnR stPptnRLast = filterList.get(i - 1);
// 两条数据的小时差 // 两条数据的小时差
double diffHours = dateHourDifference(stPptnR.getTm(), stPptnRNext.getTm()); double diffHours = dateHourDifference(stPptnRLast.getTm(), stPptnR.getTm());
// 两条数据间需要增补几条 // 两条数据间需要增补几条
int floorNum = (int) Math.floor(diffHours / dt); int floorNum = (int) Math.floor(diffHours / dt);
for (int j = 0; j < floorNum; j++) { for (int j = 0; j < floorNum; j++) {
@ -337,9 +334,7 @@ public class ForecastResultsService extends ServiceImpl<ForecastResultsMapper, F
// 两条数据的小时差 // 两条数据的小时差
double diffHours = dateHourDifference(stRsvrR.getTm(), stRsvrRNext.getTm()); double diffHours = dateHourDifference(stRsvrR.getTm(), stRsvrRNext.getTm());
int floorNum = (int) Math.floor(diffHours / dt); int floorNum = (int) Math.floor(diffHours / dt);
BigDecimal meanDifference = BigDecimal meanDifference = new BigDecimal(stRsvrRNext.getRz()).subtract(new BigDecimal(drp)).divide(new BigDecimal(floorNum), BigDecimal.ROUND_HALF_UP, 2);
new BigDecimal(stRsvrRNext.getRz()).subtract(new BigDecimal(drp)).divide(new BigDecimal(floorNum),
BigDecimal.ROUND_HALF_UP, 2);
for (int j = 1; j < floorNum; j++) { for (int j = 1; j < floorNum; j++) {
// 增补出的数据 // 增补出的数据
StRsvrR suppleStRsvrR = new StRsvrR(); StRsvrR suppleStRsvrR = new StRsvrR();