Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gf_back
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tianchao
gf_back
Commits
f782f97b
Commit
f782f97b
authored
Sep 18, 2023
by
ZWT
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(能源管理系统): 间开优化定时任务
1.开发间开优化长期间开优化定时任务,完成并网流程绿电消纳优先策略; BREAKING CHANGE: 无 Closes 无 [skip ci]
parent
cd16f8c1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
240 additions
and
200 deletions
+240
-200
C11-space/pps-core-space/src/main/java/pps/core/space/service/SpaceOptimizeLongCloudServiceImpl.java
...core/space/service/SpaceOptimizeLongCloudServiceImpl.java
+240
-200
No files found.
C11-space/pps-core-space/src/main/java/pps/core/space/service/SpaceOptimizeLongCloudServiceImpl.java
View file @
f782f97b
...
...
@@ -104,7 +104,6 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
for
(
SpaceInstitutionDetailEnt
detail
:
detailEntList
)
{
String
detailId
=
detail
.
getId
();
String
lineId
=
detail
.
getLineId
();
Integer
startInterval
=
0
;
//创建记录
String
longPeriodId
=
this
.
createOptimizeLongPeriod
(
longPeriodList
,
detailId
,
lineId
,
executionCycleForMonth
,
optimizeDeadline
);
switch
(
detail
.
getGridTypeKey
())
{
...
...
@@ -158,129 +157,95 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
int
compare
=
powerMax
.
compareTo
(
wellheadTotalPower
);
//光伏出力峰值大于等于井口总功率:绿电消纳优先策略
if
(
compare
>=
BusinessConstant
.
ZERO
)
{
//---------------------------------井口优化---------------------------------
int
between
=
0
;
//判断是否第一口井
boolean
isFirstWellhead
;
//第一口井启动时间
DateTime
firstStartTime
=
null
;
//井口累积运行总功率
BigDecimal
totalOperatingPower
=
BigDecimal
.
ZERO
;
for
(
int
w
=
0
,
wellheadSize
=
wellheadViewList
.
size
();
w
<
wellheadSize
;
w
++)
{
SpaceInstitutionWellheadView
wellhead
=
wellheadViewList
.
get
(
w
);
String
wellheadId
=
wellhead
.
getWellheadId
();
String
recordId
=
this
.
createOptimizeLongWellhead
(
longWellheadList
,
longPeriodId
,
wellheadId
,
wellhead
.
getWellNumber
());
//取当前井口最大发电量
BigDecimal
serviceRating
=
wellhead
.
getServiceRating
();
List
<
SpaceInstitutionDurationEnt
>
durationConfigList
=
durationMap
.
get
(
wellhead
);
if
(
CollUtil
.
isEmpty
(
durationConfigList
))
{
//没有设置时间段,无法优化
continue
;
}
if
(
w
==
0
)
{
//第一个井口
isFirstWellhead
=
true
;
totalOperatingPower
.
add
(
serviceRating
);
//---------------------------------绿电消纳策略---------------------------------
this
.
greenElectricityConsumptionStrategy
(
longDurationList
,
wellheadViewList
,
longWellheadList
,
avgPowerList
,
durationMap
,
detail
,
longPeriodId
);
}
else
{
//累加
totalOperatingPower
=
totalOperatingPower
.
add
(
serviceRating
);
startInterval
=
startInterval
+
detail
.
getStartInterval
();
isFirstWellhead
=
false
;
}
for
(
int
d
=
0
,
durationSize
=
durationConfigList
.
size
();
d
<
durationSize
;
d
++)
{
SpaceInstitutionDurationEnt
duration
=
durationConfigList
.
get
(
d
);
String
openWellTime
=
duration
.
getOpenWellTime
();
DateTime
startTime
=
DateUtil
.
parse
(
openWellTime
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
);
DateTime
endTime
=
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
);
//第一次启动
if
(
d
==
0
)
{
//第一口井的启动时间
if
(
isFirstWellhead
)
{
firstStartTime
=
startTime
;
//计算开井时间
int
startIndex
=
0
;
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
//当日时间段平均光伏出力>=第一口井运行负荷时,该时间为第一口井运行时间
if
(
predictedPower
.
getPower
().
compareTo
(
serviceRating
)
>=
BusinessConstant
.
ZERO
)
{
startIndex
=
a
;
break
;
//遍历井口,按发电功率大于等于光伏出力峰值条件分组
Map
<
Boolean
,
List
<
SpaceInstitutionWellheadView
>>
collect
=
spaceWellheadList
.
stream
()
.
filter
(
w
->
StringUtils
.
equals
(
detailId
,
w
.
getInstitutionId
())
)
.
collect
(
Collectors
.
partitioningBy
(
w
->
powerMax
.
compareTo
(
w
.
getServiceRating
())
>=
BusinessConstant
.
ZERO
));
List
<
SpaceInstitutionWellheadView
>
lowWellheadList
=
collect
.
get
(
false
);
int
size
=
spaceWellheadList
.
size
();
int
lowWellheadListSize
=
lowWellheadList
.
size
();
//光伏出力峰值<任何一口井的运行功率:消峰平谷策略
if
(
size
==
lowWellheadListSize
)
{
//---------------------------------消峰平谷策略---------------------------------
this
.
peakEliminationAndValleyLevelingStrategy
(
context
,
longWellheadList
,
longDurationList
,
wellheadViewList
,
durationMap
,
detail
,
lineId
,
monthNum
,
longPeriodId
);
}
//光伏出力峰值>=线路哪部分井口运行功率:满足的部分井口采用绿电消纳优先,不满足的井采用消峰平谷
else
{
//---------------------------------井口优化---------------------------------
List
<
SpaceInstitutionWellheadView
>
highWellheadList
=
collect
.
get
(
true
);
}
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
String
startTimeString
=
start
.
getHourTime
()
+
start
.
getMinTime
();
//计算第一次关井时间,按照间开时间段顺延
int
startDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTime
.
offset
(
DateField
.
MINUTE
,
startDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
startTimeString
,
endTimeOptimize
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
)
);
//计算时间偏移
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
startTimeString
,
BusinessConstant
.
TIME_FORMAT
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
startTimeOptimize
,
startTime
);
}
//其它井口的第一次启动时间
else
{
DateTime
startTimeOffset
=
firstStartTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
int
startIndex
=
-
1
;
BigDecimal
add
=
serviceRating
.
add
(
totalOperatingPower
);
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
if
(
DateUtil
.
parse
(
predictedPower
.
getHourTime
()
+
predictedPower
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
)
.
compareTo
(
startTimeOffset
)
>=
0
)
{
//判断第一口井启动时间+启动间隔时日平均光伏出力-前两口井的运行功率是否为正数
if
(
predictedPower
.
getPower
().
compareTo
(
add
)
>=
0
)
{
//确定第二口井第一次开井时间为第一口井启动时间+启动间隔
startIndex
=
a
;
break
;
//离网型优化
case
"0"
:
break
;
default
:
//电网类型不存在
}
}
}
if
(
startIndex
>
-
1
)
{
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
start
.
getHourTime
()
+
start
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
);
//计算未优化启动间隔
int
openDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTimeOptimize
.
offset
(
DateField
.
MINUTE
,
openDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
openWellTime
,
BaseUtils
.
getEndTimeString
(
endTimeOptimize
)
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
endTimeOptimize
,
endTime
);
//开启事务
return
XTransactionHelper
.
begin
(
context
,
()
->
{
int
size
;
if
(
CollUtil
.
isNotEmpty
(
longPeriodList
))
{
SpaceOptimizeLongPeriodViewMapper
longPeriodViewMapper
=
context
.
getBean
(
SpaceOptimizeLongPeriodViewMapper
.
class
);
size
=
longPeriodList
.
size
();
if
(
size
>
BaseUtils
.
BATCH_SIZE
)
{
List
<
List
<
SpaceOptimizeLongPeriodView
>>
subList
=
BaseUtils
.
getSubList
(
longPeriodList
);
subList
.
forEach
(
b
->
longPeriodViewMapper
.
batchInsertList
(
b
));
}
else
{
//无法优化
longPeriodViewMapper
.
batchInsertList
(
longPeriodList
);
}
}
if
(
CollUtil
.
isNotEmpty
(
longWellheadList
))
{
SpaceOptimizeLongWellheadViewMapper
longWellheadViewMapper
=
context
.
getBean
(
SpaceOptimizeLongWellheadViewMapper
.
class
);
size
=
longWellheadList
.
size
();
if
(
size
>
BaseUtils
.
BATCH_SIZE
)
{
List
<
List
<
SpaceOptimizeLongWellheadView
>>
subList
=
BaseUtils
.
getSubList
(
longWellheadList
);
subList
.
forEach
(
b
->
longWellheadViewMapper
.
batchInsertList
(
b
));
}
else
{
DateTime
offset
=
startTime
.
offset
(
DateField
.
MINUTE
,
between
);
if
(
offset
.
compareTo
(
BusinessConstant
.
DATE_FLAG
)
>
0
)
{
//如果时间超过当天,舍弃
continue
;
longWellheadViewMapper
.
batchInsertList
(
longWellheadList
);
}
//计算偏移
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
offset
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
),
BaseUtils
.
getEndTimeString
(
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
)
.
offset
(
DateField
.
MINUTE
,
between
))
);
}
if
(
CollUtil
.
isNotEmpty
(
longDurationList
))
{
SpaceOptimizeLongDurationViewMapper
longDurationViewMapper
=
context
.
getBean
(
SpaceOptimizeLongDurationViewMapper
.
class
);
size
=
longDurationList
.
size
();
if
(
size
>
BaseUtils
.
BATCH_SIZE
)
{
List
<
List
<
SpaceOptimizeLongDurationView
>>
subList
=
BaseUtils
.
getSubList
(
longDurationList
);
subList
.
forEach
(
b
->
longDurationViewMapper
.
batchInsertList
(
b
));
}
else
{
longDurationViewMapper
.
batchInsertList
(
longDurationList
);
}
}
}
else
{
//遍历井口,按发电功率大于等于光伏出力峰值条件分组
Map
<
Boolean
,
List
<
SpaceInstitutionWellheadView
>>
collect
=
spaceWellheadList
.
stream
()
.
filter
(
w
->
StringUtils
.
equals
(
detailId
,
w
.
getInstitutionId
())
)
.
collect
(
Collectors
.
partitioningBy
(
w
->
powerMax
.
compareTo
(
w
.
getServiceRating
())
>=
BusinessConstant
.
ZERO
));
return
XServiceResult
.
OK
;
});
}
List
<
SpaceInstitutionWellheadView
>
lowWellheadList
=
collect
.
get
(
false
);
int
size
=
spaceWellheadList
.
size
();
int
lowWellheadListSize
=
lowWellheadList
.
size
();
//光伏出力峰值<任何一口井的运行功率:消峰平谷策略
if
(
size
==
lowWellheadListSize
)
{
//---------------------------------井口优化---------------------------------
/*-----------------------------------private-----------------------------------*/
/**
* 消峰平谷策略
*
* @param context 上下文
* @param longWellheadList 长井口列表
* @param longDurationList 长期清单
* @param wellheadViewList 井口视图列表
* @param durationMap 持续时间图
* @param detail 细节
* @param lineId 线路id
* @param monthNum 月份
* @param longPeriodId 长周期id
*/
private
void
peakEliminationAndValleyLevelingStrategy
(
XContext
context
,
List
<
SpaceOptimizeLongWellheadView
>
longWellheadList
,
List
<
SpaceOptimizeLongDurationView
>
longDurationList
,
List
<
SpaceInstitutionWellheadView
>
wellheadViewList
,
Map
<
String
,
List
<
SpaceInstitutionDurationEnt
>>
durationMap
,
SpaceInstitutionDetailEnt
detail
,
String
lineId
,
int
monthNum
,
String
longPeriodId
)
{
//通过线路ID和月份获取市电峰谷策略明细配置
List
<
GetBasePriceStrategyDetailOutput
>
strategyDetailList
=
ServiceUtil
.
getStrategyDetailList
(
context
,
GetBasePriceStrategyDetailInput
.
builder
()
...
...
@@ -290,7 +255,7 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
);
if
(
CollUtil
.
isEmpty
(
strategyDetailList
))
{
//没有配置,不优化
continue
;
return
;
}
//获取第一段谷电阶段的开始时间为第一口井的开井时间
Optional
<
GetBasePriceStrategyDetailOutput
>
low
=
strategyDetailList
.
stream
()
...
...
@@ -298,7 +263,7 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
.
findFirst
();
if
(!
low
.
isPresent
())
{
//没有谷电,不优化
continue
;
return
;
}
GetBasePriceStrategyDetailOutput
strategyDetailOutput
=
low
.
get
();
//第一口井启动时间
...
...
@@ -306,8 +271,10 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
DateTime
firstEndTime
=
DateUtil
.
parse
(
strategyDetailOutput
.
getEndTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
);
//判断是否第一口井
boolean
isFirstWellhead
;
//优化时间间隔
//时间差
int
between
=
0
;
//启动间隔累积
int
startInterval
=
0
;
for
(
int
w
=
0
,
wellheadSize
=
wellheadViewList
.
size
();
w
<
wellheadSize
;
w
++)
{
SpaceInstitutionWellheadView
wellhead
=
wellheadViewList
.
get
(
w
);
String
wellheadId
=
wellhead
.
getWellheadId
();
...
...
@@ -371,62 +338,135 @@ public class SpaceOptimizeLongCloudServiceImpl implements ISpaceOptimizeLongClou
}
}
}
//光伏出力峰值>=线路哪部分井口运行功率:满足的部分井口采用绿电消纳优先,不满足的井采用消峰平谷
else
{
//---------------------------------井口优化---------------------------------
List
<
SpaceInstitutionWellheadView
>
highWellheadList
=
collect
.
get
(
true
);
/**
* 绿电消纳策略
*
* @param longDurationList 长期清单
* @param wellheadViewList 井口视图列表
* @param longWellheadList 长井口列表
* @param avgPowerList 平均功率列表
* @param durationMap 持续时间图
* @param detail 细节
* @param longPeriodId 长周期id
*/
private
void
greenElectricityConsumptionStrategy
(
List
<
SpaceOptimizeLongDurationView
>
longDurationList
,
List
<
SpaceInstitutionWellheadView
>
wellheadViewList
,
List
<
SpaceOptimizeLongWellheadView
>
longWellheadList
,
List
<
DynamicQueryPlantPredictedPowerOutput
>
avgPowerList
,
Map
<
String
,
List
<
SpaceInstitutionDurationEnt
>>
durationMap
,
SpaceInstitutionDetailEnt
detail
,
String
longPeriodId
)
{
//---------------------------------井口优化---------------------------------
//时间差
int
between
=
0
;
//启动间隔累积
int
startInterval
=
0
;
//判断是否第一口井
boolean
isFirstWellhead
;
//第一口井启动时间
DateTime
firstStartTime
=
null
;
//井口累积运行总功率
BigDecimal
totalOperatingPower
=
BigDecimal
.
ZERO
;
for
(
int
w
=
0
,
wellheadSize
=
wellheadViewList
.
size
();
w
<
wellheadSize
;
w
++)
{
SpaceInstitutionWellheadView
wellhead
=
wellheadViewList
.
get
(
w
);
String
wellheadId
=
wellhead
.
getWellheadId
();
String
recordId
=
this
.
createOptimizeLongWellhead
(
longWellheadList
,
longPeriodId
,
wellheadId
,
wellhead
.
getWellNumber
());
//取当前井口最大发电量
BigDecimal
serviceRating
=
wellhead
.
getServiceRating
();
List
<
SpaceInstitutionDurationEnt
>
durationConfigList
=
durationMap
.
get
(
wellhead
);
if
(
CollUtil
.
isEmpty
(
durationConfigList
))
{
//没有设置时间段,无法优化
continue
;
}
if
(
w
==
0
)
{
//第一个井口
isFirstWellhead
=
true
;
totalOperatingPower
.
add
(
serviceRating
);
}
else
{
//累加
totalOperatingPower
=
totalOperatingPower
.
add
(
serviceRating
);
startInterval
=
startInterval
+
detail
.
getStartInterval
();
isFirstWellhead
=
false
;
}
for
(
int
d
=
0
,
durationSize
=
durationConfigList
.
size
();
d
<
durationSize
;
d
++)
{
SpaceInstitutionDurationEnt
duration
=
durationConfigList
.
get
(
d
);
String
openWellTime
=
duration
.
getOpenWellTime
();
DateTime
startTime
=
DateUtil
.
parse
(
openWellTime
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
);
DateTime
endTime
=
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
);
//第一次启动
if
(
d
==
0
)
{
//第一口井的启动时间
if
(
isFirstWellhead
)
{
firstStartTime
=
startTime
;
//计算开井时间
int
startIndex
=
0
;
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
//当日时间段平均光伏出力>=第一口井运行负荷时,该时间为第一口井运行时间
if
(
predictedPower
.
getPower
().
compareTo
(
serviceRating
)
>=
BusinessConstant
.
ZERO
)
{
startIndex
=
a
;
break
;
//离网型优化
case
"0"
:
}
}
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
String
startTimeString
=
start
.
getHourTime
()
+
start
.
getMinTime
();
//计算第一次关井时间,按照间开时间段顺延
int
startDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTime
.
offset
(
DateField
.
MINUTE
,
startDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
startTimeString
,
endTimeOptimize
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
)
);
//计算时间偏移
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
startTimeString
,
BusinessConstant
.
TIME_FORMAT
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
startTimeOptimize
,
startTime
);
}
//其它井口的第一次启动时间
else
{
DateTime
startTimeOffset
=
firstStartTime
.
offset
(
DateField
.
MINUTE
,
startInterval
);
int
startIndex
=
-
1
;
BigDecimal
add
=
serviceRating
.
add
(
totalOperatingPower
);
for
(
int
a
=
0
,
avgPowerSize
=
avgPowerList
.
size
();
a
<
avgPowerSize
;
a
++)
{
DynamicQueryPlantPredictedPowerOutput
predictedPower
=
avgPowerList
.
get
(
a
);
if
(
DateUtil
.
parse
(
predictedPower
.
getHourTime
()
+
predictedPower
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
)
.
compareTo
(
startTimeOffset
)
>=
0
)
{
//判断第一口井启动时间+启动间隔时日平均光伏出力-前两口井的运行功率是否为正数
if
(
predictedPower
.
getPower
().
compareTo
(
add
)
>=
0
)
{
//确定第二口井第一次开井时间为第一口井启动时间+启动间隔
startIndex
=
a
;
break
;
default
:
//电网类型不存在
}
}
//开启事务
return
XTransactionHelper
.
begin
(
context
,
()
->
{
int
size
;
if
(
CollUtil
.
isNotEmpty
(
longPeriodList
))
{
SpaceOptimizeLongPeriodViewMapper
longPeriodViewMapper
=
context
.
getBean
(
SpaceOptimizeLongPeriodViewMapper
.
class
);
size
=
longPeriodList
.
size
();
if
(
size
>
BaseUtils
.
BATCH_SIZE
)
{
List
<
List
<
SpaceOptimizeLongPeriodView
>>
subList
=
BaseUtils
.
getSubList
(
longPeriodList
);
subList
.
forEach
(
b
->
longPeriodViewMapper
.
batchInsertList
(
b
));
}
if
(
startIndex
>
-
1
)
{
DynamicQueryPlantPredictedPowerOutput
start
=
avgPowerList
.
get
(
startIndex
);
DateTime
startTimeOptimize
=
DateUtil
.
parse
(
start
.
getHourTime
()
+
start
.
getMinTime
(),
BusinessConstant
.
TIME_FORMAT
);
//计算未优化启动间隔
int
openDuration
=
(
int
)
startTime
.
between
(
endTime
,
DateUnit
.
MINUTE
);
DateTime
endTimeOptimize
=
startTimeOptimize
.
offset
(
DateField
.
MINUTE
,
openDuration
);
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
openWellTime
,
BaseUtils
.
getEndTimeString
(
endTimeOptimize
)
);
//取时间间隔(分钟)
between
=
BaseUtils
.
getTimeDifferenceMinute
(
endTimeOptimize
,
endTime
);
}
else
{
longPeriodViewMapper
.
batchInsertList
(
longPeriodList
);
//无法优化
}
}
if
(
CollUtil
.
isNotEmpty
(
longWellheadList
))
{
SpaceOptimizeLongWellheadViewMapper
longWellheadViewMapper
=
context
.
getBean
(
SpaceOptimizeLongWellheadViewMapper
.
class
);
size
=
longWellheadList
.
size
();
if
(
size
>
BaseUtils
.
BATCH_SIZE
)
{
List
<
List
<
SpaceOptimizeLongWellheadView
>>
subList
=
BaseUtils
.
getSubList
(
longWellheadList
);
subList
.
forEach
(
b
->
longWellheadViewMapper
.
batchInsertList
(
b
));
}
else
{
longWellheadViewMapper
.
batchInsertList
(
longWellheadList
);
DateTime
offset
=
startTime
.
offset
(
DateField
.
MINUTE
,
between
);
if
(
offset
.
compareTo
(
BusinessConstant
.
DATE_FLAG
)
>
0
)
{
//如果时间超过当天,舍弃
continue
;
}
//计算偏移
this
.
createOptimizeLongDuration
(
longDurationList
,
duration
,
longPeriodId
,
recordId
,
wellheadId
,
null
,
offset
.
toString
(
BusinessConstant
.
MINUTES_FORMAT
),
BaseUtils
.
getEndTimeString
(
DateUtil
.
parse
(
duration
.
getCloseWellTime
()
+
BusinessConstant
.
INITIALIZATION_SECOND
,
BusinessConstant
.
TIME_FORMAT
)
.
offset
(
DateField
.
MINUTE
,
between
))
);
}
if
(
CollUtil
.
isNotEmpty
(
longDurationList
))
{
SpaceOptimizeLongDurationViewMapper
longDurationViewMapper
=
context
.
getBean
(
SpaceOptimizeLongDurationViewMapper
.
class
);
size
=
longDurationList
.
size
();
if
(
size
>
BaseUtils
.
BATCH_SIZE
)
{
List
<
List
<
SpaceOptimizeLongDurationView
>>
subList
=
BaseUtils
.
getSubList
(
longDurationList
);
subList
.
forEach
(
b
->
longDurationViewMapper
.
batchInsertList
(
b
));
}
else
{
longDurationViewMapper
.
batchInsertList
(
longDurationList
);
}
}
return
XServiceResult
.
OK
;
});
}
/*-----------------------------------private-----------------------------------*/
/**
* 创建长期优化信息
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment