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
13e46443
Commit
13e46443
authored
Jul 18, 2023
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.单元编号划分
parent
fa272b0a
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
49 additions
and
17 deletions
+49
-17
RailManagementServiceImpl.java
...s/deviceAsset/service/impl/RailManagementServiceImpl.java
+49
-17
No files found.
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/impl/RailManagementServiceImpl.java
View file @
13e46443
...
...
@@ -77,7 +77,51 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
// 3.1 查询上行所有里程数
List
<
RailManagement
>
allRailList
=
new
ArrayList
<>();
String
sdkId
=
"1"
;
// 上行线id
List
<
Map
<
String
,
Object
>>
lineSpecialRailList
=
this
.
getLineSpecialRail
(
sdkId
);
generationCore
(
lightRail
,
allRailList
,
sdkId
);
for
(
int
i
=
0
;
i
<
allRailList
.
size
();
i
++)
{
RailManagement
railManagement
=
allRailList
.
get
(
i
);
String
railCode
=
"钢轨[上行]"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setRailCode
(
railCode
);
String
unitCode
=
"SXXGG"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setUnitCode
(
unitCode
);
railManagement
.
setRailOrderNum
(
i
+
1
);
railManagement
.
setCreateTime
(
new
Date
());
railManagement
.
setUpdateTime
(
new
Date
());
}
this
.
saveBatch
(
allRailList
);
// 4.处理下行
allRailList
.
clear
();
String
xdkId
=
"2"
;
// 下行线id
generationCore
(
lightRail
,
allRailList
,
xdkId
);
for
(
int
i
=
0
;
i
<
allRailList
.
size
();
i
++)
{
RailManagement
railManagement
=
allRailList
.
get
(
i
);
String
railCode
=
"钢轨[下行]"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setRailCode
(
railCode
);
String
unitCode
=
"DXXGG"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setUnitCode
(
unitCode
);
railManagement
.
setRailOrderNum
(
i
+
1
);
railManagement
.
setCreateTime
(
new
Date
());
railManagement
.
setUpdateTime
(
new
Date
());
}
this
.
saveBatch
(
allRailList
);
}
/**
* 生成核心
*
* @param lightRail
* @param allRailList
* @param lineAliasId
*/
private
void
generationCore
(
LightRail
lightRail
,
List
<
RailManagement
>
allRailList
,
String
lineAliasId
)
{
List
<
Map
<
String
,
Object
>>
lineSpecialRailList
=
this
.
getLineSpecialRail
(
lineAliasId
);
BigDecimal
lineStartMileage
=
BigDecimal
.
ZERO
;
BigDecimal
endMileage
=
lightRail
.
getUpLineMileage
();
...
...
@@ -90,7 +134,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
// 3.2.1 第一次进入循环
if
(
i
==
0
)
{
if
(
currentStartMileage
.
subtract
(
lineStartMileage
).
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
lineStartMileage
,
currentStartMileage
,
sdk
Id
);
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
lineStartMileage
,
currentStartMileage
,
lineAlias
Id
);
allRailList
.
addAll
(
innerRailList
);
}
continue
;
...
...
@@ -101,7 +145,7 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
Map
<
String
,
Object
>
frontMap
=
lineSpecialRailList
.
get
(
i
-
1
);
BigDecimal
frontEndMileage
=
Convert
.
toBigDecimal
(
frontMap
.
get
(
"endMileage"
));
if
(
currentStartMileage
.
subtract
(
frontEndMileage
).
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
frontEndMileage
,
currentStartMileage
,
sdk
Id
);
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
frontEndMileage
,
currentStartMileage
,
lineAlias
Id
);
allRailList
.
addAll
(
innerRailList
);
}
...
...
@@ -109,25 +153,13 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
// 3.2.3 最后一次循环
if
(
i
==
size
-
1
)
{
if
(
endMileage
.
subtract
(
currentStartMileage
).
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
currentStartMileage
,
endMileage
,
sdk
Id
);
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
currentStartMileage
,
endMileage
,
lineAlias
Id
);
allRailList
.
addAll
(
innerRailList
);
}
}
}
for
(
int
i
=
0
;
i
<
allRailList
.
size
();
i
++)
{
RailManagement
railManagement
=
allRailList
.
get
(
i
);
String
railCode
=
"钢轨[上行]"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setRailCode
(
railCode
);
String
unitCode
=
"SXXGG"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setUnitCode
(
unitCode
);
railManagement
.
setRailOrderNum
(
i
+
1
);
railManagement
.
setCreateTime
(
new
Date
());
railManagement
.
setUpdateTime
(
new
Date
());
}
this
.
saveBatch
(
allRailList
);
}
/**
* @param startMileage
...
...
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