init 初始化配送模板区域及运费
This commit is contained in:
parent
28b1014676
commit
4fa2649fe0
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送模板区域及运费输入对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-16
|
||||
/// </summary>
|
||||
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; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 配送模板区域及运费查询对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-16
|
||||
/// </summary>
|
||||
public class DeliveryRuleQueryDto : PagerInfo
|
||||
{
|
||||
|
||||
public long? DeliveryGuid { get; set; }
|
||||
|
||||
public string ids { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送模板区域及运费,数据实体对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-16
|
||||
/// </summary>
|
||||
[SugarTable("tb_delivery_rule")]
|
||||
public class DeliveryRule : BusinessBase
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "delivery_rule_id")]
|
||||
public int DeliveryRuleId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "delivery_rule_guid")]
|
||||
public long DeliveryRuleGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :配送模板guid
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
[SugarColumn(ColumnName = "delivery_guid")]
|
||||
public long DeliveryGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :可配送区域(城市id集)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "delivery_rule_region")]
|
||||
public string DeliveryRuleRegion { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :可配送区域(文字展示)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "delivery_rule_region_text")]
|
||||
public string DeliveryRuleRegionText { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :首件(个)/首重(Kg)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "delivery_rule_first")]
|
||||
public int DeliveryRuleFirst { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :运费(元)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "delivery_rule_first_fee")]
|
||||
public decimal DeliveryRuleFirstFee { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :续件/续重
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "delivery_rule_additional")]
|
||||
public int DeliveryRuleAdditional { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :续费(元)
|
||||
/// 空值 : false
|
||||
/// </summary>
|
||||
[SugarColumn(ColumnName = "delivery_rule_additional_fee")]
|
||||
public decimal DeliveryRuleAdditionalFee { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
using Newtonsoft.Json;
|
||||
using OfficeOpenXml.Attributes;
|
||||
using SqlSugar;
|
||||
using System;
|
||||
|
||||
namespace ARW.Model.Vo.Business.LogisticsManage.DeliveryRules
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送模板区域及运费展示对象
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-16
|
||||
/// </summary>
|
||||
public class DeliveryRuleVo
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
public int DeliveryRuleId { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long DeliveryRuleGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :配送模板guid
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(ValueToStringConverter))]
|
||||
public long DeliveryGuid { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :可配送区域(城市id集)
|
||||
/// </summary>
|
||||
public string DeliveryRuleRegion { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :可配送区域(文字展示)
|
||||
/// </summary>
|
||||
public string DeliveryRuleRegionText { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :首件(个)/首重(Kg)
|
||||
/// </summary>
|
||||
public int DeliveryRuleFirst { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :运费(元)
|
||||
/// </summary>
|
||||
public decimal DeliveryRuleFirstFee { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :续件/续重
|
||||
/// </summary>
|
||||
public int DeliveryRuleAdditional { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 描述 :续费(元)
|
||||
/// </summary>
|
||||
public decimal DeliveryRuleAdditionalFee { get; set; }
|
||||
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送模板区域及运费仓储
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-16
|
||||
/// </summary>
|
||||
[AppService(ServiceLifetime = LifeTime.Transient)]
|
||||
public class DeliveryRuleRepository : BaseRepository<DeliveryRule>
|
||||
{
|
||||
#region 业务逻辑代码
|
||||
#endregion
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送模板区域及运费接口实现类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-16
|
||||
/// </summary>
|
||||
[AppService(ServiceType = typeof(IDeliveryRuleService), ServiceLifetime = LifeTime.Transient)]
|
||||
public class DeliveryRuleServiceImpl : BaseService<DeliveryRule>, IDeliveryRuleService
|
||||
{
|
||||
private readonly DeliveryRuleRepository _DeliveryRuleRepository;
|
||||
|
||||
public DeliveryRuleServiceImpl(DeliveryRuleRepository DeliveryRuleRepository)
|
||||
{
|
||||
this._DeliveryRuleRepository = DeliveryRuleRepository;
|
||||
}
|
||||
|
||||
#region 业务逻辑代码
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 查询配送模板区域及运费分页列表
|
||||
/// </summary>
|
||||
public async Task<PagedInfo<DeliveryRuleVo>> GetDeliveryRuleList(DeliveryRuleQueryDto parm)
|
||||
{
|
||||
//开始拼装查询条件d
|
||||
var predicate = Expressionable.Create<DeliveryRule>();
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改配送模板区域及运费
|
||||
/// </summary>
|
||||
public async Task<string> 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
|
||||
|
||||
}
|
||||
}
|
@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// 配送模板区域及运费接口类
|
||||
///
|
||||
/// @author 黎文豪
|
||||
/// @date 2023-06-16
|
||||
/// </summary>
|
||||
public interface IDeliveryRuleService : IBaseService<DeliveryRule>
|
||||
{
|
||||
/// <summary>
|
||||
/// 获取配送模板区域及运费分页列表
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<PagedInfo<DeliveryRuleVo>> GetDeliveryRuleList(DeliveryRuleQueryDto parm);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 添加或修改配送模板区域及运费
|
||||
/// </summary>
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> AddOrUpdateDeliveryRule(DeliveryRule parm);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user