gwbvipvip před 9 měsíci
rodič
revize
360527de5a
39 změnil soubory, kde provedl 1878 přidání a 37 odebrání
  1. +4
    -0
      BPA.KitChen.GroupMealOrder.Application/BPA.KitChen.GroupMealOrder.Application.csproj
  2. +0
    -7
      BPA.KitChen.GroupMealOrder.Application/Class1.cs
  3. +17
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseEPDto.cs
  4. +29
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseRequestDto.cs
  5. +158
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/DtoValidator.cs
  6. +16
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResponDataBase.cs
  7. +74
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResultSAASManageDto.cs
  8. +144
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Enum/ErrorCodeEnum.cs
  9. +35
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/CheckServices.cs
  10. +81
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs
  11. +47
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/CompanyDto.cs
  12. +24
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/StoreAuthorizationDto.cs
  13. +17
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs
  14. +77
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs
  15. +1
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/Test/TestService.cs
  16. +22
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/DiningPlateDto.cs
  17. +177
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs
  18. +64
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/IWeighOrderService.cs
  19. +304
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs
  20. +108
    -0
      BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/WeighOrderServices.cs
  21. +0
    -7
      BPA.KitChen.GroupMealOrder.Core/Class1.cs
  22. +4
    -2
      BPA.KitChen.GroupMealOrder.Core/Const.cs
  23. +12
    -7
      BPA.KitChen.GroupMealOrder.Core/CurrentUser.cs
  24. +6
    -2
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberInfo.cs
  25. +1
    -1
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberTag.cs
  26. +1
    -1
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ShopAuthorize.cs
  27. +1
    -1
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrder.cs
  28. +1
    -1
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrderInfo.cs
  29. +73
    -0
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrder.cs
  30. +48
    -0
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs
  31. +48
    -0
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlateUnbindRecord.cs
  32. +68
    -0
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs
  33. +61
    -0
      BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderStatesRecord.cs
  34. +2
    -2
      BPA.KitChen.GroupMealOrder.Core/Entity/Base/IBaseGroupIdEntity.cs
  35. +6
    -3
      BPA.KitChen.GroupMealOrder.Core/Entity/Base/IEntity.cs
  36. +2
    -2
      BPA.KitChen.GroupMealOrder.Core/RequestAnalysis/UserAnalysis.cs
  37. +2
    -1
      BPA.KitChen.GroupMealOrder.SqlSugar/SqlSugarDb.cs
  38. +141
    -0
      BPA.KitChen.GroupMealOrder/Handlers/RequestAuditFiltercs.cs
  39. +2
    -0
      BPA.KitChen.GroupMealOrder/appsettings.json

+ 4
- 0
BPA.KitChen.GroupMealOrder.Application/BPA.KitChen.GroupMealOrder.Application.csproj Zobrazit soubor

@@ -15,4 +15,8 @@
<ProjectReference Include="..\BPA.KitChen.GroupMealOrder.SqlSugar\BPA.KitChen.GroupMealOrder.SqlSugar.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Service\AExternalPlatform\Service\WeighOrder\Serviec\" />
</ItemGroup>

</Project>

+ 0
- 7
BPA.KitChen.GroupMealOrder.Application/Class1.cs Zobrazit soubor

@@ -1,7 +0,0 @@
namespace BPA.KitChen.GroupMealOrder.Application
{
public class Class1
{

}
}

+ 17
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseEPDto.cs Zobrazit soubor

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.BaseDto
{
public class BaseEPDto
{
public string Sign { get; set; }

public string Key { get; set; }

}

}

+ 29
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseRequestDto.cs Zobrazit soubor

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.BaseDto
{
public class BaseRequestDto<T>
{
/// <summary>
/// 是否下发
/// </summary>
public bool IsPush { get; set; }

/// <summary>
/// 回调地址
/// </summary>
public string CallbackUrl { get; set; }

public List<string> StoreIdList { get; set; }

public List<string> DeviceIdList { get; set; }

public List<T> DataInfo { get; set; }

}

}

+ 158
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/DtoValidator.cs Zobrazit soubor

@@ -0,0 +1,158 @@

