Commit cd16f8c1 authored by ZWT's avatar ZWT

feat(能源管理系统): 间开优化定时任务

1.开发间开优化长期间开优化定时任务,完成并网流程绿电消纳优先策略;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 1224455a
......@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.UUID;
import org.apache.commons.lang3.StringUtils;
import pps.core.common.constant.BusinessConstant;
import pps.core.common.entity.BaseModel;
import pps.core.common.session.PpsUserSession;
......@@ -123,4 +124,20 @@ public class BaseUtils {
}
return between;
}
/**
* 获取结束时间字符串
*
* @param endTimeOptimize 结束时间优化
* @return {@link String}
*/
public static String getEndTimeString(DateTime endTimeOptimize) {
String endTimeString;
if (endTimeOptimize.compareTo(BusinessConstant.DATE_FLAG) > 0) {
endTimeString = BusinessConstant.END_OF_DAY_TIME;
} else {
endTimeString = endTimeOptimize.toString(BusinessConstant.MINUTES_FORMAT);
}
return endTimeString;
}
}
\ No newline at end of file
......@@ -243,14 +243,8 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
//计算未优化启动间隔
int openDuration = (int) startTime.between(endTime, DateUnit.MINUTE);
DateTime endTimeOptimize = startTimeOptimize.offset(DateField.MINUTE, openDuration);
String endTimeString;
if (endTimeOptimize.compareTo(BusinessConstant.DATE_FLAG) > 0) {
endTimeString = BusinessConstant.END_OF_DAY_TIME;
} else {
endTimeString = endTimeOptimize.toString(BusinessConstant.MINUTES_FORMAT);
}
this.createOptimizeLongDuration(longDurationList, duration, longPeriodId, recordId, wellheadId, null,
openWellTime, endTimeString
openWellTime, BaseUtils.getEndTimeString(endTimeOptimize)
);
//取时间间隔(分钟)
between = BaseUtils.getTimeDifferenceMinute(endTimeOptimize, endTime);
......@@ -264,17 +258,11 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
//如果时间超过当天,舍弃
continue;
}
DateTime endDate = DateUtil.parse(duration.getCloseWellTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT)
.offset(DateField.MINUTE, between);
String closeWellTime;
if (endDate.compareTo(BusinessConstant.DATE_FLAG) > 0) {
closeWellTime = BusinessConstant.END_OF_DAY_TIME;
} else {
closeWellTime = endDate.toString(BusinessConstant.MINUTES_FORMAT);
}
//计算偏移
this.createOptimizeLongDuration(longDurationList, duration, longPeriodId, recordId, wellheadId, null,
offset.toString(BusinessConstant.MINUTES_FORMAT), closeWellTime
offset.toString(BusinessConstant.MINUTES_FORMAT),
BaseUtils.getEndTimeString(DateUtil.parse(duration.getCloseWellTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT)
.offset(DateField.MINUTE, between))
);
}
}
......@@ -372,17 +360,12 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
//如果时间超过当天,舍弃
continue;
}
DateTime endDate = DateUtil.parse(duration.getCloseWellTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT)
.offset(DateField.MINUTE, between);
String closeWellTime;
if (endDate.compareTo(BusinessConstant.DATE_FLAG) > 0) {
closeWellTime = BusinessConstant.END_OF_DAY_TIME;
} else {
closeWellTime = endDate.toString(BusinessConstant.MINUTES_FORMAT);
}
//计算偏移
this.createOptimizeLongDuration(longDurationList, duration, longPeriodId, recordId, wellheadId, null,
offset.toString(BusinessConstant.MINUTES_FORMAT), closeWellTime
offset.toString(BusinessConstant.MINUTES_FORMAT), BaseUtils.getEndTimeString(
DateUtil.parse(duration.getCloseWellTime() + BusinessConstant.INITIALIZATION_SECOND, BusinessConstant.TIME_FORMAT)
.offset(DateField.MINUTE, between)
)
);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment