接口更新海运出口服务项目

dev
cjy 3 weeks ago
parent d2e28a9920
commit dfbc55d8b4

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
namespace DS.Module.DjyServiceStatus
{
/// <summary>
/// 服务项目返回
/// </summary>
public class ServiceProjectRes
{
/// <summary>
///
/// </summary>
public string ProjectPKId { get; set; }
/// <summary>
///
/// </summary>
public string ProjectCode { get; set; }
/// <summary>
/// 订舱
/// </summary>
public string ProjectName { get; set; }
/// <summary>
///
/// </summary>
public int SortNo { get; set; }
/// <summary>
///
/// </summary>
public bool IsYield { get; set; }
/// <summary>
///
/// </summary>
public DateTime ActDate { get; set; }
/// <summary>
///
/// </summary>
public int StatusNum { get; set; }
}
public class ServiceProjectRoot
{
/// <summary>
///
/// </summary>
public bool Succ { get; set; }
/// <summary>
///
/// </summary>
public int Status { get; set; }
/// <summary>
///
/// </summary>
public List<ServiceProjectRes> Ext { get; set; }
/// <summary>
///
/// </summary>
public bool IsTimeout { get; set; }
/// <summary>
///
/// </summary>
public DateTime ExecuteTime { get; set; }
}
}

@ -280,4 +280,10 @@ public interface ISeaExportService
/// <param name="req"></param>
/// <returns></returns>
public Task<DataResult> CreateOrderAuditTaskAsync(IdModel req);
/// <summary>
/// 更新服务项目
/// </summary>
/// <returns></returns>
public Task<DataResult> UpdateSeaExportServiceItem();
}

@ -102,6 +102,7 @@ public partial class SeaExportService : ISeaExportService
//_bookingSlotService = _serviceProvider.GetRequiredService<IBookingSlotService>();
_seaTaskService = _serviceProvider.GetRequiredService<ISeaExportTaskService>();
_taskManageBaseService = _serviceProvider.GetRequiredService<Lazy<ITaskManageBaseService>>();
}
@ -1652,4 +1653,38 @@ public partial class SeaExportService : ISeaExportService
return DataResult.Success;
}
}
/// <summary>
/// 更新服务项目
/// </summary>
/// <returns></returns>
public async Task<DataResult> UpdateSeaExportServiceItem()
{
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
var list = await tenantDb.Queryable<SeaExport>().Where(x => x.ServiceItem == null || x.ServiceItem == "").ToListAsync();//.Where(x => x.IsRefund == false && x.IsChangeETD == false)
foreach (var item in list)
{
var res = await _djyServiceStatusService.GetServiceProjectList(new EmbedQueryServiceProjectWithStatus()
{
BusinessId = item.Id.ToString(),
QueryType = 0,
});
var data = JsonConvert.DeserializeObject<ServiceProjectRoot>(res.data.ToString());
var res1 = data.Ext;
if (res1 != null && res1.Count>0) {
var codes = res1.Where(x=>x.IsYield == true).Select(x=> x.ProjectCode.ToLower()).ToList();
var codeStr = String.Join(",", codes);
item.ServiceItem = codeStr;
await tenantDb.Updateable(item).UpdateColumns(x=>new { x.ServiceItem}).ExecuteCommandAsync();
}
Console.WriteLine(res.data);
}
return DataResult.Success;
}
}

@ -593,5 +593,15 @@ public class SeaExportController : ApiController
var res = await _invokeService.CreateOrderAuditTaskAsync(req);
return res;
}
/// <summary>
/// 更新服务项目
/// </summary>
/// <returns></returns>
[HttpGet]
[Route("UpdateSeaExportServiceItem")]
public async Task<DataResult> UpdateSeaExportServiceItem()
{
var res = await _invokeService.UpdateSeaExportServiceItem();
return res;
}
}

@ -56,6 +56,7 @@ public class Startup
services.AddSqlSugarInstall();
services.AddSaasDbInstall();
services.AddPrintModuleInstall();
services.AddDjyModuleInstall(); //djy服务
}

Loading…
Cancel
Save