瀏覽代碼

更新数据上传

master
fyf 2 年之前
父節點
當前提交
9e24aa2ce7
共有 3 個檔案被更改,包括 74 行新增4 行删除
  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 查看文件

@@ -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 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存