Ver Fonte

添加缺失代码

linqilong há 7 meses atrás
pai
commit
7c0663f76a

+ 7 - 0
pom.xml

@@ -211,6 +211,13 @@
                 <artifactId>ruoyi-api-patform</artifactId>
                 <version>${ruoyi.version}</version>
             </dependency>
+
+            <dependency>
+                <groupId>cn.com.goldenwater</groupId>
+                <artifactId>gw-cloud-id</artifactId>
+                <version>0.0.1-SNAPSHOT</version>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
 

+ 5 - 5
ruoyi-admin/pom.xml

@@ -43,28 +43,28 @@
             <artifactId>mysql-connector-java</artifactId>
         </dependency>
 
-        <!-- 核心模块-->
+        <!-- 核心模块 -->
         <dependency>
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-framework</artifactId>
         </dependency>
 
-        <!-- 定时任务-->
+        <!-- 定时任务 -->
         <dependency>
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-quartz</artifactId>
         </dependency>
-        <!-- 公共组件-->
+        <!-- 公共组件 -->
         <dependency>
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-common</artifactId>
         </dependency>
-        <!-- 代码生成-->
+        <!-- 代码生成 -->
         <dependency>
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-generator</artifactId>
         </dependency>
-        <!-- 业务代码-->
+        <!-- 业务代码 -->
         <dependency>
             <groupId>com.ruoyi</groupId>
             <artifactId>ruoyi-sh</artifactId>

+ 1 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtDataExpController.java

@@ -1,6 +1,6 @@
 package com.ruoyi.interfaces.controller;
 
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ruoyi.common.utils.uuid.IdUtils;

+ 3 - 4
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/controller/PtDataImpController.java

@@ -1,11 +1,10 @@
 package com.ruoyi.interfaces.controller;
 
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSONObject;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ruoyi.common.core.controller.BaseController;
 import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.utils.FileUtils;
 import com.ruoyi.common.utils.uuid.IdUtils;
 import com.ruoyi.interfaces.core.page.Page;
 import com.ruoyi.interfaces.core.page.PageUtils;