using Furion.JsonSerialization;
using Newtonsoft.Json;
using NPOI.POIFS.Crypt.Dsig;
using NPOI.SS.Formula.Functions;
using NPOI.Util.ArrayExtensions;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Reflection;
using System.Text;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.BaseDto
{



/// <summary>
/// Dto参数验证
/// </summary>
public static class DtoValidator
{

///// <summary>
///// 获取签名
///// </summary>
///// <typeparam name="T"></typeparam>
///// <param name="t"></param>
///// <param name="otype">0-不排序 1-按名称ASCII排序</param>
///// <returns></returns>
//public static string GetSign<T>(T t, int otype = 1)
//{
// string retstr = "";
// //定义PropertyInfo的List
// List<PropertyInfo> proplist = new List<PropertyInfo>();
// //遍历泛型类的每个属性加入到List里面
// Array.ForEach<PropertyInfo>(typeof(T).GetProperties(),
// p => proplist.Add(p));
// //根据参数进行排序 0-不排序 1-按名称ASCII码排序
// if (otype == 1)
// proplist = proplist.OrderBy(k => k.Name).ToList();

// //遍历List泛型生成我们要签名的字符串
// proplist.ForEach(p =>
// {
// if (p.Name.ToLower() != "sign".ToLower())
// {
// if (p.GetValue(t, null) != null && p.GetValue(t, null).ToString() != "")
// {

// var type = p.GetValue(t, null).GetType().FullName;

// if (type == "System.String" || type == "System.Boolean" || type == "System.Int32" || type == "System.DateTime")
// {
// retstr = retstr + p.Name + "=" + p.GetValue(t, null) + "&";
// }
// else
// {

// retstr = retstr + p.Name + "=" + JsonConvert.SerializeObject(p.GetValue(t, null)) + "&";
// }

// }

// }
// });
// //把字符串最后一位截断
// retstr = retstr.Substring(0, retstr.Length - 1);
// //输出字符串
// return retstr;
//}

/// <summary>
/// 获取签名
/// </summary>
/// <param name="t"></param>
/// <returns></returns>
public static string GetSign(object t)
{
string retstr = "";
//定义PropertyInfo的List
List<PropertyInfo> proplist = new List<PropertyInfo>();
//遍历泛型类的每个属性加入到List里面
Array.ForEach<PropertyInfo>(t.GetType().GetProperties(),
p => proplist.Add(p));
//根据参数进行排序 0-不排序 1-按名称ASCII码排序
proplist = proplist.OrderBy(k => k.Name).ToList();

//遍历List泛型生成我们要签名的字符串
proplist.ForEach(p =>
{
if (p.Name.ToLower() != "sign".ToLower())
{
if (p.GetValue(t, null) != null && p.GetValue(t, null).ToString() != "")
{

var type = p.GetValue(t, null).GetType().FullName;

if (type == "System.String"||type== "System.Boolean"||type== "System.Int32" || type == "System.DateTime")
{
retstr = retstr + p.Name + "=" + p.GetValue(t, null) + "&";
}
else
{
var jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };

retstr = retstr + p.Name + "=" + JsonConvert.SerializeObject(p.GetValue(t, null), Formatting.None, jsonSetting) + "&";
}

}

}
});
//把字符串最后一位截断
retstr = retstr.Substring(0, retstr.Length - 1);
//输出字符串
return retstr;
}

/// <summary>
/// 获取属性值
/// </summary>
/// <param name="obj"></param>
/// <param name="name"></param>
/// <returns></returns>
public static string GetAttributePrice(object obj,string name)
{
string retstr = "";
//定义PropertyInfo的List
List<PropertyInfo> proplist = new List<PropertyInfo>();
//遍历泛型类的每个属性加入到List里面
Array.ForEach<PropertyInfo>(obj.GetType().GetProperties(),
p => proplist.Add(p));
//根据参数进行排序 0-不排序 1-按名称ASCII码排序
proplist = proplist.OrderBy(k => k.Name).ToList();

//遍历List泛型生成我们要签名的字符串
proplist.ForEach(p =>
{
if (p.Name.ToLower() == name.ToLower())
{
if (p.GetValue(obj, null).GetType().FullName.Contains("System.Collections.Generic.List"))
{
retstr = JsonConvert.SerializeObject(p.GetValue(obj, null));
}
else
{
retstr = p.GetValue(obj, null)?.ToString();
}

}
});
//输出字符串
return retstr;
}
}
}

+ 16
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResponDataBase.cs Zobrazit soubor

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.BaseDto
{
public class ResponDataBase
{
public string statusCode { get; set; }
public object data { get; set; }
public string succeeded { get; set; }
public string errors { get; set; }
}
}

+ 74
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResultSAASManageDto.cs Zobrazit soubor

@@ -0,0 +1,74 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.BaseDto
{
public class ResultSAASManageDto<T>
{
public int statusCode { get; set; }

public T? data { get; set; }

public string succeeded { get; set; }

public string errors { get; set; }

public string extras { get; set; }

public int timestamp { get; set; }


}
public class ResultSAASManageDto
{
public int statusCode { get; set; }

public object data { get; set; }

public string succeeded { get; set; }

public string errors { get; set; }

public string extras { get; set; }

public int timestamp { get; set; }


}


public class ResultSAASManageDataDto<T>
{
public List<T> data { get; set; }

public int total { get; set; }
}
public class ResultTenantDataItemDto
{
public string id { get; set; }

public string name { get; set; }

public string adminName { get; set; }

public string email { get; set; }

public string phone { get; set; }

public string remark { get; set; }

public string logo { get; set; }

public string createAt { get; set; }

public int status { get; set; }

public string sysRoleId { get; set; }

public int type { get; set; }
}

}

+ 144
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Enum/ErrorCodeEnum.cs Zobrazit soubor

