新增总需水量字段,总计划量字段
parent
b278261480
commit
af9f6c8ed1
|
|
@ -104,6 +104,7 @@ public class RiceSupportBalance implements Serializable {
|
|||
@Schema(description = "来水预测主键")
|
||||
private Long icWaterId;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<RiceSupportBalanceDetail> details;
|
||||
}
|
||||
|
|
@ -68,4 +68,10 @@ public class RiceSupportBalanceDetail implements Serializable {
|
|||
@TableField(value = "eco_plan")
|
||||
@Schema(description = "生态水量(万m³)-计划供水量")
|
||||
private BigDecimal ecoPlan;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal dailyTotalUse;
|
||||
|
||||
@TableField(exist = false)
|
||||
private BigDecimal dailyTotalPlan;
|
||||
}
|
||||
|
|
@ -353,6 +353,10 @@ public class RiceSupportBalanceService extends ServiceImpl<RiceSupportBalanceMap
|
|||
Page<RiceSupportBalance> riceSupportBalancePage = this.baseMapper.selectPage(page.getPageSo().toPage(), queryWrapper);
|
||||
for (RiceSupportBalance record : riceSupportBalancePage.getRecords()) {
|
||||
List<RiceSupportBalanceDetail> details = riceSupportBalanceDetailService.selectByRCId(record.getId());
|
||||
for (RiceSupportBalanceDetail detail : details) {
|
||||
detail.setDailyTotalUse(detail.getEcoUse().add(detail.getIrrigationUse()));
|
||||
detail.setDailyTotalPlan(detail.getEcoPlan().add(detail.getIrrigationPlan()));
|
||||
}
|
||||
record.setDetails(details);
|
||||
}
|
||||
return riceSupportBalancePage;
|
||||
|
|
|
|||
|
|
@ -202,7 +202,6 @@ public class LocalDateTimeUtils {
|
|||
if (startTime == null || endTime == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 将开始和结束时间调整为同一年(比如都调整为2020年)
|
||||
int baseYear = 2020; // 选择一个基准年
|
||||
|
||||
|
|
@ -219,43 +218,4 @@ public class LocalDateTimeUtils {
|
|||
return getTotalDayByRangeDate(adjustedStart, adjustedEnd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断日期是否在忽略年份的时间范围内
|
||||
*
|
||||
* @param checkDate 检查日期
|
||||
* @param startTime 周期开始时间
|
||||
* @param endTime 周期结束时间
|
||||
* @return 是否在周期内
|
||||
*/
|
||||
public static boolean isDateInCycleIgnoringYear(LocalDateTime checkDate,
|
||||
LocalDateTime startTime,
|
||||
LocalDateTime endTime) {
|
||||
if (checkDate == null || startTime == null || endTime == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 提取月日
|
||||
int checkMonth = checkDate.getMonthValue();
|
||||
int checkDay = checkDate.getDayOfMonth();
|
||||
|
||||
int startMonth = startTime.getMonthValue();
|
||||
int startDay = startTime.getDayOfMonth();
|
||||
|
||||
int endMonth = endTime.getMonthValue();
|
||||
int endDay = endTime.getDayOfMonth();
|
||||
|
||||
// 判断日期是否在周期内
|
||||
if (startMonth < endMonth || (startMonth == endMonth && startDay <= endDay)) {
|
||||
// 不跨年情况
|
||||
return (checkMonth > startMonth || (checkMonth == startMonth && checkDay >= startDay)) &&
|
||||
(checkMonth < endMonth || (checkMonth == endMonth && checkDay <= endDay));
|
||||
} else {
|
||||
// 跨年情况
|
||||
return (checkMonth > startMonth || (checkMonth == startMonth && checkDay >= startDay)) ||
|
||||
(checkMonth < endMonth || (checkMonth == endMonth && checkDay <= endDay));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue