Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
smart_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
赵啸非
smart_gov_platform
Commits
7fd2781b
Commit
7fd2781b
authored
Jan 30, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加主题缓存
parent
f92de300
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
39 additions
and
17 deletions
+39
-17
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteThemeController.java
.../com/mortals/xhx/module/site/web/SiteThemeController.java
+39
-17
No files found.
base-manager/src/main/java/com/mortals/xhx/module/site/web/SiteThemeController.java
View file @
7fd2781b
package
com.mortals.xhx.module.site.web
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.mortals.framework.annotation.UnAuth
;
...
...
@@ -19,8 +20,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
com.mortals.framework.model.Context
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
com.mortals.framework.web.BaseCRUDJsonBodyMappingController
;
import
com.mortals.xhx.module.site.model.SiteThemeEntity
;
import
com.mortals.xhx.module.site.service.SiteThemeService
;
...
...
@@ -29,26 +32,28 @@ import com.mortals.framework.util.StringUtils;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
static
com
.
mortals
.
framework
.
ap
.
SysConstains
.*;
/**
*
* 主题
*
* @author zxfei
* @date 2022-11-23
*/
* 主题
*
* @author zxfei
* @date 2022-11-23
*/
@RestController
@RequestMapping
(
"site/theme"
)
public
class
SiteThemeController
extends
BaseCRUDJsonBodyMappingController
<
SiteThemeService
,
SiteThemeEntity
,
Long
>
{
public
class
SiteThemeController
extends
BaseCRUDJsonBodyMappingController
<
SiteThemeService
,
SiteThemeEntity
,
Long
>
{
@Autowired
private
ICacheService
cacheService
;
public
SiteThemeController
(){
super
.
setModuleDesc
(
"主题"
);
public
SiteThemeController
()
{
super
.
setModuleDesc
(
"主题"
);
}
@Override
...
...
@@ -64,17 +69,34 @@ public class SiteThemeController extends BaseCRUDJsonBodyMappingController<SiteT
@UnAuth
public
String
getThemeCacheBySite
(
@RequestBody
SiteThemeEntity
site
)
{
JSONObject
jsonObject
=
new
JSONObject
();
List
<
SiteThemeEntity
>
siteThemeList
=
new
ArrayList
<>();
String
busiDesc
=
"根据站点id获取当前站点主题列表"
+
this
.
getModuleDesc
();
try
{
if
(
ObjectUtils
.
isEmpty
(
site
.
getSiteId
()))
throw
new
AppException
(
"站点id不能为空!"
);
if
(
ObjectUtils
.
isEmpty
(
site
.
getUserType
()))
throw
new
AppException
(
"服务类型不能为空!"
);
String
jsonstr
=
cacheService
.
hget
(
RedisCacheKeys
.
getSiteUserTypeThemeCodeKey
()
+
site
.
getSiteId
(),
site
.
getUserType
(),
String
.
class
);
List
<
SiteThemeEntity
>
siteThemeEntities
=
JSON
.
parseObject
(
jsonstr
,
new
TypeReference
<
List
<
SiteThemeEntity
>>()
{});
if
(
ObjectUtils
.
isEmpty
(
siteThemeEntities
)){
jsonObject
.
put
(
KEY_RESULT_DATA
,
new
ArrayList
<
SiteThemeEntity
>());
}
else
{
jsonObject
.
put
(
KEY_RESULT_DATA
,
siteThemeEntities
);
if
(
ObjectUtils
.
isEmpty
(
site
.
getSiteId
()))
throw
new
AppException
(
"站点id不能为空!"
);
//if(ObjectUtils.isEmpty(site.getUserType())) throw new AppException("服务类型不能为空!");
if
(
ObjectUtils
.
isEmpty
(
site
.
getUserType
()))
{
//合并多个
for
(
int
i
=
1
;
i
<=
3
;
i
++)
{
String
jsonstr
=
cacheService
.
hget
(
RedisCacheKeys
.
getSiteUserTypeThemeCodeKey
()
+
site
.
getSiteId
(),
String
.
valueOf
(
i
),
String
.
class
);
if
(!
ObjectUtils
.
isEmpty
(
jsonstr
))
{
List
<
SiteThemeEntity
>
siteThemeEntities
=
JSON
.
parseObject
(
jsonstr
,
new
TypeReference
<
List
<
SiteThemeEntity
>>()
{
});
if
(!
ObjectUtils
.
isEmpty
(
siteThemeEntities
))
{
siteThemeList
.
addAll
(
siteThemeEntities
);
}
}
}
}
else
{
String
jsonstr
=
cacheService
.
hget
(
RedisCacheKeys
.
getSiteUserTypeThemeCodeKey
()
+
site
.
getSiteId
(),
site
.
getUserType
(),
String
.
class
);
if
(!
ObjectUtils
.
isEmpty
(
jsonstr
))
{
List
<
SiteThemeEntity
>
siteThemeEntities
=
JSON
.
parseObject
(
jsonstr
,
new
TypeReference
<
List
<
SiteThemeEntity
>>()
{
});
if
(!
ObjectUtils
.
isEmpty
(
siteThemeEntities
))
{
siteThemeList
.
addAll
(
siteThemeEntities
);
}
}
}
jsonObject
.
put
(
KEY_RESULT_DATA
,
siteThemeList
);
jsonObject
.
put
(
KEY_RESULT_CODE
,
VALUE_RESULT_SUCCESS
);
jsonObject
.
put
(
KEY_RESULT_MSG
,
"根据站点id获取当前站点主题列表成功!"
);
recordSysLog
(
request
,
busiDesc
+
" 【成功】"
);
...
...
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