wks 1 год назад
Родитель
Сommit
3c937a9137

+ 0 - 22
src/main/java/com/ydtech/config/MvcConfig.java

@@ -31,8 +31,6 @@ import java.util.stream.Collectors;
 @Configuration
 @Configuration
 public class MvcConfig implements WebMvcConfigurer {
 public class MvcConfig implements WebMvcConfigurer {
 
 
-    @Resource
-    private WechatOpenProperties wechatOpenProperties;
 
 
     @Value("${apk.path}")
     @Value("${apk.path}")
     private String apkPath;
     private String apkPath;
@@ -97,26 +95,6 @@ public class MvcConfig implements WebMvcConfigurer {
         registry.addResourceHandler(uploadFileUrl + "**").addResourceLocations("file:" + uploadFilePath);
         registry.addResourceHandler(uploadFileUrl + "**").addResourceLocations("file:" + uploadFilePath);
     }
     }
 
 
-    @Bean
-    public Map<String, WxMpService> wxMpService() {
-        Map<String, WxMpDefaultConfigImpl> collect = wechatOpenProperties.getProperties().keySet()
-                .stream()
-                .collect(Collectors.toMap(x->x, x -> {
-                    WechatOpenProperties.PropertiesDto propertiesDto = wechatOpenProperties.getProperties().get(x);
-                    WxMpDefaultConfigImpl wxMpDefaultConfig = new WxMpDefaultConfigImpl();
-                    wxMpDefaultConfig.setAppId(propertiesDto.getComponentAppId());
-                    wxMpDefaultConfig.setSecret(propertiesDto.getComponentSecret());
-                    return wxMpDefaultConfig;
-                }));
-
-        return collect.keySet().stream().collect(Collectors.toMap(x -> x, x -> {
-            WxMpServiceImpl wxMpService = new WxMpServiceImpl();
-            WxMpDefaultConfigImpl wxMpDefaultConfig = collect.get(x);
-            wxMpService.setWxMpConfigStorage(wxMpDefaultConfig);
-            return wxMpService;
-        }));
-    }
-
     @Bean
     @Bean
     public PaginationInnerInterceptor paginationInnerInterceptor() {
     public PaginationInnerInterceptor paginationInnerInterceptor() {
         PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
         PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();

+ 61 - 1
src/main/java/com/ydtech/config/WechatWorkConfig.java

@@ -1,12 +1,30 @@
 package com.ydtech.config;
 package com.ydtech.config;
 
 
+import com.ydtech.config.properties.WechatCustomerProperties;
+import com.ydtech.config.properties.WechatOpenProperties;
+import me.chanjar.weixin.cp.api.WxCpKfService;
 import me.chanjar.weixin.cp.api.WxCpService;
 import me.chanjar.weixin.cp.api.WxCpService;
+import me.chanjar.weixin.cp.api.impl.WxCpKfServiceImpl;
 import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
 import me.chanjar.weixin.cp.api.impl.WxCpServiceImpl;
 import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
 import me.chanjar.weixin.cp.config.impl.WxCpDefaultConfigImpl;
+import me.chanjar.weixin.mp.api.WxMpService;
+import me.chanjar.weixin.mp.api.impl.WxMpServiceImpl;
+import me.chanjar.weixin.mp.config.impl.WxMpDefaultConfigImpl;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
 
 
+import javax.annotation.Resource;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+
+/**
+ * @version
+ * @description: 微信相关配置
+ * @author: wenks
+ * @date: 2024/11/27 15:01
+ **/
 @Configuration
 @Configuration
 public class WechatWorkConfig {
 public class WechatWorkConfig {
 
 
@@ -17,13 +35,55 @@ public class WechatWorkConfig {
     @Value("${wechat.cp.agent-id}")
     @Value("${wechat.cp.agent-id}")
     private Integer agentId;
     private Integer agentId;
 
 
+    @Resource
+    private WechatOpenProperties wechatOpenProperties;
+
+    @Resource
+    private WechatCustomerProperties wechatCustomerProperties;
+
     @Bean
     @Bean
     public WxCpService wxCpService() {
     public WxCpService wxCpService() {
         WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
         WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
         config.setCorpId(corpId);
         config.setCorpId(corpId);
         config.setCorpSecret(secret);
         config.setCorpSecret(secret);
         config.setAgentId(agentId);
         config.setAgentId(agentId);
-
+        WxCpServiceImpl wxCpService = new WxCpServiceImpl();
+        wxCpService.setWxCpConfigStorage(config);
         return new WxCpServiceImpl();
         return new WxCpServiceImpl();
     }
     }
+
+    @Bean
+    public Map<String, WxMpService> wxMpService() {
+        Map<String, WxMpDefaultConfigImpl> collect = wechatOpenProperties.getProperties().keySet()
+                .stream()
+                .collect(Collectors.toMap(x->x, x -> {
+                    WechatOpenProperties.PropertiesDto propertiesDto = wechatOpenProperties.getProperties().get(x);
+                    WxMpDefaultConfigImpl wxMpDefaultConfig = new WxMpDefaultConfigImpl();
+                    wxMpDefaultConfig.setAppId(propertiesDto.getComponentAppId());
+                    wxMpDefaultConfig.setSecret(propertiesDto.getComponentSecret());
+                    return wxMpDefaultConfig;
+                }));
+
+        return collect.keySet().stream().collect(Collectors.toMap(x -> x, x -> {
+            WxMpServiceImpl wxMpService = new WxMpServiceImpl();
+            WxMpDefaultConfigImpl wxMpDefaultConfig = collect.get(x);
+            wxMpService.setWxMpConfigStorage(wxMpDefaultConfig);
+            return wxMpService;
+        }));
+    }
+
+
+    @Bean
+    public WxCpKfService wxCpKfService(){
+        WxCpDefaultConfigImpl config = new WxCpDefaultConfigImpl();
+        config.setCorpId(corpId);
+        config.setCorpSecret(wechatCustomerProperties.getSecret());
+        config.setToken(wechatCustomerProperties.getToken());
+        config.setAesKey(wechatCustomerProperties.getEncodingAesKey());
+        WxCpServiceImpl wxCpService = new WxCpServiceImpl();
+        wxCpService.setWxCpConfigStorage(config);
+        return new WxCpKfServiceImpl(wxCpService());
+    }
+
+
 }
 }

+ 4 - 0
src/main/java/com/ydtech/config/properties/WechatCustomerProperties.java

@@ -15,6 +15,10 @@ import org.springframework.stereotype.Component;
 @ConfigurationProperties(prefix = "wechat.customer")
 @ConfigurationProperties(prefix = "wechat.customer")
 public class WechatCustomerProperties {
 public class WechatCustomerProperties {
 
 
+    private String corpId;
+
+    private String secret;
+
     private String token;
     private String token;
 
 
     private String encodingAesKey;
     private String encodingAesKey;

+ 48 - 0
src/main/java/com/ydtech/modules/admin/components/WechatCustomerComponents.java

@@ -0,0 +1,48 @@
+package com.ydtech.modules.admin.components;
+
+
+import com.ydtech.config.properties.WechatCustomerProperties;
+import com.ydtech.modules.admin.components.wechat.customer.request.CustomerGetTokenRequest;
+import com.ydtech.modules.admin.components.wechat.customer.response.CustomerGetTokenResponse;
+import com.ydtech.modules.admin.constants.WechatCustomerEnum;
+import com.ydtech.modules.order.constants.OrderCacheConstant;
+import com.ydtech.modules.protocol.utils.AssertionUtils;
+import com.ydtech.utils.cache.BaseCacheConfig;
+import com.ydtech.utils.cache.RedissonUtils;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+
+import java.util.concurrent.TimeUnit;
+
+@Component
+@RequiredArgsConstructor
+public class WechatCustomerComponents {
+
+    private final RestTemplate restTemplate;
+
+    private final WechatCustomerProperties wechatCustomerProperties;
+
+    private final RedissonUtils redissonUtils;
+
+    /**
+     * 获取调用凭证access_token
+     *
+     * @return access_token
+     */
+    public String getToken() {
+        return redissonUtils.getFromRedis(() -> {
+            CustomerGetTokenRequest customerGetTokenRequest = new CustomerGetTokenRequest(wechatCustomerProperties.getCorpId(), wechatCustomerProperties.getSecret());
+            String url = WechatCustomerEnum.URL + customerGetTokenRequest;
+            CustomerGetTokenResponse customerGetTokenResponse = restTemplate.getForObject(url, CustomerGetTokenResponse.class);
+            AssertionUtils.isEmpty(customerGetTokenResponse, "获取调用凭证access_token异常");
+            String accessToken = customerGetTokenResponse.getAccessToken();
+            return new BaseCacheConfig<String>()
+                    .setExpiresIn(customerGetTokenResponse.getExpiresIn())
+                    .setTimeUnit(TimeUnit.SECONDS)
+                    .setData(accessToken);
+        }, OrderCacheConstant.WECHAT_CUSTOMER_TOKEN);
+    }
+
+
+}

+ 28 - 0
src/main/java/com/ydtech/modules/admin/components/wechat/customer/request/CustomerGetTokenRequest.java

@@ -0,0 +1,28 @@
+package com.ydtech.modules.admin.components.wechat.customer.request;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+/**
+ * @version
+ * @description: 微信客服 获取调用凭证access_token
+ * @author: wenks
+ * @date: 2024/11/27 18:03
+ **/
+@NoArgsConstructor
+@AllArgsConstructor
+@Data
+public class CustomerGetTokenRequest {
+
+    private String corpId;
+
+    private String corpSecret;
+
+    public String getUrlParams(){
+        return "corpid=" + corpId + "&corpsecret=" + corpSecret;
+    }
+
+
+
+}

+ 44 - 0
src/main/java/com/ydtech/modules/admin/components/wechat/customer/response/CustomerGetTokenResponse.java

@@ -0,0 +1,44 @@
+package com.ydtech.modules.admin.components.wechat.customer.response;
+
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+
+
+/**
+ * @version
+ * @description: 微信客服 获取调用凭证access_token
+ * @author: wenks
+ * @date: 2024/11/27 18:01
+ **/
+@NoArgsConstructor
+@Data
+public class CustomerGetTokenResponse {
+
+    /**
+     * 出错返回码,为0表示成功,非0表示调用失败
+     */
+    @JsonProperty("errcode")
+    private Integer errcode;
+
+    /**
+     * 返回码提示语
+     */
+    @JsonProperty("errmsg")
+    private String errmsg;
+
+    /**
+     * 获取到的凭证,最长为512字节
+     */
+    @JsonProperty("access_token")
+    private String accessToken;
+
+    /**
+     * 凭证的有效时间(秒)
+     */
+    @JsonProperty("expires_in")
+    private Integer expiresIn;
+
+}

+ 29 - 0
src/main/java/com/ydtech/modules/admin/constants/WechatCustomerEnum.java

@@ -0,0 +1,29 @@
+package com.ydtech.modules.admin.constants;
+
+import lombok.AllArgsConstructor;
+import lombok.Getter;
+
+/**
+ * @description: 微信客服api
+ * @author: wenks
+ * @date: 2024/11/27 17:41
+ **/
+@Getter
+@AllArgsConstructor
+public enum WechatCustomerEnum {
+
+
+    GET_ACCESS_TOKEN("获取调用凭证access_token", "/cgi-bin/gettoken"),
+    LIST("获取客服账号列表", "/cgi-bin/kf/account/list"),
+    ADD_CONTACT_WAY("获取客服账号链接", "/cgi-bin/kf/add_contact_way"),
+    SYNC_MSG("获取消息", "/cgi-bin/kf/sync_msg"),
+    SEND_MSG_ON_EVENT("发送客服欢迎语", "/cgi-bin/kf/send_msg_on_event"),
+    ;
+
+    private final String desc;
+
+    private final String uri;
+
+    public final static String URL = "https://qyapi.weixin.qq.com";
+
+}

+ 42 - 34
src/main/java/com/ydtech/modules/admin/controller/WechatController.java

@@ -1,36 +1,37 @@
 package com.ydtech.modules.admin.controller;
 package com.ydtech.modules.admin.controller;
 
 
-import cn.hutool.core.codec.Base64;
-import cn.hutool.crypto.SecureUtil;
-import cn.hutool.crypto.symmetric.AES;
+import cn.hutool.core.util.XmlUtil;
+import com.alibaba.fastjson.JSON;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.dataformat.xml.XmlMapper;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.core.page.HttpResult;
 import com.ydtech.exception.SystemException;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.admin.model.vo.WechatBindVo;
 import com.ydtech.modules.admin.model.vo.WechatBindVo;
 import com.ydtech.modules.admin.model.vo.WechatLoginVo;
 import com.ydtech.modules.admin.model.vo.WechatLoginVo;
 import com.ydtech.modules.admin.model.vo.WechatVo;
 import com.ydtech.modules.admin.model.vo.WechatVo;
+import com.ydtech.modules.admin.model.vo.wechat.WechatCustomerCallbackVo;
+import com.ydtech.modules.admin.model.vo.wechat.WechatEncryptVo;
 import com.ydtech.modules.admin.service.WechatService;
 import com.ydtech.modules.admin.service.WechatService;
 import com.ydtech.modules.base.controller.BaseController;
 import com.ydtech.modules.base.controller.BaseController;
-import com.ydtech.modules.order.utils.AESUtilsWithDataBase;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.models.Xml;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import lombok.Data;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 import lombok.NoArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import me.chanjar.weixin.common.error.WxErrorException;
 import me.chanjar.weixin.common.error.WxErrorException;
+import me.chanjar.weixin.common.util.crypto.WxCryptUtil;
+import me.chanjar.weixin.cp.api.WxCpKfService;
+import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgListResp;
+import me.chanjar.weixin.cp.bean.kf.WxCpKfMsgSendRequest;
+import me.chanjar.weixin.cp.util.crypto.WxCpCryptUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServletRequest;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Set;
+import java.util.List;
 
 
 @Api(tags = "微信业务")
 @Api(tags = "微信业务")
 @Slf4j
 @Slf4j
@@ -64,32 +65,39 @@ public class WechatController extends BaseController {
         }
         }
     }
     }
 
 
-    @Data
-    @AllArgsConstructor
-    @NoArgsConstructor
-    public static class Test {
-
-        private String msgSignature;
-
-        private String timestamp;
-
-        private String nonce;
-
-        private String echostr;
-
-    }
-
     @GetMapping(path = "/customer/callback")
     @GetMapping(path = "/customer/callback")
     @ApiOperation(value = "客服回调")
     @ApiOperation(value = "客服回调")
-    public HttpResult<String> customerCallback(@RequestParam(value = "msg_signature") String msgSignature,
+    public String customerCallback(@RequestParam(value = "msg_signature") String msgSignature,
                                                @RequestParam(value = "timestamp") String timestamp,
                                                @RequestParam(value = "timestamp") String timestamp,
                                                @RequestParam(value = "nonce") String nonce,
                                                @RequestParam(value = "nonce") String nonce,
                                                @RequestParam(value = "echostr") String echoStr) {
                                                @RequestParam(value = "echostr") String echoStr) {
         System.out.println(msgSignature + " " + timestamp + " " + nonce + " " + echoStr);
         System.out.println(msgSignature + " " + timestamp + " " + nonce + " " + echoStr);
-//        HBme3ASL
-//        kv1XrZqTDUup27rVatFG3s04DSw2qEAvxg7k9euEROq
-//        f1bfbc5dad67cee5ff28b97ee030188c443e12d7 1732671302 1732293939 GOqO+iXVYx2FBoD0uzjwkNcTBEyvOeKKfLkShKrgvQ0GWmAM3cVB4NxXf4KB5w3IDO37yIb8M+9pfSD/xzlwNQ==
-        return HttpResult.ok();
+        WxCryptUtil wxCryptUtil = new WxCryptUtil("HBme3ASL", "kv1XrZqTDUup27rVatFG3s04DSw2qEAvxg7k9euEROq", "wwfe67d19509d43ec5");
+        return wxCryptUtil.decryptContent(msgSignature, timestamp, nonce, echoStr);
     }
     }
 
 
+    @Autowired
+    public WxCpKfService wxCpKfService;
+
+    @PostMapping(path = "/customer/callback", consumes = MediaType.TEXT_XML_VALUE, produces = MediaType.TEXT_XML_VALUE)
+    @ApiOperation(value = "客服回调")
+    public HttpResult customerCallback(@RequestBody String wechatEncrypt) throws JsonProcessingException, WxErrorException {
+        XmlMapper xmlMapper = new XmlMapper();
+        WechatEncryptVo wechatEncryptVo = xmlMapper.readValue(wechatEncrypt, WechatEncryptVo.class);
+        WxCryptUtil wxCryptUtil = new WxCryptUtil("HBme3ASL", "kv1XrZqTDUup27rVatFG3s04DSw2qEAvxg7k9euEROq", "wwfe67d19509d43ec5");
+        String encrypt = wxCryptUtil.decrypt(wechatEncryptVo.getEncrypt());
+        WechatCustomerCallbackVo wechatCustomerCallbackVo = xmlMapper.readValue(encrypt, WechatCustomerCallbackVo.class);
+        WxCpKfMsgListResp wxCpKfMsgListResp = wxCpKfService.syncMsg("", wechatCustomerCallbackVo.getToken(), null, null, wechatCustomerCallbackVo.getOpenKfId());
+        WxCpKfMsgListResp.WxCpKfMsgItem wxCpKfMsgItem = wxCpKfMsgListResp.getMsgList().get(0);
+
+        WxCpKfMsgSendRequest wxCpKfMsgSendRequest = new WxCpKfMsgSendRequest();
+        wxCpKfMsgSendRequest.setMsgType("text");
+        wxCpKfMsgSendRequest.setMsgId(wxCpKfMsgItem.getMsgId());
+        wxCpKfMsgSendRequest.setCode(wxCpKfMsgItem.getEvent().getWelcomeCode());
+        wxCpKfService.sendMsgOnEvent(wxCpKfMsgSendRequest);
+
+        return HttpResult.ok(wxCpKfMsgListResp);
+    }
+
+
 }
 }

+ 1 - 1
src/main/java/com/ydtech/modules/admin/model/vo/WechatCustomerCallbackVo.java → src/main/java/com/ydtech/modules/admin/model/vo/wechat/WechatCustomerCallbackVo.java

@@ -1,4 +1,4 @@
-package com.ydtech.modules.admin.model.vo;
+package com.ydtech.modules.admin.model.vo.wechat;
 
 
 
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;

+ 24 - 0
src/main/java/com/ydtech/modules/admin/model/vo/wechat/WechatEncryptVo.java

@@ -0,0 +1,24 @@
+package com.ydtech.modules.admin.model.vo.wechat;
+
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+@AllArgsConstructor
+@NoArgsConstructor
+@Data
+@JacksonXmlRootElement(localName = "xml")
+public class WechatEncryptVo {
+
+    @JacksonXmlProperty(localName = "ToUserName")
+    private String toUserName;
+
+    @JacksonXmlProperty(localName = "Encrypt")
+    private String encrypt;
+
+    @JacksonXmlProperty(localName = "AgentID")
+    private String agentID;
+
+}

+ 5 - 1
src/main/java/com/ydtech/modules/order/constants/OrderCacheConstant.java

@@ -99,7 +99,6 @@ public class OrderCacheConstant {
     public static final String CT_ACCESS_LOCK = "ct:accessLock:";
     public static final String CT_ACCESS_LOCK = "ct:accessLock:";
 
 
 
 
-
     /**
     /**
      * 紫金财险 为接入方提供获取token时间
      * 紫金财险 为接入方提供获取token时间
      */
      */
@@ -110,4 +109,9 @@ public class OrderCacheConstant {
      */
      */
     public static final long CT_ACCESS_TOKEN_TIME = 238;
     public static final long CT_ACCESS_TOKEN_TIME = 238;
 
 
+    /**
+     * 微信客服token
+     */
+    public static final String WECHAT_CUSTOMER_TOKEN = "WECHAT:CUSTOMER:TOKEN";
+
 }
 }

+ 25 - 0
src/main/java/com/ydtech/utils/cache/BaseCacheConfig.java

@@ -0,0 +1,25 @@
+package com.ydtech.utils.cache;
+
+
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.util.concurrent.TimeUnit;
+
+
+@Data
+@Accessors(chain = true)
+@AllArgsConstructor
+@NoArgsConstructor
+public class BaseCacheConfig<T> {
+
+    private Integer expiresIn;
+
+    private TimeUnit timeUnit;
+
+    private T data;
+
+}

+ 10 - 0
src/main/java/com/ydtech/utils/cache/CacheFactory.java

@@ -0,0 +1,10 @@
+package com.ydtech.utils.cache;
+
+import org.apache.poi.ss.formula.functions.T;
+
+@FunctionalInterface
+public interface CacheFactory <F extends BaseCacheConfig<?>>{
+
+    F getCache();
+
+}

+ 31 - 0
src/main/java/com/ydtech/utils/cache/RedissonUtils.java

@@ -0,0 +1,31 @@
+package com.ydtech.utils.cache;
+
+
+import com.alibaba.fastjson.JSON;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.redisson.api.RedissonClient;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+@Slf4j
+public class RedissonUtils {
+
+    private final RedissonClient redisson;
+
+    public <T, F extends BaseCacheConfig<T>> T getFromRedis(CacheFactory<F> cacheFactory, String redisKey) {
+        Object cache = redisson.getBucket(redisKey).get();
+        if (cache != null) {
+            log.info("key:{} cache:{}", redisKey, JSON.toJSONString(cache));
+        }
+
+        F result = cacheFactory.getCache();
+        if (result == null) {
+            return null;
+        }
+        redisson.getBucket(redisKey).set(result.getData(), result.getExpiresIn(), result.getTimeUnit());
+        return result.getData();
+    }
+
+}