|
|
|
@ -16,6 +16,7 @@ using System.Text.RegularExpressions;
|
|
|
|
|
using NPOI.Util;
|
|
|
|
|
using StackExchange.Profiling.Internal;
|
|
|
|
|
using Microsoft.AspNetCore.Authorization;
|
|
|
|
|
using static NPOI.HSSF.Util.HSSFColor;
|
|
|
|
|
|
|
|
|
|
namespace Myshipping.Core.Service
|
|
|
|
|
{
|
|
|
|
@ -410,10 +411,12 @@ namespace Myshipping.Core.Service
|
|
|
|
|
var dbContactList = await _repContact.AsQueryable().Filter(null, true).Where(x => x.CustomerId == cust.Id).ToListAsync();
|
|
|
|
|
foreach (var usr in dto.UserList)
|
|
|
|
|
{
|
|
|
|
|
DjyCustomerContact contact = dbContactList.FirstOrDefault(x => x.CustSysId == usr.Id);
|
|
|
|
|
|
|
|
|
|
//不存在,新增
|
|
|
|
|
if (dbContactList.Count(x => x.CustSysId == usr.Id) == 0)
|
|
|
|
|
if (contact == null)
|
|
|
|
|
{
|
|
|
|
|
var contact = new DjyCustomerContact()
|
|
|
|
|
contact = new DjyCustomerContact()
|
|
|
|
|
{
|
|
|
|
|
CustomerId = cust.Id,
|
|
|
|
|
Name = usr.Name,
|
|
|
|
@ -425,6 +428,25 @@ namespace Myshipping.Core.Service
|
|
|
|
|
|
|
|
|
|
await _repContact.InsertAsync(contact);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
contact.CustomerId = cust.Id;
|
|
|
|
|
contact.Name = usr.Name;
|
|
|
|
|
contact.Email = usr.Email;
|
|
|
|
|
contact.Tel = usr.Phone;
|
|
|
|
|
contact.CustSysId = usr.Id;
|
|
|
|
|
contact.DjyGid = usr.DjyGid;
|
|
|
|
|
|
|
|
|
|
await _repContact.UpdateAsync(contact);
|
|
|
|
|
|
|
|
|
|
dbContactList.Remove(contact);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//删除没有的用户
|
|
|
|
|
foreach (var contact in dbContactList)
|
|
|
|
|
{
|
|
|
|
|
await _repContact.DeleteAsync(contact);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|