@@ -0,0 +1,144 @@
using Furion.FriendlyException;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Enum
{
/// <summary>
/// 系统错误码
/// </summary>
[ErrorCodeType]
[Description("系统错误码")]
public enum ErrorCodeEnum
{
/// <summary>
/// 用户没有注册
/// </summary>
[ErrorCodeItemMetadata("用户没有注册")]
Code1000,

/// <summary>
/// 操作错误
/// </summary>
[ErrorCodeItemMetadata("操作错误")]
Code1001,

/// <summary>
/// 重复添加
/// </summary>
[ErrorCodeItemMetadata("重复添加")]
Code1002,

/// <summary>
/// 操作数据不存在
/// </summary>
[ErrorCodeItemMetadata("操作数据不存在")]
Code1003,

/// <summary>
/// key不正确
/// </summary>
[ErrorCodeItemMetadata("key不正确")]
Code1004,

/// <summary>
/// 签名错误
/// </summary>
[ErrorCodeItemMetadata("签名错误")]
Code1005,

/// <summary>
/// 签名错误
/// </summary>
[ErrorCodeItemMetadata("签名过期")]
Code1006,
/// <summary>
/// 系统异常
/// </summary>
[ErrorCodeItemMetadata("系统异常")]
Code1007,
/// <summary>
/// 商品不存在
/// </summary>
[ErrorCodeItemMetadata("商品不存在")]
Code1008,
/// <summary>
/// 场景id不能为空
/// </summary>
[ErrorCodeItemMetadata("场景id不能为空")]
Code1009,
/// <summary>
/// 产品不存在
/// </summary>
[ErrorCodeItemMetadata("产品不存在")]
Code10010,
/// <summary>
/// 产品版本不存在
/// </summary>
[ErrorCodeItemMetadata("产品版本不存在")]
Code10011,
/// <summary>
/// 设备不存在
/// </summary>
[ErrorCodeItemMetadata("设备不存在")]
Code10012,
/// <summary>
/// 产品标签不存在
/// </summary>
[ErrorCodeItemMetadata("产品标签不存在")]
Code10013,


/// <summary>
/// 授权过期
/// </summary>
[ErrorCodeItemMetadata("授权过期")]
Code10014,
/// <summary>
/// 配方不存在
/// </summary>
[ErrorCodeItemMetadata("配方不存在")]
Code10015,

/// <summary>
/// 下发错误
/// </summary>
[ErrorCodeItemMetadata("操作成功,下发错误")]
Code10016,

/// <summary>
/// 名称或编码重复
/// </summary>
[ErrorCodeItemMetadata("名称或编码重复")]
Code10017,
/// <summary>
/// 模板名称不能重复
/// </summary>
[ErrorCodeItemMetadata("模板名称不能重复")]
Code10018,
/// <summary>
/// 设备id不能为空
/// </summary>
[ErrorCodeItemMetadata("设备id不能为空")]
Code10019,
/// <summary>
/// 模板名称不能为空
/// </summary>
[ErrorCodeItemMetadata("模板名称不能为空")]
Code10020,
/// <summary>
/// 获取场景数据失败
/// </summary>
[ErrorCodeItemMetadata("获取场景数据失败")]
Code10021,
/// <summary>
/// 场景不存在
/// </summary>
[ErrorCodeItemMetadata("场景不存在")]
Code10022,
}
}

+ 35
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/CheckServices.cs Zobrazit soubor

@@ -0,0 +1,35 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService.Services;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Mvc;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService
{
[ApiDescriptionSettings("开放平台", Tag = "检查"), AllowAnonymous]
public class CheckServices : IDynamicApiController
{
private readonly ICheckServices _checkServices;
public CheckServices(ICheckServices checkServices)
{
_checkServices = checkServices;
}

/// <summary>
///检查Sign
/// </summary>
public async Task CheckSign(string key, string signStr, string signMd5)
{
await _checkServices.CheckSign( key, signStr, signMd5);
}


}
}

+ 81
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs Zobrazit soubor

@@ -0,0 +1,81 @@

using BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.BaseDto;
using BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Enum;
using BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService.Services.Dtos;
using BPA.KitChen.GroupMealOrder.Core;
using BPA.KitChen.GroupMealOrder.Core.Common;
using BPA.KitChen.GroupMealOrder.SqlSugar;
using Furion;
using Furion.DatabaseAccessor;
using Furion.DataEncryption;
using Furion.DependencyInjection;
using Furion.FriendlyException;
using Microsoft.AspNetCore.Components.Forms;
using Newtonsoft.Json;
using NPOI.Util.ArrayExtensions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService.Services
{
public class CheckServices : ICheckServices, ITransient
{
/// <summary>
///检查Sign
/// </summary>
public async Task CheckSign(string key,string signStr,string signMd5)
{

//检查key
await CheckKey(key);

var thisSign = signStr + "&key=" + key;
var vvv = MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper();

var vvvvv = thisSign.ToUpper();

if (MD5Encryption.Encrypt(thisSign.ToUpper()).ToUpper() != signMd5.ToUpper())
{
throw Oops.Oh(ErrorCodeEnum.Code1005);
}
}

/// <summary>
/// 检查平key验证
/// </summary>
/// <param name="key"></param>
private async Task CheckKey(string key)
{
Dictionary<string, string> dic = new Dictionary<string, string>();
var url = App.Configuration["groupmeal"] + "api/authorization/GetCompanyById";
var jsonData = HttpHelper.HttpGet(url, key, dic, "application/json");
var data = JsonConvert.DeserializeObject<ResultSAASManageDto<StoreAuthorizationDto>>(jsonData);
if (data.statusCode != 200) throw Oops.Oh(ErrorCodeEnum.Code10016);
if (data.data == null) throw Oops.Oh(ErrorCodeEnum.Code10016);
await CheckTenant(data.data.GroupId);
}

/// <summary>
/// 检查租户
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
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;
}
}
}

+ 47
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/CompanyDto.cs Zobrazit soubor

