Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 32d8256b
authored
Sep 08, 2023
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
1.23.0 POI列表 优化POI名称校验
1 parent
5d9de07d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
9 deletions
src/main/java/cn/com/glsx/admin/modules/controller/PoiFenceController.java
src/main/java/cn/com/glsx/admin/modules/service/PoiFenceService.java
src/test/java/cn/com/glsx/admin/modules/service/PoiFenceServiceTest.java
src/main/java/cn/com/glsx/admin/modules/controller/PoiFenceController.java
View file @
32d8256
...
...
@@ -79,12 +79,12 @@ public class PoiFenceController extends AbstractController {
@ApiOperation
(
value
=
"校验POI名称"
)
@GetMapping
(
"/checkPoiName"
)
public
R
checkPoiName
(
@RequestParam
String
poiName
)
{
PoiFence
poiFence
=
poiFenceService
.
checkPoiName
(
poiName
);
if
(
Objects
.
nonNull
(
poiFence
)
)
{
public
R
checkPoiName
(
@RequestParam
String
poiName
,
Long
id
)
{
Boolean
flag
=
poiFenceService
.
checkPoiName
(
poiName
,
id
);
if
(
!
flag
)
{
throw
new
AdminException
(
"该POI名称已存在,请重新输入!"
);
}
return
R
.
ok
();
return
R
.
ok
()
.
data
(
Boolean
.
TRUE
)
;
}
@ApiOperation
(
value
=
"增加POI地址类型"
)
...
...
src/main/java/cn/com/glsx/admin/modules/service/PoiFenceService.java
View file @
32d8256
...
...
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Objects
;
/**
* poi列表 service
...
...
@@ -96,11 +97,24 @@ public class PoiFenceService extends AbstractCommonService {
/**
* 校验POI名称
*
* @param poiName
* @param poiName poi名称
* @param id id
*/
public
PoiFence
checkPoiName
(
String
poiName
)
{
public
Boolean
checkPoiName
(
String
poiName
,
Long
id
)
{
// 通过POI名称查询是否存在POI数据
PoiFence
poiFence
=
poiFenceMapper
.
checkPoiName
(
poiName
);
return
poiFence
;
// 通过id查询是否存在
if
(
Objects
.
nonNull
(
id
))
{
PoiFence
poiFenceById
=
poiFenceMapper
.
selectByPrimaryKey
(
id
);
if
(
Objects
.
isNull
(
poiFence
)
||
(
Objects
.
nonNull
(
poiFenceById
)
&&
poiFenceById
.
getPoiName
().
equals
(
poiName
)))
{
return
Boolean
.
TRUE
;
}
}
else
{
if
(
Objects
.
isNull
(
poiFence
))
{
return
Boolean
.
TRUE
;
}
}
return
Boolean
.
FALSE
;
}
/**
...
...
src/test/java/cn/com/glsx/admin/modules/service/PoiFenceServiceTest.java
View file @
32d8256
...
...
@@ -101,8 +101,8 @@ public class PoiFenceServiceTest {
@Test
public
void
checkPoiName
()
{
PoiFence
poiFence
=
poiFenceService
.
checkPoiName
(
"POI名称"
);
System
.
out
.
println
(
"
poiFence = "
+
JSONUtil
.
toJsonStr
(
poiFence
)
);
Boolean
flag
=
poiFenceService
.
checkPoiName
(
"POI名称"
,
null
);
System
.
out
.
println
(
"
flag = "
+
flag
);
}
@Test
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment