From aa3f9191f936422ef2665cb21f783b98c88f05da Mon Sep 17 00:00:00 2001 From: lwh <2679599887@qq.com> Date: Mon, 17 Jul 2023 02:08:00 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E6=B7=BB=E5=8A=A0=E5=95=86=E5=93=81?= =?UTF-8?q?=E8=AF=84=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GoodsComments/GoodsCommentDto.cs | 105 ++++++++++++ .../GoodsComments/GoodsComment.cs | 150 ++++++++++++++++++ .../GoodsComments/GoodsCommentVo.cs | 132 +++++++++++++++ .../GoodsComments/GoodsCommentRepository.cs | 20 +++ .../GoodsComments/GoodsCommentService.cs | 144 +++++++++++++++++ .../GoodsManager/Goodss/GoodsService.cs | 43 +++-- .../GoodsComments/IGoodsCommentService.cs | 45 ++++++ .../Api/Wechat/WeChatLoginController.cs | 4 + .../GoodsComments/GoodsCommentController.cs | 120 ++++++++++++++ .../wwwroot/excel/商品导入模板模板 (5).xlsx | Bin 0 -> 11629 bytes 10 files changed, 748 insertions(+), 15 deletions(-) create mode 100644 ARW.Model/Dto/Business/GoodsManager/GoodsComments/GoodsCommentDto.cs create mode 100644 ARW.Model/Models/Business/GoodsManager/GoodsComments/GoodsComment.cs create mode 100644 ARW.Model/Vo/Business/GoodsManager/GoodsComments/GoodsCommentVo.cs create mode 100644 ARW.Repository/Business/GoodsManager/GoodsComments/GoodsCommentRepository.cs create mode 100644 ARW.Service/Business/BusinessService/GoodsManager/GoodsComments/GoodsCommentService.cs create mode 100644 ARW.Service/Business/IBusinessService/GoodsManager/GoodsComments/IGoodsCommentService.cs create mode 100644 ARW.WebApi/Controllers/Business/GoodsManager/GoodsComments/GoodsCommentController.cs create mode 100644 ARW.WebApi/wwwroot/excel/商品导入模板模板 (5).xlsx diff --git a/ARW.Model/Dto/Business/GoodsManager/GoodsComments/GoodsCommentDto.cs b/ARW.Model/Dto/Business/GoodsManager/GoodsComments/GoodsCommentDto.cs new file mode 100644 index 0000000..53ce348 --- /dev/null +++ b/ARW.Model/Dto/Business/GoodsManager/GoodsComments/GoodsCommentDto.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; + +namespace ARW.Model.Dto.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价输入对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + public class GoodsCommentDto + { + + public int GoodsCommentId { get; set; } + + public long GoodsCommentGuid { get; set; } + + [Required(ErrorMessage = "店铺guid不能为空")] + public long ShopGuid { get; set; } + + [Required(ErrorMessage = "客户guid不能为空")] + public long CustomerGuid { get; set; } + + [Required(ErrorMessage = "订单guid不能为空")] + public long OrderGuid { get; set; } + + [Required(ErrorMessage = "商品guid不能为空")] + public long GoodsGuid { get; set; } + + [Required(ErrorMessage = "订单商品guid不能为空")] + public long OrderGoodsGuid { get; set; } + + [Required(ErrorMessage = "评分分数不能为空")] + public float GoodsCommentRating { get; set; } + + [Required(ErrorMessage = "评分类型不能为空")] + public int GoodsCommentRatingType { get; set; } + + [Required(ErrorMessage = "评价内容不能为空")] + public string GoodsCommentContent { get; set; } + + public string GoodsCommentImages { get; set; } + + [Required(ErrorMessage = "回复状态不能为空")] + public int GoodsCommentRecoverStatus { get; set; } + + public string GoodsCommentRecoverContent { get; set; } + + [Required(ErrorMessage = "显示状态不能为空")] + public int GoodsCommentStatus { get; set; } + + [Required(ErrorMessage = "排序不能为空")] + public int GoodsCommentSort { get; set; } + + + + + + } + + + /// + /// 商品评价查询对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + public class GoodsCommentQueryDto : PagerInfo + { + + public string ShopName { get; set; } + + public string GoodsName { get; set; } + + public long? ShopGuid { get; set; } + public int? GoodsCommentRatingType { get; set; } + + public int? GoodsCommentStatus { get; set; } + + public int? GoodsCommentRecoverStatus { get; set; } + + public string ids { get; set; } + } + + + /// + /// + /// @author admin + /// @date 2023-07-17 + /// 回复对象 + /// + public class GoodsCommentRecoverDto + { + [Required(ErrorMessage = "id不能为空")] + public int GoodsCommentId { get; set; } + + [Required(ErrorMessage = "回复内容不能为空")] + public string GoodsCommentRecoverContent { get; set; } + } + + +} diff --git a/ARW.Model/Models/Business/GoodsManager/GoodsComments/GoodsComment.cs b/ARW.Model/Models/Business/GoodsManager/GoodsComments/GoodsComment.cs new file mode 100644 index 0000000..7d05c7f --- /dev/null +++ b/ARW.Model/Models/Business/GoodsManager/GoodsComments/GoodsComment.cs @@ -0,0 +1,150 @@ +using System; +using System.Collections.Generic; +using SqlSugar; +using OfficeOpenXml.Attributes; +using Newtonsoft.Json; + +namespace ARW.Model.Models.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价,数据实体对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + [SugarTable("tb_goods_comment")] + public class GoodsComment : BusinessBase + { + + /// + /// 描述 : + /// 空值 : false + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "goods_comment_id")] + public int GoodsCommentId { get; set; } + + + /// + /// 描述 : + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "goods_comment_guid")] + public long GoodsCommentGuid { get; set; } + + + /// + /// 描述 :店铺guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "shop_guid")] + public long ShopGuid { get; set; } + + + /// + /// 描述 :客户guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "customer_guid")] + public long CustomerGuid { get; set; } + + + /// + /// 描述 :订单guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "order_guid")] + public long OrderGuid { get; set; } + + + /// + /// 描述 :商品guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "goods_guid")] + public long GoodsGuid { get; set; } + + + /// + /// 描述 :订单商品guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "order_goods_guid")] + public long OrderGoodsGuid { get; set; } + + + /// + /// 描述 :评分分数 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_rating")] + public float GoodsCommentRating { get; set; } + + + /// + /// 描述 :评分类型 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_rating_type")] + public int GoodsCommentRatingType { get; set; } + + + /// + /// 描述 :评价内容 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_content")] + public string GoodsCommentContent { get; set; } + + + /// + /// 描述 :评价图片 + /// 空值 : true + /// + [SugarColumn(ColumnName = "goods_comment_images")] + public string GoodsCommentImages { get; set; } + + + /// + /// 描述 :回复状态 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_recover_status")] + public int GoodsCommentRecoverStatus { get; set; } + + + /// + /// 描述 :回复内容 + /// 空值 : true + /// + [SugarColumn(ColumnName = "goods_comment_recover_content")] + public string GoodsCommentRecoverContent { get; set; } + + + /// + /// 描述 :显示状态 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_status")] + public int GoodsCommentStatus { get; set; } + + + /// + /// 描述 :排序 + /// 空值 : false + /// + [SugarColumn(ColumnName = "goods_comment_sort")] + public int GoodsCommentSort { get; set; } + + + + + + + } +} \ No newline at end of file diff --git a/ARW.Model/Vo/Business/GoodsManager/GoodsComments/GoodsCommentVo.cs b/ARW.Model/Vo/Business/GoodsManager/GoodsComments/GoodsCommentVo.cs new file mode 100644 index 0000000..8165547 --- /dev/null +++ b/ARW.Model/Vo/Business/GoodsManager/GoodsComments/GoodsCommentVo.cs @@ -0,0 +1,132 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价展示对象 + /// + /// @author admin + /// @date 2023-07-15 + /// + public class GoodsCommentVo + { + + + /// + /// 描述 : + /// + public int GoodsCommentId { get; set; } + + + /// + /// 描述 : + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long GoodsCommentGuid { get; set; } + + + /// + /// 描述 :店铺guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long ShopGuid { get; set; } + + /// + /// 描述 :店铺名称 + /// + public string ShopName { get; set; } + + /// + /// 描述 :客户guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long CustomerGuid { get; set; } + + /// + /// 描述 :客户名称 + /// + public string CustomerNickname { get; set; } + + + /// + /// 描述 :订单guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long OrderGuid { get; set; } + + + /// + /// 描述 :商品guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long GoodsGuid { get; set; } + + /// + /// 描述 :商品名称 + /// + public string GoodsName { get; set; } + + /// + /// 描述 :商品图片 + /// + public string GoodsPicture { get; set; } + + /// + /// 描述 :订单商品guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long OrderGoodsGuid { get; set; } + + + /// + /// 描述 :评分分数 + /// + public float GoodsCommentRating { get; set; } + + + /// + /// 描述 :评分类型 + /// + public int GoodsCommentRatingType { get; set; } + + + /// + /// 描述 :评价内容 + /// + public string GoodsCommentContent { get; set; } + + + /// + /// 描述 :评价图片 + /// + public string GoodsCommentImages { get; set; } + + + /// + /// 描述 :回复状态 + /// + public int GoodsCommentRecoverStatus { get; set; } + + + /// + /// 描述 :回复内容 + /// + public string GoodsCommentRecoverContent { get; set; } + + + /// + /// 描述 :显示状态 + /// + public int GoodsCommentStatus { get; set; } + + + /// + /// 描述 :排序 + /// + public int GoodsCommentSort { get; set; } + + } +} diff --git a/ARW.Repository/Business/GoodsManager/GoodsComments/GoodsCommentRepository.cs b/ARW.Repository/Business/GoodsManager/GoodsComments/GoodsCommentRepository.cs new file mode 100644 index 0000000..a8a8ed4 --- /dev/null +++ b/ARW.Repository/Business/GoodsManager/GoodsComments/GoodsCommentRepository.cs @@ -0,0 +1,20 @@ +using System; +using Infrastructure.Attribute; +using ARW.Repository.System; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; + +namespace ARW.Repository.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价仓储 + /// + /// @author admin + /// @date 2023-07-15 + /// + [AppService(ServiceLifetime = LifeTime.Transient)] + public class GoodsCommentRepository : BaseRepository + { + #region 业务逻辑代码 + #endregion + } +} \ No newline at end of file diff --git a/ARW.Service/Business/BusinessService/GoodsManager/GoodsComments/GoodsCommentService.cs b/ARW.Service/Business/BusinessService/GoodsManager/GoodsComments/GoodsCommentService.cs new file mode 100644 index 0000000..3e45cf2 --- /dev/null +++ b/ARW.Service/Business/BusinessService/GoodsManager/GoodsComments/GoodsCommentService.cs @@ -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.GoodsManager.GoodsComments; +using ARW.Service.Business.IBusinessService.GoodsManager.GoodsComments; +using ARW.Model.Dto.Business.GoodsManager.GoodsComments; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; +using ARW.Model.Vo.Business.GoodsManager.GoodsComments; +using ARW.Model.Models.Business.ShopManager.Shops; +using ARW.Model.Models.Business.GoodsManager.Goodss; +using ARW.Model.Models.Business.Custom.Customers; + +namespace ARW.Service.Business.BusinessService.GoodsManager.GoodsComments +{ + /// + /// 商品评价接口实现类 + /// + /// @author admin + /// @date 2023-07-15 + /// + [AppService(ServiceType = typeof(IGoodsCommentService), ServiceLifetime = LifeTime.Transient)] + public class GoodsCommentServiceImpl : BaseService, IGoodsCommentService + { + private readonly GoodsCommentRepository _GoodsCommentRepository; + + public GoodsCommentServiceImpl(GoodsCommentRepository GoodsCommentRepository) + { + this._GoodsCommentRepository = GoodsCommentRepository; + } + + #region 业务逻辑代码 + + + /// + /// 查询商品评价分页列表 + /// + public async Task> GetGoodsCommentList(GoodsCommentQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(parm.ShopGuid != null, s => s.ShopGuid == parm.ShopGuid); + predicate = predicate.AndIF(parm.GoodsCommentRecoverStatus != null, s => s.GoodsCommentRecoverStatus == parm.GoodsCommentRecoverStatus); + predicate = predicate.AndIF(parm.GoodsCommentRatingType != null, s => s.GoodsCommentRatingType == parm.GoodsCommentRatingType); + predicate = predicate.AndIF(parm.GoodsCommentStatus != null, s => s.GoodsCommentStatus == parm.GoodsCommentStatus); + var query = _GoodsCommentRepository + .Queryable() + .LeftJoin((s, c) => s.ShopGuid == c.ShopGuid) + .LeftJoin((s, c, d) => s.GoodsGuid == d.GoodsGuid) + .LeftJoin((s, c, d, f) => s.CustomerGuid == f.CustomerGuid) + .WhereIF(!string.IsNullOrEmpty(parm.ShopName), (s, c, d, f) => c.ShopName.Contains(parm.ShopName)) + .WhereIF(!string.IsNullOrEmpty(parm.GoodsName), (s, c, d, f) => d.GoodsName.Contains(parm.GoodsName)) + .Where(predicate.ToExpression()) + .OrderBy(s => s.GoodsCommentSort, OrderByType.Asc) + .Select((s, c, d, f) => new GoodsCommentVo + { + GoodsCommentId = s.GoodsCommentId, + GoodsCommentGuid = s.GoodsCommentGuid, + ShopGuid = s.ShopGuid, + ShopName = c.ShopName, + CustomerGuid = s.CustomerGuid, + CustomerNickname = f.CustomerNickname, + OrderGuid = s.OrderGuid, + GoodsGuid = s.GoodsGuid, + GoodsName = d.GoodsName, + GoodsPicture = d.GoodsPicture, + OrderGoodsGuid = s.OrderGoodsGuid, + GoodsCommentRating = s.GoodsCommentRating, + GoodsCommentRatingType = s.GoodsCommentRatingType, + GoodsCommentContent = s.GoodsCommentContent, + GoodsCommentImages = s.GoodsCommentImages, + GoodsCommentRecoverStatus = s.GoodsCommentRecoverStatus, + GoodsCommentRecoverContent = s.GoodsCommentRecoverContent, + GoodsCommentStatus = s.GoodsCommentStatus, + GoodsCommentSort = s.GoodsCommentSort, + }); + + + return await query.ToPageAsync(parm); + } + + /// + /// 添加或修改商品评价 + /// + public async Task AddOrUpdateGoodsComment(GoodsComment model) + { + if (model.GoodsCommentRating < 3) + { + model.GoodsCommentRatingType = 3; + } + if (model.GoodsCommentRating < 3.5 && model.GoodsCommentRating >= 2.5) + { + model.GoodsCommentRatingType = 2; + } + if (model.GoodsCommentRating >= 3.5) + { + model.GoodsCommentRatingType = 1; + } + + if (model.GoodsCommentId != 0) + { + var response = await _GoodsCommentRepository.UpdateAsync(model); + return "修改成功!"; + } + else + { + model.GoodsCommentRecoverStatus = 1; + var response = await _GoodsCommentRepository.InsertReturnSnowflakeIdAsync(model); + return "添加成功!"; + } + } + + #region Excel处理 + + + #endregion + + + /// + /// 回复 + /// + public async Task Recover(GoodsCommentRecoverDto parm) + { + var response = await _GoodsCommentRepository.UpdateAsync(f => new GoodsComment + { + GoodsCommentRecoverContent = parm.GoodsCommentRecoverContent, + GoodsCommentRecoverStatus = 2 + }, s => s.GoodsCommentId == parm.GoodsCommentId); + if (response) return "回复成功"; + else return "回复失败"; + } + + #endregion + + } +} diff --git a/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs b/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs index 2fed5b7..3d7f92a 100644 --- a/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs +++ b/ARW.Service/Business/BusinessService/GoodsManager/Goodss/GoodsService.cs @@ -289,23 +289,36 @@ namespace ARW.Service.Business.BusinessService.GoodsManager.Goodss // 商品类目 // 拆分上级类目和当前类目(手机/xxxx系列) var nameArr = Goods.GoodsCategoryName.Split('/'); - if (nameArr.Length == 0 || nameArr.Length >= 3) throw new CustomException($"商品类目【{Goods.GoodsCategoryName}】格式不正确,参考(手机/xxxx系列)"); + if (nameArr.Length == 0 || nameArr.Length >= 3) throw new CustomException($"商品类目【{Goods.GoodsCategoryName}】格式不正确,参考(手机/xxxx系列 或者 手机)"); - // 找出上级类目 - var parentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( - s => s.ShopGoodsCategoryName == nameArr.First() && - s.ShopGuid == Goods.ShopGuid - ); - if (parentGoodsCategory == null) throw new CustomException($"上级商品类目【{nameArr.First()}】不存在"); + if (nameArr.Length != 1) + { + // 找出上级类目 + var parentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( + s => s.ShopGoodsCategoryName == nameArr.First() && + s.ShopGuid == Goods.ShopGuid + ); + if (parentGoodsCategory == null) throw new CustomException($"上级商品类目【{nameArr.First()}】不存在"); - // 找出当前类目 - var currentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( - s => s.ShopGoodsCategoryName == nameArr.Last() && - s.ShopGuid == Goods.ShopGuid && - s.ShopGoodsCategoryParentGuid == parentGoodsCategory.ShopGoodsCategoryGuid - ); - if (currentGoodsCategory == null) throw new CustomException($"当前商品类目【{nameArr.First()}】不存在"); - Goods.ShopGoodsCategoryGuid = currentGoodsCategory.ShopGoodsCategoryGuid; + // 找出当前类目 + var currentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( + s => s.ShopGoodsCategoryName == nameArr.Last() && + s.ShopGuid == Goods.ShopGuid && + s.ShopGoodsCategoryParentGuid == parentGoodsCategory.ShopGoodsCategoryGuid + ); + if (currentGoodsCategory == null) throw new CustomException($"当前商品类目【{nameArr.First()}】不存在"); + Goods.ShopGoodsCategoryGuid = currentGoodsCategory.ShopGoodsCategoryGuid; + } + else + { + // 找出当前类目 + var currentGoodsCategory = await _ShopGoodsCategoryRepository.GetFirstAsync( + s => s.ShopGoodsCategoryName == Goods.GoodsCategoryName && + s.ShopGuid == Goods.ShopGuid + ); + if (currentGoodsCategory == null) throw new CustomException($"当前商品类目【{Goods.GoodsCategoryName}】不存在"); + Goods.ShopGoodsCategoryGuid = currentGoodsCategory.ShopGoodsCategoryGuid; + } // 配送模板 diff --git a/ARW.Service/Business/IBusinessService/GoodsManager/GoodsComments/IGoodsCommentService.cs b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsComments/IGoodsCommentService.cs new file mode 100644 index 0000000..0f80884 --- /dev/null +++ b/ARW.Service/Business/IBusinessService/GoodsManager/GoodsComments/IGoodsCommentService.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.GoodsManager.GoodsComments; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; +using ARW.Model.Vo.Business.GoodsManager.GoodsComments; + +namespace ARW.Service.Business.IBusinessService.GoodsManager.GoodsComments +{ + /// + /// 商品评价接口类 + /// + /// @author admin + /// @date 2023-07-15 + /// + public interface IGoodsCommentService : IBaseService + { + /// + /// 获取商品评价分页列表 + /// + /// + /// + Task> GetGoodsCommentList(GoodsCommentQueryDto parm); + + + /// + /// 添加或修改商品评价 + /// + /// + /// + Task AddOrUpdateGoodsComment(GoodsComment parm); + + + + + /// + /// 回复 + /// + Task Recover(GoodsCommentRecoverDto parm); + + } +} diff --git a/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs b/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs index 5485195..fe14bed 100644 --- a/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs +++ b/ARW.WebApi/Controllers/Api/Wechat/WeChatLoginController.cs @@ -71,6 +71,10 @@ namespace ARW.WebApi.Controllers.Api.Wechat user = await _customerService.GetFirstAsync(s => s.CustomerGuid == response); } + else + { + user.CustomerLastLoginTime = DateTime.Now; + } LoginUser loginUser = new LoginUser { diff --git a/ARW.WebApi/Controllers/Business/GoodsManager/GoodsComments/GoodsCommentController.cs b/ARW.WebApi/Controllers/Business/GoodsManager/GoodsComments/GoodsCommentController.cs new file mode 100644 index 0000000..2e229ef --- /dev/null +++ b/ARW.WebApi/Controllers/Business/GoodsManager/GoodsComments/GoodsCommentController.cs @@ -0,0 +1,120 @@ +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.GoodsManager.GoodsComments; +using ARW.Service.Business.IBusinessService.GoodsManager.GoodsComments; +using ARW.Admin.WebApi.Controllers; +using ARW.Model.Models.Business.GoodsManager.GoodsComments; +using ARW.Model.Vo.Business.GoodsManager.GoodsComments; +using Microsoft.AspNetCore.Authorization; +using ARW.Admin.WebApi.Framework; +using ARW.Service.Business.IBusinessService.ShopManager.Shops; + + +namespace ARW.WebApi.Controllers.Business.GoodsManager.GoodsComments +{ + /// + /// 商品评价控制器 + /// + /// @author admin + /// @date 2023-07-15 + /// + [Verify] + [Route("business/[controller]")] + public class GoodsCommentController : BaseController + { + private readonly IGoodsCommentService _GoodsCommentService; + private readonly IShopService _ShopService; + + /// + /// 依赖注入 + /// + /// 商品评价服务 + public GoodsCommentController(IGoodsCommentService GoodsCommentService, IShopService shopService) + { + _GoodsCommentService = GoodsCommentService; + _ShopService = shopService; + } + + + /// + /// 获取商品评价列表 + /// + /// 查询参数 + /// + [HttpGet("getGoodsCommentList")] + [ActionPermissionFilter(Permission = "business:goodscomment:list")] + public async Task GetGoodsCommentList([FromQuery] GoodsCommentQueryDto parm) + { + var user = JwtUtil.GetLoginUser(App.HttpContext); + if (user.UserId != 1) + { + var shop = await _ShopService.GetFirstAsync(s => s.ShopUserId == user.UserId); + if (shop == null) throw new Exception("当前用户没有店铺"); + parm.ShopGuid = shop.ShopGuid; + } + + var res = await _GoodsCommentService.GetGoodsCommentList(parm); + return SUCCESS(res); + } + + /// + /// 添加或修改商品评价 + /// + /// + /// + [HttpPost("addOrUpdateGoodsComment")] + [ActionPermissionFilter(Permission = "business:goodscomment:addOrUpdate")] + [Log(Title = "添加或修改商品评价", BusinessType = BusinessType.ADDORUPDATE)] + public async Task AddOrUpdateGoodsComment([FromBody] GoodsCommentDto parm) + { + if (parm == null) { throw new CustomException("请求参数错误"); } + + var modal = new GoodsComment(); + if (parm.GoodsCommentId != 0) modal = parm.Adapt().ToUpdate(HttpContext); + else modal = parm.Adapt().ToCreate(HttpContext); + + var res = await _GoodsCommentService.AddOrUpdateGoodsComment(modal); + return SUCCESS(res); + } + + /// + /// 删除商品评价 + /// + /// + [HttpDelete("{ids}")] + [ActionPermissionFilter(Permission = "business:goodscomment: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 = _GoodsCommentService.Delete(idsArr); + return SUCCESS("删除成功!"); + } + + + + /// + /// 回复商品评价 + /// + /// + [HttpPut("recover")] + [ActionPermissionFilter(Permission = "business:goodscomment:recover")] + public async Task RecoverGoodsComment([FromBody] GoodsCommentRecoverDto param) + { + var res = await _GoodsCommentService.Recover(param); + return SUCCESS(res); + } + + + + } +} diff --git a/ARW.WebApi/wwwroot/excel/商品导入模板模板 (5).xlsx b/ARW.WebApi/wwwroot/excel/商品导入模板模板 (5).xlsx new file mode 100644 index 0000000000000000000000000000000000000000..6eec5aecf90b0a44530391d69805b579569bf55c GIT binary patch literal 11629 zcmaJ{1yo$ivc=scNN{&|2ohWa!QI{6A;E)taCditySux)OK|;=ymxbxcmM6Rh8bo` zPVcT$)qQG9ivxo|0lW@>sde7h_x}#amk)ZDy3#h5R<^X#FJdS!UqJj2E7x>g6aoYQ z5Cj4MK=`|uwv`o)let-PM7dN49g3hM(No*`a(ywv`B5OTWmrX5%Nl{yAoi3y)gtz-s{v?T|Bq|tE!u`pm4 z77mjmnRV%15h5XeUc=R0yv5~pep80ByjDcqbah_R0OeGAQqpj!nX8H`F*7rY(Nc#& z2`oxTa3PJHw1`WNWOXoE5Ny85{$?QKIzBJy)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