@@ -1,227 +0,0 @@ | |||
using BPA.SAAS.Manage.Comm.Const; | |||
using Furion; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder.Dtos | |||
{ | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public class WeighOrderDto | |||
{ | |||
/// <summary> | |||
/// 主键 Guid | |||
/// </summary> | |||
[SugarColumn(IsPrimaryKey = true, ColumnDataType = "Nvarchar(64)", IsNullable = false)] | |||
public string Id { get; set; } = Guid.NewGuid().ToString(); | |||
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "GroupId", IsNullable = true)] | |||
public string GroupId { get; set; } = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
/// <summary> | |||
/// 订单编号 | |||
/// </summary> | |||
public string OrderNumber { get; set; } | |||
/// <summary> | |||
/// 订单金额 | |||
/// </summary> | |||
public decimal TotalAmount { get; set; } | |||
/// <summary> | |||
/// 订单标题 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Subject { get; set; } | |||
/// <summary> | |||
/// 场景id | |||
/// </summary> | |||
public string SceneId { get; set; } | |||
/// <summary> | |||
/// 0.选菜中 1.订单完成 | |||
/// </summary> | |||
public int States { get; set; } | |||
/// <summary> | |||
/// 0.待支付 1.已支付 2.支付失败 | |||
/// </summary> | |||
public int PayStates { get; set; } | |||
/// <summary> | |||
/// 创建时间 | |||
/// </summary> | |||
public DateTime CreateAt { get; set; } = DateTime.Now; | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
public string CreateId { get; set; } | |||
/// <summary> | |||
/// 商品信息 | |||
/// </summary> | |||
public List<WeighOrderGoodsDto> GoodsInfo { get; set; } | |||
/// <summary> | |||
/// 餐盘信息 | |||
/// </summary> | |||
public List<WeighOrderDiningPlateDto> DiningPlateInfo { get; set; } | |||
} | |||
public class WeighOrderGoodsDto | |||
{ | |||
/// <summary> | |||
/// 主键 Guid | |||
/// </summary> | |||
public string Id { get; set; } = Guid.NewGuid().ToString(); | |||
public string GroupId { get; set; } = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
/// <summary> | |||
/// 订单id | |||
/// </summary> | |||
public string OrderId { get; set; } | |||
/// <summary> | |||
/// 商品名称 | |||
/// </summary> | |||
public string GoodsId { get; set; } | |||
/// <summary> | |||
/// 商品名称 | |||
/// </summary> | |||
public string GoodsName { get; set; } | |||
/// <summary> | |||
/// 商品商品重量 | |||
/// </summary> | |||
public decimal GoodsWeight { get; set; } | |||
/// <summary> | |||
/// 商品属性 | |||
/// </summary> | |||
public List<GoogsAttribute>? GoodsAttribute { get; set; } | |||
} | |||
public class WeighOrderDiningPlateDto | |||
{ | |||
/// <summary> | |||
/// 订单编号 | |||
/// </summary> | |||
public string OrderId { get; set; } | |||
public string DiningPlateId { get; set; } | |||
} | |||
public class GoogsAttribute | |||
{ | |||
public string AttributeId { get; set; } | |||
public string AttributeName { get; set; } | |||
} | |||
public class GetOrderInputDto | |||
{ | |||
public string OrderId { get; set; } | |||
} | |||
public class WeighOrderCreteDto | |||
{ | |||
/// <summary> | |||
/// 订单金额 | |||
/// </summary> | |||
public decimal TotalAmount { get; set; } | |||
/// <summary> | |||
/// 订单标题 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Subject { get; set; } | |||
/// <summary> | |||
/// 场景id | |||
/// </summary> | |||
public string SceneId { get; set; } | |||
/// <summary> | |||
/// 创建人(会员Id) | |||
/// </summary> | |||
public string CreateId { get; set; } | |||
/// <summary> | |||
/// 商品 | |||
/// </summary> | |||
public List<WeighOrderGoodsCreateDto> Goods { get; set; } | |||
/// <summary> | |||
/// 餐盘信息 | |||
/// </summary> | |||
public List<WeighOrderDiningPlateCreateDto> DiningPlateInfo { get; set; } | |||
} | |||
public class WeighOrderGoodsCreateDto | |||
{ | |||
public string OrderId { get; set; } | |||
/// <summary> | |||
/// 商品名称 | |||
/// </summary> | |||
public string GoodsId { get; set; } | |||
/// <summary> | |||
/// 商品名称 | |||
/// </summary> | |||
public string GoodsName { get; set; } | |||
/// <summary> | |||
/// 商品商品重量 | |||
/// </summary> | |||
public decimal GoodsWeight { get; set; } | |||
} | |||
public class WeighOrderDiningPlateCreateDto | |||
{ | |||
/// <summary> | |||
/// 订单编号 | |||
/// </summary> | |||
public string OrderId { get; set; } | |||
public string DiningPlateId { get; set; } | |||
} | |||
public class WeighOrderUpdateDto | |||
{ | |||
public string OrderId { get; set; } | |||
public int PayStates { get; set; } | |||
public int States { get; set; } | |||
} | |||
} |
@@ -1,46 +0,0 @@ | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder.Dtos; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder.Serviec | |||
{ | |||
public interface IWeighOrderService | |||
{ | |||
/// <summary> | |||
/// 创建订单 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<WeighOrderDto> CreateWeighOrder(WeighOrderCreteDto inputDto); | |||
/// <summary> | |||
/// 添加订单商品 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddWeighOrderGoods(List<WeighOrderGoodsCreateDto> inputDto); | |||
/// <summary> | |||
/// 添加订单餐盘 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<bool> AddWeighOrderDiningPlate(List<WeighOrderDiningPlateCreateDto> inputDto); | |||
/// <summary> | |||
/// 查询订单商品 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
Task<WeighOrderDto> GetWeighOrder(GetOrderInputDto inputDto); | |||
/// <summary> | |||
/// 修改订单状态 | |||
/// </summary> | |||
/// <returns></returns> | |||
Task<bool> UpdateWeighOrderStates(WeighOrderUpdateDto inputDto); | |||
} | |||
} |
@@ -1,153 +0,0 @@ | |||
using BPA.SAAS.KitChenManage.Core; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.Enum; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder.Dtos; | |||
using BPA.SAAS.Manage.Comm.Util; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder.Serviec | |||
{ | |||
public class WeighOrderService: IWeighOrderService, ITransient | |||
{ | |||
/// <summary> | |||
/// 创建订单 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<WeighOrderDto> CreateWeighOrder(WeighOrderCreteDto inputDto) | |||
{ | |||
var result = new WeighOrderDto(); | |||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||
dic.Add("GroupId", CurrentUser.GroupId); | |||
var url = App.Configuration["baseurl"] + "api/WeighOrder/CreateWeighOrder"; | |||
var inputData = JsonConvert.SerializeObject(inputDto); | |||
var jsonData = HttpHelper.PostData(url, inputData, Encoding.UTF8, "application/json", dic); | |||
var data = JsonConvert.DeserializeObject<ResultSAASManageDto>(jsonData); | |||
if (data.statusCode != 200) | |||
{ | |||
throw Oops.Oh(data.errors); | |||
} | |||
if (data.data!=null) | |||
{ | |||
result = data.data as WeighOrderDto; | |||
} | |||
return result; | |||
} | |||
/// <summary> | |||
/// 添加订单商品 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddWeighOrderGoods(List<WeighOrderGoodsCreateDto> inputDto) | |||
{ | |||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||
dic.Add("GroupId", CurrentUser.GroupId); | |||
var url = App.Configuration["baseurl"] + "api/WeighOrder/AddWeighOrderGoods"; | |||
var inputData = JsonConvert.SerializeObject(inputDto); | |||
var jsonData = HttpHelper.PostData(url, inputData, Encoding.UTF8, "application/json", dic); | |||
var data = JsonConvert.DeserializeObject<ResultSAASManageDto>(jsonData); | |||
if (data.statusCode != 200) | |||
{ | |||
throw Oops.Oh(data.errors); | |||
} | |||
if (!Convert.ToBoolean(data.data)) | |||
{ | |||
throw Oops.Oh(ErrorCodeEnum.Code1001); | |||
} | |||
return true; | |||
} | |||
/// <summary> | |||
/// 添加订单餐盘 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<bool> AddWeighOrderDiningPlate(List<WeighOrderDiningPlateCreateDto> inputDto) | |||
{ | |||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||
dic.Add("GroupId", CurrentUser.GroupId); | |||
var url = App.Configuration["baseurl"] + "api/WeighOrder/AddWeighOrderDiningPlate"; | |||
var inputData = JsonConvert.SerializeObject(inputDto); | |||
var jsonData = HttpHelper.PostData(url, inputData, Encoding.UTF8, "application/json", dic); | |||
var data = JsonConvert.DeserializeObject<ResultSAASManageDto>(jsonData); | |||
if (data.statusCode != 200) | |||
{ | |||
throw Oops.Oh(data.errors); | |||
} | |||
if (!Convert.ToBoolean(data.data)) | |||
{ | |||
throw Oops.Oh(ErrorCodeEnum.Code1001); | |||
} | |||
return true; | |||
} | |||
/// <summary> | |||
/// 查询订单商品 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
public async Task<WeighOrderDto> GetWeighOrder(GetOrderInputDto inputDto) | |||
{ | |||
var result = new WeighOrderDto(); | |||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||
dic.Add("GroupId", CurrentUser.GroupId); | |||
var url = App.Configuration["baseurl"] + "api/WeighOrder/GetWeighOrder"; | |||
var inputData = JsonConvert.SerializeObject(inputDto); | |||
var jsonData = HttpHelper.PostData(url, inputData, Encoding.UTF8, "application/json", dic); | |||
var data = JsonConvert.DeserializeObject<ResultSAASManageDto>(jsonData); | |||
if (data.statusCode != 200) | |||
{ | |||
throw Oops.Oh(data.errors); | |||
} | |||
if (data.data != null) | |||
{ | |||
result = data.data as WeighOrderDto; | |||
} | |||
return result; | |||
} | |||
/// <summary> | |||
/// 修改订单状态 | |||
/// </summary> | |||
/// <returns></returns> | |||
public async Task<bool> UpdateWeighOrderStates(WeighOrderUpdateDto inputDto) | |||
{ | |||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||
dic.Add("GroupId", CurrentUser.GroupId); | |||
var url = App.Configuration["baseurl"] + "api/WeighOrder/UpdateWeighOrderStates"; | |||
var inputData = JsonConvert.SerializeObject(inputDto); | |||
var jsonData = HttpHelper.PostData(url, inputData, Encoding.UTF8, "application/json", dic); | |||
var data = JsonConvert.DeserializeObject<ResultSAASManageDto>(jsonData); | |||
if (data.statusCode != 200) | |||
{ | |||
throw Oops.Oh(data.errors); | |||
} | |||
if (!Convert.ToBoolean(data.data)) | |||
{ | |||
throw Oops.Oh(ErrorCodeEnum.Code1001); | |||
} | |||
return true; | |||
} | |||
} | |||
} |
@@ -1,82 +0,0 @@ | |||
using BPA.SAAS.KitChenManage.Core; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.Enum; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.DiningPlate.Services; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder.Dtos; | |||
using BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder.Serviec; | |||
using BPA.SAAS.Manage.Comm.Util; | |||
using Newtonsoft.Json; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.WeighOrder | |||
{ | |||
[ApiDescriptionSettings("开放平台", Tag = "称重订单"), AllowAnonymous] | |||
public class WeighOrderServices: IDynamicApiController | |||
{ | |||
private readonly IWeighOrderService _weighOrderService; | |||
public WeighOrderServices(IWeighOrderService weighOrderService) | |||
{ | |||
_weighOrderService = weighOrderService; | |||
} | |||
/// <summary> | |||
/// 创建订单 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/WeighOrder/CreateWeighOrder")] | |||
public async Task<WeighOrderDto> CreateWeighOrder(WeighOrderCreteDto inputDto) | |||
{ | |||
return await _weighOrderService.CreateWeighOrder(inputDto); | |||
} | |||
/// <summary> | |||
/// 添加订单商品 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/WeighOrder/AddWeighOrderGoods")] | |||
public async Task<bool> AddWeighOrderGoods(List<WeighOrderGoodsCreateDto> inputDto) | |||
{ | |||
return await _weighOrderService.AddWeighOrderGoods(inputDto); | |||
} | |||
/// <summary> | |||
/// 添加订单餐盘 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/WeighOrder/AddWeighOrderDiningPlate")] | |||
public async Task<bool> AddWeighOrderDiningPlate(List<WeighOrderDiningPlateCreateDto> inputDto) | |||
{ | |||
return await _weighOrderService.AddWeighOrderDiningPlate(inputDto); | |||
} | |||
/// <summary> | |||
/// 查询订单商品 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/WeighOrder/GetWeighOrder")] | |||
public async Task<WeighOrderDto> GetWeighOrder(GetOrderInputDto inputDto) | |||
{ | |||
return await _weighOrderService.GetWeighOrder(inputDto); | |||
} | |||
/// <summary> | |||
/// 修改订单状态 | |||
/// </summary> | |||
/// <returns></returns> | |||
[HttpPost("/api/ExternalPlatform/WeighOrder/UpdateWeighOrderStates")] | |||
public async Task<bool> UpdateWeighOrderStates(WeighOrderUpdateDto inputDto) | |||
{ | |||
return await _weighOrderService.UpdateWeighOrderStates(inputDto); | |||
} | |||
} | |||
} |
@@ -229,6 +229,21 @@ namespace BPA.SAAS.Manage.Application.Auth | |||
return await _db.Deleteable(data).ExecuteCommandHasChangeAsync(); | |||
} | |||
/// <summary> | |||
/// 获取加盟商信息 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/authorization/GetCompanyById")] | |||
[AllowAnonymous] | |||
public async Task<BPA_Company> GetCompanyById(string id) | |||
{ | |||
var data = await _db.Queryable<BPA_Company>().FirstAsync(x => x.Id == id); | |||
return data; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.SAAS.Manage.Core | |||
{ | |||
public class Const | |||
{ | |||
public const string ExternalPlatform = "base"; | |||
} | |||
} |