|
@@ -17,7 +17,9 @@ using Hotline.Import;
|
|
|
using Hotline.Orders;
|
|
|
using Hotline.Realtimes;
|
|
|
using Hotline.Repository.SqlSugar;
|
|
|
+using Hotline.Repository.SqlSugar.System;
|
|
|
using Hotline.Repository.SqlSugar.Ts;
|
|
|
+using Hotline.Settings;
|
|
|
using Hotline.Settings.TimeLimits;
|
|
|
using Hotline.Share.Dtos.FlowEngine;
|
|
|
using Hotline.Share.Dtos.Realtime;
|
|
@@ -85,6 +87,8 @@ public class TestController : BaseController
|
|
|
private readonly IRepository<WorkflowTrace> _workflowTraceRepository;
|
|
|
private readonly IRepository<WorkflowStepHandler> _workflowStepHandleRepository;
|
|
|
|
|
|
+ private readonly IRepository<SystemOrganize> _systemOrganizeRepository;
|
|
|
+
|
|
|
|
|
|
//private readonly ITypedCache<List<User>> _cache;
|
|
|
//private readonly ICacheManager<User> _cache;
|
|
@@ -118,7 +122,8 @@ public class TestController : BaseController
|
|
|
IExportApplication exportApplication,
|
|
|
IAiVisitService aiVisitService,
|
|
|
IRepository<WorkflowTrace> workflowTraceRepository,
|
|
|
- IRepository<WorkflowStepHandler> workflowStepHandleRepository)
|
|
|
+ IRepository<WorkflowStepHandler> workflowStepHandleRepository,
|
|
|
+ IRepository<SystemOrganize> systemOrganizeRepository)
|
|
|
{
|
|
|
_logger = logger;
|
|
|
_authorizeGenerator = authorizeGenerator;
|
|
@@ -145,6 +150,7 @@ public class TestController : BaseController
|
|
|
_aiVisitService = aiVisitService;
|
|
|
_workflowTraceRepository = workflowTraceRepository;
|
|
|
_workflowStepHandleRepository = workflowStepHandleRepository;
|
|
|
+ _systemOrganizeRepository = systemOrganizeRepository;
|
|
|
}
|
|
|
|
|
|
[HttpGet("testo")]
|
|
@@ -154,6 +160,58 @@ public class TestController : BaseController
|
|
|
return OpenResponse.Ok(now);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ [HttpGet("init-orgname")]
|
|
|
+ [AllowAnonymous]
|
|
|
+ public async Task InitUserOrgFullName()
|
|
|
+ {
|
|
|
+ var list = await _userRepository.Queryable().Where(x => 1==1 && string.IsNullOrEmpty(x.FullOrgName)).ToListAsync();
|
|
|
+
|
|
|
+ foreach (var item in list)
|
|
|
+ {
|
|
|
+ var orgFullName = "";
|
|
|
+ var orgFullCode = "";
|
|
|
+ var orgId = item.OrgId;
|
|
|
+ int strLength = orgId.Length;
|
|
|
+ int segmentsCount = strLength / 3;
|
|
|
+ List<string> strings = new List<string>();
|
|
|
+
|
|
|
+ for (int i = 0; i < segmentsCount; i++)
|
|
|
+ {
|
|
|
+ int startIndex = i * 3;
|
|
|
+ int length = Math.Min(3, strLength - startIndex);
|
|
|
+ strings.Add(orgId.Substring(startIndex, length));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (strLength > 3)
|
|
|
+ {
|
|
|
+ orgFullCode = strings[0];
|
|
|
+ strings.Remove(orgFullCode);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ foreach (var str in strings)
|
|
|
+ {
|
|
|
+ orgFullCode = orgFullCode + str;
|
|
|
+
|
|
|
+ var org = await _systemOrganizeRepository.GetAsync(orgFullCode);
|
|
|
+ if (org != null)
|
|
|
+ {
|
|
|
+
|
|
|
+ orgFullName = orgFullName + org.Name + "/";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (orgFullName.Length > 0)
|
|
|
+ {
|
|
|
+ orgFullName = orgFullName.Remove(orgFullName.Length - 1);
|
|
|
+ }
|
|
|
+ item.FullOrgName = orgFullName;
|
|
|
+ await _userRepository.UpdateAsync(item);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
[HttpPost("import")]
|
|
|
[AllowAnonymous]
|
|
|
public async Task<List<ExcelContent>> Import(IFormFile file)
|