@@ -0,0 +1,47 @@
using BPA.KitChen.GroupMealOrder.Core.Enum;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService.Services.Dtos
{
public class CompanyDto
{
public string Id { get; set; }

/// <summary>
/// 加盟商名称
/// </summary>
public string Name { get; set; }
/// <summary>
/// 管理员姓名
/// </summary>
public string AdminName { get; set; }
/// <summary>
/// 邮箱账号
/// </summary>
public string Email { get; set; }
/// <summary>
/// 电话
/// </summary>
public string Phone { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// logo
/// </summary>
public string Code { get; set; }
/// <summary>
/// 状态 【正常 停用】默认 正常
/// </summary>
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;
/// <summary>
/// 所属平台 0 团餐 1门店 2 后厨 3公共
/// </summary>
public int Type { get; set; }
}
}

+ 24
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/StoreAuthorizationDto.cs Zobrazit soubor

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService.Services.Dtos
{
public class StoreAuthorizationDto
{
public string Id { get; set; }

public string StoreId { get; set; }
public string Key { get; set; }
public string GroupId { get; set; }

/// <summary>
/// 有效期 长期有效为空
/// </summary>
public DateTime? PeriodValidity { get; set; }

public DateTime UpdateAt { get; set; }
}
}

+ 17
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs Zobrazit soubor

@@ -0,0 +1,17 @@

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService.Services
{
public interface ICheckServices
{
/// <summary>
///检查Sign
/// </summary>
Task CheckSign(string key, string signStr, string signMd5);
}
}

+ 77
- 0
BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs Zobrazit soubor

@@ -0,0 +1,77 @@


using BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos;
using BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service;
using BPA.KitChen.GroupMealOrder.Core;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;

namespace BPA.KitChen.GroupMealOrder.Application.Service.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
- 0
BPA.KitChen.GroupMealOrder.Application/Service/Test/TestService.cs Zobrazit soubor

@@ -30,6 +30,7 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.TestService
&& x.GetCustomAttribute<SugarTable>() != null
&& x.Namespace.Contains("BPA.KitChen.GroupMealOrder.Core.Entity"))
.ToArray();
types = types.Where(x => x.Name != "BPA_Order"&&x.Name!= "BPA_SubOrder").ToArray();
SqlSugarDb.Db.CodeFirst.InitTables(types);
}
catch (Exception e)


+ 22
- 0
BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/DiningPlateDto.cs Zobrazit soubor

@@ -0,0 +1,22 @@
using NPOI.SS.Formula.Functions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos
{
public class DiningPlateDto
{
/// <summary>
/// 餐盘信息
/// </summary>
public string DiningPlateId { get; set; }

/// <summary>
/// 是否占用
/// </summary>
public bool IsOccupy { get; set; }
}
}

+ 177
- 0
BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs Zobrazit soubor

@@ -0,0 +1,177 @@
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity;
using Furion;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos
{


/// <summary>
///
/// </summary>
public class WeighOrderDto: BPA_WeighOrder
{
/// <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; }
}



}

+ 64
- 0
BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/IWeighOrderService.cs Zobrazit soubor

@@ -0,0 +1,64 @@
using BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos;
using BPA.KitChen.GroupMealOrder.Core.Entity;
using Furion.DatabaseAccessor;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
{
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);

/// <summary>
/// 添加 餐盘解绑记录
/// </summary>
/// <param name="inputDto">餐盘ID</param>
/// <returns></returns>
Task<bool> AddWeighOrderDiningPlateUnbindRecord(List<string> inputDto);

/// <summary>
/// 获取餐盘绑定信息
/// </summary>
/// <param name="inputDto">餐盘ID</param>
/// <returns></returns>
Task<List<DiningPlateDto>> GetDiningPlateOccupyInfo(List<string> inputDto);
}
}

+ 304
- 0
BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs Zobrazit soubor

