|
@@ -1,22 +1,13 @@
|
|
|
|
|
|
|
|
using AutoMapper;
|
|
using AutoMapper;
|
|
|
-using Newtonsoft.Json;
|
|
|
|
|
using OASystem.Domain;
|
|
using OASystem.Domain;
|
|
|
using OASystem.Domain.AesEncryption;
|
|
using OASystem.Domain.AesEncryption;
|
|
|
using OASystem.Domain.Dtos;
|
|
using OASystem.Domain.Dtos;
|
|
|
using OASystem.Domain.Dtos.CRM;
|
|
using OASystem.Domain.Dtos.CRM;
|
|
|
using OASystem.Domain.Dtos.UserDto;
|
|
using OASystem.Domain.Dtos.UserDto;
|
|
|
using OASystem.Domain.Entities.Customer;
|
|
using OASystem.Domain.Entities.Customer;
|
|
|
-using OASystem.Domain.Entities.Groups;
|
|
|
|
|
-using OASystem.Domain.Entities.Resource;
|
|
|
|
|
using OASystem.Domain.ViewModels.CRM;
|
|
using OASystem.Domain.ViewModels.CRM;
|
|
|
-using OASystem.Domain.ViewModels.Groups;
|
|
|
|
|
-using System;
|
|
|
|
|
-using System.Collections.Generic;
|
|
|
|
|
-using System.Linq;
|
|
|
|
|
-using System.Runtime.Intrinsics.X86;
|
|
|
|
|
-using System.Text;
|
|
|
|
|
-using System.Threading.Tasks;
|
|
|
|
|
|
|
+using System.Reflection;
|
|
|
|
|
|
|
|
namespace OASystem.Infrastructure.Repositories.CRM
|
|
namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
{
|
|
{
|
|
@@ -27,11 +18,11 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
{
|
|
{
|
|
|
private readonly IMapper _mapper;
|
|
private readonly IMapper _mapper;
|
|
|
private readonly JsonView _jv = new() { Code = StatusCodes.Status400BadRequest, Msg = "操作失败!" };
|
|
private readonly JsonView _jv = new() { Code = StatusCodes.Status400BadRequest, Msg = "操作失败!" };
|
|
|
- public VisaDeleClientRepository(SqlSugarClient sqlSugar,IMapper mapper) :
|
|
|
|
|
|
|
+ public VisaDeleClientRepository(SqlSugarClient sqlSugar, IMapper mapper) :
|
|
|
base(sqlSugar)
|
|
base(sqlSugar)
|
|
|
{
|
|
{
|
|
|
this._mapper = mapper;
|
|
this._mapper = mapper;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -42,7 +33,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
public async Task<Result> GetCrmList(DtoBase dto)
|
|
public async Task<Result> GetCrmList(DtoBase dto)
|
|
|
{
|
|
{
|
|
|
Result result = new Result() { Code = -2 };
|
|
Result result = new Result() { Code = -2 };
|
|
|
- if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)
|
|
|
|
|
|
|
+ if (dto.PortType == 1 || dto.PortType == 2 || dto.PortType == 3)
|
|
|
{
|
|
{
|
|
|
string sql = string.Format(@"Select cdc.Id,cdc.LastName,cdc.FirstName,ccc.CompanyFullName,Sex,Marriage,
|
|
string sql = string.Format(@"Select cdc.Id,cdc.LastName,cdc.FirstName,ccc.CompanyFullName,Sex,Marriage,
|
|
|
Phone LandlinePhone,Tel,crmCard1.CertNo IDNo,crmCard2.CertNo PassportNo
|
|
Phone LandlinePhone,Tel,crmCard1.CertNo IDNo,crmCard2.CertNo PassportNo
|
|
@@ -94,7 +85,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
{
|
|
{
|
|
|
int addId = -1;
|
|
int addId = -1;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
return addId;
|
|
return addId;
|
|
@@ -112,7 +103,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
string clientSql = string.Format(@"Select * From Crm_DeleClient Where LastName+FirstName='{0}' And Sex = {1}",
|
|
string clientSql = string.Format(@"Select * From Crm_DeleClient Where LastName+FirstName='{0}' And Sex = {1}",
|
|
|
client.ClientName, client.Sex);
|
|
client.ClientName, client.Sex);
|
|
|
var clientInfo = await _sqlSugar.SqlQueryable<VisaDeleClientListView>(clientSql).FirstAsync();
|
|
var clientInfo = await _sqlSugar.SqlQueryable<VisaDeleClientListView>(clientSql).FirstAsync();
|
|
|
- if(clientInfo == null) return false;
|
|
|
|
|
|
|
+ if (clientInfo == null) return false;
|
|
|
|
|
|
|
|
string cardSql = string.Format(@"Select * From Crm_CustomerCert Where SdId=773 And DcId={0}", clientInfo.Id);
|
|
string cardSql = string.Format(@"Select * From Crm_CustomerCert Where SdId=773 And DcId={0}", clientInfo.Id);
|
|
|
var cardInfo = await _sqlSugar.SqlQueryable<CustomerCertView>(cardSql).FirstAsync();
|
|
var cardInfo = await _sqlSugar.SqlQueryable<CustomerCertView>(cardSql).FirstAsync();
|
|
@@ -151,23 +142,23 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
if (cerdStatus > 0) return true;
|
|
if (cerdStatus > 0) return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
public async Task<Result> OpCustomer(DeleClientOpDto dto)
|
|
public async Task<Result> OpCustomer(DeleClientOpDto dto)
|
|
|
{
|
|
{
|
|
|
- Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
|
|
|
|
+ Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
EncryptionProcessor.EncryptProperties(dto.DeleClient);
|
|
EncryptionProcessor.EncryptProperties(dto.DeleClient);
|
|
|
|
|
|
|
|
BeginTran();
|
|
BeginTran();
|
|
|
int deleId = 0;
|
|
int deleId = 0;
|
|
|
- if (dto.Status==1)//添加
|
|
|
|
|
|
|
+ if (dto.Status == 1)//添加
|
|
|
{
|
|
{
|
|
|
string selectSql = string.Format(@"select * from Crm_DeleClient where LastName+FirstName='{0}' and Phone='{1}' and IsDel='{2}'"
|
|
string selectSql = string.Format(@"select * from Crm_DeleClient where LastName+FirstName='{0}' and Phone='{1}' and IsDel='{2}'"
|
|
|
- , dto.DeleClient.LastName+dto.DeleClient.FirstName, dto.DeleClient.Phone, 0);
|
|
|
|
|
|
|
+ , dto.DeleClient.LastName + dto.DeleClient.FirstName, dto.DeleClient.Phone, 0);
|
|
|
var DeleClient = await _sqlSugar.SqlQueryable<Crm_DeleClient>(selectSql).FirstAsync();//查询是否存在
|
|
var DeleClient = await _sqlSugar.SqlQueryable<Crm_DeleClient>(selectSql).FirstAsync();//查询是否存在
|
|
|
if (DeleClient != null)
|
|
if (DeleClient != null)
|
|
|
{
|
|
{
|
|
@@ -185,12 +176,12 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
}
|
|
}
|
|
|
result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
result = new Result() { Code = 0, Msg = "添加成功!" };
|
|
|
deleId = id;
|
|
deleId = id;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
else if (dto.Status == 2)//修改
|
|
else if (dto.Status == 2)//修改
|
|
|
{
|
|
{
|
|
|
- deleId=dto.DeleClient.Id;
|
|
|
|
|
|
|
+ deleId = dto.DeleClient.Id;
|
|
|
|
|
|
|
|
DateTime? dateTime = null;
|
|
DateTime? dateTime = null;
|
|
|
bool isDt = DateTime.TryParse(dto.DeleClient.BirthDay, out DateTime dt);
|
|
bool isDt = DateTime.TryParse(dto.DeleClient.BirthDay, out DateTime dt);
|
|
@@ -297,7 +288,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
result = new Result() { Code = -1, Msg = "修改失败!" };
|
|
result = new Result() { Code = -1, Msg = "修改失败!" };
|
|
|
}
|
|
}
|
|
|
result = new Result() { Code = 0, Msg = "修改成功!" };
|
|
result = new Result() { Code = 0, Msg = "修改成功!" };
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
//进行其他表
|
|
//进行其他表
|
|
|
if (result.Code == 0)
|
|
if (result.Code == 0)
|
|
@@ -326,7 +317,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
IsUSA = Crm_VisaCustomerFamily.IsUSA,
|
|
IsUSA = Crm_VisaCustomerFamily.IsUSA,
|
|
|
Remark = Crm_VisaCustomerFamily.Remark,
|
|
Remark = Crm_VisaCustomerFamily.Remark,
|
|
|
}).ExecuteCommandAsync();
|
|
}).ExecuteCommandAsync();
|
|
|
- if (res==0)
|
|
|
|
|
|
|
+ if (res == 0)
|
|
|
{
|
|
{
|
|
|
result = new Result() { Code = -1, Msg = "家庭成员信息保存失败!" };
|
|
result = new Result() { Code = -1, Msg = "家庭成员信息保存失败!" };
|
|
|
RollbackTran();
|
|
RollbackTran();
|
|
@@ -334,7 +325,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
}
|
|
}
|
|
|
else if (item.Id == 0)//添加
|
|
else if (item.Id == 0)//添加
|
|
|
{
|
|
{
|
|
|
- int sss= await _sqlSugar.Insertable(Crm_VisaCustomerFamily).ExecuteReturnIdentityAsync();
|
|
|
|
|
|
|
+ int sss = await _sqlSugar.Insertable(Crm_VisaCustomerFamily).ExecuteReturnIdentityAsync();
|
|
|
if (sss == 0)
|
|
if (sss == 0)
|
|
|
{
|
|
{
|
|
|
result = new Result() { Code = -1, Msg = "家庭成员信息保存失败!" };
|
|
result = new Result() { Code = -1, Msg = "家庭成员信息保存失败!" };
|
|
@@ -352,7 +343,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
{
|
|
{
|
|
|
int res = await _sqlSugar.Updateable<Crm_CustomerCert>().Where(a => a.Id == CustomerCert.Id).SetColumns(a => new Crm_CustomerCert
|
|
int res = await _sqlSugar.Updateable<Crm_CustomerCert>().Where(a => a.Id == CustomerCert.Id).SetColumns(a => new Crm_CustomerCert
|
|
|
{
|
|
{
|
|
|
- DcId=CustomerCert.DcId,
|
|
|
|
|
|
|
+ DcId = CustomerCert.DcId,
|
|
|
SdId = CustomerCert.SdId,
|
|
SdId = CustomerCert.SdId,
|
|
|
CertNo = CustomerCert.CertNo,
|
|
CertNo = CustomerCert.CertNo,
|
|
|
Country = CustomerCert.Country,
|
|
Country = CustomerCert.Country,
|
|
@@ -389,7 +380,7 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
{
|
|
{
|
|
|
int res = await _sqlSugar.Updateable<Crm_VisaCustomerCompany>().Where(a => a.Id == VisaCustomerCompany.Id).SetColumns(a => new Crm_VisaCustomerCompany
|
|
int res = await _sqlSugar.Updateable<Crm_VisaCustomerCompany>().Where(a => a.Id == VisaCustomerCompany.Id).SetColumns(a => new Crm_VisaCustomerCompany
|
|
|
{
|
|
{
|
|
|
- DcId=VisaCustomerCompany.DcId,
|
|
|
|
|
|
|
+ DcId = VisaCustomerCompany.DcId,
|
|
|
Company = VisaCustomerCompany.Company,
|
|
Company = VisaCustomerCompany.Company,
|
|
|
CompanyAddress = VisaCustomerCompany.CompanyAddress,
|
|
CompanyAddress = VisaCustomerCompany.CompanyAddress,
|
|
|
Phone = VisaCustomerCompany.Phone,
|
|
Phone = VisaCustomerCompany.Phone,
|
|
@@ -469,11 +460,11 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
Result result = new Result() { Code = -2, Msg = "未知错误" };
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
- bool isOk=await SoftDeleteByIdAsync<Crm_DeleClient>(dto.Id.ToString(),dto.DeleteUserId);
|
|
|
|
|
|
|
+ bool isOk = await SoftDeleteByIdAsync<Crm_DeleClient>(dto.Id.ToString(), dto.DeleteUserId);
|
|
|
if (isOk)//删除其他表数据
|
|
if (isOk)//删除其他表数据
|
|
|
{
|
|
{
|
|
|
//客户工作经历
|
|
//客户工作经历
|
|
|
- await _sqlSugar.Updateable<Crm_VisaCustomerCompany>().Where(a => a.DcId==dto.Id).SetColumns(a => new Crm_VisaCustomerCompany()
|
|
|
|
|
|
|
+ await _sqlSugar.Updateable<Crm_VisaCustomerCompany>().Where(a => a.DcId == dto.Id).SetColumns(a => new Crm_VisaCustomerCompany()
|
|
|
{
|
|
{
|
|
|
IsDel = 1,
|
|
IsDel = 1,
|
|
|
DeleteUserId = dto.DeleteUserId,
|
|
DeleteUserId = dto.DeleteUserId,
|
|
@@ -511,7 +502,6 @@ namespace OASystem.Infrastructure.Repositories.CRM
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
#region 签证客户资料 New 2025-06-04
|
|
#region 签证客户资料 New 2025-06-04
|
|
|
|
|
|
|
|
|
|
|