记得上下班打卡 | 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
13cae844
Commit
13cae844
authored
Jun 09, 2026
by
stonepy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
宣传手册修改geojson的保存方式
parent
7043e74a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
148 additions
and
78 deletions
+148
-78
SweetManualExtConfigParam.java
...uidnet/service/sweet/param/SweetManualExtConfigParam.java
+2
-2
SweetManualMapGeojsonParam.java
...idnet/service/sweet/param/SweetManualMapGeojsonParam.java
+18
-0
ISweetManualExtConfigService.java
...t/service/sweet/service/ISweetManualExtConfigService.java
+4
-2
SweetManualExtConfigDto.java
.../liquidnet/service/sweet/dto/SweetManualExtConfigDto.java
+2
-2
SweetManual.java
.../java/com/liquidnet/service/sweet/entity/SweetManual.java
+2
-2
db_20250608_manual_ext_config.sql
...dnet-service-sweet/docu/db_20250608_manual_ext_config.sql
+1
-1
db_20250609_manual_geojson_json.sql
...et-service-sweet/docu/db_20250609_manual_geojson_json.sql
+5
-0
SweetManualExtConfigController.java
...vice/sweet/controller/SweetManualExtConfigController.java
+14
-5
SweetManualExtConfigServiceImpl.java
...e/sweet/service/impl/SweetManualExtConfigServiceImpl.java
+90
-63
RedisDataUtils.java
...ava/com/liquidnet/service/sweet/utils/RedisDataUtils.java
+10
-1
No files found.
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/param/SweetManualExtConfigParam.java
View file @
13cae844
...
...
@@ -22,6 +22,6 @@ public class SweetManualExtConfigParam implements Serializable {
@ApiModelProperty
(
"失物招领问卷星ID"
)
private
String
lostFoundWjxId
;
@ApiModelProperty
(
"地图GeoJSON
文件地址
"
)
private
String
mapGeojsonUrl
;
@ApiModelProperty
(
"地图GeoJSON
数据
"
)
private
Object
mapGeojson
;
}
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/param/SweetManualMapGeojsonParam.java
0 → 100644
View file @
13cae844
package
com
.
liquidnet
.
service
.
sweet
.
param
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
@ApiModel
(
"手册地图GeoJSON保存参数"
)
public
class
SweetManualMapGeojsonParam
implements
Serializable
{
@ApiModelProperty
(
value
=
"电子手册id"
,
required
=
true
)
private
String
manualId
;
@ApiModelProperty
(
value
=
"地图GeoJSON数据"
,
required
=
true
)
private
Object
mapGeojson
;
}
liquidnet-bus-api/liquidnet-service-sweet-api/src/main/java/com/liquidnet/service/sweet/service/ISweetManualExtConfigService.java
View file @
13cae844
...
...
@@ -3,7 +3,7 @@ package com.liquidnet.service.sweet.service;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.sweet.dto.SweetManualExtConfigDto
;
import
com.liquidnet.service.sweet.param.SweetManualExtConfigParam
;
import
org.springframework.web.multipart.MultipartFile
;
import
com.liquidnet.service.sweet.param.SweetManualMapGeojsonParam
;
public
interface
ISweetManualExtConfigService
{
...
...
@@ -11,5 +11,7 @@ public interface ISweetManualExtConfigService {
ResponseDto
<
Boolean
>
save
(
SweetManualExtConfigParam
param
);
ResponseDto
<
String
>
uploadGeojson
(
MultipartFile
file
);
ResponseDto
<
Object
>
getMapGeojson
(
String
manualId
);
ResponseDto
<
Boolean
>
saveMapGeojson
(
SweetManualMapGeojsonParam
param
);
}
liquidnet-bus-do/liquidnet-service-sweet-do/src/main/java/com/liquidnet/service/sweet/dto/SweetManualExtConfigDto.java
View file @
13cae844
...
...
@@ -22,6 +22,6 @@ public class SweetManualExtConfigDto implements Serializable {
@ApiModelProperty
(
"失物招领问卷星ID"
)
private
String
lostFoundWjxId
;
@ApiModelProperty
(
"地图GeoJSON
文件地址
"
)
private
String
mapGeojsonUrl
;
@ApiModelProperty
(
"地图GeoJSON
数据
"
)
private
Object
mapGeojson
;
}
liquidnet-bus-do/liquidnet-service-sweet-do/src/main/java/com/liquidnet/service/sweet/entity/SweetManual.java
View file @
13cae844
...
...
@@ -66,9 +66,9 @@ public class SweetManual implements Serializable,Cloneable {
private
String
lostFoundWjxId
;
/**
* 地图GeoJSON
文件地址
* 地图GeoJSON
数据
*/
private
String
mapGeojson
Url
;
private
String
mapGeojson
;
/**
* 创建时间
...
...
liquidnet-bus-service/liquidnet-service-sweet/docu/db_20250608_manual_ext_config.sql
View file @
13cae844
...
...
@@ -4,4 +4,4 @@ ALTER TABLE `sweet_manual`
ADD
COLUMN
`food_guide_url`
varchar
(
500
)
NOT
NULL
DEFAULT
''
COMMENT
'餐饮攻略链接'
AFTER
`is_release_manual`
,
ADD
COLUMN
`album_url`
varchar
(
500
)
NOT
NULL
DEFAULT
''
COMMENT
'相册链接'
AFTER
`food_guide_url`
,
ADD
COLUMN
`lost_found_wjx_id`
varchar
(
200
)
NOT
NULL
DEFAULT
''
COMMENT
'失物招领问卷星ID'
AFTER
`album_url`
,
ADD
COLUMN
`map_geojson
_url`
varchar
(
500
)
NOT
NULL
DEFAULT
''
COMMENT
'地图GeoJSON文件地址
'
AFTER
`lost_found_wjx_id`
;
ADD
COLUMN
`map_geojson
`
longtext
NULL
COMMENT
'地图GeoJSON数据
'
AFTER
`lost_found_wjx_id`
;
liquidnet-bus-service/liquidnet-service-sweet/docu/db_20250609_manual_geojson_json.sql
0 → 100644
View file @
13cae844
use
ln_scene
;
-- 地图GeoJSON由文件地址改为直接存储JSON数据
ALTER
TABLE
`sweet_manual`
CHANGE
COLUMN
`map_geojson_url`
`map_geojson`
longtext
NULL
COMMENT
'地图GeoJSON数据'
;
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/controller/SweetManualExtConfigController.java
View file @
13cae844
...
...
@@ -3,6 +3,7 @@ package com.liquidnet.service.sweet.controller;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.sweet.dto.SweetManualExtConfigDto
;
import
com.liquidnet.service.sweet.param.SweetManualExtConfigParam
;
import
com.liquidnet.service.sweet.param.SweetManualMapGeojsonParam
;
import
com.liquidnet.service.sweet.service.ISweetManualExtConfigService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
...
...
@@ -10,7 +11,6 @@ import io.swagger.annotations.ApiImplicitParams;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
@Api
(
tags
=
"草莓音乐节手册扩展配置"
)
@RestController
...
...
@@ -35,9 +35,18 @@ public class SweetManualExtConfigController {
return
sweetManualExtConfigService
.
save
(
param
);
}
@PostMapping
(
"uploadGeojson"
)
@ApiOperation
(
"上传地图GeoJSON文件"
)
public
ResponseDto
<
String
>
uploadGeojson
(
@RequestPart
(
"file"
)
MultipartFile
file
)
{
return
sweetManualExtConfigService
.
uploadGeojson
(
file
);
@GetMapping
(
"mapGeojson"
)
@ApiOperation
(
"获取地图GeoJSON数据"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
type
=
"query"
,
dataType
=
"String"
,
name
=
"manualId"
,
value
=
"电子手册id"
,
required
=
true
),
})
public
ResponseDto
<
Object
>
getMapGeojson
(
@RequestParam
String
manualId
)
{
return
sweetManualExtConfigService
.
getMapGeojson
(
manualId
);
}
@PostMapping
(
"saveMapGeojson"
)
@ApiOperation
(
"保存地图GeoJSON数据"
)
public
ResponseDto
<
Boolean
>
saveMapGeojson
(
@RequestBody
SweetManualMapGeojsonParam
param
)
{
return
sweetManualExtConfigService
.
saveMapGeojson
(
param
);
}
}
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/service/impl/SweetManualExtConfigServiceImpl.java
View file @
13cae844
package
com
.
liquidnet
.
service
.
sweet
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.kylin.dto.vo.basicServices.UploadVo
;
import
com.liquidnet.service.sweet.dto.SweetManualExtConfigDto
;
import
com.liquidnet.service.sweet.entity.SweetManual
;
import
com.liquidnet.service.sweet.mapper.SweetManualMapper
;
import
com.liquidnet.service.sweet.param.SweetManualExtConfigParam
;
import
com.liquidnet.service.sweet.param.SweetManualMapGeojsonParam
;
import
com.liquidnet.service.sweet.service.ISweetManualExtConfigService
;
import
com.liquidnet.service.sweet.utils.RedisDataUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.ByteArrayResource
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.LinkedMultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.time.LocalDateTime
;
import
java.util.Map
;
@Service
public
class
SweetManualExtConfigServiceImpl
implements
ISweetManualExtConfigService
{
private
static
final
String
GEOJSON_IMG_PREFIX
=
"https://img.zhengzai.tv/"
;
@Value
(
"${liquidnet.service.platform.url}"
)
private
String
platformUrl
;
@Autowired
private
SweetManualMapper
sweetManualMapper
;
...
...
@@ -61,56 +46,60 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
if
(
exist
==
null
)
{
return
ResponseDto
.
failure
(
"手册不存在"
);
}
try
{
SweetManual
update
=
SweetManual
.
getNew
();
update
.
setFoodGuideUrl
(
nullToEmpty
(
param
.
getFoodGuideUrl
()));
update
.
setAlbumUrl
(
nullToEmpty
(
param
.
getAlbumUrl
()));
update
.
setLostFoundWjxId
(
nullToEmpty
(
param
.
getLostFoundWjxId
()));
update
.
setMapGeojsonUrl
(
nullToEmpty
(
param
.
getMapGeojsonUrl
()));
if
(
param
.
getMapGeojson
()
!=
null
)
{
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
());
}
}
@Override
public
ResponseDto
<
String
>
uploadGeojson
(
MultipartFile
file
)
{
if
(
file
==
null
||
file
.
isEmpty
())
{
return
ResponseDto
.
failure
(
"文件不能为空"
);
public
ResponseDto
<
Object
>
getMapGeojson
(
String
manualId
)
{
SweetManual
manual
=
sweetManualMapper
.
selectOne
(
Wrappers
.
lambdaQuery
(
SweetManual
.
class
).
eq
(
SweetManual:
:
getManualId
,
manualId
));
if
(
manual
==
null
)
{
return
ResponseDto
.
failure
(
"手册不存在"
);
}
String
filename
=
file
.
getOriginalFilename
();
if
(
StringUtil
.
isBlank
(
filename
)
||
(!
filename
.
toLowerCase
().
endsWith
(
".geojson"
)
&&
!
filename
.
toLowerCase
().
endsWith
(
".json"
)))
{
return
ResponseDto
.
failure
(
"仅支持上传.geojson或.json文件"
);
return
ResponseDto
.
success
(
parseGeojson
(
manual
.
getMapGeojson
()));
}
try
{
RestTemplate
restTemplate
=
new
RestTemplate
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
MULTIPART_FORM_DATA
);
ByteArrayResource
fileResource
=
new
ByteArrayResource
(
file
.
getBytes
())
{
@Override
public
String
getFilename
()
{
return
filename
;
public
ResponseDto
<
Boolean
>
saveMapGeojson
(
SweetManualMapGeojsonParam
param
)
{
if
(
StringUtil
.
isBlank
(
param
.
getManualId
()))
{
return
ResponseDto
.
failure
(
"手册id不能为空"
);
}
};
MultiValueMap
<
String
,
Object
>
body
=
new
LinkedMultiValueMap
<>();
body
.
add
(
"file"
,
fileResource
);
body
.
add
(
"pathName"
,
"sweet/manual/geojson"
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
requestEntity
=
new
HttpEntity
<>(
body
,
headers
);
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
platformUrl
.
concat
(
"/platform/basicServices/alOss/upload"
),
requestEntity
,
String
.
class
);
ResponseDto
<
UploadVo
>
dto
=
JsonUtils
.
fromJson
(
response
.
getBody
(),
new
TypeReference
<
ResponseDto
<
UploadVo
>>()
{
});
if
(
dto
==
null
||
dto
.
getData
()
==
null
||
StringUtil
.
isBlank
(
dto
.
getData
().
getOssPath
()))
{
return
ResponseDto
.
failure
(
"文件上传失败"
);
if
(
param
.
getMapGeojson
()
==
null
)
{
return
ResponseDto
.
failure
(
"地图GeoJSON数据不能为空"
);
}
return
ResponseDto
.
success
(
GEOJSON_IMG_PREFIX
.
concat
(
dto
.
getData
().
getOssPath
()));
}
catch
(
Exception
e
)
{
return
ResponseDto
.
failure
(
"文件上传失败"
);
SweetManual
exist
=
sweetManualMapper
.
selectOne
(
Wrappers
.
lambdaQuery
(
SweetManual
.
class
).
eq
(
SweetManual:
:
getManualId
,
param
.
getManualId
()));
if
(
exist
==
null
)
{
return
ResponseDto
.
failure
(
"手册不存在"
);
}
try
{
String
geojson
=
serializeGeojson
(
param
.
getMapGeojson
());
SweetManual
update
=
SweetManual
.
getNew
();
update
.
setMapGeojson
(
geojson
);
update
.
setUpdatedAt
(
LocalDateTime
.
now
());
sweetManualMapper
.
update
(
update
,
Wrappers
.
lambdaUpdate
(
SweetManual
.
class
)
.
eq
(
SweetManual:
:
getManualId
,
param
.
getManualId
()));
SweetManualExtConfigDto
cacheDto
=
toDto
(
exist
);
cacheDto
.
setMapGeojson
(
parseGeojson
(
geojson
));
redisDataUtils
.
setManualExtConfigRedisData
(
param
.
getManualId
(),
cacheDto
);
return
ResponseDto
.
success
(
true
);
}
catch
(
IllegalArgumentException
e
)
{
return
ResponseDto
.
failure
(
e
.
getMessage
());
}
}
...
...
@@ -120,7 +109,7 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
dto
.
setFoodGuideUrl
(
manual
.
getFoodGuideUrl
());
dto
.
setAlbumUrl
(
manual
.
getAlbumUrl
());
dto
.
setLostFoundWjxId
(
manual
.
getLostFoundWjxId
());
dto
.
setMapGeojson
Url
(
manual
.
getMapGeojsonUrl
(
));
dto
.
setMapGeojson
(
parseGeojson
(
manual
.
getMapGeojson
()
));
return
dto
;
}
...
...
@@ -130,10 +119,48 @@ public class SweetManualExtConfigServiceImpl implements ISweetManualExtConfigSer
dto
.
setFoodGuideUrl
(
nullToEmpty
(
param
.
getFoodGuideUrl
()));
dto
.
setAlbumUrl
(
nullToEmpty
(
param
.
getAlbumUrl
()));
dto
.
setLostFoundWjxId
(
nullToEmpty
(
param
.
getLostFoundWjxId
()));
dto
.
setMapGeojsonUrl
(
nullToEmpty
(
param
.
getMapGeojsonUrl
()));
if
(
param
.
getMapGeojson
()
!=
null
)
{
dto
.
setMapGeojson
(
param
.
getMapGeojson
());
}
else
{
dto
.
setMapGeojson
(
parseGeojson
(
exist
.
getMapGeojson
()));
}
return
dto
;
}
private
Object
parseGeojson
(
String
geojson
)
{
if
(
StringUtil
.
isBlank
(
geojson
))
{
return
null
;
}
return
JsonUtils
.
fromJson
(
geojson
,
Object
.
class
);
}
private
String
serializeGeojson
(
Object
geojson
)
{
if
(
geojson
==
null
)
{
return
null
;
}
String
json
;
if
(
geojson
instanceof
String
)
{
json
=
((
String
)
geojson
).
trim
();
if
(
json
.
isEmpty
())
{
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格式"
);
}
}
private
String
nullToEmpty
(
String
value
)
{
return
value
==
null
?
""
:
value
;
}
...
...
liquidnet-bus-service/liquidnet-service-sweet/src/main/java/com/liquidnet/service/sweet/utils/RedisDataUtils.java
View file @
13cae844
...
...
@@ -7,7 +7,9 @@ import com.liquidnet.common.cache.redis.util.RedisUtil;
import
com.liquidnet.commons.lang.util.CollectionUtil
;
import
com.liquidnet.commons.lang.util.DateUtil
;
import
com.liquidnet.commons.lang.util.IDGenerator
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.RandomUtil
;
import
com.liquidnet.commons.lang.util.StringUtil
;
import
com.liquidnet.service.base.SqlMapping
;
import
com.liquidnet.service.base.constant.MQConst
;
import
com.liquidnet.service.base.constant.RedisKeyExpireConst
;
...
...
@@ -193,7 +195,7 @@ public class RedisDataUtils {
configDto
.
setFoodGuideUrl
(
manual
.
getFoodGuideUrl
());
configDto
.
setAlbumUrl
(
manual
.
getAlbumUrl
());
configDto
.
setLostFoundWjxId
(
manual
.
getLostFoundWjxId
());
configDto
.
setMapGeojson
Url
(
manual
.
getMapGeojsonUrl
(
));
configDto
.
setMapGeojson
(
parseManualMapGeojson
(
manual
.
getMapGeojson
()
));
}
}
redisUtil
.
set
(
redisKey
,
configDto
);
...
...
@@ -213,6 +215,13 @@ public class RedisDataUtils {
redisUtil
.
del
(
SweetConstant
.
REDIS_KEY_SWEET_MANUAL_EXT_CONFIG
.
concat
(
manualId
));
}
private
Object
parseManualMapGeojson
(
String
geojson
)
{
if
(
StringUtil
.
isBlank
(
geojson
))
{
return
null
;
}
return
JsonUtils
.
fromJson
(
geojson
,
Object
.
class
);
}
public
List
<
String
>
setTagRedisData
(
String
manualId
)
{
String
redisKey
=
SweetConstant
.
REDIS_KEY_SWEET_MANUAL_SORT
.
concat
(
manualId
);
SweetManualSort
data
=
sweetManualSortMapper
.
selectOne
(
Wrappers
.
lambdaQuery
(
SweetManualSort
.
class
).
eq
(
SweetManualSort:
:
getManualId
,
manualId
));
...
...
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