feat 初始化店铺列表
This commit is contained in:
parent
bb5b4d0b8a
commit
60e1f5001a
89
ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
Normal file
89
ARW.Model/Dto/Business/ShopManager/Shops/ShopDto.cs
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using ARW.Model.Models.Business.ShopManager.Shops;
|
||||||
|
|
||||||
|
namespace ARW.Model.Dto.Business.ShopManager.Shops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺输入对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
public class ShopDto
|
||||||
|
{
|
||||||
|
|
||||||
|
public int ShopId { get; set; }
|
||||||
|
|
||||||
|
public long ShopGuid { get; set; }
|
||||||
|
|
||||||
|
public int? ShopUserId { get; set; }
|
||||||
|
|
||||||
|
public long? ShopCustomerGuid { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "经营类目guid不能为空")]
|
||||||
|
public long ShopBusinessCategoryGuid { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "图标不能为空")]
|
||||||
|
public string ShopLogo { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "营业执照不能为空")]
|
||||||
|
public string ShopBusinessLicense { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "名称不能为空")]
|
||||||
|
public string ShopName { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "简介不能为空")]
|
||||||
|
public string ShopIntro { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "排序不能为空")]
|
||||||
|
public int ShopSort { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "销售单量不能为空")]
|
||||||
|
public int ShopSalesOrderCount { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "审核状态不能为空")]
|
||||||
|
public int ShopAuditStatus { get; set; }
|
||||||
|
|
||||||
|
[Required(ErrorMessage = "审核人不能为空")]
|
||||||
|
public long ShopAuditUserGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺查询对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
public class ShopQueryDto : PagerInfo
|
||||||
|
{
|
||||||
|
|
||||||
|
public string ShopName { get; set; }
|
||||||
|
|
||||||
|
public int? ShopAuditStatus { get; set; }
|
||||||
|
|
||||||
|
public string ids { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// 审核对象
|
||||||
|
/// </summary>
|
||||||
|
public class ShopAuditDto
|
||||||
|
{
|
||||||
|
public int ShopAuditStatus { get; set; }
|
||||||
|
public string ids { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
145
ARW.Model/Models/Business/ShopManager/Shops/Shop.cs
Normal file
145
ARW.Model/Models/Business/ShopManager/Shops/Shop.cs
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using SqlSugar;
|
||||||
|
using OfficeOpenXml.Attributes;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
namespace ARW.Model.Models.Business.ShopManager.Shops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺,数据实体对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
[SugarTable("tb_shop")]
|
||||||
|
public class Shop : BusinessBase
|
||||||
|
{
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "ShopId")]
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "shop_id")]
|
||||||
|
public int ShopId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "ShopGuid")]
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "shop_guid")]
|
||||||
|
public long ShopGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :用户id
|
||||||
|
/// 空值 : true
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "用户id")]
|
||||||
|
[SugarColumn(ColumnName = "shop_user_id")]
|
||||||
|
public int? ShopUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :客户guid
|
||||||
|
/// 空值 : true
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "客户guid")]
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName = "shop_customer_guid")]
|
||||||
|
public long? ShopCustomerGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :经营类目guid
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "经营类目guid")]
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName = "shop_business_category_guid")]
|
||||||
|
public long ShopBusinessCategoryGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :图标
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "图标")]
|
||||||
|
[SugarColumn(ColumnName = "shop_logo")]
|
||||||
|
public string ShopLogo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :营业执照
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "营业执照")]
|
||||||
|
[SugarColumn(ColumnName = "shop_business_license")]
|
||||||
|
public string ShopBusinessLicense { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :名称
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "名称")]
|
||||||
|
[SugarColumn(ColumnName = "shop_name")]
|
||||||
|
public string ShopName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :简介
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "简介")]
|
||||||
|
[SugarColumn(ColumnName = "shop_intro")]
|
||||||
|
public string ShopIntro { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :排序
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "排序")]
|
||||||
|
[SugarColumn(ColumnName = "shop_sort")]
|
||||||
|
public int ShopSort { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :销售单量
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "销售单量")]
|
||||||
|
[SugarColumn(ColumnName = "shop_sales_order_count")]
|
||||||
|
public int ShopSalesOrderCount { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :审核状态
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "审核状态")]
|
||||||
|
[SugarColumn(ColumnName = "shop_audit_status")]
|
||||||
|
public int ShopAuditStatus { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :审核人
|
||||||
|
/// 空值 : false
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "审核人")]
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[SugarColumn(ColumnName = "shop_audit_user_guid")]
|
||||||
|
public long ShopAuditUserGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
113
ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
Normal file
113
ARW.Model/Vo/Business/ShopManager/Shops/ShopVo.cs
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using OfficeOpenXml.Attributes;
|
||||||
|
using SqlSugar;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace ARW.Model.Vo.Business.ShopManager.Shops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺展示对象
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
public class ShopVo
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// </summary>
|
||||||
|
[EpplusIgnore]
|
||||||
|
public int ShopId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[EpplusIgnore]
|
||||||
|
public long ShopGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :用户id
|
||||||
|
/// </summary>
|
||||||
|
[EpplusIgnore]
|
||||||
|
public int? ShopUserId { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :客户guid
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[EpplusIgnore]
|
||||||
|
public long? ShopCustomerGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :经营类目guid
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[EpplusTableColumn(Header = "经营类目guid")]
|
||||||
|
public long ShopBusinessCategoryGuid { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :图标
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "图标")]
|
||||||
|
public string ShopLogo { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :营业执照
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "营业执照")]
|
||||||
|
public string ShopBusinessLicense { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :名称
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "名称")]
|
||||||
|
public string ShopName { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :简介
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "简介")]
|
||||||
|
public string ShopIntro { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :排序
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "排序")]
|
||||||
|
public int ShopSort { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :销售单量
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "销售单量")]
|
||||||
|
public int ShopSalesOrderCount { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :审核状态
|
||||||
|
/// </summary>
|
||||||
|
[EpplusTableColumn(Header = "审核状态")]
|
||||||
|
public int ShopAuditStatus { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 描述 :审核人
|
||||||
|
/// </summary>
|
||||||
|
[JsonConverter(typeof(ValueToStringConverter))]
|
||||||
|
[EpplusTableColumn(Header = "审核人")]
|
||||||
|
public long ShopAuditUserGuid { get; set; }
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
20
ARW.Repository/Business/ShopManager/Shops/ShopRepository.cs
Normal file
20
ARW.Repository/Business/ShopManager/Shops/ShopRepository.cs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
using System;
|
||||||
|
using Infrastructure.Attribute;
|
||||||
|
using ARW.Repository.System;
|
||||||
|
using ARW.Model.Models.Business.ShopManager.Shops;
|
||||||
|
|
||||||
|
namespace ARW.Repository.Business.ShopManager.Shops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺仓储
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||||
|
public class ShopRepository : BaseRepository<Shop>
|
||||||
|
{
|
||||||
|
#region 业务逻辑代码
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,144 @@
|
|||||||
|
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.Repository.Business.ShopManager.Shops;
|
||||||
|
using ARW.Service.Business.IBusinessService.ShopManager.Shops;
|
||||||
|
using ARW.Model.Dto.Business.ShopManager.Shops;
|
||||||
|
using ARW.Model.Models.Business.ShopManager.Shops;
|
||||||
|
using ARW.Model.Vo.Business.ShopManager.Shops;
|
||||||
|
|
||||||
|
namespace ARW.Service.Business.BusinessService.ShopManager.Shops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺接口实现类
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
[AppService(ServiceType = typeof(IShopService), ServiceLifetime = LifeTime.Transient)]
|
||||||
|
public class ShopServiceImpl : BaseService<Shop>, IShopService
|
||||||
|
{
|
||||||
|
private readonly ShopRepository _ShopRepository;
|
||||||
|
|
||||||
|
public ShopServiceImpl(ShopRepository ShopRepository)
|
||||||
|
{
|
||||||
|
this._ShopRepository = ShopRepository;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region 业务逻辑代码
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查询店铺分页列表
|
||||||
|
/// </summary>
|
||||||
|
public Task<PagedInfo<ShopVo>> GetShopList(ShopQueryDto parm)
|
||||||
|
{
|
||||||
|
//开始拼装查询条件d
|
||||||
|
var predicate = Expressionable.Create<Shop>();
|
||||||
|
|
||||||
|
predicate = predicate.AndIF(!string.IsNullOrEmpty(parm.ShopName), it => it.ShopName.Contains(parm.ShopName));
|
||||||
|
predicate = predicate.AndIF(parm.ShopAuditStatus != null, it => it.ShopAuditStatus == parm.ShopAuditStatus);
|
||||||
|
var query = _ShopRepository
|
||||||
|
.Queryable()
|
||||||
|
.Where(predicate.ToExpression())
|
||||||
|
.OrderBy(s => s.ShopSort,OrderByType.Asc)
|
||||||
|
.Select(s => new ShopVo
|
||||||
|
{
|
||||||
|
ShopId = s.ShopId,
|
||||||
|
ShopGuid = s.ShopGuid,
|
||||||
|
ShopUserId = s.ShopUserId,
|
||||||
|
ShopCustomerGuid = s.ShopCustomerGuid,
|
||||||
|
ShopBusinessCategoryGuid = s.ShopBusinessCategoryGuid,
|
||||||
|
ShopLogo = s.ShopLogo,
|
||||||
|
ShopBusinessLicense = s.ShopBusinessLicense,
|
||||||
|
ShopName = s.ShopName,
|
||||||
|
ShopIntro = s.ShopIntro,
|
||||||
|
ShopSort = s.ShopSort,
|
||||||
|
ShopSalesOrderCount = s.ShopSalesOrderCount,
|
||||||
|
ShopAuditStatus = s.ShopAuditStatus,
|
||||||
|
ShopAuditUserGuid = s.ShopAuditUserGuid,
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
return query.ToPageAsync(parm);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加或修改店铺
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> AddOrUpdateShop(Shop model)
|
||||||
|
{
|
||||||
|
if (model.ShopId != 0)
|
||||||
|
{
|
||||||
|
var response = await _ShopRepository.UpdateAsync(model);
|
||||||
|
return "修改成功!";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
var response = await _ShopRepository.InsertReturnSnowflakeIdAsync(model);
|
||||||
|
return "添加成功!";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region Excel处理
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Excel数据导出处理
|
||||||
|
/// </summary>
|
||||||
|
public async Task<List<ShopVo>> HandleExportData(List<ShopVo> data)
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 审核
|
||||||
|
/// </summary>
|
||||||
|
public async Task<string> Audit(int id, int status, long userGuid)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var res = await _ShopRepository.GetFirstAsync(s => s.ShopId == id);
|
||||||
|
await UseTranAsync(async () =>
|
||||||
|
{
|
||||||
|
await _ShopRepository.UpdateAsync(f => new Shop { ShopAuditStatus = status, ShopAuditUserGuid = userGuid, Update_time = DateTime.Now, Update_by = userGuid.ToString() }, s => s.ShopId == id);
|
||||||
|
});
|
||||||
|
if (res.ShopAuditStatus == 2)
|
||||||
|
{
|
||||||
|
var errorRes = $"店铺:【{res.ShopName}】<span style='color:red'>已通过审核!</span><br>";
|
||||||
|
return errorRes;
|
||||||
|
}
|
||||||
|
if (res.ShopAuditStatus == 3)
|
||||||
|
{
|
||||||
|
var errorRes = $"店铺:【{res.ShopName}】<span style='color:red'>已被驳回!</span><br>";
|
||||||
|
return errorRes;
|
||||||
|
}
|
||||||
|
else if (res.ShopAuditStatus == 1)
|
||||||
|
{
|
||||||
|
var addStr = $"店铺:【{res.ShopName}】<span style='color:#27af49'>审核通过!</span><br>";
|
||||||
|
return addStr;
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
catch (Exception)
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
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.ShopManager.Shops;
|
||||||
|
|
||||||
|
namespace ARW.Service.Business.IBusinessService.ShopManager.Shops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺接口类
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
public interface IShopService : IBaseService<Shop>
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 获取店铺分页列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<PagedInfo<ShopVo>> GetShopList(ShopQueryDto parm);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加或修改店铺
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
Task<string> AddOrUpdateShop(Shop parm);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Excel导出
|
||||||
|
/// </summary>
|
||||||
|
Task<List<ShopVo>> HandleExportData(List<ShopVo> data);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 审核
|
||||||
|
/// </summary>
|
||||||
|
Task<string> Audit(int idsArr, int status,long userGuid);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,154 @@
|
|||||||
|
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.Model.Dto.Business.ShopManager.Shops;
|
||||||
|
using ARW.Service.Business.IBusinessService.ShopManager.Shops;
|
||||||
|
using ARW.Admin.WebApi.Controllers;
|
||||||
|
using ARW.Model.Models.Business.ShopManager.Shops;
|
||||||
|
using ARW.Model.Vo.Business.ShopManager.Shops;
|
||||||
|
using Microsoft.AspNetCore.Authorization;
|
||||||
|
using ARW.Admin.WebApi.Framework;
|
||||||
|
|
||||||
|
|
||||||
|
namespace ARW.WebApi.Controllers.Business.ShopManager.Shops
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// 店铺控制器
|
||||||
|
///
|
||||||
|
/// @author 黎文豪
|
||||||
|
/// @date 2023-06-09
|
||||||
|
/// </summary>
|
||||||
|
[Verify]
|
||||||
|
[Route("business/[controller]")]
|
||||||
|
public class ShopController : BaseController
|
||||||
|
{
|
||||||
|
private readonly IShopService _ShopService;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 依赖注入
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="ShopService">店铺服务</param>
|
||||||
|
public ShopController(IShopService ShopService)
|
||||||
|
{
|
||||||
|
_ShopService = ShopService;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取店铺列表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm">查询参数</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("getShopList")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shop:list")]
|
||||||
|
public async Task<IActionResult> GetShopList([FromQuery] ShopQueryDto parm)
|
||||||
|
{
|
||||||
|
var res = await _ShopService.GetShopList(parm);
|
||||||
|
return SUCCESS(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 添加或修改店铺
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="parm"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPost("addOrUpdateShop")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shop:addOrUpdate")]
|
||||||
|
[Log(Title = "添加或修改店铺", BusinessType = BusinessType.ADDORUPDATE)]
|
||||||
|
public async Task<IActionResult> AddOrUpdateShop([FromBody] ShopDto parm)
|
||||||
|
{
|
||||||
|
if (parm == null) { throw new CustomException("请求参数错误"); }
|
||||||
|
|
||||||
|
var modal = new Shop();
|
||||||
|
if (parm.ShopId != 0) modal = parm.Adapt<Shop>().ToUpdate(HttpContext);
|
||||||
|
else modal = parm.Adapt<Shop>().ToCreate(HttpContext);
|
||||||
|
|
||||||
|
var res = await _ShopService.AddOrUpdateShop(modal);
|
||||||
|
return SUCCESS(res);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 删除店铺
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpDelete("{ids}")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shop:delete")]
|
||||||
|
[Log(Title = "店铺删除", BusinessType = BusinessType.DELETE)]
|
||||||
|
public IActionResult Delete(string ids)
|
||||||
|
{
|
||||||
|
long[] idsArr = Tools.SpitLongArrary(ids);
|
||||||
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||||
|
var response = _ShopService.Delete(idsArr);
|
||||||
|
return SUCCESS("删除成功!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 导出店铺
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[Log(Title = "店铺导出", BusinessType = BusinessType.EXPORT, IsSaveResponseData = false)]
|
||||||
|
[HttpGet("exportShop")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shop:export")]
|
||||||
|
public async Task<IActionResult> ExportExcel([FromQuery] ShopQueryDto parm)
|
||||||
|
{
|
||||||
|
parm.PageSize = 10000;
|
||||||
|
var list = await _ShopService.GetShopList(parm);
|
||||||
|
var data = list.Result;
|
||||||
|
|
||||||
|
// 选中数据
|
||||||
|
if (!string.IsNullOrEmpty(parm.ids))
|
||||||
|
{
|
||||||
|
int[] idsArr = Tools.SpitIntArrary(parm.ids);
|
||||||
|
var selectDataList = new List<ShopVo>();
|
||||||
|
foreach (var item in idsArr)
|
||||||
|
{
|
||||||
|
var select_data = data.Where(s => s.ShopId == item).First();
|
||||||
|
selectDataList.Add(select_data);
|
||||||
|
}
|
||||||
|
data = selectDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// 导出数据处理
|
||||||
|
var handleData = await _ShopService.HandleExportData(data);
|
||||||
|
|
||||||
|
string sFileName = ExportExcel(handleData, "Shop", "店铺列表");
|
||||||
|
return SUCCESS(new { path = "/export/" + sFileName, fileName = sFileName });
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 审核店铺
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpPut("audit")]
|
||||||
|
[ActionPermissionFilter(Permission = "business:shop:audit")]
|
||||||
|
[Log(Title = "审核店铺", BusinessType = BusinessType.AUDIT)]
|
||||||
|
public async Task<IActionResult> AuditShop([FromBody] ShopAuditDto param)
|
||||||
|
{
|
||||||
|
var user = JwtUtil.GetLoginUser(App.HttpContext);
|
||||||
|
int[] idsArr = Tools.SpitIntArrary(param.ids);
|
||||||
|
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"审核失败 Id 不能为空")); }
|
||||||
|
|
||||||
|
var msgList = new List<string>();
|
||||||
|
foreach (var item in idsArr)
|
||||||
|
{
|
||||||
|
var msg = await _ShopService.Audit(item, param.ShopAuditStatus, user.UserId);
|
||||||
|
msgList.Add(msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return SUCCESS(msgList.ToArray());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ConnectionStrings": {
|
"ConnectionStrings": {
|
||||||
"conn_db": "server=47.242.159.172;Database=shop_template;Uid=shop_template;Pwd=TWYrxjCiEnmP6aBi;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
"conn_db": "server=47.242.159.172;Database=shop_template;Uid=shop_template;Pwd=tKFJjWwL2kxMYtJK;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
||||||
//"conn_db": "server=127.0.0.1;Database= shop_template;Uid=root;Pwd=root;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
//"conn_db": "server=127.0.0.1;Database= shop_template;Uid=root;Pwd=root;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
||||||
"conn_db_type": "8" //数据库类型 MySql = 0, SqlServer = 1
|
"conn_db_type": "8" //数据库类型 MySql = 0, SqlServer = 1
|
||||||
},
|
},
|
||||||
@ -41,7 +41,7 @@
|
|||||||
"templateCode": "SMS_154950909"
|
"templateCode": "SMS_154950909"
|
||||||
},
|
},
|
||||||
"gen": {
|
"gen": {
|
||||||
"conn": "server=47.242.159.172;Database=shop_template;Uid=shop_template;Pwd=TWYrxjCiEnmP6aBi;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
"conn": "server=47.242.159.172;Database=shop_template;Uid=shop_template;Pwd=tKFJjWwL2kxMYtJK;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
||||||
//"conn": "server=127.0.0.1;Database= shop_template;Uid=root;Pwd=root;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
//"conn": "server=127.0.0.1;Database= shop_template;Uid=root;Pwd=root;SslMode=none;CharSet=utf8mb4;AllowLoadLocalInfile=true;AllowUserVariables=true;",
|
||||||
"dbType": 8, //MySql = 0, SqlServer = 1
|
"dbType": 8, //MySql = 0, SqlServer = 1
|
||||||
"autoPre": true, //自动去除表前缀
|
"autoPre": true, //自动去除表前缀
|
||||||
|
Loading…
Reference in New Issue
Block a user