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
a6371ce2
Commit
a6371ce2
authored
Oct 26, 2023
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.修改bug
parent
ec59cd0b
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
217 additions
and
152 deletions
+217
-152
Result.java
...se-core/src/main/java/org/jeecg/common/api/vo/Result.java
+8
-0
pom.xml
jeecg-module-system/pom.xml
+4
-4
IRailManagementService.java
...g/modules/deviceAsset/service/IRailManagementService.java
+0
-2
RailManagementServiceImpl.java
...s/deviceAsset/service/impl/RailManagementServiceImpl.java
+17
-113
LightRailController.java
...modules/subwayNetwork/controller/LightRailController.java
+1
-5
SubwaySectionController.java
...les/subwayNetwork/controller/SubwaySectionController.java
+94
-13
TrainStationController.java
...ules/subwayNetwork/controller/TrainStationController.java
+57
-4
SubwaySectionServiceImpl.java
.../subwayNetwork/service/impl/SubwaySectionServiceImpl.java
+35
-11
TrainStationServiceImpl.java
...s/subwayNetwork/service/impl/TrainStationServiceImpl.java
+1
-0
No files found.
jeecg-boot-base-core/src/main/java/org/jeecg/common/api/vo/Result.java
View file @
a6371ce2
...
...
@@ -154,6 +154,14 @@ public class Result<T> implements Serializable {
return
r
;
}
public
static
<
T
>
Result
<
T
>
batchDelete
(
String
msg
)
{
Result
<
T
>
r
=
new
Result
<
T
>();
r
.
setSuccess
(
true
);
r
.
setCode
(
207
);
r
.
setMessage
(
msg
);
return
r
;
}
public
static
<
T
>
Result
<
T
>
error
(
String
msg
)
{
return
error
(
CommonConstant
.
SC_INTERNAL_SERVER_ERROR_500
,
msg
);
}
...
...
jeecg-module-system/pom.xml
View file @
a6371ce2
...
...
@@ -74,10 +74,6 @@
<properties>
<package.environment>
hkl
</package.environment>
</properties>
<!-- 是否默认 true表示默认-->
<activation>
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
<!-- 测试环境 -->
...
...
@@ -94,6 +90,10 @@
<properties>
<package.environment>
pressure
</package.environment>
</properties>
<!-- 是否默认 true表示默认-->
<activation>
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
<!-- 生成环境环境-->
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/IRailManagementService.java
View file @
a6371ce2
...
...
@@ -24,8 +24,6 @@ public interface IRailManagementService extends IService<RailManagement> {
void
edit
(
RailManagement
railManagement
);
void
intelligentGeneration
(
String
lightRailId
);
void
intelligentGeneration
(
String
lightRailId
,
String
lineAliasId
);
/**
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/deviceAsset/service/impl/RailManagementServiceImpl.java
View file @
a6371ce2
...
...
@@ -78,97 +78,6 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
// 1.判断完整的线路有没有空白部分(指剩余区间既不是道岔、曲线、竖曲线、钢轨的部分),只需要填空白部分,空白部分一定是钢轨,按照25一根的逻辑余数自成一根;
// 2.如果不存在空白部分,则定义道岔曲线竖曲线为绝对正确里程值,并且定义为特殊钢轨,相邻两个特殊钢轨之间的里程区间按照25一根的逻辑余数自成一根。
@Override
public
void
intelligentGeneration
(
String
lightRailId
)
{
// 1.删除整条线的
this
.
lambdaUpdate
().
eq
(
RailManagement:
:
getLightRailId
,
lightRailId
).
remove
();
// 2.查询当前车站的上下行里程
LightRail
lightRail
=
lightRailMapper
.
selectById
(
lightRailId
);
// 3.处理上行
// 3.1 查询上行所有里程数
List
<
RailManagement
>
allRailList
=
new
ArrayList
<>();
String
sdkId
=
"1"
;
// 上行线id
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
.
setLightRailId
(
lightRailId
);
railManagement
.
setRailOrderNum
(
i
+
1
);
railManagement
.
setCreateBy
(
"系统生成"
);
railManagement
.
setUpdateBy
(
"系统生成"
);
}
// 3.2 计算区间
this
.
calcSection
(
lightRailId
,
sdkId
,
allRailList
);
// 4.处理下行
List
<
RailManagement
>
downRailList
=
new
ArrayList
<>();
String
xdkId
=
"2"
;
// 下行线id
generationCore
(
lightRail
,
downRailList
,
xdkId
);
for
(
int
i
=
0
;
i
<
downRailList
.
size
();
i
++)
{
RailManagement
railManagement
=
downRailList
.
get
(
i
);
String
railCode
=
"钢轨[下行]"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setRailCode
(
railCode
);
String
unitCode
=
"DXXGG"
+
UnitCodeUtil
.
supplementZero
(
4
,
i
+
1
);
railManagement
.
setUnitCode
(
unitCode
);
railManagement
.
setLightRailId
(
lightRailId
);
railManagement
.
setRailOrderNum
(
i
+
1
);
railManagement
.
setCreateBy
(
"系统生成"
);
railManagement
.
setUpdateBy
(
"系统生成"
);
}
this
.
calcSection
(
lightRailId
,
xdkId
,
downRailList
);
allRailList
.
addAll
(
downRailList
);
// 异步执行保存
asyncTask
.
getAsyncExecutor
().
execute
(()
->
{
this
.
saveBatch
(
allRailList
);
});
}
// @Override
public
void
intelligentGeneration1
(
String
lightRailId
,
String
lineAliasId
)
{
// 1.查询当前车站的上下行里程
LightRail
lightRail
=
lightRailMapper
.
selectById
(
lightRailId
);
// 2.1 查询上行所有里程数
List
<
RailManagement
>
allRailList
=
new
ArrayList
<>();
generationCore
(
lightRail
,
allRailList
,
lineAliasId
);
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
.
setLightRailId
(
lightRailId
);
railManagement
.
setRailOrderNum
(
i
+
1
);
railManagement
.
setCreateBy
(
"系统生成"
);
railManagement
.
setUpdateBy
(
"系统生成"
);
}
// 3.2 计算区间
this
.
calcSection
(
lightRailId
,
lineAliasId
,
allRailList
);
// 异步执行保存
asyncTask
.
getAsyncExecutor
().
execute
(()
->
{
this
.
saveBatch
(
allRailList
);
});
}
@Override
public
void
intelligentGeneration
(
String
lightRailId
,
String
lineAliasId
)
{
// 1.查询当前车站的上下行里程
...
...
@@ -225,14 +134,6 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
currentEndMileage
,
endMileage
,
lineAliasId
);
allRailList
.
addAll
(
innerRailList
);
}
// // ③ 线路终点里程 > 一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
// if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
// isGenerateRule2 = false;
//
// List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
// allRailList.addAll(innerRailList);
// }
}
continue
;
}
...
...
@@ -301,12 +202,6 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
List
<
RailManagement
>
innerRailList
=
this
.
generate
(
currentEndMileage
,
endMileage
,
lineAliasId
);
allRailList
.
addAll
(
innerRailList
);
}
// // ③ 线路终点里程 > 最后一个单元结束里程,要补充[最后一个单元结束里程,线路终点里程]
// if (endMileage.subtract(currentEndMileage).compareTo(BigDecimal.ZERO) > 0) {
// List<RailManagement> innerRailList = this.generate(currentEndMileage, endMileage, lineAliasId);
// allRailList.addAll(innerRailList);
// }
}
continue
;
}
...
...
@@ -534,14 +429,23 @@ public class RailManagementServiceImpl extends ServiceImpl<RailManagementMapper,
}
// 2.处理不到25米一段的钢轨
RailManagement
railManagement
=
new
RailManagement
();
railManagement
.
setId
(
UUIDGenerator
.
generate
());
railManagement
.
setLineAliasId
(
lineAliasId
);
railManagement
.
setStartingMileage
(
startMileage
);
railManagement
.
setCenterMileage
(
startMileage
.
add
(
endMileage
).
divide
(
new
BigDecimal
(
"2"
),
3
,
RoundingMode
.
HALF_UP
));
// 中心里程 = (开始里程+结束里程) / 2
railManagement
.
setEndMileage
(
endMileage
);
result
.
add
(
railManagement
);
// 2.处理不到25米一段的钢轨,如果开始里程等于结束里程也不计算
//中心里程 = (开始里程 + 结束里程) / 2
BigDecimal
centerMileage
=
startMileage
.
add
(
endMileage
).
divide
(
new
BigDecimal
(
"2"
),
3
,
RoundingMode
.
HALF_UP
);
// 开始里程 == 中心里程 == 结束里程 这是一个点
if
(
startMileage
.
compareTo
(
centerMileage
)
==
0
&&
endMileage
.
compareTo
(
centerMileage
)
==
0
)
{
// 啥也不做
}
else
{
RailManagement
railManagement
=
new
RailManagement
();
railManagement
.
setId
(
UUIDGenerator
.
generate
());
railManagement
.
setLineAliasId
(
lineAliasId
);
railManagement
.
setStartingMileage
(
startMileage
);
railManagement
.
setCenterMileage
(
centerMileage
);
railManagement
.
setEndMileage
(
endMileage
);
result
.
add
(
railManagement
);
}
return
result
;
}
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/controller/LightRailController.java
View file @
a6371ce2
...
...
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.models.auth.In
;
import
lombok.extern.slf4j.Slf4j
;
import
org.jeecg.common.api.dto.PageSearch
;
import
org.jeecg.common.api.vo.Result
;
...
...
@@ -23,7 +22,6 @@ import org.jeecg.modules.subwayNetwork.service.ITrainStationService;
import
org.jeecg.modules.subwayNetwork.vo.LightRailQueryVO
;
import
org.jeecg.modules.subwayNetwork.vo.SectionStationMapVO
;
import
org.jeecg.modules.subwayNetwork.vo.SectionStationNode
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
...
...
@@ -154,10 +152,8 @@ public class LightRailController extends JeecgController<LightRail, ILightRailSe
if
(
totalNum
-
successNum
>
0
)
{
message
=
message
+
",未删除"
+
failNum
+
"条。未删除"
+
failMessage
+
"原因是线路下面有关联车站或区间故不能被删除"
;
// throw JeecgBootException.error(message.toString());
}
return
Result
.
OK
(
message
);
return
Result
.
batchDelete
(
message
);
}
/**
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/controller/SubwaySectionController.java
View file @
a6371ce2
...
...
@@ -142,31 +142,31 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
}
if
(
switchCount
!=
0
)
{
isDel
=
true
;
errorMsg
.
append
(
"道岔单元:"
+
rail
Count
+
"个"
);
errorMsg
.
append
(
"道岔单元:"
+
switch
Count
+
"个"
);
}
if
(
curveCount
!=
0
)
{
isDel
=
true
;
errorMsg
.
append
(
"曲线单元:"
+
rail
Count
+
"个"
);
errorMsg
.
append
(
"曲线单元:"
+
curve
Count
+
"个"
);
}
if
(
verticalCurveCount
!=
0
)
{
isDel
=
true
;
errorMsg
.
append
(
"竖曲线单元:"
+
rail
Count
+
"个"
);
errorMsg
.
append
(
"竖曲线单元:"
+
verticalCurve
Count
+
"个"
);
}
if
(
trackBedCount
!=
0
)
{
isDel
=
true
;
errorMsg
.
append
(
"道床:"
+
rail
Count
+
"个"
);
errorMsg
.
append
(
"道床:"
+
trackBed
Count
+
"个"
);
}
if
(
fastenerCount
!=
0
)
{
isDel
=
true
;
errorMsg
.
append
(
"扣件:"
+
rail
Count
+
"个"
);
errorMsg
.
append
(
"扣件:"
+
fastener
Count
+
"个"
);
}
if
(
sleeperCount
!=
0
)
{
isDel
=
true
;
errorMsg
.
append
(
"轨枕:"
+
rail
Count
+
"个"
);
errorMsg
.
append
(
"轨枕:"
+
sleeper
Count
+
"个"
);
}
if
(
signBoardCount
!=
0
)
{
isDel
=
true
;
errorMsg
.
append
(
"轨行区标示牌:"
+
rail
Count
+
"个"
);
errorMsg
.
append
(
"轨行区标示牌:"
+
signBoard
Count
+
"个"
);
}
if
(
isDel
)
{
throw
JeecgBootException
.
error
(
errorMsg
.
toString
());
...
...
@@ -177,15 +177,96 @@ public class SubwaySectionController extends JeecgController<SubwaySection, ISub
@ApiOperation
(
value
=
"线路车站-地铁区间-批量删除"
,
notes
=
"线路车站-地铁区间-批量删除"
)
@GetMapping
(
value
=
"/deleteBatch"
)
public
Result
<
String
>
deleteBatch
(
@RequestParam
(
name
=
"ids"
,
required
=
true
)
String
ids
)
{
for
(
String
id
:
Arrays
.
asList
(
ids
.
split
(
","
)))
{
verifyDeleteParams
(
id
);
sectionStationMapService
.
lambdaUpdate
()
String
message
=
""
;
Integer
totalNum
=
0
;
Integer
successNum
=
0
;
Integer
failNum
=
0
;
String
failMessage
=
" "
;
List
<
SubwaySection
>
listRecords
=
this
.
service
.
lambdaQuery
()
.
in
(
SubwaySection:
:
getId
,
Arrays
.
asList
(
ids
.
split
(
","
)))
.
list
();
for
(
SubwaySection
record
:
listRecords
)
{
totalNum
++;
String
id
=
record
.
getId
();
Long
railCount
=
railManagementService
.
lambdaQuery
()
.
eq
(
RailManagement:
:
getSectionId
,
id
)
.
count
();
Long
switchCount
=
0L
;
List
<
SectionStationMap
>
sectionStationMapList
=
sectionStationMapService
.
lambdaQuery
()
.
eq
(
SectionStationMap:
:
getSectionId
,
id
)
.
remove
();
this
.
service
.
removeById
(
id
);
.
list
();
if
(
ObjectUtil
.
isNotEmpty
(
sectionStationMapList
))
{
List
<
String
>
sectionStationMapIds
=
sectionStationMapList
.
stream
()
.
map
(
SectionStationMap:
:
getId
)
.
collect
(
Collectors
.
toList
());
switchCount
=
switchManagementService
.
lambdaQuery
()
.
in
(
SwitchManagement:
:
getSectionStationMapId
,
sectionStationMapIds
)
.
count
();
}
Long
curveCount
=
curveManagementService
.
lambdaQuery
()
.
eq
(
CurveManagement:
:
getSectionId
,
id
)
.
count
();
Long
verticalCurveCount
=
verticalCurveManagementService
.
lambdaQuery
()
.
eq
(
VerticalCurveManagement:
:
getSectionId
,
id
)
.
count
();
Long
trackBedCount
=
trackBedManagementService
.
lambdaQuery
()
.
eq
(
TrackBedManagement:
:
getSectionId
,
id
)
.
count
();
Long
fastenerCount
=
fastenerManagementService
.
lambdaQuery
()
.
eq
(
FastenerManagement:
:
getSectionId
,
id
)
.
count
();
Long
sleeperCount
=
sleeperManagementService
.
lambdaQuery
()
.
eq
(
SleeperManagement:
:
getSectionId
,
id
)
.
count
();
Long
signBoardCount
=
signBoardManagementService
.
lambdaQuery
()
.
eq
(
SignBoardManagement:
:
getSectionId
,
id
)
.
count
();
boolean
isDel
=
false
;
if
(
railCount
!=
0
)
{
isDel
=
true
;
}
if
(
switchCount
!=
0
)
{
isDel
=
true
;
}
if
(
curveCount
!=
0
)
{
isDel
=
true
;
}
if
(
verticalCurveCount
!=
0
)
{
isDel
=
true
;
}
if
(
trackBedCount
!=
0
)
{
isDel
=
true
;
}
if
(
fastenerCount
!=
0
)
{
isDel
=
true
;
}
if
(
sleeperCount
!=
0
)
{
isDel
=
true
;
}
if
(
signBoardCount
!=
0
)
{
isDel
=
true
;
}
if
(
isDel
)
{
failNum
++;
failMessage
=
failMessage
+
record
.
getSectionName
()
+
" "
;
}
else
{
successNum
++;
sectionStationMapService
.
lambdaUpdate
()
.
eq
(
SectionStationMap:
:
getSectionId
,
id
)
.
remove
();
this
.
service
.
removeById
(
id
);
}
}
message
=
"选中"
+
totalNum
+
"条数据已删除数据"
+
successNum
+
"条"
;
return
Result
.
OK
(
"批量删除成功!"
);
if
(
totalNum
-
successNum
>
0
)
{
message
=
message
+
",未删除"
+
failNum
+
"条。未删除"
+
failMessage
+
"原因是线路下面有关联设备故不能被删除"
;
}
return
Result
.
batchDelete
(
message
);
}
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/controller/TrainStationController.java
View file @
a6371ce2
...
...
@@ -12,9 +12,9 @@ import org.jeecg.common.exception.JeecgBootException;
import
org.jeecg.common.system.base.controller.JeecgController
;
import
org.jeecg.modules.subwayNetwork.dto.TrainStationEditDTO
;
import
org.jeecg.modules.subwayNetwork.dto.TrainStationQueryDTO
;
import
org.jeecg.modules.subwayNetwork.entity.
LightRail
;
import
org.jeecg.modules.subwayNetwork.
entity.SectionStationMap
;
import
org.jeecg.modules.subwayNetwork.
entity.TrainStation
;
import
org.jeecg.modules.subwayNetwork.entity.
*
;
import
org.jeecg.modules.subwayNetwork.
service.ILightRailService
;
import
org.jeecg.modules.subwayNetwork.
service.ILineAliasService
;
import
org.jeecg.modules.subwayNetwork.service.ISectionStationMapService
;
import
org.jeecg.modules.subwayNetwork.service.ITrainStationService
;
import
org.jeecg.modules.subwayNetwork.vo.TrainStationVO
;
...
...
@@ -22,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.math.BigDecimal
;
import
java.util.*
;
/**
...
...
@@ -41,6 +42,12 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain
@Resource
private
ISectionStationMapService
sectionStationMapService
;
@Resource
private
ILightRailService
lightRailService
;
@Resource
private
ILineAliasService
lineAliasService
;
@AutoLog
(
value
=
"线路车站-地铁站-分页列表查询"
)
@ApiOperation
(
value
=
"线路车站-地铁站-分页列表查询"
,
notes
=
"线路车站-地铁站-分页列表查询"
)
@PostMapping
(
value
=
"/list"
)
...
...
@@ -54,6 +61,52 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain
@ApiOperation
(
value
=
"线路车站-地铁站-编辑"
,
notes
=
"线路车站-地铁站-编辑"
)
@PostMapping
(
value
=
"/edit"
)
public
Result
<
String
>
edit
(
@RequestBody
TrainStationEditDTO
dto
)
{
LightRail
lightRail
=
lightRailService
.
getById
(
dto
.
getLightRailId
());
LineAlias
lineAlias
=
lineAliasService
.
getById
(
dto
.
getLineAliasId
());
BigDecimal
lightRailEndMileage
=
lightRail
.
getUpLineMileage
();
if
(
lineAlias
.
getLineAliasName
().
contains
(
"下行"
))
{
lightRailEndMileage
=
lightRail
.
getDownLineMileage
();
}
if
(
dto
.
getEndMileage
().
compareTo
(
lightRailEndMileage
)
>
0
)
{
throw
JeecgBootException
.
error
(
"新增车站结束里程超过:"
+
lightRail
.
getRailLineName
()
+
"的"
+
lineAlias
.
getLineAliasName
()
+
"的结束里程【"
+
lightRailEndMileage
+
"】"
);
}
List
<
TrainStation
>
listRecord
=
this
.
service
.
lambdaQuery
()
.
eq
(
TrainStation:
:
getLightRailId
,
dto
.
getLightRailId
())
.
eq
(
TrainStation:
:
getLineAliasId
,
dto
.
getLineAliasId
())
.
list
();
for
(
TrainStation
record
:
listRecord
)
{
// 如果是更新,排除自己
if
(
record
.
getId
().
equals
(
dto
.
getId
()))
{
continue
;
}
BigDecimal
currentStartMileage
=
record
.
getStartingMileage
();
BigDecimal
currentEndMileage
=
record
.
getEndMileage
();
BigDecimal
startMileage
=
dto
.
getStartingMileage
();
BigDecimal
endMileage
=
dto
.
getEndMileage
();
// 判断区间是否重叠
if
(
currentStartMileage
.
compareTo
(
startMileage
)
>=
0
&&
currentEndMileage
.
compareTo
(
endMileage
)
<=
0
)
{
throw
JeecgBootException
.
error
(
"你输入的站点里程范围【"
+
dto
.
getStartingMileage
()
+
"~"
+
dto
.
getEndMileage
()
+
"】;"
+
"冲突区间名称:"
+
record
.
getStationName
()
+
",里程范围【"
+
record
.
getStartingMileage
()
+
"~"
+
record
.
getEndMileage
()
+
"】"
);
}
// 判断开始里程是否是否冲突
if
(
currentStartMileage
.
compareTo
(
startMileage
)
<
0
&&
currentEndMileage
.
compareTo
(
startMileage
)
>
0
)
{
throw
JeecgBootException
.
error
(
"你输入的站点里程范围【"
+
dto
.
getStartingMileage
()
+
"~"
+
dto
.
getEndMileage
()
+
"】;"
+
"冲突区间名称:"
+
record
.
getStationName
()
+
",里程范围【"
+
record
.
getStartingMileage
()
+
"~"
+
record
.
getEndMileage
()
+
"】"
);
}
// 判断结束里程是否是否冲突
if
(
currentStartMileage
.
compareTo
(
endMileage
)
<
0
&&
currentEndMileage
.
compareTo
(
endMileage
)
>
0
)
{
throw
JeecgBootException
.
error
(
"你输入的站点里程范围【"
+
dto
.
getStartingMileage
()
+
"~"
+
dto
.
getEndMileage
()
+
"】;"
+
"冲突区间名称:"
+
record
.
getStationName
()
+
",里程范围【"
+
record
.
getStartingMileage
()
+
"~"
+
record
.
getEndMileage
()
+
"】"
);
}
}
trainStationService
.
edit
(
dto
);
...
...
@@ -115,7 +168,7 @@ public class TrainStationController extends JeecgController<TrainStation, ITrain
// throw JeecgBootException.error(message.toString());
}
return
Result
.
OK
(
message
);
return
Result
.
batchDelete
(
message
);
}
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/service/impl/SubwaySectionServiceImpl.java
View file @
a6371ce2
...
...
@@ -11,6 +11,7 @@ import org.apache.shiro.SecurityUtils;
import
org.jeecg.common.api.dto.PageSearch
;
import
org.jeecg.common.exception.JeecgBootException
;
import
org.jeecg.common.system.vo.LoginUser
;
import
org.jeecg.modules.deviceAsset.entity.TrackBedManagement
;
import
org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO
;
import
org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO
;
import
org.jeecg.modules.subwayNetwork.entity.LightRail
;
...
...
@@ -60,19 +61,42 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
throw
JeecgBootException
.
error
(
"选中站点开始里程要小于结束里程"
);
}
// 1.2. 验证这条线路,线别区间是否有交集验证表达式: (start1 < end2) AND (end1 > start2);
SubwaySection
existOne
=
this
.
lambdaQuery
()
.
ne
(
ObjectUtil
.
isNotEmpty
(
dto
.
getId
()),
SubwaySection:
:
getId
,
dto
.
getId
())
List
<
SubwaySection
>
listRecord
=
this
.
lambdaQuery
()
.
eq
(
SubwaySection:
:
getLightRailId
,
dto
.
getLightRailId
())
.
eq
(
SubwaySection:
:
getLineAliasId
,
dto
.
getLineAliasId
())
.
le
(
SubwaySection:
:
getSectionStartingMileage
,
startTrainStation
.
getCenterMileage
())
.
ge
(
SubwaySection:
:
getSectionEndMileage
,
endTrainStation
.
getCenterMileage
())
.
last
(
"limit 1"
)
.
one
();
if
(
ObjectUtil
.
isNotEmpty
(
existOne
))
{
throw
JeecgBootException
.
error
(
"和区间 "
+
existOne
.
getSectionName
()
+
"有里程交集;"
+
"你选中的站点里程范围【"
+
startTrainStation
.
getEndMileage
()
+
"~"
+
endTrainStation
.
getEndMileage
()
+
"】;"
+
"冲突区间名称:"
+
existOne
.
getSectionName
()
+
",里程范围【"
+
existOne
.
getSectionStartingMileage
()
+
"~"
+
existOne
.
getSectionEndMileage
()
+
"】"
);
.
list
();
for
(
SubwaySection
record
:
listRecord
)
{
// 如果是更新,排除自己
if
(
record
.
getId
().
equals
(
dto
.
getId
()))
{
continue
;
}
BigDecimal
currentStartMileage
=
record
.
getSectionStartingMileage
();
BigDecimal
currentEndMileage
=
record
.
getSectionEndMileage
();
BigDecimal
startMileage
=
startTrainStation
.
getCenterMileage
();
BigDecimal
endMileage
=
endTrainStation
.
getCenterMileage
();
// 判断区间是否重叠
if
(
currentStartMileage
.
compareTo
(
startMileage
)
>=
0
&&
currentEndMileage
.
compareTo
(
endMileage
)
<=
0
)
{
throw
JeecgBootException
.
error
(
"和区间 "
+
record
.
getSectionName
()
+
"有里程交集;"
+
"你选中的站点里程范围【"
+
startTrainStation
.
getCenterMileage
()
+
"~"
+
endTrainStation
.
getCenterMileage
()
+
"】;"
+
"冲突区间名称:"
+
record
.
getSectionName
()
+
",里程范围【"
+
record
.
getSectionStartingMileage
()
+
"~"
+
record
.
getSectionEndMileage
()
+
"】"
);
}
// 判断开始里程是否是否冲突
if
(
currentStartMileage
.
compareTo
(
startMileage
)
<
0
&&
currentEndMileage
.
compareTo
(
startMileage
)
>
0
)
{
throw
JeecgBootException
.
error
(
"和区间 "
+
record
.
getSectionName
()
+
"有里程交集;"
+
"你选中的站点里程范围【"
+
startTrainStation
.
getCenterMileage
()
+
"~"
+
endTrainStation
.
getCenterMileage
()
+
"】;"
+
"冲突区间名称:"
+
record
.
getSectionName
()
+
",里程范围【"
+
record
.
getSectionStartingMileage
()
+
"~"
+
record
.
getSectionEndMileage
()
+
"】"
);
}
// 判断结束里程是否是否冲突
if
(
currentStartMileage
.
compareTo
(
endMileage
)
<
0
&&
currentEndMileage
.
compareTo
(
endMileage
)
>
0
)
{
throw
JeecgBootException
.
error
(
"和区间 "
+
record
.
getSectionName
()
+
"有里程交集;"
+
"你选中的站点里程范围【"
+
startTrainStation
.
getCenterMileage
()
+
"~"
+
endTrainStation
.
getCenterMileage
()
+
"】;"
+
"冲突区间名称:"
+
record
.
getSectionName
()
+
",里程范围【"
+
record
.
getSectionStartingMileage
()
+
"~"
+
record
.
getSectionEndMileage
()
+
"】"
);
}
}
...
...
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/service/impl/TrainStationServiceImpl.java
View file @
a6371ce2
...
...
@@ -37,6 +37,7 @@ public class TrainStationServiceImpl extends ServiceImpl<TrainStationMapper, Tra
@Override
public
void
edit
(
TrainStationEditDTO
dto
)
{
// 1.计算站长度:终点里程-起始里程
BigDecimal
length
=
dto
.
getEndMileage
().
subtract
(
dto
.
getStartingMileage
());
...
...
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