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
bd08fd78
Commit
bd08fd78
authored
Oct 10, 2023
by
hkl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:1.新增区间时,不能与这条线路线别其他区间有里程交集
parent
fe791c24
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
16 deletions
+36
-16
JeecgBootException.java
...n/java/org/jeecg/common/exception/JeecgBootException.java
+16
-14
SubwaySectionServiceImpl.java
.../subwayNetwork/service/impl/SubwaySectionServiceImpl.java
+20
-2
No files found.
jeecg-boot-base-core/src/main/java/org/jeecg/common/exception/JeecgBootException.java
View file @
bd08fd78
...
@@ -5,19 +5,21 @@ package org.jeecg.common.exception;
...
@@ -5,19 +5,21 @@ package org.jeecg.common.exception;
* @author: jeecg-boot
* @author: jeecg-boot
*/
*/
public
class
JeecgBootException
extends
RuntimeException
{
public
class
JeecgBootException
extends
RuntimeException
{
private
static
final
long
serialVersionUID
=
1L
;
private
static
final
long
serialVersionUID
=
1L
;
public
JeecgBootException
(
String
message
){
public
JeecgBootException
(
String
message
)
{
super
(
message
);
super
(
message
);
}
}
public
JeecgBootException
(
Throwable
cause
)
public
static
JeecgBootException
error
(
String
message
)
{
{
return
new
JeecgBootException
(
message
);
super
(
cause
);
}
}
public
JeecgBootException
(
Throwable
cause
)
{
public
JeecgBootException
(
String
message
,
Throwable
cause
)
super
(
cause
);
{
}
super
(
message
,
cause
);
}
public
JeecgBootException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
}
}
jeecg-module-system/src/main/java/org/jeecg/modules/subwayNetwork/service/impl/SubwaySectionServiceImpl.java
View file @
bd08fd78
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
...
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
org.apache.shiro.SecurityUtils
;
import
org.apache.shiro.SecurityUtils
;
import
org.jeecg.common.api.dto.PageSearch
;
import
org.jeecg.common.api.dto.PageSearch
;
import
org.jeecg.common.exception.JeecgBootException
;
import
org.jeecg.common.system.vo.LoginUser
;
import
org.jeecg.common.system.vo.LoginUser
;
import
org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO
;
import
org.jeecg.modules.subwayNetwork.dto.SubwaySectionEditDTO
;
import
org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO
;
import
org.jeecg.modules.subwayNetwork.dto.SubwaySectionQueryDTO
;
...
@@ -38,8 +39,6 @@ import java.util.List;
...
@@ -38,8 +39,6 @@ import java.util.List;
*/
*/
@Service
@Service
public
class
SubwaySectionServiceImpl
extends
ServiceImpl
<
SubwaySectionMapper
,
SubwaySection
>
implements
ISubwaySectionService
{
public
class
SubwaySectionServiceImpl
extends
ServiceImpl
<
SubwaySectionMapper
,
SubwaySection
>
implements
ISubwaySectionService
{
@Resource
@Resource
private
LightRailMapper
lightRailMapper
;
private
LightRailMapper
lightRailMapper
;
...
@@ -55,6 +54,25 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
...
@@ -55,6 +54,25 @@ public class SubwaySectionServiceImpl extends ServiceImpl<SubwaySectionMapper, S
TrainStation
startTrainStation
=
trainStationMapper
.
selectById
(
dto
.
getStartTrainStationId
());
TrainStation
startTrainStation
=
trainStationMapper
.
selectById
(
dto
.
getStartTrainStationId
());
TrainStation
endTrainStation
=
trainStationMapper
.
selectById
(
dto
.
getEndTrainStationId
());
TrainStation
endTrainStation
=
trainStationMapper
.
selectById
(
dto
.
getEndTrainStationId
());
// 1.1 起点里程 一定要大于始点里程
if
(
startTrainStation
.
getCenterMileage
().
compareTo
(
endTrainStation
.
getCenterMileage
())
>
0
)
{
throw
JeecgBootException
.
error
(
"选中站点开始里程要小于结束里程"
);
}
// 1.2. 验证这条线路,线别区间是否有交集验证表达式: (start1 < end2) AND (end1 > start2);
SubwaySection
existOne
=
this
.
lambdaQuery
()
.
eq
(
SubwaySection:
:
getLightRailId
,
dto
.
getLightRailId
())
.
eq
(
SubwaySection:
:
getLineAliasId
,
dto
.
getLineAliasId
())
.
lt
(
SubwaySection:
:
getSectionStartingMileage
,
endTrainStation
.
getEndMileage
())
.
gt
(
SubwaySection:
:
getSectionEndMileage
,
startTrainStation
.
getCenterMileage
())
.
last
(
"limit 1"
)
.
one
();
if
(
ObjectUtil
.
isNotEmpty
(
existOne
))
{
throw
JeecgBootException
.
error
(
"和区间 "
+
existOne
.
getSectionName
()
+
"有里程交集;"
+
"你选中的站点里程范围【"
+
startTrainStation
.
getEndMileage
()
+
"~"
+
endTrainStation
.
getEndMileage
()
+
"】;"
+
"冲突区间名称:"
+
existOne
.
getSectionName
()
+
",里程范围【"
+
existOne
.
getSectionStartingMileage
()
+
"~"
+
existOne
.
getSectionEndMileage
()
+
"】"
);
}
// 2.设置区间信息
// 2.设置区间信息
SubwaySection
subwaySection
=
BeanUtil
.
copyProperties
(
dto
,
SubwaySection
.
class
);
SubwaySection
subwaySection
=
BeanUtil
.
copyProperties
(
dto
,
SubwaySection
.
class
);
...
...
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