diff --git a/ARW.Model/Dto/Api/Custom/CustomerAddresses/CustomerAddressApiDto.cs b/ARW.Model/Dto/Api/Custom/CustomerAddresses/CustomerAddressApiDto.cs
new file mode 100644
index 0000000..b621396
--- /dev/null
+++ b/ARW.Model/Dto/Api/Custom/CustomerAddresses/CustomerAddressApiDto.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using ARW.Model.Models.Business.Custom.CustomerAddresses;
+
+namespace ARW.Model.Dto.Api.Custom.CustomerAddresses
+{
+
+ ///
+ /// 客户收货地址查询对象Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public class CustomerAddressQueryDtoApi : PagerInfo
+ {
+ public long CustomerAddressCustomerGuid { get; set; }
+ public string CustomerAddressName { get; set; }
+ public string CustomerAddressPhone { get; set; }
+ }
+
+
+ ///
+ /// 客户收货地址详情输入对象Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public class CustomerAddressDtoApi
+ {
+ [Required(ErrorMessage = "CustomerAddressGuid不能为空")]
+ public long CustomerAddressGuid { get; set; }
+ }
+
+}
diff --git a/ARW.Model/Dto/Api/Custom/Regions/RegionApiDto.cs b/ARW.Model/Dto/Api/Custom/Regions/RegionApiDto.cs
new file mode 100644
index 0000000..d95c386
--- /dev/null
+++ b/ARW.Model/Dto/Api/Custom/Regions/RegionApiDto.cs
@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using ARW.Model.Models.Business.Custom.Regions;
+
+namespace ARW.Model.Dto.Api.Custom.Regions
+{
+
+ ///
+ /// 省市区数据表查询对象Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public class RegionQueryDtoApi : PagerInfo
+ {
+ public string RegionName { get; set; }
+ }
+
+
+ ///
+ /// 省市区数据表详情输入对象Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public class RegionDtoApi
+ {
+ [Required(ErrorMessage = "RegionGuid不能为空")]
+ public long RegionGuid { get; set; }
+ }
+
+}
diff --git a/ARW.Model/Vo/Api/Custom/CustomerAddresses/CustomerAddressApiVo.cs b/ARW.Model/Vo/Api/Custom/CustomerAddresses/CustomerAddressApiVo.cs
new file mode 100644
index 0000000..f18f092
--- /dev/null
+++ b/ARW.Model/Vo/Api/Custom/CustomerAddresses/CustomerAddressApiVo.cs
@@ -0,0 +1,85 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Api.Custom.CustomerAddresses
+{
+ ///
+ /// 客户收货地址展示对象Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public class CustomerAddressVoApi
+ {
+
+
+ ///
+ /// 描述 : id
+ ///
+ public int CustomerAddressId { get; set; }
+
+
+ ///
+ /// 描述 : guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [EpplusIgnore]
+ public long CustomerAddressGuid { get; set; }
+
+
+ ///
+ /// 描述 :收货人名称
+ ///
+ public string Name { get; set; }
+
+
+ ///
+ /// 描述 :收货电话
+ ///
+ public string PhoneNumber { get; set; }
+
+
+ ///
+ /// 描述 :详细地址
+ ///
+ public string Address { get; set; }
+
+ ///
+ /// 描述 : 是否为默认地址
+ ///
+ public bool IsDefault { get; set; }
+
+ }
+
+
+ ///
+ /// 客户收货地址详情展示对象Api
+ ///
+ public class CustomerAddressApiDetailsVo
+ {
+ [EpplusIgnore]
+ public int CustomerAddressId { get; set; }
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [EpplusIgnore]
+ public long CustomerAddressGuid { get; set; }
+ [JsonConverter(typeof(ValueToStringConverter))]
+ [EpplusTableColumn(Header = "客户guid")]
+ public long CustomerAddressCustomerGuid { get; set; }
+ [EpplusTableColumn(Header = "省id")]
+ public int CustomerAddressProvinceId { get; set; }
+ [EpplusTableColumn(Header = "市id")]
+ public int CustomerAddressCityId { get; set; }
+ [EpplusTableColumn(Header = "区id")]
+ public int CustomerAddressAreaId { get; set; }
+ [EpplusTableColumn(Header = "收货人名称")]
+ public string CustomerAddressName { get; set; }
+ [EpplusTableColumn(Header = "收货电话")]
+ public string CustomerAddressPhone { get; set; }
+ [EpplusTableColumn(Header = "详细地址")]
+ public string CustomerAddressDetailed { get; set; }
+
+ }
+
+}
diff --git a/ARW.Model/Vo/Api/Custom/Regions/RegionApiVo.cs b/ARW.Model/Vo/Api/Custom/Regions/RegionApiVo.cs
new file mode 100644
index 0000000..bfc8ad4
--- /dev/null
+++ b/ARW.Model/Vo/Api/Custom/Regions/RegionApiVo.cs
@@ -0,0 +1,85 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+using ARW.Model.Models.Business.Custom.Regions;
+using System.Collections.Generic;
+
+namespace ARW.Model.Vo.Api.Custom.Regions
+{
+ ///
+ /// 省市区数据表展示对象Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public class RegionVoApi
+ {
+
+
+ ///
+ /// 描述 :区划信息ID
+ ///
+ [EpplusIgnore]
+ public int RegionId { get; set; }
+
+
+ ///
+ /// 描述 :区划名称
+ ///
+ [EpplusTableColumn(Header = "区划名称")]
+ public string RegionName { get; set; }
+
+
+ ///
+ /// 描述 :父级ID
+ ///
+ [EpplusTableColumn(Header = "父级ID")]
+ public int RegionPid { get; set; }
+
+
+ ///
+ /// 描述 :区划编码
+ ///
+ [EpplusTableColumn(Header = "区划编码")]
+ public string RegionCode { get; set; }
+
+
+ ///
+ /// 描述 :层级(1省级 2市级 3区/县级)
+ ///
+ [EpplusTableColumn(Header = "层级(1省级 2市级 3区/县级)")]
+ public int RegionLevel { get; set; }
+
+ public string ParentName { get; set; }
+
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ [SugarColumn(IsIgnore = true)]
+ public List Children { get; set; }
+ }
+
+
+ ///
+ /// 省市区数据表详情展示对象Api
+ ///
+ public class RegionApiDetailsVo
+ {
+ [EpplusIgnore]
+ public int RegionId { get; set; }
+ [EpplusTableColumn(Header = "区划名称")]
+ public string RegionName { get; set; }
+ [EpplusTableColumn(Header = "父级ID")]
+ public int RegionPid { get; set; }
+ [EpplusTableColumn(Header = "区划编码")]
+ public string RegionCode { get; set; }
+ [EpplusTableColumn(Header = "层级(1省级 2市级 3区/县级)")]
+ public int RegionLevel { get; set; }
+
+ public string ParentName { get; set; }
+
+ [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
+ [SugarColumn(IsIgnore = true)]
+ public List Children { get; set; }
+ }
+
+}
diff --git a/ARW.Repository/Business/Custom/Customers/CustomerRepository.cs b/ARW.Repository/Business/Custom/Customers/CustomerRepository.cs
new file mode 100644
index 0000000..96c70b9
--- /dev/null
+++ b/ARW.Repository/Business/Custom/Customers/CustomerRepository.cs
@@ -0,0 +1,20 @@
+using System;
+using Infrastructure.Attribute;
+using ARW.Repository.System;
+using ARW.Model.Models.Business.Custom.Customers;
+
+namespace ARW.Repository.Business.Custom.Customers
+{
+ ///
+ /// 小程序客户仓储
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-05
+ ///
+ [AppService(ServiceLifetime = LifeTime.Transient)]
+ public class CustomerRepository : BaseRepository
+ {
+ #region 业务逻辑代码
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/ARW.Repository/Business/Custom/Regions/RegionRepository.cs b/ARW.Repository/Business/Custom/Regions/RegionRepository.cs
new file mode 100644
index 0000000..3410ede
--- /dev/null
+++ b/ARW.Repository/Business/Custom/Regions/RegionRepository.cs
@@ -0,0 +1,20 @@
+using System;
+using Infrastructure.Attribute;
+using ARW.Repository.System;
+using ARW.Model.Models.Business.Custom.Regions;
+
+namespace ARW.Repository.Business.Custom.Regions
+{
+ ///
+ /// 省市区数据表仓储
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ [AppService(ServiceLifetime = LifeTime.Transient)]
+ public class RegionRepository : BaseRepository
+ {
+ #region 业务逻辑代码
+ #endregion
+ }
+}
\ No newline at end of file
diff --git a/ARW.Service/Api/BusinessService/Custom/CustomerAddresses/CustomerAddressServiceApi.cs b/ARW.Service/Api/BusinessService/Custom/CustomerAddresses/CustomerAddressServiceApi.cs
new file mode 100644
index 0000000..c9c7d34
--- /dev/null
+++ b/ARW.Service/Api/BusinessService/Custom/CustomerAddresses/CustomerAddressServiceApi.cs
@@ -0,0 +1,110 @@
+using Infrastructure.Attribute;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Repository;
+using ARW.Repository.Business.Custom.CustomerAddresses;
+using ARW.Service.Api.IBusinessService.Custom.CustomerAddresses;
+using ARW.Model.Dto.Api.Custom.CustomerAddresses;
+using ARW.Model.Models.Business.Custom.CustomerAddresses;
+using ARW.Model.Vo.Api.Custom.CustomerAddresses;
+using ARW.Model.Models.Business.Custom.Regions;
+using ARW.Model.Models.Business.Custom.Customers;
+using Microsoft.AspNetCore.Server.IISIntegration;
+
+namespace ARW.Service.Api.BusinessService.Custom.CustomerAddresses
+{
+ ///
+ /// 客户收货地址接口实现类Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ [AppService(ServiceType = typeof(ICustomerAddressServiceApi), ServiceLifetime = LifeTime.Transient)]
+ public class CustomerAddressServiceImplApi : BaseService, ICustomerAddressServiceApi
+ {
+ private readonly CustomerAddressRepository _CustomerAddressRepository;
+
+ public CustomerAddressServiceImplApi(CustomerAddressRepository CustomerAddressRepository)
+ {
+ this._CustomerAddressRepository = CustomerAddressRepository;
+ }
+
+ #region Api接口代码
+
+
+ ///
+ /// 查询客户收货地址列表(Api)
+ ///
+ ///
+ ///
+ public async Task> GetCustomerAddressListApi(CustomerAddressQueryDtoApi parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ var query = _CustomerAddressRepository
+ .Queryable()
+ .LeftJoin((s, c) => s.CustomerAddressProvinceId == c.RegionId)
+ .LeftJoin((s, c, d) => s.CustomerAddressCityId == d.RegionId)
+ .LeftJoin((s, c, d, f) => s.CustomerAddressAreaId == f.RegionId)
+ .LeftJoin((s, c, d, f, g) => s.CustomerAddressCustomerGuid == g.CustomerGuid)
+ .Where((s) => s.CustomerAddressCustomerGuid == parm.CustomerAddressCustomerGuid)
+ .Where(predicate.ToExpression())
+ .OrderBy(s => s.Create_time, OrderByType.Asc)
+ .Select((s, c, d, f, g) => new CustomerAddressVoApi
+ {
+ CustomerAddressId = s.CustomerAddressId,
+ CustomerAddressGuid = s.CustomerAddressGuid,
+ Name = s.CustomerAddressName,
+ PhoneNumber = s.CustomerAddressPhone,
+ Address = c.RegionName + d.RegionName + f.RegionName + s.CustomerAddressDetailed,
+ IsDefault = s.CustomerAddressGuid == g.CustomerDefaultAddressGuid
+ });
+
+
+ return await query.ToListAsync();
+ }
+
+ ///
+ /// 查询客户收货地址详情(Api)
+ ///
+ ///
+ ///
+ public Task GetCustomerAddressDetails(CustomerAddressDtoApi parm)
+ {
+
+ var query = _CustomerAddressRepository
+ .Queryable()
+ .LeftJoin((s, c) => s.CustomerAddressProvinceId == c.RegionPid)
+ .LeftJoin((s, c, d) => s.CustomerAddressCityId == d.RegionPid)
+ .LeftJoin((s, c, d, f) => s.CustomerAddressAreaId == f.RegionPid)
+ .LeftJoin((s, c, d, f, g) => s.CustomerAddressCustomerGuid == g.CustomerGuid)
+ .Where(s => s.CustomerAddressGuid == parm.CustomerAddressGuid)
+ .Select(s => new CustomerAddressApiDetailsVo
+ {
+ CustomerAddressId = s.CustomerAddressId,
+ CustomerAddressGuid = s.CustomerAddressGuid,
+ CustomerAddressCustomerGuid = s.CustomerAddressCustomerGuid,
+ CustomerAddressProvinceId = s.CustomerAddressProvinceId,
+ CustomerAddressCityId = s.CustomerAddressCityId,
+ CustomerAddressAreaId = s.CustomerAddressAreaId,
+ CustomerAddressName = s.CustomerAddressName,
+ CustomerAddressPhone = s.CustomerAddressPhone,
+ CustomerAddressDetailed = s.CustomerAddressDetailed,
+ }).Take(1);
+
+
+ return query.ToJsonAsync();
+ }
+
+
+ #endregion
+
+ }
+}
diff --git a/ARW.Service/Api/BusinessService/Custom/Regions/RegionServiceApi.cs b/ARW.Service/Api/BusinessService/Custom/Regions/RegionServiceApi.cs
new file mode 100644
index 0000000..2d53cdd
--- /dev/null
+++ b/ARW.Service/Api/BusinessService/Custom/Regions/RegionServiceApi.cs
@@ -0,0 +1,95 @@
+using Infrastructure.Attribute;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Repository;
+using ARW.Repository.Business.Custom.Regions;
+using ARW.Service.Api.IBusinessService.Custom.Regions;
+using ARW.Model.Dto.Api.Custom.Regions;
+using ARW.Model.Models.Business.Custom.Regions;
+using ARW.Model.Vo.Api.Custom.Regions;
+
+namespace ARW.Service.Api.BusinessService.Custom.Regions
+{
+ ///
+ /// 省市区数据表接口实现类Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ [AppService(ServiceType = typeof(IRegionServiceApi), ServiceLifetime = LifeTime.Transient)]
+ public class RegionServiceImplApi : BaseService, IRegionServiceApi
+ {
+ private readonly RegionRepository _RegionRepository;
+
+ public RegionServiceImplApi(RegionRepository RegionRepository)
+ {
+ this._RegionRepository = RegionRepository;
+ }
+
+ #region Api接口代码
+
+
+ ///
+ /// 查询省市区数据表树形列表(Api)
+ ///
+ ///
+ ///
+ public async Task> GetRegionTreeListApi(RegionQueryDtoApi parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.RegionName), it => it.RegionName.Contains(parm.RegionName));
+ var query = _RegionRepository
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .LeftJoin((s, c) => s.RegionPid == c.RegionGuid)
+ .OrderBy(s => s.RegionId,OrderByType.Asc)
+ .Select((s,c) => new RegionVoApi
+ {
+ RegionId = s.RegionId,
+ RegionName = s.RegionName,
+ RegionPid = s.RegionPid,
+ RegionCode = s.RegionCode,
+ RegionLevel = s.RegionLevel,
+ ParentName = c.RegionName,
+});
+
+ return await query.ToTreeAsync(it => it.Children, it => it.RegionPid, 0);
+ }
+
+ ///
+ /// 查询省市区数据表详情(Api)
+ ///
+ ///
+ ///
+ public Task GetRegionDetails(RegionDtoApi parm)
+ {
+
+ var query = _RegionRepository
+ .Queryable()
+ .Where(s => s.RegionGuid == parm.RegionGuid)
+ .Select(s => new RegionApiDetailsVo
+ {
+ RegionId = s.RegionId,
+ RegionName = s.RegionName,
+ RegionPid = s.RegionPid,
+ RegionCode = s.RegionCode,
+ RegionLevel = s.RegionLevel,
+ }).Take(1);
+
+
+ return query.ToJsonAsync();
+ }
+
+
+#endregion
+
+ }
+}
diff --git a/ARW.Service/Api/IBusinessService/Custom/CustomerAddresses/ICustomerAddressServiceApi.cs b/ARW.Service/Api/IBusinessService/Custom/CustomerAddresses/ICustomerAddressServiceApi.cs
new file mode 100644
index 0000000..9a817f5
--- /dev/null
+++ b/ARW.Service/Api/IBusinessService/Custom/CustomerAddresses/ICustomerAddressServiceApi.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Api.Custom.CustomerAddresses;
+using ARW.Model.Models.Business.Custom.CustomerAddresses;
+using ARW.Model.Vo.Api.Custom.CustomerAddresses;
+
+namespace ARW.Service.Api.IBusinessService.Custom.CustomerAddresses
+{
+ ///
+ /// 客户收货地址接口类Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public interface ICustomerAddressServiceApi : IBaseService
+ {
+ ///
+ /// 获取客户收货地址分页列表(Api)
+ ///
+ ///
+ ///
+ Task> GetCustomerAddressListApi(CustomerAddressQueryDtoApi parm);
+
+ ///
+ /// 获取客户收货地址详情(Api)
+ ///
+ ///
+ ///
+ Task GetCustomerAddressDetails(CustomerAddressDtoApi parm);
+
+ }
+}
diff --git a/ARW.Service/Api/IBusinessService/Custom/Regions/IRegionServiceApi.cs b/ARW.Service/Api/IBusinessService/Custom/Regions/IRegionServiceApi.cs
new file mode 100644
index 0000000..debc641
--- /dev/null
+++ b/ARW.Service/Api/IBusinessService/Custom/Regions/IRegionServiceApi.cs
@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Api.Custom.Regions;
+using ARW.Model.Models.Business.Custom.Regions;
+using ARW.Model.Vo.Api.Custom.Regions;
+
+namespace ARW.Service.Api.IBusinessService.Custom.Regions
+{
+ ///
+ /// 省市区数据表接口类Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ public interface IRegionServiceApi : IBaseService
+ {
+ ///
+ /// 获取省市区数据表树形列表(Api)
+ ///
+ ///
+ ///
+ Task> GetRegionTreeListApi(RegionQueryDtoApi parm);
+
+ ///
+ /// 获取省市区数据表详情(Api)
+ ///
+ ///
+ ///
+ Task GetRegionDetails(RegionDtoApi parm);
+
+ }
+}
diff --git a/ARW.Service/Business/BusinessService/Custom/Customers/CustomerService.cs b/ARW.Service/Business/BusinessService/Custom/Customers/CustomerService.cs
new file mode 100644
index 0000000..a089240
--- /dev/null
+++ b/ARW.Service/Business/BusinessService/Custom/Customers/CustomerService.cs
@@ -0,0 +1,111 @@
+using Infrastructure.Attribute;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Infrastructure;
+using ARW.Model;
+using ARW.Repository;
+using ARW.Model.Dto.Business.Custom.Customers;
+using ARW.Model.Models.Business.Custom.Customers;
+using ARW.Model.Vo.Business.Custom.Customers;
+using ARW.Repository.Business.Custom.Customers;
+using ARW.Service.Business.IBusinessService.Custom.Customers;
+
+namespace ARW.Service.Business.BusinessService.Custom.Customers
+{
+ ///
+ /// 小程序客户接口实现类
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-05
+ ///
+ [AppService(ServiceType = typeof(ICustomerService), ServiceLifetime = LifeTime.Transient)]
+ public class CustomerServiceImpl : BaseService, ICustomerService
+ {
+ private readonly CustomerRepository _CustomerRepository;
+
+ public CustomerServiceImpl(CustomerRepository CustomerRepository)
+ {
+ _CustomerRepository = CustomerRepository;
+ }
+
+ #region 业务逻辑代码
+
+
+ ///
+ /// 查询小程序客户分页列表
+ ///
+ public Task> GetCustomerList(CustomerQueryDto parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerXcxOpenid), it => it.CustomerXcxOpenid == parm.CustomerXcxOpenid);
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerNickname), it => it.CustomerNickname.Contains(parm.CustomerNickname));
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerMobilePhoneNumber), it => it.CustomerMobilePhoneNumber.Contains(parm.CustomerMobilePhoneNumber));
+ predicate = predicate.AndIF(parm.BeginTime != null && parm.EndTime != null, it => it.CustomerLastLoginTime >= parm.BeginTime && it.CustomerLastLoginTime <= parm.EndTime);
+ var query = _CustomerRepository
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .OrderBy(s => s.Create_time, OrderByType.Desc)
+ .Select(s => new CustomerVo
+ {
+ CustomerId = s.CustomerId,
+ CustomerGuid = s.CustomerGuid,
+ CustomerXcxOpenid = s.CustomerXcxOpenid,
+ CustomerNickname = s.CustomerNickname,
+ CustomerMobilePhoneNumber = s.CustomerMobilePhoneNumber,
+ CustomerAvatar = s.CustomerAvatar,
+ CustomerGender = s.CustomerGender,
+ CustomerAvailableBalance = s.CustomerAvailableBalance,
+ CustomerAvailablePoints = s.CustomerAvailablePoints,
+ CustomerTotalPaymentAmount = s.CustomerTotalPaymentAmount,
+ CustomerActualConsumptionAmount = s.CustomerActualConsumptionAmount,
+ CustomerLastLoginTime = s.CustomerLastLoginTime,
+ });
+
+
+ return query.ToPageAsync(parm);
+ }
+
+ ///
+ /// 添加或修改小程序客户
+ ///
+ public async Task AddOrUpdateCustomer(Customer model)
+ {
+ if (model.CustomerId != 0)
+ {
+ var response = await _CustomerRepository.UpdateAsync(model);
+ return "修改成功!";
+ }
+ else
+ {
+
+ var response = await _CustomerRepository.InsertReturnSnowflakeIdAsync(model);
+ return "添加成功!";
+ }
+ }
+
+ #region Excel处理
+
+
+ ///
+ /// Excel数据导出处理
+ ///
+ public async Task> HandleExportData(List data)
+ {
+ return data;
+ }
+
+ #endregion
+
+
+
+ #endregion
+
+ }
+}
diff --git a/ARW.Service/Business/BusinessService/Custom/Regions/RegionService.cs b/ARW.Service/Business/BusinessService/Custom/Regions/RegionService.cs
new file mode 100644
index 0000000..273857f
--- /dev/null
+++ b/ARW.Service/Business/BusinessService/Custom/Regions/RegionService.cs
@@ -0,0 +1,154 @@
+using Infrastructure.Attribute;
+using Microsoft.AspNetCore.Http;
+using SqlSugar;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Infrastructure;
+using ARW.Model;
+using ARW.Repository;
+using ARW.Model.Dto.Business.Custom.Regions;
+using ARW.Model.Models.Business.Custom.Regions;
+using ARW.Model.Vo.Business.Custom.Regions;
+using ARW.Repository.Business.Custom.Regions;
+using ARW.Service.Business.IBusinessService.Custom.Regions;
+
+namespace ARW.Service.Business.BusinessService.Custom.Regions
+{
+ ///
+ /// 省市区数据表接口实现类
+ ///
+ [AppService(ServiceType = typeof(IRegionService), ServiceLifetime = LifeTime.Transient)]
+ public class RegionServiceImpl : BaseService, IRegionService
+ {
+ private readonly RegionRepository _RegionRepository;
+
+ public RegionServiceImpl(RegionRepository RegionRepository)
+ {
+ _RegionRepository = RegionRepository;
+ }
+
+ #region 业务逻辑代码
+
+
+ ///
+ /// 查询省市区数据表树形列表
+ ///
+ public async Task> GetRegionTreeList(RegionQueryDto parm)
+ {
+ //开始拼装查询条件
+ var predicate = Expressionable.Create();
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.RegionName), s => s.RegionName.Contains(parm.RegionName));
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.RegionCode), s => s.RegionCode == parm.RegionCode);
+
+ var query = _RegionRepository
+ .Queryable()
+ .LeftJoin((s, c) => s.RegionPid == c.RegionId)
+ .Where(predicate.ToExpression())
+ .OrderBy(s => s.RegionId, OrderByType.Asc)
+ .Select((s, c) => new RegionVo
+ {
+ RegionId = s.RegionId,
+ RegionName = s.RegionName,
+ RegionPid = s.RegionPid,
+ RegionCode = s.RegionCode,
+ RegionLevel = s.RegionLevel,
+ ParentName = c.RegionName,
+ });
+
+ return await query.ToTreeAsync(it => it.Children, it => it.RegionPid, 0);
+ }
+
+
+ ///
+ /// 查询省市区数据表列表
+ ///
+ public Task> GetRegionList(RegionQueryDto parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.RegionName), it => it.RegionName.Contains(parm.RegionName));
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.RegionCode), it => it.RegionCode == parm.RegionCode);
+ var query = _RegionRepository
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .OrderBy(s => s.RegionId, OrderByType.Asc)
+ .Select(s => new RegionVo
+ {
+ RegionId = s.RegionId,
+ RegionName = s.RegionName,
+ RegionPid = s.RegionPid,
+ RegionCode = s.RegionCode,
+ RegionLevel = s.RegionLevel,
+ });
+
+
+ return query.ToListAsync();
+ }
+
+ ///
+ /// 添加或修改省市区数据表
+ ///
+ public async Task AddOrUpdateRegion(Region model)
+ {
+ if (model.RegionId != 0)
+ {
+ var type = await _RegionRepository.GetListAsync(s => s.RegionPid == model.RegionId);
+ if (type != null)
+ {
+ foreach (var item in type)
+ {
+ if (model.RegionPid == item.RegionId) throw new CustomException("上级菜单不能选择自己的子级!");
+ }
+ }
+ if (model.RegionPid == model.RegionId) throw new CustomException("上级菜单不能选择与当前菜单一样的!");
+ var response = await _RegionRepository.UpdateAsync(model);
+ return "修改成功!";
+ }
+ else
+ {
+ var info = _RegionRepository.GetFirst(it => it.RegionId == model.RegionPid);
+
+ var response = await _RegionRepository.InsertAsync(model);
+ return "添加成功!";
+ }
+ }
+
+
+ ///
+ /// 获取省市区Id
+ ///
+ /// 省市区编码
+ ///
+ ///
+ public async Task GetRegionId(string RegionCode, int level)
+ {
+ var region = await _RegionRepository.GetFirstAsync(s => s.RegionCode == RegionCode && s.RegionLevel == level);
+ if (region == null) throw new Exception("编码不正确");
+ return region.RegionId;
+ }
+
+
+
+ #region Excel处理
+
+
+ ///
+ /// Excel数据导出处理
+ ///
+ public async Task> HandleExportData(List data)
+ {
+ return data;
+ }
+
+ #endregion
+
+
+
+ #endregion
+
+ }
+}
diff --git a/ARW.Service/Business/IBusinessService/Custom/Customers/ICustomerService.cs b/ARW.Service/Business/IBusinessService/Custom/Customers/ICustomerService.cs
new file mode 100644
index 0000000..fbb5d1e
--- /dev/null
+++ b/ARW.Service/Business/IBusinessService/Custom/Customers/ICustomerService.cs
@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Business.Custom.Customers;
+using ARW.Model.Models.Business.Custom.Customers;
+using ARW.Model.Vo.Business.Custom.Customers;
+
+namespace ARW.Service.Business.IBusinessService.Custom.Customers
+{
+ ///
+ /// 小程序客户接口类
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-05
+ ///
+ public interface ICustomerService : IBaseService
+ {
+ ///
+ /// 获取小程序客户分页列表
+ ///
+ ///
+ ///
+ Task> GetCustomerList(CustomerQueryDto parm);
+
+
+ ///
+ /// 添加或修改小程序客户
+ ///
+ ///
+ ///
+ Task AddOrUpdateCustomer(Customer parm);
+
+
+
+ ///
+ /// Excel导出
+ ///
+ Task> HandleExportData(List data);
+
+
+ }
+}
diff --git a/ARW.Service/Business/IBusinessService/Custom/Regions/IRegionService.cs b/ARW.Service/Business/IBusinessService/Custom/Regions/IRegionService.cs
new file mode 100644
index 0000000..704dc7f
--- /dev/null
+++ b/ARW.Service/Business/IBusinessService/Custom/Regions/IRegionService.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using ARW.Model;
+using ARW.Model.Dto.Business.Custom.Regions;
+using ARW.Model.Models.Business.Custom.Regions;
+using ARW.Model.Vo.Business.Custom.Regions;
+
+namespace ARW.Service.Business.IBusinessService.Custom.Regions
+{
+ public interface IRegionService : IBaseService
+ {
+ ///
+ /// 获取省市区数据表树形列表
+ ///
+ ///
+ ///
+ Task> GetRegionTreeList(RegionQueryDto parm);
+
+ ///
+ /// 获取省市区数据表列表
+ ///
+ ///
+ ///
+ Task> GetRegionList(RegionQueryDto parm);
+
+
+ ///
+ /// 添加或修改省市区数据表
+ ///
+ ///
+ ///
+ Task AddOrUpdateRegion(Region parm);
+
+
+
+ ///
+ /// Excel导出
+ ///
+ Task> HandleExportData(List data);
+
+
+ ///
+ /// 获取省市区Id
+ ///
+ /// 省市区编码
+ ///
+ Task GetRegionId(string RegionCode,int level);
+
+ }
+}
diff --git a/ARW.WebApi/Controllers/Api/Custom/CustomerAddresses/CustomerAddressApiController.cs b/ARW.WebApi/Controllers/Api/Custom/CustomerAddresses/CustomerAddressApiController.cs
new file mode 100644
index 0000000..68980e4
--- /dev/null
+++ b/ARW.WebApi/Controllers/Api/Custom/CustomerAddresses/CustomerAddressApiController.cs
@@ -0,0 +1,84 @@
+using Infrastructure;
+using Infrastructure.Attribute;
+using Infrastructure.Enums;
+using Infrastructure.Model;
+using Mapster;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using ARW.Admin.WebApi.Extensions;
+using ARW.Admin.WebApi.Filters;
+using ARW.Common;
+using ARW.Admin.WebApi.Controllers;
+using ARW.Model.Dto.Api.Custom.CustomerAddresses;
+using ARW.Service.Api.IBusinessService.Custom.CustomerAddresses;
+using ARW.Model.Models.Business.Custom.CustomerAddresses;
+using ARW.Model.Vo.Api.Custom.CustomerAddresses;
+using Microsoft.AspNetCore.Authorization;
+using Geocoding;
+using ARW.Admin.WebApi.Framework;
+
+namespace ARW.WebApi.Controllers.Api.Custom.CustomerAddresses
+{
+ ///
+ /// 客户收货地址控制器Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ [Verify]
+ [Route("api/[controller]")]
+ public class CustomerAddressApiController : BaseController
+ {
+ private readonly ICustomerAddressServiceApi _CustomerAddressServiceApi;
+
+ ///
+ /// 依赖注入
+ ///
+ /// 客户收货地址客户收货地址Api服务
+ public CustomerAddressApiController(ICustomerAddressServiceApi CustomerAddressServiceApi)
+ {
+ _CustomerAddressServiceApi = CustomerAddressServiceApi;
+ }
+
+
+ ///
+ /// 获取客户收货地址列表(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getCustomerAddressList")]
+ public async Task GetCustomerAddressListApi([FromQuery] CustomerAddressQueryDtoApi parm)
+ {
+ var user = JwtUtil.GetLoginUser(App.HttpContext);
+ parm.CustomerAddressCustomerGuid = user.UserId;
+ var res = await _CustomerAddressServiceApi.GetCustomerAddressListApi(parm);
+ return SUCCESS(res);
+ }
+
+ ///
+ /// 获取CustomerAddress详情(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getCustomerAddressDetails")]
+ public async Task GetCustomerAddressDetails([FromQuery] CustomerAddressDtoApi parm)
+ {
+ if (parm == null) throw new CustomException("参数错误!");
+
+ var res = await _CustomerAddressServiceApi.GetCustomerAddressDetails(parm);
+
+ if (res != "[]")
+ {
+ res = res.Remove(0, 1);
+ res = res.Substring(0, res.Length - 1);
+ var data = res.FromJSON();
+ return SUCCESS(data);
+ }
+ else
+ {
+ return SUCCESS(res);
+ }
+ }
+
+ }
+}
diff --git a/ARW.WebApi/Controllers/Api/Custom/Regions/RegionApiController.cs b/ARW.WebApi/Controllers/Api/Custom/Regions/RegionApiController.cs
new file mode 100644
index 0000000..bf0bdaf
--- /dev/null
+++ b/ARW.WebApi/Controllers/Api/Custom/Regions/RegionApiController.cs
@@ -0,0 +1,84 @@
+using Infrastructure;
+using Infrastructure.Attribute;
+using Infrastructure.Enums;
+using Infrastructure.Model;
+using Mapster;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using ARW.Admin.WebApi.Extensions;
+using ARW.Admin.WebApi.Filters;
+using ARW.Common;
+using ARW.Admin.WebApi.Controllers;
+using ARW.Model.Dto.Api.Custom.Regions;
+using ARW.Service.Api.IBusinessService.Custom.Regions;
+using ARW.Model.Models.Business.Custom.Regions;
+using ARW.Model.Vo.Api.Custom.Regions;
+using Microsoft.AspNetCore.Authorization;
+using Geocoding;
+
+namespace ARW.WebApi.Controllers.Api.Custom.Regions
+{
+ ///
+ /// 省市区数据表控制器Api
+ ///
+ /// @author admin
+ /// @date 2023-06-09
+ ///
+ [Verify]
+ [Route("api/[controller]")]
+ public class RegionApiController : BaseController
+ {
+ private readonly IRegionServiceApi _RegionServiceApi;
+
+ ///
+ /// 依赖注入
+ ///
+ /// 省市区数据表省市区数据表Api服务
+ public RegionApiController(IRegionServiceApi RegionServiceApi)
+ {
+ _RegionServiceApi = RegionServiceApi;
+ }
+
+
+ ///
+ /// 获取省市区数据表树形列表(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getRegionTreeList")]
+ public async Task GetRegionTreeListApi([FromQuery] RegionQueryDtoApi parm)
+ {
+ var res = await _RegionServiceApi.GetRegionTreeListApi(parm);
+ if (res == null)
+ res = new List();
+
+ return SUCCESS(res);
+ }
+
+ ///
+ /// 获取Region详情(Api)
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getRegionDetails")]
+ public async Task GetRegionDetails([FromQuery] RegionDtoApi parm)
+ {
+ //if (parm == null) throw new CustomException("参数错误!");
+
+ var res = await _RegionServiceApi.GetRegionDetails(parm);
+
+ if (res != "[]")
+ {
+ res = res.Remove(0, 1);
+ res = res.Substring(0, res.Length - 1);
+ var data = res.FromJSON();
+ return SUCCESS(data);
+ }
+ else
+ {
+ return SUCCESS(res);
+ }
+ }
+
+ }
+}