Browse Source

提交

groupmealmanage
gwbvipvip 10 months ago
parent
commit
550e1f0c74
7 changed files with 509 additions and 1 deletions
  1. BIN
     
  2. BIN
     
  3. +227
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/Dtos/WeighOrderDto.cs
  4. +46
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/Serviec/IWeighOrderService.cs
  5. +153
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/Serviec/WeighOrderService.cs
  6. +82
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs
  7. +1
    -1
      BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json

BIN
View File


BIN
View File


+ 227
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/Dtos/WeighOrderDto.cs View File

@@ -0,0 +1,227 @@
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; }
}
}

+ 46
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/Serviec/IWeighOrderService.cs View File

@@ -0,0 +1,46 @@
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);
}
}

+ 153
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/Serviec/WeighOrderService.cs View File

@@ -0,0 +1,153 @@
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;
}
}
}

+ 82
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs View File

@@ -0,0 +1,82 @@
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);
}
}
}

+ 1
- 1
BPA.SAAS.Manage.Web.Entry/Properties/launchSettings.json View File

@@ -14,7 +14,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://192.168.1.50:5001"
"applicationUrl": "http://localhost:5001"
},
"Docker": {
"commandName": "Docker",


Loading…
Cancel
Save