From 69e9ce6ae24fce670fb8d7af0e1f132e2e009dbc Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 12 七月 2023 13:44:21 +0800
Subject: [PATCH] 提交

---
 zhengcaioa/Services/CooperatecustomCustomerService.cs |   25 ++++++++++++++++++-------
 zhengcaioa/zhengcaioa/Startup.cs                      |   10 +++++-----
 zhengcaioa/Services/IntentionCustomerService.cs       |   24 +++++++++++++++++-------
 3 files changed, 40 insertions(+), 19 deletions(-)

diff --git a/zhengcaioa/Services/CooperatecustomCustomerService.cs b/zhengcaioa/Services/CooperatecustomCustomerService.cs
index 4f5b9cb..4096d52 100644
--- a/zhengcaioa/Services/CooperatecustomCustomerService.cs
+++ b/zhengcaioa/Services/CooperatecustomCustomerService.cs
@@ -145,7 +145,7 @@
 
                 var listPosition = _context.CooperatecustomCustomers.Where(r => r.RecStatus == "A").ToList();
 
-
+                CacheHelperNetCore.CacheNull("CooperatecustomCustomerDTOs");
                 resultEntity.ReturnID = cooperatecustomCustomer.Id;
                 resultEntity.Result = true;
             }
@@ -510,27 +510,38 @@
         /// <returns></returns>
         public List<CooperatecustomCustomerDTO> GetList(string HuiyuanId = "", string Name = "")
         {
+            List<CooperatecustomCustomerDTO> CooperatecustomCustomerDTOs = (List<CooperatecustomCustomerDTO>)CacheHelperNetCore.CacheValue("CooperatecustomCustomerDTOs");
+            if (CooperatecustomCustomerDTOs != null && CooperatecustomCustomerDTOs.Count > 0)
+            {
+                if (!string.IsNullOrEmpty(HuiyuanId))
+                {
+                    CooperatecustomCustomerDTOs = CooperatecustomCustomerDTOs.Where(x => x.HuiyuanId == HuiyuanId).ToList();
+                }
+                if (!string.IsNullOrEmpty(Name))
+                {
+                    CooperatecustomCustomerDTOs = CooperatecustomCustomerDTOs.Where(x => x.Name == Name).ToList();
+                }
+                return CooperatecustomCustomerDTOs;
+            }
             var listPosition = _context.CooperatecustomCustomers.Where(r => r.RecStatus == "A").ToList();
-
-          
-
+            CooperatecustomCustomerDTOs = _mapper.Map<List<CooperatecustomCustomerDTO>>(listPosition);
+            CacheHelperNetCore.CacheInsert("CooperatecustomCustomerDTOs", CooperatecustomCustomerDTOs);
 
             if (!string.IsNullOrEmpty(HuiyuanId))
             {
                 listPosition = listPosition.Where(x => x.HuiyuanId == HuiyuanId).ToList();
             }
-
             if (!string.IsNullOrEmpty(Name))
             {
                 listPosition = listPosition.Where(x => x.Name == Name).ToList();
             }
-            var CooperatecustomCustomerDTOs = _mapper.Map<List<CooperatecustomCustomerDTO>>(listPosition);
+            CooperatecustomCustomerDTOs = _mapper.Map<List<CooperatecustomCustomerDTO>>(listPosition);
             return CooperatecustomCustomerDTOs;
 
 
 
 
-           
+
         }
 
         public List<CooperatecustomCustomerDTO> GetListsalary(string userid, DateTime datemin, DateTime datemax)
diff --git a/zhengcaioa/Services/IntentionCustomerService.cs b/zhengcaioa/Services/IntentionCustomerService.cs
index d2c17b1..41c2739 100644
--- a/zhengcaioa/Services/IntentionCustomerService.cs
+++ b/zhengcaioa/Services/IntentionCustomerService.cs
@@ -144,7 +144,7 @@
 
                 // var  intentionCustomerDTOs = _mapper.Map<List<IntentionCustomerDTO>>(listPosition);
                 //CacheHelperNetCore.CacheInsert("intentionCustomerDTOs", intentionCustomerDTOs);
-
+                CacheHelperNetCore.CacheNull("intentionCustomerDTOs");
                 resultEntity.ReturnID = intentionCustomer.Id;
             resultEntity.Result = true;
         }
@@ -527,19 +527,29 @@
         /// <returns></returns>
         public List<IntentionCustomerDTO> GetList(string huiyuanId = null)
         {
-            
+
+
+            List<IntentionCustomerDTO> intentionCustomerDTOs = (List<IntentionCustomerDTO>)CacheHelperNetCore.CacheValue("intentionCustomerDTOs");
+
+            if (intentionCustomerDTOs != null && intentionCustomerDTOs.Count > 0)
+            {
+                if (!string.IsNullOrEmpty(huiyuanId))
+                {
+                    intentionCustomerDTOs = intentionCustomerDTOs.Where(x => x.HuiyuanId == huiyuanId).ToList();
+                }
+
+                return intentionCustomerDTOs;
+            }
 
             var listPosition = _context.IntentionCustomers.Where(r => r.RecStatus == "A").ToList();
-
-           
-
+            intentionCustomerDTOs = _mapper.Map<List<IntentionCustomerDTO>>(listPosition);
+            CacheHelperNetCore.CacheInsert("intentionCustomerDTOs", intentionCustomerDTOs);
 
             if (!string.IsNullOrEmpty(huiyuanId))
             {
                 listPosition = listPosition.Where(x => x.HuiyuanId == huiyuanId).ToList();
             }
-
-            var intentionCustomerDTOs = _mapper.Map<List<IntentionCustomerDTO>>(listPosition);
+            intentionCustomerDTOs = _mapper.Map<List<IntentionCustomerDTO>>(listPosition);
             return intentionCustomerDTOs;
         }
 
diff --git a/zhengcaioa/zhengcaioa/Startup.cs b/zhengcaioa/zhengcaioa/Startup.cs
index 3b03fca..54dd793 100644
--- a/zhengcaioa/zhengcaioa/Startup.cs
+++ b/zhengcaioa/zhengcaioa/Startup.cs
@@ -68,23 +68,23 @@
 
             var connectionString = Configuration.GetConnectionString("DefaultConnection");
             services.AddDbContext<zhengcaioaContext>(options =>
-            options.UseSqlServer(connectionString));
+            options.UseSqlServer(connectionString, option => option.CommandTimeout(60)));
 
             var connectionString1 = Configuration.GetConnectionString("zcwebConnection");
             services.AddDbContext<zcwebContext>(options =>
-            options.UseSqlServer(connectionString1));
+            options.UseSqlServer(connectionString1, option => option.CommandTimeout(60)));
 
             var connectionString2 = Configuration.GetConnectionString("zcUserInfoNConnection");
             services.AddDbContext<zcUserInfoN_dbContext>(options =>
-            options.UseSqlServer(connectionString2));
+            options.UseSqlServer(connectionString2, option => option.CommandTimeout(60)));
 
             var connectionString3 = Configuration.GetConnectionString("WebCrawlerConnection");
             services.AddDbContext<WebCrawlerContext>(options =>
-            options.UseSqlServer(connectionString3));
+            options.UseSqlServer(connectionString3, option => option.CommandTimeout(60)));
 
             var connectionString4 = Configuration.GetConnectionString("IMdbtestConnection");
             services.AddDbContext<IMdbtestContext>(options =>
-            options.UseSqlServer(connectionString4));
+            options.UseSqlServer(connectionString4, option => option.CommandTimeout(60)));
 
             services.AddControllersWithViews();
 

--
Gitblit v1.9.1