demo

  1. public async Task<GatGatewayDetailInfo> GetGatewayDetailInfo(int gatewayId)
  2. {
  3. #region 获取网关详情
  4. var detail = new GatGatewayDetailInfo();
  5. await Task.Run(() =>
  6. {
  7. Parallel.Invoke(
  8. async () =>
  9. {
  10. detail.GatGatewayBasicInfo = await GetGatewayBasicExtInfo(gatewayId);
  11. },
  12. async () =>
  13. {
  14. detail.GatDeviceValvesList = await _deviceDal.GetListByValves(gatewayId);
  15. },
  16. async () =>
  17. {
  18. detail.GatDeviceSensorFertilizerList = await _deviceDal.GetListBySensor(gatewayId, 4);
  19. },
  20. async () =>
  21. {
  22. detail.GatDeviceSensorWaterList = await _deviceDal.GetListBySensor(gatewayId, 3);
  23. }
  24. );
  25. });
  26. return detail;
  27. #endregion
  28. }