@@ -0,0 +1,304 @@
using BPA.KitChen.GroupMealOrder.Application.BaseDto;
using BPA.KitChen.GroupMealOrder.Application.Service.ThirdAuthorize;
using BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos;
using BPA.KitChen.GroupMealOrder.Core;
using BPA.KitChen.GroupMealOrder.Core.Entity;
using BPA.KitChen.GroupMealOrder.SqlSugar;
using Furion.DependencyInjection;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Components.Forms;
using Microsoft.AspNetCore.Hosting;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service
{
public class WeighOrderService : ITransient, IWeighOrderService
{
private readonly SqlSugarScope db;

public WeighOrderService()
{
db = SqlSugarDb.Db;
}

/// <summary>
/// 创建订单
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<WeighOrderDto> CreateWeighOrder(WeighOrderCreteDto inputDto)
{
var result = new WeighOrderDto();



var order = new BPA_WeighOrder()
{
CreateAt = DateTime.Now,
GroupId = CurrentUser.TenantId,
CreateId = inputDto.CreateId,
OrderNumber = Guid.NewGuid().ToString(),
Id = Guid.NewGuid().ToString(),
PayStates = 0,
SceneId = inputDto.SceneId,
States = 0,
TotalAmount = inputDto.TotalAmount,
Subject = inputDto.Subject,
};
//添加订单
var res = await db.Insertable(order).ExecuteCommandAsync();




var orderGoods = new List<BPA_WeighOrderGoods>();
foreach (var item in inputDto.Goods)
{
orderGoods.Add(new BPA_WeighOrderGoods()
{
GoodsAttribute = "",
GoodsId = item.GoodsId,
GoodsName = item.GoodsName,
GoodsWeight = item.GoodsWeight,
GroupId = CurrentUser.TenantId,
Id = Guid.NewGuid().ToString(),
OrderId = order.Id

});
}


var diningPlate = new List<BPA_WeighOrderDiningPlate>();
foreach (var item in inputDto.DiningPlateInfo)
{
diningPlate.Add(new BPA_WeighOrderDiningPlate()
{
DiningPlateId = item.DiningPlateId,
GroupId = CurrentUser.TenantId,
WeighOrderId = order.Id,
Id = Guid.NewGuid().ToString(),
});
}

//添加子订单
if (res > 0)
{
result = new WeighOrderDto()
{
CreateAt = order.CreateAt,
CreateId = order.CreateId,
GroupId = order.GroupId,
Id = order.Id,
OrderNumber = order.OrderNumber,
PayStates = order.PayStates,
SceneId = order.SceneId,
States = order.States,
Subject = inputDto.Subject,
TotalAmount = order.TotalAmount,
};
await db.Insertable(orderGoods).ExecuteCommandAsync();
await db.Insertable(diningPlate).ExecuteCommandAsync();
}

result = await GetWeighOrder(new GetOrderInputDto()
{
OrderId = order.Id,
});

return result;
}

/// <summary>
/// 添加订单商品
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<bool> AddWeighOrderGoods(List<WeighOrderGoodsCreateDto> inputDto)
{
var orderGoods = new List<BPA_WeighOrderGoods>();
foreach (var item in inputDto)
{
orderGoods.Add(new BPA_WeighOrderGoods()
{
GoodsAttribute = "",
GoodsId = item.GoodsId,
GoodsName = item.GoodsName,
GoodsWeight = item.GoodsWeight,
GroupId = CurrentUser.TenantId,
OrderId = item.OrderId,
Id = Guid.NewGuid().ToString(),

});
}

var res = await db.Insertable(orderGoods).ExecuteCommandAsync();

return res > 0;
}

/// <summary>
/// 添加订单餐盘
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<bool> AddWeighOrderDiningPlate(List<WeighOrderDiningPlateCreateDto> inputDto)
{
var diningPlate = new List<BPA_WeighOrderDiningPlate>();
foreach (var item in inputDto)
{
diningPlate.Add(new BPA_WeighOrderDiningPlate()
{
DiningPlateId = item.DiningPlateId,
GroupId = CurrentUser.TenantId,
WeighOrderId = item.OrderId,
Id = Guid.NewGuid().ToString(),
});
}

var res = await db.Insertable(diningPlate).ExecuteCommandAsync();
return res > 0;
}

/// <summary>
/// 查询订单商品
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
public async Task<WeighOrderDto> GetWeighOrder(GetOrderInputDto inputDto)
{
var result = new WeighOrderDto();

//查询订单
result = await db.Queryable<BPA_WeighOrder>()
.Select(x => new WeighOrderDto
{
CreateAt = x.CreateAt,
CreateId = x.CreateId,
GroupId = x.GroupId,
Id = x.Id,
OrderNumber = x.OrderNumber,
PayStates = 0,
SceneId = x.SceneId,
States = 0,
Subject = x.Subject,
TotalAmount = x.TotalAmount,
})
.FirstAsync(x => x.Id == inputDto.OrderId);

//查询订单商品
var orderGoods = await db.Queryable<BPA_WeighOrderGoods>()
.Where(x => x.OrderId == inputDto.OrderId)
.ToListAsync();

result.GoodsInfo = orderGoods.Select(x => new WeighOrderGoodsDto()
{
GoodsId = x.GoodsId,
GoodsAttribute = string.IsNullOrEmpty(x.GoodsAttribute) ? null : JsonConvert.DeserializeObject<List<GoogsAttribute>>(x.GoodsAttribute),
GoodsName = x.GoodsName,
GoodsWeight = x.GoodsWeight,
GroupId = x.GroupId,
Id = x.Id,
OrderId = x.OrderId,
}).ToList();


//查询订单餐盘
var diningPlate = await db.Queryable<BPA_WeighOrderDiningPlate>()
.Where(x => x.WeighOrderId == inputDto.OrderId)
.Select(x => new WeighOrderDiningPlateDto()
{
DiningPlateId = x.DiningPlateId,
OrderId = inputDto.OrderId,
}).ToListAsync();
result.DiningPlateInfo = diningPlate;

return result;
}

/// <summary>
/// 修改订单状态
/// </summary>
/// <returns></returns>
public async Task<bool> UpdateWeighOrderStates(WeighOrderUpdateDto inputDto)
{
//查询订单
var result = await db.Queryable<BPA_WeighOrder>()
.Select(x => new WeighOrderDto
{
CreateAt = x.CreateAt,
CreateId = x.CreateId,
GroupId = x.GroupId,
Id = x.Id,
OrderNumber = x.OrderNumber,
PayStates = 0,
SceneId = x.SceneId,
States = 0,
Subject = x.Subject,
TotalAmount = x.TotalAmount,
})
.FirstAsync(x => x.Id == inputDto.OrderId);

result.PayStates = inputDto.PayStates;
result.States = inputDto.States;

var res =await db.Updateable(result).ExecuteCommandAsync();

return res > 0;
}

/// <summary>
/// 添加 餐盘解绑记录
/// </summary>
/// <param name="inputDto">餐盘ID</param>
/// <returns></returns>
public async Task<bool> AddWeighOrderDiningPlateUnbindRecord(List<string> inputDto)
{
var list=new List<BPA_WeighOrderDiningPlateUnbindRecord>();

foreach (var item in inputDto)
{
list.Add(new BPA_WeighOrderDiningPlateUnbindRecord()
{
CreateAt=DateTime.Now,
DiningPlateId=item
});
}

if (list.Count>0)
{
var res=await db.Updateable(list).ExecuteCommandAsync();
return res > 0;
}

return false;
}

/// <summary>
/// 获取餐盘绑定信息
/// </summary>
/// <param name="inputDto">餐盘ID</param>
/// <returns></returns>
public async Task<List<DiningPlateDto>> GetDiningPlateOccupyInfo(List<string> inputDto)
{
var data = await db.Queryable<BPA_WeighOrderDiningPlate, BPA_WeighOrder, BPA_WeighOrderDiningPlateUnbindRecord>
((a, b, c) => new JoinQueryInfos(JoinType.Left, a.WeighOrderId == b.Id, JoinType.Left, a.DiningPlateId == c.DiningPlateId))
.WhereIF(inputDto.Count > 0, (a, b, c) => inputDto.Contains(a.DiningPlateId))
.Select((a, b, c) => new DiningPlateDto()
{
DiningPlateId = a.DiningPlateId,
IsOccupy = b.States == 1 ? false : ((c == null || c.Id == null) ? false : true)
})
.ToListAsync();
data = data.Where(x => x.IsOccupy == true).ToList();

return data;

}
}
}

