Browse Source

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

master
gwbvipvip 1 month ago
parent
commit
8d7d5591dc
3 changed files with 42 additions and 19 deletions
  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 View File

@@ -37,6 +37,21 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt
public int timestamp { get; set; } 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 class ResultDeviceResultDto
{ {
public int statusCode { get; set; } public int statusCode { get; set; }
@@ -55,20 +70,33 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Dt
public class GoodsAndDeviceResultDto public class GoodsAndDeviceResultDto
{ {
public List<GoodsTypeResultDto> GoodsInfoList { get; set; } public List<GoodsTypeResultDto> GoodsInfoList { get; set; }
public List<GoodsClassifyResultDto> GoodsClassifyList { get; set; }
public DeviceInfoQueryDto DeviceInfo { 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 class GoodsTypeResultDto
{ {
public string GoodsTypeId { get; set; } public string GoodsTypeId { get; set; }


public string GoodsTypeName { get; set; } public string GoodsTypeName { get; set; }



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


public List<GoodsInfoResultDto> GoodsInfoList { 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 string GoodsAttributeName { get; set; }


public int Sort { get; set; }

public List<GoodsAttributeValueResultDto> GoodsAttributeValueList { 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 GoodsAttributeId { get; set; }
public string GoodsAttributeValueId { get; set; } public string GoodsAttributeValueId { get; set; }
public string AttributeValue { get; set; } public string AttributeValue { get; set; }
public int Sort { get; set; }
} }


public class GoodsResultDto public class GoodsResultDto


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

@@ -30,16 +30,7 @@ namespace BPA.SAAS.KitChenManage.Application.AExternalPlatform1.Service.Goods.Se
[HttpPost("/api/goods/Getdevicegoods")] [HttpPost("/api/goods/Getdevicegoods")]
public async Task<ResultGoodsAndDeviceResultDto> GetDeviceGoods(string deviceId) 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; return data;
} }


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


+ 1
- 2
BPA.SAAS.KitChenManage.Application/BPA.SAAS.KitChenManage.Application.xml View File

@@ -206,11 +206,10 @@
</summary> </summary>
<returns></returns> <returns></returns>
</member> </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>
获取商品信息 获取商品信息
</summary> </summary>
<param name="goodsList"></param>
<param name="autoKey"></param> <param name="autoKey"></param>
<returns></returns> <returns></returns>
</member> </member>


Loading…
Cancel
Save