AFR对接

master
zhangxiaofeng 11 months ago
parent 9e1408d689
commit aecdc87e70

@ -12,8 +12,8 @@ namespace djy.IService.Afr
#region 字典接口
List<CommonCNEN> GetCountry(string strlink, int page, int limit);
List<CommonMappiCode> GetCARRIER();
List<CommonCodeValue> GetCTNALL();
List<CommonCodeValue> GetPackage();
List<CommonMappiCode> GetCTNALL();
List<CommonMappiCode> GetPackage();
List<CodeDangerGradeDto> GetDangerousGoods(string strlink);
List<CommonCodeValue> GetPort(string strlink, int page, int limit);
List<CommonCodeValue> GetVessel(string strlink, int page, int limit);
@ -23,7 +23,8 @@ namespace djy.IService.Afr
Task<AFRMaster> Get(string gid);
Task SaveInfo(AFRMaster input);
Task Delete(string ids);
Task Send(string ids, string msgType);
Task<string> Send(string ids, int sendType);
Task SaveReceipt(AFRReceiptDto input);
Task<List<AFRMasterHistory>> GetHistory(string id);
}
}

@ -32,9 +32,18 @@ namespace djy.Model.Afr
public string ContainerNo { get; set; }
/// <summary>
/// 箱型
/// 箱型Code
/// </summary>
public string ContainerType { get; set; }
public string ContainerTypeCode { get; set; }
/// <summary>
/// 箱型Name
/// </summary>
public string ContainerTypeName { get; set; }
/// <summary>
/// 箱型MapCode
/// </summary>
public string ContainerTypeMapCode { get; set; }
/// <summary>
/// 危品联系人(选填)
@ -92,14 +101,22 @@ namespace djy.Model.Afr
public string OriginCountryCode { get; set; }
/// <summary>
/// 包装
/// 包装Code
/// </summary>
public string Packing { get; set; }
public string PackingCode { get; set; }
/// <summary>
/// 包装Name
/// </summary>
public string PackingName { get; set; }
/// <summary>
/// 包装MapCode
/// </summary>
public string PackingMapCode { get; set; }
/// <summary>
/// 包装代码
/// 包装MapName
/// </summary>
public string PackingCode { get; set; }
public string PackingMapName { get; set; }
/// <summary>

@ -100,9 +100,19 @@ namespace djy.Model.Afr
public string MBLNO { get; set; }
/// <summary>
/// 船公司
/// 船司Code
/// </summary>
public string ShipCompany { get; set; }
public string ShipCompanyCode { get; set; }
/// <summary>
/// 船司Name
/// </summary>
public string ShipCompanyName { get; set; }
/// <summary>
/// 船司MapCode
/// </summary>
public string ShipCompanyMapCode { get; set; }
/// <summary>
/// 船东单运编号(选填)

@ -34,7 +34,7 @@ namespace djy.Model.AFRDto
/// <summary>
/// 船公司
/// </summary>
public string ShipCompany { get; set; }
public string ShipCompanyName { get; set; }
/// <summary>
/// 操作用户名称
/// </summary>

@ -14,5 +14,6 @@ namespace djy.Model.AmsDto
public string Value { get; set; }
public string MapCode { get; set; }
public string MapName { get; set; }
}
}

