zhaoy 8 months ago
parent
commit
64cd0d9578
3 changed files with 52 additions and 0 deletions
  1. +16
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResponDataBase.cs
  2. +21
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/StopDto.cs
  3. +15
    -0
      BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs

+ 16
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/BaseDto/ResponDataBase.cs View File

@@ -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; }
}
}

+ 21
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Dtos/StopDto.cs View File

@@ -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; }
}
}

+ 15
- 0
BPA.SAAS.Manage.Application/AExternalPlatform/Service/Device/Services/DeviceService.cs View File

@@ -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<ResponDataBase>(responseStop);
if (resStop.statusCode != "200") throw Oops.Oh("获取场景数据失败");
var dataStop = JsonConvert.DeserializeObject<List<StopDto>>(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<BPA_Product>().Where(x => x.Id == dto.ProductId).Any();
if (!checkProduct) throw Oops.Oh(ErrorCodeEnum.Code10010);
var checkProductVesion = SqlSugarDb.Db.Queryable<BPA_ProductVesion>().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<ResponDataBase>(responseStop);
if (resStop.statusCode != "200") throw Oops.Oh("获取场景数据失败");
var dataStop = JsonConvert.DeserializeObject<List<StopDto>>(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<BPA_Product>().Where(x => x.Id == dto.ProductId).Any();
if (!checkProduct) throw Oops.Oh(ErrorCodeEnum.Code10010);
var checkProductVesion = SqlSugarDb.Db.Queryable<BPA_ProductVesion>().Where(x => x.Id == dto.ProductVersionId).Any();


Loading…
Cancel
Save