Sfoglia il codice sorgente

添加项目文件。

master
HBL 2 anni fa
parent
commit
841b996bc2
27 ha cambiato i file con 1271 aggiunte e 0 eliminazioni
  1. +25
    -0
      .dockerignore
  2. +25
    -0
      DataV.sln
  3. +52
    -0
      DataV/App/DataVApplication.cs
  4. +19
    -0
      DataV/DataV.csproj
  5. +314
    -0
      DataV/DataV.xml
  6. +27
    -0
      DataV/Enums/AfterEnum.cs
  7. +33
    -0
      DataV/Enums/CookEnum.cs
  8. +27
    -0
      DataV/Enums/OrderTypeEnum.cs
  9. +27
    -0
      DataV/Enums/PayEnum.cs
  10. +31
    -0
      DataV/Enums/PayModelEnum.cs
  11. +75
    -0
      DataV/Model/BPA_Order.cs
  12. +29
    -0
      DataV/Model/BPA_StoreInfo.cs
  13. +48
    -0
      DataV/Model/BPA_SubOrder.cs
  14. +15
    -0
      DataV/Model/BasicEntity.cs
  15. +22
    -0
      DataV/Model/BasicEntityRead.cs
  16. +27
    -0
      DataV/Program.cs
  17. +28
    -0
      DataV/Properties/launchSettings.json
  18. +14
    -0
      DataV/Result.cs
  19. +259
    -0
      DataV/Service/DataVService.cs
  20. +13
    -0
      DataV/Service/Dto/DataVDto.cs
  21. +8
    -0
      DataV/Service/Dto/LocDto.cs
  22. +22
    -0
      DataV/Service/IDataVService.cs
  23. +27
    -0
      DataV/SqlDbContext.cs
  24. +48
    -0
      DataV/Startup.cs
  25. +17
    -0
      DataV/appsettings.json
  26. +32
    -0
      Dockerfile
  27. +7
    -0
      NuGet.config

+ 25
- 0
.dockerignore Vedi File

@@ -0,0 +1,25 @@
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/azds.yaml
**/bin
**/charts
**/docker-compose*
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md

+ 25
- 0
DataV.sln Vedi File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.32126.315
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataV", "DataV\DataV.csproj", "{DF0C496F-1683-4B82-A6B9-63B961A17067}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DF0C496F-1683-4B82-A6B9-63B961A17067}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF0C496F-1683-4B82-A6B9-63B961A17067}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF0C496F-1683-4B82-A6B9-63B961A17067}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF0C496F-1683-4B82-A6B9-63B961A17067}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DBDD0A53-9FC4-486D-890D-0BDA45DE92B8}
EndGlobalSection
EndGlobal

+ 52
- 0
DataV/App/DataVApplication.cs Vedi File

@@ -0,0 +1,52 @@
using DataV.Service;
using DataV.Service.Dto;
using Furion.DynamicApiController;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataV.App
{
[ApiDescriptionSettings("DataV", Tag = "大屏服务", SplitCamelCase = false), Route("/screen"), NonUnify]
public class DataVApplication : IDynamicApiController
{
private IDataVService DataV;
public DataVApplication(IDataVService DataV)
{
this.DataV = DataV;
}
/// <summary>
/// 统计订单
/// </summary>
/// <returns></returns>
[HttpPost]
public Result<object> GetAllOrderDataState(DataVDto input) => DataV.GetAllOrderDataState(input.AutoKey);

/// <summary>
/// 订单日活
/// </summary>
/// <returns></returns>
[HttpPost]
public Result<object> OrderLine(DataVDto input) => DataV.OrderLine(input.AutoKey);
/// <summary>
/// 顶数量
/// </summary>
/// <returns></returns>
[HttpPost]
public Result<object> OrderNumber(DataVDto input) => DataV.OrderNumber(input.AutoKey);
/// <summary>
/// 获取加盟商设备列表
/// </summary>
/// <returns></returns>
[HttpGet]
public Result<Dictionary<string, List<int>>> OnlineDevice() => DataV.OnlineDevice();
/// <summary>
/// 区域饼状图统计
/// </summary>
/// <returns></returns>
[HttpGet]
public Result<object> GetLocSale() => DataV.GetLocSale();
}
}

+ 19
- 0
DataV/DataV.csproj Vedi File

