diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResponDataBase.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResponDataBase.cs new file mode 100644 index 0000000..4d0820d --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResponDataBase.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto +{ + public class ResponDataBase + { + public string statusCode { get; set; } + public object data { get; set; } + public string succeeded { get; set; } + public string errors { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/StopDto.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/StopDto.cs new file mode 100644 index 0000000..285033e --- /dev/null +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/StopDto.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos +{ + public class StopDto + { + public string Id { get; set; } + public string Name { get; set; } + public string OrgId { get; set; } + public string OrgName { get; set; } + public string Phone { get; set; } + public int Sort { get; set; } + public string Description { get; set; } + public string GroupId { get; set; } + public DateTime CreateAt { get; set; } + } +} diff --git a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs index 4717c74..e0e1b1d 100644 --- a/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs +++ b/BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs @@ -3,6 +3,7 @@ using BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto; using BPA.SAAS.Manage.Application.AExternalPlatform.Enum; using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Dtos; using BPA.SAAS.Manage.Application.AExternalPlatform.Service.Goods.Dtos; +using BPA.SAAS.Manage.Application.DataBase.Dtos.GoodsAttribute; using BPA.SAAS.Manage.Comm.Const; using BPA.SAAS.Manage.Core.Base; using BPA.SAAS.Manage.Core.DataBase; @@ -10,11 +11,13 @@ using BPA.SAAS.Manage.Core.Device; using BPA.SAAS.Manage.Core.Product; using Furion.DependencyInjection; using Furion.RemoteRequest.Extensions; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using ResponDataBase = BPA.SAAS.Manage.Application.AExternalPlatform.BaseDto.ResponDataBase; namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services { @@ -154,6 +157,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services { groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value }).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); + var resStop = JsonConvert.DeserializeObject(responseStop); + if (resStop.statusCode != "200") throw Oops.Oh("获取场景数据失败"); + var dataStop = JsonConvert.DeserializeObject>(resStop.data.ToString()); + if (dataStop.Count==0) throw Oops.Oh("获取场景数据失败"); + if(!dataStop.Where(x=>x.Id == dto.StopId).Any()) throw Oops.Oh("场景不存在"); + var checkProduct = SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.ProductId).Any(); if (!checkProduct) throw Oops.Oh(ErrorCodeEnum.Code10010); var checkProductVesion = SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.ProductVersionId).Any(); @@ -172,6 +181,12 @@ namespace BPA.SAAS.Manage.Application.AExternalPlatform.Service.Device.Services { groupId = App.User?.FindFirst(ClaimConst.GroupId)?.Value }).SetHttpMethod(HttpMethod.Get).GetAsStringAsync(); + var resStop = JsonConvert.DeserializeObject(responseStop); + if (resStop.statusCode != "200") throw Oops.Oh("获取场景数据失败"); + var dataStop = JsonConvert.DeserializeObject>(resStop.data.ToString()); + if (dataStop.Count == 0) throw Oops.Oh("获取场景数据失败"); + if (!dataStop.Where(x => x.Id == dto.StopId).Any()) throw Oops.Oh("场景不存在"); + var checkProduct = SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.ProductId).Any(); if (!checkProduct) throw Oops.Oh(ErrorCodeEnum.Code10010); var checkProductVesion = SqlSugarDb.Db.Queryable().Where(x => x.Id == dto.ProductVersionId).Any();