Просмотр исходного кода

公司客户名单(加密解密--> CRUD、其他相关接口代码更改、测试(本地、生产环境))

LEIYI месяцев назад: 3
Родитель
Сommit
2c3a9190f7

+ 0 - 29
OASystem/OASystem.Api/Controllers/MarketCustomerResourcesController.cs

@@ -22,35 +22,6 @@ namespace OASystem.API.Controllers
             this._clientDataRepository = clientDataRepository;
         }
 
-
-        /// <summary>
-        /// 客户资料数据
-        /// 批量加密
-        /// </summary>
-        /// <returns></returns>
-        [HttpGet]
-        [ProducesResponseType(typeof(JsonView), StatusCodes.Status200OK)]
-        public async Task<IActionResult> MarketCustomerBatchEncryption()
-        {
-            JsonView jw = new JsonView();
-         
-            
-            var infos = await _clientDataRepository._sqlSugar.Queryable< Crm_NewClientData >().ToListAsync();
-
-            Stopwatch stopwatch = Stopwatch.StartNew();
-
-            foreach (var info in infos) EncryptionProcessor.EncryptProperties(info);
-
-            var updCount = await _clientDataRepository._sqlSugar.Updateable(infos).ExecuteCommandAsync();
-            stopwatch.Stop();
-
-            jw.Count = 200;
-            jw.Msg = $"AES加密耗时: {stopwatch.ElapsedMilliseconds} 毫秒";
-            jw.Count = updCount;
-
-            return Ok(jw);
-        }
-
         /// <summary>
         /// 客户资料数据
         /// 基础数据

+ 4 - 1
OASystem/OASystem.Api/Controllers/StatisticsController.cs

@@ -1,6 +1,7 @@
 using Aspose.Cells;
 using NPOI.SS.Formula.Functions;
 using OASystem.API.OAMethodLib;
+using OASystem.Domain.AesEncryption;
 using OASystem.Domain.Dtos.Statistics;
 using OASystem.Domain.Entities.Customer;
 using OASystem.Domain.Entities.Groups;
@@ -1978,7 +1979,9 @@ ORDER BY
                 int group_number = 0;
                 if (!string.IsNullOrEmpty(info.ClientUnit))
                 {
-                    var _NewClientData = await _sqlSugar.Queryable<Crm_NewClientData>().Where(it => it.IsDel == 0 && it.Client.Equals(info.ClientUnit)).FirstAsync();
+                    var _NewClientData = await _sqlSugar.Queryable<Crm_NewClientData>()
+                        .Where(it => it.IsDel == 0 && it.Client.Equals(AesEncryptionHelper.Encrypt(info.ClientUnit)))
+                        .FirstAsync();
                     if (_NewClientData != null)
                     {
                         var regionInfo = await _sqlSugar.Queryable<Sys_SetData>().Where(it => it.Id == _NewClientData.Lvlid).FirstAsync();

+ 1 - 0
OASystem/OASystem.Api/Controllers/SystemController.cs

@@ -2258,6 +2258,7 @@ And u.UId = {0} And u.FId = 1 ", dto.UserId);
                             ncd.CreateTime,
                         })
                         .ToListAsync();
+                    foreach (var item in marketData) EncryptionProcessor.DecryptProperties(item);
                     var marketDataGroup = marketData.GroupBy(x => x.CreateUserId).Select(g => new { CreateUserId = g.Key, Items = g.ToList(), Count = g.Count() });
 
                     var marketData2 = new List<dynamic>();

+ 13 - 1
OASystem/OASystem.Infrastructure/Repositories/CRM/NewClientDataRepository.cs

@@ -337,6 +337,8 @@ namespace OASystem.Infrastructure.Repositories.CRM
                 }
                 #endregion
 
+                if (intList.Count < 1) intList.Add(-1);
+
                 var NewClientDataView = new List<NewClientDataView>();
                 var count = 0;
                 string contact = dto.Contact, location = dto.Location, clientDto = dto.Client;
@@ -434,7 +436,17 @@ namespace OASystem.Infrastructure.Repositories.CRM
                         int index = 1;
                         foreach (var item in NewClientDataView)
                         {
-                            EncryptionProcessor.DecryptProperties(item); //解密
+                            //EncryptionProcessor.DecryptProperties(item); //解密
+
+                            item.Wechat = AesEncryptionHelper.Decrypt(item.Wechat);
+                            item.Job = AesEncryptionHelper.Decrypt(item.Job);
+                            item.Phone = AesEncryptionHelper.Decrypt(item.Phone);
+                            item.Telephone = AesEncryptionHelper.Decrypt(item.Telephone);
+                            item.Remark = AesEncryptionHelper.Decrypt(item.Remark);
+                             if(string.IsNullOrEmpty(contact)) item.Contact = AesEncryptionHelper.Decrypt(item.Contact);
+                            if (string.IsNullOrEmpty(clientDto)) item.Client = AesEncryptionHelper.Decrypt(item.Client);
+                            if (string.IsNullOrEmpty(location)) item.Location = AesEncryptionHelper.Decrypt(item.Location);
+
                             item.RowNumber = index;
                             item.CategoryStr = setDatas.Find(x => x.Id == item.Category)?.Name ?? "-";
                             item.LvlidStr = setDatas.Find(x => x.Id == item.Lvlid)?.Name ?? "-";

+ 7 - 1
OASystem/OASystem.Infrastructure/Repositories/Groups/DelegationInfoRepository.cs

@@ -527,7 +527,13 @@ namespace OASystem.Infrastructure.Repositories.Groups
                     var clientData = await _sqlSugar.SqlQueryable<Crm_NewClientData>(clientSql).ToListAsync();
                     if (clientData.Count > 0)
                     {
-                        clientData1 = clientData.Select(it => new { it.Client,it.Contact,it.Telephone,it.Wechat }).ToList();
+                        clientData1 = clientData.Select(it => new
+                        {
+                            Client = AesEncryptionHelper.Decrypt(it.Client),
+                            Contact = AesEncryptionHelper.Decrypt(it.Contact),
+                            Telephone = AesEncryptionHelper.Decrypt(it.Telephone),
+                            Wechat = AesEncryptionHelper.Decrypt(it.Wechat)
+                        }).ToList();
                     }
 
                     result.Code = 0;