From 2919d9dd9888442d8ccfa69adc6917e8cd923656 Mon Sep 17 00:00:00 2001 From: lwh <2679599887@qq.com> Date: Sat, 15 Jul 2023 11:58:43 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=E5=AF=B9=E6=8E=A5=E5=95=86=E5=93=81?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../GoodsManager/Goodss/GoodsServiceApi.cs | 23 ++++++++++++++++++- .../ShopManager/Shops/ShopService.cs | 4 ++++ .../ShopManager/Shops/ShopController.cs | 4 ---- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ARW.Service/Api/BusinessService/GoodsManager/Goodss/GoodsServiceApi.cs b/ARW.Service/Api/BusinessService/GoodsManager/Goodss/GoodsServiceApi.cs index 7128136..d22d2b3 100644 --- a/ARW.Service/Api/BusinessService/GoodsManager/Goodss/GoodsServiceApi.cs +++ b/ARW.Service/Api/BusinessService/GoodsManager/Goodss/GoodsServiceApi.cs @@ -18,6 +18,9 @@ using Newtonsoft.Json; using Senparc.CO2NET.Extensions; using ARW.Model.Models.Business.GoodsManager.GoodsSpecs.GoodsSkus; using ARW.Repository.Business.GoodsManager.GoodsSpecs.GoodsSkus; +using ARW.Model.Models.Business.GoodsManager.GoodsCategorys; +using ARW.Repository.Business.GoodsManager.GoodsCategorys; +using System; namespace ARW.Service.Api.BusinessService.GoodsManager.Goodss { @@ -35,14 +38,17 @@ namespace ARW.Service.Api.BusinessService.GoodsManager.Goodss private readonly SpecRepository _SpecRepository; private readonly SpecValueRepository _SpecValueRepository; private readonly GoodsSkuRepository _GoodsSkuRepository; + private readonly GoodsCategoryRepository _GoodsCategoryRepository; - public GoodsServiceImplApi(GoodsRepository GoodsRepository, GoodsSpecRelRepository goodsSpecRelRepository, SpecRepository specRepository, SpecValueRepository specValueRepository, GoodsSkuRepository goodsSkuRepository) + + public GoodsServiceImplApi(GoodsRepository GoodsRepository, GoodsSpecRelRepository goodsSpecRelRepository, SpecRepository specRepository, SpecValueRepository specValueRepository, GoodsSkuRepository goodsSkuRepository, GoodsCategoryRepository goodsCategoryRepository) { this._GoodsRepository = GoodsRepository; _GoodsSpecRelRepository = goodsSpecRelRepository; _SpecRepository = specRepository; _SpecValueRepository = specValueRepository; _GoodsSkuRepository = goodsSkuRepository; + _GoodsCategoryRepository = goodsCategoryRepository; } #region Api接口代码 @@ -57,6 +63,20 @@ namespace ARW.Service.Api.BusinessService.GoodsManager.Goodss { //开始拼装查询条件 var predicate = Expressionable.Create(); + string[] goodsCategoryArr = null; + + // 检索经营类目 + //if (parm.GoodsCategoryGuid != null) + //{ + // var data = await _GoodsCategoryRepository.GetListAsync(); + + // var SewGoodsCategorys = data.FindAll(delegate (GoodsCategory goodsCategory) + // { + // string[] parentGoodsCategoryId = goodsCategory.GoodsCategoryAncestralGuid.Split(",", StringSplitOptions.RemoveEmptyEntries); + // return parentGoodsCategoryId.Contains(parm.GoodsCategoryGuid.ToString()); + // }); + // goodsCategoryArr = SewGoodsCategorys.Select(s => s.GoodsCategoryGuid.ToString()).ToArray(); + //} predicate = predicate.AndIF(parm.ShopGuid != null, s => s.ShopGuid == parm.ShopGuid); //predicate = predicate.AndIF(parm.GoodsCategoryGuid != null, s => s.GoodsCategoryGuid == parm.GoodsCategoryGuid); @@ -67,6 +87,7 @@ namespace ARW.Service.Api.BusinessService.GoodsManager.Goodss .LeftJoin((s, c) => s.ShopGuid == c.ShopGuid) .Where(predicate.ToExpression()) .WhereIF(parm.GoodsCategoryGuid != null, (s,c) => c.ShopBusinessCategoryGuid == parm.GoodsCategoryGuid) + //.WhereIF(parm.GoodsCategoryGuid != null, (s, c) => c.ShopBusinessCategoryGuid == parm.GoodsCategoryGuid || goodsCategoryArr.Contains(c.ShopBusinessCategoryGuid.ToString())) .Where(s => s.GoodsShelfStatus == 1) .OrderBy(s => s.GoodsSort, OrderByType.Desc) .Select((s, c) => new GoodsVoApi diff --git a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs index 19c64e3..2266e20 100644 --- a/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs +++ b/ARW.Service/Business/BusinessService/ShopManager/Shops/ShopService.cs @@ -32,6 +32,7 @@ using ARW.Model.Models.Business.LogisticsManage.DeliveryRules; using ARW.Model.Models.Business.LogisticsManage.Deliverys; using ARW.Service.Business.IBusinessService.GoodsManager.GoodsServicess; using ARW.Service.Business.IBusinessService.LogisticsManage.Deliverys; +using Aliyun.OSS; namespace ARW.Service.Business.BusinessService.ShopManager.Shops { @@ -123,6 +124,9 @@ namespace ARW.Service.Business.BusinessService.ShopManager.Shops } else { + // 检查是否有重复商店名称 + var isRepeat = await CheckRepeatShopName(model.ShopName); + if (isRepeat) throw new CustomException("商铺名称已存在"); model.ShopAuditStatus = 2; model.ShopAuditUserGuid = 1; var response = await _ShopRepository.InsertReturnSnowflakeIdAsync(model); diff --git a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs index 36cedf5..524ecd1 100644 --- a/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs +++ b/ARW.WebApi/Controllers/Business/ShopManager/Shops/ShopController.cs @@ -108,10 +108,6 @@ namespace ARW.WebApi.Controllers.Business.ShopManager.Shops { if (parm == null) { throw new CustomException("请求参数错误"); } - // 检查是否有重复商店名称 - var isRepeat = await _ShopService.CheckRepeatShopName(parm.ShopName); - if (isRepeat) throw new CustomException("商铺名称已存在"); - var modal = new Shop(); if (parm.ShopId != 0) modal = parm.Adapt().ToUpdate(HttpContext); else modal = parm.Adapt().ToCreate(HttpContext);