@@ -240,7 +239,7 @@ public class PtDataImpController extends BaseController {
     public AjaxResult impExcel(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request) throws IOException {
         String path = "E:\\excel文件";
         //  清空临时文件夹
-        FileUtils.deleteDir(new File(path));
+//        FileUtils.deleteDir(new File(path));
         String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
         String uuid = IdUtils.simpleUUID();
         //1、判断目录。如果目录不存在,则创建目录
@@ -320,7 +319,7 @@ public class PtDataImpController extends BaseController {
     public AjaxResult impModel(@RequestParam("file") MultipartFile file, HttpServletResponse response, HttpServletRequest request, PtDataImp ptDataImp) throws IOException {
         String path = "E:\\excel文件";
         //  清空临时文件夹
-        FileUtils.deleteDir(new File(path));
+//        FileUtils.deleteDir(new File(path));
         String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".") + 1);
         String uuid = IdUtils.simpleUUID();
         //1、判断目录。如果目录不存在,则创建目录

+ 0 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtAppServiceImpl.java

@@ -10,7 +10,6 @@ import com.ruoyi.interfaces.domain.PtApp;
 import com.ruoyi.interfaces.mapper.PtAppMapper;
 import com.ruoyi.interfaces.service.PtAppService;
 import org.apache.commons.lang3.StringUtils;
-//import org.apache.shenyu.common.utils.UUIDUtils;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;

+ 1 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtFileServiceImpl.java

@@ -1,6 +1,6 @@
 package com.ruoyi.interfaces.service.impl;
 
-import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson2.JSON;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
 import com.ruoyi.interfaces.core.page.PageParam;

+ 1 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceReturnServiceImpl.java

@@ -1,6 +1,6 @@
 package com.ruoyi.interfaces.service.impl;
 
-import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson2.JSON;
 import com.github.pagehelper.PageHelper;
 import com.ruoyi.interfaces.core.page.Page;
 import com.ruoyi.interfaces.core.page.PageUtils;

+ 1 - 1
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/PtServiceServiceImpl.java

@@ -1,6 +1,6 @@
 package com.ruoyi.interfaces.service.impl;
 
-import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson2.JSON;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ruoyi.common.utils.DateUtils;
 import com.ruoyi.common.utils.JsonUtils;

+ 2 - 2
ruoyi-api-patform/src/main/java/com/ruoyi/interfaces/service/impl/ServiceDataViewServiceImpl.java

@@ -1,7 +1,7 @@
 package com.ruoyi.interfaces.service.impl;
 
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONObject;
 import com.ruoyi.common.exception.CheckException;
 import com.ruoyi.common.utils.OkHttpUtils;
 import com.ruoyi.interfaces.domain.PtService;

+ 13 - 0
ruoyi-common/pom.xml

@@ -133,6 +133,19 @@
             <groupId>io.swagger</groupId>
             <artifactId>swagger-models</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>cn.com.goldenwater</groupId>
+            <artifactId>gw-cloud-id</artifactId>
+            <version>0.0.1-SNAPSHOT</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>4.12.0</version>
+        </dependency>
+
     </dependencies>
 
 </project>

+ 41 - 0
ruoyi-common/src/main/java/com/ruoyi/common/core/CustomQueryWrapper.java

@@ -0,0 +1,41 @@
+package com.ruoyi.common.core;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.enums.SqlKeyword;
+import com.baomidou.mybatisplus.core.enums.SqlLike;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Objects;
+
+/**
+ * @author LinQiLong
+ * @date 2022/5/31 14:19
+ */
+public class CustomQueryWrapper<T> extends QueryWrapper<T> {
+    @Override
+    protected QueryWrapper<T> addCondition(boolean condition, String column, SqlKeyword sqlKeyword, Object val) {
+        if (Objects.isNull(val)) {
+            condition = false;
+        }
+        if (val instanceof String) {
+            if (StringUtils.isBlank((CharSequence) val)) {
+                condition = false;
+            }
+        }
+
+        return super.addCondition(condition, column, sqlKeyword, val);
+    }
+
+    @Override
+    protected QueryWrapper<T> likeValue(boolean condition, SqlKeyword keyword, String column, Object val, SqlLike sqlLike) {
+        if (Objects.isNull(val)) {
+            condition = false;
+        }
+        if (val instanceof String) {
+            if (StringUtils.isBlank((CharSequence) val)) {
+                condition = false;
+            }
+        }
+        return super.likeValue(condition, keyword, column, val, sqlLike);
+    }
+}

+ 24 - 0
ruoyi-common/src/main/java/com/ruoyi/common/exception/CheckException.java

@@ -0,0 +1,24 @@
+package com.ruoyi.common.exception;
+
+public class CheckException extends RuntimeException {
+    private static final long serialVersionUID = 1L;
+
+    public CheckException() {
+    }
+
+    public CheckException(String message) {
+        super(message);
+    }
+
+    public CheckException(Throwable cause) {
+        super(cause);
+    }
+
+    public CheckException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+    public CheckException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
+        super(message, cause, enableSuppression, writableStackTrace);
+    }
+}

+ 41 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/CheckUtils.java

@@ -0,0 +1,41 @@
+package com.ruoyi.common.utils;
+
+import com.ruoyi.common.exception.CheckException;
+import org.springframework.context.MessageSource;
+
+import java.util.Arrays;
+
+
+/**
+ * @author HAIHUA2
+ */
+public class CheckUtils {
+    private static MessageSource resources;
+
+    public static void setResources(MessageSource resources) {
+        CheckUtils.resources = resources;
+    }
+
+    public static void check(boolean condition, String msgKey, Object... args) {
+        if (!condition) {
+            fail(msgKey, args);
+        }
+    }
+
+    public static void notEmpty(String str, String msgKey, Object... args) {
+        if (str == null || str.isEmpty()) {
+            fail(msgKey, args);
+        }
+    }
+
+    public static void notNull(Object obj, String msgKey, Object... args) {
+        if (obj == null) {
+            fail(msgKey, args);
+        }
+    }
+
+    private static void fail(String msgKey, Object... args) {
+        throw new CheckException(msgKey + ": " + Arrays.toString(args));
+        //    throw new CheckException(resources.getMessage(msgKey, args, Locale.CHINA));
+    }
+}

+ 74 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/JsonUtils.java

@@ -0,0 +1,74 @@
+package com.ruoyi.common.utils;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JavaType;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.util.List;
+
+/**
+ * @author imooc
+ * @Title: JsonUtils.java
+ * @Package com.imooc.utils
+ * @Description: json转换类
+ * Copyright: Copyright (c)
+ * Company: www.imooc.com
+ */
+public class JsonUtils {
+
+    // 定义jackson对象
+    private static final ObjectMapper MAPPER = new ObjectMapper();
+
+    /**
+     * 将对象转换成json字符串。
+     *
+     * @param data
+     * @return
+     */
+    public static String objectToJson(Object data) {
+        try {
+            String string = MAPPER.writeValueAsString(data);
+            return string;
+        } catch (JsonProcessingException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 将json结果集转化为对象
+     *
+     * @param jsonData json数据
+     * @param beanType 对象中的object类型
+     * @return
+     */
+    public static <T> T jsonToPojo(String jsonData, Class<T> beanType) {
+        try {
+            T t = MAPPER.readValue(jsonData, beanType);
+            return t;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 将json数据转换成pojo对象list
+     *
+     * @param jsonData
+     * @param beanType
+     * @return
+     */
+    public static <T> List<T> jsonToList(String jsonData, Class<T> beanType) {
+        JavaType javaType = MAPPER.getTypeFactory().constructParametricType(List.class, beanType);
+        try {
+            List<T> list = MAPPER.readValue(jsonData, javaType);
+            return list;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        return null;
+    }
+
+}

+ 251 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/OkHttpUtils.java

@@ -0,0 +1,251 @@
+package com.ruoyi.common.utils;
+
+import com.ruoyi.common.exception.OkHttpException;
+import okhttp3.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.servlet.http.HttpServletRequest;
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Created by admin on 2018/12/21.
+ */
+public class OkHttpUtils {
+    public static final MediaType JSON = MediaType.parse("application/json; charset=utf-8");
+    public static final MediaType MEDIA_TYPE = MediaType.parse("application/json;charset=utf-8");
+    private static final Logger logger = LoggerFactory.getLogger(OkHttpUtils.class);
+    private static OkHttpClient client = new OkHttpClient().newBuilder().connectTimeout(20000, TimeUnit.MILLISECONDS)
+            .readTimeout(20000, TimeUnit.MILLISECONDS)
+            .build();
+
+    public static String postJson(String url, String json) {
+        RequestBody body = RequestBody.create(JSON, json);
+        Request request = new Request.Builder().url(url).post(body).build();
+        String bodyStr = httpCall(request);
+        return bodyStr;
+    }
+
+    public static String postJson(String url, String json, Map<String, String> headerMap) {
+        String bodyStr = "";
+        RequestBody body = RequestBody.create(MEDIA_TYPE, json);
+        Headers headers = Headers.of(headerMap);
+        Request request = new Request.Builder().url(url).post(body).headers(headers).build();
+        bodyStr = httpCall(request);
+        return bodyStr;
+    }
+
+    public static String postMap(String url, Map map, Map headerMap) {
+        /* Long sTime = System.currentTimeMillis();*/
+        try {
+            FormBody.Builder builder = new FormBody.Builder();
+            if (map != null && map.size() != 0) {
+                for (Object obj : map.keySet()) {
+                    if (map.get(obj) == null) {
+                    } else {
+                        builder.add(obj + "", map.get(obj).toString());
+                    }
+                }
+            }
+            RequestBody body = builder.build();
+            Headers headers = Headers.of(headerMap);
+            Request request = new Request.Builder().url(url).post(body).headers(headers).build();
+            String bodyStr = httpCall(request);
+            return bodyStr;
+        } catch (Exception e) {
+            logger.error(e.getLocalizedMessage(), e);
+            return "";
+        }
+    }
+
+    public static String postMap(String url, Map map) {
+        FormBody.Builder builder = new FormBody.Builder();
+        if (map != null && map.size() != 0) {
+            for (Object obj : map.keySet()) {
+                if (map.get(obj) == null) {
+                } else {
+                    builder.add(obj + "", map.get(obj).toString());
+                }
+            }
+        }
+        RequestBody body = builder.build();
+        Request request = new Request.Builder().url(url).post(body).build();
+        String bodyStr = httpCall(request);
+        return bodyStr;
+    }
+
+    public static String get(String url) {
+        Request request = new Request.Builder().url(url).build();
+        String bodyStr = httpCall(request);
+        return bodyStr;
+    }
+
+    public static String get(String url, Map headerMap) {
+        Headers headers = Headers.of(headerMap);
+        Request request = new Request.Builder().url(url).headers(headers).build();
+        String bodyStr = httpCall(request);
+        return bodyStr;
+    }
+
+    public static String getTimeUlr(String url) {
+        client = new OkHttpClient.Builder().connectTimeout(1, TimeUnit.SECONDS).readTimeout(1, TimeUnit.SECONDS).build();
+        Request request = new Request.Builder().url(url).build();
+        return httpCall(request);
+    }
+
+    public static String getMap(String url, Map map) {
+        if (map != null && map.size() != 0) {
+            int i = 0;
+            StringBuilder urlBuilder = new StringBuilder(url);
+            for (Object obj : map.keySet()) {
+                if (map.get(obj) != null) {
+                    if (i == 0) {
+                        urlBuilder.append("?");
+                    } else {
+                        urlBuilder.append("&");
+                    }
+                    urlBuilder.append(obj).append("=").append(map.get(obj));
+                    i++;
+                }
+            }
+            url = urlBuilder.toString();
+        }
+        Request request = new Request.Builder().url(url).get().build();
+        return httpCall(request);
+    }
+
+    public static String getList(String url, List list) {
+        String json = list.toString();
+        RequestBody body = RequestBody.create(JSON, json);
+        Request request = new Request.Builder().url(url).get().put(body).build();
+        String bodyStr = httpCall(request);
+        return bodyStr;
+    }
+
+    public static File postFile(String url) {
+        Request request = new Request.Builder().url(url).build();
+        Response response = null;
+        Call call = null;
+        File file = new File("../report");
+        try {
+            call = client.newCall(request);
+            response = call.execute();
+            InputStream in = response.body().byteStream();
+            FileOutputStream fos = new FileOutputStream(file);
+            byte[] buf = new byte[8096];
+            int size = 0;
+            while ((size = in.read(buf)) != -1) {
+                fos.write(buf, 0, size);
+            }
+            fos.close();
+        } catch (IOException e) {
+            logger.info("请求失败----------------url:{}" + e, url);
+        } finally {
+            call.cancel();
+        }
+        return file;
+    }
+
+    public static void download(String url) {
+        Request request = new Request.Builder()
+                .url(url)
+                .build();
+        Response response = null;
+        Call call = null;
+        File file = new File("../report");
+        try {
+            call = client.newCall(request);
+            response = call.execute();
+            InputStream in = response.body().byteStream();
+            FileOutputStream fos = new FileOutputStream(file);
+            byte[] buf = new byte[8096];
+            int size = 0;
+            while ((size = in.read(buf)) != -1) {
+                fos.write(buf, 0, size);
+            }
+            in.close();
+            fos.flush();
+            fos.close();
+        } catch (IOException e) {
+            logger.info("请求失败----------------url:{}" + e, url);
+        } finally {
+            call.cancel();
+        }
+    }
+
+    public static String multipartHttpPost(String url, MultipartFile file, String filename, String name, Map<String, Object> param) {
+        try {
+            ByteArrayOutputStream output = new ByteArrayOutputStream();
+            InputStream input = file.getInputStream();
+            byte[] buffer = new byte[4096];
+            int n = 0;
+            while (-1 != (n = input.read(buffer))) {
+                output.write(buffer, 0, n);
+            }
+            RequestBody body = RequestBody.create(JSON, output.toByteArray());
+            Request request = new Request.Builder()
+                    .url(url).post(body)
+                    .build();
+            return httpCall(request);
+        } catch (IOException e) {
+            logger.error("url:{},参数:{}", url, e);
+        }
+        return null;
+    }
+
+    private static String httpCall(Request request) {
+        Response response = null;
+        Call call = null;
+        try {
+            call = client.newCall(request);
+            response = call.execute();
+            ResponseBody responseBody = response.body();
+            return responseBody == null ? "" : responseBody.string();
+        } catch (IOException e) {
+            logger.error(e.getMessage(), e);
+            throw new OkHttpException("request error", e);
+        } finally {
+            Optional.ofNullable(call).ifPresent(Call::cancel);
+        }
+    }
+
+    /**
+     * 把request转为map
+     *
+     * @param request
+     * @return
+     */
+    public static Map<String, Object> getParameterMap(HttpServletRequest request) {
+        // 参数Map
+        Map<?, ?> properties = request.getParameterMap();
+        // 返回值Map
+        Map<String, Object> returnMap = new HashMap<String, Object>();
+        Iterator<?> entries = properties.entrySet().iterator();
+
+        Map.Entry<String, Object> entry;
+        String name = "";
+        String value = "";
+        Object valueObj = null;
+        while (entries.hasNext()) {
+            entry = (Map.Entry<String, Object>) entries.next();
+            name = (String) entry.getKey();
+            valueObj = entry.getValue();
+            if (null == valueObj) {
+                value = "";
+            } else if (valueObj instanceof String[]) {
+                String[] values = (String[]) valueObj;
+                for (String s : values) {
+                    value = s + ",";
+                }
+                value = value.substring(0, value.length() - 1);
+            } else {
+                value = valueObj.toString();
+            }
+            returnMap.put(name, value);
+        }
+        return returnMap;
+    }
+}

+ 225 - 0
ruoyi-common/src/main/java/com/ruoyi/common/utils/RedisOperator.java

@@ -0,0 +1,225 @@
+package com.ruoyi.common.utils;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.DataAccessException;
+import org.springframework.data.redis.connection.RedisConnection;
+import org.springframework.data.redis.connection.StringRedisConnection;
+import org.springframework.data.redis.core.RedisCallback;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author 慕课网
+ * @Title: Redis 工具类
+ */
+@Component
+public class RedisOperator {
+
+//	@Autowired
+//    private RedisTemplate<String, Object> redisTemplate;
+
+    @Autowired
+    private StringRedisTemplate redisTemplate;
+
+    // Key(键),简单的key-value操作
+
+    /**
+     * 实现命令:TTL key,以秒为单位,返回给定 key的剩余生存时间(TTL, time to live)。
+     *
+     * @param key
+     * @return
+     */
+    public long ttl(String key) {
+        return redisTemplate.getExpire(key);
+    }
+
+    /**
+     * 实现命令:expire 设置过期时间,单位秒
+     *
+     * @param key
+     * @return
+     */
+    public void expire(String key, long timeout) {
+        redisTemplate.expire(key, timeout, TimeUnit.SECONDS);
+    }
+
+    /**
+     * 实现命令:INCR key,增加key一次
+     *
+     * @param key
+     * @return
+     */
+    public long incr(String key, long delta) {
+        return redisTemplate.opsForValue().increment(key, delta);
+    }
+
+    /**
+     * 实现命令:KEYS pattern,查找所有符合给定模式 pattern的 key
+     */
+    public Set<String> keys(String pattern) {
+        return redisTemplate.keys(pattern);
+    }
+
+    /**
+     * 实现命令:DEL key,删除一个key
+     *
+     * @param key
+     */
+    public void del(String key) {
+        redisTemplate.delete(key);
+    }
+
+    // String(字符串)
+
+    /**
+     * 实现命令:SET key value,设置一个key-value(将字符串值 value关联到 key)
+     *
+     * @param key
+     * @param value
+     */
+    public void set(String key, String value) {
+        redisTemplate.opsForValue().set(key, value);
+    }
+
+    /**
+     * 实现命令:SET key value EX seconds,设置key-value和超时时间(秒)
+     *
+     * @param key
+     * @param value
+     * @param timeout (以秒为单位)
+     */
+    public void set(String key, String value, long timeout) {
+        redisTemplate.opsForValue().set(key, value, timeout, TimeUnit.SECONDS);
+    }
+
+    /**
+     * 实现命令:GET key,返回 key所关联的字符串值。
+     *
+     * @param key
+     * @return value
+     */
+    public String get(String key) {
+        return (String) redisTemplate.opsForValue().get(key);
+    }
+
+    /**
+     * 批量查询,对应mget
+     *
+     * @param keys
+     * @return
+     */
+    public List<String> mget(List<String> keys) {
+        return redisTemplate.opsForValue().multiGet(keys);
+    }
+
+    /**
+     * 批量查询,管道pipeline
+     *
+     * @param keys
+     * @return
+     */
+    public List<Object> batchGet(List<String> keys) {
+
+//		nginx -> keepalive
+//		redis -> pipeline
+
+        List<Object> result = redisTemplate.executePipelined(new RedisCallback<String>() {
+            @Override
+            public String doInRedis(RedisConnection connection) throws DataAccessException {
+                StringRedisConnection src = (StringRedisConnection) connection;
+
+                for (String k : keys) {
+                    src.get(k);
+                }
+                return null;
+            }
+        });
+
+        return result;
+    }
+
+
+    // Hash(哈希表)
+
+    /**
+     * 实现命令:HSET key field value,将哈希表 key中的域 field的值设为 value
+     *
+     * @param key
+     * @param field
+     * @param value
+     */
+    public void hset(String key, String field, Object value) {
+        redisTemplate.opsForHash().put(key, field, value);
+    }
+
+    /**
+     * 实现命令:HGET key field,返回哈希表 key中给定域 field的值
+     *
+     * @param key
+     * @param field
+     * @return
+     */
+    public String hget(String key, String field) {
+        return (String) redisTemplate.opsForHash().get(key, field);
+    }
+
+    /**
+     * 实现命令:HDEL key field [field ...],删除哈希表 key 中的一个或多个指定域,不存在的域将被忽略。
+     *
+     * @param key
+     * @param fields
+     */
+    public void hdel(String key, Object... fields) {
+        redisTemplate.opsForHash().delete(key, fields);
+    }
+
+    /**
+     * 实现命令:HGETALL key,返回哈希表 key中,所有的域和值。
+     *
+     * @param key
+     * @return
+     */
+    public Map<Object, Object> hgetall(String key) {
+        return redisTemplate.opsForHash().entries(key);
+    }
+
+    // List(列表)
+
+    /**
+     * 实现命令:LPUSH key value,将一个值 value插入到列表 key的表头
+     *
+     * @param key
+     * @param value
+     * @return 执行 LPUSH命令后,列表的长度。
+     */
+    public long lpush(String key, String value) {
+        return redisTemplate.opsForList().leftPush(key, value);
+    }
+
+    /**
+     * 实现命令:LPOP key,移除并返回列表 key的头元素。
+     *
+     * @param key
+     * @return 列表key的头元素。
+     */
+    public String lpop(String key) {
+        return (String) redisTemplate.opsForList().leftPop(key);
+    }
+
+    /**
+     * 实现命令:RPUSH key value,将一个值 value插入到列表 key的表尾(最右边)。
+     *
+     * @param key
+     * @param value
+     * @return 执行 LPUSH命令后,列表的长度。
+     */
+    public long rpush(String key, String value) {
+        return redisTemplate.opsForList().rightPush(key, value);
+    }
+
+}