Browse Source

更新数据上传

master
fyf 2 years ago
parent
commit
9e24aa2ce7
3 changed files with 74 additions and 4 deletions
  1. +15
    -0
      DataVAPI.Tools/IOT/ScreenMonitorModel.cs
  2. +58
    -4
      DataVAPI/UpAndDown/ProcessServer.cs
  3. +1
    -0
      DataVApi.Order/OrderProvider.cs

+ 15
- 0
DataVAPI.Tools/IOT/ScreenMonitorModel.cs View File

@@ -21,6 +21,21 @@ namespace DataVAPI.Tool.IOT
/// </summary>
public InfoMessage infoMessage { get; set; }
/// <summary>
/// 折线图
/// </summary>
public object OrderLine { get; set; }
/// <summary>
/// 订单数据状态
/// </summary>
public object OrderDataState { get; set; }
/// <summary>
/// 区域销售
/// </summary>
public object LocSale { get; set; }
/// <summary>
/// 下单数量
/// </summary>
public object OrderNumber { get; set; }
/// 返回JSON
/// </summary>
/// <returns></returns>


+ 58
- 4
DataVAPI/UpAndDown/ProcessServer.cs View File

@@ -1,4 +1,5 @@
using DataVAPI.Controllers;
using DataVApi.Order;
using DataVAPI.Controllers;
using DataVAPI.Model;
using DataVAPI.Tool;
using DataVAPI.Tool.IOT;
@@ -23,8 +24,10 @@ namespace DataVAPI.UpAndDown
public DeviceController deviceController { get; set; }
public LogController logController { get; set; }
public ScreenController screenController { get; set; }
public AlarmController alarmController { get; set; }
public OrderProvider orderProvider { get; set; }


#region 不需要监听
private static ProcessServer _instance;
public static ProcessServer Instance
@@ -40,8 +43,9 @@ namespace DataVAPI.UpAndDown
{
deviceController = new DeviceController();
logController = new LogController();
alarmController = new AlarmController();
screenController = new ScreenController();
orderProvider = new OrderProvider();
}
#endregion
/// <summary>
@@ -69,9 +73,53 @@ namespace DataVAPI.UpAndDown
Subscribe(IOTDevServer.HeartbeatSubTopic);

IOTDevServer.DevIOTAction += DevIOTActionHandler;

//执行队列任务
QueueTask();
ConsoleHelper.WriteSuccessLine("开始接收数据,执行队列任务!");
}
/// <summary>
/// 队列任务
/// </summary>
private void QueueTask()
{
Executer.GetInstance().Start(new Action(() =>
{
while (true)
{
try
{
if (IOTDevServer.GetInstance().GetIsConnected())
{

SentData(null);

FindDataAlarm();

Thread.Sleep(3000);
}

}
catch (Exception ex)
{
ConsoleHelper.WriteErrorLine(ex.Message);
}
}

}), "队列任务执行");
}

public void FindDataAlarm()
{
devModel?.operatingDeviceStatus.data?.ForEach(par =>
{

if (!string.IsNullOrEmpty(par.clientId))
{
JsonMsg<List<AlarmTable>> jsonMsg = alarmController.QueryClientId(par.clientId);
par.IsAlarm = (jsonMsg.obj != null && jsonMsg.obj.data != null && jsonMsg.obj.data.Count > 0)?true:false;//ApiGetAlarm(par.clientId);
}
});
}

/// <summary>
/// 加载店铺信息
@@ -173,6 +221,12 @@ namespace DataVAPI.UpAndDown
LoadingShopInformation();
}
}

devModel.OrderLine = orderProvider.OrderLine(new DataVApi.Order.RequestModel.FullScreenBasic());
devModel.OrderDataState = orderProvider.GetAllOrderDataState(new DataVApi.Order.RequestModel.FullScreenInput()); devModel.OrderDataState = orderProvider.GetAllOrderDataState(new DataVApi.Order.RequestModel.FullScreenInput());
devModel.LocSale = orderProvider.GetLocSale();
devModel.OrderNumber = orderProvider.OrderNumber(new DataVApi.Order.RequestModel.FullScreenBasic());

ScreenMonitorModel screen1Monitor = Tools.JsonToObjectTools<ScreenMonitorModel>(devModel.ToJSON());
#region 1.设置data默认值
if (screen1Monitor.operatingDeviceStatus.data.Count == 0)


+ 1
- 0
DataVApi.Order/OrderProvider.cs View File

@@ -199,6 +199,7 @@ WHERE
return new
{
Year = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year).Count(),
//YearBFB = (data.Where(t => t.CreatedAt.Year == DateTime.Now.Year).Count() / data.Where(t => t.CreatedAt.Year == DateTime.Now.AddYears(-1).Year).Count()),
Month = data.Where(t => t.CreatedAt.Month == DateTime.Now.Month).Count(),
Day = data.Where(t => t.CreatedAt.Day == DateTime.Now.Day).Count(),
};


Loading…
Cancel
Save