+ 108
- 0
BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/WeighOrderServices.cs Zobrazit soubor

@@ -0,0 +1,108 @@
using BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Dtos;
using BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder.Service;
using BPA.KitChen.GroupMealOrder.Core.Entity;
using BPA.KitChen.GroupMealOrder.SqlSugar;
using Furion.DatabaseAccessor;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Application.Service.WeighOrder
{

[ApiDescriptionSettings("订单管理", Tag = "称重订单", SplitCamelCase = false)]
public class WeighOrderServices: IDynamicApiController
{
private readonly IWeighOrderService _weighOrderService;
public WeighOrderServices(IWeighOrderService weighOrderService)
{
_weighOrderService = weighOrderService;
}


/// <summary>
/// 创建订单
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/WeighOrder/CreateWeighOrder")]
public async Task<WeighOrderDto> CreateWeighOrder(WeighOrderCreteDto inputDto)
{
return await _weighOrderService.CreateWeighOrder(inputDto);
}

/// <summary>
/// 添加订单商品
/// </summary>
/// <param name="inputDto"></param>
/// <returns></returns>
[HttpPost("/api/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/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/WeighOrder/GetWeighOrder")]
public async Task<WeighOrderDto> GetWeighOrder(GetOrderInputDto inputDto)
{
return await _weighOrderService.GetWeighOrder(inputDto);
}

/// <summary>
/// 修改订单状态
/// </summary>
/// <returns></returns>
[HttpPost("/api/WeighOrder/UpdateWeighOrderStates")]
public async Task<bool> UpdateWeighOrderStates(WeighOrderUpdateDto inputDto)
{
return await _weighOrderService.UpdateWeighOrderStates(inputDto);
}


/// <summary>
/// 添加 餐盘解绑记录
/// </summary>
/// <param name="inputDto">餐盘ID</param>
/// <returns></returns>
[HttpPost("/api/WeighOrder/AddWeighOrderDiningPlateUnbindRecord"), AllowAnonymous]
public async Task<bool> AddWeighOrderDiningPlateUnbindRecord(List<string> inputDto)
{
return await _weighOrderService.AddWeighOrderDiningPlateUnbindRecord(inputDto);
}

/// <summary>
/// 获取餐盘绑定信息
/// </summary>
/// <param name="inputDto">餐盘ID</param>
/// <returns></returns>
[HttpPost("/api/WeighOrder/GetDiningPlateOccupyInfo"), AllowAnonymous]
public async Task<List<DiningPlateDto>> GetDiningPlateOccupyInfo(List<string> inputDto)
{
return await _weighOrderService.GetDiningPlateOccupyInfo(inputDto);
}

}
}

+ 0
- 7
BPA.KitChen.GroupMealOrder.Core/Class1.cs Zobrazit soubor

@@ -1,7 +0,0 @@
namespace BPA.KitChen.GroupMealOrder.Core
{
public class Class1
{

}
}

BPA.KitChen.GroupMealOrder.Core/Entity/Class1.cs → BPA.KitChen.GroupMealOrder.Core/Const.cs Zobrazit soubor

@@ -4,9 +4,11 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.StoreManagementOrder.Core.Entity
namespace BPA.KitChen.GroupMealOrder.Core
{
internal class Class1
public class Const
{

public const string ExternalPlatformUrl = "groupmealorder";
}
}

BPA.KitChen.GroupMealOrder.Core/Common/CurrentUser.cs → BPA.KitChen.GroupMealOrder.Core/CurrentUser.cs Zobrazit soubor

@@ -3,23 +3,28 @@ using Furion;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Core.Common
namespace BPA.KitChen.GroupMealOrder.Core
{
/// <summary>
/// 当前用户
/// </summary>
public class CurrentUser
public static class CurrentUser
{

public static string? UserId => App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value;

public static string? TenantId => App.User?.FindFirst(ClaimConst.GroupId)?.Value;

private static string tenantId;

public static string? TenantId
{
get { return string.IsNullOrEmpty(App.User?.FindFirst(ClaimConst.GroupId)?.Value) ? tenantId : App.User?.FindFirst(ClaimConst.GroupId)?.Value; }
set { tenantId = value; }
}

public static string? Account => App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value;
public static string? RoleId => App.User?.FindFirst(ClaimConst.RoleId)?.Value;

public static string MessageId { get; set; }
}
}

+ 6
- 2
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberInfo.cs Zobrazit soubor

@@ -1,4 +1,6 @@
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using Furion;
using SqlSugar;
using System;
using System.Collections.Generic;
@@ -12,8 +14,10 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity
/// 会员
/// </summary>
[SugarTable("BPA_MemberInfo")]
public class BPA_MemberInfo : IBaseGroupIdEntity
public class BPA_MemberInfo : IEntity
{
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "GroupId", IsNullable = true)]
public string GroupId { get; set; } = App.User?.FindFirst(ClaimConst.GroupId)?.Value;

/// <summary>
///


+ 1
- 1
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberTag.cs Zobrazit soubor