@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>D:\Codes\DataV\DataV\DataV.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="BPA.ApolloClient" Version="1.0.9" />
<PackageReference Include="Furion" Version="3.1.4" />
<PackageReference Include="Furion.Extras.ObjectMapper.Mapster" Version="3.1.4" />
<PackageReference Include="SqlSugarCore" Version="5.0.7.5" />
<PackageReference Include="XExten.Advance" Version="1.1.3.3" />
</ItemGroup>

</Project>

+ 314
- 0
DataV/DataV.xml Vedi File

@@ -0,0 +1,314 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>DataV</name>
</assembly>
<members>
<member name="M:DataV.App.DataVApplication.GetAllOrderDataState(DataV.Service.Dto.DataVDto)">
<summary>
统计订单
</summary>
<returns></returns>
</member>
<member name="M:DataV.App.DataVApplication.OrderLine(DataV.Service.Dto.DataVDto)">
<summary>
订单日活
</summary>
<returns></returns>
</member>
<member name="M:DataV.App.DataVApplication.OrderNumber(DataV.Service.Dto.DataVDto)">
<summary>
顶数量
</summary>
<returns></returns>
</member>
<member name="M:DataV.App.DataVApplication.OnlineDevice">
<summary>
获取加盟商设备列表
</summary>
<returns></returns>
</member>
<member name="M:DataV.App.DataVApplication.GetLocSale">
<summary>
区域饼状图统计
</summary>
<returns></returns>
</member>
<member name="F:DataV.Enums.AfterEnum.Cancel">
<summary>
取消售后
</summary>
</member>
<member name="F:DataV.Enums.AfterEnum.Apply">
<summary>
申请售后
</summary>
</member>
<member name="F:DataV.Enums.AfterEnum.Wait">
<summary>
等待处理
</summary>
</member>
<member name="F:DataV.Enums.AfterEnum.Ok">
<summary>
处理完成
</summary>
</member>
<member name="F:DataV.Enums.CookEnum.WaitMake">
<summary>
等待制作
</summary>
</member>
<member name="F:DataV.Enums.CookEnum.Making">
<summary>
制作中
</summary>
</member>
<member name="F:DataV.Enums.CookEnum.WaitTake">
<summary>
等待取餐
</summary>
</member>
<member name="F:DataV.Enums.CookEnum.TakeCompleted">
取餐完成
</member>
<member name="F:DataV.Enums.CookEnum.Normal">
<summary>
正常订单
</summary>
</member>
<member name="F:DataV.Enums.CookEnum.Error">
<summary>
异常订单数据不会放入redis
</summary>
</member>
<member name="F:DataV.Enums.OrderTypeEnum.Normal">
<summary>
正常
</summary>
</member>
<member name="F:DataV.Enums.OrderTypeEnum.RightNow">
<summary>
立即吃面2
</summary>
</member>
<member name="F:DataV.Enums.OrderTypeEnum.Box">
<summary>
盲盒
</summary>
</member>
<member name="F:DataV.Enums.OrderTypeEnum.Other">
<summary>
其他
</summary>
</member>
<member name="F:DataV.Enums.PayEnum.NoPay">
<summary>
未支付
</summary>
</member>
<member name="F:DataV.Enums.PayEnum.PayOk">
<summary>
已支付
</summary>
</member>
<member name="F:DataV.Enums.PayEnum.PayCancel">
<summary>
支付取消
</summary>
</member>
<member name="F:DataV.Enums.PayEnum.Refund">
<summary>
已退单
</summary>
</member>
<member name="F:DataV.Enums.PayModelEnum.WeiXin">
<summary>
微信
</summary>
</member>
<member name="F:DataV.Enums.PayModelEnum.AliPay">
<summary>
支付宝
</summary>
</member>
<member name="F:DataV.Enums.PayModelEnum.Wallet">
<summary>
钱包
</summary>
</member>
<member name="F:DataV.Enums.PayModelEnum.UnionPay">
<summary>
银联
</summary>
</member>
<member name="F:DataV.Enums.PayModelEnum.Other">
<summary>
其他
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.SortId">
<summary>
排序号
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.CustomerId">
<summary>
用户Id
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.OrderStatus">
<summary>
支付状态<see cref="T:DataV.Enums.PayEnum"/>
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.AfterStatus">
<summary>
售后状态<see cref="T:DataV.Enums.AfterEnum"/>
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.OrderCount">
<summary>
数量
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.OrderOriginalMoney">
<summary>
商品总价
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.DiscountMoney">
<summary>
折扣价格
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.OrderRealMoney">
<summary>
实际支付价格
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.PayMode">
<summary>
支付方式<see cref="T:DataV.Enums.PayModelEnum"/>
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.OrderNumber">
<summary>
订单号
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.TradeNo">
<summary>
订单号(第三方)
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.TransactionId">
<summary>
流水号
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.OrderType">
<summary>
订单类型 <see cref="T:DataV.Enums.OrderTypeEnum"/>
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.TroikaId">
<summary>
OpenId
</summary>
</member>
<member name="P:DataV.Model.BPA_Order.OrderSourceFrom">
<summary>
订单
</summary>
</member>
<member name="P:DataV.Model.BPA_StoreInfo.AutoKey">
<summary>
与上位机映射ID
</summary>
</member>
<member name="P:DataV.Model.BPA_StoreInfo.CheckStock">
<summary>
校验库存
</summary>
</member>
<member name="P:DataV.Model.BPA_StoreInfo.Store_Name">
<summary>
店铺名称
</summary>
</member>
<member name="P:DataV.Model.BPA_StoreInfo.Store_TypeId">
<summary>
店铺类型
</summary>
</member>
<member name="P:DataV.Model.BPA_SubOrder.GooodOriginPrice">
<summary>
原价
</summary>
</member>
<member name="P:DataV.Model.BPA_SubOrder.GoodsRealPrice">
<summary>
实际金额
</summary>
</member>
<member name="P:DataV.Model.BPA_SubOrder.Remark">
<summary>
备注
</summary>
</member>
<member name="P:DataV.Model.BPA_SubOrder.CookingStatus">
<summary>
订单状态<see cref="T:DataV.Enums.CookEnum"/>
</summary>
</member>
<member name="P:DataV.Model.BPA_SubOrder.IsVaild">
<summary>
废弃状态 0 正常 1 废弃
</summary>
</member>
<member name="P:DataV.Model.BPA_SubOrder.VaildTime">
<summary>
废弃时间
</summary>
</member>
<member name="P:DataV.Model.BPA_SubOrder.SortNumber">
<summary>
订单序号
</summary>
</member>
<member name="M:DataV.Service.DataVService.GetAllOrderDataState(System.Nullable{System.Int32})">
<summary>
大屏数据
</summary>
<param name="autokey"></param>
<returns></returns>
</member>
<member name="M:DataV.Service.DataVService.OnlineDevice">
<summary>
设备
</summary>
<returns></returns>
</member>
<member name="M:DataV.Service.DataVService.OrderLine(System.Nullable{System.Int32})">
<summary>
折线图
</summary>
<param name="autokey"></param>
<returns></returns>
</member>
<member name="M:DataV.Service.DataVService.OrderNumber(System.Nullable{System.Int32})">
<summary>
下单数量
</summary>
<param name="autokey"></param>
<returns></returns>
</member>
<member name="M:DataV.Service.DataVService.GetLocSale">
<summary>
区域销售
</summary>
<returns></returns>
</member>
</members>
</doc>

