123
tangxu
2024-08-02 97270e48e35dbce006263f6dc5fa6b6d8f81d0f5
WebApi/Controllers/TotalWaterInController.cs
@@ -1,9 +1,7 @@
using IStation.Common;
using IStation.Dto;
using IStation.Untity;
using IStation.ZyDto;
using IStation.ZyModel;
using Microsoft.Ajax.Utilities;
using IStation.Untity;
using IStation.ZyModel;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -14,9 +12,7 @@
using System.Threading;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using System.Web.UI.WebControls;
using static IStation.ZyConnectHelper;
using System.Web.Http;
namespace IStation.WebApi.Controllers
{
@@ -61,6 +57,8 @@
        [HttpGet]
        public IStation.Dto.ApiResult GetByDayDebug(string day)
        {
            if (ZyConnectHelper.isDebug)
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "Debug is Unacess " };
            if (day == null)
            {
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day null" };
@@ -87,6 +85,8 @@
        [HttpGet]
        public async Task<IStation.Dto.ApiResult> GetByDay(string day)
        {
            if (ZyConnectHelper.isDebug)
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "Debug is Unacess " };
            if (day == null)
            {
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day null" };
@@ -123,8 +123,8 @@
                }
                sum = 0;
                string joinedValues = string.Join(",", tagDict.Values);
                var result = HttpClientHelper.Get<List<DataPoint>>(_GetUrl, starttime, endtime, "first", "300s", joinedValues);
                var realScadaDataList = GetScadaData(result);
                var result = HttpClientHelper.Get<List<DataPoint>>(ZyConnectHelper.ZyApiUrl, starttime, endtime, "first", "300s", joinedValues);
                var realScadaDataList = ZyConnectHelper.GetScadaData(result);
                if (realScadaDataList != null && realScadaDataList.Any())
                {
                    foreach (var r in realScadaDataList)
@@ -158,12 +158,13 @@
        [HttpGet]
        public async Task<IStation.Dto.ApiResult> GetLastDay3()
        {
            if (ZyConnectHelper.isDebug)
                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "Debug is Unacess " };
            DateTime yest1 = DateTime.Today.AddDays(-1);
            var sum1 = TotalWaterInHelper.Read(yest1);
            if (sum1 < 0)
            {
                sum1 = await ZyConnectHelper.GetTotalWaterByDay_In(yest1);//.GetAwaiter().GetResult();
                TotalWaterInHelper.Save(yest1, sum1);
            }
@@ -172,7 +173,6 @@
            if (sum2 < 0)
            {
                sum2 = await ZyConnectHelper.GetTotalWaterByDay_In(yest2);//.GetAwaiter().GetResult();
                TotalWaterInHelper.Save(yest2, sum2);
            }