using Furion.DynamicApiController; using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Nirvana.Common; using Nirvana.Common.ApiBase; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace YBDevice.Application.MeasureInfo { /// /// 测量记录 /// [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] public class ResultAppService : IDynamicApiController { private readonly IResultService _Service; public ResultAppService(IResultService Service) { _Service = Service; } /// /// 测量记录列表 /// /// /// [HttpPost] public async Task GetListAsync(QueryParams param) { var result = await _Service.GetListAsync(param); return new ResultInfo(ResultState.SUCCESS, "success", result); } /// /// 根据设备查询测量记录列表 /// /// /// /// [HttpPost] public async Task GetDevResultListAsync([FromQuery] int devid, QueryParams param) { var result = await _Service.GetDevResultAsync(devid, param); return new ResultInfo(ResultState.SUCCESS, "success", result); } /// /// 指定家庭成语的体重记录列表 /// /// /// /// /// [QueryParameters] public async Task GetFamilyResultAsync(int id, DateTime? starttime, DateTime? endtime) { var result = await _Service.GetUserResultAsync(id, starttime, endtime); var weightlist = new List(); var timelist = new List(); result.ForEach(x => { weightlist.Add(x.weight); timelist.Add(x.time); }); return new ResultInfo(ResultState.SUCCESS, "success", new { weightlist = weightlist, timelist = timelist }); } /// /// 根据用户ID查询用户汇总汇总数据 /// /// /// /// [HttpPost] public async Task GetUserDataByUserIdAsync([FromQuery] int id, QueryParams param) { var result = await _Service.GetUserDataByUserIdAsync(id, param); return new ResultInfo(ResultState.SUCCESS, "success", result); } /// /// 根据用户ID查询用户测量记录 /// /// /// /// [HttpPost] public async Task GetUserResultByUserIdAsync([FromQuery] int id, QueryParams param) { var result = await _Service.GetUserResultByUserIdAsync(id, param); return new ResultInfo(ResultState.SUCCESS, "success", result); } /// /// 导出信息 /// /// /// public async Task ExportAsync(QueryParams param) { return await _Service.ExportAsync(param); } } }