diff --git a/Myshipping.Core/Entity/DJY/DjyCustomerAddr.cs b/Myshipping.Core/Entity/DJY/DjyCustomerAddr.cs
new file mode 100644
index 00000000..2bc638f8
--- /dev/null
+++ b/Myshipping.Core/Entity/DJY/DjyCustomerAddr.cs
@@ -0,0 +1,34 @@
+using System;
+using SqlSugar;
+using System.ComponentModel;
+using Myshipping.Core.Entity;
+namespace Myshipping.Core.Entity
+{
+ ///
+ /// 客户地址
+ ///
+ [SugarTable("djy_customer_addr")]
+ [Description("客户地址")]
+ public class DjyCustomerAddr
+ {
+ ///
+ /// 客户Id
+ ///
+ public long CustomerId { get; set; }
+
+ ///
+ /// 地址简称
+ ///
+ public string AddrName { get; set; }
+
+ ///
+ /// 地址详情
+ ///
+ public string Addr { get; set; }
+
+ ///
+ /// 地址类型 factory-工厂地址
+ ///
+ public string AddrType { get; set; }
+ }
+}
diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml
index ddf86d8d..6ef58e4b 100644
--- a/Myshipping.Core/Myshipping.Core.xml
+++ b/Myshipping.Core/Myshipping.Core.xml
@@ -1949,6 +1949,31 @@
等级
+
+
+ 客户地址
+
+
+
+
+ 客户Id
+
+
+
+
+ 地址简称
+
+
+
+
+ 地址详情
+
+
+
+
+ 地址类型 factory-工厂地址
+
+
@@ -10186,6 +10211,31 @@
默认最大行数
返回回执
+
+
+ 往来单位地址
+
+
+
+
+ 客户Id
+
+
+
+
+ 地址简称
+
+
+
+
+ 地址详情
+
+
+
+
+ 地址类型 factory-工厂地址
+
+
订舱客户联系人输出参数
@@ -10726,6 +10776,11 @@
服务项目
+
+
+ 地址列表
+
+
订舱客户新增输入参数
@@ -11041,6 +11096,11 @@
服务项目
+
+
+ 地址列表
+
+
检索车队参数
diff --git a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs
index 68762503..7f521ebb 100644
--- a/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs
+++ b/Myshipping.Core/Service/DjyCustomer/DjyCustomerService.cs
@@ -26,15 +26,18 @@ namespace Myshipping.Core.Service
{
private readonly SqlSugarRepository _rep;
private readonly SqlSugarRepository _repContact;
+ private readonly SqlSugarRepository _repAddr;
+
private readonly ILogger _logger;
- public DjyCustomerService(SqlSugarRepository rep, SqlSugarRepository repContact, ILogger logger)
+ public DjyCustomerService(SqlSugarRepository rep, SqlSugarRepository repContact, ILogger logger, SqlSugarRepository addrRepContact)
{
_rep = rep;
_repContact = repContact;
_logger = logger;
+ _repAddr = addrRepContact;
}
///
@@ -106,6 +109,12 @@ namespace Myshipping.Core.Service
var contactList = input.Contacts.Adapt>();
contactList.ForEach(x => x.CustomerId = entity.Id);
await _repContact.InsertAsync(contactList);
+
+ //地址
+ var addrList = input.Contacts.Adapt>();
+ addrList.ForEach(x => x.CustomerId = entity.Id);
+ await _repAddr.InsertAsync(addrList);
+
return entity.Id;
}
@@ -148,6 +157,11 @@ namespace Myshipping.Core.Service
var contactList = input.Contacts.Adapt>();
contactList.ForEach(x => x.CustomerId = entity.Id);
await _repContact.InsertAsync(contactList);
+ //地址
+ await _repAddr.DeleteAsync(x => x.CustomerId == input.Id);
+ var addrList = input.Contacts.Adapt>();
+ addrList.ForEach(x => x.CustomerId = entity.Id);
+ await _repAddr.InsertAsync(addrList);
return entity.Id;
}
@@ -167,6 +181,7 @@ namespace Myshipping.Core.Service
else
{
await _repContact.DeleteAsync(x => x.CustomerId == input.Id);
+ await _repAddr.DeleteAsync(x => x.CustomerId == input.Id);
await _rep.DeleteAsync(entity);
}
}
@@ -188,6 +203,8 @@ namespace Myshipping.Core.Service
}
var custOut = cust.Adapt();
custOut.Contacts = _repContact.Where(x => x.CustomerId == input.Id).OrderBy(x => x.Sort).ToList().Adapt>();
+ custOut.Addrs = _repAddr.Where(x => x.CustomerId == input.Id).ToList().Adapt>();
+
return custOut;
}
@@ -263,6 +280,9 @@ namespace Myshipping.Core.Service
var contactList = _repContact.AsQueryable()
.Where(a => custsArg.Contains(a.CustomerId.Value)).ToList();
+ var addrList = _repAddr.AsQueryable()
+ .Where(a => custsArg.Contains(a.CustomerId)).ToList();
+
list = list.GroupJoin(contactList, l => l.Id, r => r.CustomerId.Value, (l, r) =>
{
var curList = r.ToList();
@@ -273,6 +293,21 @@ namespace Myshipping.Core.Service
return l;
}).ToList();
+
+ if(addrList.Count > 0)
+ {
+ list = list.GroupJoin(addrList, l => l.Id, r => r.CustomerId, (l, r) =>
+ {
+ var curList = r.ToList();
+
+ if (curList.Count > 0)
+ l.Addrs = curList.Adapt>();
+
+ return l;
+
+ }).ToList();
+ }
+
}
}
diff --git a/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerAddrInput.cs b/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerAddrInput.cs
new file mode 100644
index 00000000..2f2cd893
--- /dev/null
+++ b/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerAddrInput.cs
@@ -0,0 +1,32 @@
+using Myshipping.Core;
+using System;
+using System.ComponentModel.DataAnnotations;
+
+namespace Myshipping.Core.Service
+{
+ ///
+ /// 往来单位地址
+ ///
+ public class DjyCustomerAddrInput
+ {
+ ///
+ /// 客户Id
+ ///
+ public long CustomerId { get; set; }
+
+ ///
+ /// 地址简称
+ ///
+ public string AddrName { get; set; }
+
+ ///
+ /// 地址详情
+ ///
+ public string Addr { get; set; }
+
+ ///
+ /// 地址类型 factory-工厂地址
+ ///
+ public string AddrType { get; set; }
+ }
+}
diff --git a/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerInput.cs b/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerInput.cs
index 74bef481..4cd85f6e 100644
--- a/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerInput.cs
+++ b/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerInput.cs
@@ -13,6 +13,8 @@ namespace Myshipping.Core.Service
public DjyCustomerInput()
{
this.Contacts = new List();
+ this.Addrs = new List();
+
}
///
@@ -167,6 +169,11 @@ namespace Myshipping.Core.Service
///
public string ServiceItem { get; set; }
public List Contacts { get; set; }
+
+ ///
+ /// 地址列表
+ ///
+ public List Addrs { get; set; }
}
///
diff --git a/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerOutput.cs b/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerOutput.cs
index 25335602..459cfa14 100644
--- a/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerOutput.cs
+++ b/Myshipping.Core/Service/DjyCustomer/Dto/DjyCustomerOutput.cs
@@ -160,5 +160,9 @@ namespace Myshipping.Core.Service
///
public string ServiceItem { get; set; }
public List Contacts { get; set; }
+ ///
+ /// 地址列表
+ ///
+ public List Addrs { get; set; }
}
}