@@ -7,7 +7,7 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity
/// 会员标签
/// </summary>
[SugarTable("BPA_MemberTag")]
public class BPA_MemberTag : IBaseGroupIdEntity
public class BPA_MemberTag : IEntity
{
/// <summary>
/// 会员标签名称


+ 1
- 1
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ShopAuthorize.cs Zobrazit soubor

@@ -10,7 +10,7 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity
{

[SugarTable("BPA_ShopAuthorize")]
public class BPA_ShopAuthorize: IBaseGroupIdEntity
public class BPA_ShopAuthorize: IEntity
{
public string StoreId { get; set; }



+ 1
- 1
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrder.cs Zobrazit soubor

@@ -10,7 +10,7 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity
{

[SugarTable("BPA_ThirdOrder")]
public class BPA_ThirdOrder: IBaseGroupIdEntity
public class BPA_ThirdOrder: IEntity
{

public string OrderNum { get; set; }


+ 1
- 1
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrderInfo.cs Zobrazit soubor

@@ -10,7 +10,7 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity
{

[SugarTable("BPA_ThirdOrderInfo")]
public class BPA_ThirdOrderInfo: IBaseGroupIdEntity
public class BPA_ThirdOrderInfo: IEntity
{

public string ThirdOrderId { get; set; }


+ 73
- 0
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrder.cs Zobrazit soubor

@@ -0,0 +1,73 @@
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using Furion;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Core.Entity
{
/// <summary>
/// 称重订单
/// </summary>
[SugarTable("bpa_weighorder")]
public class BPA_WeighOrder : IBaseGroupIdEntity
{
/// <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; }
}
}

+ 48
- 0
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs Zobrazit soubor

@@ -0,0 +1,48 @@
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using Furion;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Core.Entity
{
/// <summary>
/// 称重餐盘订单
/// </summary>
[SugarTable("bpa_weighorderdiningplate")]
public class BPA_WeighOrderDiningPlate : IBaseGroupIdEntity
{
/// <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 WeighOrderId { get; set; }

public string DiningPlateId { get; set; }

/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)]
public DateTime CreateAt { get; set; } = DateTime.Now;

/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = false)]
public string CreateBy { get; set; }
}
}

+ 48
- 0
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlateUnbindRecord.cs Zobrazit soubor

@@ -0,0 +1,48 @@
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using Furion;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Core.Entity
{
/// <summary>
/// 产盘解绑记录
/// </summary>
[SugarTable("bpa_weighorderdiningplateunbindrecord")]
public class BPA_WeighOrderDiningPlateUnbindRecord : IBaseGroupIdEntity
{
/// <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;


public string WeighOrderId { get; set; }

public string DiningPlateId { get; set; }


/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)]
public DateTime CreateAt { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)]
public string CreateBy { get; set; }

}
}

+ 68
- 0
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs Zobrazit soubor

@@ -0,0 +1,68 @@
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using Furion;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Core.Entity
{
/// <summary>
/// 称重订单商品
/// </summary>
[SugarTable("bpa_weighordergoods")]
public class BPA_WeighOrderGoods : IBaseGroupIdEntity
{
/// <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>
/// 订单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 string GoodsAttribute { get; set; }

/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)]
public DateTime CreateAt { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)]
public string CreateBy { get; set; }
}
}

+ 61
- 0
BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderStatesRecord.cs Zobrazit soubor

@@ -0,0 +1,61 @@
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using Furion;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Core.Entity
{
/// <summary>
/// 称重订单状态变更记录
/// </summary>
[SugarTable("bpa_weighorderstatesrecord")]
public class BPA_WeighOrderStatesRecord : IBaseGroupIdEntity
{
/// <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 OrderId { get; set; }

/// <summary>
/// 变更前
/// </summary>
public int BeforeTheChange { get; set; }

/// <summary>
/// 变更后
/// </summary>
public int AfterTheChange { get; set; }


/// <summary>
/// 创建时间
/// </summary>
[SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)]
public DateTime CreateAt { get; set; } = DateTime.Now;
/// <summary>
/// 创建人
/// </summary>
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)]
public string CreateBy { get; set; }




}
}

+ 2
- 2
BPA.KitChen.GroupMealOrder.Core/Entity/Base/IBaseGroupIdEntity.cs Zobrazit soubor

@@ -10,10 +10,10 @@ using System.Threading.Tasks;

namespace BPA.KitChen.GroupMealOrder.Core.Entity.Base
{
public class IBaseGroupIdEntity: IEntity
public interface IBaseGroupIdEntity
{

[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "GroupId", IsNullable = true)]
public string GroupId { get; set; } = App.User?.FindFirst(ClaimConst.GroupId)?.Value;
public string GroupId { get; set; }
}
}

+ 6
- 3
BPA.KitChen.GroupMealOrder.Core/Entity/Base/IEntity.cs Zobrazit soubor

@@ -1,4 +1,5 @@
using BPA.KitChen.GroupMealOrder.Core.Enum;
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Enum;
using Furion;
using SqlSugar;
using System;
@@ -8,14 +9,16 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity.Base
/// <summary>
/// 自定义实体基类
/// </summary>
public abstract class IEntity: IBaseOPEntity
public abstract class IEntity: IBaseOPEntity, IBaseGroupIdEntity
{
/// <summary>
/// 状态
/// </summary>
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)]
public CommonStatus Status { get; set; } = CommonStatus.ENABLE;


[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "GroupId", IsNullable = true)]
public string GroupId { get; set; } = App.User?.FindFirst(ClaimConst.GroupId)?.Value;
}
}

+ 2
- 2
BPA.KitChen.GroupMealOrder.Core/RequestAnalysis/UserAnalysis.cs Zobrazit soubor

@@ -12,9 +12,9 @@ namespace BPA.KitChen.GroupMealOrder.Core.RequestAnalysis
{
public UserAnalysis()
{
//CurrentUser.AppId = App.HttpContext.Request.Headers["AppId"];
//CurrentUser.TenantId = App.HttpContext.Request.Headers["TenantId"];
CurrentUser.TenantId = App.HttpContext.Request.Headers["GroupId"];

}
}


+ 2
- 1
BPA.KitChen.GroupMealOrder.SqlSugar/SqlSugarDb.cs Zobrazit soubor

