记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
4fa42401
Commit
4fa42401
authored
Jun 09, 2026
by
stonepy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修正json格式校验
parent
13cae844
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
49 deletions
+24
-49
SweetManualExtConfigServiceImpl.java
...e/sweet/service/impl/SweetManualExtConfigServiceImpl.java
+24
-49
No files found.
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetManualExtConfigServiceImpl.java
View file @
4fa42401
...
@@ -15,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -15,7 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Map
;
@Service
@Service
public
class
SweetManualExtConfigServiceImpl
implements
ISweetManualExtConfigService
{
public
class
SweetManualExtConfigServiceImpl
implements
ISweetManualExtConfigService
{
...
@@ -46,22 +45,18 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
...
@@ -46,22 +45,18 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
if
(
exist
==
null
)
{
if
(
exist
==
null
)
{
return
ResponseDto
.
failure
(
"手册不存在"
);
return
ResponseDto
.
failure
(
"手册不存在"
);
}
}
try
{
SweetManual
update
=
SweetManual
.
getNew
();
SweetManual
update
=
SweetManual
.
getNew
();
update
.
setFoodGuideUrl
(
nullToEmpty
(
param
.
getFoodGuideUrl
()));
update
.
setFoodGuideUrl
(
nullToEmpty
(
param
.
getFoodGuideUrl
()));
update
.
setAlbumUrl
(
nullToEmpty
(
param
.
getAlbumUrl
()));
update
.
setAlbumUrl
(
nullToEmpty
(
param
.
getAlbumUrl
()));
update
.
setLostFoundWjxId
(
nullToEmpty
(
param
.
getLostFoundWjxId
()));
update
.
setLostFoundWjxId
(
nullToEmpty
(
param
.
getLostFoundWjxId
()));
if
(
param
.
getMapGeojson
()
!=
null
)
{
if
(
param
.
getMapGeojson
()
!=
null
)
{
update
.
setMapGeojson
(
serializeGeojson
(
param
.
getMapGeojson
()));
update
.
setMapGeojson
(
serializeGeojson
(
param
.
getMapGeojson
()));
}
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
sweetManualMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetManual
.
class
)
.
eq
(
SweetManual:
:
getManualId
,
param
.
getManualId
()));
redisDataUtils
.
setManualExtConfigRedisData
(
param
.
getManualId
(),
toDto
(
exist
,
param
));
return
ResponseDto
.
success
(
true
);
}
catch
(
IllegalArgumentException
e
)
{
return
ResponseDto
.
failure
(
e
.
getMessage
());
}
}
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
sweetManualMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetManual
.
class
)
.
eq
(
SweetManual:
:
getManualId
,
param
.
getManualId
()));
redisDataUtils
.
setManualExtConfigRedisData
(
param
.
getManualId
(),
toDto
(
exist
,
param
));
return
ResponseDto
.
success
(
true
);
}
}
@Override
@Override
...
@@ -87,20 +82,16 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
...
@@ -87,20 +82,16 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
if
(
exist
==
null
)
{
if
(
exist
==
null
)
{
return
ResponseDto
.
failure
(
"手册不存在"
);
return
ResponseDto
.
failure
(
"手册不存在"
);
}
}
try
{
String
geojson
=
serializeGeojson
(
param
.
getMapGeojson
());
String
geojson
=
serializeGeojson
(
param
.
getMapGeojson
());
SweetManual
update
=
SweetManual
.
getNew
();
SweetManual
update
=
SweetManual
.
getNew
();
update
.
setMapGeojson
(
geojson
);
update
.
setMapGeojson
(
geojson
);
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
sweetManualMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetManual
.
class
)
sweetManualMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetManual
.
class
)
.
eq
(
SweetManual:
:
getManualId
,
param
.
getManualId
()));
.
eq
(
SweetManual:
:
getManualId
,
param
.
getManualId
()));
SweetManualExtConfigDto
cacheDto
=
toDto
(
exist
);
SweetManualExtConfigDto
cacheDto
=
toDto
(
exist
);
cacheDto
.
setMapGeojson
(
parseGeojson
(
geojson
));
cacheDto
.
setMapGeojson
(
parseGeojson
(
geojson
));
redisDataUtils
.
setManualExtConfigRedisData
(
param
.
getManualId
(),
cacheDto
);
redisDataUtils
.
setManualExtConfigRedisData
(
param
.
getManualId
(),
cacheDto
);
return
ResponseDto
.
success
(
true
);
return
ResponseDto
.
success
(
true
);
}
catch
(
IllegalArgumentException
e
)
{
return
ResponseDto
.
failure
(
e
.
getMessage
());
}
}
}
private
SweetManualExtConfigDto
toDto
(
SweetManual
manual
)
{
private
SweetManualExtConfigDto
toDto
(
SweetManual
manual
)
{
...
@@ -138,27 +129,11 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
...
@@ -138,27 +129,11 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
if
(
geojson
==
null
)
{
if
(
geojson
==
null
)
{
return
null
;
return
null
;
}
}
String
json
;
if
(
geojson
instanceof
String
)
{
if
(
geojson
instanceof
String
)
{
json
=
((
String
)
geojson
).
trim
();
String
json
=
((
String
)
geojson
).
trim
();
if
(
json
.
isEmpty
())
{
return
json
.
isEmpty
()
?
null
:
json
;
return
null
;
}
}
else
{
json
=
JsonUtils
.
toJson
(
geojson
);
}
validateGeojson
(
json
);
return
json
;
}
private
void
validateGeojson
(
String
json
)
{
Map
<?,
?>
map
=
JsonUtils
.
fromJson
(
json
,
Map
.
class
);
if
(
map
==
null
)
{
throw
new
IllegalArgumentException
(
"地图GeoJSON格式不正确"
);
}
if
(!
"FeatureCollection"
.
equals
(
map
.
get
(
"type"
)))
{
throw
new
IllegalArgumentException
(
"地图GeoJSON必须为FeatureCollection格式"
);
}
}
return
JsonUtils
.
toJson
(
geojson
);
}
}
private
String
nullToEmpty
(
String
value
)
{
private
String
nullToEmpty
(
String
value
)
{
...
...
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