futian.liu
2023-12-02 8e41786892a4bd7cff2d63bde8cb0636cdb0650c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.consum.base.config;
 
import com.consum.base.FinOrgCacheProvider;
import com.consum.base.FinSysTenantCacheProvider;
import com.consum.base.FinSysTenantUserCacheProvider;
import com.consum.base.TokenCacheProvider;
import com.consum.base.cache.RedisFinOrgCache;
import com.consum.base.cache.RedisFinSysTenantCache;
import com.consum.base.cache.RedisFinSysTenantUserCache;
import com.consum.base.cache.RedisTokenCache;
import com.consum.base.service.FinOrgService;
import com.consum.base.service.FinSysTenantServiceImpl;
import com.consum.base.service.FinSysTenantUserServiceImpl;
import com.iplatform.base.config.CacheConfiguration;
import com.walker.support.redis.RedisHelper;
import com.walker.support.redis.cache.RedisCacheProvider;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
@Configuration
@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "true", matchIfMissing = false)
@ConditionalOnClass({RedisCacheProvider.class})
@AutoConfigureAfter(RedisAutoConfiguration.class)
public class RedisFinCacheConfig extends CacheConfiguration {
 
    /**
     * Redis实现的业务机构缓存配置。
     * @param redisHelper
     * @param finOrgService
     * @return
     * @date 2023-07-05
     */
    @Bean
    public FinOrgCacheProvider finOrgCacheProvider(RedisHelper redisHelper, FinOrgService finOrgService){
        RedisFinOrgCache cache = new RedisFinOrgCache();
        cache.setRedisHelper(redisHelper);
        cache.setFinOrgService(finOrgService);
        return cache;
    }
 
    /**
     * @Description 配置平台登录用户缓存
     * @Author wh
     * @Date 2023/7/18 13:38
     */
    @Bean
    public FinSysTenantUserCacheProvider finSysTenantUserCacheProvider(RedisHelper redisHelper, FinSysTenantUserServiceImpl finSysTenantUserService){
        RedisFinSysTenantUserCache cache = new RedisFinSysTenantUserCache();
        cache.setRedisHelper(redisHelper);
        cache.setFinSysTenantUserService(finSysTenantUserService);
        return cache;
    }
 
    /**
     * @Description 配置平台登录用户缓存
     * @Author wh
     * @Date 2023/7/18 13:38
     */
    @Bean
    public TokenCacheProvider tokenCacheProvider(RedisHelper redisHelper){
        RedisTokenCache cache = new RedisTokenCache();
        cache.setRedisHelper(redisHelper);
        return cache;
    }
 
    /**
     * Redis实现的业务机构缓存配置。
     * @param redisHelper
     * @param finSysTenantService
     * @return
     * @date 2023-07-05
     */
    @Bean
    public FinSysTenantCacheProvider finSysTenantCacheProvider(RedisHelper redisHelper, FinSysTenantServiceImpl finSysTenantService){
        RedisFinSysTenantCache cache = new RedisFinSysTenantCache();
        cache.setRedisHelper(redisHelper);
        cache.setFinSysTenantService(finSysTenantService);
        return cache;
    }
 
}