Browse Source

提交

master
gwbvipvip 9 months ago
parent
commit
d306a7d334
6 changed files with 111 additions and 15 deletions
  1. +14
    -7
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs
  2. +38
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs
  3. +42
    -6
      BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs
  4. +10
    -0
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs
  5. +5
    -0
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs
  6. +2
    -2
      BPA.KitChen.GroupMealOrder/appsettings.json

+ 14
- 7
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs View File

@@ -69,13 +69,20 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Servi
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("请求错误");
}
}
}
}

+ 38
- 0
BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs View File

@@ -26,6 +26,11 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos
/// 餐盘信息
/// </summary>
public List<WeighOrderDiningPlateDto> DiningPlateInfo { get; set; }

/// <summary>
/// 会员信息
/// </summary>
public MemberInfoDto MemberInfo { get; set; }
}

public class WeighOrderGoodsDto
@@ -55,6 +60,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos
/// </summary>
public string GoodsName { get; set; }

public decimal TotalAmount { get; set; }


/// <summary>
/// 商品商品重量
@@ -76,6 +83,19 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos
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
{
/// <summary>
/// orderId
/// </summary>
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 DiningPlateId { get; set; }

/// <summary>
/// 二维码
/// </summary>
public string QRCode { get; set; }

/// <summary>
/// 芯片码
/// </summary>
public string ChipCode { get; set; }
}



+ 42
- 6
BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs View File

@@ -9,6 +9,7 @@ using Furion.DynamicApiController;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Hosting;
using Newtonsoft.Json;
using NPOI.SS.Formula.Functions;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -54,9 +55,6 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
//添加订单
var res = await db.Insertable(order).ExecuteCommandAsync();




var orderGoods = new List<BPA_WeighOrderGoods>();
foreach (var item in inputDto.Goods)
{
@@ -82,6 +80,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
DiningPlateId = item.DiningPlateId,
GroupId = CurrentUser.TenantId,
WeighOrderId = order.Id,
ChipCode = item.ChipCode,
QRCode = item.QRCode,
Id = Guid.NewGuid().ToString(),
});
}
@@ -174,8 +174,27 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
{
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>()
.WhereIF(!string.IsNullOrEmpty(inputDto.OrderId), x => orderIds.Contains(inputDto.OrderId))
.Select(x => new WeighOrderDto
{
CreateAt = x.CreateAt,
@@ -189,7 +208,7 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
Subject = x.Subject,
TotalAmount = x.TotalAmount,
})
.FirstAsync(x => x.Id == inputDto.OrderId);
.FirstAsync();

//查询订单商品
var orderGoods = await db.Queryable<BPA_WeighOrderGoods>()
@@ -208,8 +227,20 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
}).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)
.Select(x => new WeighOrderDiningPlateDto()
{
@@ -218,6 +249,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
}).ToListAsync();
result.DiningPlateInfo = diningPlate;

result.TotalAmount = result.GoodsInfo.Sum(x => x.TotalAmount);

return result;
}

@@ -300,5 +333,8 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
return data;

}



}
}

+ 10
- 0
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs View File

@@ -33,6 +33,16 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity

public string DiningPlateId { get; set; }

/// <summary>
/// 二维码
/// </summary>
public string QRCode { get; set; }

/// <summary>
/// 芯片码
/// </summary>
public string ChipCode { get; set; }

/// <summary>
/// 创建时间
/// </summary>


+ 5
- 0
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs View File

@@ -43,6 +43,11 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity
/// </summary>
public string GoodsName { get; set; }

/// <summary>
/// 商品名称
/// </summary>
public decimal TotalAmount { get; set; }


/// <summary>
/// 商品商品重量


+ 2
- 2
BPA.KitChen.GroupMealOrder/appsettings.json View File

@@ -6,8 +6,8 @@
}
},
"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;",
"AllowedHosts": "*"
}

Loading…
Cancel
Save