+ 27
- 0
DataV/Enums/AfterEnum.cs Vedi File

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

namespace DataV.Enums
{
public enum AfterEnum
{
/// <summary>
/// 取消售后
/// </summary>
Cancel,
/// <summary>
/// 申请售后
/// </summary>
Apply,
/// <summary>
/// 等待处理
/// </summary>
Wait,
/// <summary>
/// 处理完成
/// </summary>
Ok
}
}

+ 33
- 0
DataV/Enums/CookEnum.cs Vedi File

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

namespace DataV.Enums
{
public enum CookEnum
{
/// <summary>
/// 等待制作
/// </summary>
WaitMake,
/// <summary>
/// 制作中
/// </summary>
Making,
/// <summary>
/// 等待取餐
/// </summary>
WaitTake,
///取餐完成
TakeCompleted,
/// <summary>
/// 正常订单
/// </summary>
Normal = 99998,
/// <summary>
/// 异常订单数据不会放入redis
/// </summary>
Error = 99999
}
}

+ 27
- 0
DataV/Enums/OrderTypeEnum.cs Vedi File

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

namespace DataV.Enums
{
public enum OrderTypeEnum
{
/// <summary>
/// 正常
/// </summary>
Normal,
/// <summary>
/// 立即吃面2
/// </summary>
RightNow,
/// <summary>
/// 盲盒
/// </summary>
Box,
/// <summary>
/// 其他
/// </summary>
Other
}
}

