fix 细节调整
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using Dlhis.Middle.Api;
|
||||
using Dlhis.Middle.Request;
|
||||
using Dlhis.Middle.Response;
|
||||
using Dlhis.Middle.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
using Kurisu.AspNetCore.UnifyResultAndValidation;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
@@ -18,11 +19,13 @@ namespace Dlhis.Middle.Controllers;
|
||||
public class AssignmentsController : ControllerBase
|
||||
{
|
||||
private readonly IAssignmentDeviceTaskApi _assignmentDeviceTaskApi;
|
||||
private readonly IHealthCheckService _healthCheckService;
|
||||
private readonly string _internalIp;
|
||||
|
||||
public AssignmentsController(IAssignmentDeviceTaskApi assignmentDeviceTaskApi, IConfiguration configuration)
|
||||
public AssignmentsController(IAssignmentDeviceTaskApi assignmentDeviceTaskApi, IConfiguration configuration, IHealthCheckService healthCheckService)
|
||||
{
|
||||
_assignmentDeviceTaskApi = assignmentDeviceTaskApi;
|
||||
_healthCheckService = healthCheckService;
|
||||
_internalIp = configuration.GetSection("InternalIP").Value;
|
||||
}
|
||||
|
||||
@@ -34,6 +37,14 @@ public class AssignmentsController : ControllerBase
|
||||
[HttpGet("deviceTasks")]
|
||||
public async Task<DefaultApiResult<List<DeviceTaskToDeviceByDeviceResponse>>> DeviceGetTasksGetAsync([FromQuery] DeviceTaskGetRequest request)
|
||||
{
|
||||
if (_healthCheckService.GetIsOffline())
|
||||
{
|
||||
return new DefaultApiResult<List<DeviceTaskToDeviceByDeviceResponse>>
|
||||
{
|
||||
Data = new List<DeviceTaskToDeviceByDeviceResponse>()
|
||||
};
|
||||
}
|
||||
|
||||
var result = await _assignmentDeviceTaskApi.DeviceGetTasksAsync(request);
|
||||
foreach (var data in result.Data)
|
||||
{
|
||||
@@ -48,6 +59,7 @@ public class AssignmentsController : ControllerBase
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -58,6 +70,14 @@ public class AssignmentsController : ControllerBase
|
||||
[IgnoreTenant]
|
||||
public async Task<DefaultApiResult<List<DeviceTaskToDeviceByDeviceResponse>>> DeviceGetTasksPostAsync(DeviceTaskGetRequest request)
|
||||
{
|
||||
if (_healthCheckService.GetIsOffline())
|
||||
{
|
||||
return new DefaultApiResult<List<DeviceTaskToDeviceByDeviceResponse>>
|
||||
{
|
||||
Data = new List<DeviceTaskToDeviceByDeviceResponse>()
|
||||
};
|
||||
}
|
||||
|
||||
var result = await _assignmentDeviceTaskApi.DeviceGetTasksAsync(request);
|
||||
foreach (var data in result.Data)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Dlhis.Middle.Api;
|
||||
using Dlhis.Middle.Request;
|
||||
using Dlhis.Middle.Request;
|
||||
using Dlhis.Middle.Response;
|
||||
using Dlhis.Middle.Services;
|
||||
using Kurisu.AspNetCore.DataAccess.SqlSugar.Aop;
|
||||
@@ -32,6 +31,5 @@ public class OrdersController : ControllerBase
|
||||
public async Task<DefaultApiResult<OrderResultResponse>> AddAsync(OrderAddRequest request)
|
||||
{
|
||||
return await _orderService.AddAsync(request);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user