Bläddra i källkod

修改获取商品及设备接口20240815

master
gwbvipvip 1 månad sedan
förälder
incheckning
8d7d5591dc
3 ändrade filer med 42 tillägg och 19 borttagningar
  1. +33
    -2
      BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs
  2. +8
    -15
      BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs
  3. +1
    -2
      BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml

+ 33
- 2
BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Dtos/ResultGoodsResultDto.cs Visa fil

@@ -37,6 +37,21 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt
public int timestamp { get; set; }
}

public class ResultGoodsClassifyResultDto
{
public int statusCode { get; set; }

public List<GoodsClassifyResultDto> data { get; set; }

public string succeeded { get; set; }

public string errors { get; set; }

public string extras { get; set; }

public int timestamp { get; set; }
}

public class ResultDeviceResultDto
{
public int statusCode { get; set; }
@@ -55,20 +70,33 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt
public class GoodsAndDeviceResultDto
{
public List<GoodsTypeResultDto> GoodsInfoList { get; set; }
public List<GoodsClassifyResultDto> GoodsClassifyList { get; set; }
public DeviceInfoQueryDto DeviceInfo { get;set; }
}

public class GoodsClassifyResultDto
{
public string GoodsClassifyId { get; set; }
public string GoodsClassifyName { get; set; }
public List<GoodsDataResultDto> GoodsList { get; set; }
}

public class GoodsDataResultDto
{
public string GoodsId { get; set; }
public string GoodsName { get; set; }
public string ImgUrl { get; set; }
}

public class GoodsTypeResultDto
{
public string GoodsTypeId { get; set; }

public string GoodsTypeName { get; set; }


public List<GoodsAttributeResultDto> GoodsAttributeList { get; set; }

public List<GoodsInfoResultDto> GoodsInfoList { get; set; }

}


@@ -78,6 +106,8 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt

public string GoodsAttributeName { get; set; }

public int Sort { get; set; }

public List<GoodsAttributeValueResultDto> GoodsAttributeValueList { get; set; }
}

@@ -86,6 +116,7 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt
public string GoodsAttributeId { get; set; }
public string GoodsAttributeValueId { get; set; }
public string AttributeValue { get; set; }
public int Sort { get; set; }
}

public class GoodsResultDto


+ 8
- 15
BPA.SAAS.KitChenManage.Application/AExternalPlatform1/Service/Goods/Services/GoodsServices.cs Visa fil

@@ -30,16 +30,7 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Se
[HttpPost("/api/goods/Getdevicegoods")]
public async Task<ResultGoodsAndDeviceResultDto> GetDeviceGoods(string deviceId)
{
var goodsId = await _db.Queryable<BPA_DeviceGoods>()
.Where(x => x.AutoKey.ToString() == deviceId)
.Select(x => x.GoodsId)
.ToListAsync();
var device = await _db.Queryable<BPA_DeviceGoods>().FirstAsync(t => t.AutoKey.ToString() == deviceId);
if (device != null)
{
goodsId.Insert(0, device.DeviceId);
}
var data = await GetDeviceGoodspost(goodsId, deviceId);
var data = await GetDeviceGoodspost(deviceId);
return data;
}

@@ -47,20 +38,22 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Se
/// <summary>
/// 获取商品信息
/// </summary>
/// <param name="goodsList"></param>
/// <param name="autoKey"></param>
/// <returns></returns>
public async Task<ResultGoodsAndDeviceResultDto> GetDeviceGoodspost(List<string> goodsList, string autoKey)
public async Task<ResultGoodsAndDeviceResultDto> GetDeviceGoodspost(string autoKey)
{
try
{
var result = new ResultGoodsAndDeviceResultDto { statusCode = 200, data = new GoodsAndDeviceResultDto(), succeeded = "true" };
Dictionary<string, string> dic = new Dictionary<string, string>();
var dic = new Dictionary<string, string>();
var goodsUrl = App.Configuration["baseurl"] + "api/goods/GetGoodsListByIds";
var goodsInputData = JsonConvert.SerializeObject(goodsList);
var goodsJsonData = HttpHelper.PostData(goodsUrl, goodsInputData, Encoding.UTF8, "application/json", dic);
var goodsJsonData = HttpHelper.HttpGet(goodsUrl, $"?autoKey={autoKey}", dic, "application/json");
var goodsData = JsonConvert.DeserializeObject<ResultGoodsResultDto>(goodsJsonData);
result.data.GoodsInfoList = goodsData?.data;
var classifyUrl = App.Configuration["baseurl"] + "api/goods/GetGoodsClassifyByIds";
var classifyJsonData = HttpHelper.HttpGet(classifyUrl, $"?autoKey={autoKey}", dic, "application/json");
var classifyData = JsonConvert.DeserializeObject<ResultGoodsClassifyResultDto>(classifyJsonData);
result.data.GoodsClassifyList = classifyData?.data;
var deviceUrl = App.Configuration["baseurl"] + "api/device/getDeviceInfoByDeviceId";
var deviceInputData = JsonConvert.SerializeObject(autoKey);
var deviceJsonData = HttpHelper.HttpGet(deviceUrl, $"?autoKey={autoKey}", dic, "application/json");


+ 1
- 2
BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml Visa fil

@@ -206,11 +206,10 @@
</summary>
<returns></returns>
</member>
<member name="M:BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Services.Goods.GetDeviceGoodspost(System.Collections.Generic.List{System.String},System.String)">
<member name="M:BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Services.Goods.GetDeviceGoodspost(System.String)">
<summary>
获取商品信息
</summary>
<param name="goodsList"></param>
<param name="autoKey"></param>
<returns></returns>
</member>


Laddar…
Avbryt
Spara