From 74a005b2c0ef4247d8915c20daea80649abb5b80 Mon Sep 17 00:00:00 2001
From: zjh <1084500556@qq.com>
Date: 星期四, 14 十二月 2023 12:16:27 +0800
Subject: [PATCH] zjh 2023/12/14--1

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java |   51 +++++++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 47 insertions(+), 4 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java
index f8286e1..e074882 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysDeptController.java
@@ -27,6 +27,11 @@
 import io.swagger.annotations.ApiParam;
 import org.apache.commons.lang3.ArrayUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.ConvertingCursor;
+import org.springframework.data.redis.core.Cursor;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.core.ScanOptions;
+import org.springframework.data.redis.serializer.RedisSerializer;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
@@ -89,7 +94,8 @@
 
     @Autowired
     private ITjRulesService tjRulesService;
-
+    @Autowired
+    public RedisTemplate<Object,Object> redisTemplate;
 
 
     /**
@@ -193,9 +199,8 @@
                 customer.setTjNumber(order.getTjNumber());
                 customer.setOrderId(order.getOrderId());
                 customer.setIsHz(order.getIsHz());
-
+                customer.setTjCategory(order.getTjCategory());
                 customerLis.add(customer);
-
             }
             if (customerLis.size() > 0) {
                 List<TjCustomer> customerList = customerLis.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
@@ -261,6 +266,7 @@
                             customer.setTjNumber(order.getTjNumber());
                             customer.setOrderId(order.getOrderId());
                             customer.setIsHz(order.getIsHz());
+                            customer.setTjCategory(order.getTjCategory());
                             list11111.add(customer);
                         }
                     }
@@ -279,14 +285,51 @@
             }
         }
         List<TjCustomer> customerLists = new ArrayList<>();
+
+//        String key="*";
+//        if(sysUser.isAdmin()){
+//            key="ks"+":*";
+//        }else {
+//            key="ks:"+ksId+":*";
+//        }
+//        ScanOptions options = ScanOptions.scanOptions()
+//                //杩欓噷鎸囧畾姣忔鎵弿key鐨勬暟閲�(寰堝鍗氬鐬庤瑕佹寚瀹欼nteger.MAX_VALUE锛岃繖鏍风殑璇濊窡        keys鏈変粈涔堝尯鍒紵)
+//                .count(10000)
+//                .match(key).build();
+//        RedisSerializer<String> redisSerializer = (RedisSerializer<String>) redisTemplate.getKeySerializer();
+//        0鏈,1宸叉
         if (type == 0) {
+//            Cursor cursor = redisTemplate.executeWithStickyConnection(redisConnection -> new ConvertingCursor<>(redisConnection.scan(options), redisSerializer::deserialize));
+//            List<TjCustomer> customers = new ArrayList<>();
+//            while(cursor.hasNext()){
+//                String s = cursor.next().toString();
+//                TjCustomer wj = redisCache.getCacheMapValue(s,"0");
+//                if(null !=wj){
+//                    customers.add(wj);
+//                }
+//            }
+////            //鍒囪杩欓噷涓�瀹氳鍏抽棴锛屽惁鍒欎細鑰楀敖杩炴帴鏁般�傛姤Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisException: Could not get a
+//            cursor.close();
             customerLists = redisCache.getCacheMapValue(ksId + "ks", "wj");
+//            customerLists = customers;
         }
         if (type == 1) {
+//            Cursor cursor = redisTemplate.executeWithStickyConnection(redisConnection -> new ConvertingCursor<>(redisConnection.scan(options), redisSerializer::deserialize));
+//            List<TjCustomer> customers = new ArrayList<>();
+//            while(cursor.hasNext()){
+//                String s = cursor.next().toString();
+//                TjCustomer wj = redisCache.getCacheMapValue(s,"1");
+//                if(null !=wj){
+//                    customers.add(wj);
+//                }
+//            }
+////            //鍒囪杩欓噷涓�瀹氳鍏抽棴锛屽惁鍒欎細鑰楀敖杩炴帴鏁般�傛姤Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisException: Could not get a
+//            cursor.close();
             customerLists = redisCache.getCacheMapValue(ksId + "ks", "yj");
+//            customerLists = customers;
         }
         asyncService.dockerSetCustomerLisByRedis(ksproList, String.valueOf(ksId));
-        if (customerLists != null && customerLists.size() > 0) {
+        if (null !=customerLists && customerLists.size() > 0) {
             Collections.reverse(customerLists);
             List<TjCustomer> customerList = customerLists.stream().skip((long) (page - 1) * pageSize).limit(pageSize).collect(Collectors.toList());
             Map<String, Object> map = new HashMap<>();

--
Gitblit v1.8.0