换电订单列表日志

zw
lxw 5 months ago
parent d04f25dc20
commit bc9d3e64b7

@ -5,6 +5,7 @@ using Entity.Api.Resp;
using Entity.DbModel.Station;
using Entity.Dto;
using HybirdFrameworkCore.Entity;
using log4net;
using Magicodes.ExporterAndImporter.Excel;
using Microsoft.AspNetCore.Mvc;
using Repository.Station;
@ -21,6 +22,8 @@ namespace WebStarter.Controllers;
[Route("api/[controller]")]
public class SwapOrderController : ControllerBase
{
private static readonly ILog Log = LogManager.GetLogger(typeof(SwapOrderController));
private readonly SwapOrderService swapOrderService;
private readonly SwapOrderBatteryService swapOrderBatteryService;
private readonly SwapOrderStepService swapOrderStepService;
@ -42,26 +45,29 @@ public class SwapOrderController : ControllerBase
[HttpPost("QueryPage")]
public async Task<Result<PageResult<SwapOrderResp>>> QueryPage([FromBody] QuerySwapOrderPageReq req)
{
Log.Info($"SwapOrderController QueryPage req={req}");
if (!string.IsNullOrEmpty(req.DownBatteryNo)||!string.IsNullOrEmpty(req.UpBatteryNo))
{
var result = BatteryCodeList(req);
return Result<PageResult<SwapOrderResp>>.Success(result);
}
Log.Info($"查询换电订单 SwapOrderController start QueryPage swapOrderService.QuerySwapOrder req={req}");
var swapOrderResp = swapOrderService.QuerySwapOrder(req);
Log.Info($"查询换电订单 SwapOrderController end QueryPage swapOrderService.QuerySwapOrder req={req}");
//获取所有订单号
var orderSns = swapOrderResp.Rows.Select(row => row.Sn).ToList();
Log.Info($"查询上报云平台次数 SwapOrderController start QueryPage swapOrderService.QueryReportCloudNumBySn req={orderSns}");
//查询上报云平台次数
Dictionary<string, int?> queryReportCloudNumBySn = swapOrderService.QueryReportCloudNumBySn(orderSns);
Log.Info($"查询上报云平台次数 SwapOrderController end QueryPage swapOrderService.QueryReportCloudNumBySn req={orderSns}");
Log.Info($"查询订单电池数据 SwapOrderController start QueryPage swapOrderBatteryService.QueryListByClause req={orderSns}");
////查询订单电池数据
List<SwapOrderBattery> batteryList =
swapOrderBatteryService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
Log.Info($"查询订单电池数据 SwapOrderController end QueryPage swapOrderBatteryService.QueryListByClause req={orderSns}");
//映射
var config =
new MapperConfiguration(cfg => cfg.CreateMap<SwapOrderBatteryResp, SwapOrderBattery>().ReverseMap());
@ -69,9 +75,9 @@ public class SwapOrderController : ControllerBase
List<SwapOrderBatteryResp> swapOrderBattery = mapper.Map<List<SwapOrderBatteryResp>>(batteryList);
Log.Info($"查询公里数 SwapOrderController start QueryPage swapOrderReportCloudRepository.QueryListByClause req={orderSns}");
List<SwapOrderReportCloud> swapOrderReportClouds = swapOrderReportCloudRepository.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
Log.Info($"查询公里数 SwapOrderController end QueryPage swapOrderReportCloudRepository.QueryListByClause req={orderSns}");
//将电池数据添加到换电订单数据中
foreach (var row in swapOrderResp.Rows)
{
@ -88,9 +94,10 @@ public class SwapOrderController : ControllerBase
}
}
}
Log.Info($"查询订单步序数据 SwapOrderController start QueryPage swapOrderStepService.QueryListByClause req={orderSns}");
//查询订单步序数据
var stepList = swapOrderStepService.QueryListByClause(u => orderSns.Contains(u.SwapOrderSn));
Log.Info($"查询订单步序数据 SwapOrderController end QueryPage swapOrderStepService.QueryListByClause req={orderSns}");
stepList = stepList.OrderBy(s => s.Sort).ToList();
//映射

Loading…
Cancel
Save