diff --git a/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs b/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
index 07d00a3..4cfdee7 100644
--- a/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
+++ b/ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
@@ -86,9 +86,22 @@ namespace ARW.Model.Dto.Business.ShopManager.Shops
}
+ ///
+ /// 未绑定的用户查询对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-09
+ ///
+ public class UserWithOutBindQueryDto : PagerInfo
+ {
+
+ public string UserName { get; set; }
+
+ }
+
///
- /// 店铺查询对象
+ /// 未绑定的客户查询对象
///
/// @author 黎文豪
/// @date 2023-06-09
diff --git a/ARW.Model/Vo/Business/ShopManager/Shops/CustomerWithOutBindVo.cs b/ARW.Model/Vo/Business/ShopManager/Shops/CustomerWithOutBindVo.cs
new file mode 100644
index 0000000..c6111f9
--- /dev/null
+++ b/ARW.Model/Vo/Business/ShopManager/Shops/CustomerWithOutBindVo.cs
@@ -0,0 +1,29 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Business.ShopManager.Shops
+{
+ ///
+ /// 未绑定客户展示对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-12
+ ///
+ public class CustomerWithOutBindVo
+ {
+ ///
+ /// 描述 : 客户guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long CustomerGuid { get; set; }
+
+
+ ///
+ /// 描述 :客户名称
+ ///
+ public string CustomerNickname { get; set; }
+
+ }
+}
diff --git a/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs b/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
index 0320f7b..3376213 100644
--- a/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
+++ b/ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
@@ -36,6 +36,11 @@ namespace ARW.Model.Vo.Business.ShopManager.Shops
[EpplusIgnore]
public int? ShopUserId { get; set; }
+ ///
+ /// 用户名
+ ///
+ public string UserName { get; set; }
+
///
/// 描述 :客户guid
@@ -44,6 +49,11 @@ namespace ARW.Model.Vo.Business.ShopManager.Shops
[EpplusIgnore]
public long? ShopCustomerGuid { get; set; }
+ ///
+ /// 客户名
+ ///
+ public string CustomerNickname { get; set; }
+
///
/// 描述 :经营类目guid
@@ -53,6 +63,12 @@ namespace ARW.Model.Vo.Business.ShopManager.Shops
public long ShopBusinessCategoryGuid { get; set; }
+ ///
+ /// 经营类别名称
+ ///
+ public string ShopBusinessCategoryName { get; set; }
+
+
///
/// 描述 :图标
///
@@ -109,5 +125,7 @@ namespace ARW.Model.Vo.Business.ShopManager.Shops
[EpplusTableColumn(Header = "审核人")]
public long ShopAuditUserGuid { get; set; }
+ public string CreateTime { get; set; }
+
}
}
diff --git a/ARW.Model/Vo/Business/ShopManager/Shops/UserWithOutBindVo.cs b/ARW.Model/Vo/Business/ShopManager/Shops/UserWithOutBindVo.cs
new file mode 100644
index 0000000..db8aef1
--- /dev/null
+++ b/ARW.Model/Vo/Business/ShopManager/Shops/UserWithOutBindVo.cs
@@ -0,0 +1,29 @@
+using Newtonsoft.Json;
+using OfficeOpenXml.Attributes;
+using SqlSugar;
+using System;
+
+namespace ARW.Model.Vo.Business.ShopManager.Shops
+{
+ ///
+ /// 未绑定用户展示对象
+ ///
+ /// @author 黎文豪
+ /// @date 2023-06-12
+ ///
+ public class UserWithOutBindVo
+ {
+ ///
+ /// 描述 : 用户guid
+ ///
+ [JsonConverter(typeof(ValueToStringConverter))]
+ public long UserId { get; set; }
+
+
+ ///
+ /// 描述 :用户名称
+ ///
+ public string UserName { get; set; }
+
+ }
+}
diff --git a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
index df299e4..9275b69 100644
--- a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
+++ b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs
@@ -17,6 +17,11 @@ using ARW.Model.Vo.Business.ShopManager.Shops;
using MimeKit;
using ARW.Model.Models.Business.Custom.Customers;
using ARW.Repository.Business.Custom.Customers;
+using ARW.Model.System;
+using ARW.Repository.System;
+using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
+using ARW.Repository.Business.GoodsManager.GoodsCategorys;
+using ARW.Model.Models.Business.GoodsManager.GoodsCategorys;
namespace ARW.Service.Business.BusinessService.ShopManager.Shops
{
@@ -31,12 +36,16 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
{
private readonly ShopRepository _ShopRepository;
private readonly CustomerRepository _CustomerRepository;
+ private readonly SysUserRepository _SysUserRepository;
+ private readonly GoodsCategoryRepository _GoodsCategoryRepository;
- public ShopServiceImpl(ShopRepository ShopRepository, CustomerRepository customerRepository)
+ public ShopServiceImpl(ShopRepository ShopRepository, CustomerRepository customerRepository, SysUserRepository sysUserRepository, GoodsCategoryRepository goodsCategoryRepository)
{
this._ShopRepository = ShopRepository;
_CustomerRepository = customerRepository;
+ _SysUserRepository = sysUserRepository;
+ _GoodsCategoryRepository = goodsCategoryRepository;
}
#region 业务逻辑代码
@@ -54,10 +63,16 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
predicate = predicate.AndIF(parm.ShopAuditStatus != null, it => it.ShopAuditStatus == parm.ShopAuditStatus);
var query = _ShopRepository
.Queryable()
+ .LeftJoin((s, c) => s.ShopUserId == c.UserId)
+ .LeftJoin((s, c, d) => s.ShopCustomerGuid == d.CustomerGuid)
+ .LeftJoin((s, c, d, f) => s.ShopBusinessCategoryGuid == f.GoodsCategoryGuid)
.Where(predicate.ToExpression())
.OrderBy(s => s.ShopSort, OrderByType.Asc)
- .Select(s => new ShopVo
+ .Select((s, c, d,f) => new ShopVo
{
+ UserName = c.UserName,
+ CustomerNickname = d.CustomerNickname,
+ ShopBusinessCategoryName = f.GoodsCategoryName,
ShopId = s.ShopId,
ShopGuid = s.ShopGuid,
ShopUserId = s.ShopUserId,
@@ -71,6 +86,7 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
ShopSalesOrderCount = s.ShopSalesOrderCount,
ShopAuditStatus = s.ShopAuditStatus,
ShopAuditUserGuid = s.ShopAuditUserGuid,
+ CreateTime = s.Create_time.ToString("yyyy-MM-dd HH:mm")
});
@@ -89,7 +105,8 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
}
else
{
-
+ model.ShopAuditStatus = 2;
+ model.ShopAuditUserGuid = 1;
var response = await _ShopRepository.InsertReturnSnowflakeIdAsync(model);
return "添加成功!";
}
@@ -109,19 +126,73 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops
#endregion
+ ///
+ /// 获取经营类目列表(一级类目)
+ ///
+ ///
+ ///
+ public async Task> GetFirstGoodsCategoryList()
+ {
+ var query = _GoodsCategoryRepository
+ .Queryable()
+ .Where(s => s.GoodsCategoryParentGuid == 0)
+ .OrderBy(s => s.Update_time, OrderByType.Desc)
+ .Select((s) => new GoodsCategoryVo
+ {
+ GoodsCategoryId = s.GoodsCategoryId,
+ GoodsCategoryGuid = s.GoodsCategoryGuid,
+ GoodsCategoryParentGuid = s.GoodsCategoryParentGuid,
+ GoodsCategoryAncestralGuid = s.GoodsCategoryAncestralGuid,
+ GoodsCategoryName = s.GoodsCategoryName,
+ GoodsCategoryImg = s.GoodsCategoryImg,
+ GoodsCategoryDisplayStatus = s.GoodsCategoryDisplayStatus,
+ GoodsCategoryIsPopular = s.GoodsCategoryIsPopular,
+ ProductCategorySort = s.ProductCategorySort,
+ });
+
+ return await query.ToListAsync();
+ }
+
+
+ ///
+ /// 获取未绑定的用户列表
+ ///
+ ///
+ ///
+ public async Task> GetUserWithOutBindList(UserWithOutBindQueryDto parm)
+ {
+ //开始拼装查询条件d
+ var predicate = Expressionable.Create();
+
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.UserName), s => s.UserName.Contains(parm.UserName));
+
+ var query = _SysUserRepository
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .Where(s => SqlFunc.Subqueryable().Where(it => it.ShopUserId == s.UserId).NotAny())
+ .Where(s => s.UserId != 1)
+ .OrderBy(s => s.Update_time, OrderByType.Desc)
+ .Select((s) => new UserWithOutBindVo
+ {
+ UserId = s.UserId,
+ UserName = s.UserName,
+ });
+
+ return await query.ToPageAsync(parm);
+ }
+
///
/// 获取未绑定的客户列表
///
///
///
- ///
public async Task> GetCustomerWithOutBindList(CustomerWithOutBindQueryDto parm)
{
//开始拼装查询条件d
var predicate = Expressionable.Create();
- predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerNickname), s => s.CustomerNickname .Contains(parm.CustomerNickname));
+ predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.CustomerNickname), s => s.CustomerNickname.Contains(parm.CustomerNickname));
var query = _CustomerRepository
.Queryable()
diff --git a/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs b/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs
index a5bc3c7..631d678 100644
--- a/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs
+++ b/ARW.Service/Business/IBusinessService/ShopManager/Shops/IShopService.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using ARW.Model;
using ARW.Model.Dto.Business.ShopManager.Shops;
using ARW.Model.Models.Business.ShopManager.Shops;
+using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
using ARW.Model.Vo.Business.ShopManager.Shops;
namespace ARW.Service.Business.IBusinessService.ShopManager.Shops
@@ -26,6 +27,14 @@ namespace ARW.Service.Business.IBusinessService.ShopManager.Shops
Task> GetShopList(ShopQueryDto parm);
+ ///
+ /// 获取未绑定的用户列表
+ ///
+ ///
+ ///
+ Task> GetUserWithOutBindList(UserWithOutBindQueryDto parm);
+
+
///
/// 获取未绑定的客户列表
///
@@ -33,8 +42,15 @@ namespace ARW.Service.Business.IBusinessService.ShopManager.Shops
///
Task> GetCustomerWithOutBindList(CustomerWithOutBindQueryDto parm);
-
- ///
+
+ ///
+ /// 获取经营类目列表(一级类目)
+ ///
+ ///
+ Task> GetFirstGoodsCategoryList();
+
+
+ ///
/// 添加或修改店铺
///
///
diff --git a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
index f70e024..0a1d320 100644
--- a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
+++ b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs
@@ -15,7 +15,7 @@ using ARW.Model.Models.Business.ShopManager.Shops;
using ARW.Model.Vo.Business.ShopManager.Shops;
using Microsoft.AspNetCore.Authorization;
using ARW.Admin.WebApi.Framework;
-
+using ARW.Model.Vo.Business.GoodsManager.GoodsCategorys;
namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
{
@@ -54,6 +54,34 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
return SUCCESS(res);
}
+
+ ///
+ /// 获取未绑定的用户列表
+ ///
+ /// 查询参数
+ ///
+ [HttpGet("getUserWithOutBindList")]
+ public async Task GetUserWithOutBindList([FromQuery] UserWithOutBindQueryDto parm)
+ {
+ var res = await _ShopService.GetUserWithOutBindList(parm);
+ return SUCCESS(res);
+ }
+
+
+ ///
+ /// 获取经营类目列表(一级类目)
+ ///
+ ///
+ [HttpGet("getFirstGoodsCategoryList")]
+ public async Task GetFirstGoodsCategoryList()
+ {
+ var res = await _ShopService.GetFirstGoodsCategoryList();
+ res ??= new List();
+
+ return SUCCESS(res);
+ }
+
+
///
/// 获取未绑定的客户列表
///
@@ -78,7 +106,7 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
{
if (parm == null) { throw new CustomException("请求参数错误"); }
- var modal = new Shop();
+ var modal = new Shop();
if (parm.ShopId != 0) modal = parm.Adapt().ToUpdate(HttpContext);
else modal = parm.Adapt().ToCreate(HttpContext);
@@ -93,23 +121,31 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "business:shop:delete")]
[Log(Title = "店铺删除", BusinessType = BusinessType.DELETE)]
- public IActionResult Delete(string ids)
+ public async Task Delete(string ids)
{
long[] idsArr = Tools.SpitLongArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _ShopService.Delete(idsArr);
+ foreach (var item in ids)
+ {
+ await _ShopService.UpdateAsync(f => new Shop
+ {
+ ShopUserId = null,
+ ShopCustomerGuid = null
+ }, s => s.ShopUserId == item);
+ }
return SUCCESS("删除成功!");
}
-
-
- ///
+
+
+ ///
/// 导出店铺
///
///
[Log(Title = "店铺导出", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
[HttpGet("exportShop")]
[ActionPermissionFilter(Permission = "business:shop:export")]
- public async Task ExportExcel([FromQuery] ShopQueryDto parm)
+ public async Task ExportExcel([FromQuery] ShopQueryDto parm)
{
parm.PageSize = 10000;
var list = await _ShopService.GetShopList(parm);
@@ -128,7 +164,7 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
data = selectDataList;
}
-
+
// 导出数据处理
var handleData = await _ShopService.HandleExportData(data);
@@ -137,7 +173,7 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
}
- ///
+ ///
/// 审核店铺
///
///
diff --git a/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt b/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt
index 1943dba..a2f8187 100644
--- a/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt
+++ b/ARW.WebApi/wwwroot/CodeGenTemplate/TplVueIndex.txt
@@ -147,7 +147,7 @@ $if(column.HtmlType == "customInput" && column.IsPk == false)
$elseif(column.HtmlType == "imageUpload")
-
+