Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-cr20g
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
Administrator
dsk-cr20g
Commits
25d65d6e
Commit
25d65d6e
authored
Oct 18, 2023
by
danfuman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'V20230915' of
http://192.168.60.201/root/dsk-operate-sys
into V20230915
parents
93cc39c9
9202bb0b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
22 deletions
+28
-22
CacheConstants.java
...src/main/java/com/dsk/common/constant/CacheConstants.java
+8
-2
JskCombineInfoService.java
.../main/java/com/dsk/jsk/service/JskCombineInfoService.java
+4
-3
EconomicServiceImpl.java
...com/dsk/jsk/service/service/impl/EconomicServiceImpl.java
+3
-3
RedisCache.java
...sk-biz-api/src/main/java/com/dsk/jsk/util/RedisCache.java
+13
-14
No files found.
dsk-common/src/main/java/com/dsk/common/constant/CacheConstants.java
View file @
25d65d6e
...
...
@@ -28,9 +28,9 @@ public interface CacheConstants {
public
static
final
String
DATA_UIPGROUPDATA
=
"data:uipGroupData"
;
/**
*
查甲方 菜单选线
*
用户 位置信息
*/
public
static
final
String
PERSONAL_LOCATION
=
"personal:location"
;
public
static
final
String
PERSONAL_LOCATION
=
"personal:location
:
"
;
/**
* 查甲方 财务数据
...
...
@@ -42,4 +42,10 @@ public interface CacheConstants {
* 全国经济大全-默认
*/
public
static
final
String
DATA_ECONOMIC
=
"data:economic"
;
/**
* 查集团户-集团统计信息
*/
public
static
final
String
DATA_COMBINE
=
"data:combine:"
;
}
dsk-module/dsk-biz-api/src/main/java/com/dsk/jsk/service/JskCombineInfoService.java
View file @
25d65d6e
...
...
@@ -11,6 +11,7 @@ import com.dsk.common.core.domain.R;
import
com.dsk.common.core.page.TableDataInfo
;
import
com.dsk.common.exception.ServiceException
;
import
com.dsk.common.utils.DskOpenApiUtil
;
import
com.dsk.common.utils.JsonUtils
;
import
com.dsk.common.utils.StringUtils
;
import
com.dsk.jsk.domain.JskCombineBidPageDto
;
import
com.dsk.jsk.domain.JskCombineCertificateDto
;
...
...
@@ -248,9 +249,9 @@ public class JskCombineInfoService {
*@date: 2023/9/12 16:05
*/
public
R
memberCount
(
JskCombineCountDto
dto
)
{
String
redisKey
=
CacheConstants
.
PERSONAL_LOCATION
+
dto
.
getCombineId
();
String
redisKey
=
CacheConstants
.
DATA_COMBINE
+
dto
.
getCombineId
();
if
(
ObjectUtil
.
isNotEmpty
(
redisKey
))
{
Map
<
String
,
Object
>
cacheMap
=
redisCache
.
getCacheObject
(
redisKey
);
Map
<
String
,
Object
>
cacheMap
=
JsonUtils
.
parseObject
(
redisCache
.
getCacheObject
(
redisKey
),
Map
.
class
);
if
(
MapUtils
.
isNotEmpty
(
cacheMap
))
{
return
R
.
ok
(
cacheMap
);
}
...
...
@@ -263,7 +264,7 @@ public class JskCombineInfoService {
Map
<
String
,
Object
>
data
=
BeanUtil
.
beanToMap
(
map
.
get
(
"data"
));
data
.
put
(
"performance"
,
businessCount
(
paramsMap
));
map
.
put
(
"data"
,
data
);
redisCache
.
setCacheObject
(
redisKey
,
data
,
24
,
TimeUnit
.
HOURS
);
redisCache
.
setCacheObject
(
redisKey
,
JsonUtils
.
toJsonString
(
data
),
24
,
TimeUnit
.
HOURS
);
}
return
BeanUtil
.
toBean
(
map
,
R
.
class
);
}
...
...
dsk-module/dsk-biz-api/src/main/java/com/dsk/jsk/service/service/impl/EconomicServiceImpl.java
View file @
25d65d6e
...
...
@@ -8,6 +8,7 @@ import com.dsk.common.core.domain.AjaxResult;
import
com.dsk.common.helper.LoginHelper
;
import
com.dsk.common.utils.DateUtils
;
import
com.dsk.common.utils.DskOpenApiUtil
;
import
com.dsk.common.utils.JsonUtils
;
import
com.dsk.jsk.domain.*
;
import
com.dsk.jsk.domain.bo.*
;
import
com.dsk.jsk.service.service.EconomicService
;
...
...
@@ -81,7 +82,7 @@ public class EconomicServiceImpl implements EconomicService {
String
redisKey
=
CacheConstants
.
PERSONAL_LOCATION
+
userId
;
if
(
ObjectUtil
.
isEmpty
(
detailsDto
.
getProvinceId
())
&&
ObjectUtil
.
isEmpty
(
detailsDto
.
getCityId
())
&&
ObjectUtil
.
isEmpty
(
detailsDto
.
getAreaId
()))
{
if
(
ObjectUtil
.
isNotEmpty
(
redisKey
))
{
Map
<
String
,
Object
>
cacheMap
=
redisCache
.
getCacheMap
(
redisKey
);
Map
<
Object
,
Object
>
cacheMap
=
JsonUtils
.
parseObject
(
redisCache
.
getCacheObject
(
redisKey
),
Map
.
class
);
if
(
MapUtils
.
isNotEmpty
(
cacheMap
))
{
return
AjaxResult
.
success
(
cacheMap
);
}
...
...
@@ -93,10 +94,9 @@ public class EconomicServiceImpl implements EconomicService {
if
(!
code
.
equals
(
HttpStatus
.
OK
.
value
()))
{
throw
new
RuntimeException
();
}
Map
data
=
MapUtils
.
getMap
(
map
,
"data"
,
null
);
if
(
ObjectUtil
.
isNotEmpty
(
detailsDto
.
getProvinceId
())
||
ObjectUtil
.
isNotEmpty
(
detailsDto
.
getCityId
())
||
ObjectUtil
.
isNotEmpty
(
detailsDto
.
getAreaId
()))
{
redisCache
.
setCache
Map
(
redisKey
,
data
);
redisCache
.
setCache
Object
(
redisKey
,
JsonUtils
.
toJsonString
(
data
)
);
}
return
BeanUtil
.
toBean
(
map
,
AjaxResult
.
class
);
}
...
...
dsk-module/dsk-biz-api/src/main/java/com/dsk/jsk/util/RedisCache.java
View file @
25d65d6e
...
...
@@ -7,10 +7,7 @@ import java.util.Map;
import
java.util.Set
;
import
java.util.concurrent.TimeUnit
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.BoundSetOperations
;
import
org.springframework.data.redis.core.HashOperations
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.ValueOperations
;
import
org.springframework.data.redis.core.*
;
import
org.springframework.stereotype.Component
;
/**
...
...
@@ -25,15 +22,18 @@ public class RedisCache
@Autowired
public
RedisTemplate
redisTemplate
;
@Autowired
public
StringRedisTemplate
stringRedisTemplate
;
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
)
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
String
value
)
{
r
edisTemplate
.
opsForValue
().
set
(
key
,
value
);
stringR
edisTemplate
.
opsForValue
().
set
(
key
,
value
);
}
/**
...
...
@@ -44,9 +44,9 @@ public class RedisCache
* @param timeout 时间
* @param timeUnit 时间颗粒度
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
Integer
timeout
,
final
TimeUnit
timeUnit
)
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
String
value
,
final
Integer
timeout
,
final
TimeUnit
timeUnit
)
{
r
edisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
timeUnit
);
stringR
edisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
timeUnit
);
}
/**
...
...
@@ -102,10 +102,9 @@ public class RedisCache
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public
<
T
>
T
getCacheObject
(
final
String
key
)
public
String
getCacheObject
(
final
String
key
)
{
ValueOperations
<
String
,
T
>
operation
=
redisTemplate
.
opsForValue
();
return
operation
.
get
(
key
);
return
stringRedisTemplate
.
opsForValue
().
get
(
key
);
}
/**
...
...
@@ -191,7 +190,7 @@ public class RedisCache
public
<
T
>
void
setCacheMap
(
final
String
key
,
final
Map
<
String
,
T
>
dataMap
)
{
if
(
dataMap
!=
null
)
{
r
edisTemplate
.
opsForHash
().
putAll
(
key
,
dataMap
);
stringR
edisTemplate
.
opsForHash
().
putAll
(
key
,
dataMap
);
}
}
...
...
@@ -201,9 +200,9 @@ public class RedisCache
* @param key
* @return
*/
public
<
T
>
Map
<
String
,
T
>
getCacheMap
(
final
String
key
)
public
<
T
>
Map
<
Object
,
Object
>
getCacheMap
(
final
String
key
)
{
return
r
edisTemplate
.
opsForHash
().
entries
(
key
);
return
stringR
edisTemplate
.
opsForHash
().
entries
(
key
);
}
/**
...
...
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