shikeyin
2024-01-11 65da8373531677b1c37a98f53eaa30c892f35e5a
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
package com.ishop.merchant.config;
 
import com.iplatform.base.FileOperateSpi;
import com.iplatform.base.config.CacheConfiguration;
import com.ishop.merchant.ArticleCategoryCache;
import com.ishop.merchant.CityCacheProvider;
import com.ishop.merchant.ExpressCache;
import com.ishop.merchant.LevelCache;
import com.ishop.merchant.MerCategoryCacheProvider;
import com.ishop.merchant.MerProductCategoryCache;
import com.ishop.merchant.MerTypeCacheProvider;
import com.ishop.merchant.MerchantCache;
import com.ishop.merchant.ProductAttrCache;
import com.ishop.merchant.ProductBrandCache;
import com.ishop.merchant.ProductCache;
import com.ishop.merchant.ProductCategoryCache;
import com.ishop.merchant.UserRegCache;
import com.ishop.merchant.UserRegConfigCache;
import com.ishop.merchant.cache.LocalArticleCateCache;
import com.ishop.merchant.cache.LocalCityCache;
import com.ishop.merchant.cache.LocalExpressCache;
import com.ishop.merchant.cache.LocalLevelCache;
import com.ishop.merchant.cache.LocalMerCategoryCache;
import com.ishop.merchant.cache.LocalMerProductCategoryCache;
import com.ishop.merchant.cache.LocalMerTypeCache;
import com.ishop.merchant.cache.LocalMerchantCache;
import com.ishop.merchant.cache.LocalProductAttrCache;
import com.ishop.merchant.cache.LocalProductBrandCache;
import com.ishop.merchant.cache.LocalProductCache;
import com.ishop.merchant.cache.LocalProductCategoryCache;
import com.ishop.merchant.cache.LocalUserRegCache;
import com.ishop.merchant.cache.LocalUserRegConfigCache;
import com.ishop.merchant.service.ArticleServiceImpl;
import com.ishop.merchant.service.CityServiceImpl;
import com.ishop.merchant.service.ExpressServiceImpl;
import com.ishop.merchant.service.LevelServiceImpl;
import com.ishop.merchant.service.MerchantCategoryServiceImpl;
import com.ishop.merchant.service.MerchantProductCategoryServiceImpl;
import com.ishop.merchant.service.MerchantServiceImpl;
import com.ishop.merchant.service.MerchantTypeServiceImpl;
import com.ishop.merchant.service.ProductAttrServiceImpl;
import com.ishop.merchant.service.ProductBrandServiceImpl;
import com.ishop.merchant.service.ProductCategoryServiceImpl;
import com.ishop.merchant.service.ProductServiceImpl;
import com.ishop.merchant.service.UserRegConfigServiceImpl;
import com.ishop.merchant.service.UserRegisterServiceImpl;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
 
@Configuration
@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "false", matchIfMissing = true)
public class LocalMerchantCacheConfig extends CacheConfiguration {
 
    /**
     * 快递公司缓存
     * @param expressService
     * @return
     * @date 2023-08-20
     */
    @Bean
    public ExpressCache expressCache(ExpressServiceImpl expressService){
        LocalExpressCache cache = new LocalExpressCache();
        cache.setExpressService(expressService);
        return cache;
    }
 
    /**
     * 用户自定义配置缓存
     * @param userRegConfigService
     * @return
     * @date 2023-08-06
     */
    @Bean
    public UserRegConfigCache userRegConfigCache(UserRegConfigServiceImpl userRegConfigService){
        LocalUserRegConfigCache cache = new LocalUserRegConfigCache();
        cache.setUserRegConfigService(userRegConfigService);
        return cache;
    }
 
    /**
     * 商品基本信息缓存
     * @param productService
     * @return
     * @date 2023-07-30
     */
    @Bean
    public ProductCache productCache(ProductServiceImpl productService){
        LocalProductCache cache = new LocalProductCache();
        cache.setProductService(productService);
        return cache;
    }
 
    @Bean
    public ArticleCategoryCache articleCategoryCache(ArticleServiceImpl articleService){
        LocalArticleCateCache cache = new LocalArticleCateCache();
        cache.setArticleService(articleService);
        return cache;
    }
 
    /**
     * 系统用户等级定义缓存。
     * @param levelService
     * @return
     * @date 2023-06-30
     */
    @Bean
    public LevelCache levelCache(LevelServiceImpl levelService){
        LocalLevelCache cache = new LocalLevelCache();
        cache.setLevelService(levelService);
        return cache;
    }
 
    @Bean
    public CityCacheProvider cityCacheProvider(CityServiceImpl cityService){
        LocalCityCache cache = new LocalCityCache();
        cache.setCityService(cityService);
        return cache;
    }
 
    @Bean
    public UserRegCache userRegCache(UserRegisterServiceImpl userRegisterService){
        LocalUserRegCache cache = new LocalUserRegCache();
        cache.setUserRegisterService(userRegisterService);
        return cache;
    }
 
    /**
     * 商户商品分类缓存。
     * @param merchantProductCategoryService
     * @return
     * @date 2023-06-16
     */
    @Bean
    public MerProductCategoryCache merProductCategoryCache(MerchantProductCategoryServiceImpl merchantProductCategoryService){
        LocalMerProductCategoryCache cache = new LocalMerProductCategoryCache();
        cache.setMerchantProductCategoryService(merchantProductCategoryService);
        return cache;
    }
 
    /**
     * 商品属性定义缓存,注意:这是个集合缓存,与之前Hash缓存不同。
     * @param productAttrService
     * @return
     * @date 2023-06-14
     */
    @Bean
    public ProductAttrCache productAttrCache(ProductAttrServiceImpl productAttrService){
        LocalProductAttrCache cache = new LocalProductAttrCache();
        cache.setProductAttrService(productAttrService);
        return cache;
    }
 
    @Bean
    public MerchantCache merchantCache(MerchantServiceImpl merchantService){
        LocalMerchantCache cache = new LocalMerchantCache();
        cache.setMerchantService(merchantService);
        return cache;
    }
 
    @Bean
    public ProductBrandCache productBrandCache(ProductBrandServiceImpl productBrandService){
        LocalProductBrandCache cache = new LocalProductBrandCache();
        cache.setProductBrandService(productBrandService);
        return cache;
    }
 
    @Bean
    public ProductCategoryCache productCategoryCache(ProductCategoryServiceImpl productCategoryService
            , FileOperateSpi fileOperateSpi){
        LocalProductCategoryCache cache = new LocalProductCategoryCache();
        cache.setProductCategoryService(productCategoryService);
        cache.setCdnUrl(fileOperateSpi.getCdnUrl());
        return cache;
    }
 
    /**
     * 商户分类缓存定义。
     * @param merchantCategoryService
     * @return
     * @date 2023-06-06
     */
    @Bean
    public MerCategoryCacheProvider merCategoryCacheProvider(MerchantCategoryServiceImpl merchantCategoryService){
        LocalMerCategoryCache cache = new LocalMerCategoryCache();
        cache.setMerchantCategoryService(merchantCategoryService);
        return cache;
    }
 
    @Bean
    public MerTypeCacheProvider merTypeCacheProvider(MerchantTypeServiceImpl merchantTypeService){
        LocalMerTypeCache cache = new LocalMerTypeCache();
        cache.setMerchantTypeService(merchantTypeService);
        return cache;
    }
}