Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
H
hzsomms
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ZTGK
hzsomms
Commits
9cdd2b7d
Commit
9cdd2b7d
authored
1 year ago
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.动静态分析代码核心业务代码提交
parent
69c00675
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
10 deletions
+83
-10
AnalysisAlgorithm.java
...es/dynamicStaticAnalysis/algorithm/AnalysisAlgorithm.java
+83
-10
No files found.
jeecg-module-system/src/main/java/org/jeecg/modules/dynamicStaticAnalysis/algorithm/AnalysisAlgorithm.java
View file @
9cdd2b7d
...
...
@@ -2,6 +2,11 @@ package org.jeecg.modules.dynamicStaticAnalysis.algorithm;
import
cn.hutool.core.convert.Convert
;
import
cn.hutool.core.convert.Converter
;
import
cn.hutool.core.util.ObjectUtil
;
import
org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspectionEquipmentItem
;
import
org.jeecg.modules.checkData.dynamicStaticGeometricData.entity.RailInspectionEquipmentItemDetail
;
import
org.jeecg.modules.checkData.dynamicStaticGeometricData.service.IRailInspectionEquipmentItemDetailService
;
import
org.jeecg.modules.checkData.dynamicStaticGeometricData.service.IRailInspectionEquipmentItemService
;
import
org.jeecg.modules.checkData.equipmentCheckData.entity.MovementCourse
;
import
org.jeecg.modules.checkData.equipmentCheckData.entity.MovementCourseInfo
;
import
org.jeecg.modules.checkData.equipmentCheckData.service.IMovementCourseInfoService
;
...
...
@@ -16,8 +21,10 @@ import org.springframework.stereotype.Service;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.TreeMap
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -35,6 +42,10 @@ public class AnalysisAlgorithm {
private
IMovementCourseInfoService
movementCourseInfoService
;
@Resource
private
IMovementCourseService
movementCourseService
;
@Resource
private
IRailInspectionEquipmentItemService
railInspectionEquipmentItemService
;
@Resource
private
IRailInspectionEquipmentItemDetailService
railInspectionEquipmentItemDetailService
;
/**
* 分析
...
...
@@ -49,9 +60,11 @@ public class AnalysisAlgorithm {
// 1.2 按公里数正序排序所有道岔,钢轨,曲线,竖曲线
List
<
Map
<
String
,
Object
>>
unitDeviceList
=
analysisAlgorithmMapper
.
getUnitDevice
(
analysisBatch
.
getLightRailId
(),
analysisBatch
.
getLineAliasId
());
Map
<
String
,
Map
<
String
,
Object
>>
unitDeviceTable
=
new
TreeMap
<>();
// 1.3 获取检查数据
for
(
AnalysisBatchCheckDataMap
checkDataMap
:
analysisBatchCheckDataMapList
)
{
// 检查数据类型 1-人工静态检查 2-轨检仪静态检查 3-轨检车检查 4-添乘仪检查
if
(
1
==
checkDataMap
.
getEkType
())
{
// 1 获取人工检查数据
...
...
@@ -67,11 +80,9 @@ public class AnalysisAlgorithm {
// 2 循环遍历检查项目比较【开始-结束】来映射关联关系
for
(
MovementCourse
checkItem
:
checkItemList
)
{
// 2.1 这里可能出现开始时间比结束时间大的情况
String
seq
=
"ASC"
;
BigDecimal
checkItemStartingMileage
=
checkItem
.
getCourseStartingMileage
();
BigDecimal
checkItemEndMileage
=
checkItem
.
getCourseEndMileage
();
if
(
checkItemStartingMileage
.
compareTo
(
checkItemEndMileage
)
>
0
)
{
seq
=
"DESC"
;
// 说明起始和结束里程颠倒了
checkItemStartingMileage
=
checkItem
.
getCourseEndMileage
();
checkItemEndMileage
=
checkItem
.
getCourseStartingMileage
();
}
...
...
@@ -85,23 +96,86 @@ public class AnalysisAlgorithm {
if
(
checkItemStartingMileage
.
compareTo
(
centerMileage
)
>
0
)
{
break
;
}
// 2.2.1 命中检查项目
if
(
checkItemStartingMileage
.
compareTo
(
centerMileage
)
<=
0
&&
checkItemEndMileage
.
compareTo
(
centerMileage
)
>
0
)
{
List
<
MovementCourseInfo
>
movementCourseInfos
=
checkItemItemDetailMap
.
get
(
checkItem
.
getId
());
Map
<
String
,
List
<
MovementCourseInfo
>>
trackCodeMap
=
movementCourseInfos
.
stream
().
collect
(
Collectors
.
groupingBy
(
MovementCourseInfo:
:
getTrackCode
));
if
(
ObjectUtil
.
isNotEmpty
(
movementCourseInfos
))
{
// 1 处理3个格子映射问题
Map
<
String
,
List
<
MovementCourseInfo
>>
trackCodeMap
=
movementCourseInfos
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
MovementCourseInfo:
:
getTrackCode
));
int
size
=
trackCodeMap
.
size
();
if
(
size
!=
0
)
{
BigDecimal
divide
=
checkItemStartingMileage
.
add
(
checkItemEndMileage
).
divide
(
new
BigDecimal
(
size
),
3
,
RoundingMode
.
HALF_UP
);
BigDecimal
averageDec
=
checkItemStartingMileage
.
add
(
checkItemEndMileage
).
divide
(
new
BigDecimal
(
size
),
3
,
RoundingMode
.
HALF_UP
);
List
<
String
>
trackCodes
=
trackCodeMap
.
keySet
().
stream
()
.
mapToInt
(
Integer:
:
valueOf
)
.
sorted
()
.
mapToObj
(
String:
:
valueOf
)
.
collect
(
Collectors
.
toList
());
BigDecimal
currentStartMileage
=
checkItemStartingMileage
;
BigDecimal
currentEndEndMileage
=
checkItemStartingMileage
.
add
(
averageDec
);
for
(
String
trackCode
:
trackCodes
)
{
// 2.命中格子
if
(
currentStartMileage
.
compareTo
(
centerMileage
)
<=
0
&&
currentEndEndMileage
.
compareTo
(
centerMileage
)
>
0
)
{
String
unitCode
=
Convert
.
toStr
(
unitDevice
.
get
(
"unitCode"
));
// 人工检查数据
List
<
MovementCourseInfo
>
labourCheck
=
trackCodeMap
.
get
(
trackCode
);
unitDevice
.
put
(
"labourCheck"
,
labourCheck
);
Map
<
String
,
Object
>
unitDeviceMap
=
unitDeviceTable
.
get
(
unitCode
);
if
(
unitDeviceMap
==
null
)
{
unitDeviceTable
.
put
(
unitCode
,
unitDevice
);
}
}
else
{
currentStartMileage
=
currentEndEndMileage
;
currentEndEndMileage
=
currentEndEndMileage
.
add
(
averageDec
);
}
}
}
}
}
}
}
else
if
(
2
==
checkDataMap
.
getEkType
())
{
// 1 获取轨检仪静态检查
List
<
RailInspectionEquipmentItem
>
checkItemList
=
railInspectionEquipmentItemService
.
lambdaQuery
()
.
eq
(
RailInspectionEquipmentItem:
:
getRailInspectionEquipmentId
,
checkDataMap
.
getEkId
())
.
list
();
List
<
RailInspectionEquipmentItemDetail
>
checkItemItemDetailList
=
railInspectionEquipmentItemDetailService
.
lambdaQuery
()
.
eq
(
RailInspectionEquipmentItemDetail:
:
getRailInspectionEquipmentId
,
checkDataMap
.
getEkId
())
.
list
();
Map
<
String
,
List
<
RailInspectionEquipmentItemDetail
>>
checkItemItemDetailMap
=
checkItemItemDetailList
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
RailInspectionEquipmentItemDetail:
:
getRailInspectionEquipmentId
));
// 2 循环遍历检查项目比较【开始-结束】来映射关联关系
for
(
RailInspectionEquipmentItem
checkItem
:
checkItemList
)
{
// 2.1 这里可能出现开始时间比结束时间大的情况
BigDecimal
checkItemStartingMileage
=
checkItem
.
getCourseStartingMileage
();
BigDecimal
checkItemEndMileage
=
checkItem
.
getCourseEndMileage
();
if
(
checkItemStartingMileage
.
compareTo
(
checkItemEndMileage
)
>
0
)
{
checkItemStartingMileage
=
checkItem
.
getCourseEndMileage
();
checkItemEndMileage
=
checkItem
.
getCourseStartingMileage
();
}
// 2.2 单元设备中心里程落在检查项目【开始-结束】这个区间视为这个区间的单元设备
for
(
Map
<
String
,
Object
>
unitDevice
:
unitDeviceList
)
{
BigDecimal
startMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"startMileage"
));
BigDecimal
endMileage
=
Convert
.
toBigDecimal
(
unitDevice
.
get
(
"endMileage"
));
BigDecimal
centerMileage
=
startMileage
.
add
(
endMileage
).
divide
(
new
BigDecimal
(
"2"
),
3
,
RoundingMode
.
HALF_UP
);
if
(
checkItemStartingMileage
.
compareTo
(
centerMileage
)
>
0
)
{
break
;
}
// 2.2.1 命中检查项目
if
(
checkItemStartingMileage
.
compareTo
(
centerMileage
)
<=
0
&&
checkItemEndMileage
.
compareTo
(
centerMileage
)
>
0
)
{
}
}
}
}
else
if
(
3
==
checkDataMap
.
getEkType
())
{
}
else
{
}
}
...
...
@@ -110,5 +184,4 @@ public class AnalysisAlgorithm {
// 2.评分
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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