6666
This commit is contained in:
parent
9f861bf6ec
commit
348c08c495
@ -0,0 +1,124 @@
|
|||||||
|
package net.lab1024.sa.admin.extend.fangxinqian;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.lab1024.sa.common.common.exception.BusinessException;
|
||||||
|
import net.lab1024.sa.common.module.support.redis.RedisService;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class Base {
|
||||||
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
|
||||||
|
@Value("${fxq.client-id}")
|
||||||
|
private static String clientId;
|
||||||
|
|
||||||
|
@Value("${fxq.client-secret}")
|
||||||
|
private static String clientSecret;
|
||||||
|
|
||||||
|
@Value("${fxq.client-url}")
|
||||||
|
private static String clientUrl;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisService redisService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送 POST JSON 请求
|
||||||
|
* @param url 请求地址
|
||||||
|
* @param jsonData JSON 字符串
|
||||||
|
* @param headers 请求头
|
||||||
|
* @return 响应字符串
|
||||||
|
*/
|
||||||
|
public String postJson(String url, String jsonData, Map<String, String> headers) {
|
||||||
|
// 获取token
|
||||||
|
String tokenKey = "fangxinqian:" + clientId;
|
||||||
|
String token = redisService.get(tokenKey);
|
||||||
|
if (token == null) {
|
||||||
|
token = getAccessToken();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新token
|
||||||
|
HttpRequest request = HttpRequest.post(url)
|
||||||
|
.body(jsonData)
|
||||||
|
.header("Content-Type", "application/json")
|
||||||
|
.header("Authorization", "Bearer " + token);
|
||||||
|
|
||||||
|
if (headers != null) {
|
||||||
|
headers.forEach(request::header);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (HttpResponse response = request.execute()) {
|
||||||
|
JSONObject json = JSONUtil.parseObj(response.body());
|
||||||
|
|
||||||
|
log.info("获取app数据返回:{}",json);
|
||||||
|
|
||||||
|
int code = json.getInt("code", -1);
|
||||||
|
if (code == 10000) {
|
||||||
|
return response.body();
|
||||||
|
} else if (code == 10005) {
|
||||||
|
// token 失效,重新获取
|
||||||
|
getAccessToken();
|
||||||
|
|
||||||
|
return postJson(url,jsonData,headers);
|
||||||
|
}else{
|
||||||
|
throw new BusinessException(json.getStr("message", "操作失败"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAccessToken(){
|
||||||
|
String url = String.format("%s?grant_type=client_credentials&client_id=%s&client_secret=%s",
|
||||||
|
"https://saasapi.fangxinqian.cn/oauth/token", clientId, clientSecret);
|
||||||
|
|
||||||
|
HttpRequest request = HttpRequest.post(url);
|
||||||
|
|
||||||
|
try (HttpResponse response = request.execute()) {
|
||||||
|
if (response.getStatus() != 200) {
|
||||||
|
throw new BusinessException("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject json = JSONUtil.parseObj(response.body());
|
||||||
|
|
||||||
|
log.info("获取app数据返回:{}",json);
|
||||||
|
|
||||||
|
String accessToken = json.getStr("access_token");
|
||||||
|
if (accessToken == null || accessToken.isEmpty()) {
|
||||||
|
throw new BusinessException("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer expiresIn = json.getInt("expires_in");
|
||||||
|
if (expiresIn == null || expiresIn <= 0) {
|
||||||
|
throw new BusinessException("操作失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
String tokenKey = "fangxinqian:" + clientId;
|
||||||
|
redisService.set(tokenKey,accessToken,(expiresIn - 120));
|
||||||
|
|
||||||
|
return accessToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class R
|
||||||
|
{
|
||||||
|
/** 接口调用状态。200:正常;其它值:调用出错 */
|
||||||
|
private int code;
|
||||||
|
|
||||||
|
/** 结果说明。如果接口调用出错,那么返回错误描述。成功则返回 ok */
|
||||||
|
private String msg;
|
||||||
|
|
||||||
|
/** 接口是否调用成功 */
|
||||||
|
private boolean success;
|
||||||
|
|
||||||
|
/** 错误信息或提示信息 */
|
||||||
|
private String message;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package net.lab1024.sa.admin.extend.fangxinqian;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业账号
|
||||||
|
*/
|
||||||
|
public class Company {
|
||||||
|
}
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package net.lab1024.sa.admin.extend.fangxinqian;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人账号
|
||||||
|
*/
|
||||||
|
public class Personal {
|
||||||
|
}
|
||||||
@ -229,8 +229,7 @@ public class ExpertController {
|
|||||||
// 获取白名单用户-姓名、医院名称
|
// 获取白名单用户-姓名、医院名称
|
||||||
ExpertWhiteEntity expertWhiteEntity = expertWhiteEntityService.getExpertWhiteEntityByNameAndHospitalName(name,hospital_name);
|
ExpertWhiteEntity expertWhiteEntity = expertWhiteEntityService.getExpertWhiteEntityByNameAndHospitalName(name,hospital_name);
|
||||||
if (expertWhiteEntity == null) {
|
if (expertWhiteEntity == null) {
|
||||||
responseDTO.setMsg("暂无登录权限");
|
return ResponseDTO.error(NO_AUTH);
|
||||||
return responseDTO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpertEntity expert = new ExpertEntity();
|
ExpertEntity expert = new ExpertEntity();
|
||||||
@ -472,8 +471,7 @@ public class ExpertController {
|
|||||||
// 获取白名单用户-姓名、医院名称
|
// 获取白名单用户-姓名、医院名称
|
||||||
ExpertWhiteEntity expertWhiteEntity = expertWhiteEntityService.getExpertWhiteEntityByNameAndHospitalName(name,hospital_name);
|
ExpertWhiteEntity expertWhiteEntity = expertWhiteEntityService.getExpertWhiteEntityByNameAndHospitalName(name,hospital_name);
|
||||||
if (expertWhiteEntity == null) {
|
if (expertWhiteEntity == null) {
|
||||||
responseDTO.setMsg("暂无登录权限");
|
return ResponseDTO.error(NO_AUTH);
|
||||||
return responseDTO;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ExpertEntity expert = new ExpertEntity();
|
ExpertEntity expert = new ExpertEntity();
|
||||||
|
|||||||
@ -9,7 +9,6 @@ import java.time.LocalDateTime;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class DpmsAddForm {
|
public class DpmsAddForm {
|
||||||
|
|
||||||
@ApiModelProperty(value = "治疗时间", required = true)
|
@ApiModelProperty(value = "治疗时间", required = true)
|
||||||
@NotNull(message = "治疗时间 不能为空")
|
@NotNull(message = "治疗时间 不能为空")
|
||||||
private LocalDateTime treatTime;
|
private LocalDateTime treatTime;
|
||||||
|
|||||||
@ -12,6 +12,13 @@ server:
|
|||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
active: '@profiles.active@'
|
active: '@profiles.active@'
|
||||||
|
data:
|
||||||
|
redis:
|
||||||
|
host: '139.155.127.177'
|
||||||
|
port: 30002
|
||||||
|
password: gdxz2022&dj.
|
||||||
|
database: 11
|
||||||
|
timeout: 3000
|
||||||
|
|
||||||
# 项目配置
|
# 项目配置
|
||||||
project:
|
project:
|
||||||
@ -40,4 +47,9 @@ igandan:
|
|||||||
token: XUUHml5iQ9mlFsa8QqOwyBrLI2nGGGxJ
|
token: XUUHml5iQ9mlFsa8QqOwyBrLI2nGGGxJ
|
||||||
platform: case
|
platform: case
|
||||||
doc:
|
doc:
|
||||||
host: https://dev-doc.igandan.com/app/
|
host: https://dev-doc.igandan.com/app/
|
||||||
|
|
||||||
|
fxq:
|
||||||
|
client-id: Md7w4eaZih
|
||||||
|
client-secret: 97acf8ebb09641cbb90accf06e74ccf5
|
||||||
|
client-url: https://saasapi.fangxinqian.cn/openapi/v2/
|
||||||
@ -260,7 +260,6 @@
|
|||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.11.0</version>
|
<version>2.11.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,9 @@ public enum UserErrorCode implements ErrorCode {
|
|||||||
NO_PERMISSION_EDIT(30010, "该状态不允许修改"),
|
NO_PERMISSION_EDIT(30010, "该状态不允许修改"),
|
||||||
NO_MODIFY(30011, "该账号无需补充资料"),
|
NO_MODIFY(30011, "该账号无需补充资料"),
|
||||||
PROJECT_CLOSE(30012, "本年度人工肝病例登记项目已结束,谢谢您的关注!"),
|
PROJECT_CLOSE(30012, "本年度人工肝病例登记项目已结束,谢谢您的关注!"),
|
||||||
ExpertBankVerifyFail(30013, "银行卡认证失败");
|
ExpertBankVerifyFail(30013, "银行卡认证失败"),
|
||||||
|
|
||||||
|
NO_AUTH(30014, "对不起,您暂无权限访问该项目~");
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
|
|
||||||
|
|||||||
@ -1,222 +1,223 @@
|
|||||||
//package net.lab1024.sa.common.module.support.redis;
|
package net.lab1024.sa.common.module.support.redis;
|
||||||
//
|
|
||||||
//import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
//import net.lab1024.sa.common.common.domain.SystemEnvironment;
|
import net.lab1024.sa.common.common.domain.SystemEnvironment;
|
||||||
//import net.lab1024.sa.common.common.enumeration.SystemEnvironmentEnum;
|
import net.lab1024.sa.common.common.enumeration.SystemEnvironmentEnum;
|
||||||
//import net.lab1024.sa.common.common.util.SmartStringUtil;
|
import net.lab1024.sa.common.common.util.SmartStringUtil;
|
||||||
//import net.lab1024.sa.common.constant.RedisKeyConst;
|
import net.lab1024.sa.common.constant.RedisKeyConst;
|
||||||
//import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
//import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
//import org.springframework.data.redis.core.*;
|
import org.springframework.data.redis.core.*;
|
||||||
//import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
//import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
//
|
|
||||||
//import java.time.LocalDate;
|
import javax.annotation.Resource;
|
||||||
//import java.time.LocalDateTime;
|
import java.time.LocalDate;
|
||||||
//import java.time.LocalTime;
|
import java.time.LocalDateTime;
|
||||||
//import java.time.temporal.ChronoUnit;
|
import java.time.LocalTime;
|
||||||
//import java.util.Collection;
|
import java.time.temporal.ChronoUnit;
|
||||||
//import java.util.List;
|
import java.util.Collection;
|
||||||
//import java.util.concurrent.TimeUnit;
|
import java.util.List;
|
||||||
//
|
import java.util.concurrent.TimeUnit;
|
||||||
///**
|
|
||||||
// * redis 一顿操作
|
/**
|
||||||
// *
|
* redis 一顿操作
|
||||||
// * @Author 1024创新实验室: 罗伊
|
*
|
||||||
// * @Date 2020/8/25 21:57
|
* @Author 1024创新实验室: 罗伊
|
||||||
// * @Wechat zhuoda1024
|
* @Date 2020/8/25 21:57
|
||||||
// * @Email lab1024@163.com
|
* @Wechat zhuoda1024
|
||||||
// * @Copyright 1024创新实验室 ( https://1024lab.net )
|
* @Email lab1024@163.com
|
||||||
// */
|
* @Copyright 1024创新实验室 ( https://1024lab.net )
|
||||||
////@Component
|
*/
|
||||||
//public class RedisService {
|
//@Component
|
||||||
//
|
public class RedisService {
|
||||||
// private static final Logger log = org.slf4j.LoggerFactory.getLogger(RedisService.class);
|
|
||||||
//
|
private static final Logger log = org.slf4j.LoggerFactory.getLogger(RedisService.class);
|
||||||
// @Autowired
|
|
||||||
// private StringRedisTemplate stringRedisTemplate;
|
@Resource
|
||||||
//
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
// @Autowired
|
|
||||||
// private RedisTemplate<String, Object> redisTemplate;
|
@Resource
|
||||||
//
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
// @Autowired
|
|
||||||
// private ValueOperations<String, String> redisValueOperations;
|
@Resource
|
||||||
//
|
private ValueOperations<String, String> redisValueOperations;
|
||||||
// @Autowired
|
|
||||||
// private HashOperations<String, String, Object> redisHashOperations;
|
@Resource
|
||||||
//
|
private HashOperations<String, String, Object> redisHashOperations;
|
||||||
// @Autowired
|
|
||||||
// private ListOperations<String, Object> redisListOperations;
|
@Resource
|
||||||
//
|
private ListOperations<String, Object> redisListOperations;
|
||||||
// @Autowired
|
|
||||||
// private SetOperations<String, Object> redisSetOperations;
|
@Resource
|
||||||
//
|
private SetOperations<String, Object> redisSetOperations;
|
||||||
// @Autowired
|
|
||||||
// private SystemEnvironment systemEnvironment;
|
@Resource
|
||||||
//
|
private SystemEnvironment systemEnvironment;
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 生成redis key
|
/**
|
||||||
// * @param prefix
|
* 生成redis key
|
||||||
// * @param key
|
* @param prefix
|
||||||
// * @return
|
* @param key
|
||||||
// */
|
* @return
|
||||||
// public String generateRedisKey(String prefix, String key) {
|
*/
|
||||||
// SystemEnvironmentEnum currentEnvironment = systemEnvironment.getCurrentEnvironment();
|
public String generateRedisKey(String prefix, String key) {
|
||||||
// return systemEnvironment.getProjectName() + RedisKeyConst.SEPARATOR + currentEnvironment.getValue() + RedisKeyConst.SEPARATOR + prefix + key;
|
SystemEnvironmentEnum currentEnvironment = systemEnvironment.getCurrentEnvironment();
|
||||||
// }
|
return systemEnvironment.getProjectName() + RedisKeyConst.SEPARATOR + currentEnvironment.getValue() + RedisKeyConst.SEPARATOR + prefix + key;
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * redis key 解析成真实的内容
|
/**
|
||||||
// * @param redisKey
|
* redis key 解析成真实的内容
|
||||||
// * @return
|
* @param redisKey
|
||||||
// */
|
* @return
|
||||||
// public static String redisKeyParse(String redisKey) {
|
*/
|
||||||
// if(SmartStringUtil.isBlank(redisKey)){
|
public static String redisKeyParse(String redisKey) {
|
||||||
// return "";
|
if(SmartStringUtil.isBlank(redisKey)){
|
||||||
// }
|
return "";
|
||||||
// int index = redisKey.lastIndexOf(RedisKeyConst.SEPARATOR);
|
}
|
||||||
// if(index < 1){
|
int index = redisKey.lastIndexOf(RedisKeyConst.SEPARATOR);
|
||||||
// return redisKey;
|
if(index < 1){
|
||||||
// }
|
return redisKey;
|
||||||
// return redisKey.substring(index);
|
}
|
||||||
// }
|
return redisKey.substring(index);
|
||||||
//
|
}
|
||||||
// public boolean getLock(String key, long expire) {
|
|
||||||
// return redisValueOperations.setIfAbsent(key, String.valueOf(System.currentTimeMillis()), expire, TimeUnit.MILLISECONDS);
|
public boolean getLock(String key, long expire) {
|
||||||
// }
|
return redisValueOperations.setIfAbsent(key, String.valueOf(System.currentTimeMillis()), expire, TimeUnit.MILLISECONDS);
|
||||||
//
|
}
|
||||||
// public void unLock(String key) {
|
|
||||||
// redisValueOperations.getOperations().delete(key);
|
public void unLock(String key) {
|
||||||
// }
|
redisValueOperations.getOperations().delete(key);
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 指定缓存失效时间
|
/**
|
||||||
// *
|
* 指定缓存失效时间
|
||||||
// * @param key 键
|
*
|
||||||
// * @param time 时间(秒)
|
* @param key 键
|
||||||
// * @return
|
* @param time 时间(秒)
|
||||||
// */
|
* @return
|
||||||
// public boolean expire(String key, long time) {
|
*/
|
||||||
// return redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
public boolean expire(String key, long time) {
|
||||||
// }
|
return redisTemplate.expire(key, time, TimeUnit.SECONDS);
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 获取当天剩余的秒数
|
/**
|
||||||
// *
|
* 获取当天剩余的秒数
|
||||||
// * @return
|
*
|
||||||
// */
|
* @return
|
||||||
// public static long currentDaySecond() {
|
*/
|
||||||
// return ChronoUnit.SECONDS.between(LocalDateTime.now(), LocalDateTime.of(LocalDate.now(), LocalTime.MAX));
|
public static long currentDaySecond() {
|
||||||
// }
|
return ChronoUnit.SECONDS.between(LocalDateTime.now(), LocalDateTime.of(LocalDate.now(), LocalTime.MAX));
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 根据key 获取过期时间
|
/**
|
||||||
// *
|
* 根据key 获取过期时间
|
||||||
// * @param key 键 不能为null
|
*
|
||||||
// * @return 时间(秒) 返回0代表为永久有效
|
* @param key 键 不能为null
|
||||||
// */
|
* @return 时间(秒) 返回0代表为永久有效
|
||||||
// public long getExpire(String key) {
|
*/
|
||||||
// return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
public long getExpire(String key) {
|
||||||
// }
|
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 判断key是否存在
|
/**
|
||||||
// *
|
* 判断key是否存在
|
||||||
// * @param key 键
|
*
|
||||||
// * @return true 存在 false不存在
|
* @param key 键
|
||||||
// */
|
* @return true 存在 false不存在
|
||||||
// public boolean hasKey(String key) {
|
*/
|
||||||
// return redisTemplate.hasKey(key);
|
public boolean hasKey(String key) {
|
||||||
// }
|
return redisTemplate.hasKey(key);
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 删除缓存
|
/**
|
||||||
// *
|
* 删除缓存
|
||||||
// * @param key 可以传一个值 或多个
|
*
|
||||||
// */
|
* @param key 可以传一个值 或多个
|
||||||
// @SuppressWarnings("unchecked")
|
*/
|
||||||
// public void delete(String... key) {
|
@SuppressWarnings("unchecked")
|
||||||
// if (key != null && key.length > 0) {
|
public void delete(String... key) {
|
||||||
// if (key.length == 1) {
|
if (key != null && key.length > 0) {
|
||||||
// redisTemplate.delete(key[0]);
|
if (key.length == 1) {
|
||||||
// } else {
|
redisTemplate.delete(key[0]);
|
||||||
// redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key));
|
} else {
|
||||||
// }
|
redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key));
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 删除缓存
|
/**
|
||||||
// *
|
* 删除缓存
|
||||||
// * @param keyList
|
*
|
||||||
// */
|
* @param keyList
|
||||||
// public void delete(List<String> keyList) {
|
*/
|
||||||
// if (CollectionUtils.isEmpty(keyList)) {
|
public void delete(List<String> keyList) {
|
||||||
// return;
|
if (CollectionUtils.isEmpty(keyList)) {
|
||||||
// }
|
return;
|
||||||
// redisTemplate.delete(keyList);
|
}
|
||||||
// }
|
redisTemplate.delete(keyList);
|
||||||
//
|
}
|
||||||
// //============================String=============================
|
|
||||||
//
|
//============================String=============================
|
||||||
// /**
|
|
||||||
// * 普通缓存获取
|
/**
|
||||||
// *
|
* 普通缓存获取
|
||||||
// * @param key 键
|
*
|
||||||
// * @return 值
|
* @param key 键
|
||||||
// */
|
* @return 值
|
||||||
// public String get(String key) {
|
*/
|
||||||
// return key == null ? null : redisValueOperations.get(key);
|
public String get(String key) {
|
||||||
// }
|
return key == null ? null : redisValueOperations.get(key);
|
||||||
//
|
}
|
||||||
// public <T> T getObject(String key, Class<T> clazz) {
|
|
||||||
// Object json = this.get(key);
|
public <T> T getObject(String key, Class<T> clazz) {
|
||||||
// if (json == null) {
|
Object json = this.get(key);
|
||||||
// return null;
|
if (json == null) {
|
||||||
// }
|
return null;
|
||||||
// T obj = JSON.parseObject(json.toString(), clazz);
|
}
|
||||||
// return obj;
|
T obj = JSON.parseObject(json.toString(), clazz);
|
||||||
// }
|
return obj;
|
||||||
//
|
}
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 普通缓存放入
|
/**
|
||||||
// */
|
* 普通缓存放入
|
||||||
// public void set(String key, String value) {
|
*/
|
||||||
// redisValueOperations.set(key, value);
|
public void set(String key, String value) {
|
||||||
// }
|
redisValueOperations.set(key, value);
|
||||||
// public void set(Object key, Object value) {
|
}
|
||||||
// String jsonString = JSON.toJSONString(value);
|
public void set(Object key, Object value) {
|
||||||
// redisValueOperations.set(key.toString(), jsonString);
|
String jsonString = JSON.toJSONString(value);
|
||||||
// }
|
redisValueOperations.set(key.toString(), jsonString);
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 普通缓存放入
|
/**
|
||||||
// */
|
* 普通缓存放入
|
||||||
// public void set(String key, String value, long second) {
|
*/
|
||||||
// redisValueOperations.set(key, value, second, TimeUnit.SECONDS);
|
public void set(String key, String value, long second) {
|
||||||
// }
|
redisValueOperations.set(key, value, second, TimeUnit.SECONDS);
|
||||||
//
|
}
|
||||||
// /**
|
|
||||||
// * 普通缓存放入并设置时间
|
/**
|
||||||
// */
|
* 普通缓存放入并设置时间
|
||||||
// public void set(Object key, Object value, long time) {
|
*/
|
||||||
// String jsonString = JSON.toJSONString(value);
|
public void set(Object key, Object value, long time) {
|
||||||
// if (time > 0) {
|
String jsonString = JSON.toJSONString(value);
|
||||||
// redisValueOperations.set(key.toString(), jsonString, time, TimeUnit.SECONDS);
|
if (time > 0) {
|
||||||
// } else {
|
redisValueOperations.set(key.toString(), jsonString, time, TimeUnit.SECONDS);
|
||||||
// set(key.toString(), jsonString);
|
} else {
|
||||||
// }
|
set(key.toString(), jsonString);
|
||||||
// }
|
}
|
||||||
//
|
}
|
||||||
// //============================ map =============================
|
|
||||||
// public void mset(String key, String hashKey, Object value) {
|
//============================ map =============================
|
||||||
// redisHashOperations.put(key, hashKey, value);
|
public void mset(String key, String hashKey, Object value) {
|
||||||
// }
|
redisHashOperations.put(key, hashKey, value);
|
||||||
//
|
}
|
||||||
// public Object mget(String key, String hashKey) {
|
|
||||||
// return redisHashOperations.get(key, hashKey);
|
public Object mget(String key, String hashKey) {
|
||||||
// }
|
return redisHashOperations.get(key, hashKey);
|
||||||
//
|
}
|
||||||
//}
|
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user