|
@@ -20,6 +20,9 @@ using OASystem.API.OAMethodLib.Hub.HubClients;
|
|
|
using static OASystem.API.OAMethodLib.Hub.Hubs.ChatHub;
|
|
|
using static OASystem.API.OAMethodLib.JWTHelper;
|
|
|
using OASystem.Domain.Entities.Groups;
|
|
|
+using OASystem.Domain.Entities.Customer;
|
|
|
+using static QRCoder.PayloadGenerator.SwissQrCode;
|
|
|
+using OASystem.Domain.AesEncryption;
|
|
|
|
|
|
namespace OASystem.API.Controllers
|
|
|
{
|
|
@@ -867,5 +870,64 @@ namespace OASystem.API.Controllers
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// ClientTest
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="depId">部门Id</param>
|
|
|
+ /// <returns></returns>
|
|
|
+ [HttpPost("ClientTest")]
|
|
|
+ [ProducesResponseType(typeof(LoginView), StatusCodes.Status200OK)]
|
|
|
+ public async Task<IActionResult> ClientTest()
|
|
|
+ {
|
|
|
+ var _sqlsugar = _loginRep._sqlSugar;
|
|
|
+ var groups = await _sqlsugar.Queryable<Grp_DelegationInfo>()
|
|
|
+ .Where(x => x.IsDel == 0 && x.VisitDate >= Convert.ToDateTime("2024-01-01") && x.VisitDate<= Convert.ToDateTime("2024-12-31"))
|
|
|
+ .Select(x => new { x.Id, x.TeamName, x.ClientUnit, x.ClientName, x.VisitDate })
|
|
|
+ .ToListAsync();
|
|
|
+
|
|
|
+ var newClients = await _sqlsugar.Queryable<Crm_NewClientData>()
|
|
|
+ .Where(x => x.IsDel == 0 && !string.IsNullOrEmpty(x.Contact))
|
|
|
+ .Select(x => new Crm_NewClientData() { Contact = x.Contact, Telephone = x.Telephone, Phone = x.Phone })
|
|
|
+ .ToListAsync();
|
|
|
+ foreach (var item in newClients) EncryptionProcessor.DecryptProperties(item);
|
|
|
+
|
|
|
+ var datas = new List<NewClientInfo>();
|
|
|
+ foreach (var group in groups)
|
|
|
+ {
|
|
|
+ var clientName = group.ClientName;
|
|
|
+ var clientInfo = newClients.Find(x => !string.IsNullOrEmpty(clientName) && !string.IsNullOrEmpty(x.Contact) && clientName.Contains(x.Contact));
|
|
|
+ if (clientInfo != null)
|
|
|
+ {
|
|
|
+ datas.Add(new NewClientInfo()
|
|
|
+ {
|
|
|
+ TeamName = group.TeamName,
|
|
|
+ ClientUnit = group.ClientUnit,
|
|
|
+ ClientName = group.ClientName,
|
|
|
+ VisitDate = group.VisitDate,
|
|
|
+ NewClientContact = clientInfo?.Contact ?? "",
|
|
|
+ Telephone = clientInfo?.Telephone ?? "",
|
|
|
+ Phone = clientInfo?.Phone ?? "",
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ datas = datas.OrderBy(x => x.VisitDate).ToList();
|
|
|
+
|
|
|
+ return Ok(JsonView(datas));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ public class NewClientInfo
|
|
|
+ {
|
|
|
+ public string TeamName { get; set; }
|
|
|
+ public string ClientUnit { get; set; }
|
|
|
+ public string ClientName { get; set; }
|
|
|
+ public DateTime VisitDate { get; set; }
|
|
|
+ public string NewClientContact { get; set; }
|
|
|
+ public string Telephone { get; set; }
|
|
|
+ public string Phone { get; set; }
|
|
|
+ }
|
|
|
}
|
|
|
}
|