现场云平台更改提交

zw
CZ 5 months ago
parent 8d9642254b
commit c036718c69

@ -571,7 +571,7 @@ public class CloudClient : IMqttClientConnectedHandler, IMqttApplicationMessageR
ct = 0, ct = 0,
cn = orders.Count, cn = orders.Count,
sfs = op, sfs = op,
vin = swapOrder.VehicleVin, vin = swapOrder?.VehicleVin,
sfoc = 0, sfoc = 0,
}; };
foreach (ChargeOrder order in orders) foreach (ChargeOrder order in orders)

@ -14,6 +14,7 @@ public class ChargeOrderUploadTask : ITask
private volatile bool _stop; private volatile bool _stop;
public ChargeOrderRepository _chargeOrderRepository { get; set; } public ChargeOrderRepository _chargeOrderRepository { get; set; }
public SwapOrderRepository _swapOrder { get; set; }
public int Interval() public int Interval()
{ {
@ -30,11 +31,10 @@ public class ChargeOrderUploadTask : ITask
Log.Info($"there are {chargeOrders?.Count ?? 0} to upload"); Log.Info($"there are {chargeOrders?.Count ?? 0} to upload");
if (chargeOrders is { Count: > 0 }) if (chargeOrders is { Count: > 0 })
{ {
var group = chargeOrders.GroupBy(it => it.CloudChargeOrder); Dictionary<string,List<ChargeOrder>> dictionary = chargeOrders.GroupBy(it => it.CloudChargeOrder).ToDictionary(i => i.Key, i=> i.ToList());
foreach (IGrouping<string, ChargeOrder> grouping in group) foreach (var (k, v) in dictionary)
{ {
List<ChargeOrder> orders = grouping.ToList(); CloudClientMgr.CloudClient?.PublishChargeOrder(v, 1);
CloudClientMgr.CloudClient?.PublishChargeOrder(orders, 1);
} }
} }
} }

Loading…
Cancel
Save