mirror of https://gitee.com/stylefeng/roses
【7.0.4】【c】更新C端用户个人信息获取
parent
e4022ecc3f
commit
12998583cf
|
@ -46,7 +46,7 @@ public enum WrapperExceptionEnum implements AbstractExceptionEnum {
|
||||||
/**
|
/**
|
||||||
* 字段包装转化异常
|
* 字段包装转化异常
|
||||||
*/
|
*/
|
||||||
TRANSFER_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + WrapperConstants.WRAPPER_EXCEPTION_STEP_CODE + "02", "字段包装转化异常");
|
TRANSFER_ERROR(RuleConstants.BUSINESS_ERROR_TYPE_CODE + WrapperConstants.WRAPPER_EXCEPTION_STEP_CODE + "02", "字段包装转化异常,具体信息:{}");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 错误编码
|
* 错误编码
|
||||||
|
|
|
@ -213,7 +213,7 @@ public class WrapperAop {
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("原始对象包装过程,字段转化异常:{}", e.getMessage());
|
log.error("原始对象包装过程,字段转化异常:{}", e.getMessage());
|
||||||
throw new WrapperException(WrapperExceptionEnum.TRANSFER_ERROR);
|
throw new WrapperException(WrapperExceptionEnum.TRANSFER_ERROR, e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return originMap;
|
return originMap;
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
*/
|
*/
|
||||||
package cn.stylefeng.roses.kernel.customer.api;
|
package cn.stylefeng.roses.kernel.customer.api;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C端用户api
|
* C端用户api
|
||||||
*
|
*
|
||||||
|
@ -32,5 +34,12 @@ package cn.stylefeng.roses.kernel.customer.api;
|
||||||
*/
|
*/
|
||||||
public interface CustomerApi {
|
public interface CustomerApi {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取C端用户的详细信息
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/6/8 21:25
|
||||||
|
*/
|
||||||
|
CustomerInfo getCustomerInfoById(Long customerId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,4 +42,9 @@ public interface CustomerConstants {
|
||||||
*/
|
*/
|
||||||
String CUSTOMER_EXCEPTION_STEP_CODE = "31";
|
String CUSTOMER_EXCEPTION_STEP_CODE = "31";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C端用户的缓存
|
||||||
|
*/
|
||||||
|
String CUSTOMER_CACHE_PREFIX = "customer:";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,4 +51,34 @@ public class CustomerConfigExpander {
|
||||||
return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_RESET_PWD_EMAIL_CONTENT", String.class, "您的验证码是【{}】,此验证码用于修改登录密码,请不要泄露给他人,如果不是您本人操作,请忽略此邮件。");
|
return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_RESET_PWD_EMAIL_CONTENT", String.class, "您的验证码是【{}】,此验证码用于修改登录密码,请不要泄露给他人,如果不是您本人操作,请忽略此邮件。");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存放用户头像的bucket的名称
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/6/7 15:42
|
||||||
|
*/
|
||||||
|
public static String getCustomerBucket() {
|
||||||
|
return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_FILE_BUCKET", String.class, "customer-bucket");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存放用户头像的bucket的名称的过期时间
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/6/7 15:42
|
||||||
|
*/
|
||||||
|
public static Long getCustomerBucketExpiredSeconds() {
|
||||||
|
return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_FILE_BUCKET_EXPIRED_SECONDS", Long.class, 600L);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户缓存的过期时间
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/6/7 15:42
|
||||||
|
*/
|
||||||
|
public static Long getCustomerCacheExpiredSeconds() {
|
||||||
|
return ConfigContext.me().getSysConfigValueWithDefault("CUSTOMER_CACHE_EXPIRED_SECONDS", Long.class, 3600L);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
package cn.stylefeng.roses.kernel.customer.api.pojo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息封装
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/6/8 21:23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CustomerInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private Long customerId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 账号
|
||||||
|
*/
|
||||||
|
private String account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 昵称(显示名称)
|
||||||
|
*/
|
||||||
|
private String nickName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邮箱
|
||||||
|
*/
|
||||||
|
private String email;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 手机
|
||||||
|
*/
|
||||||
|
private String telephone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像(文件表id)
|
||||||
|
*/
|
||||||
|
private Long avatar;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户头像的全部url
|
||||||
|
*/
|
||||||
|
private String avatarObjectUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户积分
|
||||||
|
*/
|
||||||
|
private Integer score;
|
||||||
|
|
||||||
|
}
|
|
@ -86,6 +86,34 @@
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--缓存api-->
|
||||||
|
<!--用户的查询会使用缓存-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>cache-api</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>cache-sdk-memory</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>cache-sdk-redis</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--文件操作的api-->
|
||||||
|
<!--用在用户头像等文件的操作-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>file-api</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||||
|
*
|
||||||
|
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||||
|
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||||
|
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||||
|
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||||
|
*/
|
||||||
|
package cn.stylefeng.roses.kernel.customer.modular.cache;
|
||||||
|
|
||||||
|
import cn.hutool.cache.impl.TimedCache;
|
||||||
|
import cn.stylefeng.roses.kernel.cache.memory.AbstractMemoryCacheOperator;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.constants.CustomerConstants;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C端用户的缓存
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/2/28 10:23
|
||||||
|
*/
|
||||||
|
public class CustomerMemoryCache extends AbstractMemoryCacheOperator<CustomerInfo> {
|
||||||
|
|
||||||
|
public CustomerMemoryCache(TimedCache<String, CustomerInfo> timedCache) {
|
||||||
|
super(timedCache);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommonKeyPrefix() {
|
||||||
|
return CustomerConstants.CUSTOMER_CACHE_PREFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* Copyright [2020-2030] [https://www.stylefeng.cn]
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*
|
||||||
|
* Guns采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
|
||||||
|
*
|
||||||
|
* 1.请不要删除和修改根目录下的LICENSE文件。
|
||||||
|
* 2.请不要删除和修改Guns源码头部的版权声明。
|
||||||
|
* 3.请保留源码和相关描述文件的项目出处,作者声明等。
|
||||||
|
* 4.分发源码时候,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 5.在修改包名,模块名称,项目代码等时,请注明软件出处 https://gitee.com/stylefeng/guns
|
||||||
|
* 6.若您的项目无法满足以上几点,可申请商业授权
|
||||||
|
*/
|
||||||
|
package cn.stylefeng.roses.kernel.customer.modular.cache;
|
||||||
|
|
||||||
|
import cn.stylefeng.roses.kernel.cache.redis.AbstractRedisCacheOperator;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.constants.CustomerConstants;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfo;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C端用户的缓存
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/2/28 10:23
|
||||||
|
*/
|
||||||
|
public class CustomerRedisCache extends AbstractRedisCacheOperator<CustomerInfo> {
|
||||||
|
|
||||||
|
public CustomerRedisCache(RedisTemplate<String, CustomerInfo> redisTemplate) {
|
||||||
|
super(redisTemplate);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCommonKeyPrefix() {
|
||||||
|
return CustomerConstants.CUSTOMER_CACHE_PREFIX;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package cn.stylefeng.roses.kernel.customer.modular.service;
|
||||||
|
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest;
|
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse;
|
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.CustomerApi;
|
||||||
import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
|
import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
|
||||||
import cn.stylefeng.roses.kernel.customer.modular.request.CustomerRequest;
|
import cn.stylefeng.roses.kernel.customer.modular.request.CustomerRequest;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
|
@ -15,7 +16,7 @@ import java.util.List;
|
||||||
* @author fengshuonan
|
* @author fengshuonan
|
||||||
* @date 2021/06/07 11:40
|
* @date 2021/06/07 11:40
|
||||||
*/
|
*/
|
||||||
public interface CustomerService extends IService<Customer> {
|
public interface CustomerService extends IService<Customer>, CustomerApi {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注册用户
|
* 注册用户
|
||||||
|
|
|
@ -11,8 +11,11 @@ import cn.stylefeng.roses.kernel.auth.api.password.PasswordStoredEncryptApi;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest;
|
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginRequest;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse;
|
import cn.stylefeng.roses.kernel.auth.api.pojo.auth.LoginResponse;
|
||||||
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
import cn.stylefeng.roses.kernel.auth.api.pojo.login.LoginUser;
|
||||||
|
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||||
import cn.stylefeng.roses.kernel.customer.api.exception.CustomerException;
|
import cn.stylefeng.roses.kernel.customer.api.exception.CustomerException;
|
||||||
import cn.stylefeng.roses.kernel.customer.api.exception.enums.CustomerExceptionEnum;
|
import cn.stylefeng.roses.kernel.customer.api.exception.enums.CustomerExceptionEnum;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.expander.CustomerConfigExpander;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfo;
|
||||||
import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
|
import cn.stylefeng.roses.kernel.customer.modular.entity.Customer;
|
||||||
import cn.stylefeng.roses.kernel.customer.modular.factory.CustomerFactory;
|
import cn.stylefeng.roses.kernel.customer.modular.factory.CustomerFactory;
|
||||||
import cn.stylefeng.roses.kernel.customer.modular.mapper.CustomerMapper;
|
import cn.stylefeng.roses.kernel.customer.modular.mapper.CustomerMapper;
|
||||||
|
@ -23,6 +26,7 @@ import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
|
||||||
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
|
||||||
import cn.stylefeng.roses.kernel.email.api.MailSenderApi;
|
import cn.stylefeng.roses.kernel.email.api.MailSenderApi;
|
||||||
import cn.stylefeng.roses.kernel.email.api.pojo.SendMailParam;
|
import cn.stylefeng.roses.kernel.email.api.pojo.SendMailParam;
|
||||||
|
import cn.stylefeng.roses.kernel.file.api.FileOperatorApi;
|
||||||
import cn.stylefeng.roses.kernel.jwt.api.context.JwtContext;
|
import cn.stylefeng.roses.kernel.jwt.api.context.JwtContext;
|
||||||
import cn.stylefeng.roses.kernel.jwt.api.pojo.payload.DefaultJwtPayload;
|
import cn.stylefeng.roses.kernel.jwt.api.pojo.payload.DefaultJwtPayload;
|
||||||
import cn.stylefeng.roses.kernel.log.api.LoginLogServiceApi;
|
import cn.stylefeng.roses.kernel.log.api.LoginLogServiceApi;
|
||||||
|
@ -73,6 +77,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||||
@Resource
|
@Resource
|
||||||
private LoginLogServiceApi loginLogServiceApi;
|
private LoginLogServiceApi loginLogServiceApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private CacheOperatorApi<CustomerInfo> customerInfoCacheOperatorApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FileOperatorApi fileOperatorApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void reg(CustomerRequest customerRequest) {
|
public void reg(CustomerRequest customerRequest) {
|
||||||
|
@ -250,6 +260,38 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||||
return this.list(wrapper);
|
return this.list(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CustomerInfo getCustomerInfoById(Long customerId) {
|
||||||
|
|
||||||
|
// 查询缓存中有没有用户信息
|
||||||
|
String customerIdKey = String.valueOf(customerId);
|
||||||
|
CustomerInfo customerInfo = customerInfoCacheOperatorApi.get(customerIdKey);
|
||||||
|
if (customerInfo != null) {
|
||||||
|
return customerInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取C端用户详情
|
||||||
|
Customer customer = this.getById(customerId);
|
||||||
|
if (customer == null) {
|
||||||
|
throw new CustomerException(CustomerExceptionEnum.CANT_FIND_CUSTOMER, customerId);
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomerInfo result = new CustomerInfo();
|
||||||
|
BeanUtil.copyProperties(customer, result);
|
||||||
|
|
||||||
|
// 获取头像的url
|
||||||
|
String fileAuthUrl = fileOperatorApi.getFileAuthUrl(
|
||||||
|
CustomerConfigExpander.getCustomerBucket(),
|
||||||
|
customer.getAvatarObjectName(),
|
||||||
|
CustomerConfigExpander.getCustomerBucketExpiredSeconds());
|
||||||
|
result.setAvatarObjectUrl(fileAuthUrl);
|
||||||
|
|
||||||
|
// 放入缓存用户信息
|
||||||
|
customerInfoCacheOperatorApi.put(customerIdKey, result, CustomerConfigExpander.getCustomerCacheExpiredSeconds());
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取信息
|
* 获取信息
|
||||||
*
|
*
|
||||||
|
@ -319,4 +361,5 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -24,6 +24,13 @@
|
||||||
<version>${roses.version}</version>
|
<version>${roses.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!--默认内存缓存使用-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.stylefeng.roses</groupId>
|
||||||
|
<artifactId>cache-sdk-memory</artifactId>
|
||||||
|
<version>${roses.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -24,6 +24,14 @@
|
||||||
*/
|
*/
|
||||||
package cn.stylefeng.roses.kernel.customer.starter;
|
package cn.stylefeng.roses.kernel.customer.starter;
|
||||||
|
|
||||||
|
import cn.hutool.cache.CacheUtil;
|
||||||
|
import cn.hutool.cache.impl.TimedCache;
|
||||||
|
import cn.stylefeng.roses.kernel.cache.api.CacheOperatorApi;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.expander.CustomerConfigExpander;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.api.pojo.CustomerInfo;
|
||||||
|
import cn.stylefeng.roses.kernel.customer.modular.cache.CustomerMemoryCache;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,4 +43,17 @@ import org.springframework.context.annotation.Configuration;
|
||||||
@Configuration
|
@Configuration
|
||||||
public class GunsCustomerAutoConfiguration {
|
public class GunsCustomerAutoConfiguration {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C端用户的缓存
|
||||||
|
*
|
||||||
|
* @author fengshuonan
|
||||||
|
* @date 2021/6/8 22:41
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
@ConditionalOnMissingBean(name = "customerInfoCacheOperatorApi")
|
||||||
|
public CacheOperatorApi<CustomerInfo> customerInfoCacheOperatorApi() {
|
||||||
|
TimedCache<String, CustomerInfo> customerInfoTimedCache = CacheUtil.newTimedCache(CustomerConfigExpander.getCustomerCacheExpiredSeconds() * 1000);
|
||||||
|
return new CustomerMemoryCache(customerInfoTimedCache);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue