Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
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
项目统一框架
amos-boot-biz
Commits
b73413d2
Commit
b73413d2
authored
Jun 22, 2021
by
tangwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加字典缓存
parent
bbf58d98
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
8 deletions
+34
-8
RedisKey.java
...java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
+17
-0
AlertFormController.java
...s/boot/module/jcs/biz/controller/AlertFormController.java
+4
-3
DataDictionaryController.java
...t/module/jcs/biz/controller/DataDictionaryController.java
+13
-5
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/utils/RedisKey.java
0 → 100644
View file @
b73413d2
package
com
.
yeejoin
.
amos
.
boot
.
biz
.
common
.
utils
;
/**
* @description:
* @author: tw
* @createDate: 2021/6/22
* redis key
*/
public
class
RedisKey
{
//动态表单
public
static
final
String
FORM
=
"form_"
;
//数据字典
public
static
final
String
DATADICTIONARY
=
"dataDictionary_"
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/AlertFormController.java
View file @
b73413d2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
...
...
@@ -112,8 +113,8 @@ public class AlertFormController extends BaseController {
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"根据表态类型code查询表单数据项"
,
notes
=
"根据表态类型code查询表单数据项"
)
public
ResponseModel
selectFormdItem
(
HttpServletRequest
request
,
@PathVariable
String
code
){
List
<
AlertFormVo
>
list
=
new
ArrayList
<
AlertFormVo
>();
if
(
redisUtils
.
hasKey
(
"form_"
+
code
)){
Object
obj
=
redisUtils
.
get
(
"form_"
+
code
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
FORM
+
code
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
FORM
+
code
);
return
CommonResponseUtil
.
success
(
obj
);
}
else
{
QueryWrapper
queryWrapper
=
new
QueryWrapper
<>();
...
...
@@ -121,7 +122,7 @@ public class AlertFormController extends BaseController {
//警情动态表单数据
List
<
AlertForm
>
alertFormValue
=
iAlertFormService
.
list
(
queryWrapper
);
list
=
FormList
.
getFormlist
(
alertFormValue
);
redisUtils
.
set
(
"form_"
+
code
,
JSON
.
toJSON
(
list
),
86400
);
redisUtils
.
set
(
RedisKey
.
FORM
+
code
,
JSON
.
toJSON
(
list
),
86400
);
return
CommonResponseUtil
.
success
(
list
);
}
}
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/DataDictionaryController.java
View file @
b73413d2
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.yeejoin.amos.boot.biz.common.utils.*
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.AlertForm
;
import
com.yeejoin.amos.boot.module.jcs.api.vo.FormList
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.Api
;
...
...
@@ -15,10 +19,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import
org.springframework.web.bind.annotation.*
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.utils.CommonResponseUtil
;
import
com.yeejoin.amos.boot.biz.common.utils.Menu
;
import
com.yeejoin.amos.boot.biz.common.utils.NameUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.TreeParser
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
...
@@ -43,7 +43,8 @@ public class DataDictionaryController extends BaseController {
@Autowired
IDataDictionaryService
iDataDictionaryService
;
@Autowired
RedisUtils
redisUtils
;
/**
* 新增数据字典
* @return
...
...
@@ -152,9 +153,16 @@ public class DataDictionaryController extends BaseController {
QueryWrapper
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"type"
,
type
);
queryWrapper
.
orderByAsc
(
"sort_num"
);
if
(
redisUtils
.
hasKey
(
RedisKey
.
DATADICTIONARY
+
type
)){
Object
obj
=
redisUtils
.
get
(
RedisKey
.
DATADICTIONARY
+
type
);
return
CommonResponseUtil
.
success
(
obj
);
}
else
{
Collection
<
DataDictionary
>
list
=
iDataDictionaryService
.
list
(
queryWrapper
);
List
<
Menu
>
menus
=
TreeParser
.
getTree
(
null
,
list
,
DataDictionary
.
class
.
getName
(),
"getCode"
,
0
,
"getName"
,
"getParent"
);
redisUtils
.
set
(
RedisKey
.
DATADICTIONARY
+
type
,
JSON
.
toJSON
(
menus
),
86400
);
return
CommonResponseUtil
.
success
(
menus
);
}
}
}
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