+ 27
- 0
DataV/Enums/PayEnum.cs Vedi File

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

namespace DataV.Enums
{
public enum PayEnum
{
/// <summary>
/// 未支付
/// </summary>
NoPay,
/// <summary>
/// 已支付
/// </summary>
PayOk,
/// <summary>
/// 支付取消
/// </summary>
PayCancel,
/// <summary>
/// 已退单
/// </summary>
Refund
}
}

+ 31
- 0
DataV/Enums/PayModelEnum.cs Vedi File

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

namespace DataV.Enums
{
public enum PayModelEnum
{
/// <summary>
/// 微信
/// </summary>
WeiXin,
/// <summary>
/// 支付宝
/// </summary>
AliPay,
/// <summary>
/// 钱包
/// </summary>
Wallet,
/// <summary>
/// 银联
/// </summary>
UnionPay,
/// <summary>
/// 其他
/// </summary>
Other,
}
}

+ 75
- 0
DataV/Model/BPA_Order.cs Vedi File

@@ -0,0 +1,75 @@
using DataV.Enums;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataV.Model
{
[SugarTable("BPA_Order")]
public class BPA_Order : BasicEntity
{
/// <summary>
/// 排序号
/// </summary>
public string SortId { get; set; }
/// <summary>
/// 用户Id
/// </summary>
public string CustomerId { get; set; }
/// <summary>
/// 支付状态<see cref="PayEnum"/>
/// </summary>
public PayEnum OrderStatus { get; set; }
/// <summary>
/// 售后状态<see cref="AfterEnum"/>
/// </summary>
public AfterEnum 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>
/// 支付方式<see cref="PayModelEnum"/>
/// </summary>
public PayModelEnum 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>
/// 订单类型 <see cref="OrderTypeEnum"/>
/// </summary>
public OrderTypeEnum OrderType { get; set; }
/// <summary>
/// OpenId
/// </summary>
public string TroikaId { get; set; }
/// <summary>
/// 订单
/// </summary>
public int OrderSourceFrom { get; set; }
public string Remark { get; set; }
}
}

+ 29
- 0
DataV/Model/BPA_StoreInfo.cs Vedi File

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

namespace DataV.Model
{
[SugarTable("BPA_StoreInfo")]
public class BPA_StoreInfo : BasicEntityRead
{
/// <summary>
/// 与上位机映射ID
/// </summary>
public int AutoKey { get; set; }
/// <summary>
/// 校验库存
/// </summary>
public bool CheckStock { get; set; }
/// <summary>
/// 店铺名称
/// </summary>
public string Store_Name { get; set; }
/// <summary>
/// 店铺类型
/// </summary>
public string Store_TypeId { get; set; }
}
}

+ 48
- 0
DataV/Model/BPA_SubOrder.cs Vedi File

@@ -0,0 +1,48 @@
using DataV.Enums;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataV.Model
{
[SugarTable("BPA_SubOrder")]
public class BPA_SubOrder : BasicEntity
{
public string OrderId { get; set; }
public string GoodId { get; set; }
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>
/// 订单状态<see cref="CookEnum"/>
/// </summary>
public CookEnum CookingStatus { get; set; }
/// <summary>
/// 废弃状态 0 正常 1 废弃
/// </summary>
public int IsVaild { get; set; }
/// <summary>
/// 废弃时间
/// </summary>
public DateTime? VaildTime { get; set; }
public DateTime? StartCookingTime { get; set; }
public DateTime? EndCookingTime { get; set; }
public DateTime? CompleteTakeTime { get; set; }
/// <summary>
/// 订单序号
/// </summary>
public string SortNumber { get; set; }
}
}

+ 15
- 0
DataV/Model/BasicEntity.cs Vedi File

@@ -0,0 +1,15 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataV.Model
{
public class BasicEntity
{
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
public DateTime? CreatedAt { get; set; }
}
}

+ 22
- 0
DataV/Model/BasicEntityRead.cs Vedi File