@@ -1,4 +1,5 @@
using BPA.KitChen.GroupMealOrder.Core.Common;
using BPA.KitChen.GroupMealOrder.Core;
using BPA.KitChen.GroupMealOrder.Core.Common;
using BPA.KitChen.GroupMealOrder.Core.Common.Const;
using BPA.KitChen.GroupMealOrder.Core.Entity.Base;
using Furion;


+ 141
- 0
BPA.KitChen.GroupMealOrder/Handlers/RequestAuditFiltercs.cs Zobrazit soubor

@@ -0,0 +1,141 @@
using BPA.KitChen.GroupMealOrder.Application.Service.AExternalPlatform.Service.CheckService.Services;
using BPA.KitChen.GroupMealOrder.Core;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.Filters;
using Newtonsoft.Json;
using System.Reflection;

namespace BPA.KitChen.GroupMealOrder.Handlers
{
public class RequestAuditFiltercs : IAsyncActionFilter
{
private readonly ICheckServices _checkServices;

public RequestAuditFiltercs( ICheckServices checkServices)
{
_checkServices = checkServices;
}

public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
{

CurrentUser.MessageId=Guid.NewGuid().ToString();

//============== 这里是执行方法之前获取数据 ====================
// 获取 HttpContext 和 HttpRequest 对象
var httpContext = context.HttpContext;
var httpRequest = httpContext.Request;

// 获取客户端 Ipv4 地址
var remoteIPv4 = httpContext.GetRemoteIpAddressToIPv4();

// 获取请求的 Url 地址
var requestUrl = httpRequest.GetRequestUrlAddress();

// 获取来源 Url 地址
var refererUrl = httpRequest.GetRefererUrlAddress();

// 获取控制器、路由信息
var actionDescriptor = context.ActionDescriptor as ControllerActionDescriptor;

// 获取请求的方法
var method = actionDescriptor.MethodInfo;

// 获取请求参数(写入日志,需序列化成字符串后存储)
var parameters = context.ActionArguments;


//foreach (var parameter in parameters)
//{
// var stingA = DtoValidator.GetSign(parameter.Value);
// var vvv = 00;
//}


//if (requestUrl.ToUpper().Contains("ExternalPlatform".ToUpper()))
//{

// var key = httpRequest.Headers["key"];
// var sign = httpRequest.Headers["sign"];
// List<PropertyInfo> proplist = new List<PropertyInfo>();
// foreach (var parameter in parameters)
// {
// var stingA = DtoValidator.GetSign(parameter.Value);
// //var sign = DtoValidator.GetAttributePrice(parameter.Value, "sign");
// await _checkServices.CheckSign(key, stingA, sign);
// }
//}

//============== 这里是执行方法之后获取数据 ====================
var actionContext = await next();

// 获取返回的结果
var returnResult = actionContext.Result;

// 判断是否请求成功,没有异常就是请求成功
var isRequestSucceed = actionContext.Exception == null;
if (requestUrl.ToUpper().Contains("ExternalPlatform".ToUpper()))
{
try
{
////记录日志
//await SqlSugarDb.Db.Insertable(new BPA_ThirdpartyRequestLog()
//{
// Id = CurrentUser.MessageId,
// CreateBy = DateTime.Now.ToString(),
// GroupId = CurrentUser.GroupId,
// RequestUrl = requestUrl,
// ReauestMethod = httpRequest.Method,
// ReauestParm = JsonConvert.SerializeObject(parameters),
// ResultParm = !isRequestSucceed ? actionContext.Exception.ToString() : JsonConvert.SerializeObject(returnResult),
// IP = remoteIPv4
//}).ExecuteCommandAsync();

////记录下发记录
//if (isRequestSucceed)
//{
// foreach (var parameter in parameters)
// {
// var isPush = DtoValidator.GetAttributePrice(parameter.Value, "isPush");
// var callbackUrl = DtoValidator.GetAttributePrice(parameter.Value, "callbackUrl");
// var storeIdList = DtoValidator.GetAttributePrice(parameter.Value, "storeIdList");
// var deviceIdList = DtoValidator.GetAttributePrice(parameter.Value, "deviceIdList");

// if (isPush.ToUpper() == "true".ToUpper())
// {
// var list = new List<string>();
// if (!string.IsNullOrEmpty(deviceIdList))
// {
// list = JsonConvert.DeserializeObject<List<string>>(deviceIdList);
// }
// if ( !string.IsNullOrEmpty(storeIdList))
// {
// list = await _thirdpartyPushService.GetDeviceByStoreId(JsonConvert.DeserializeObject<List<string>>(storeIdList));
// }

// await _thirdpartyPushService.AddThirdpartyPushRecord(new BPA_ThirdpartyPushRecord()
// {
// Id = Guid.NewGuid().ToString(),
// GroupId = CurrentUser.GroupId,
// IsPush = false,
// CallbackUrl = callbackUrl,
// MessageId = msgId,
// PushData = JsonConvert.SerializeObject(parameters),
// PushDevice = JsonConvert.SerializeObject(list)
// });
// }
// break;
// }
//}

}
catch (Exception e)
{
}
}

}
}
}

+ 2
- 0
BPA.KitChen.GroupMealOrder/appsettings.json Zobrazit soubor

@@ -6,6 +6,8 @@
}
},
"SAAS_Manage": "http://10.2.1.26:21995/saasbase/",
"baseurl": "http://localhost:5001/",
"groupmeal": "http://localhost:5002/",
"DBConnectionStr": "server=10.2.1.21;Port=3306;Database=bpa_kitchen_groupmealorder;Uid=root;Pwd=cygadmin;",
"AllowedHosts": "*"
}

Načítá se…
Zrušit
Uložit