@ -61,7 +61,7 @@ namespace djy.Service.AFR
{
try
{
var List = DbBus.Get(DbList.Common).Select<CodeCarrier, MappingCarrier>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonMappiCode
var List = DbBus.Get(DbList.Common).Select<CodeCarrier, MappingCarrier>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode
{
Code = cc.Code,
Value = cc.EnName,
@ -75,14 +75,15 @@ namespace djy.Service.AFR
}
}
public List<CommonCodeValue> GetCTNALL()
public List<CommonMappiCode> GetCTNALL()
{
try
{
var List = DbBus.Get(DbList.Common).Select<CodeCtn, MappingCtn>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonCodeValue
var List = DbBus.Get(DbList.Common).Select<CodeCtn, MappingCtn>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode
{
Code = cc.Code,
Value = cc.Name,
MapCode = map.MapCode
}).Distinct().ToList();
return List;
}
@ -92,14 +93,16 @@ namespace djy.Service.AFR
}
}
public List<CommonCodeValue> GetPackage()
public List<CommonMappiCode> GetPackage()
{
try
{
var List = DbBus.Get(DbList.Common).Select<CodePackage, MappingPackage>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "Afr").ToList((cc, map) => new CommonCodeValue
var List = DbBus.Get(DbList.Common).Select<CodePackage, MappingPackage>().InnerJoin((cc, map) => cc.Code == map.Code && map.Module == "AMS").ToList((cc, map) => new CommonMappiCode
{
Code = cc.Code,
Value = cc.Name,
MapCode = map.MapCode,
MapName = map.MapName
}).Distinct().ToList();
return List;
}
@ -210,7 +213,7 @@ namespace djy.Service.AFR
.WhereIf(!string.IsNullOrEmpty(input.MBLNO), m => m.MBLNO.Contains(input.MBLNO))
.WhereIf(!string.IsNullOrEmpty(input.UserName), m => m.UserName.Contains(input.UserName))
.WhereIf(!string.IsNullOrEmpty(input.DischargeHarbour), m => m.DischargeHarbour.Contains(input.DischargeHarbour))
.WhereIf(!string.IsNullOrEmpty(input.ShipCompany), m => m.ShipCompany.Contains(input.ShipCompany))
.WhereIf(!string.IsNullOrEmpty(input.ShipCompanyName), m => m.ShipCompanyName.Contains(input.ShipCompanyName))
.WhereIf(input.CreateTimeStart != null, m => m.CreateTime >= input.CreateTimeStart)
.WhereIf(input.CreateTimeEnd != null, m => m.CreateTime <= input.CreateTimeEnd);
@ -484,14 +487,43 @@ namespace djy.Service.AFR
return history;
}
public Task Delete(string ids)
public async Task Delete(string ids)
{
throw new NotImplementedException();
if (string.IsNullOrEmpty(ids))
{
return;
}
DateTime nowTime = DateTime.Now;
public Task Send(string ids, string msgType)
string[] idArr = ids.Split(',');
foreach (string id in idArr)
{
throw new NotImplementedException();
await using DbTransaction tran = await GetDbAmsTransaction();
await DbAMS.Update<AFRMaster>()
.Set(h => h.IsDel == true)
.Set(h => h.LastUpdate == nowTime)
.WithTransaction(tran)
.Where(h => id == h.GID)
.ExecuteAffrowsAsync();
await DbAMS.Update<AFRHouse>()
.Set(h => h.IsDel == true)
.Set(h => h.LastUpdate == nowTime)
.WithTransaction(tran)
.Where(h => h.PID == id)
.ExecuteAffrowsAsync();
tran.Commit();
}
}
public async Task<string> Send(string ids, int sendType)
{
return sendType switch
{
_ => "发送成功",
};
}
public Task SaveReceipt(AFRReceiptDto input)
@ -499,5 +531,12 @@ namespace djy.Service.AFR
throw new NotImplementedException();
}
public async Task<List<AFRMasterHistory>> GetHistory(string id)
{
var data = await DbAMS.Select<AFRMasterHistory>()
.Where(h => h.PID == id)
.ToListAsync();
return data;
}
}
}

@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace djy_AfrApi.Controllers
@ -57,8 +58,8 @@ namespace djy_AfrApi.Controllers
/// </summary>
/// <param name="gid"></param>
/// <returns></returns>
[HttpGet("Get")]
public async Task<Response<AFRMaster>> Get(string gid)
[HttpGet("Detail")]
public async Task<Response<AFRMaster>> Detail(string gid)
{
var model = await _afrService.Get(gid);
return SuccessResp(model);
@ -97,14 +98,14 @@ namespace djy_AfrApi.Controllers
/// <summary>
/// 发送接口
/// </summary>
/// <param name="ids"></param>
/// <param name="msgType"></param>
/// <param name="ids">主键集合</param>
/// <param name="sendType">1:发送 2原始重发 3修改发送 4删除发送</param>
/// <returns></returns>
[HttpGet("Send")]
public async Task<Response> Send(string ids, string msgType)
public async Task<Response> Send(string ids, int sendType)
{
await _afrService.Send(ids, msgType);
return SuccessResp();
string message = await _afrService.Send(ids, sendType);
return SuccessResp(message);
}
/// <summary>
@ -120,6 +121,19 @@ namespace djy_AfrApi.Controllers
return SuccessResp("接收成功");
}
#endregion
/// <summary>
/// 获取历史记录
/// </summary>
/// <param name="id">主键</param>
/// <returns>历史记录列表</returns>
[HttpGet("GetHistory")]
public async Task<Response<List<AFRMasterHistory>>> GetHistory(string id)
{
var data = await _afrService.GetHistory(id);
return SuccessResp(data);
}
/// <summary>
/// 获取服务器当前时间
/// </summary>