@@ -0,0 +1,22 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataV.Model
{
public class BasicEntityRead
{
[SugarColumn(IsPrimaryKey = true)]
public string Id { get; set; }
public string GroupId { get; set; }
public DateTime? UpdateAt { get; set; }
public string UpdateBy { get; set; }
public string DeleteBy { get; set; }
public DateTime? DeleteAt { get; set; }
public int IsDeleted { get; set; }
public DateTime? CreateAt { get; set; }
public string CreateBy { get; set; }
}
}

+ 27
- 0
DataV/Program.cs Vedi File

@@ -0,0 +1,27 @@
using BPA.ApolloClient;
using BPA.ApolloClient.Options;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Hosting;

namespace DataV
{
public class Program
{
public static void Main(string[] args)
{
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
builder.Inject().WebHost.ConfigureAppConfiguration((context, build) =>
{
builder.Configuration.AddApolloConfiguration(opt =>
{
builder.Configuration.GetSection(nameof(ApolloOptions)).Bind(opt);
});

});
var app = builder.Build();
app.Run();
}
}
}

+ 28
- 0
DataV/Properties/launchSettings.json Vedi File

@@ -0,0 +1,28 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:49839",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"DataV": {
"commandName": "Project",
"dotnetRunMessages": "true",
"launchBrowser": true,
"applicationUrl": "http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

+ 14
- 0
DataV/Result.cs Vedi File

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

namespace DataV
{
public class Result<T>
{
public bool IsSuccess { get; set; }
public T Data { get; set; }
public string Msg { get; set; }
}
}

+ 259
- 0
DataV/Service/DataVService.cs Vedi File

@@ -0,0 +1,259 @@
using DataV.Enums;
using DataV.Model;
using DataV.Service.Dto;
using Furion.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Xml;
using XExten.Advance.HttpFramework.MultiFactory;

