diff --git a/ARW.Model/Dto/Business/LogisticsManage/DeliveryRules/DeliveryRuleDto.cs b/ARW.Model/Dto/Business/LogisticsManage/DeliveryRules/DeliveryRuleDto.cs new file mode 100644 index 0000000..c7d8512 --- /dev/null +++ b/ARW.Model/Dto/Business/LogisticsManage/DeliveryRules/DeliveryRuleDto.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using ARW.Model.Models.Business.LogisticsManage.DeliveryRules; + +namespace ARW.Model.Dto.Business.LogisticsManage.DeliveryRules +{ + /// + /// 配送模板区域及运费输入对象 + /// + /// @author 黎文豪 + /// @date 2023-06-16 + /// + public class DeliveryRuleDto + { + + public int DeliveryRuleId { get; set; } + + public long DeliveryRuleGuid { get; set; } + + [Required(ErrorMessage = "配送模板guid不能为空")] + public long DeliveryGuid { get; set; } + + [Required(ErrorMessage = "可配送区域(城市id集)不能为空")] + public string DeliveryRuleRegion { get; set; } + + [Required(ErrorMessage = "可配送区域(文字展示)不能为空")] + public string DeliveryRuleRegionText { get; set; } + + [Required(ErrorMessage = "首件(个)/首重(Kg)不能为空")] + public int DeliveryRuleFirst { get; set; } + + [Required(ErrorMessage = "运费(元)不能为空")] + public decimal DeliveryRuleFirstFee { get; set; } + + [Required(ErrorMessage = "续件/续重不能为空")] + public int DeliveryRuleAdditional { get; set; } + + [Required(ErrorMessage = "续费(元)不能为空")] + public decimal DeliveryRuleAdditionalFee { get; set; } + + + + + + } + + + /// + /// 配送模板区域及运费查询对象 + /// + /// @author 黎文豪 + /// @date 2023-06-16 + /// + public class DeliveryRuleQueryDto : PagerInfo + { + + public long? DeliveryGuid { get; set; } + + public string ids { get; set; } + } + + + + +} diff --git a/ARW.Model/Models/Business/LogisticsManage/DeliveryRules/DeliveryRule.cs b/ARW.Model/Models/Business/LogisticsManage/DeliveryRules/DeliveryRule.cs new file mode 100644 index 0000000..4434f28 --- /dev/null +++ b/ARW.Model/Models/Business/LogisticsManage/DeliveryRules/DeliveryRule.cs @@ -0,0 +1,98 @@ +using System; +using System.Collections.Generic; +using SqlSugar; +using OfficeOpenXml.Attributes; +using Newtonsoft.Json; + +namespace ARW.Model.Models.Business.LogisticsManage.DeliveryRules +{ + /// + /// 配送模板区域及运费,数据实体对象 + /// + /// @author 黎文豪 + /// @date 2023-06-16 + /// + [SugarTable("tb_delivery_rule")] + public class DeliveryRule : BusinessBase + { + + /// + /// 描述 : + /// 空值 : false + /// + [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "delivery_rule_id")] + public int DeliveryRuleId { get; set; } + + + /// + /// 描述 : + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "delivery_rule_guid")] + public long DeliveryRuleGuid { get; set; } + + + /// + /// 描述 :配送模板guid + /// 空值 : false + /// + [JsonConverter(typeof(ValueToStringConverter))] + [SugarColumn(ColumnName = "delivery_guid")] + public long DeliveryGuid { get; set; } + + + /// + /// 描述 :可配送区域(城市id集) + /// 空值 : false + /// + [SugarColumn(ColumnName = "delivery_rule_region")] + public string DeliveryRuleRegion { get; set; } + + + /// + /// 描述 :可配送区域(文字展示) + /// 空值 : false + /// + [SugarColumn(ColumnName = "delivery_rule_region_text")] + public string DeliveryRuleRegionText { get; set; } + + + /// + /// 描述 :首件(个)/首重(Kg) + /// 空值 : false + /// + [SugarColumn(ColumnName = "delivery_rule_first")] + public int DeliveryRuleFirst { get; set; } + + + /// + /// 描述 :运费(元) + /// 空值 : false + /// + [SugarColumn(ColumnName = "delivery_rule_first_fee")] + public decimal DeliveryRuleFirstFee { get; set; } + + + /// + /// 描述 :续件/续重 + /// 空值 : false + /// + [SugarColumn(ColumnName = "delivery_rule_additional")] + public int DeliveryRuleAdditional { get; set; } + + + /// + /// 描述 :续费(元) + /// 空值 : false + /// + [SugarColumn(ColumnName = "delivery_rule_additional_fee")] + public decimal DeliveryRuleAdditionalFee { get; set; } + + + + + + + } +} \ No newline at end of file diff --git a/ARW.Model/Vo/Business/LogisticsManage/DeliveryRules/DeliveryRuleVo.cs b/ARW.Model/Vo/Business/LogisticsManage/DeliveryRules/DeliveryRuleVo.cs new file mode 100644 index 0000000..a131dfe --- /dev/null +++ b/ARW.Model/Vo/Business/LogisticsManage/DeliveryRules/DeliveryRuleVo.cs @@ -0,0 +1,74 @@ +using Newtonsoft.Json; +using OfficeOpenXml.Attributes; +using SqlSugar; +using System; + +namespace ARW.Model.Vo.Business.LogisticsManage.DeliveryRules +{ + /// + /// 配送模板区域及运费展示对象 + /// + /// @author 黎文豪 + /// @date 2023-06-16 + /// + public class DeliveryRuleVo + { + + + /// + /// 描述 : + /// + public int DeliveryRuleId { get; set; } + + + /// + /// 描述 : + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long DeliveryRuleGuid { get; set; } + + + /// + /// 描述 :配送模板guid + /// + [JsonConverter(typeof(ValueToStringConverter))] + public long DeliveryGuid { get; set; } + + + /// + /// 描述 :可配送区域(城市id集) + /// + public string DeliveryRuleRegion { get; set; } + + + /// + /// 描述 :可配送区域(文字展示) + /// + public string DeliveryRuleRegionText { get; set; } + + + /// + /// 描述 :首件(个)/首重(Kg) + /// + public int DeliveryRuleFirst { get; set; } + + + /// + /// 描述 :运费(元) + /// + public decimal DeliveryRuleFirstFee { get; set; } + + + /// + /// 描述 :续件/续重 + /// + public int DeliveryRuleAdditional { get; set; } + + + /// + /// 描述 :续费(元) + /// + public decimal DeliveryRuleAdditionalFee { get; set; } + + } +} diff --git a/ARW.Repository/Business/LogisticsManage/DeliveryRules/DeliveryRuleRepository.cs b/ARW.Repository/Business/LogisticsManage/DeliveryRules/DeliveryRuleRepository.cs new file mode 100644 index 0000000..de448fb --- /dev/null +++ b/ARW.Repository/Business/LogisticsManage/DeliveryRules/DeliveryRuleRepository.cs @@ -0,0 +1,20 @@ +using System; +using Infrastructure.Attribute; +using ARW.Repository.System; +using ARW.Model.Models.Business.LogisticsManage.DeliveryRules; + +namespace ARW.Repository.Business.LogisticsManage.DeliveryRules +{ + /// + /// 配送模板区域及运费仓储 + /// + /// @author 黎文豪 + /// @date 2023-06-16 + /// + [AppService(ServiceLifetime = LifeTime.Transient)] + public class DeliveryRuleRepository : BaseRepository + { + #region 业务逻辑代码 + #endregion + } +} \ No newline at end of file diff --git a/ARW.Service/Business/BusinessService/LogisticsManage/DeliveryRules/DeliveryRuleService.cs b/ARW.Service/Business/BusinessService/LogisticsManage/DeliveryRules/DeliveryRuleService.cs new file mode 100644 index 0000000..2828c0a --- /dev/null +++ b/ARW.Service/Business/BusinessService/LogisticsManage/DeliveryRules/DeliveryRuleService.cs @@ -0,0 +1,97 @@ +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.LogisticsManage.DeliveryRules; +using ARW.Service.Business.IBusinessService.LogisticsManage.DeliveryRules; +using ARW.Model.Dto.Business.LogisticsManage.DeliveryRules; +using ARW.Model.Models.Business.LogisticsManage.DeliveryRules; +using ARW.Model.Vo.Business.LogisticsManage.DeliveryRules; + +namespace ARW.Service.Business.BusinessService.LogisticsManage.DeliveryRules +{ + /// + /// 配送模板区域及运费接口实现类 + /// + /// @author 黎文豪 + /// @date 2023-06-16 + /// + [AppService(ServiceType = typeof(IDeliveryRuleService), ServiceLifetime = LifeTime.Transient)] + public class DeliveryRuleServiceImpl : BaseService, IDeliveryRuleService + { + private readonly DeliveryRuleRepository _DeliveryRuleRepository; + + public DeliveryRuleServiceImpl(DeliveryRuleRepository DeliveryRuleRepository) + { + this._DeliveryRuleRepository = DeliveryRuleRepository; + } + + #region 业务逻辑代码 + + + /// + /// 查询配送模板区域及运费分页列表 + /// + public async Task> GetDeliveryRuleList(DeliveryRuleQueryDto parm) + { + //开始拼装查询条件d + var predicate = Expressionable.Create(); + + predicate = predicate.AndIF(parm.DeliveryGuid != null, s => s.DeliveryGuid == parm.DeliveryGuid); + var query = _DeliveryRuleRepository + .Queryable() + .Where(predicate.ToExpression()) + .OrderBy(s => s.Create_time, OrderByType.Desc) + .Select(s => new DeliveryRuleVo + { + DeliveryRuleId = s.DeliveryRuleId, + DeliveryRuleGuid = s.DeliveryRuleGuid, + DeliveryGuid = s.DeliveryGuid, + DeliveryRuleRegion = s.DeliveryRuleRegion, + DeliveryRuleRegionText = s.DeliveryRuleRegionText, + DeliveryRuleFirst = s.DeliveryRuleFirst, + DeliveryRuleFirstFee = s.DeliveryRuleFirstFee, + DeliveryRuleAdditional = s.DeliveryRuleAdditional, + DeliveryRuleAdditionalFee = s.DeliveryRuleAdditionalFee, + }); + + + return await query.ToPageAsync(parm); + } + + /// + /// 添加或修改配送模板区域及运费 + /// + public async Task AddOrUpdateDeliveryRule(DeliveryRule model) + { + if (model.DeliveryRuleId != 0) + { + var response = await _DeliveryRuleRepository.UpdateAsync(model); + return "修改成功!"; + } + else + { + + var response = await _DeliveryRuleRepository.InsertReturnSnowflakeIdAsync(model); + return "添加成功!"; + } + } + + #region Excel处理 + + + #endregion + + + + #endregion + + } +} diff --git a/ARW.Service/Business/IBusinessService/LogisticsManage/DeliveryRules/IDeliveryRuleService.cs b/ARW.Service/Business/IBusinessService/LogisticsManage/DeliveryRules/IDeliveryRuleService.cs new file mode 100644 index 0000000..75fcf6d --- /dev/null +++ b/ARW.Service/Business/IBusinessService/LogisticsManage/DeliveryRules/IDeliveryRuleService.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ARW.Model; +using ARW.Model.Dto.Business.LogisticsManage.DeliveryRules; +using ARW.Model.Models.Business.LogisticsManage.DeliveryRules; +using ARW.Model.Vo.Business.LogisticsManage.DeliveryRules; + +namespace ARW.Service.Business.IBusinessService.LogisticsManage.DeliveryRules +{ + /// + /// 配送模板区域及运费接口类 + /// + /// @author 黎文豪 + /// @date 2023-06-16 + /// + public interface IDeliveryRuleService : IBaseService + { + /// + /// 获取配送模板区域及运费分页列表 + /// + /// + /// + Task> GetDeliveryRuleList(DeliveryRuleQueryDto parm); + + + /// + /// 添加或修改配送模板区域及运费 + /// + /// + /// + Task AddOrUpdateDeliveryRule(DeliveryRule parm); + + + + + + } +}