@ -28,12 +28,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns>
[HttpGet("GetCountry")]
[RedisCaching]
public Response<List<CommonCNEN>> GetCountry(string strlink = "", int page = 0, int limit = 0)
public Response<List<CommonCNEN>> GetCountry()
{
var result = new Response<List<CommonCNEN>>();
try
{
result.Result = ser.GetCountry(strlink, page, limit);
result.Result = ser.GetCountry("", 0, 0);
}
catch (Exception ex)
{
@ -71,9 +71,9 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns>
[HttpGet("GetCTNALL")]
[RedisCaching]
public Response<List<CommonCodeValue>> GetCTNALL()
public Response<List<CommonMappiCode>> GetCTNALL()
{
var result = new Response<List<CommonCodeValue>>();
var result = new Response<List<CommonMappiCode>>();
try
{
result.Result = ser.GetCTNALL();
@ -94,9 +94,9 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns>
[HttpGet("GetPackage")]
[RedisCaching]
public Response<List<CommonCodeValue>> GetPackage()
public Response<List<CommonMappiCode>> GetPackage()
{
var result = new Response<List<CommonCodeValue>>();
var result = new Response<List<CommonMappiCode>>();
try
{
result.Result = ser.GetPackage();
@ -115,12 +115,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns>
[HttpGet("GetDangerousGoods")]
[RedisCaching]
public Response<List<CodeDangerGradeDto>> GetDangerousGoods(string strlink = "",int page = 0, int limit = 0)
public Response<List<CodeDangerGradeDto>> GetDangerousGoods()
{
var result = new Response<List<CodeDangerGradeDto>>();
try
{
result.Result = ser.GetDangerousGoods(strlink);
result.Result = ser.GetDangerousGoods("");
}
catch (Exception ex)
{
@ -158,12 +158,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns>
[HttpGet("GetPort")]
[RedisCaching]
public Response<List<CommonCodeValue>> GetPort(string strlink = "", int page = 0, int limit = 0)
public Response<List<CommonCodeValue>> GetPort()
{
var result = new Response<List<CommonCodeValue>>();
try
{
result.Result = ser.GetPort(strlink, page, limit);
result.Result = ser.GetPort("", 0, 0);
}
catch (Exception ex)
{
@ -180,12 +180,12 @@ namespace djy_AfrApi.Controllers.Common
/// <returns></returns>
[HttpGet("GetVessel")]
[RedisCaching]
public Response<List<CommonCodeValue>> GetVessel(string strlink = "", int page = 0,int limit =0)
public Response<List<CommonCodeValue>> GetVessel()
{
var result = new Response<List<CommonCodeValue>>();
try
{
result.Result = ser.GetVessel(strlink, page,limit);
result.Result = ser.GetVessel("", 0, 0);
}
catch (Exception ex)
{

@ -1,22 +1,19 @@
using Common.Tools;
using Common.Utilities;
using djy_AfrApi.Attributes;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc.Controllers;
using Newtonsoft.Json;
using System.Diagnostics;
using System;
using System.IO;
using System.Threading.Tasks;
using NPOI.XWPF.UserModel;
using djy_AfrApi.Attributes;
namespace djy_AfrApi.Milldlewares
{
public class CommonCacheMiddleware
public class CommonDataCacheMiddleware
{
private readonly RequestDelegate next;
public CommonCacheMiddleware(RequestDelegate next)
public CommonDataCacheMiddleware(RequestDelegate next)
{
this.next = next;
}

@ -42,7 +42,7 @@ namespace djy_AfrApi.Middlewares
/// </summary>
public static IApplicationBuilder UseCommonCacheMiddleware(this IApplicationBuilder app)
{
return app.UseMiddleware<CommonCacheMiddleware>();
return app.UseMiddleware<CommonDataCacheMiddleware>();
}
}
}

Loading…
Cancel
Save