namespace DataV.Service
{
public class DataVService : IDataVService, ITransient
{
private SqlDbContext Db;

public DataVService()
{
Db = new SqlDbContext();
}
/// <summary>
/// 大屏数据
/// </summary>
/// <param name="autokey"></param>
/// <returns></returns>
public Result<object> GetAllOrderDataState(int? autokey)
{
var db = Db.DbContext();

List<string> OrderIds = new List<string>();


if (autokey != null)
{
OrderIds = db.Queryable<BPA_StoreInfo>().LeftJoin<BPA_SubOrder>((t, x) => t.Id == x.StoreId)
.Where(t => t.AutoKey == autokey.Value).Select((t, x) => x.OrderId).ToList();
}

var data = db.Queryable<BPA_Order>().Where(t => t.AfterStatus == 0)
.Where(t => t.OrderStatus == PayEnum.PayOk || t.PayMode == PayModelEnum.Other)
.Where(t => !string.IsNullOrEmpty(t.TransactionId))
.Where(t => !string.IsNullOrEmpty(t.TradeNo))
.WhereIF(OrderIds.Count > 0, t => OrderIds.Contains(t.Id))
.Select(t => new { t.OrderRealMoney, t.CreatedAt }).ToList();

return new Result<object>
{
Data = new
{
Total = data.Sum(t => t.OrderRealMoney).ToString(),
OrderCount = data.Count().ToString(),
MoneyM = data.Where(t => t.CreatedAt.Value.Month == DateTime.Now.Month).Sum(t => t.OrderRealMoney).ToString(),
MoneyD = data.Where(t => t.CreatedAt.Value >= DateTime.Parse(DateTime.Now.ToShortDateString()) && t.CreatedAt < DateTime.Parse(DateTime.Now.ToShortDateString()).AddDays(1)).Sum(t => t.OrderRealMoney).ToString(),
},
IsSuccess = true,
Msg = String.Empty
};
}

/// <summary>
/// 设备
/// </summary>
/// <returns></returns>
public Result<Dictionary<string, List<int>>> OnlineDevice()
{
string sql = $@"SELECT
a.AutoKey,
b.Name
FROM
BPA_StoreInfo AS a
LEFT JOIN BPA_Company AS b ON a.GroupId= b.Id
";

var data = Db.DbContext().SqlQueryable<DataVDto>(sql).ToList().GroupBy(t => t.Name).Select(t => new
{
Key = t.Key,
Value = t.Select(x => x.AutoKey).ToList()
}).ToDictionary(t => t.Key, t => t.Value);


return new Result<Dictionary<string, List<int>>>
{
Data = data,
IsSuccess = true,
Msg = String.Empty
};
}

/// <summary>
/// 折线图
/// </summary>
/// <param name="autokey"></param>
/// <returns></returns>
public Result<object> OrderLine(int? autokey)
{
var db = Db.DbContext();

List<string> OrderIds = new List<string>();


if (autokey != null)
{
OrderIds = db.Queryable<BPA_StoreInfo>().LeftJoin<BPA_SubOrder>((t, x) => t.Id == x.StoreId)
.Where(t => t.AutoKey == autokey.Value).Select((t, x) => x.OrderId).ToList();
}

var data = db.Queryable<BPA_Order>()
.Where(t => !string.IsNullOrEmpty(t.TransactionId))
.WhereIF(OrderIds.Count > 0, t => OrderIds.Contains(t.Id))
.Where(t => !string.IsNullOrEmpty(t.TradeNo)).Select(t => new
{
t.OrderStatus,
t.AfterStatus,
t.CreatedAt,
t.PayMode
}).ToList();

List<object> res = new List<object>();


for (int index = 0; index < 10; index++)
{
var temp = DateTime.Now.AddDays(-index);
var end = DateTime.Parse(temp.ToString("yyyy-MM-dd 23:59:59"));
var start = DateTime.Parse(temp.ToString("yyyy-MM-dd 00:00:00"));
var NO = data.Where(t => t.CreatedAt.Value < end && t.CreatedAt.Value >= start).Where(t => t.AfterStatus != 0 && (t.OrderStatus == PayEnum.PayOk || t.PayMode == PayModelEnum.Other)).Count();
var OK = data.Where(t => t.CreatedAt.Value < end && t.CreatedAt.Value >= start).Where(t => t.AfterStatus == 0 && (t.OrderStatus == PayEnum.PayOk || t.PayMode == PayModelEnum.Other)).Count();
var Date = temp.ToString("MM/dd");
res.Add(new
{
NO,
OK,
Date
});
}

return new Result<object>
{
Data = res,
IsSuccess = true,
Msg = String.Empty,
};
}

/// <summary>
/// 下单数量
/// </summary>
/// <param name="autokey"></param>
/// <returns></returns>
public Result<object> OrderNumber(int? autokey)
{
var db = Db.DbContext();

List<string> OrderIds = new List<string>();


if (autokey != null)
{
OrderIds = db.Queryable<BPA_StoreInfo>().LeftJoin<BPA_SubOrder>((t, x) => t.Id == x.StoreId)
.Where(t => t.AutoKey == autokey.Value).Select((t, x) => x.OrderId).ToList();
}


var data = db.Queryable<BPA_Order>().Where(t => t.AfterStatus == 0)
.Where(t => t.OrderStatus == PayEnum.PayOk || t.PayMode == PayModelEnum.Other)
.Where(t => !string.IsNullOrEmpty(t.TransactionId))
.Where(t => !string.IsNullOrEmpty(t.TradeNo))
.WhereIF(OrderIds.Count > 0, t => OrderIds.Contains(t.Id))
.Select(t => t.CreatedAt).ToList();

return new Result<object>
{
IsSuccess = true,
Msg = String.Empty,
Data = new
{
Year = data.Where(t => t.Value.Year == DateTime.Now.Year).Count(),
Month = data.Where(t => t.Value.Month == DateTime.Now.Month).Count(),
Day = data.Where(t => t.Value.Day == DateTime.Now.Day).Count(),
}
};
}

/// <summary>
/// 区域销售
/// </summary>
/// <returns></returns>
public Result<object> GetLocSale()
{
var db = Db.DbContext();

var baiduMap = "http://api.map.baidu.com/geocoder/v2/?ak=3ce7ddfda60046708248ea55e10b1435&callback=renderReverse&location={0}&output=xml";
List<LocDto> loc = new List<LocDto>();
var data = db.SqlQueryable<dynamic>(@"SELECT
a.Store_Loc AS Loc,
(
SELECT COUNT
( b.Id )
FROM
BPA_Order AS b
JOIN BPA_SubOrder AS c ON b.Id= c.OrderId
WHERE
c.StoreId= a.Id
AND ( b.OrderStatus= 1 OR b.OrderStatus = 4 )
AND b.TradeNo IS NOT NULL
AND b.TransactionId IS NOT NULL
) AS Counts
FROM
BPA_StoreInfo AS a
WHERE
a.Store_Status = 0
AND a.IsDeleted = 0
AND a.Store_Loc LIKE '%,%'").ToList();
IHttpMultiClient http = null;

data.ForEach(item =>
{
if (http == null)
http = IHttpMultiClient.HttpMulti.AddNode(opt =>
{
opt.NodePath = String.Format(baiduMap, item.Loc);
});
else
http = http.AddNode(opt =>
{
opt.NodePath = String.Format(baiduMap, item.Loc);
});
});
XmlDocument doc = new XmlDocument();

var Temps = http.Build().RunString();

for (int i = 0; i < Temps.Count; i++)
{
doc.LoadXml(Temps[i]);
loc.Add(new LocDto
{
Count = data[i].Counts,
City = doc.SelectSingleNode("//province")?.InnerText + doc.SelectSingleNode("//city")?.InnerText
});
}

return new Result<object>
{
Data = new
{
Data = loc.GroupBy(t => t.City).Select(t => new LocDto
{
City = t.Key,
Count = t.Sum(t => t.Count)
})
},
IsSuccess = true,
Msg = ""
};
}
}
}

+ 13
- 0
DataV/Service/Dto/DataVDto.cs Vedi File

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

namespace DataV.Service.Dto
{
public class DataVDto
{
public int AutoKey { get; set; }
public string Name { get; set; }
}
}

+ 8
- 0
DataV/Service/Dto/LocDto.cs Vedi File

@@ -0,0 +1,8 @@
namespace DataV.Service.Dto
{
public class LocDto
{
public string City { get; set; }
public int Count { get; set; }
}
}

+ 22
- 0
DataV/Service/IDataVService.cs Vedi File

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

namespace DataV.Service
{
public interface IDataVService
{

Result<object> GetAllOrderDataState(int? autokey);

Result<object> OrderLine(int? autokey);

Result<object> OrderNumber(int? autokey);

Result<Dictionary<string, List<int>>> OnlineDevice();

Result<object> GetLocSale();

}
}

+ 27
- 0
DataV/SqlDbContext.cs Vedi File

@@ -0,0 +1,27 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataV
{
public class SqlDbContext
{
public SqlSugarScope DbContext()
{
SqlSugarScope client = new SqlSugarScope(new ConnectionConfig
{
ConnectionString = Furion.App.Configuration["DbConnectionstring"],
DbType = DbType.SqlServer,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
});
client.Aop.OnLogExecuting = (sql, pars) =>
{
Console.WriteLine($"当前SQL语句:【{sql}】,参数:【{string.Join(",", pars.Select(t => t.Value))}】");
};
return client;
}
}
}

+ 48
- 0
DataV/Startup.cs Vedi File

@@ -0,0 +1,48 @@
using Furion;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace DataV
{
public class Startup: AppStartup
{


// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers().AddInjectWithUnifyResult();

services.AddCorsAccessor();

services.AddRemoteRequest();
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
app.UseStaticFiles();

app.UseRouting();

app.UseCorsAccessor();

app.UseAuthentication();
app.UseAuthorization();

app.UseInject(string.Empty);

app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
}
}
}

