Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chuanshan_gov_platform
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
廖旭伟
chuanshan_gov_platform
Commits
32f84c63
Commit
32f84c63
authored
Mar 13, 2024
by
廖旭伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加banner配置接口
parent
c2a756a1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
110 additions
and
6 deletions
+110
-6
single-matter/src/main/java/com/mortals/xhx/base/system/param/service/ParamService.java
...m/mortals/xhx/base/system/param/service/ParamService.java
+1
-0
single-matter/src/main/java/com/mortals/xhx/base/system/param/service/impl/ParamServiceImpl.java
.../xhx/base/system/param/service/impl/ParamServiceImpl.java
+7
-0
single-matter/src/main/java/com/mortals/xhx/base/system/param/web/ParamController.java
...om/mortals/xhx/base/system/param/web/ParamController.java
+61
-6
single-matter/src/main/java/com/mortals/xhx/common/key/ParamKey.java
...er/src/main/java/com/mortals/xhx/common/key/ParamKey.java
+3
-0
single-matter/src/main/java/com/mortals/xhx/common/pdu/BannerPdu.java
...r/src/main/java/com/mortals/xhx/common/pdu/BannerPdu.java
+38
-0
No files found.
single-matter/src/main/java/com/mortals/xhx/base/system/param/service/ParamService.java
View file @
32f84c63
...
...
@@ -44,4 +44,5 @@ public interface ParamService extends ICRUDCacheService<ParamEntity, Long>, IPar
*/
Map
<
String
,
String
>
getParamBySecondOrganize
(
String
firstOrganize
,
String
secondOrganize
,
String
...
excludeParamKeys
);
Long
getIdByKey
(
String
key
);
}
\ No newline at end of file
single-matter/src/main/java/com/mortals/xhx/base/system/param/service/impl/ParamServiceImpl.java
View file @
32f84c63
...
...
@@ -194,4 +194,11 @@ public class ParamServiceImpl extends AbstractCRUDCacheServiceImpl<ParamDao, Par
}
}
@Override
public
Long
getIdByKey
(
String
key
)
{
List
<
ParamEntity
>
list
=
this
.
getCacheList
();
Map
<
String
,
Long
>
keyValueMap
=
list
.
parallelStream
().
collect
(
Collectors
.
toMap
(
x
->
x
.
getParamKey
(),
y
->
y
.
getId
(),
(
o
,
n
)
->
n
));
return
keyValueMap
.
get
(
key
);
}
}
\ No newline at end of file
single-matter/src/main/java/com/mortals/xhx/base/system/param/web/ParamController.java
View file @
32f84c63
...
...
@@ -3,15 +3,16 @@ package com.mortals.xhx.base.system.param.web;
import
com.alibaba.fastjson.JSONObject
;
import
com.mortals.framework.annotation.RepeatSubmit
;
import
com.mortals.framework.annotation.UnAuth
;
import
com.mortals.framework.common.code.PageDisplayType
;
import
com.mortals.framework.model.Context
;
import
com.mortals.framework.util.FileUtil
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.common.pdu.BannerPdu
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.web.BaseCRUDJsonMappingController
;
import
com.mortals.xhx.base.system.param.model.ParamEntity
;
...
...
@@ -21,8 +22,9 @@ import com.mortals.xhx.common.code.ModStatusEnum;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
import
static
com
.
mortals
.
xhx
.
common
.
key
.
ParamKey
.
SYS_PARAM_BANNER
;
/**
* 参数信息
...
...
@@ -49,7 +51,6 @@ public class ParamController extends BaseCRUDJsonBodyMappingController<ParamServ
model
.
put
(
KEY_RESULT_DICT
,
status
);
}
private
Map
<
String
,
Object
>
getPageDisplayType
()
{
PageDisplayType
[]
pageDisplayTypes
=
PageDisplayType
.
values
();
Map
<
String
,
Object
>
result
=
new
HashMap
<>(
pageDisplayTypes
.
length
);
...
...
@@ -59,6 +60,60 @@ public class ParamController extends BaseCRUDJsonBodyMappingController<ParamServ
return
result
;
}
@GetMapping
(
"banner/info"
)
@UnAuth
public
String
getBannerInfo
()
{
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
"获取banner配置"
;
try
{
String
value
=
this
.
service
.
getValueByKey
(
SYS_PARAM_BANNER
);
if
(
ObjectUtils
.
isEmpty
(
value
))
{
BannerPdu
pdu
=
new
BannerPdu
();
jsonObject
.
put
(
KEY_RESULT_DATA
,
pdu
);
}
else
{
BannerPdu
pdu
=
JSONObject
.
parseObject
(
value
,
BannerPdu
.
class
);
jsonObject
.
put
(
KEY_RESULT_DATA
,
pdu
);
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
busiDesc
+
"成功!"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取异常"
,
e
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
}
return
jsonObject
.
toJSONString
();
}
@PostMapping
(
"banner/save"
)
@UnAuth
public
String
saveBannerInfo
(
@RequestBody
BannerPdu
pdu
)
{
JSONObject
jsonObject
=
new
JSONObject
();
String
busiDesc
=
"修改banner配置"
;
try
{
ParamEntity
entity
=
new
ParamEntity
();
entity
.
setParamKey
(
SYS_PARAM_BANNER
);
entity
.
setParamValue
(
JSONObject
.
toJSONString
(
pdu
));
Long
id
=
this
.
service
.
getIdByKey
(
SYS_PARAM_BANNER
);
if
(
id
==
null
){
entity
.
setCreateTime
(
new
Date
());
this
.
service
.
save
(
entity
);
}
else
{
entity
.
setId
(
id
);
entity
.
setUpdateTime
(
new
Date
());
this
.
service
.
update
(
entity
);
}
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
busiDesc
+
"成功!"
);
}
catch
(
Exception
e
)
{
log
.
error
(
"获取异常"
,
e
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_FAILURE
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
super
.
convertException
(
e
));
}
return
jsonObject
.
toJSONString
();
}
public
static
void
main
(
String
[]
args
)
{
FileUtil
.
delete
(
"E:\\pic\\1.png"
);
}
...
...
single-matter/src/main/java/com/mortals/xhx/common/key/ParamKey.java
View file @
32f84c63
...
...
@@ -12,4 +12,7 @@ public class ParamKey {
/** 物料编码长度,默认6 */
public
static
final
String
MATERIA_CODE_LENGTH
=
"iot:base:param:materia:length"
;
/** banner图配置 */
public
static
String
SYS_PARAM_BANNER
=
"banner"
;
}
single-matter/src/main/java/com/mortals/xhx/common/pdu/BannerPdu.java
0 → 100644
View file @
32f84c63
package
com.mortals.xhx.common.pdu
;
import
lombok.Data
;
import
java.util.ArrayList
;
import
java.util.List
;
@Data
public
class
BannerPdu
{
private
List
<
BannerInfo
>
bannerInfo
;
public
BannerPdu
()
{
bannerInfo
=
new
ArrayList
<>();
BannerInfo
info
=
new
BannerInfo
();
bannerInfo
.
add
(
info
);
}
}
class
BannerInfo
{
private
String
fileName
=
"bannerName"
;
private
String
filePath
=
"bannerUrl"
;
public
String
getFileName
()
{
return
fileName
;
}
public
void
setFileName
(
String
fileName
)
{
this
.
fileName
=
fileName
;
}
public
String
getFilePath
()
{
return
filePath
;
}
public
void
setFilePath
(
String
filePath
)
{
this
.
filePath
=
filePath
;
}
}
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