@@ -69,13 +69,20 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Servi | |||||
private async Task CheckTenant(string tenantId) | private async Task CheckTenant(string tenantId) | ||||
{ | { | ||||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||||
var url = App.Configuration["baseurl"] + "api/authorization/GetCompanyById"; | |||||
var jsonData = HttpHelper.HttpGet(url, tenantId, dic, "application/json"); | |||||
var data = JsonConvert.DeserializeObject<ResultSAASManageDto<CompanyDto>>(jsonData); | |||||
if (data.statusCode != 200) throw Oops.Oh(ErrorCodeEnum.Code10016); | |||||
if (data.data==null) throw Oops.Oh(ErrorCodeEnum.Code10016); | |||||
CurrentUser.TenantId = tenantId; | |||||
try | |||||
{ | |||||
Dictionary<string, string> dic = new Dictionary<string, string>(); | |||||
var url = App.Configuration["GroupMealBaseUrl"] + "api/authorization/GetCompanyById?id=" + tenantId; | |||||
var jsonData = HttpHelper.HttpGet(url, null, dic, "application/json"); | |||||
var data = JsonConvert.DeserializeObject<ResultSAASManageDto<CompanyDto>>(jsonData); | |||||
if (data.statusCode != 200) throw Oops.Oh(ErrorCodeEnum.Code10016); | |||||
if (data.data == null) throw Oops.Oh(ErrorCodeEnum.Code10016); | |||||
CurrentUser.TenantId = tenantId; | |||||
} | |||||
catch (Exception e) | |||||
{ | |||||
throw Oops.Oh("请求错误"); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } |
@@ -26,6 +26,11 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos | |||||
/// 餐盘信息 | /// 餐盘信息 | ||||
/// </summary> | /// </summary> | ||||
public List<WeighOrderDiningPlateDto> DiningPlateInfo { get; set; } | public List<WeighOrderDiningPlateDto> DiningPlateInfo { get; set; } | ||||
/// <summary> | |||||
/// 会员信息 | |||||
/// </summary> | |||||
public MemberInfoDto MemberInfo { get; set; } | |||||
} | } | ||||
public class WeighOrderGoodsDto | public class WeighOrderGoodsDto | ||||
@@ -55,6 +60,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos | |||||
/// </summary> | /// </summary> | ||||
public string GoodsName { get; set; } | public string GoodsName { get; set; } | ||||
public decimal TotalAmount { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 商品商品重量 | /// 商品商品重量 | ||||
@@ -76,6 +83,19 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos | |||||
public string DiningPlateId { get; set; } | public string DiningPlateId { get; set; } | ||||
} | } | ||||
public class MemberInfoDto | |||||
{ | |||||
/// <summary> | |||||
/// 是否会员 | |||||
/// </summary> | |||||
public bool IsMember { get; set; } | |||||
/// <summary> | |||||
/// 会员名称 | |||||
/// </summary> | |||||
public string Name { get; set; } | |||||
} | |||||
@@ -90,7 +110,15 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos | |||||
public class GetOrderInputDto | public class GetOrderInputDto | ||||
{ | { | ||||
/// <summary> | |||||
/// orderId | |||||
/// </summary> | |||||
public string OrderId { get; set; } | public string OrderId { get; set; } | ||||
/// <summary> | |||||
/// 芯片码 | |||||
/// </summary> | |||||
public string ChipCode { get; set; } | |||||
} | } | ||||
@@ -160,6 +188,16 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos | |||||
public string OrderId { get; set; } | public string OrderId { get; set; } | ||||
public string DiningPlateId { get; set; } | public string DiningPlateId { get; set; } | ||||
/// <summary> | |||||
/// 二维码 | |||||
/// </summary> | |||||
public string QRCode { get; set; } | |||||
/// <summary> | |||||
/// 芯片码 | |||||
/// </summary> | |||||
public string ChipCode { get; set; } | |||||
} | } | ||||
@@ -9,6 +9,7 @@ using Furion.DynamicApiController; | |||||
using Microsoft.AspNetCore.Components.Forms; | using Microsoft.AspNetCore.Components.Forms; | ||||
using Microsoft.AspNetCore.Hosting; | using Microsoft.AspNetCore.Hosting; | ||||
using Newtonsoft.Json; | using Newtonsoft.Json; | ||||
using NPOI.SS.Formula.Functions; | |||||
using SqlSugar; | using SqlSugar; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -54,9 +55,6 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service | |||||
//添加订单 | //添加订单 | ||||
var res = await db.Insertable(order).ExecuteCommandAsync(); | var res = await db.Insertable(order).ExecuteCommandAsync(); | ||||
var orderGoods = new List<BPA_WeighOrderGoods>(); | var orderGoods = new List<BPA_WeighOrderGoods>(); | ||||
foreach (var item in inputDto.Goods) | foreach (var item in inputDto.Goods) | ||||
{ | { | ||||
@@ -82,6 +80,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service | |||||
DiningPlateId = item.DiningPlateId, | DiningPlateId = item.DiningPlateId, | ||||
GroupId = CurrentUser.TenantId, | GroupId = CurrentUser.TenantId, | ||||
WeighOrderId = order.Id, | WeighOrderId = order.Id, | ||||
ChipCode = item.ChipCode, | |||||
QRCode = item.QRCode, | |||||
Id = Guid.NewGuid().ToString(), | Id = Guid.NewGuid().ToString(), | ||||
}); | }); | ||||
} | } | ||||
@@ -174,8 +174,27 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service | |||||
{ | { | ||||
var result = new WeighOrderDto(); | var result = new WeighOrderDto(); | ||||
var orderIds = new List<string>(); | |||||
if (!string.IsNullOrEmpty(inputDto.ChipCode)) | |||||
{ | |||||
//查询订单餐盘 | |||||
orderIds = await db.Queryable<BPA_WeighOrderDiningPlate>() | |||||
.Where(x => x.ChipCode == inputDto.ChipCode) | |||||
.Select(x =>x.WeighOrderId) | |||||
.ToListAsync(); | |||||
; | |||||
} | |||||
if (!string.IsNullOrEmpty(inputDto.OrderId)) | |||||
{ | |||||
orderIds.Add(inputDto.OrderId); | |||||
} | |||||
//查询订单 | //查询订单 | ||||
result = await db.Queryable<BPA_WeighOrder>() | result = await db.Queryable<BPA_WeighOrder>() | ||||
.WhereIF(!string.IsNullOrEmpty(inputDto.OrderId), x => orderIds.Contains(inputDto.OrderId)) | |||||
.Select(x => new WeighOrderDto | .Select(x => new WeighOrderDto | ||||
{ | { | ||||
CreateAt = x.CreateAt, | CreateAt = x.CreateAt, | ||||
@@ -189,7 +208,7 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service | |||||
Subject = x.Subject, | Subject = x.Subject, | ||||
TotalAmount = x.TotalAmount, | TotalAmount = x.TotalAmount, | ||||
}) | }) | ||||
.FirstAsync(x => x.Id == inputDto.OrderId); | |||||
.FirstAsync(); | |||||
//查询订单商品 | //查询订单商品 | ||||
var orderGoods = await db.Queryable<BPA_WeighOrderGoods>() | var orderGoods = await db.Queryable<BPA_WeighOrderGoods>() | ||||
@@ -208,8 +227,20 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service | |||||
}).ToList(); | }).ToList(); | ||||
//查询订单餐盘 | |||||
var diningPlate = await db.Queryable<BPA_WeighOrderDiningPlate>() | |||||
result.GoodsInfo = result.GoodsInfo.GroupBy(x=>new{x.GroupId,x.GoodsAttribute,x.GoodsName,x.OrderId}) | |||||
.Select(x=>new WeighOrderGoodsDto() | |||||
{ | |||||
GoodsAttribute=x.FirstOrDefault()?.GoodsAttribute, | |||||
GoodsId=x.FirstOrDefault()?.GoodsId, | |||||
GoodsName=x.FirstOrDefault()?.GoodsName, | |||||
GoodsWeight= SqlFunc.AggregateSum(x.FirstOrDefault()?.GoodsWeight??0), | |||||
GroupId=x.FirstOrDefault()?.GroupId, | |||||
OrderId=x.FirstOrDefault()?.OrderId, | |||||
}) | |||||
.ToList(); | |||||
//查询订单餐盘 | |||||
var diningPlate = await db.Queryable<BPA_WeighOrderDiningPlate>() | |||||
.Where(x => x.WeighOrderId == inputDto.OrderId) | .Where(x => x.WeighOrderId == inputDto.OrderId) | ||||
.Select(x => new WeighOrderDiningPlateDto() | .Select(x => new WeighOrderDiningPlateDto() | ||||
{ | { | ||||
@@ -218,6 +249,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service | |||||
}).ToListAsync(); | }).ToListAsync(); | ||||
result.DiningPlateInfo = diningPlate; | result.DiningPlateInfo = diningPlate; | ||||
result.TotalAmount = result.GoodsInfo.Sum(x => x.TotalAmount); | |||||
return result; | return result; | ||||
} | } | ||||
@@ -300,5 +333,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service | |||||
return data; | return data; | ||||
} | } | ||||
} | } | ||||
} | } |
@@ -33,6 +33,16 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity | |||||
public string DiningPlateId { get; set; } | public string DiningPlateId { get; set; } | ||||
/// <summary> | |||||
/// 二维码 | |||||
/// </summary> | |||||
public string QRCode { get; set; } | |||||
/// <summary> | |||||
/// 芯片码 | |||||
/// </summary> | |||||
public string ChipCode { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 创建时间 | /// 创建时间 | ||||
/// </summary> | /// </summary> | ||||
@@ -43,6 +43,11 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity | |||||
/// </summary> | /// </summary> | ||||
public string GoodsName { get; set; } | public string GoodsName { get; set; } | ||||
/// <summary> | |||||
/// 商品名称 | |||||
/// </summary> | |||||
public decimal TotalAmount { get; set; } | |||||
/// <summary> | /// <summary> | ||||
/// 商品商品重量 | /// 商品商品重量 | ||||
@@ -6,8 +6,8 @@ | |||||
} | } | ||||
}, | }, | ||||
"SAAS_Manage": "http://10.2.1.26:21995/saasbase/", | "SAAS_Manage": "http://10.2.1.26:21995/saasbase/", | ||||
"baseurl": "http://localhost:5001/", | |||||
"groupmeal": "http://localhost:5002/", | |||||
"GroupMealBaseUrl": "http://localhost:5001/", | |||||
"GroupMealUrl": "http://localhost:5002/", | |||||
"DBConnectionStr": "server=10.2.1.21;Port=3306;Database=bpa_kitchen_groupmealorder;Uid=root;Pwd=cygadmin;", | "DBConnectionStr": "server=10.2.1.21;Port=3306;Database=bpa_kitchen_groupmealorder;Uid=root;Pwd=cygadmin;", | ||||
"AllowedHosts": "*" | "AllowedHosts": "*" | ||||
} | } |