+ 17
- 0
DataV/appsettings.json Vedi File

@@ -0,0 +1,17 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*",
"ApolloOptions": {
"MetaServer": "http://10.2.1.21:28080", //Meta server地址不用修改
"Namespaces": [
"data_v"
],
"AppId": "dev1_data_v" //根据自己创建应用修改
}
}

+ 32
- 0
Dockerfile Vedi File

@@ -0,0 +1,32 @@
#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /etc/ssl/openssl.cnf
RUN sed -i 's/DEFAULT@SECLEVEL=2/DEFAULT@SECLEVEL=1/g' /usr/lib/ssl/openssl.cnf
RUN sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1/g' /usr/lib/ssl/openssl.cnf
RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN echo Asia/Shanghai > /etc/timezone
RUN cat /etc/localtime
ENV TZ=Asia/Shanghai
WORKDIR /app
EXPOSE 9000

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src

COPY . .

WORKDIR "/src/DataV"
RUN dotnet build "DataV.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "DataV.csproj" -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .

ENV ASPNETCORE_URLS http://+:9000

ENTRYPOINT ["dotnet", "DataV.dll"]

+ 7
- 0
NuGet.config Vedi File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json"/>
<add key="bpa" value="http://10.2.1.25:10243/repository/bpa/index.json"/>
</packageSources>
</configuration>

Caricamento…
Annulla
Salva