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 |   80 ++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 3 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 2b3c520..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;
 
 
     /**
@@ -155,6 +161,15 @@
                 wqs.in(TjOrderRemark::getType, 0,3);
                 List<TjOrderRemark> lists = remarkService.list(wqs);
                 TjCustomer customer = customerService.getById(order.getUserId());
+
+                //閬嶅巻椤圭洰 鍒ゆ柇鏄惁鏈夐噸澶ч槼鎬�  鏍囪
+                for (TjOrderDetail tjOrderDetail11 : list) {
+                    customer.setIsPositive(tjOrderDetail11.getIsPositive());
+                    if (tjOrderDetail11.getIsPositive()==1){
+                        break;
+                    }
+                }
+
                 customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
                 customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                 customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
@@ -184,8 +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());
@@ -217,6 +232,13 @@
                             if (list111.size() == 0) {
                                 continue;
                             }
+                            //閬嶅巻椤圭洰 鍒ゆ柇鏄惁鏈夐噸澶ч槼鎬�  鏍囪
+                            for (TjOrderDetail tjOrderDetail11 : list111) {
+                                customer.setIsPositive(tjOrderDetail11.getIsPositive());
+                                if (tjOrderDetail11.getIsPositive()==1){
+                                    break;
+                                }
+                            }
                             List<TjOrderRemark> lists = remarkService.getTjOrderRemarkListByYjNum(order.getTjNumber());
                             if (null != lists && lists.size() > 0) {
                                 StringBuilder stringBuilder = new StringBuilder();
@@ -244,6 +266,7 @@
                             customer.setTjNumber(order.getTjNumber());
                             customer.setOrderId(order.getOrderId());
                             customer.setIsHz(order.getIsHz());
+                            customer.setTjCategory(order.getTjCategory());
                             list11111.add(customer);
                         }
                     }
@@ -262,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<>();
@@ -348,6 +408,13 @@
                 wqs.in(TjOrderRemark::getType, 0,3);
                 List<TjOrderRemark> lists = remarkService.list(wqs);
                 TjCustomer customer = customerService.getById(order.getUserId());
+                //閬嶅巻椤圭洰 鍒ゆ柇鏄惁鏈夐噸澶ч槼鎬�  鏍囪
+                for (TjOrderDetail tjOrderDetail11 : list) {
+                    customer.setIsPositive(tjOrderDetail11.getIsPositive());
+                    if (tjOrderDetail11.getIsPositive()==1){
+                        break;
+                    }
+                }
                 customer.setCusName(MatchUtils.hideCusName(customer.getCusName()));
                 customer.setCusPhone(MatchUtils.hidePhoneNum(customer.getCusPhone()));
                 customer.setCusIdcard(MatchUtils.hideIdCardNum(customer.getCusIdcard()));
@@ -410,6 +477,13 @@
                             if (list111.size() == 0) {
                                 continue;
                             }
+                            //閬嶅巻椤圭洰 鍒ゆ柇鏄惁鏈夐噸澶ч槼鎬�  鏍囪
+                            for (TjOrderDetail tjOrderDetail11 : list111) {
+                                customer.setIsPositive(tjOrderDetail11.getIsPositive());
+                                if (tjOrderDetail11.getIsPositive()==1){
+                                    break;
+                                }
+                            }
                             List<TjOrderRemark> lists = remarkService.getTjOrderRemarkListByYjNum(order.getTjNumber());
                             if (null != lists && lists.size() > 0) {
                                 StringBuilder stringBuilder = new StringBuilder();

--
Gitblit v1.8.0