From 360527de5af08760e8a30b8ba4456da160ab5987 Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Mon, 11 Mar 2024 10:17:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ....KitChen.GroupMealOrder.Application.csproj | 4 + .../Class1.cs | 7 - .../AExternalPlatform/BaseDto/BaseEPDto.cs | 17 + .../BaseDto/BaseRequestDto.cs | 29 ++ .../AExternalPlatform/BaseDto/DtoValidator.cs | 158 +++++++++ .../BaseDto/ResponDataBase.cs | 16 + .../BaseDto/ResultSAASManageDto.cs | 74 +++++ .../AExternalPlatform/Enum/ErrorCodeEnum.cs | 144 +++++++++ .../Service/CheckService/CheckServices.cs | 35 ++ .../CheckService/Services/CheckServices.cs | 81 +++++ .../CheckService/Services/Dtos/CompanyDto.cs | 47 +++ .../Services/Dtos/StoreAuthorizationDto.cs | 24 ++ .../CheckService/Services/ICheckServices.cs | 17 + .../Service/WeighOrder/WeighOrderServices.cs | 77 +++++ .../Service/Test/TestService.cs | 1 + .../Service/WeighOrder/Dtos/DiningPlateDto.cs | 22 ++ .../Service/WeighOrder/Dtos/WeighOrderDto.cs | 177 ++++++++++ .../WeighOrder/Service/IWeighOrderService.cs | 64 ++++ .../WeighOrder/Service/WeighOrderService.cs | 304 ++++++++++++++++++ .../Service/WeighOrder/WeighOrderServices.cs | 108 +++++++ BPA.KitChen.GroupMealOrder.Core/Class1.cs | 7 - .../{Entity/Class1.cs => Const.cs} | 6 +- .../{Common => }/CurrentUser.cs | 19 +- .../Entity/BPA_MemberInfo.cs | 8 +- .../Entity/BPA_MemberTag.cs | 2 +- .../Entity/BPA_ShopAuthorize.cs | 2 +- .../Entity/BPA_ThirdOrder.cs | 2 +- .../Entity/BPA_ThirdOrderInfo.cs | 2 +- .../Entity/BPA_WeighOrder.cs | 73 +++++ .../Entity/BPA_WeighOrderDiningPlate.cs | 48 +++ .../BPA_WeighOrderDiningPlateUnbindRecord.cs | 48 +++ .../Entity/BPA_WeighOrderGoods.cs | 68 ++++ .../Entity/BPA_WeighOrderStatesRecord.cs | 61 ++++ .../Entity/Base/IBaseGroupIdEntity.cs | 4 +- .../Entity/Base/IEntity.cs | 9 +- .../RequestAnalysis/UserAnalysis.cs | 4 +- .../SqlSugarDb.cs | 3 +- .../Handlers/RequestAuditFiltercs.cs | 141 ++++++++ BPA.KitChen.GroupMealOrder/appsettings.json | 2 + 39 files changed, 1878 insertions(+), 37 deletions(-) delete mode 100644 BPA.KitChen.GroupMealOrder.Application/Class1.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseEPDto.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseRequestDto.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/DtoValidator.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResponDataBase.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResultSAASManageDto.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Enum/ErrorCodeEnum.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/CheckServices.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/CompanyDto.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/StoreAuthorizationDto.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/DiningPlateDto.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/IWeighOrderService.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs create mode 100644 BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/WeighOrderServices.cs delete mode 100644 BPA.KitChen.GroupMealOrder.Core/Class1.cs rename BPA.KitChen.GroupMealOrder.Core/{Entity/Class1.cs => Const.cs} (50%) rename BPA.KitChen.GroupMealOrder.Core/{Common => }/CurrentUser.cs (52%) create mode 100644 BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrder.cs create mode 100644 BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs create mode 100644 BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlateUnbindRecord.cs create mode 100644 BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs create mode 100644 BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderStatesRecord.cs create mode 100644 BPA.KitChen.GroupMealOrder/Handlers/RequestAuditFiltercs.cs diff --git a/BPA.KitChen.GroupMealOrder.Application/BPA.KitChen.GroupMealOrder.Application.csproj b/BPA.KitChen.GroupMealOrder.Application/BPA.KitChen.GroupMealOrder.Application.csproj index 123e2f1..2178720 100644 --- a/BPA.KitChen.GroupMealOrder.Application/BPA.KitChen.GroupMealOrder.Application.csproj +++ b/BPA.KitChen.GroupMealOrder.Application/BPA.KitChen.GroupMealOrder.Application.csproj @@ -15,4 +15,8 @@ + + + + diff --git a/BPA.KitChen.GroupMealOrder.Application/Class1.cs b/BPA.KitChen.GroupMealOrder.Application/Class1.cs deleted file mode 100644 index 2e30ee8..0000000 --- a/BPA.KitChen.GroupMealOrder.Application/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace BPA.KitChen.GroupMealOrder.Application -{ - public class Class1 - { - - } -} \ No newline at end of file diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseEPDto.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseEPDto.cs new file mode 100644 index 0000000..9b03e1b --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseEPDto.cs @@ -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; } + + } + +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseRequestDto.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseRequestDto.cs new file mode 100644 index 0000000..f5f4038 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/BaseRequestDto.cs @@ -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 + { + /// + /// 是否下发 + /// + public bool IsPush { get; set; } + + /// + /// 回调地址 + /// + public string CallbackUrl { get; set; } + + public List StoreIdList { get; set; } + + public List DeviceIdList { get; set; } + + public List DataInfo { get; set; } + + } + +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/DtoValidator.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/DtoValidator.cs new file mode 100644 index 0000000..ad9c457 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/DtoValidator.cs @@ -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 +{ + + + + /// + /// Dto参数验证 + /// + public static class DtoValidator + { + + ///// + ///// 获取签名 + ///// + ///// + ///// + ///// 0-不排序 1-按名称ASCII排序 + ///// + //public static string GetSign(T t, int otype = 1) + //{ + // string retstr = ""; + // //定义PropertyInfo的List + // List proplist = new List(); + // //遍历泛型类的每个属性加入到List里面 + // Array.ForEach(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; + //} + + /// + /// 获取签名 + /// + /// + /// + public static string GetSign(object t) + { + string retstr = ""; + //定义PropertyInfo的List + List proplist = new List(); + //遍历泛型类的每个属性加入到List里面 + Array.ForEach(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; + } + + + /// + /// 获取属性值 + /// + /// + /// + /// + public static string GetAttributePrice(object obj,string name) + { + string retstr = ""; + //定义PropertyInfo的List + List proplist = new List(); + //遍历泛型类的每个属性加入到List里面 + Array.ForEach(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; + } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResponDataBase.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResponDataBase.cs new file mode 100644 index 0000000..58caf2d --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResponDataBase.cs @@ -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; } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResultSAASManageDto.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResultSAASManageDto.cs new file mode 100644 index 0000000..6fc2645 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/BaseDto/ResultSAASManageDto.cs @@ -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 + { + 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 + { + public List 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; } + } + +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Enum/ErrorCodeEnum.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Enum/ErrorCodeEnum.cs new file mode 100644 index 0000000..ef9c514 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Enum/ErrorCodeEnum.cs @@ -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 +{ + /// + /// 系统错误码 + /// + [ErrorCodeType] + [Description("系统错误码")] + public enum ErrorCodeEnum + { + /// + /// 用户没有注册 + /// + [ErrorCodeItemMetadata("用户没有注册")] + Code1000, + + /// + /// 操作错误 + /// + [ErrorCodeItemMetadata("操作错误")] + Code1001, + + /// + /// 重复添加 + /// + [ErrorCodeItemMetadata("重复添加")] + Code1002, + + /// + /// 操作数据不存在 + /// + [ErrorCodeItemMetadata("操作数据不存在")] + Code1003, + + /// + /// key不正确 + /// + [ErrorCodeItemMetadata("key不正确")] + Code1004, + + /// + /// 签名错误 + /// + [ErrorCodeItemMetadata("签名错误")] + Code1005, + + /// + /// 签名错误 + /// + [ErrorCodeItemMetadata("签名过期")] + Code1006, + /// + /// 系统异常 + /// + [ErrorCodeItemMetadata("系统异常")] + Code1007, + /// + /// 商品不存在 + /// + [ErrorCodeItemMetadata("商品不存在")] + Code1008, + /// + /// 场景id不能为空 + /// + [ErrorCodeItemMetadata("场景id不能为空")] + Code1009, + /// + /// 产品不存在 + /// + [ErrorCodeItemMetadata("产品不存在")] + Code10010, + /// + /// 产品版本不存在 + /// + [ErrorCodeItemMetadata("产品版本不存在")] + Code10011, + /// + /// 设备不存在 + /// + [ErrorCodeItemMetadata("设备不存在")] + Code10012, + /// + /// 产品标签不存在 + /// + [ErrorCodeItemMetadata("产品标签不存在")] + Code10013, + + + /// + /// 授权过期 + /// + [ErrorCodeItemMetadata("授权过期")] + Code10014, + /// + /// 配方不存在 + /// + [ErrorCodeItemMetadata("配方不存在")] + Code10015, + + /// + /// 下发错误 + /// + [ErrorCodeItemMetadata("操作成功,下发错误")] + Code10016, + + /// + /// 名称或编码重复 + /// + [ErrorCodeItemMetadata("名称或编码重复")] + Code10017, + /// + /// 模板名称不能重复 + /// + [ErrorCodeItemMetadata("模板名称不能重复")] + Code10018, + /// + /// 设备id不能为空 + /// + [ErrorCodeItemMetadata("设备id不能为空")] + Code10019, + /// + /// 模板名称不能为空 + /// + [ErrorCodeItemMetadata("模板名称不能为空")] + Code10020, + /// + /// 获取场景数据失败 + /// + [ErrorCodeItemMetadata("获取场景数据失败")] + Code10021, + /// + /// 场景不存在 + /// + [ErrorCodeItemMetadata("场景不存在")] + Code10022, + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/CheckServices.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/CheckServices.cs new file mode 100644 index 0000000..69492e6 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/CheckServices.cs @@ -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; + } + + /// + ///检查Sign + /// + public async Task CheckSign(string key, string signStr, string signMd5) + { + await _checkServices.CheckSign( key, signStr, signMd5); + } + + + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs new file mode 100644 index 0000000..cecacf5 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/CheckServices.cs @@ -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 + { + /// + ///检查Sign + /// + 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); + } + } + + + /// + /// 检查平key验证 + /// + /// + private async Task CheckKey(string key) + { + Dictionary dic = new Dictionary(); + var url = App.Configuration["groupmeal"] + "api/authorization/GetCompanyById"; + var jsonData = HttpHelper.HttpGet(url, key, dic, "application/json"); + var data = JsonConvert.DeserializeObject>(jsonData); + if (data.statusCode != 200) throw Oops.Oh(ErrorCodeEnum.Code10016); + if (data.data == null) throw Oops.Oh(ErrorCodeEnum.Code10016); + await CheckTenant(data.data.GroupId); + } + + /// + /// 检查租户 + /// + /// + /// + private async Task CheckTenant(string tenantId) + { + + Dictionary dic = new Dictionary(); + var url = App.Configuration["baseurl"] + "api/authorization/GetCompanyById"; + var jsonData = HttpHelper.HttpGet(url, tenantId, dic, "application/json"); + var data = JsonConvert.DeserializeObject>(jsonData); + if (data.statusCode != 200) throw Oops.Oh(ErrorCodeEnum.Code10016); + if (data.data==null) throw Oops.Oh(ErrorCodeEnum.Code10016); + CurrentUser.TenantId = tenantId; + } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/CompanyDto.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/CompanyDto.cs new file mode 100644 index 0000000..214944d --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/CompanyDto.cs @@ -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; } + + /// + /// 加盟商名称 + /// + 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; } + /// + /// logo + /// + public string Code { get; set; } + /// + /// 状态 【正常 停用】默认 正常 + /// + public CommonStatus Status { get; set; } = CommonStatus.ENABLE; + /// + /// 所属平台 0 团餐 1门店 2 后厨 3公共 + /// + public int Type { get; set; } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/StoreAuthorizationDto.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/StoreAuthorizationDto.cs new file mode 100644 index 0000000..9c7587d --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/Dtos/StoreAuthorizationDto.cs @@ -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; } + + /// + /// 有效期 长期有效为空 + /// + public DateTime? PeriodValidity { get; set; } + + public DateTime UpdateAt { get; set; } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs new file mode 100644 index 0000000..fdbf041 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/CheckService/Services/ICheckServices.cs @@ -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 + { + /// + ///检查Sign + /// + Task CheckSign(string key, string signStr, string signMd5); + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs new file mode 100644 index 0000000..388f303 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/AExternalPlatform/Service/WeighOrder/WeighOrderServices.cs @@ -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; + } + + /// + /// 创建订单 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/WeighOrder/CreateWeighOrder")] + public async Task CreateWeighOrder(WeighOrderCreteDto inputDto) + { + return await _weighOrderService.CreateWeighOrder(inputDto); + } + + /// + /// 添加订单商品 + /// + /// + /// + [HttpPost("/api/ExternalPlatform/WeighOrder/AddWeighOrderGoods")] + public async Task AddWeighOrderGoods(List inputDto) + { + return await _weighOrderService.AddWeighOrderGoods(inputDto); + } + + /// + /// 添加订单餐盘 + /// + /// + /// + [HttpPost( "/api/ExternalPlatform/WeighOrder/AddWeighOrderDiningPlate")] + public async Task AddWeighOrderDiningPlate(List inputDto) + { + return await _weighOrderService.AddWeighOrderDiningPlate(inputDto); + } + + /// + /// 查询订单商品 + /// + /// + /// + [HttpPost( "/api/ExternalPlatform/WeighOrder/GetWeighOrder")] + public async Task GetWeighOrder(GetOrderInputDto inputDto) + { + return await _weighOrderService.GetWeighOrder(inputDto); + } + + /// + /// 修改订单状态 + /// + /// + [HttpPost( "/api/ExternalPlatform/WeighOrder/UpdateWeighOrderStates")] + public async Task UpdateWeighOrderStates(WeighOrderUpdateDto inputDto) + { + + return await _weighOrderService.UpdateWeighOrderStates(inputDto); + } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/Test/TestService.cs b/BPA.KitChen.GroupMealOrder.Application/Service/Test/TestService.cs index fd28fe1..0ad8613 100644 --- a/BPA.KitChen.GroupMealOrder.Application/Service/Test/TestService.cs +++ b/BPA.KitChen.GroupMealOrder.Application/Service/Test/TestService.cs @@ -30,6 +30,7 @@ namespace BPA.KitChen.GroupMealOrder.Application.Service.TestService && x.GetCustomAttribute() != 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) diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/DiningPlateDto.cs b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/DiningPlateDto.cs new file mode 100644 index 0000000..9bbeefb --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/DiningPlateDto.cs @@ -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 + { + /// + /// 餐盘信息 + /// + public string DiningPlateId { get; set; } + + /// + /// 是否占用 + /// + public bool IsOccupy { get; set; } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs new file mode 100644 index 0000000..ecf1299 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Dtos/WeighOrderDto.cs @@ -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 +{ + + + /// + /// + /// + public class WeighOrderDto: BPA_WeighOrder + { + /// + /// 商品信息 + /// + public List GoodsInfo { get; set; } + + /// + /// 餐盘信息 + /// + public List DiningPlateInfo { get; set; } + } + + public class WeighOrderGoodsDto + { + /// + /// 主键 Guid + /// + public string Id { get; set; } = Guid.NewGuid().ToString(); + + + public string GroupId { get; set; } = App.User?.FindFirst(ClaimConst.GroupId)?.Value; + + /// + /// 订单id + /// + public string OrderId { get; set; } + + + /// + /// 商品名称 + /// + public string GoodsId { get; set; } + + + /// + /// 商品名称 + /// + public string GoodsName { get; set; } + + + /// + /// 商品商品重量 + /// + public decimal GoodsWeight { get; set; } + + /// + /// 商品属性 + /// + public List? GoodsAttribute { get; set; } + } + public class WeighOrderDiningPlateDto + { + /// + /// 订单编号 + /// + 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 + { + /// + /// 订单金额 + /// + public decimal TotalAmount { get; set; } + + /// + /// 订单标题 + /// + [SugarColumn(IsNullable = true)] + public string Subject { get; set; } + + /// + /// 场景id + /// + public string SceneId { get; set; } + + /// + /// 创建人(会员Id) + /// + public string CreateId { get; set; } + + /// + /// 商品 + /// + public List Goods { get; set; } + + /// + /// 餐盘信息 + /// + public List DiningPlateInfo { get; set; } + + } + + public class WeighOrderGoodsCreateDto + { + public string OrderId { get; set; } + + /// + /// 商品名称 + /// + public string GoodsId { get; set; } + + + /// + /// 商品名称 + /// + public string GoodsName { get; set; } + + /// + /// 商品商品重量 + /// + public decimal GoodsWeight { get; set; } + } + + public class WeighOrderDiningPlateCreateDto + { + /// + /// 订单编号 + /// + 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; } + } + + + +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/IWeighOrderService.cs b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/IWeighOrderService.cs new file mode 100644 index 0000000..101d335 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/IWeighOrderService.cs @@ -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 + { + + /// + /// 创建订单 + /// + /// + /// + Task CreateWeighOrder(WeighOrderCreteDto inputDto); + + /// + /// 添加订单商品 + /// + /// + /// + Task AddWeighOrderGoods(List inputDto); + + /// + /// 添加订单餐盘 + /// + /// + /// + Task AddWeighOrderDiningPlate(List inputDto); + + /// + /// 查询订单商品 + /// + /// + /// + Task GetWeighOrder(GetOrderInputDto inputDto); + + /// + /// 修改订单状态 + /// + /// + Task UpdateWeighOrderStates(WeighOrderUpdateDto inputDto); + + /// + /// 添加 餐盘解绑记录 + /// + /// 餐盘ID + /// + Task AddWeighOrderDiningPlateUnbindRecord(List inputDto); + + /// + /// 获取餐盘绑定信息 + /// + /// 餐盘ID + /// + Task> GetDiningPlateOccupyInfo(List inputDto); + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs new file mode 100644 index 0000000..f8cd179 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/Service/WeighOrderService.cs @@ -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; + } + + /// + /// 创建订单 + /// + /// + /// + public async Task 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(); + 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(); + 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; + } + + /// + /// 添加订单商品 + /// + /// + /// + public async Task AddWeighOrderGoods(List inputDto) + { + var orderGoods = new List(); + 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; + } + + /// + /// 添加订单餐盘 + /// + /// + /// + public async Task AddWeighOrderDiningPlate(List inputDto) + { + var diningPlate = new List(); + 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; + } + + /// + /// 查询订单商品 + /// + /// + /// + public async Task GetWeighOrder(GetOrderInputDto inputDto) + { + var result = new WeighOrderDto(); + + //查询订单 + result = await db.Queryable() + .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() + .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>(x.GoodsAttribute), + GoodsName = x.GoodsName, + GoodsWeight = x.GoodsWeight, + GroupId = x.GroupId, + Id = x.Id, + OrderId = x.OrderId, + }).ToList(); + + + //查询订单餐盘 + var diningPlate = await db.Queryable() + .Where(x => x.WeighOrderId == inputDto.OrderId) + .Select(x => new WeighOrderDiningPlateDto() + { + DiningPlateId = x.DiningPlateId, + OrderId = inputDto.OrderId, + }).ToListAsync(); + result.DiningPlateInfo = diningPlate; + + return result; + } + + /// + /// 修改订单状态 + /// + /// + public async Task UpdateWeighOrderStates(WeighOrderUpdateDto inputDto) + { + //查询订单 + var result = await db.Queryable() + .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; + } + + /// + /// 添加 餐盘解绑记录 + /// + /// 餐盘ID + /// + public async Task AddWeighOrderDiningPlateUnbindRecord(List inputDto) + { + var list=new List(); + + 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; + } + + /// + /// 获取餐盘绑定信息 + /// + /// 餐盘ID + /// + public async Task> GetDiningPlateOccupyInfo(List inputDto) + { + var data = await db.Queryable + ((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; + + } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/WeighOrderServices.cs b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/WeighOrderServices.cs new file mode 100644 index 0000000..606b7fa --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Application/Service/WeighOrder/WeighOrderServices.cs @@ -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; + } + + + /// + /// 创建订单 + /// + /// + /// + [HttpPost("/api/WeighOrder/CreateWeighOrder")] + public async Task CreateWeighOrder(WeighOrderCreteDto inputDto) + { + return await _weighOrderService.CreateWeighOrder(inputDto); + } + + /// + /// 添加订单商品 + /// + /// + /// + [HttpPost("/api/WeighOrder/AddWeighOrderGoods")] + public async Task AddWeighOrderGoods(List inputDto) + { + return await _weighOrderService.AddWeighOrderGoods(inputDto); + } + + /// + /// 添加订单餐盘 + /// + /// + /// + [HttpPost("/api/WeighOrder/AddWeighOrderDiningPlate")] + public async Task AddWeighOrderDiningPlate(List inputDto) + { + return await _weighOrderService.AddWeighOrderDiningPlate(inputDto); + } + + /// + /// 查询订单商品 + /// + /// + /// + [HttpPost("/api/WeighOrder/GetWeighOrder")] + public async Task GetWeighOrder(GetOrderInputDto inputDto) + { + return await _weighOrderService.GetWeighOrder(inputDto); + } + + /// + /// 修改订单状态 + /// + /// + [HttpPost("/api/WeighOrder/UpdateWeighOrderStates")] + public async Task UpdateWeighOrderStates(WeighOrderUpdateDto inputDto) + { + return await _weighOrderService.UpdateWeighOrderStates(inputDto); + } + + + /// + /// 添加 餐盘解绑记录 + /// + /// 餐盘ID + /// + [HttpPost("/api/WeighOrder/AddWeighOrderDiningPlateUnbindRecord"), AllowAnonymous] + public async Task AddWeighOrderDiningPlateUnbindRecord(List inputDto) + { + return await _weighOrderService.AddWeighOrderDiningPlateUnbindRecord(inputDto); + } + + /// + /// 获取餐盘绑定信息 + /// + /// 餐盘ID + /// + [HttpPost("/api/WeighOrder/GetDiningPlateOccupyInfo"), AllowAnonymous] + public async Task> GetDiningPlateOccupyInfo(List inputDto) + { + return await _weighOrderService.GetDiningPlateOccupyInfo(inputDto); + } + + } +} diff --git a/BPA.KitChen.GroupMealOrder.Core/Class1.cs b/BPA.KitChen.GroupMealOrder.Core/Class1.cs deleted file mode 100644 index 1344f7f..0000000 --- a/BPA.KitChen.GroupMealOrder.Core/Class1.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace BPA.KitChen.GroupMealOrder.Core -{ - public class Class1 - { - - } -} \ No newline at end of file diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/Class1.cs b/BPA.KitChen.GroupMealOrder.Core/Const.cs similarity index 50% rename from BPA.KitChen.GroupMealOrder.Core/Entity/Class1.cs rename to BPA.KitChen.GroupMealOrder.Core/Const.cs index db5bb53..caa6fff 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/Class1.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Const.cs @@ -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"; } } diff --git a/BPA.KitChen.GroupMealOrder.Core/Common/CurrentUser.cs b/BPA.KitChen.GroupMealOrder.Core/CurrentUser.cs similarity index 52% rename from BPA.KitChen.GroupMealOrder.Core/Common/CurrentUser.cs rename to BPA.KitChen.GroupMealOrder.Core/CurrentUser.cs index a5fb22d..a03fb80 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Common/CurrentUser.cs +++ b/BPA.KitChen.GroupMealOrder.Core/CurrentUser.cs @@ -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 { - /// - /// 当前用户 - /// - 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; } } } diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberInfo.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberInfo.cs index 0fe97c6..bca9ae2 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberInfo.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberInfo.cs @@ -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 /// 会员 /// [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; /// /// diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberTag.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberTag.cs index 684ab70..e727f37 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberTag.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_MemberTag.cs @@ -7,7 +7,7 @@ namespace BPA.KitChen.GroupMealOrder.Core.Entity /// 会员标签 /// [SugarTable("BPA_MemberTag")] - public class BPA_MemberTag : IBaseGroupIdEntity + public class BPA_MemberTag : IEntity { /// /// 会员标签名称 diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ShopAuthorize.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ShopAuthorize.cs index a3cfb7e..ffa630b 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ShopAuthorize.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ShopAuthorize.cs @@ -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; } diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrder.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrder.cs index 07b82c1..d71a9e4 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrder.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrder.cs @@ -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; } diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrderInfo.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrderInfo.cs index 9efe205..d2f90ff 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrderInfo.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_ThirdOrderInfo.cs @@ -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; } diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrder.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrder.cs new file mode 100644 index 0000000..db88453 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrder.cs @@ -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 +{ + /// + /// 称重订单 + /// + [SugarTable("bpa_weighorder")] + public class BPA_WeighOrder : IBaseGroupIdEntity + { + /// + /// 主键 Guid + /// + [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 OrderNumber { get; set; } + + /// + /// 订单金额 + /// + public decimal TotalAmount { get; set; } + + + /// + /// 订单标题 + /// + [SugarColumn(IsNullable = true)] + public string Subject { get; set; } + + /// + /// 场景id + /// + public string SceneId { get; set; } + + /// + /// 0.选菜中 1.订单完成 + /// + public int States { get; set; } + + /// + /// 0.待支付 1.已支付 2.支付失败 + /// + public int PayStates { get; set; } + + + /// + /// 创建时间 + /// + public DateTime CreateAt { get; set; } = DateTime.Now; + + + /// + /// 创建人 + /// + public string CreateId { get; set; } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs new file mode 100644 index 0000000..1e919b5 --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlate.cs @@ -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 +{ + /// + /// 称重餐盘订单 + /// + [SugarTable("bpa_weighorderdiningplate")] + public class BPA_WeighOrderDiningPlate : IBaseGroupIdEntity + { + /// + /// 主键 Guid + /// + [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; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)] + public DateTime CreateAt { get; set; } = DateTime.Now; + + /// + /// 创建人 + /// + [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = false)] + public string CreateBy { get; set; } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlateUnbindRecord.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlateUnbindRecord.cs new file mode 100644 index 0000000..e9eff9a --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderDiningPlateUnbindRecord.cs @@ -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 +{ + /// + /// 产盘解绑记录 + /// + [SugarTable("bpa_weighorderdiningplateunbindrecord")] + public class BPA_WeighOrderDiningPlateUnbindRecord : IBaseGroupIdEntity + { + /// + /// 主键 Guid + /// + [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; } + + + /// + /// 创建时间 + /// + [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)] + public DateTime CreateAt { get; set; } = DateTime.Now; + /// + /// 创建人 + /// + [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)] + public string CreateBy { get; set; } + + } +} diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs new file mode 100644 index 0000000..8bafabc --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderGoods.cs @@ -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 +{ + /// + /// 称重订单商品 + /// + [SugarTable("bpa_weighordergoods")] + public class BPA_WeighOrderGoods : IBaseGroupIdEntity + { + /// + /// 主键 Guid + /// + [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; + + /// + /// 订单id + /// + public string OrderId { get; set; } + + + /// + /// 商品名称 + /// + public string GoodsId { get; set; } + + + /// + /// 商品名称 + /// + public string GoodsName { get; set; } + + + /// + /// 商品商品重量 + /// + public decimal GoodsWeight { get; set; } + + /// + /// 商品属性 + /// + public string GoodsAttribute { get; set; } + + /// + /// 创建时间 + /// + [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)] + public DateTime CreateAt { get; set; } = DateTime.Now; + /// + /// 创建人 + /// + [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)] + public string CreateBy { get; set; } + } +} diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderStatesRecord.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderStatesRecord.cs new file mode 100644 index 0000000..9ea40fa --- /dev/null +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/BPA_WeighOrderStatesRecord.cs @@ -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 +{ + /// + /// 称重订单状态变更记录 + /// + [SugarTable("bpa_weighorderstatesrecord")] + public class BPA_WeighOrderStatesRecord : IBaseGroupIdEntity + { + /// + /// 主键 Guid + /// + [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 OrderId { get; set; } + + /// + /// 变更前 + /// + public int BeforeTheChange { get; set; } + + /// + /// 变更后 + /// + public int AfterTheChange { get; set; } + + + /// + /// 创建时间 + /// + [SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "创建时间", IsNullable = true)] + public DateTime CreateAt { get; set; } = DateTime.Now; + /// + /// 创建人 + /// + [SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "创建人", IsNullable = true)] + public string CreateBy { get; set; } + + + + + } +} diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IBaseGroupIdEntity.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IBaseGroupIdEntity.cs index 4178970..4dc9f0e 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IBaseGroupIdEntity.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IBaseGroupIdEntity.cs @@ -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; } } } diff --git a/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IEntity.cs b/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IEntity.cs index 1e1fc28..1338000 100644 --- a/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IEntity.cs +++ b/BPA.KitChen.GroupMealOrder.Core/Entity/Base/IEntity.cs @@ -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 /// /// 自定义实体基类 /// - public abstract class IEntity: IBaseOPEntity + public abstract class IEntity: IBaseOPEntity, IBaseGroupIdEntity { /// /// 状态 /// [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; } } diff --git a/BPA.KitChen.GroupMealOrder.Core/RequestAnalysis/UserAnalysis.cs b/BPA.KitChen.GroupMealOrder.Core/RequestAnalysis/UserAnalysis.cs index ece24b5..7962746 100644 --- a/BPA.KitChen.GroupMealOrder.Core/RequestAnalysis/UserAnalysis.cs +++ b/BPA.KitChen.GroupMealOrder.Core/RequestAnalysis/UserAnalysis.cs @@ -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"]; } } diff --git a/BPA.KitChen.GroupMealOrder.SqlSugar/SqlSugarDb.cs b/BPA.KitChen.GroupMealOrder.SqlSugar/SqlSugarDb.cs index c0286f3..e184398 100644 --- a/BPA.KitChen.GroupMealOrder.SqlSugar/SqlSugarDb.cs +++ b/BPA.KitChen.GroupMealOrder.SqlSugar/SqlSugarDb.cs @@ -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; diff --git a/BPA.KitChen.GroupMealOrder/Handlers/RequestAuditFiltercs.cs b/BPA.KitChen.GroupMealOrder/Handlers/RequestAuditFiltercs.cs new file mode 100644 index 0000000..693e6eb --- /dev/null +++ b/BPA.KitChen.GroupMealOrder/Handlers/RequestAuditFiltercs.cs @@ -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 proplist = new List(); + // 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(); + // if (!string.IsNullOrEmpty(deviceIdList)) + // { + // list = JsonConvert.DeserializeObject>(deviceIdList); + // } + // if ( !string.IsNullOrEmpty(storeIdList)) + // { + // list = await _thirdpartyPushService.GetDeviceByStoreId(JsonConvert.DeserializeObject>(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) + { + } + } + + } + } +} diff --git a/BPA.KitChen.GroupMealOrder/appsettings.json b/BPA.KitChen.GroupMealOrder/appsettings.json index 924a060..8b77fca 100644 --- a/BPA.KitChen.GroupMealOrder/appsettings.json +++ b/BPA.KitChen.GroupMealOrder/appsettings.json @@ -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": "*" }