Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
long-tern-care-service
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
hubin
long-tern-care-service
Commits
80e4e8bb
Commit
80e4e8bb
authored
Mar 13, 2023
by
zhangwanglin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev_ch_master' into dev_nursing_records_20230214
parents
389ffd87
055cf33a
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
289 additions
and
18 deletions
+289
-18
DisableController.java
...n/java/com/hungraim/ltc/controller/DisableController.java
+1
-1
TaskController.java
...main/java/com/hungraim/ltc/controller/TaskController.java
+4
-2
TaskServiceImpl.java
...n/java/com/hungraim/ltc/service/impl/TaskServiceImpl.java
+5
-2
ChDisableEvaluateMapper.xml
...ice/src/main/resources/mapper/ChDisableEvaluateMapper.xml
+1
-0
AuthController.java
...main/java/com/hungraim/ltc/controller/AuthController.java
+8
-3
ChDisableInfoChange.java
...hungraim/ltc/pojo/entity/disable/ChDisableInfoChange.java
+5
-0
ReportDetailVO.java
...a/com/hungraim/ltc/pojo/vo/assessment/ReportDetailVO.java
+4
-0
TaskReportVO.java
...ava/com/hungraim/ltc/pojo/vo/assessment/TaskReportVO.java
+1
-0
CsoftSecurityUtil.java
...rc/main/java/com/hungraim/ltc/util/CsoftSecurityUtil.java
+20
-10
RedisCache.java
...-core/src/main/java/com/hungraim/ltc/util/RedisCache.java
+240
-0
No files found.
apply/apply-service/src/main/java/com/hungraim/ltc/controller/DisableController.java
View file @
80e4e8bb
...
@@ -126,7 +126,7 @@ public class DisableController {
...
@@ -126,7 +126,7 @@ public class DisableController {
/**
/**
* 查询机构下或者包含子机构下的所有护理机构
* 查询机构下或者包含子机构下的所有护理机构
*
*
* @param 机构id
* @param
token
机构id
*/
*/
@RequestMapping
(
"/srvOrganListByIsInvolveChild"
)
@RequestMapping
(
"/srvOrganListByIsInvolveChild"
)
public
Result
<
List
<
ChSrvOrgan
>>
srvOrganListByIsInvolveChild
(
@RequestHeader
(
"Authorization"
)
String
token
,
Boolean
isInvolveChild
)
{
public
Result
<
List
<
ChSrvOrgan
>>
srvOrganListByIsInvolveChild
(
@RequestHeader
(
"Authorization"
)
String
token
,
Boolean
isInvolveChild
)
{
...
...
assessment/assessment-service/src/main/java/com/hungraim/ltc/controller/TaskController.java
View file @
80e4e8bb
...
@@ -59,11 +59,13 @@ public class TaskController {
...
@@ -59,11 +59,13 @@ public class TaskController {
* @param taskName 评定人员姓名
* @param taskName 评定人员姓名
* @param taskTel 评定人员手机号码
* @param taskTel 评定人员手机号码
* @param daysRemaining 评定剩余天数
* @param daysRemaining 评定剩余天数
* @param
s
tatus 任务状态
* @param
taskS
tatus 任务状态
* @param isReturn 是否退回
* @param isReturn 是否退回
* @param pageNum 当前页
* @param pageNum 当前页
* @param pageSize 每页几条数据
* @param pageSize 每页几条数据
* @param type 1评定报告录入查询失能人员
*/
*/
@RequestMapping
(
"/taskDistributionList"
)
@RequestMapping
(
"/taskDistributionList"
)
public
Result
<
Page
<
TaskDistributionVO
>>
taskDistributionList
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
,
public
Result
<
Page
<
TaskDistributionVO
>>
taskDistributionList
(
@RequestParam
(
defaultValue
=
"1"
)
Integer
pageNum
,
@RequestParam
(
defaultValue
=
"10"
)
Integer
pageSize
,
String
organId
,
String
provincial
,
String
city
,
String
organId
,
String
provincial
,
String
city
,
...
@@ -229,7 +231,7 @@ public class TaskController {
...
@@ -229,7 +231,7 @@ public class TaskController {
/**
/**
* 添加评估公示信息
* 添加评估公示信息
* @param t
askId
* @param t
oken
* @return
* @return
*/
*/
@RequestMapping
(
"/updateReportPublicityInfo"
)
@RequestMapping
(
"/updateReportPublicityInfo"
)
...
...
assessment/assessment-service/src/main/java/com/hungraim/ltc/service/impl/TaskServiceImpl.java
View file @
80e4e8bb
...
@@ -438,8 +438,11 @@ public class TaskServiceImpl implements TaskService {
...
@@ -438,8 +438,11 @@ public class TaskServiceImpl implements TaskService {
taskMapper
.
updateById
(
task
);
taskMapper
.
updateById
(
task
);
//更新失能人员信息
//更新失能人员信息
ChDisableInfo
chDisableInfo
=
disableInfoMapper
.
selectById
(
task
.
getDisableInfoId
());
ChDisableInfo
chDisableInfo
=
disableInfoMapper
.
selectById
(
task
.
getDisableInfoId
());
chDisableInfo
.
setLastTaskId
(
task
.
getTaskId
());
if
(
chDisableInfo
!=
null
){
disableInfoMapper
.
updateById
(
chDisableInfo
);
chDisableInfo
.
setLastTaskId
(
task
.
getTaskId
());
disableInfoMapper
.
updateById
(
chDisableInfo
);
}
//生成组
//生成组
ChAprTaskPush
taskPush
=
new
ChAprTaskPush
();
ChAprTaskPush
taskPush
=
new
ChAprTaskPush
();
taskPush
.
setAssignTime
(
new
Date
());
taskPush
.
setAssignTime
(
new
Date
());
...
...
assessment/assessment-service/src/main/resources/mapper/ChDisableEvaluateMapper.xml
View file @
80e4e8bb
...
@@ -143,6 +143,7 @@
...
@@ -143,6 +143,7 @@
(SELECT dis.DISTRICT_NAME FROM CH_FND_DISTRICT dis WHERE info.acpt_srv_area = dis.DISTRICT_CODE) acptSrvArea,
(SELECT dis.DISTRICT_NAME FROM CH_FND_DISTRICT dis WHERE info.acpt_srv_area = dis.DISTRICT_CODE) acptSrvArea,
info.ACPT_SRV_ADDRESS acptSrvAddress,--接受服务地址详细地址
info.ACPT_SRV_ADDRESS acptSrvAddress,--接受服务地址详细地址
info.ACPT_ADDRESS acptAddress,--接受评定详细地址
info.ACPT_ADDRESS acptAddress,--接受评定详细地址
info.ADRESS_DETAIL operAddress,
lev.DISABLE_LEVEL_NAME riskLevel,
lev.DISABLE_LEVEL_NAME riskLevel,
report.EFF_TIME effTime,report.EVALUATE_TYPE
report.EFF_TIME effTime,report.EVALUATE_TYPE
FROM ch_apr_report report
FROM ch_apr_report report
...
...
auth-service/src/main/java/com/hungraim/ltc/controller/AuthController.java
View file @
80e4e8bb
...
@@ -6,6 +6,7 @@ import com.hungraim.ltc.util.Result;
...
@@ -6,6 +6,7 @@ import com.hungraim.ltc.util.Result;
import
com.hungraim.ltc.util.ResultCode
;
import
com.hungraim.ltc.util.ResultCode
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.SneakyThrows
;
import
lombok.SneakyThrows
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.security.jwt.JwtHelper
;
import
org.springframework.security.jwt.JwtHelper
;
import
org.springframework.security.oauth2.common.OAuth2AccessToken
;
import
org.springframework.security.oauth2.common.OAuth2AccessToken
;
...
@@ -30,14 +31,18 @@ public class AuthController {
...
@@ -30,14 +31,18 @@ public class AuthController {
private
final
RedisTemplate
redisTemplate
;
private
final
RedisTemplate
redisTemplate
;
private
final
TokenEndpoint
tokenEndpoint
;
private
final
TokenEndpoint
tokenEndpoint
;
@Autowired
private
CsoftSecurityUtil
csoftSecurityUtil
;
@PostMapping
(
"/token"
)
@PostMapping
(
"/token"
)
@SneakyThrows
@SneakyThrows
public
Result
<
OAuth2AccessToken
>
postAccessToken
(
Principal
principal
,
@RequestParam
Map
<
String
,
String
>
parameters
)
{
public
Result
<
OAuth2AccessToken
>
postAccessToken
(
Principal
principal
,
@RequestParam
Map
<
String
,
String
>
parameters
,
String
publicKeyString
)
{
String
password
=
parameters
.
get
(
"password"
);
String
password
=
parameters
.
get
(
"password"
);
if
(
FALSE
.
equals
(
password
)){
if
(
FALSE
.
equals
(
password
)){
return
Result
.
failed
(
ResultCode
.
USER_LOGIN_ERROR
);
return
Result
.
failed
(
ResultCode
.
USER_LOGIN_ERROR
);
}
}
String
decrypt
=
CsoftSecurityUtil
.
decryptRSADefault
(
password
);
String
decrypt
=
csoftSecurityUtil
.
decryptRSADefault
(
password
,
publicKeyString
);
parameters
.
put
(
"password"
,
decrypt
);
parameters
.
put
(
"password"
,
decrypt
);
OAuth2AccessToken
oAuth2AccessToken
=
tokenEndpoint
.
postAccessToken
(
principal
,
parameters
).
getBody
();
OAuth2AccessToken
oAuth2AccessToken
=
tokenEndpoint
.
postAccessToken
(
principal
,
parameters
).
getBody
();
return
Result
.
success
(
oAuth2AccessToken
);
return
Result
.
success
(
oAuth2AccessToken
);
...
@@ -49,7 +54,7 @@ public class AuthController {
...
@@ -49,7 +54,7 @@ public class AuthController {
*/
*/
@GetMapping
(
"/genKeyPair"
)
@GetMapping
(
"/genKeyPair"
)
public
Result
<
String
>
genKeyPair
()
{
public
Result
<
String
>
genKeyPair
()
{
Map
keyMap
=
C
softSecurityUtil
.
createKeyPairs
();
Map
keyMap
=
c
softSecurityUtil
.
createKeyPairs
();
return
Result
.
success
(
keyMap
.
get
(
0
).
toString
());
return
Result
.
success
(
keyMap
.
get
(
0
).
toString
());
}
}
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/entity/disable/ChDisableInfoChange.java
View file @
80e4e8bb
...
@@ -420,4 +420,9 @@ public class ChDisableInfoChange {
...
@@ -420,4 +420,9 @@ public class ChDisableInfoChange {
* 待遇类型(1失能、0失智)
* 待遇类型(1失能、0失智)
*/
*/
private
Integer
treatmentType
;
private
Integer
treatmentType
;
/**
*医保统筹区区
*/
private
String
medicalArea
;
}
}
common/common-core/src/main/java/com/hungraim/ltc/pojo/vo/assessment/ReportDetailVO.java
View file @
80e4e8bb
...
@@ -15,6 +15,10 @@ public class ReportDetailVO {
...
@@ -15,6 +15,10 @@ public class ReportDetailVO {
Integer
person3
;
Integer
person3
;
String
evaluateTime
;
String
evaluateTime
;
Integer
disableLevelId
;
Integer
disableLevelId
;
/**
* 现住址
*/
String
operAddress
;
String
applyId
;
String
applyId
;
String
polNo
;
String
polNo
;
String
remark
;
String
remark
;
...
...
common/common-core/src/main/java/com/hungraim/ltc/pojo/vo/assessment/TaskReportVO.java
View file @
80e4e8bb
...
@@ -56,6 +56,7 @@ public class TaskReportVO {
...
@@ -56,6 +56,7 @@ public class TaskReportVO {
private
String
adressDistrictProvincial
;
private
String
adressDistrictProvincial
;
private
String
adressDistrictCity
;
private
String
adressDistrictCity
;
private
String
adressDistrictCode
;
private
String
adressDistrictCode
;
private
String
operAddress
;
//失能人员接受评定地址
//失能人员接受评定地址
private
String
acptProvincial
;
private
String
acptProvincial
;
private
String
acptCity
;
private
String
acptCity
;
...
...
common/common-core/src/main/java/com/hungraim/ltc/util/CsoftSecurityUtil.java
View file @
80e4e8bb
...
@@ -20,7 +20,9 @@ import java.util.HashMap;
...
@@ -20,7 +20,9 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Map.Entry
;
import
java.util.TreeMap
;
import
java.util.TreeMap
;
import
java.util.concurrent.TimeUnit
;
import
javax.annotation.Resource
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.BadPaddingException
;
import
javax.crypto.Cipher
;
import
javax.crypto.Cipher
;
import
javax.crypto.IllegalBlockSizeException
;
import
javax.crypto.IllegalBlockSizeException
;
...
@@ -37,6 +39,7 @@ import org.apache.commons.codec.digest.DigestUtils;
...
@@ -37,6 +39,7 @@ import org.apache.commons.codec.digest.DigestUtils;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.stereotype.Component
;
/**
/**
* @Description: 中研通用加密工具 RSA+ASE+SHA256(非对称加密(对称秘钥),对称加密数据,Sha256消息摘要,RSA签名)
* @Description: 中研通用加密工具 RSA+ASE+SHA256(非对称加密(对称秘钥),对称加密数据,Sha256消息摘要,RSA签名)
...
@@ -44,11 +47,15 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -44,11 +47,15 @@ import com.alibaba.fastjson.JSONObject;
* @version 1.0
* @version 1.0
*/
*/
@Slf4j
@Slf4j
@Component
public
class
CsoftSecurityUtil
{
public
class
CsoftSecurityUtil
{
private
static
Map
<
Integer
,
String
>
keyMap
=
new
HashMap
<>();
// 用于封装随机产生的公钥与私钥
private
static
Map
<
Integer
,
String
>
keyMap
=
new
HashMap
<>();
// 用于封装随机产生的公钥与私钥
@Resource
private
RedisCache
redisCache
;
// 加密数据和秘钥的编码方式
// 加密数据和秘钥的编码方式
public
static
final
String
UTF_8
=
"UTF-8"
;
public
static
final
String
UTF_8
=
"UTF-8"
;
...
@@ -304,7 +311,7 @@ public class CsoftSecurityUtil {
...
@@ -304,7 +311,7 @@ public class CsoftSecurityUtil {
* 创建RSA的公钥和私钥示例 将生成的公钥和私钥用Base64编码后打印出来
* 创建RSA的公钥和私钥示例 将生成的公钥和私钥用Base64编码后打印出来
* @throws NoSuchAlgorithmException
* @throws NoSuchAlgorithmException
*/
*/
public
static
Map
createKeyPairs
()
{
public
Map
createKeyPairs
()
{
try
{
try
{
KeyPairGenerator
keyPairGenerator
=
KeyPairGenerator
.
getInstance
(
"RSA"
);
KeyPairGenerator
keyPairGenerator
=
KeyPairGenerator
.
getInstance
(
"RSA"
);
keyPairGenerator
.
initialize
(
2048
);
keyPairGenerator
.
initialize
(
2048
);
...
@@ -315,6 +322,9 @@ public class CsoftSecurityUtil {
...
@@ -315,6 +322,9 @@ public class CsoftSecurityUtil {
RSAPrivateKey
privateKey
=
(
RSAPrivateKey
)
keyPair
.
getPrivate
();
RSAPrivateKey
privateKey
=
(
RSAPrivateKey
)
keyPair
.
getPrivate
();
String
publicKeyString
=
new
String
(
Base64
.
encodeBase64
(
publicKey
.
getEncoded
()));
String
publicKeyString
=
new
String
(
Base64
.
encodeBase64
(
publicKey
.
getEncoded
()));
String
privateKeyString
=
new
String
(
Base64
.
encodeBase64
((
privateKey
.
getEncoded
())));
String
privateKeyString
=
new
String
(
Base64
.
encodeBase64
((
privateKey
.
getEncoded
())));
log
.
info
(
"公钥:{}"
,
publicKeyString
);
log
.
info
(
"私钥:{}"
,
privateKeyString
);
redisCache
.
setCacheObject
(
publicKeyString
,
privateKeyString
,
1
,
TimeUnit
.
DAYS
);
keyMap
.
put
(
0
,
publicKeyString
);
//0表示公钥
keyMap
.
put
(
0
,
publicKeyString
);
//0表示公钥
keyMap
.
put
(
1
,
privateKeyString
);
//1表示私钥
keyMap
.
put
(
1
,
privateKeyString
);
//1表示私钥
}
catch
(
NoSuchAlgorithmException
e
){
}
catch
(
NoSuchAlgorithmException
e
){
...
@@ -337,15 +347,15 @@ public class CsoftSecurityUtil {
...
@@ -337,15 +347,15 @@ public class CsoftSecurityUtil {
* @throws IllegalBlockSizeException
* @throws IllegalBlockSizeException
* @throws BadPaddingException
* @throws BadPaddingException
*/
*/
public
static
String
decryptRSADefault
(
String
data
)
throws
InvalidKeySpecException
,
NoSuchAlgorithmException
,
NoSuchPaddingException
,
InvalidKeyException
,
IllegalBlockSizeException
,
BadPaddingException
,
UnsupportedEncodingException
{
public
String
decryptRSADefault
(
String
data
,
String
publicKeyString
)
throws
InvalidKeySpecException
,
NoSuchAlgorithmException
,
NoSuchPaddingException
,
InvalidKeyException
,
IllegalBlockSizeException
,
BadPaddingException
,
UnsupportedEncodingException
{
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
RSA_ALGORITHM_NOPADDING
);
KeyFactory
keyFactory
=
KeyFactory
.
getInstance
(
RSA_ALGORITHM_NOPADDING
);
byte
[]
privateKeyArray
=
keyMap
.
get
(
1
).
getBytes
(
);
String
privateKeyString
=
redisCache
.
getCacheObject
(
publicKeyString
);
byte
[]
dataArray
=
data
.
getBytes
();
byte
[]
privateKeyArray
=
privateKeyString
.
getBytes
();
PKCS8EncodedKeySpec
pkcs8EncodedKeySpec
=
new
PKCS8EncodedKeySpec
(
Base64
.
decodeBase64
(
privateKeyArray
)
);
byte
[]
dataArray
=
data
.
getBytes
(
);
PrivateKey
privateKey
=
keyFactory
.
generatePrivate
(
pkcs8EncodedKeySpec
);
PKCS8EncodedKeySpec
pkcs8EncodedKeySpec
=
new
PKCS8EncodedKeySpec
(
Base64
.
decodeBase64
(
privateKeyArray
)
);
PrivateKey
privateKey
=
keyFactory
.
generatePrivate
(
pkcs8EncodedKeySpec
);
Cipher
cipher
=
Cipher
.
getInstance
(
RSA_ALGORITHM_NOPADDING
);
Cipher
cipher
=
Cipher
.
getInstance
(
RSA_ALGORITHM_NOPADDING
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
privateKey
);
return
new
String
(
cipher
.
doFinal
(
Base64
.
decodeBase64
(
dataArray
)),
UTF_8
);
return
new
String
(
cipher
.
doFinal
(
Base64
.
decodeBase64
(
dataArray
)),
UTF_8
);
}
}
...
...
common/common-core/src/main/java/com/hungraim/ltc/util/RedisCache.java
0 → 100644
View file @
80e4e8bb
package
com
.
hungraim
.
ltc
.
util
;
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.stereotype.Component
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
/**
* @author root
*/
@Component
public
class
RedisCache
{
@Autowired
public
RedisTemplate
redisTemplate
;
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
)
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
);
}
/**
* 缓存基本的对象,Integer、String、实体类等
*
* @param key 缓存的键值
* @param value 缓存的值
* @param timeout 时间
* @param timeUnit 时间颗粒度
*/
public
<
T
>
void
setCacheObject
(
final
String
key
,
final
T
value
,
final
Integer
timeout
,
final
TimeUnit
timeUnit
)
{
redisTemplate
.
opsForValue
().
set
(
key
,
value
,
timeout
,
timeUnit
);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @return true=设置成功;false=设置失败
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
)
{
return
expire
(
key
,
timeout
,
TimeUnit
.
SECONDS
);
}
/**
* 设置有效时间
*
* @param key Redis键
* @param timeout 超时时间
* @param unit 时间单位
* @return true=设置成功;false=设置失败
*/
public
boolean
expire
(
final
String
key
,
final
long
timeout
,
final
TimeUnit
unit
)
{
return
redisTemplate
.
expire
(
key
,
timeout
,
unit
);
}
/**
* 获得缓存的基本对象。
*
* @param key 缓存键值
* @return 缓存键值对应的数据
*/
public
<
T
>
T
getCacheObject
(
final
String
key
)
{
ValueOperations
<
String
,
T
>
operation
=
redisTemplate
.
opsForValue
();
return
operation
.
get
(
key
);
}
/**
* 删除单个对象
*
* @param key
*/
public
boolean
deleteObject
(
final
String
key
)
{
return
redisTemplate
.
delete
(
key
);
}
/**
* 删除集合对象
*
* @param collection 多个对象
* @return
*/
public
long
deleteObject
(
final
Collection
collection
)
{
return
redisTemplate
.
delete
(
collection
);
}
/**
* 缓存List数据
*
* @param key 缓存的键值
* @param dataList 待缓存的List数据
* @return 缓存的对象
*/
public
<
T
>
long
setCacheList
(
final
String
key
,
final
List
<
T
>
dataList
)
{
Long
count
=
redisTemplate
.
opsForList
().
rightPushAll
(
key
,
dataList
);
return
count
==
null
?
0
:
count
;
}
/**
* 获得缓存的list对象
*
* @param key 缓存的键值
* @return 缓存键值对应的数据
*/
public
<
T
>
List
<
T
>
getCacheList
(
final
String
key
)
{
return
redisTemplate
.
opsForList
().
range
(
key
,
0
,
-
1
);
}
/**
* 缓存Set
*
* @param key 缓存键值
* @param dataSet 缓存的数据
* @return 缓存数据的对象
*/
public
<
T
>
BoundSetOperations
<
String
,
T
>
setCacheSet
(
final
String
key
,
final
Set
<
T
>
dataSet
)
{
BoundSetOperations
<
String
,
T
>
setOperation
=
redisTemplate
.
boundSetOps
(
key
);
Iterator
<
T
>
it
=
dataSet
.
iterator
();
while
(
it
.
hasNext
())
{
setOperation
.
add
(
it
.
next
());
}
return
setOperation
;
}
/**
* 获得缓存的set
*
* @param key
* @return
*/
public
<
T
>
Set
<
T
>
getCacheSet
(
final
String
key
)
{
return
redisTemplate
.
opsForSet
().
members
(
key
);
}
/**
* 缓存Map
*
* @param key
* @param dataMap
*/
public
<
T
>
void
setCacheMap
(
final
String
key
,
final
Map
<
String
,
T
>
dataMap
)
{
if
(
dataMap
!=
null
)
{
redisTemplate
.
opsForHash
().
putAll
(
key
,
dataMap
);
}
}
/**
* 获得缓存的Map
*
* @param key
* @return
*/
public
<
T
>
Map
<
String
,
T
>
getCacheMap
(
final
String
key
)
{
return
redisTemplate
.
opsForHash
().
entries
(
key
);
}
/**
* 往Hash中存入数据
*
* @param key Redis键
* @param hKey Hash键
* @param value 值
*/
public
<
T
>
void
setCacheMapValue
(
final
String
key
,
final
String
hKey
,
final
T
value
)
{
redisTemplate
.
opsForHash
().
put
(
key
,
hKey
,
value
);
}
/**
* 获取Hash中的数据
*
* @param key Redis键
* @param hKey Hash键
* @return Hash中的对象
*/
public
<
T
>
T
getCacheMapValue
(
final
String
key
,
final
String
hKey
)
{
HashOperations
<
String
,
String
,
T
>
opsForHash
=
redisTemplate
.
opsForHash
();
return
opsForHash
.
get
(
key
,
hKey
);
}
/**
* 删除Hash中的数据
*
* @param key
* @param hkey
*/
public
void
delCacheMapValue
(
final
String
key
,
final
String
hkey
)
{
HashOperations
hashOperations
=
redisTemplate
.
opsForHash
();
hashOperations
.
delete
(
key
,
hkey
);
}
/**
* 获取多个Hash中的数据
*
* @param key Redis键
* @param hKeys Hash键集合
* @return Hash对象集合
*/
public
<
T
>
List
<
T
>
getMultiCacheMapValue
(
final
String
key
,
final
Collection
<
Object
>
hKeys
)
{
return
redisTemplate
.
opsForHash
().
multiGet
(
key
,
hKeys
);
}
/**
* 获得缓存的基本对象列表
*
* @param pattern 字符串前缀
* @return 对象列表
*/
public
Collection
<
String
>
keys
(
final
String
pattern
)
{
return
redisTemplate
.
keys
(
pattern
);
}
}
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