@@ -0,0 +1,63 @@ | |||
############################################################################### | |||
# Set default behavior to automatically normalize line endings. | |||
############################################################################### | |||
* text=auto | |||
############################################################################### | |||
# Set default behavior for command prompt diff. | |||
# | |||
# This is need for earlier builds of msysgit that does not have it on by | |||
# default for csharp files. | |||
# Note: This is only used by command line | |||
############################################################################### | |||
#*.cs diff=csharp | |||
############################################################################### | |||
# Set the merge driver for project and solution files | |||
# | |||
# Merging from the command prompt will add diff markers to the files if there | |||
# are conflicts (Merging from VS is not affected by the settings below, in VS | |||
# the diff markers are never inserted). Diff markers may cause the following | |||
# file extensions to fail to load in VS. An alternative would be to treat | |||
# these files as binary and thus will always conflict and require user | |||
# intervention with every merge. To do so, just uncomment the entries below | |||
############################################################################### | |||
#*.sln merge=binary | |||
#*.csproj merge=binary | |||
#*.vbproj merge=binary | |||
#*.vcxproj merge=binary | |||
#*.vcproj merge=binary | |||
#*.dbproj merge=binary | |||
#*.fsproj merge=binary | |||
#*.lsproj merge=binary | |||
#*.wixproj merge=binary | |||
#*.modelproj merge=binary | |||
#*.sqlproj merge=binary | |||
#*.wwaproj merge=binary | |||
############################################################################### | |||
# behavior for image files | |||
# | |||
# image files are treated as binary by default. | |||
############################################################################### | |||
#*.jpg binary | |||
#*.png binary | |||
#*.gif binary | |||
############################################################################### | |||
# diff behavior for common document formats | |||
# | |||
# Convert binary document formats to text before diffing them. This feature | |||
# is only available from the command line. Turn it on by uncommenting the | |||
# entries below. | |||
############################################################################### | |||
#*.doc diff=astextplain | |||
#*.DOC diff=astextplain | |||
#*.docx diff=astextplain | |||
#*.DOCX diff=astextplain | |||
#*.dot diff=astextplain | |||
#*.DOT diff=astextplain | |||
#*.pdf diff=astextplain | |||
#*.PDF diff=astextplain | |||
#*.rtf diff=astextplain | |||
#*.RTF diff=astextplain |
@@ -0,0 +1,363 @@ | |||
## Ignore Visual Studio temporary files, build results, and | |||
## files generated by popular Visual Studio add-ons. | |||
## | |||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore | |||
# User-specific files | |||
*.rsuser | |||
*.suo | |||
*.user | |||
*.userosscache | |||
*.sln.docstates | |||
# User-specific files (MonoDevelop/Xamarin Studio) | |||
*.userprefs | |||
# Mono auto generated files | |||
mono_crash.* | |||
# Build results | |||
[Dd]ebug/ | |||
[Dd]ebugPublic/ | |||
[Rr]elease/ | |||
[Rr]eleases/ | |||
x64/ | |||
x86/ | |||
[Ww][Ii][Nn]32/ | |||
[Aa][Rr][Mm]/ | |||
[Aa][Rr][Mm]64/ | |||
bld/ | |||
[Bb]in/ | |||
[Oo]bj/ | |||
[Oo]ut/ | |||
[Ll]og/ | |||
[Ll]ogs/ | |||
# Visual Studio 2015/2017 cache/options directory | |||
.vs/ | |||
# Uncomment if you have tasks that create the project's static files in wwwroot | |||
#wwwroot/ | |||
# Visual Studio 2017 auto generated files | |||
Generated\ Files/ | |||
# MSTest test Results | |||
[Tt]est[Rr]esult*/ | |||
[Bb]uild[Ll]og.* | |||
# NUnit | |||
*.VisualState.xml | |||
TestResult.xml | |||
nunit-*.xml | |||
# Build Results of an ATL Project | |||
[Dd]ebugPS/ | |||
[Rr]eleasePS/ | |||
dlldata.c | |||
# Benchmark Results | |||
BenchmarkDotNet.Artifacts/ | |||
# .NET Core | |||
project.lock.json | |||
project.fragment.lock.json | |||
artifacts/ | |||
# ASP.NET Scaffolding | |||
ScaffoldingReadMe.txt | |||
# StyleCop | |||
StyleCopReport.xml | |||
# Files built by Visual Studio | |||
*_i.c | |||
*_p.c | |||
*_h.h | |||
*.ilk | |||
*.meta | |||
*.obj | |||
*.iobj | |||
*.pch | |||
*.pdb | |||
*.ipdb | |||
*.pgc | |||
*.pgd | |||
*.rsp | |||
*.sbr | |||
*.tlb | |||
*.tli | |||
*.tlh | |||
*.tmp | |||
*.tmp_proj | |||
*_wpftmp.csproj | |||
*.log | |||
*.vspscc | |||
*.vssscc | |||
.builds | |||
*.pidb | |||
*.svclog | |||
*.scc | |||
# Chutzpah Test files | |||
_Chutzpah* | |||
# Visual C++ cache files | |||
ipch/ | |||
*.aps | |||
*.ncb | |||
*.opendb | |||
*.opensdf | |||
*.sdf | |||
*.cachefile | |||
*.VC.db | |||
*.VC.VC.opendb | |||
# Visual Studio profiler | |||
*.psess | |||
*.vsp | |||
*.vspx | |||
*.sap | |||
# Visual Studio Trace Files | |||
*.e2e | |||
# TFS 2012 Local Workspace | |||
$tf/ | |||
# Guidance Automation Toolkit | |||
*.gpState | |||
# ReSharper is a .NET coding add-in | |||
_ReSharper*/ | |||
*.[Rr]e[Ss]harper | |||
*.DotSettings.user | |||
# TeamCity is a build add-in | |||
_TeamCity* | |||
# DotCover is a Code Coverage Tool | |||
*.dotCover | |||
# AxoCover is a Code Coverage Tool | |||
.axoCover/* | |||
!.axoCover/settings.json | |||
# Coverlet is a free, cross platform Code Coverage Tool | |||
coverage*.json | |||
coverage*.xml | |||
coverage*.info | |||
# Visual Studio code coverage results | |||
*.coverage | |||
*.coveragexml | |||
# NCrunch | |||
_NCrunch_* | |||
.*crunch*.local.xml | |||
nCrunchTemp_* | |||
# MightyMoose | |||
*.mm.* | |||
AutoTest.Net/ | |||
# Web workbench (sass) | |||
.sass-cache/ | |||
# Installshield output folder | |||
[Ee]xpress/ | |||
# DocProject is a documentation generator add-in | |||
DocProject/buildhelp/ | |||
DocProject/Help/*.HxT | |||
DocProject/Help/*.HxC | |||
DocProject/Help/*.hhc | |||
DocProject/Help/*.hhk | |||
DocProject/Help/*.hhp | |||
DocProject/Help/Html2 | |||
DocProject/Help/html | |||
# Click-Once directory | |||
publish/ | |||
# Publish Web Output | |||
*.[Pp]ublish.xml | |||
*.azurePubxml | |||
# Note: Comment the next line if you want to checkin your web deploy settings, | |||
# but database connection strings (with potential passwords) will be unencrypted | |||
*.pubxml | |||
*.publishproj | |||
# Microsoft Azure Web App publish settings. Comment the next line if you want to | |||
# checkin your Azure Web App publish settings, but sensitive information contained | |||
# in these scripts will be unencrypted | |||
PublishScripts/ | |||
# NuGet Packages | |||
*.nupkg | |||
# NuGet Symbol Packages | |||
*.snupkg | |||
# The packages folder can be ignored because of Package Restore | |||
**/[Pp]ackages/* | |||
# except build/, which is used as an MSBuild target. | |||
!**/[Pp]ackages/build/ | |||
# Uncomment if necessary however generally it will be regenerated when needed | |||
#!**/[Pp]ackages/repositories.config | |||
# NuGet v3's project.json files produces more ignorable files | |||
*.nuget.props | |||
*.nuget.targets | |||
# Microsoft Azure Build Output | |||
csx/ | |||
*.build.csdef | |||
# Microsoft Azure Emulator | |||
ecf/ | |||
rcf/ | |||
# Windows Store app package directories and files | |||
AppPackages/ | |||
BundleArtifacts/ | |||
Package.StoreAssociation.xml | |||
_pkginfo.txt | |||
*.appx | |||
*.appxbundle | |||
*.appxupload | |||
# Visual Studio cache files | |||
# files ending in .cache can be ignored | |||
*.[Cc]ache | |||
# but keep track of directories ending in .cache | |||
!?*.[Cc]ache/ | |||
# Others | |||
ClientBin/ | |||
~$* | |||
*~ | |||
*.dbmdl | |||
*.dbproj.schemaview | |||
*.jfm | |||
*.pfx | |||
*.publishsettings | |||
orleans.codegen.cs | |||
# Including strong name files can present a security risk | |||
# (https://github.com/github/gitignore/pull/2483#issue-259490424) | |||
#*.snk | |||
# Since there are multiple workflows, uncomment next line to ignore bower_components | |||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) | |||
#bower_components/ | |||
# RIA/Silverlight projects | |||
Generated_Code/ | |||
# Backup & report files from converting an old project file | |||
# to a newer Visual Studio version. Backup files are not needed, | |||
# because we have git ;-) | |||
_UpgradeReport_Files/ | |||
Backup*/ | |||
UpgradeLog*.XML | |||
UpgradeLog*.htm | |||
ServiceFabricBackup/ | |||
*.rptproj.bak | |||
# SQL Server files | |||
*.mdf | |||
*.ldf | |||
*.ndf | |||
# Business Intelligence projects | |||
*.rdl.data | |||
*.bim.layout | |||
*.bim_*.settings | |||
*.rptproj.rsuser | |||
*- [Bb]ackup.rdl | |||
*- [Bb]ackup ([0-9]).rdl | |||
*- [Bb]ackup ([0-9][0-9]).rdl | |||
# Microsoft Fakes | |||
FakesAssemblies/ | |||
# GhostDoc plugin setting file | |||
*.GhostDoc.xml | |||
# Node.js Tools for Visual Studio | |||
.ntvs_analysis.dat | |||
node_modules/ | |||
# Visual Studio 6 build log | |||
*.plg | |||
# Visual Studio 6 workspace options file | |||
*.opt | |||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) | |||
*.vbw | |||
# Visual Studio LightSwitch build output | |||
**/*.HTMLClient/GeneratedArtifacts | |||
**/*.DesktopClient/GeneratedArtifacts | |||
**/*.DesktopClient/ModelManifest.xml | |||
**/*.Server/GeneratedArtifacts | |||
**/*.Server/ModelManifest.xml | |||
_Pvt_Extensions | |||
# Paket dependency manager | |||
.paket/paket.exe | |||
paket-files/ | |||
# FAKE - F# Make | |||
.fake/ | |||
# CodeRush personal settings | |||
.cr/personal | |||
# Python Tools for Visual Studio (PTVS) | |||
__pycache__/ | |||
*.pyc | |||
# Cake - Uncomment if you are using it | |||
# tools/** | |||
# !tools/packages.config | |||
# Tabs Studio | |||
*.tss | |||
# Telerik's JustMock configuration file | |||
*.jmconfig | |||
# BizTalk build output | |||
*.btp.cs | |||
*.btm.cs | |||
*.odx.cs | |||
*.xsd.cs | |||
# OpenCover UI analysis results | |||
OpenCover/ | |||
# Azure Stream Analytics local run output | |||
ASALocalRun/ | |||
# MSBuild Binary and Structured Log | |||
*.binlog | |||
# NVidia Nsight GPU debugger configuration file | |||
*.nvuser | |||
# MFractors (Xamarin productivity tool) working folder | |||
.mfractor/ | |||
# Local History for Visual Studio | |||
.localhistory/ | |||
# BeatPulse healthcheck temp database | |||
healthchecksdb | |||
# Backup folder for Package Reference Convert tool in Visual Studio 2017 | |||
MigrationBackup/ | |||
# Ionide (cross platform F# VS Code tools) working folder | |||
.ionide/ | |||
# Fody - auto-generated XML schema | |||
FodyWeavers.xsd |
@@ -0,0 +1,18 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="NPOI" Version="2.6.2" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.KitChen.GroupMealOrder.Core\BPA.KitChen.StoreManagementOrder.Core.csproj" /> | |||
<ProjectReference Include="..\BPA.KitChen.GroupMealOrder.SqlSugar\BPA.KitChen.StoreManagementOrder.SqlSugar.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,82 @@ | |||
| |||
using BPA.KitChen.StoreManagementOrder.Core.Entity; | |||
using BPA.KitChen.StoreManagementOrder.Core.Enum; | |||
using BPA.KitChen.StoreManagementOrder.SqlSugar; | |||
using MySqlConnector; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.BaseDto | |||
{ | |||
/// <summary> | |||
/// Dto参数验证 | |||
/// </summary> | |||
public class DtoValidator | |||
{ | |||
/// <summary> | |||
/// 验证会员 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public static ValidationResult Member(string id) | |||
{ | |||
var data = SqlSugarDb.Db.Queryable<BPA_MemberInfo>().First(x => x.Id == id&&x.IsDeleted==0); | |||
return data == null ? new ValidationResult("会员不存在") : ValidationResult.Success; | |||
} | |||
/// <summary> | |||
/// 验证会员标签的合法性 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public static ValidationResult MemberTag(string id) | |||
{ | |||
var data = SqlSugarDb.Db.Queryable<BPA_MemberTag>().First(x=>x.Id==id); | |||
return data == null ? new ValidationResult("会员标签不存在") : ValidationResult.Success; | |||
} | |||
/// <summary> | |||
/// 验证会员标签的合法性 | |||
/// </summary> | |||
/// <param name="id"></param> | |||
/// <returns></returns> | |||
public static ValidationResult MemberTagList(List<string> ids) | |||
{ | |||
var data = SqlSugarDb.Db.Queryable<BPA_MemberTag>().Where(x => ids.Contains(x.Id) && x.IsDeleted == 0&&x.Status== CommonStatus.ENABLE).ToList(); | |||
return data.Count<=0 ? new ValidationResult("会员标签不存在") : ValidationResult.Success; | |||
} | |||
/// <summary> | |||
/// 会员平台 | |||
/// </summary> | |||
/// <param name="type"></param> | |||
/// <returns></returns> | |||
public static ValidationResult MemberPlatformType(int type) | |||
{ | |||
return !System.Enum.IsDefined(typeof(PlatformType), type) ? new ValidationResult("平台类型不存在") : ValidationResult.Success; | |||
} | |||
/// <summary> | |||
/// 会员平台 | |||
/// </summary> | |||
/// <param name="type"></param> | |||
/// <returns></returns> | |||
public static ValidationResult Status(int type) | |||
{ | |||
return !System.Enum.IsDefined(typeof(CommonStatus), type) ? new ValidationResult("状态错误") : ValidationResult.Success; | |||
} | |||
/// <summary> | |||
/// 优惠券使用 | |||
/// </summary> | |||
/// <param name="type"></param> | |||
/// <returns></returns> | |||
public static ValidationResult CouponUseType(int type) | |||
{ | |||
return !System.Enum.IsDefined(typeof(CouponUseType), type) ? new ValidationResult("状态错误") : ValidationResult.Success; | |||
} | |||
} | |||
} |
@@ -0,0 +1,116 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.BaseDto | |||
{ | |||
/// <summary> | |||
/// 通用输入扩展参数(带权限) | |||
/// </summary> | |||
public class XnInputBase : PageInputBase | |||
{ | |||
/// <summary> | |||
/// 授权菜单 | |||
/// </summary> | |||
public List<string> GrantMenuIdList { get; set; } = new List<string>(); | |||
/// <summary> | |||
/// 授权角色 | |||
/// </summary> | |||
public List<string> GrantRoleIdList { get; set; } = new List<string>(); | |||
/// <summary> | |||
/// 授权数据 | |||
/// </summary> | |||
public List<string> GrantOrgIdList { get; set; } = new List<string>(); | |||
/// <summary> | |||
/// 搜索值 | |||
/// </summary> | |||
public virtual string SearchValue { get; set; } | |||
/// <summary> | |||
/// 搜索开始时间 | |||
/// </summary> | |||
public virtual string SearchBeginTime { get; set; } | |||
/// <summary> | |||
/// 搜索结束时间 | |||
/// </summary> | |||
public virtual string SearchEndTime { get; set; } | |||
/// <summary> | |||
/// 排序字段 | |||
/// </summary> | |||
public virtual string SortField { get; set; } | |||
/// <summary> | |||
/// 排序方法,默认升序,否则降序(配合antd前端,约定参数为 Ascend,Dscend) | |||
/// </summary> | |||
public virtual string SortOrder { get; set; } | |||
/// <summary> | |||
/// 降序排序(不要问我为什么是descend不是desc,前端约定参数就是这样) | |||
/// </summary> | |||
public virtual string DescStr { get; set; } = "descend"; | |||
/// <summary> | |||
/// 复杂查询条件 | |||
/// </summary> | |||
// public virtual List<Condition> SearchParameters { get; set; } = new(); | |||
} | |||
/// <summary> | |||
/// 通用分页输入参数 | |||
/// </summary> | |||
public class PageInputBase | |||
{ | |||
public string bomId { get; set; } | |||
public string chnologyId { get; set; } | |||
/// <summary> | |||
/// 当前页码 | |||
/// </summary> | |||
private int current; | |||
public virtual int Current | |||
{ | |||
get | |||
{ | |||
return current; | |||
} | |||
set | |||
{ | |||
current = value; | |||
if (current <= 0) | |||
{ | |||
current = 1; | |||
} | |||
} | |||
} | |||
//public int? Status { get; set; } | |||
/// <summary> | |||
/// 页码容量 | |||
/// </summary> | |||
private int pagesize; | |||
public virtual int PageSize | |||
{ | |||
get | |||
{ | |||
return pagesize; | |||
} | |||
set | |||
{ | |||
pagesize = value; | |||
if (pagesize <= 0) | |||
{ | |||
pagesize = 20; | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.BaseDto | |||
{ | |||
public class PageUtil | |||
{ | |||
/// <summary> | |||
/// Data | |||
/// </summary> | |||
public object Data { get; set; } | |||
/// <summary> | |||
/// Total | |||
/// </summary> | |||
public int Total { get; set; } | |||
} | |||
} |
@@ -0,0 +1,46 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.BaseDto | |||
{ | |||
public class ResultEntity | |||
{ | |||
public bool IsSuccess { get; set; } | |||
public string Msg { get; set; } | |||
public Object Data { get; set; } | |||
} | |||
public class ResultEntity<T> | |||
{ | |||
public bool IsSuccess { get; set; } | |||
public string Msg { get; set; } | |||
public T Data { get; set; } | |||
} | |||
public class Result<T> | |||
{ | |||
public int StatusCode { get; set; } | |||
public ResultEntity<T> Data { get; set; } | |||
public string Succeeded { get; set; } | |||
public object Errors { get; set; } | |||
public object Extras { get; set; } | |||
public string Timestamp { get; set; } | |||
} | |||
} |
@@ -0,0 +1,7 @@ | |||
namespace BPA.KitChen.StoreManagementOrder.Application | |||
{ | |||
public class Class1 | |||
{ | |||
} | |||
} |
@@ -0,0 +1,68 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service | |||
{ | |||
public class PageInputDto | |||
{ | |||
/// <summary> | |||
/// 当前页码 | |||
/// </summary> | |||
private int current; | |||
public virtual int Current | |||
{ | |||
get | |||
{ | |||
return current; | |||
} | |||
set | |||
{ | |||
current = value; | |||
if (current <= 0) | |||
{ | |||
current = 1; | |||
} | |||
} | |||
} | |||
//public int? Status { get; set; } | |||
/// <summary> | |||
/// 页码容量 | |||
/// </summary> | |||
private int pagesize; | |||
public virtual int PageSize | |||
{ | |||
get | |||
{ | |||
return pagesize; | |||
} | |||
set | |||
{ | |||
pagesize = value; | |||
if (pagesize <= 0) | |||
{ | |||
pagesize = 20; | |||
} | |||
} | |||
} | |||
} | |||
public class PageOutDto | |||
{ | |||
/// <summary> | |||
/// Data | |||
/// </summary> | |||
public object Data { get; set; } | |||
/// <summary> | |||
/// Total | |||
/// </summary> | |||
public int Total { get; set; } | |||
} | |||
} |
@@ -0,0 +1,200 @@ | |||
using BPA.KitChen.StoreManagementOrder.Application.BaseDto; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagement.Application.Service.OrderManage.Dtos | |||
{ | |||
/// <summary> | |||
/// 订单流水查询 | |||
/// </summary> | |||
public class OrderFlowQuery : PageInputBase | |||
{ | |||
/// <summary> | |||
/// 订单Id | |||
/// </summary> | |||
public string Id { get; set; } | |||
public string orderFlowId { get; set; } | |||
/// <summary> | |||
/// 加盟商编号 | |||
/// </summary> | |||
public string FranchiseeId { get; set; } | |||
/// <summary> | |||
/// 加盟商名称 | |||
/// </summary> | |||
public string FranchiseeName { get; set; } | |||
/// <summary> | |||
/// 店铺名称编号(设备名称编号) | |||
/// </summary> | |||
public string StoreId { get; set; } | |||
/// <summary> | |||
/// 店铺名称 | |||
/// </summary> | |||
public string StoreName { get; set; } | |||
/// <summary> | |||
/// 商品key | |||
/// </summary> | |||
public string GoodsId { get; set; } | |||
/// <summary> | |||
/// 商品名称 | |||
/// </summary> | |||
public string GoodsName { get; set; } | |||
/// <summary> | |||
/// 商品类型编号 | |||
/// </summary> | |||
public string GoodsTypeId { get; set; } | |||
/// <summary> | |||
/// 商品类型名称 | |||
/// </summary> | |||
public string GoodsTypeName { get; set; } | |||
/// <summary> | |||
/// 店铺分类编号(设备类型关联值) | |||
/// </summary> | |||
public string StoreTypeId { get; set; } | |||
/// <summary> | |||
/// 店铺分类名称(设备类型名称) | |||
/// </summary> | |||
public string StoreTypeName { get; set; } | |||
/// <summary> | |||
/// 订单编号 | |||
/// </summary> | |||
public string Order_Number { get; set; } | |||
/// <summary> | |||
/// 应付金额 | |||
/// </summary> | |||
public decimal? Order_OriginalMoney { get; set; } | |||
/// <summary> | |||
/// 实付金额 | |||
/// </summary> | |||
public decimal? Order_RealMoney { get; set; } | |||
public decimal? RefundOriginalMoney { get; set; } | |||
public decimal? RefundRealMoney { get; set; } | |||
/// <summary> | |||
/// 支付方式(微信支付) | |||
/// </summary> | |||
public int PayMode { get; set; } | |||
public int Order_Status { get; set; } | |||
/// <summary> | |||
/// 订单汇总数量 | |||
/// </summary> | |||
public int Order_Count { get; set; } | |||
/// <summary> | |||
/// 订单开始时间 | |||
/// </summary> | |||
public DateTime Order_CreateTime { get; set; } | |||
/// <summary> | |||
/// 订单结束时间 | |||
/// </summary> | |||
public DateTime? Order_EndTime { get; set; } | |||
/// <summary> | |||
/// 订单类型 | |||
/// 0-->正常 | |||
/// 1--立即吃面 | |||
/// 2-->其他 | |||
/// </summary> | |||
public int PlaceMode { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public string Customer_Name { get; set; } | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public string Customer_Tel { get; set; } | |||
public int CountNumber { get; set; } | |||
public int WechatIsCheck { get; set; } | |||
} | |||
public class OrderSumQuery : PageInputBase | |||
{ | |||
/// <summary> | |||
/// 订单Id | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 加盟商编号 | |||
/// </summary> | |||
public string FranchiseeId { get; set; } | |||
/// <summary> | |||
/// 加盟商名称 | |||
/// </summary> | |||
public string FranchiseeName { get; set; } | |||
/// <summary> | |||
/// 店铺名称编号(设备名称编号) | |||
/// </summary> | |||
public string StoreId { get; set; } | |||
/// <summary> | |||
/// 店铺名称 | |||
/// </summary> | |||
public string StoreName { get; set; } | |||
/// <summary> | |||
/// 商品key | |||
/// </summary> | |||
public string GoodsId { get; set; } | |||
/// <summary> | |||
/// 商品名称 | |||
/// </summary> | |||
public string GoodsName { get; set; } | |||
/// <summary> | |||
/// 商品类型编号 | |||
/// </summary> | |||
public string GoodsTypeId { get; set; } | |||
/// <summary> | |||
/// 商品类型名称 | |||
/// </summary> | |||
public string GoodsTypeName { get; set; } | |||
/// <summary> | |||
/// 店铺分类编号(设备类型关联值) | |||
/// </summary> | |||
public string StoreTypeId { get; set; } | |||
/// <summary> | |||
/// 店铺分类名称(设备类型名称) | |||
/// </summary> | |||
public string StoreTypeName { get; set; } | |||
/// <summary> | |||
/// 订单编号 | |||
/// </summary> | |||
public string Order_Number { get; set; } | |||
/// <summary> | |||
/// 应付金额 | |||
/// </summary> | |||
public decimal? Order_OriginalMoney { get; set; } | |||
/// <summary> | |||
/// 实付金额 | |||
/// </summary> | |||
public decimal? Order_RealMoney { get; set; } | |||
public decimal? DiscountMoney { get; set; } | |||
/// <summary> | |||
/// 支付方式(微信支付) | |||
/// </summary> | |||
public int PayMode { get; set; } | |||
/// <summary> | |||
/// 订单汇总数量 | |||
/// </summary> | |||
public int SumOrder { get; set; } | |||
public int OrderNum { get; set; } | |||
public int BoxNum { get; set; } | |||
public int NowNum { get; set; } | |||
public int Abandoned { get; set; } | |||
public int Refund { get; set; } | |||
public decimal refundMoney { get; set; } | |||
public int refundNum { get; set; } | |||
public int Customer { get; set; } | |||
public int CountDetail { get; set; } | |||
/// <summary> | |||
/// 订单开始时间 | |||
/// </summary> | |||
public DateTime? Order_CreateTime { get; set; } | |||
/// <summary> | |||
/// 订单结束时间 | |||
/// </summary> | |||
public DateTime? Order_EndTime { get; set; } | |||
} | |||
} |
@@ -0,0 +1,66 @@ | |||
using BPA.KitChen.StoreManagementOrder.Application.BaseDto; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel.DataAnnotations; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagement.Application.Service.OrderManage.Dtos | |||
{ | |||
public class OrderQueryInputDto : PageInputBase | |||
{ | |||
/// <summary> | |||
/// 订单Id | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 加盟商编号 | |||
/// </summary> | |||
public string FranchiseeId { get; set; } | |||
/// <summary> | |||
/// 订单号 | |||
/// </summary> | |||
public string order_Number { get; set; } | |||
public string Customer_Tel { get; set; } | |||
/// <summary> | |||
/// 店铺名称编号(设备名称编号) | |||
/// </summary> | |||
public string[] StoreId { get; set; } | |||
/// <summary> | |||
/// <summary> | |||
/// 商品key | |||
/// </summary> | |||
public string[] GoodsId { get; set; } | |||
/// <summary> | |||
/// 商品类型编号 | |||
/// </summary> | |||
public string[] GoodsTypeId { get; set; } | |||
/// <summary> | |||
/// 店铺分类编号(设备类型关联值) | |||
/// </summary> | |||
public string StoreTypeId { get; set; } | |||
/// <summary> | |||
/// 订单开始时间 | |||
/// </summary> | |||
public DateTime? Order_CreateTime { get; set; } | |||
/// <summary> | |||
/// 订单结束时间 | |||
/// </summary> | |||
public DateTime? Order_EndTime { get; set; } | |||
public bool isreport { get; set; } = false; | |||
public bool IsExport { get; set; } = false; | |||
/// <summary> | |||
/// 订单状态 | |||
/// </summary> | |||
public int? OrderStatus { get; set; } | |||
/// <summary> | |||
/// 支付渠道 0微信 1支付宝 2 余额 3银联 | |||
/// </summary> | |||
public int? PayMode { get; set; } | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using BPA.KitChen.StoreManagementOrder.Application.BaseDto; | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.Order.Dtos | |||
{ | |||
public class ThirdOrderDto: BPA_ThirdOrder | |||
{ | |||
public List<BPA_ThirdOrderInfo> ThirdOrderInfos { get; set; } | |||
} | |||
public class ThirdOrderInputDto: PageInputBase | |||
{ | |||
public string OrderNum { get; set; } | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.Order | |||
{ | |||
public interface IOrderService | |||
{ | |||
} | |||
} |
@@ -0,0 +1,454 @@ | |||
using BPA.KitChen.StoreManagementOrder.Application.BaseDto; | |||
using BPA.KitChen.StoreManagementOrder.Application.Service.TestService; | |||
using BPA.KitChen.StoreManagementOrder.Core.Common.Const; | |||
using BPA.KitChen.StoreManagement.Application.Service.OrderManage.Dtos; | |||
using Furion.DatabaseAccessor; | |||
using Furion; | |||
using Furion.DependencyInjection; | |||
using Furion.DynamicApiController; | |||
using Microsoft.AspNetCore.Mvc; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPA.KitChen.StoreManagementOrder.SqlSugar; | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity; | |||
using Microsoft.AspNetCore.Authorization; | |||
using Microsoft.AspNetCore.Hosting; | |||
using NPOI.SS.UserModel; | |||
using NPOI.XSSF.UserModel; | |||
using BPA.KitChen.StoreManagementOrder.Application.Service.Order.Dtos; | |||
using Org.BouncyCastle.Crypto; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.Order | |||
{ | |||
[ApiDescriptionSettings("订单管理", Tag = "订单管理", SplitCamelCase = false)] | |||
public class OrderService : IDynamicApiController, ITransient, IOrderService | |||
{ | |||
/// <summary> | |||
/// 核心对象:拥有完整的SqlSugar全部功能 | |||
/// </summary> | |||
private readonly SqlSugarScope db; | |||
private readonly string CustomerIds = "omwji4jSSh6o-I0UPLGrxKEio73Y,omwji4lFXTPD6SoCQLMexKoWdWY4"; | |||
private readonly string StoreId = "3b007e32-f1cc-4021-b4e0-f4764fa90f12"; | |||
IWebHostEnvironment _hostingEnvironment; | |||
/// <summary> | |||
/// construct | |||
/// </summary> | |||
/// <param name="sqlSugarRepository"></param> | |||
public OrderService(IWebHostEnvironment hostingEnvironment) | |||
{ | |||
db = SqlSugarDb.Db; | |||
_hostingEnvironment=hostingEnvironment; | |||
} | |||
/// <summary> | |||
/// 订单明细 | |||
/// </summary> | |||
/// <param name="dto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/Order/PostDetail")] | |||
public PageUtil PostDetail(OrderQueryInputDto dto) | |||
{ | |||
//根据对应的条件查询和排序 | |||
string strWhere = string.Empty; | |||
int total = 0; | |||
List<OrderFlowQuery> res = new List<OrderFlowQuery>(); | |||
if (!string.IsNullOrEmpty(dto.StoreTypeId))//店铺分类 | |||
{ | |||
strWhere += $" and d.Id='{dto.StoreTypeId}'"; | |||
} | |||
if (dto.StoreId != null && dto.StoreId.Length > 0)//店铺名称 | |||
{ | |||
strWhere += $" and a.StoreId in ("; | |||
for (int i = 0; i < dto.StoreId.Length; i++) | |||
{ | |||
strWhere += $"'{dto.StoreId[i]}',"; | |||
} | |||
strWhere = strWhere.Substring(0, strWhere.LastIndexOf(',')); | |||
strWhere += ")"; | |||
} | |||
if (dto.GoodsId != null && dto.GoodsId.Length > 0)//商品名称 | |||
{ | |||
strWhere += $" and a.GoodId in ("; | |||
for (int i = 0; i < dto.GoodsId.Length; i++) | |||
{ | |||
strWhere += $"'{dto.GoodsId[i]}',"; | |||
} | |||
strWhere = strWhere.Substring(0, strWhere.LastIndexOf(',')); | |||
strWhere += ")"; | |||
} | |||
if (!dto.isreport) | |||
{ | |||
if (!string.IsNullOrWhiteSpace(CustomerIds))//屏蔽查询人 | |||
{ | |||
string key = ""; | |||
string[] CustomerId = CustomerIds.Split(','); | |||
for (int i = 0; i < CustomerId.Length; i++) | |||
{ | |||
key += $"'{CustomerId[i]}',"; | |||
} | |||
key = key.Substring(0, key.LastIndexOf(',')); | |||
strWhere += $" and a.Customer_ID not in (" + key + ")"; | |||
} | |||
strWhere += $" and a.StoreId not in ('" + StoreId + "')"; | |||
} | |||
if (!string.IsNullOrEmpty(dto.Customer_Tel)) | |||
{ | |||
strWhere += $" and g.Phone='{dto.Customer_Tel}'"; | |||
} | |||
if (dto.GoodsTypeId != null && dto.GoodsTypeId.Length > 0)//商品类型 | |||
{ | |||
strWhere += $" and e.Goods_TypeID in ("; | |||
for (int i = 0; i < dto.GoodsTypeId.Length; i++) | |||
{ | |||
strWhere += $"'{dto.GoodsTypeId[i]}',"; | |||
} | |||
strWhere = strWhere.Substring(0, strWhere.LastIndexOf(',')); | |||
strWhere += ")"; | |||
} | |||
//默认当天时间 | |||
if (string.IsNullOrEmpty(dto.Order_CreateTime.ToString())) | |||
{ | |||
dto.Order_CreateTime = DateTime.Now; | |||
} | |||
if (string.IsNullOrEmpty(dto.Order_EndTime.ToString())) | |||
{ | |||
dto.Order_EndTime = DateTime.Now; | |||
} | |||
var GroupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
if (!string.IsNullOrWhiteSpace(GroupId)) | |||
{ | |||
strWhere += $" and a.GroupId = '" + GroupId + "'"; | |||
} | |||
if (dto.OrderStatus != null) | |||
{ | |||
strWhere += $" and a.Order_Status = " + dto.OrderStatus; | |||
} | |||
var temp1 = Convert.ToDateTime(dto.Order_CreateTime.Value.ToString("yyyy-MM-dd")); | |||
var temp2 = Convert.ToDateTime(dto.Order_EndTime.Value.AddDays(1).ToString("yyyy-MM-dd")); | |||
if (!dto.isreport) | |||
{ | |||
var lastDay = DateTime.Now.AddDays(1 - DateTime.Now.Day).AddMonths(-1).Date; | |||
if (temp1 < lastDay) | |||
{ | |||
temp1 = lastDay; | |||
} | |||
if (temp2 < lastDay) | |||
{ | |||
temp2 = lastDay; | |||
} | |||
} | |||
string sql = @"SELECT | |||
UUID() as orderFlowId, | |||
a.OrderInfo_Id AS Id, | |||
a.RefundStatus, | |||
a.StoreId, | |||
a.StoreName, | |||
(case when a.RefundStatus<0 then a.Order_RealMoney else 0 end ) AS Order_RealMoney, | |||
(case when a.RefundStatus<0 then a.Order_OriginalMoney else 0 end ) AS Order_OriginalMoney, | |||
(case when a.RefundStatus>=0 then a.Order_RealMoney else 0 end ) AS RefundRealMoney, | |||
(case when a.RefundStatus>=0 then a.Order_OriginalMoney else 0 end ) AS RefundOriginalMoney, | |||
a.Transaction_ID AS Order_Number, | |||
a.Order_CreateTime AS Order_CreateTime, | |||
a.PlaceMode AS PayMode, | |||
a.Order_Status AS Order_Status, | |||
g.NickName AS Customer_Name, | |||
g.Phone AS Customer_Tel, | |||
1 as order_Count | |||
FROM | |||
V_AllOrder a | |||
LEFT JOIN BPA_MemberInfo g ON ( a.Customer_ID = LOWER(g.Id) ) | |||
where a.RefundStatus is not NULL and | |||
a.Order_CreateTime >='" + temp1.ToString("yyyy-MM-dd HH:mm:ss") + @"' and a.Order_CreateTime <'" + temp2.ToString("yyyy-MM-dd HH:mm:ss") + @"' | |||
" + strWhere + ""; | |||
res = db.SqlQueryable<OrderFlowQuery>(sql) | |||
.WhereIF(dto.PayMode.HasValue, (b) => b.PayMode == dto.PayMode) | |||
.OrderBy(a => a.Order_CreateTime, OrderByType.Desc).ToPageList(dto.Current, dto.PageSize, ref total); | |||
var ids = res.Select(x => x.Id).ToList(); | |||
var orders = db.Queryable<BPA_Order>().Where(x => ids.Contains(x.Id)).ToList(); | |||
foreach (var item in res) | |||
{ | |||
item.PayMode = orders.FirstOrDefault(x => x.Id == item.Id)?.PayMode ?? 0; | |||
} | |||
PageUtil unit = new PageUtil() | |||
{ | |||
Data = res, | |||
Total = total, | |||
}; | |||
return unit; | |||
} | |||
[HttpPost("/api/Order/GetFlowExport"), ApiDescriptionSettings(SplitCamelCase = false), AllowAnonymous, NonUnify] | |||
public ResultEntity OrderDetailFlowExport([FromBody] OrderQueryInputDto dto) | |||
{ | |||
List<OrderFlowQuery> orderFlows = OrderDetailFlowExportData(dto); | |||
return new ResultEntity() | |||
{ | |||
Data = orderFlows, | |||
IsSuccess = orderFlows.Count > 0, | |||
}; | |||
string fielName = DateTime.Now.ToString("yyyyMMddHHmmss"); | |||
var currentUseId = "OrderFlow"; | |||
var rootPath = _hostingEnvironment.ContentRootPath + "orderExcels\\"; | |||
if (System.IO.Directory.Exists(rootPath) == false) | |||
System.IO.Directory.CreateDirectory(rootPath); | |||
var newFile = rootPath + "\\" + fielName + ".xlsx"; | |||
if (System.IO.File.Exists(newFile)) | |||
{ | |||
System.IO.File.Delete(newFile); | |||
} | |||
using (var fs = new FileStream(newFile, FileMode.Create, FileAccess.Write)) | |||
{ | |||
IWorkbook workbook = new XSSFWorkbook(); | |||
var sheet = workbook.CreateSheet("orders"); | |||
var header = sheet.CreateRow(0); | |||
header.CreateCell(1).SetCellValue("店铺名称 "); | |||
header.CreateCell(2).SetCellValue("交易单号"); | |||
header.CreateCell(3).SetCellValue("应付金额"); | |||
header.CreateCell(4).SetCellValue("实付金额 "); | |||
header.CreateCell(5).SetCellValue("应退金额"); | |||
header.CreateCell(6).SetCellValue("实退金额"); | |||
header.CreateCell(7).SetCellValue("菜品数量"); | |||
header.CreateCell(8).SetCellValue("下单时间"); | |||
var rowIndex = 1; | |||
foreach (var item in orderFlows) | |||
{ | |||
var datarow = sheet.CreateRow(rowIndex); | |||
datarow.CreateCell(0).SetCellValue(item.StoreName); | |||
datarow.CreateCell(1).SetCellValue(item.Order_Number); | |||
datarow.CreateCell(2).SetCellValue(item.Order_OriginalMoney.Value.ToString("#0.00")); | |||
datarow.CreateCell(3).SetCellValue(item.Order_RealMoney.Value.ToString("#0.00")); | |||
datarow.CreateCell(4).SetCellValue(item.RefundOriginalMoney.Value.ToString("#0.00")); | |||
datarow.CreateCell(5).SetCellValue(item.RefundRealMoney.Value.ToString("#0.00")); | |||
datarow.CreateCell(6).SetCellValue(item.Order_Count); | |||
datarow.CreateCell(7).SetCellValue(item.Order_CreateTime.ToString("yyyy-MM-dd HH:mm:ss")); | |||
rowIndex++; | |||
} | |||
workbook.Write(fs); | |||
} | |||
var memory = new MemoryStream(); | |||
using (var stream = new FileStream(newFile, FileMode.Open)) | |||
{ | |||
stream.CopyTo(memory); | |||
} | |||
memory.Position = 0; | |||
var result = new FileStreamResult(memory, "application/octet-stream") | |||
{ | |||
FileDownloadName = fielName + ".xlsx" | |||
}; | |||
// return result; | |||
} | |||
private List<OrderFlowQuery> OrderDetailFlowExportData(OrderQueryInputDto dto) | |||
{ | |||
//根据对应的条件查询和排序 | |||
string strWhere = string.Empty; | |||
int total = 0; | |||
List<OrderFlowQuery> res = new List<OrderFlowQuery>(); | |||
if (!string.IsNullOrEmpty(dto.StoreTypeId))//店铺分类 | |||
{ | |||
strWhere += $" and d.Id='{dto.StoreTypeId}'"; | |||
} | |||
if (dto.StoreId != null && dto.StoreId.Length > 0)//店铺名称 | |||
{ | |||
strWhere += $" and a.StoreId in ("; | |||
for (int i = 0; i < dto.StoreId.Length; i++) | |||
{ | |||
strWhere += $"'{dto.StoreId[i]}',"; | |||
} | |||
strWhere = strWhere.Substring(0, strWhere.LastIndexOf(',')); | |||
strWhere += ")"; | |||
} | |||
if (dto.GoodsId != null && dto.GoodsId.Length > 0)//商品名称 | |||
{ | |||
strWhere += $" and a.GoodId in ("; | |||
for (int i = 0; i < dto.GoodsId.Length; i++) | |||
{ | |||
strWhere += $"'{dto.GoodsId[i]}',"; | |||
} | |||
strWhere = strWhere.Substring(0, strWhere.LastIndexOf(',')); | |||
strWhere += ")"; | |||
} | |||
if (!dto.isreport) | |||
{ | |||
if (!string.IsNullOrWhiteSpace(CustomerIds))//屏蔽查询人 | |||
{ | |||
string key = ""; | |||
string[] CustomerId = CustomerIds.Split(','); | |||
for (int i = 0; i < CustomerId.Length; i++) | |||
{ | |||
key += $"'{CustomerId[i]}',"; | |||
} | |||
key = key.Substring(0, key.LastIndexOf(',')); | |||
strWhere += $" and a.Customer_ID not in (" + key + ")"; | |||
} | |||
strWhere += $" and a.StoreId not in ('" + StoreId + "')"; | |||
} | |||
if (!string.IsNullOrEmpty(dto.Customer_Tel)) | |||
{ | |||
strWhere += $" and g.Phone='{dto.Customer_Tel}'"; | |||
} | |||
if (dto.GoodsTypeId != null && dto.GoodsTypeId.Length > 0)//商品类型 | |||
{ | |||
strWhere += $" and e.Goods_TypeID in ("; | |||
for (int i = 0; i < dto.GoodsTypeId.Length; i++) | |||
{ | |||
strWhere += $"'{dto.GoodsTypeId[i]}',"; | |||
} | |||
strWhere = strWhere.Substring(0, strWhere.LastIndexOf(',')); | |||
strWhere += ")"; | |||
} | |||
//默认当天时间 | |||
if (string.IsNullOrEmpty(dto.Order_CreateTime.ToString())) | |||
{ | |||
dto.Order_CreateTime = DateTime.Now; | |||
} | |||
if (string.IsNullOrEmpty(dto.Order_EndTime.ToString())) | |||
{ | |||
dto.Order_EndTime = DateTime.Now; | |||
} | |||
var GroupId = App.User.FindFirst(ClaimConst.GroupId)?.Value; | |||
if (!string.IsNullOrWhiteSpace(GroupId)) | |||
{ | |||
strWhere += $" and a.GroupId = '" + GroupId + "'"; | |||
} | |||
if (dto.OrderStatus != null) | |||
{ | |||
strWhere += $" and a.OrderStatus = " + dto.OrderStatus; | |||
} | |||
var temp1 = Convert.ToDateTime(dto.Order_CreateTime.Value.ToString("yyyy-MM-dd")); | |||
var temp2 = Convert.ToDateTime(dto.Order_EndTime.Value.AddDays(1).ToString("yyyy-MM-dd")); | |||
if (!dto.isreport) | |||
{ | |||
var lastDay = DateTime.Now.AddDays(1 - DateTime.Now.Day).AddMonths(-1).Date; | |||
if (temp1 < lastDay) | |||
{ | |||
temp1 = lastDay; | |||
} | |||
if (temp2 < lastDay) | |||
{ | |||
temp2 = lastDay; | |||
} | |||
} | |||
string sql = @"SELECT | |||
a.OrderInfo_Id AS Id, | |||
a.RefundStatus, | |||
a.StoreId, | |||
a.StoreName, | |||
(case when a.RefundStatus<0 then a.Order_RealMoney else 0 end ) AS Order_RealMoney, | |||
(case when a.RefundStatus<0 then a.Order_OriginalMoney else 0 end ) AS Order_OriginalMoney, | |||
(case when a.RefundStatus>=0 then a.Order_RealMoney else 0 end ) AS RefundRealMoney, | |||
(case when a.RefundStatus>=0 then a.Order_OriginalMoney else 0 end ) AS RefundOriginalMoney, | |||
a.Transaction_ID AS Order_Number, | |||
a.Order_CreateTime AS Order_CreateTime, | |||
a.PlaceMode AS PayMode, | |||
a.Order_Status AS Order_Status, | |||
g.NickName AS Customer_Name, | |||
g.Phone AS Customer_Tel, | |||
1 as order_Count | |||
FROM | |||
V_AllOrder a | |||
LEFT JOIN BPA_MemberInfo g ON ( a.Customer_ID = LOWER(g.Id) ) | |||
where a.RefundStatus is not NULL and | |||
a.Order_CreateTime >='" + temp1.ToString("yyyy-MM-dd HH:mm:ss") + @"' and a.Order_CreateTime <'" + temp2.ToString("yyyy-MM-dd HH:mm:ss") + @"' | |||
" + strWhere + ""; | |||
res = db.SqlQueryable<OrderFlowQuery>(sql) | |||
.WhereIF(dto.PayMode.HasValue, (b) => b.PayMode == dto.PayMode) | |||
.OrderBy(a => a.Order_CreateTime, OrderByType.Desc).ToList(); | |||
return res; | |||
} | |||
#region 第三方订单 | |||
/// <summary> | |||
/// 获取第三方 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/Order/ThirdOrderPage")] | |||
public async Task<PageUtil> ThirdOrderPageAsync(ThirdOrderInputDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
var data = await db.Queryable<BPA_ThirdOrder>() | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.WhereIF(!string.IsNullOrEmpty(inputDto.OrderNum),x=>x.OrderNum.Contains(inputDto.OrderNum)) | |||
.Select(x=>new ThirdOrderDto() | |||
{ | |||
Id = x.Id.SelectAll() | |||
}) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
var ids = data.Select(x => x.Id).ToList(); | |||
var thirdOrderInfos = await db.Queryable<BPA_ThirdOrderInfo>() | |||
.Where(x=>ids.Contains(x.ThirdOrderId)) | |||
.ToListAsync(); | |||
foreach (var item in data) | |||
{ | |||
var thisData = thirdOrderInfos.Where(x => x.ThirdOrderId == item.Id).ToList(); | |||
item.ThirdOrderInfos= thisData; | |||
} | |||
return new PageUtil() | |||
{ | |||
Data = data, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 获取第三方订单详情 | |||
/// </summary> | |||
/// <param name="thirdOrderId"></param> | |||
/// <returns></returns> | |||
[HttpGet("/api/Order/GetThirdOrderInfo")] | |||
public async Task<ThirdOrderDto> GetThirdOrderInfo(string thirdOrderId) | |||
{ | |||
var data = await db.Queryable<BPA_ThirdOrder>() | |||
.Where(x=>x.Id==thirdOrderId) | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.Select(x => new ThirdOrderDto() | |||
{ | |||
Id = x.Id.SelectAll() | |||
}).FirstAsync(); | |||
var thirdOrderInfos = await db.Queryable<BPA_ThirdOrderInfo>() | |||
.Where(x => x.ThirdOrderId==thirdOrderId) | |||
.ToListAsync(); | |||
data.ThirdOrderInfos = thirdOrderInfos; | |||
return data; | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.TestService | |||
{ | |||
public interface ITestService | |||
{ | |||
} | |||
} |
@@ -0,0 +1,44 @@ | |||
using BPA.KitChen.StoreManagementOrder.SqlSugar; | |||
using Furion.DependencyInjection; | |||
using Furion.DynamicApiController; | |||
using Microsoft.AspNetCore.Authorization; | |||
using Microsoft.AspNetCore.Mvc; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.TestService | |||
{ | |||
[ApiDescriptionSettings("测试", Tag = "测试", SplitCamelCase = false)] | |||
[AllowAnonymous] | |||
public class TestService: IDynamicApiController, ITransient, ITestService | |||
{ | |||
/// <summary> | |||
/// CodeFirst | |||
/// </summary> | |||
/// <param name="tableNames"></param> | |||
public void CodeFirst() | |||
{ | |||
try | |||
{ | |||
var types = Assembly.Load("BPA.KitChen.StoreManagementOrder.Core").GetTypes() | |||
.Where(x => x.Namespace != null | |||
&& x.GetCustomAttribute<SugarTable>() != null | |||
&& x.Namespace.Contains("BPA.KitChen.StoreManagementOrder.Core.Entity")) | |||
.ToArray(); | |||
SqlSugarDb.Db.CodeFirst.InitTables(types); | |||
} | |||
catch (Exception e) | |||
{ | |||
Console.WriteLine(e); | |||
throw; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using BPA.KitChen.StoreManagementOrder.Application.BaseDto; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.ThirdAuthorize.Dtos | |||
{ | |||
public class ThirdAuthorizeInfoDto: PageInputBase | |||
{ | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.ThirdAuthorize | |||
{ | |||
public interface IThirdAuthorize | |||
{ | |||
} | |||
} |
@@ -0,0 +1,101 @@ | |||
using BPA.KitChen.StoreManagementOrder.Application.BaseDto; | |||
using BPA.KitChen.StoreManagementOrder.Application.Service.Order; | |||
using BPA.KitChen.StoreManagementOrder.Application.Service.Order.Dtos; | |||
using BPA.KitChen.StoreManagementOrder.Application.Service.ThirdAuthorize.Dtos; | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity; | |||
using BPA.KitChen.StoreManagementOrder.SqlSugar; | |||
using Furion.DependencyInjection; | |||
using Furion.DynamicApiController; | |||
using Furion.FriendlyException; | |||
using Microsoft.AspNetCore.Hosting; | |||
using Microsoft.AspNetCore.Mvc; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Application.Service.ThirdAuthorize | |||
{ | |||
[ApiDescriptionSettings("订单管理", Tag = "第三方授权", SplitCamelCase = false)] | |||
public class ThirdAuthorize : IDynamicApiController, ITransient, IThirdAuthorize | |||
{ | |||
private readonly SqlSugarScope db; | |||
public ThirdAuthorize(IWebHostEnvironment hostingEnvironment) | |||
{ | |||
db = SqlSugarDb.Db; | |||
} | |||
/// <summary> | |||
/// 获取第三方 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ThirdAuthorize/Page")] | |||
public async Task<PageUtil> Page(ThirdAuthorizeInfoDto inputDto) | |||
{ | |||
var total = new RefAsync<int>(); | |||
var data = await db.Queryable<BPA_ShopAuthorize>() | |||
.OrderBy(a => a.CreateAt, OrderByType.Desc) | |||
.ToPageListAsync(inputDto.Current, inputDto.PageSize, total); | |||
return new PageUtil() | |||
{ | |||
Data = data, | |||
Total = total | |||
}; | |||
} | |||
/// <summary> | |||
/// 创建 授权 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ThirdAuthorize/Create")] | |||
public async Task<bool> Create(BPA_ShopAuthorize inputDto) | |||
{ | |||
var data=await db.Queryable<BPA_ShopAuthorize>().Where(x=>x.StoreId==inputDto.StoreId).FirstAsync(); | |||
if (data != null) | |||
{ | |||
throw Oops.Oh($"店铺已授权"); | |||
} | |||
inputDto.AuthorizeCode=Guid.NewGuid().ToString(); | |||
var res=await db.Insertable(inputDto).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 修改 重新赋值授权码 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ThirdAuthorize/Update")] | |||
public async Task<bool> Update(BPA_ShopAuthorize inputDto) | |||
{ | |||
var data = await db.Queryable<BPA_ShopAuthorize>().Where(x =>x.Id==inputDto.Id).FirstAsync(); | |||
data.AuthorizeCode = Guid.NewGuid().ToString(); | |||
var res=await db.Updateable(data).ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
/// <summary> | |||
/// 修改 重新赋值授权码 | |||
/// </summary> | |||
/// <param name="inputDto"></param> | |||
/// <returns></returns> | |||
[HttpPost("/api/ThirdAuthorize/Del")] | |||
public async Task<bool> Del(string id) | |||
{ | |||
var res = await SqlSugarDb.Db.Updateable<BPA_ShopAuthorize>() | |||
.SetColumns(it => new BPA_ShopAuthorize { IsDeleted = 1 })//类只能在表达示里面不能提取 | |||
.Where(it => it.Id == id) | |||
.ExecuteCommandAsync(); | |||
return res > 0; | |||
} | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<PackageReference Include="EasyNetQ" Version="7.8.0" /> | |||
<PackageReference Include="Furion" Version="4.9.1.20" /> | |||
<PackageReference Include="Furion.Extras.Authentication.JwtBearer" Version="4.9.1.20" /> | |||
<PackageReference Include="SqlSugarCore" Version="5.1.4.134" /> | |||
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.3.7" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Folder Include="Common\Enum\" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,7 @@ | |||
namespace BPA.KitChen.StoreManagementOrder.Core | |||
{ | |||
public class Class1 | |||
{ | |||
} | |||
} |
@@ -0,0 +1,57 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Common.Const | |||
{ | |||
public class ClaimConst | |||
{ | |||
/// <summary> | |||
/// 用户Id | |||
/// </summary> | |||
public const string CLAINM_USERID = "UserId"; | |||
/// <summary> | |||
/// 账号 | |||
/// </summary> | |||
public const string CLAINM_ACCOUNT = "Account"; | |||
/// <summary> | |||
/// 名称 | |||
/// </summary> | |||
public const string CLAINM_NAME = "Name"; | |||
/// <summary> | |||
/// 是否超级管理 | |||
/// </summary> | |||
public const string CLAINM_SUPERADMIN = "SuperAdmin"; | |||
/// <summary> | |||
/// 登录类型1平台用户登录,0加盟商登录 | |||
/// </summary> | |||
public const string LoginType = "LoginType"; | |||
/// <summary> | |||
/// 加盟商编号 | |||
/// </summary> | |||
public const string FranchID = "FranchID"; | |||
/// <summary> | |||
/// 加盟商通知手机号 | |||
/// </summary> | |||
public const string FranchTel = "18782023833"; | |||
/// <summary> | |||
/// 加盟商组id | |||
/// </summary> | |||
public const string GroupId = "GroupId"; | |||
/// <summary> | |||
/// 权限 | |||
/// </summary> | |||
public const string RoleId = "RoleId"; | |||
public const string OrgId = ""; | |||
public const string SupplyPlatformId = "SupplyPlatformId"; | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
| |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Common | |||
{ | |||
public class CosConfig | |||
{ | |||
public static CosInfoOptions cosInfoOptions; | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using Furion.ConfigurableOptions; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Common | |||
{ | |||
public class CosInfoOptions : IConfigurableOptions | |||
{ | |||
public string AppId { get; set; } | |||
public string Region { get; set; } | |||
public string Bucket { get; set; } | |||
public string SecretId { get; set; } | |||
public string SecretKey { get; set; } | |||
public CosInfoOptions(string appid, string region, string bucket, string secretId, string secretKey) | |||
{ | |||
AppId = appid; | |||
Region = region; | |||
Bucket = bucket; | |||
SecretId = secretId; | |||
SecretKey = secretKey; | |||
} | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Common.Const; | |||
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.StoreManagementOrder.Core.Common | |||
{ | |||
/// <summary> | |||
/// 当前用户 | |||
/// </summary> | |||
public class CurrentUser | |||
{ | |||
public static string? UserId => App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
public static string? TenantId => App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
public static string? Account => App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value; | |||
public static string? RoleId => App.User?.FindFirst(ClaimConst.RoleId)?.Value; | |||
} | |||
} |
@@ -0,0 +1,100 @@ | |||
using Furion; | |||
using Furion.FriendlyException; | |||
using Furion.Templates; | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.EntityFrameworkCore.Metadata.Internal; | |||
using Microsoft.IdentityModel.Logging; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Net; | |||
using System.Net.Http; | |||
using System.Reflection.PortableExecutable; | |||
using System.Security.Policy; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Common | |||
{ | |||
public static class HttpHelper | |||
{ | |||
private static readonly HttpClient client = new HttpClient(); | |||
/// <summary> | |||
/// Get 请求 | |||
/// </summary> | |||
/// <param name="url"></param> | |||
/// <param name="postDataStr"></param> | |||
/// <param name="headers"></param> | |||
/// <param name="platform"></param> | |||
/// <param name="contentType"></param> | |||
/// <returns></returns> | |||
public static string HttpGet(string url, string postDataStr, Dictionary<string, string> headers, string contentType = "") | |||
{ | |||
var result = string.Empty; | |||
try | |||
{ | |||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url + postDataStr); | |||
request.ServicePoint.Expect100Continue = false; //加了这一行代码 就OK了 | |||
request.Method = "GET"; | |||
request.ContentType = contentType; | |||
foreach (KeyValuePair<string, string> kv in headers) | |||
{ | |||
request.Headers.Add(kv.Key, kv.Value); | |||
} | |||
HttpWebResponse response = (HttpWebResponse)request.GetResponse(); | |||
Stream myResponseStream = response.GetResponseStream(); | |||
StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8")); | |||
result = myStreamReader.ReadToEnd(); | |||
myStreamReader.Close(); | |||
myResponseStream.Close(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw Oops.Oh( ex.Message); | |||
} | |||
return result; | |||
} | |||
public static string PostData(string url, string postData, Encoding encoding, string ContentType, Dictionary<string, string> headers) | |||
{ | |||
try | |||
{ | |||
HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(url); | |||
myReq.Method = "POST"; | |||
myReq.Timeout = 600 * 60; | |||
byte[] byteArray = encoding.GetBytes(postData); | |||
myReq.ContentType = ContentType; | |||
//对键值对进行遍历 | |||
foreach (KeyValuePair<string, string> kv in headers) | |||
{ | |||
myReq.Headers.Add(kv.Key, kv.Value); | |||
} | |||
Stream dataStream = myReq.GetRequestStream(); | |||
dataStream.Write(byteArray, 0, byteArray.Length); | |||
dataStream.Close(); | |||
HttpWebResponse HttpWResp = (HttpWebResponse)myReq.GetResponse(); | |||
dataStream = HttpWResp.GetResponseStream(); | |||
string result = ""; | |||
using (StreamReader myStreamReader = new StreamReader(dataStream, encoding)) | |||
{ | |||
result = myStreamReader.ReadToEnd(); | |||
myStreamReader.Close(); | |||
} | |||
dataStream.Close(); | |||
HttpWResp.Close(); | |||
return result; | |||
} | |||
catch (System.Exception ex) | |||
{ | |||
throw ex; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.Kitchen.Core.RabbitMq.Config | |||
{ | |||
public class AcceptEntity | |||
{ | |||
/// <summary> | |||
/// 队列名称 | |||
/// </summary> | |||
public String QueeName { get; set; } | |||
/// <summary> | |||
/// 推送模式 | |||
/// </summary> | |||
public MQEnum SendType { get; set; } | |||
/// <summary> | |||
/// 管道名称 | |||
/// </summary> | |||
public String ExchangeName { get; set; } | |||
/// <summary> | |||
/// 路由名称 | |||
/// </summary> | |||
public String RouteName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.Kitchen.Core.RabbitMq.Config | |||
{ | |||
public interface IAccept | |||
{ | |||
void AcceptMQ<T>(string msg); | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Text; | |||
namespace BPA.Kitchen.Core.RabbitMq.Config | |||
{ | |||
public enum MQEnum | |||
{ | |||
/// <summary> | |||
/// 订阅模式 | |||
/// </summary> | |||
[Description("订阅模式")] | |||
Sub = 10, | |||
/// <summary> | |||
/// 推送模式 | |||
/// </summary> | |||
[Description("推送模式")] | |||
Push = 20, | |||
/// <summary> | |||
/// 主路由模式 | |||
/// </summary> | |||
[Description("主路由模式")] | |||
Top = 30 | |||
} | |||
} |
@@ -0,0 +1,111 @@ | |||
| |||
using EasyNetQ; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq.Expressions; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Linq.Expressions; | |||
namespace BPA.Kitchen.Core.RabbitMq.Config | |||
{ | |||
public class MQFactory | |||
{ | |||
private volatile static IBus Bus = null; | |||
/// <summary> | |||
/// 创建链接 | |||
/// </summary> | |||
/// <returns></returns> | |||
public static IBus CreateMQ() | |||
{ | |||
Console.WriteLine("MQ地址:" + Furion.App.Configuration["RabbitMQ"].ToString()); | |||
if (Bus == null) | |||
Bus = RabbitHutch.CreateBus(Furion.App.Configuration["RabbitMQ"].ToString()); | |||
return Bus; | |||
} | |||
/// <summary> | |||
/// 释放链接 | |||
/// </summary> | |||
public static void DisposeBus() | |||
{ | |||
Bus?.Dispose(); | |||
} | |||
/// <summary> | |||
/// 同步执行 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="Param"></param> | |||
/// <returns></returns> | |||
public static bool SendMQ<T>(PushEntity<T> Param) | |||
{ | |||
try | |||
{ | |||
if (Bus == null) | |||
CreateMQ(); | |||
new PushManage().SendMQ(Param, Bus); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
Console.WriteLine(ex); | |||
//BPALog.WriteLog(ex.Message, LogEnum.Error, ex: ex); | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 推荐异步执行 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="Param"></param> | |||
/// <returns></returns> | |||
public static async Task SendMQAsync<T>(PushEntity<T> Param) where T : class | |||
{ | |||
if (Bus == null) | |||
CreateMQ(); | |||
await new PushManage().SendMQAsync(Param, Bus); | |||
} | |||
/// <summary> | |||
/// 订阅消息 | |||
/// </summary> | |||
/// <typeparam name="TAccept"></typeparam> | |||
/// <param name="Args"></param> | |||
public static void Subscriber<TAccept, T>(AcceptEntity Args) where TAccept : IAccept, new() where T : new() | |||
{ | |||
//if (Bus == null) | |||
// CreateMQ(); | |||
//if (string.IsNullOrEmpty(Args.ExchangeName)) | |||
// return; | |||
//Expression<Action<IAccept>> methodCall; | |||
//IExchange EX = null; | |||
//if (Args.SendType == MQEnum.Sub) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Args.ExchangeName, ExchangeType.Fanout); | |||
//} | |||
//if (Args.SendType == MQEnum.Push) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Args.ExchangeName, ExchangeType.Direct); | |||
//} | |||
//if (Args.SendType == MQEnum.Top) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Args.ExchangeName, ExchangeType.Topic); | |||
//} | |||
//IQueue queue = Bus.Advanced.QueueDeclare(Args.QueeName ?? null); | |||
//Bus.Advanced.Bind(EX, queue, Args.RouteName); | |||
//Bus.Advanced.Consume(queue, (body, properties, info) => Task.Factory.StartNew(() => | |||
//{ | |||
// try | |||
// { | |||
// var message = Encoding.UTF8.GetString(body); | |||
// //处理消息 | |||
// methodCall = job => job.AcceptMQ<T>(message); | |||
// methodCall.Compile()(new TAccept()); | |||
// } | |||
// catch (Exception ex) | |||
// { | |||
// throw ex; | |||
// } | |||
//})); | |||
} | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
namespace BPA.Kitchen.Core.RabbitMq.Config | |||
{ | |||
public class PushEntity<T> | |||
{ | |||
/// <summary> | |||
/// 推送内容 | |||
/// </summary> | |||
public T BodyData { get; set; } | |||
/// <summary> | |||
/// 推送模式 | |||
/// </summary> | |||
public MQEnum SendType { get; set; } | |||
/// <summary> | |||
/// 管道名称 | |||
/// </summary> | |||
public String ExchangeName { get; set; } | |||
/// <summary> | |||
/// 路由名称 | |||
/// </summary> | |||
public String RouteName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,81 @@ | |||
using EasyNetQ; | |||
using EasyNetQ.Topology; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using Newtonsoft.Json; | |||
using System.Threading.Tasks; | |||
namespace BPA.Kitchen.Core.RabbitMq.Config | |||
{ | |||
public class PushManage | |||
{ | |||
/// <summary> | |||
/// 发布消息队列异步 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="Param"></param> | |||
/// <param name="Bus"></param> | |||
/// <returns></returns> | |||
public async Task SendMQAsync<T>(PushEntity<T> Param, IBus Bus) | |||
{ | |||
////one to one | |||
//var msg = new Message<T>(Param.BodyData); | |||
//IExchange EX = null; | |||
//if (Param.SendType == MQEnum.Sub) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Param.ExchangeName, ExchangeType.Fanout); | |||
//} | |||
//if (Param.SendType == MQEnum.Push) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Param.ExchangeName, ExchangeType.Direct); | |||
//} | |||
//if (Param.SendType == MQEnum.Top) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Param.ExchangeName, ExchangeType.Topic); | |||
//} | |||
//await Bus.Advanced.PublishAsync(EX, Param.RouteName, false, msg).ContinueWith(t => | |||
//{ | |||
// //消息投递失败 | |||
// if (!t.IsCompleted && t.IsFaulted) | |||
// { | |||
// // //将消息记录到数据库轮询 | |||
// // IRepository Repository = new Repository(); | |||
// // SystemLog Log = new SystemLog | |||
// // { | |||
// // LogName = "消息队列", | |||
// // Source = "发布队列", | |||
// // EventData = JsonConvert.SerializeObject(Param.BodyData) | |||
// // }; | |||
// // Repository.Insert(Log); | |||
// } | |||
//}); | |||
} | |||
/// <summary> | |||
/// 发布消息队列同步 | |||
/// </summary> | |||
/// <typeparam name="T"></typeparam> | |||
/// <param name="Param"></param> | |||
/// <param name="Bus"></param> | |||
public void SendMQ<T>(PushEntity<T> Param, IBus Bus) | |||
{ | |||
////one to one | |||
//var msg = new Message<T>(Param.BodyData); | |||
//IExchange EX = null; | |||
//if (Param.SendType == MQEnum.Sub) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Param.ExchangeName, ExchangeType.Fanout); | |||
//} | |||
//if (Param.SendType == MQEnum.Push) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Param.ExchangeName, ExchangeType.Direct); | |||
//} | |||
//if (Param.SendType == MQEnum.Top) | |||
//{ | |||
// EX = Bus.Advanced.ExchangeDeclare(Param.ExchangeName, ExchangeType.Topic); | |||
//} | |||
//Bus.Advanced.Publish(EX, Param.RouteName, false, msg); | |||
} | |||
} | |||
} |
@@ -0,0 +1,73 @@ | |||
using BPA.Kitchen.Core.RabbitMq.Config; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.Kitchen.Core.RabbitMq.Publisher | |||
{ | |||
public class ServiceQueryPush | |||
{ | |||
public static ServiceQueryPush QueryPush => new Lazy<ServiceQueryPush>().Value; | |||
public async Task<bool> PushMQAsync<T>(T Entity,string Key, MQEnum MQType = MQEnum.Push) where T : class, new() | |||
{ | |||
//推送模式 | |||
//推送模式下需指定管道名称和路由键值名称 | |||
//消息只会被发送到指定的队列中去 | |||
//订阅模式 | |||
//订阅模式下只需指定管道名称 | |||
//消息会被发送到该管道下的所有队列中 | |||
//主题路由模式 | |||
//路由模式下需指定管道名称和路由值 | |||
//消息会被发送到该管道下,和路由值匹配的队列中去 | |||
PushEntity<T> entity = new PushEntity<T>(); | |||
entity.BodyData = Entity; | |||
entity.SendType = MQType; | |||
if (MQType == MQEnum.Push) | |||
{ | |||
entity.ExchangeName = "Message.Direct"; | |||
entity.RouteName = Key; | |||
} | |||
else if (MQType == MQEnum.Sub) | |||
{ | |||
entity.ExchangeName = "Message.Fanout"; | |||
} | |||
else | |||
{ | |||
entity.ExchangeName = "Message.Topic"; | |||
entity.RouteName = Key; | |||
} | |||
return await MQFactory.SendMQAsync(entity).ContinueWith(t => { return t.IsCompleted ? true : false; }); | |||
} | |||
public bool PushMQ<T>(T Entity, string Key, MQEnum MQType = MQEnum.Push) | |||
{ | |||
//推送模式 | |||
//推送模式下需指定管道名称和路由键值名称 | |||
//消息只会被发送到指定的队列中去 | |||
//订阅模式 | |||
//订阅模式下只需指定管道名称 | |||
//消息会被发送到该管道下的所有队列中 | |||
//主题路由模式 | |||
//路由模式下需指定管道名称和路由值 | |||
//消息会被发送到该管道下,和路由值匹配的队列中去 | |||
PushEntity<T> entity = new PushEntity<T>(); | |||
entity.BodyData = Entity; | |||
entity.SendType = MQType; | |||
if (MQType == MQEnum.Push) | |||
{ | |||
entity.ExchangeName = "Message.Direct"; | |||
entity.RouteName = Key; | |||
} | |||
else if (MQType == MQEnum.Sub) | |||
{ | |||
entity.ExchangeName = "Message.Fanout"; | |||
} | |||
else | |||
{ | |||
entity.ExchangeName = "Message.Topic"; | |||
entity.RouteName = Key; | |||
} | |||
return MQFactory.SendMQ(entity); | |||
} | |||
} | |||
} |
@@ -0,0 +1,91 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
/// <summary> | |||
/// 会员 | |||
/// </summary> | |||
[SugarTable("BPA_MemberInfo")] | |||
public class BPA_MemberInfo : IBaseGroupIdEntity | |||
{ | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string NickName { get; set; } | |||
/// <summary> | |||
/// 0=未知 1=男 2=女 | |||
/// </summary> | |||
public int Sex { get; set; } | |||
/// <summary> | |||
/// 头像 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string HeadImgUrl { get; set; } | |||
/// <summary> | |||
/// 国家 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Country { get; set; } | |||
/// <summary> | |||
/// 省 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Province { get; set; } | |||
/// <summary> | |||
/// 市 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string City { get; set; } | |||
/// <summary> | |||
/// 县(区) | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string County { get; set; } | |||
/// <summary> | |||
/// 具体地址 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Address { get; set; } | |||
/// <summary> | |||
/// 出生日期 | |||
/// </summary> | |||
public DateTime Birthday { get; set; } | |||
/// <summary> | |||
/// 电话 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Phone { get; set; } | |||
/// <summary> | |||
/// 真实姓名 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string RealName { get; set; } | |||
/// <summary> | |||
/// 身份证号码 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string CardNum { get; set; } | |||
/// <summary> | |||
/// 等级 | |||
/// </summary> | |||
[SugarColumn(IsNullable = true)] | |||
public string Level_Id { get; set; } | |||
/// <summary> | |||
/// 向外展示那个平台的信息 0:默认 1.微信 2.支付宝 | |||
/// </summary> | |||
public int ShowPlatformType { get; set; } | |||
/// <summary> | |||
/// 积分 | |||
/// </summary> | |||
public decimal Integral { get; set; } | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity.Base; | |||
using SqlSugar; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
/// <summary> | |||
/// 会员标签 | |||
/// </summary> | |||
[SugarTable("BPA_MemberTag")] | |||
public class BPA_MemberTag : IBaseGroupIdEntity | |||
{ | |||
/// <summary> | |||
/// 会员标签名称 | |||
/// </summary> | |||
public string Name { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public int Sort { get; set; } | |||
/// <summary> | |||
/// 平台标签 0:默认 1.微信 2.支付宝 | |||
/// </summary> | |||
public int PlatformType { get; set; } | |||
} | |||
} |
@@ -0,0 +1,130 @@ | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
[SugarTable("BPA_Order")] | |||
public class BPA_Order | |||
{ | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 排序号 (按加盟商区分) | |||
/// </summary> | |||
public string SortId { get; set; } | |||
/// <summary> | |||
/// 用户Id | |||
/// </summary> | |||
public string CustomerId { get; set; } | |||
/// <summary> | |||
/// 订单状态 0未付款,1已付款,-1退单申请,-2退单中,-3已退单,-4取消交易 -5撤销申请 | |||
/// </summary> | |||
public int OrderStatus { get; set; } | |||
/// <summary> | |||
/// 用户售后状态 -1 售后已取消 0 未发起售后 1 申请售后 2 处理中 200 处理完毕 | |||
/// </summary> | |||
public int AfterStatus { get; set; } | |||
/// <summary> | |||
/// 商品数量 | |||
/// </summary> | |||
public int OrderCount { get; set; } | |||
/// <summary> | |||
/// 商品总价 | |||
/// </summary> | |||
public decimal OrderOriginalMoney { get; set; } | |||
/// <summary> | |||
/// 折扣价格 | |||
/// </summary> | |||
public decimal DiscountMoney { get; set; } | |||
/// <summary> | |||
/// 实际支付价格 | |||
/// </summary> | |||
public decimal OrderRealMoney { get; set; } | |||
/// <summary> | |||
/// 支付渠道 0微信 1支付宝 2 余额 3银联 4.现金 | |||
/// </summary> | |||
public int PayMode { get; set; } | |||
/// <summary> | |||
/// 订单号(本系统) | |||
/// </summary> | |||
public string OrderNumber { get; set; } | |||
/// <summary> | |||
/// 订单号(第三方) | |||
/// </summary> | |||
public string TradeNo { get; set; } | |||
/// <summary> | |||
/// 交易号 | |||
/// </summary> | |||
public string TransactionId { get; set; } | |||
/// <summary> | |||
/// 订单结算状态 0未结算 1已结算 | |||
/// </summary> | |||
public int OrderSettlementStatus { get; set; } | |||
/// <summary> | |||
/// 订单结算时间 | |||
/// </summary> | |||
public string OrderSettlementTime { get; set; } | |||
/// <summary> | |||
/// 订单类型 0->正常 1->立即吃面2->盲盒3->其他 | |||
/// </summary> | |||
public int OrderType { get; set; } | |||
/// <summary> | |||
/// 创建于 | |||
/// </summary> | |||
public DateTime CreatedAt { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
public string CreatedBy { get; set; } | |||
/// <summary> | |||
/// 更新于 | |||
/// </summary> | |||
public DateTime UpdatedAt { get; set; } | |||
/// <summary> | |||
/// 更新人 | |||
/// </summary> | |||
public string UpdatedBy { get; set; } | |||
/// <summary> | |||
/// 自动修改 记录最新的修改时间 | |||
/// </summary> | |||
public string UpdatedTs { get; set; } | |||
/// <summary> | |||
/// 订单来源 0 小程序 1大屏点餐 etc... | |||
/// </summary> | |||
public string OrderSourceFrom { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 三方id | |||
/// </summary> | |||
public string TroikaId { get; set; } | |||
/// <summary> | |||
/// 店铺id | |||
/// </summary> | |||
public string OrgId { get; set; } | |||
/// <summary> | |||
/// 小票备注 | |||
/// </summary> | |||
public string PrintRemark { get; set; } | |||
/// <summary> | |||
/// 就餐方式 | |||
/// </summary> | |||
public int EatType { get; set; } | |||
public string GroupId { get; set; } | |||
/// <summary> | |||
/// 优惠合集 | |||
/// </summary> | |||
public string PriceCollection { get; set; } | |||
public decimal CusmetMoney { get; set; } | |||
} | |||
} |
@@ -0,0 +1,172 @@ | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
[SugarTable("BPA_OrderRefundLog")] | |||
public class BPA_OrderRefundLog | |||
{ | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public string Id { get; set; } = Guid.NewGuid().ToString(); | |||
/// <summary> | |||
/// 订单号(自己系统) | |||
/// </summary> | |||
public System.String OrderNumber { get; set; } | |||
/// <summary> | |||
/// 订单号(第三方) | |||
/// </summary> | |||
public System.String TradeNo { get; set; } | |||
/// <summary> | |||
/// 交易号 | |||
/// </summary> | |||
public System.String TransactionId { get; set; } | |||
/// <summary> | |||
/// 售后表Id(null表示为售前退款) | |||
/// </summary> | |||
public System.String ReturnId { get; set; } | |||
/// <summary> | |||
/// 主订单id | |||
/// </summary> | |||
public System.String OrderId { get; set; } | |||
/// <summary> | |||
/// 子订单id | |||
/// </summary> | |||
public System.String SubOrderId { get; set; } | |||
/// <summary> | |||
/// 退款金额() | |||
/// </summary> | |||
public System.Decimal RefundMoney { get; set; } | |||
/// <summary> | |||
/// 退款类型0:售前退款(商品未制作时退款) 1 售后退款 (商品已经开始进行制作) | |||
/// </summary> | |||
public System.Int32 RefundType { get; set; } | |||
/// <summary> | |||
/// 退款结果 0 成功 1失败 | |||
/// </summary> | |||
public System.Int32 RefundResult { get; set; } | |||
/// <summary> | |||
/// 退款描述 退款成功;账户余额不足;退款金额大于订单金额..etc | |||
/// </summary> | |||
public System.String RefundDesc { get; set; } | |||
/// <summary> | |||
/// 退款来源(退款到什么地方) 0微信 1支付宝 2 余额 | |||
/// </summary> | |||
public System.Int32 RefundSource { get; set; } | |||
/// <summary> | |||
/// 退款调用方式 0 小程序调用退款 1 saas调用退款 2 第三方调用退款 4.POS | |||
/// </summary> | |||
public System.Int32 RefundCallType { get; set; } | |||
/// <summary> | |||
/// 退款时间 | |||
/// </summary> | |||
public System.DateTime? RefundTime { get; set; } | |||
/// <summary> | |||
/// 创建于 | |||
/// </summary> | |||
public System.DateTime? CreatedAt { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
public System.String CreatedBy { get; set; } | |||
/// <summary> | |||
/// 更新于 | |||
/// </summary> | |||
public System.DateTime? UpdatedAt { get; set; } | |||
/// <summary> | |||
/// 更新人 | |||
/// </summary> | |||
public System.String UpdatedBy { get; set; } | |||
/// <summary> | |||
/// 退款状态 | |||
/// </summary> | |||
public RefundStatus Stutas { get; set; } | |||
public string GroupId { get; set; } | |||
} | |||
public enum RefundStatus | |||
{ | |||
/// <summary> | |||
/// 申请部分退款 | |||
/// </summary> | |||
PartRefund = 10, | |||
/// <summary> | |||
/// 部分退款处理中 | |||
/// </summary> | |||
PartRefundWait = 101, | |||
/// <summary> | |||
/// 部分退款成功 | |||
/// </summary> | |||
PartRefundOk = 102, | |||
/// <summary> | |||
/// 取消部分退款 | |||
/// </summary> | |||
PartRefundCancel = 103, | |||
/// <summary> | |||
/// 部分退款失败 | |||
/// </summary> | |||
PartRefundError = 104, | |||
/// <summary> | |||
/// 申请全额退款 | |||
/// </summary> | |||
FullRefund = 20, | |||
/// <summary> | |||
/// 全额退款处理中 | |||
/// </summary> | |||
FullRefundWait = 201, | |||
/// <summary> | |||
/// 全额退款成功 | |||
/// </summary> | |||
FullRefundOk = 202, | |||
/// <summary> | |||
/// 取消全额退款 | |||
/// </summary> | |||
FullRefundCancel = 203, | |||
/// <summary> | |||
/// 全额退款失败 | |||
/// </summary> | |||
FullRefundError = 204, | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
[SugarTable("BPA_ShopAuthorize")] | |||
public class BPA_ShopAuthorize: IBaseGroupIdEntity | |||
{ | |||
public string StoreId { get; set; } | |||
public string AuthorizeCode { get; set; } | |||
} | |||
} |
@@ -0,0 +1,107 @@ | |||
using SqlSugar; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
[SugarTable("BPA_SubOrder")] | |||
public class BPA_SubOrder | |||
{ | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 主订单表Id | |||
/// </summary> | |||
public string OrderId { get; set; } | |||
/// <summary> | |||
/// 商品表Id | |||
/// </summary> | |||
public string GoodId { get; set; } | |||
/// <summary> | |||
/// 设备id | |||
/// </summary> | |||
public string StoreId { get; set; } | |||
/// <summary> | |||
/// 应付款 | |||
/// </summary> | |||
public decimal GooodOriginPrice { get; set; } | |||
/// <summary> | |||
/// 商品平摊价格(实付款) | |||
/// </summary> | |||
public decimal GoodsRealPrice { get; set; } | |||
/// <summary> | |||
/// 备注 | |||
/// </summary> | |||
public string Remark { get; set; } | |||
/// <summary> | |||
/// 订单状态 1已下单(云服务将订单信息存放在redis) 2等待制作(上位机从redis取出) 3 制作中 4 制作完成待取餐 5 取餐完成 | |||
/// </summary> | |||
public int CookingStatus { get; set; } | |||
/// <summary> | |||
/// 废弃状态 0 正常 1 废弃 | |||
/// </summary> | |||
public int IsVaild { get; set; } | |||
/// <summary> | |||
/// 废弃时间 | |||
/// </summary> | |||
public string VaildTime { get; set; } | |||
/// <summary> | |||
/// 开始制作时间 cookingStatu更新为3时更新此字段 | |||
/// </summary> | |||
public string StartCookingTime { get; set; } | |||
/// <summary> | |||
/// 结束制作时间 cookingStatus跟新为4时更新此字段 | |||
/// </summary> | |||
public string EndCookingTime { get; set; } | |||
/// <summary> | |||
/// 完成取餐时间 cookingStatus更新为5时更新此字段 | |||
/// </summary> | |||
public string CompleteTakeTime { get; set; } | |||
/// <summary> | |||
/// 创建于 | |||
/// </summary> | |||
public string CreatedAt { get; set; } | |||
/// <summary> | |||
/// 创建人 | |||
/// </summary> | |||
public string CreatedBy { get; set; } | |||
/// <summary> | |||
/// 更新于 | |||
/// </summary> | |||
public string UpdatedAt { get; set; } | |||
/// <summary> | |||
/// 更新人 | |||
/// </summary> | |||
public string UpdatedBy { get; set; } | |||
/// <summary> | |||
/// 自动修改 记录最新的修改时间 | |||
/// </summary> | |||
public string UpdatedTs { get; set; } | |||
/// <summary> | |||
/// 排序 | |||
/// </summary> | |||
public string SortNumber { get; set; } | |||
/// <summary> | |||
/// 后厨小票打印次数 | |||
/// </summary> | |||
public int SalvePrintCount { get; set; } | |||
/// <summary> | |||
/// 做法Id | |||
/// </summary> | |||
public string MakeId { get; set; } | |||
/// <summary> | |||
/// 做法名称 | |||
/// </summary> | |||
public string MakeName { get; set; } | |||
/// <summary> | |||
/// 是否设备 | |||
/// </summary> | |||
public int IsDevice { get; set; } | |||
/// <summary> | |||
/// 是否赠送 true 赠送 | |||
/// </summary> | |||
public bool IsGift { get; set; } | |||
} | |||
} |
@@ -0,0 +1,22 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
[SugarTable("BPA_ThirdOrder")] | |||
public class BPA_ThirdOrder: IBaseGroupIdEntity | |||
{ | |||
public string OrderNum { get; set; } | |||
public string ThirdName { get; set; } | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity.Base; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
[SugarTable("BPA_ThirdOrderInfo")] | |||
public class BPA_ThirdOrderInfo: IBaseGroupIdEntity | |||
{ | |||
public string ThirdOrderId { get; set; } | |||
public string GoodsForeignKeyId { get; set; } | |||
public string GoodsName { get; set; } | |||
public decimal Count { get; set; } | |||
} | |||
} |
@@ -0,0 +1,23 @@ | |||
using Furion; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity.Base | |||
{ | |||
/// <summary> | |||
/// 基础类型 | |||
/// </summary> | |||
public abstract class IBaseEntity | |||
{ | |||
/// <summary> | |||
/// 主键 Guid | |||
/// </summary> | |||
[SugarColumn(IsPrimaryKey = true, ColumnDataType = "Nvarchar(64)", IsNullable = false)] | |||
public string Id { get; set; } = Guid.NewGuid().ToString(); | |||
} | |||
} |
@@ -0,0 +1,19 @@ | |||
| |||
using BPA.KitChen.StoreManagementOrder.Core.Common.Const; | |||
using Furion; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity.Base | |||
{ | |||
public class IBaseGroupIdEntity: IEntity | |||
{ | |||
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "GroupId", IsNullable = true)] | |||
public string GroupId { get; set; } = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
} | |||
} |
@@ -0,0 +1,128 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Common.Const; | |||
using Furion; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity.Base | |||
{ | |||
/// <summary> | |||
/// 修改人修改时间 | |||
/// </summary> | |||
public class IBaseOPEntity : IBaseEntity | |||
{ | |||
/// <summary> | |||
/// 删除标识 | |||
/// 0=> 正常使用 | |||
/// 1=> 已经被标记删除 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "是否删除", IsNullable = false)] | |||
public int IsDeleted { get; set; } = 0; | |||
/// <summary> | |||
/// 删除时间 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "删除时间", IsNullable = true)] | |||
public DateTime? DeleteAt { get; set; } | |||
/// <summary> | |||
/// 删除人 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "删除人", IsNullable = true)] | |||
public string DeleteBy { get; set; } | |||
/// <summary> | |||
/// 更新时间 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "DateTime", ColumnDescription = "更新时间", IsNullable = true)] | |||
public DateTime? UpdateAt { get; set; } | |||
/// <summary> | |||
/// 更新人 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "nvarchar(64)", ColumnDescription = "更新人", IsNullable = true)] | |||
public string UpdateBy { 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; } | |||
/// <summary> | |||
/// 新增 | |||
/// </summary> | |||
public virtual void Create() | |||
{ | |||
var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value; | |||
this.Id = Guid.NewGuid().ToString(); | |||
this.CreateAt = DateTime.Now; | |||
if (!string.IsNullOrEmpty(userId)) | |||
{ | |||
this.CreateBy = userId; | |||
} | |||
else | |||
{ | |||
this.CreateBy = "admin"; | |||
} | |||
} | |||
public virtual void Create(DateTime data) | |||
{ | |||
var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value; | |||
this.Id = Guid.NewGuid().ToString(); | |||
this.CreateAt = data; | |||
if (!string.IsNullOrEmpty(userId)) | |||
{ | |||
this.CreateBy = userId; | |||
} | |||
else | |||
{ | |||
this.CreateBy = "admin"; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改 | |||
/// </summary> | |||
public void Modify() | |||
{ | |||
var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value; | |||
this.UpdateAt = DateTime.Now; | |||
if (!string.IsNullOrEmpty(userId)) | |||
{ | |||
this.UpdateBy = userId; | |||
} | |||
else | |||
{ | |||
this.UpdateBy = "admin"; | |||
} | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
public void Delete() | |||
{ | |||
var userId = App.User?.FindFirst(ClaimConst.CLAINM_USERID)?.Value; | |||
var userName = App.User?.FindFirst(ClaimConst.CLAINM_ACCOUNT)?.Value; | |||
this.DeleteAt = DateTime.Now; | |||
if (!string.IsNullOrEmpty(userId)) | |||
{ | |||
this.DeleteBy = userId; | |||
} | |||
else | |||
{ | |||
this.DeleteBy = "admin"; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Enum; | |||
using Furion; | |||
using SqlSugar; | |||
using System; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity.Base | |||
{ | |||
/// <summary> | |||
/// 自定义实体基类 | |||
/// </summary> | |||
public abstract class IEntity: IBaseOPEntity | |||
{ | |||
/// <summary> | |||
/// 状态 | |||
/// </summary> | |||
[SugarColumn(ColumnDataType = "int", ColumnDescription = "状态", IsNullable = false)] | |||
public CommonStatus Status { get; set; } = CommonStatus.ENABLE; | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Entity | |||
{ | |||
internal class Class1 | |||
{ | |||
} | |||
} |
@@ -0,0 +1,27 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
/// <summary> | |||
/// 分账账户类型 | |||
/// </summary> | |||
public enum AccountType | |||
{ | |||
/// <summary> | |||
/// 商户 | |||
/// </summary> | |||
[Description("商户")] | |||
MERCHANT = 0, | |||
/// <summary> | |||
/// 个人 | |||
/// </summary> | |||
[Description("个人")] | |||
PERSONAL = 1, | |||
} | |||
} |
@@ -0,0 +1,95 @@ | |||
using System.ComponentModel; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
/// <summary> | |||
/// 公共状态 | |||
/// </summary> | |||
public enum CommonStatus | |||
{ | |||
/// <summary> | |||
/// 正常 | |||
/// </summary> | |||
[Description("正常")] | |||
ENABLE = 0, | |||
/// <summary> | |||
/// 停用 | |||
/// </summary> | |||
[Description("停用")] | |||
DISABLE = 1, | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
[Description("删除")] | |||
DELETED = 2 | |||
} | |||
public enum MenuTypeEnums | |||
{ | |||
/// <summary> | |||
/// 数据操作类型 | |||
/// </summary> | |||
Handle, | |||
/// <summary> | |||
/// 普通菜单 | |||
/// </summary> | |||
Normal | |||
} | |||
/// <summary> | |||
/// 账号类型 | |||
/// </summary> | |||
public enum AdminEnums | |||
{ | |||
/// <summary> | |||
/// 超级管理员 | |||
/// </summary> | |||
[Description("超级管理员")] | |||
SuperAdmin = 1, | |||
/// <summary> | |||
/// 管理员 | |||
/// </summary> | |||
[Description("管理员")] | |||
Admin = 2, | |||
/// <summary> | |||
/// 普通账号 | |||
/// </summary> | |||
[Description("普通账号")] | |||
None = 3 | |||
} | |||
/// <summary> | |||
/// 会员平台 | |||
/// </summary> | |||
public enum PlatformType | |||
{ | |||
/// <summary> | |||
/// 默认 | |||
/// </summary> | |||
[Description("默认")] | |||
Default = 0, | |||
/// <summary> | |||
/// 微信 | |||
/// </summary> | |||
[Description("微信")] | |||
WeChat=1, | |||
/// <summary> | |||
/// 支付宝 | |||
/// </summary> | |||
[Description("支付宝")] | |||
Alipay = 2, | |||
/// <summary> | |||
/// POS | |||
/// </summary> | |||
[Description("pos")] | |||
POS = 3, | |||
/// <summary> | |||
/// card | |||
/// </summary> | |||
[Description("储值卡")] | |||
Card = 4, | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public enum CouponUseType | |||
{ | |||
[Description("未使用")] | |||
NoUse=1, | |||
[Description("已核销")] | |||
WriteOff=2, | |||
[Description("占用中")] | |||
Occupied=3, | |||
[Description("已失效")] | |||
Invalidation=4 | |||
} | |||
} |
@@ -0,0 +1,42 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public enum DataScopeType | |||
{ | |||
/// <summary> | |||
/// 全部数据 | |||
/// </summary> | |||
[Description("全部数据")] | |||
ALL = 1, | |||
/// <summary> | |||
/// 本部门及以下数据 | |||
/// </summary> | |||
[Description("本部门及以下数据")] | |||
DEPT_WITH_CHILD = 2, | |||
/// <summary> | |||
/// 本部门数据 | |||
/// </summary> | |||
[Description("本部门数据")] | |||
DEPT = 3, | |||
/// <summary> | |||
/// 仅本人数据 | |||
/// </summary> | |||
[Description("仅本人数据")] | |||
SELF = 4, | |||
/// <summary> | |||
/// 自定义数据 | |||
/// </summary> | |||
[Description("自定义数据")] | |||
DEFINE = 5 | |||
} | |||
} |
@@ -0,0 +1,36 @@ | |||
/** | |||
* 命名空间: BPA.Kitchen.Core.Common.Enum | |||
* | |||
* 功 能: N/A | |||
* 类 名: GoodsAttribute | |||
* | |||
* Ver 变更日期 负责人 变更内容 | |||
* ─────────────────────────────────── | |||
* V0.01 2022/6/24 10:04:06 唐学波 初版 | |||
* | |||
* Copyright (c) 2022 BlackB Corporation. All rights reserved. | |||
*/ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
/// <summary> | |||
/// 商品属性 | |||
/// </summary> | |||
public enum GoodsAttribute | |||
{ | |||
/// <summary> | |||
/// 单品 | |||
/// </summary> | |||
SingleGoods = 0, | |||
/// <summary> | |||
/// 套餐 | |||
/// </summary> | |||
ComboGoods = 1, | |||
} | |||
} |
@@ -0,0 +1,44 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public class IntegralEnum | |||
{ | |||
public enum CalculateType | |||
{ | |||
积分方案 = 1, | |||
多倍积分 = 2, | |||
独立计算 = 3 | |||
} | |||
/// <summary> | |||
/// 积分增加/减少类型 | |||
/// </summary> | |||
public enum IntegSourceType | |||
{ | |||
订单消费 = 1, | |||
活动赠送 = 2, | |||
后台补充 = 3, | |||
积分兑换 = 4, | |||
} | |||
/// <summary> | |||
/// 小类方案类型 | |||
/// </summary> | |||
public enum allTypes | |||
{ | |||
common = 0, | |||
price = 1, | |||
big = 2, | |||
small = 3, | |||
count = 4, | |||
persons = 5, | |||
number = 6 | |||
} | |||
} | |||
} |
@@ -0,0 +1,34 @@ | |||
using System.ComponentModel; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
/// <summary> | |||
/// 系统菜单类型 | |||
/// </summary> | |||
public enum MenuOpenType | |||
{ | |||
/// <summary> | |||
/// 无 | |||
/// </summary> | |||
[Description("无")] | |||
NONE = 0, | |||
/// <summary> | |||
/// 组件 | |||
/// </summary> | |||
[Description("组件")] | |||
COMPONENT = 1, | |||
/// <summary> | |||
/// 内链 | |||
/// </summary> | |||
[Description("内链")] | |||
INNER = 2, | |||
/// <summary> | |||
/// 外链 | |||
/// </summary> | |||
[Description("外链")] | |||
OUTER = 3 | |||
} | |||
} |
@@ -0,0 +1,25 @@ | |||
using System.ComponentModel; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public enum MenuType | |||
{ | |||
/// <summary> | |||
/// 目录 | |||
/// </summary> | |||
[Description("目录")] | |||
DIR = 0, | |||
/// <summary> | |||
/// 菜单 | |||
/// </summary> | |||
[Description("菜单")] | |||
MENU = 1, | |||
/// <summary> | |||
/// 按钮 | |||
/// </summary> | |||
[Description("按钮")] | |||
BTN = 2 | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public class OrderEnum | |||
{ | |||
public enum SubOrderCookingStutas | |||
{ | |||
WaitMake = 0, | |||
Making = 1, | |||
WaitTake = 2, | |||
TakeCompleted = 3, | |||
Normal = 99998, | |||
Error = 99999 | |||
} | |||
} | |||
} |
@@ -0,0 +1,35 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public enum OrgType | |||
{ | |||
/// <summary> | |||
/// 机构部门 | |||
/// </summary> | |||
[Description("机构部门")] | |||
ORG = 0, | |||
/// <summary> | |||
/// 配送中心 | |||
/// </summary> | |||
[Description("配送中心")] | |||
DEVLIVERY = 1, | |||
/// <summary> | |||
/// 门店 | |||
/// </summary> | |||
[Description("门店")] | |||
STORE = 2, | |||
/// <summary> | |||
/// 门店 | |||
/// </summary> | |||
[Description("加盟店")] | |||
FranchiseeSTORE = 3 | |||
} | |||
} |
@@ -0,0 +1,39 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public enum SRDUserType | |||
{ | |||
/// <summary> | |||
/// 人员 | |||
/// </summary> | |||
[Description("人员")] | |||
USER = 0, | |||
/// <summary> | |||
/// 人员分类 | |||
/// </summary> | |||
[Description("人员分类")] | |||
USERTYPE = 1, | |||
} | |||
public enum RSDGroupType | |||
{ | |||
/// <summary> | |||
/// 设备 | |||
/// </summary> | |||
[Description("设备")] | |||
RSD = 0, | |||
/// <summary> | |||
/// 设备分组 | |||
/// </summary> | |||
[Description("设备分组")] | |||
RSDGROUP = 1, | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.ComponentModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public enum StatusEntity | |||
{ | |||
/// <summary> | |||
/// 正常 | |||
/// </summary> | |||
[Description("正常")] | |||
ENABLE = 0, | |||
/// <summary> | |||
/// 停用 | |||
/// </summary> | |||
[Description("停用")] | |||
DISABLE = 1, | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.Enum | |||
{ | |||
public enum TransactionType | |||
{ | |||
/// <summary> | |||
/// 充值 | |||
/// </summary> | |||
Recharge=1, | |||
/// <summary> | |||
/// 消费 | |||
/// </summary> | |||
Consume = 2, | |||
/// <summary> | |||
/// 退款 | |||
/// </summary> | |||
Refund = 3, | |||
} | |||
} |
@@ -0,0 +1,21 @@ | |||
using Furion; | |||
using Microsoft.AspNetCore.Http; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Core.RequestAnalysis | |||
{ | |||
public class UserAnalysis | |||
{ | |||
public UserAnalysis() | |||
{ | |||
//CurrentUser.AppId = App.HttpContext.Request.Headers["AppId"]; | |||
//CurrentUser.TenantId = App.HttpContext.Request.Headers["TenantId"]; | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
<Nullable>enable</Nullable> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.KitChen.GroupMealOrder.Core\BPA.KitChen.StoreManagementOrder.Core.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,201 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.Common; | |||
using BPA.KitChen.StoreManagementOrder.Core.Common.Const; | |||
using BPA.KitChen.StoreManagementOrder.Core.Entity.Base; | |||
using Furion; | |||
using Furion.DatabaseAccessor; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Linq.Dynamic.Core; | |||
using System.Linq.Expressions; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.SqlSugar | |||
{ | |||
public class SqlSugarDb | |||
{ | |||
public static SqlSugarScope Db { get; set; } | |||
public static SqlSugarScope SqlSugarScope(ConnectionConfig configConnection) | |||
{ | |||
//全局过滤 | |||
Db = new SqlSugarScope(configConnection, db => | |||
{ | |||
//全局过滤 | |||
TableFilterItem(db); | |||
db.Aop.OnLogExecuting = (sql, pars) => | |||
{ | |||
Console.WriteLine(sql); | |||
//sql 执行前 | |||
}; | |||
db.Aop.OnLogExecuted = (sql, pars) => | |||
{ | |||
//sql 执行后 | |||
}; | |||
db.Aop.OnError = ex => | |||
{ | |||
//sql 异常 | |||
}; | |||
}); | |||
return Db; | |||
} | |||
#region 全局过滤器及配置 | |||
/// <summary> | |||
/// 全局过滤 | |||
/// </summary> | |||
private static void TableFilterItem(SqlSugarClient db) | |||
{ | |||
//添加默认值 | |||
DataExecuting(db); | |||
//// 配置租户过滤器 | |||
//var tenantId = App.User?.FindFirst(ClaimConst.GroupId)?.Value; | |||
//db.QueryFilter.AddTableFilter<IBaseGroupIdEntity>(u => u.GroupId == tenantId); | |||
//db.QueryFilter.AddTableFilter<IBaseOPEntity>(u => u.IsDeleted ==0); | |||
var types = Assembly.Load("BPA.KitChen.StoreManagementOrder.Core").GetTypes() | |||
.Where(x => x.GetCustomAttribute<SugarTable>() != null); | |||
foreach (var entityType in types) | |||
{ | |||
if (entityType.GetProperty("GroupId") != null)//判断实体类中包含属性 | |||
{ | |||
var groupId = string.IsNullOrWhiteSpace(CurrentUser.TenantId) | |||
? App.User?.FindFirst(ClaimConst.GroupId)?.Value | |||
: CurrentUser.TenantId; | |||
//构建动态Lambda | |||
var lambda = DynamicExpressionParser.ParseLambda | |||
(new[] { Expression.Parameter(entityType, "it") }, | |||
typeof(bool), $"{nameof(IBaseGroupIdEntity.GroupId)} == @0", | |||
groupId); | |||
db.QueryFilter.Add(new TableFilterItem<object>(entityType, lambda, true)); //将Lambda传入过滤器 | |||
} | |||
if (entityType.GetProperty("IsDeleted") != null) //判断实体类中包含属性 | |||
{ | |||
//构建动态Lambda | |||
var lambda = DynamicExpressionParser.ParseLambda | |||
(new[] { Expression.Parameter(entityType, "it") }, | |||
typeof(bool), $"{nameof(IBaseOPEntity.IsDeleted)} == @0", | |||
0); | |||
db.QueryFilter.Add(new TableFilterItem<object>(entityType, lambda, true)); //将Lambda传入过滤器 | |||
} | |||
} | |||
//var types = Assembly.Load("BPA.KitChen.StoreManagementOrder.Core").GetTypes() | |||
// .Where(x => x.Namespace != null | |||
// && x.GetCustomAttribute<SugarTable>() != null | |||
// && x.Namespace.Contains("BPA.KitChen.StoreManagementOrder.Core.Entity")); | |||
//foreach (var entityType in types) | |||
//{ | |||
// if (entityType.GetProperty("GroupId") != null)//判断实体类中包含属性 | |||
// { | |||
// //构建动态Lambda | |||
// var lambda = DynamicExpressionParser.ParseLambda | |||
// (new[] { Expression.Parameter(entityType, "it") }, | |||
// typeof(bool), $"{nameof(ITenantIdFilter.GroupId)} == @0", | |||
// CurrentUser.GroupId); | |||
// db.QueryFilter.Add(new TableFilterItem<object>(entityType, lambda, true)); //将Lambda传入过滤器 | |||
// } | |||
// if (entityType.GetProperty("IsDelete") != null) //判断实体类中包含属性 | |||
// { | |||
// //构建动态Lambda | |||
// var lambda = DynamicExpressionParser.ParseLambda | |||
// (new[] { Expression.Parameter(entityType, "it") }, | |||
// typeof(bool), $"{nameof(IDeletedFilter.IsDelete)} == @0", | |||
// false); | |||
// db.QueryFilter.Add(new TableFilterItem<object>(entityType, lambda, true)); //将Lambda传入过滤器 | |||
// } | |||
//} | |||
} | |||
/// <summary> | |||
/// 附默认值 | |||
/// </summary> | |||
/// <param name="db"></param> | |||
private static void DataExecuting(SqlSugarClient db) | |||
{ | |||
//全局字段赋值 | |||
db.Aop.DataExecuting = (oldValue, entityInfo) => | |||
{ | |||
InsertByObject(entityInfo); | |||
UpdateByObject(oldValue, entityInfo); | |||
}; | |||
} | |||
/// <summary> | |||
///插入数据时附默认值 | |||
/// </summary> | |||
/// <param name="entityInfo"></param> | |||
private static void InsertByObject(DataFilterModel entityInfo) | |||
{ | |||
if (entityInfo.OperationType != DataFilterType.InsertByObject) return; | |||
switch (entityInfo.PropertyName) | |||
{ | |||
case "CreateAt": | |||
entityInfo.SetValue(DateTime.Now); | |||
break; | |||
case "CreateBy": | |||
entityInfo.SetValue(CurrentUser.Account); | |||
break; | |||
case "GroupId": | |||
entityInfo.SetValue(CurrentUser.TenantId); | |||
break; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改数据时附默认值 | |||
/// </summary> | |||
/// <param name="oldValue"></param> | |||
/// <param name="entityInfo"></param> | |||
private static void UpdateByObject(object oldValue, DataFilterModel entityInfo) | |||
{ | |||
if (entityInfo.OperationType != DataFilterType.UpdateByObject) return; | |||
switch (entityInfo.PropertyName) | |||
{ | |||
case "UpdateAt": | |||
entityInfo.SetValue(DateTime.Now); | |||
break; | |||
case "UpdateBy": | |||
entityInfo.SetValue(CurrentUser.Account); | |||
break; | |||
} | |||
//if (entityInfo.PropertyName == "IsDelete" && (bool)oldValue) | |||
//{ | |||
// switch (entityInfo.PropertyName) | |||
// { | |||
// case "DeleteAt": | |||
// entityInfo.SetValue(DateTime.Now); | |||
// break; | |||
// case "DeleteBy": | |||
// entityInfo.SetValue(CurrentUser.Account); | |||
// break; | |||
// } | |||
//} | |||
//else | |||
//{ | |||
//} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -0,0 +1,31 @@ | |||
using Furion; | |||
using Microsoft.Extensions.DependencyInjection; | |||
using SqlSugar; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.SqlSugar | |||
{ | |||
public static class SqlsugarSetup | |||
{ | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="services"></param> | |||
public static void AddSqlsugarSetup(this IServiceCollection services) | |||
{ | |||
//如果多个数数据库传 List<ConnectionConfig> | |||
var configConnection = new ConnectionConfig() | |||
{ | |||
DbType = DbType.MySql, | |||
ConnectionString = App.Configuration["DBConnectionStr"], | |||
IsAutoCloseConnection = true | |||
}; | |||
var sqlSugar = SqlSugarDb.SqlSugarScope(configConnection); | |||
services.AddSingleton<ISqlSugarClient>(sqlSugar);//这边是SqlSugarScope用AddSingleton | |||
} | |||
} | |||
} |
@@ -0,0 +1,26 @@ | |||
using BPA.KitChen.StoreManagementOrder.Core.RequestAnalysis; | |||
using Furion.FriendlyException; | |||
using SqlSugar; | |||
namespace BPA.KitChen.StoreManagementOrder.SqlSugar | |||
{ | |||
public class SupperRepository: UserAnalysis | |||
{ | |||
public async Task<T> BaseAction<T>(SqlSugarClient db, Func<T> action, Func<T> defualtActoion, string msg) | |||
{ | |||
try | |||
{ | |||
db.BeginTran(); | |||
var res = action.Invoke(); | |||
db.CommitTran(); | |||
return await Task.FromResult(res); | |||
} | |||
catch (Exception ex) | |||
{ | |||
db.RollbackTran(); | |||
//BPALog.WriteLog(msg + ":" + ex.Message, LogEnum.Error, null, ex); | |||
throw Oops.Oh(ex.Message); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,15 @@ | |||
<Project Sdk="Microsoft.NET.Sdk.Web"> | |||
<PropertyGroup> | |||
<TargetFramework>net6.0</TargetFramework> | |||
<Nullable>enable</Nullable> | |||
<ImplicitUsings>enable</ImplicitUsings> | |||
</PropertyGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPA.KitChen.GroupMealOrder.Application\BPA.KitChen.StoreManagementOrder.Application.csproj" /> | |||
<ProjectReference Include="..\BPA.KitChen.GroupMealOrder.Core\BPA.KitChen.StoreManagementOrder.Core.csproj" /> | |||
<ProjectReference Include="..\BPA.KitChen.GroupMealOrder.SqlSugar\BPA.KitChen.StoreManagementOrder.SqlSugar.csproj" /> | |||
</ItemGroup> | |||
</Project> |
@@ -0,0 +1,33 @@ | |||
using Microsoft.AspNetCore.Mvc; | |||
namespace BPA.KitChen.StoreManagementOrder.Controllers | |||
{ | |||
[ApiController] | |||
[Route("[controller]")] | |||
public class WeatherForecastController : ControllerBase | |||
{ | |||
private static readonly string[] Summaries = new[] | |||
{ | |||
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" | |||
}; | |||
private readonly ILogger<WeatherForecastController> _logger; | |||
public WeatherForecastController(ILogger<WeatherForecastController> logger) | |||
{ | |||
_logger = logger; | |||
} | |||
[HttpGet] | |||
public IEnumerable<WeatherForecast> Get() | |||
{ | |||
return Enumerable.Range(1, 5).Select(index => new WeatherForecast | |||
{ | |||
Date = DateTime.Now.AddDays(index), | |||
TemperatureC = Random.Shared.Next(-20, 55), | |||
Summary = Summaries[Random.Shared.Next(Summaries.Length)] | |||
}) | |||
.ToArray(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,80 @@ | |||
using Furion; | |||
using Furion.Authorization; | |||
using Furion.DataEncryption; | |||
using Microsoft.AspNetCore.Authorization; | |||
using Microsoft.AspNetCore.Http; | |||
using Microsoft.Extensions.DependencyInjection; | |||
using System.Security.Claims; | |||
using System.Threading.Tasks; | |||
namespace BPA.KitChen.StoreManagementOrder.Handlers | |||
{ | |||
public class JwtHandler : AppAuthorizeHandler | |||
{ | |||
/// <summary> | |||
/// 重写 Handler 添加自动刷新 | |||
/// </summary> | |||
/// <param name="context"></param> | |||
/// <returns></returns> | |||
public override async Task HandleAsync(AuthorizationHandlerContext context) | |||
{ | |||
// 自动刷新Token | |||
if (JWTEncryption.AutoRefreshToken(context, context.GetCurrentHttpContext(), | |||
App.GetOptions<JWTSettingsOptions>().ExpiredTime)) | |||
{ | |||
await AuthorizeHandleAsync(context); | |||
} | |||
else | |||
{ | |||
context.Fail(); // 授权失败 | |||
DefaultHttpContext currentHttpContext = context.GetCurrentHttpContext(); | |||
if (currentHttpContext == null) | |||
return; | |||
currentHttpContext.SignoutToSwagger(); | |||
} | |||
} | |||
/// <summary> | |||
/// 授权判断逻辑,授权通过返回 true,否则返回 false | |||
/// </summary> | |||
/// <param name="context"></param> | |||
/// <param name="httpContext"></param> | |||
/// <returns></returns> | |||
public override async Task<bool> PipelineAsync(AuthorizationHandlerContext context, DefaultHttpContext httpContext) | |||
{ | |||
// 此处已经自动验证 Jwt Token的有效性了,无需手动验证 | |||
return await CheckAuthorzieAsync(httpContext); | |||
} | |||
/// <summary> | |||
/// 检查权限 | |||
/// </summary> | |||
/// <param name="httpContext"></param> | |||
/// <returns></returns> | |||
private static async Task<bool> CheckAuthorzieAsync(DefaultHttpContext httpContext) | |||
{ | |||
// 获取权限特性 FromHeader教研数据 | |||
//var securityDefineAttribute = httpContext.GetMetadata<SecurityDefineAttribute>(); | |||
//if (securityDefineAttribute == null) return true; | |||
var userId = App.User?.FindFirstValue("UserId"); | |||
// 解析服务 | |||
// var userManager = httpContext.RequestServices.GetService<IUserService>(); | |||
// var loginType = App.User?.FindFirstValue("LoginType"); | |||
//登录认证服务 | |||
return true; | |||
//if ("0".Equals(loginType)) { | |||
// var securities = await userManager.CheckUser(userId); | |||
// // 检查授权 | |||
// return securities; | |||
//} | |||
//if ("1".Equals(loginType)) { | |||
// var securities = await userManager.CheckUser(userId); | |||
// // 检查授权 | |||
// return securities; | |||
//} | |||
//return false; | |||
} | |||
} | |||
} |
@@ -0,0 +1,29 @@ | |||
using BPA.KitChen.StoreManagementOrder.Handlers; | |||
using BPA.KitChen.StoreManagementOrder.SqlSugar; | |||
var builder = WebApplication.CreateBuilder(args).Inject(); | |||
//JWT¼øȨ | |||
builder.Services.AddJwt<JwtHandler>(enableGlobalAuthorize: true); | |||
//ÉèÖ÷µ»ØÑùʽ | |||
builder.Services.AddUnifyResult(); | |||
builder.Services.AddControllers().AddInject(); | |||
builder.Services.AddSqlsugarSetup(); | |||
var app = builder.Build(); | |||
// Configure the HTTP request pipeline. | |||
app.UseHttpsRedirection(); | |||
app.UseAuthentication(); | |||
app.UseAuthorization(); | |||
app.UseInject(); | |||
app.MapControllers(); | |||
app.Run(); |
@@ -0,0 +1,31 @@ | |||
{ | |||
"$schema": "https://json.schemastore.org/launchsettings.json", | |||
"iisSettings": { | |||
"windowsAuthentication": false, | |||
"anonymousAuthentication": true, | |||
"iisExpress": { | |||
"applicationUrl": "http://localhost:41386", | |||
"sslPort": 44336 | |||
} | |||
}, | |||
"profiles": { | |||
"BPA.KitChen.StoreManagementOrder": { | |||
"commandName": "Project", | |||
"dotnetRunMessages": true, | |||
"launchBrowser": true, | |||
"launchUrl": "api/index.html", | |||
"applicationUrl": "http://localhost:5248", | |||
"environmentVariables": { | |||
"ASPNETCORE_ENVIRONMENT": "Development" | |||
} | |||
}, | |||
"IIS Express": { | |||
"commandName": "IISExpress", | |||
"launchBrowser": true, | |||
"launchUrl": "weatherforecast", | |||
"environmentVariables": { | |||
"ASPNETCORE_ENVIRONMENT": "Development" | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,13 @@ | |||
namespace BPA.KitChen.StoreManagementOrder | |||
{ | |||
public class WeatherForecast | |||
{ | |||
public DateTime Date { get; set; } | |||
public int TemperatureC { get; set; } | |||
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); | |||
public string? Summary { get; set; } | |||
} | |||
} |
@@ -0,0 +1,8 @@ | |||
{ | |||
"Logging": { | |||
"LogLevel": { | |||
"Default": "Information", | |||
"Microsoft.AspNetCore": "Warning" | |||
} | |||
} | |||
} |
@@ -0,0 +1,11 @@ | |||
{ | |||
"Logging": { | |||
"LogLevel": { | |||
"Default": "Information", | |||
"Microsoft.AspNetCore": "Warning" | |||
} | |||
}, | |||
"SAAS_Manage": "http://10.2.1.26:21995/saasbase/", | |||
"DBConnectionStr": "server=10.2.1.21;Port=3306;Database=bpa_kitchen_storemanage;Uid=root;Pwd=cygadmin;", | |||
"AllowedHosts": "*" | |||
} |
@@ -0,0 +1,43 @@ | |||
| |||
Microsoft Visual Studio Solution File, Format Version 12.00 | |||
# Visual Studio Version 17 | |||
VisualStudioVersion = 17.7.34024.191 | |||
MinimumVisualStudioVersion = 10.0.40219.1 | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.KitChen.StoreManagementOrder", "BPA.KitChen.GroupMealOrder\BPA.KitChen.StoreManagementOrder.csproj", "{0D85BD1B-9687-4810-8116-68B0DF89AE94}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.KitChen.StoreManagementOrder.Application", "BPA.KitChen.GroupMealOrder.Application\BPA.KitChen.StoreManagementOrder.Application.csproj", "{5E78CC44-C084-4EDD-B61E-5850536497D6}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.KitChen.StoreManagementOrder.Core", "BPA.KitChen.GroupMealOrder.Core\BPA.KitChen.StoreManagementOrder.Core.csproj", "{9206A225-72CA-4E24-89D1-340BE1B33C69}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPA.KitChen.StoreManagementOrder.SqlSugar", "BPA.KitChen.GroupMealOrder.SqlSugar\BPA.KitChen.StoreManagementOrder.SqlSugar.csproj", "{763BBA2C-58A4-4FD0-9E0E-0C615D96E3A9}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||
Debug|Any CPU = Debug|Any CPU | |||
Release|Any CPU = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | |||
{0D85BD1B-9687-4810-8116-68B0DF89AE94}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{0D85BD1B-9687-4810-8116-68B0DF89AE94}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{0D85BD1B-9687-4810-8116-68B0DF89AE94}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{0D85BD1B-9687-4810-8116-68B0DF89AE94}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{5E78CC44-C084-4EDD-B61E-5850536497D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{5E78CC44-C084-4EDD-B61E-5850536497D6}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{5E78CC44-C084-4EDD-B61E-5850536497D6}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{5E78CC44-C084-4EDD-B61E-5850536497D6}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{9206A225-72CA-4E24-89D1-340BE1B33C69}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{9206A225-72CA-4E24-89D1-340BE1B33C69}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{9206A225-72CA-4E24-89D1-340BE1B33C69}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{9206A225-72CA-4E24-89D1-340BE1B33C69}.Release|Any CPU.Build.0 = Release|Any CPU | |||
{763BBA2C-58A4-4FD0-9E0E-0C615D96E3A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | |||
{763BBA2C-58A4-4FD0-9E0E-0C615D96E3A9}.Debug|Any CPU.Build.0 = Debug|Any CPU | |||
{763BBA2C-58A4-4FD0-9E0E-0C615D96E3A9}.Release|Any CPU.ActiveCfg = Release|Any CPU | |||
{763BBA2C-58A4-4FD0-9E0E-0C615D96E3A9}.Release|Any CPU.Build.0 = Release|Any CPU | |||
EndGlobalSection | |||
GlobalSection(SolutionProperties) = preSolution | |||
HideSolutionNode = FALSE | |||
EndGlobalSection | |||
GlobalSection(ExtensibilityGlobals) = postSolution | |||
SolutionGuid = {A6F1BEE2-DDAD-41B6-8AF5-1A84ABF72DEA} | |||
EndGlobalSection | |||
EndGlobal |