jianghaiqing 8 months ago
commit 28df50070f

@ -12038,7 +12038,6 @@ namespace Myshipping.Application
{
throw Oops.Bah("大简云电放服务接口Secret未配置请联系管理员");
}
url += "/v1/submit";
var webAccount = _webAccountConfig.GetAccountConfig("MSKWeb", UserManager.UserId).Result;
if (webAccount == null)
@ -12050,6 +12049,8 @@ namespace Myshipping.Application
var mappingIssueType = _cache.GetAllMappingIssueType().Result;
List<SubmitTelexResultDto> result = new();
List<(long Id, string MBLNO, string CarrierId)> pushList = new();
foreach (var order in orderList)
{
try
@ -12081,21 +12082,104 @@ namespace Myshipping.Application
// 判断签单方式是否符合条件
string issueType = mappingIssueType.FirstOrDefault(x => x.Module == "TelexCheck" && x.Code == order.ISSUETYPE)?.MapCode;
issueType = issueType?? order.ISSUETYPE;
issueType = issueType ?? order.ISSUETYPE;
if (!issueType.Equals("telex", StringComparison.OrdinalIgnoreCase))
{
result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"签单方式非电放"));
continue;
}
pushList.Add((order.Id, order.MBLNO, carrierId));
}
catch (Exception ex)
{
_logger.LogError("请求电放条件判断的过程中发生未知异常mblno={mblno}, ex={ex}", order.MBLNO, ex);
result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"提交错误:{ex.Message}"));
continue;
}
}
if (pushList.Count == 0)
{
return result;
}
if (ids.Length > 1)
{
url += "/v1/tasks";
var mblnos = string.Concat(',', pushList.Select(x => x.MBLNO));
try
{
// 提交电放
var data = pushList.Select(x => new
{
web_code = x.CarrierId,
web_user = webAccount.Account,
web_psw = webAccount.Password,
bno = x.MBLNO,
email = UserManager.Email
});
var body = new
{
user_key = key,
user_secret = secret,
data = data
};
_logger.LogInformation("请求电放提交接口开始mblnos={mblnos}, url={url}, body={body}", mblnos, url, body);
var rtn = await url.SetBody(body).PostAsStringAsync();
_logger.LogInformation("请求电放提交接口结束rtn={rtn}", rtn);
var jsonRtn = JObject.Parse(rtn);
if (jsonRtn.GetIntValue("code") == 200)
{
_logger.LogInformation("请求电放提交接口成功mblnos={mblnos}", mblnos);
foreach (var item in pushList)
{
// 推送 电放已安排 状态
var pushModel = new ModifyServiceProjectStatusDto
{
BookingId = item.Id,
SourceType = TrackingSourceTypeEnum.MANUAL,
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
new ModifyServiceProjectStatusDetailDto { StatusCode = "DFYAP" } }
};
var saveStatusRlt = await bookingValueAddedService.SaveServiceStatus(pushModel);
_logger.LogInformation("请求电放提交接口成功后推送 电放已安排 状态mblno={mblno}JSON={json} ,结果={rlt}",
item.MBLNO, JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt));
result.Add(new SubmitTelexResultDto(item.MBLNO, true, null));
}
}
else
{
var msg = jsonRtn.GetStringValue("msg")?.Replace("爬虫", "");
_logger.LogInformation("请求电放提交接口失败mblnos={mblnos}, 电放服务返回:{msg}", mblnos, msg);
result.AddRange(pushList.Select(x => new SubmitTelexResultDto(x.MBLNO, false, $"电放服务返回:{msg}")));
}
}
catch (Exception ex)
{
_logger.LogError("请求电放服务的过程中发生未知异常mblnos={mblnos}, ex={ex}", mblnos, ex);
result.AddRange(pushList.Select(x => new SubmitTelexResultDto(x.MBLNO, false, $"错误:{ex.Message}")));
}
}
else
{
url += "/v1/submit";
var order = pushList[0];
try
{
// 提交电放
var body = new
{
user_key = key,
user_secret = secret,
web_code = carrierId,
web_user = webAccount.Account,
web_psw = webAccount.Password,
web_code = order.CarrierId,
bno = order.MBLNO
};
@ -12114,7 +12198,7 @@ namespace Myshipping.Application
BookingId = order.Id,
SourceType = TrackingSourceTypeEnum.MANUAL,
StatusCodes = new List<ModifyServiceProjectStatusDetailDto> {
new ModifyServiceProjectStatusDetailDto { StatusCode = "DFYAP" } }
new ModifyServiceProjectStatusDetailDto { StatusCode = "DFYAP" } }
};
var saveStatusRlt = await bookingValueAddedService.SaveServiceStatus(pushModel);
_logger.LogInformation("请求电放提交接口成功后推送 电放已安排 状态JSON={json} ,结果={rlt}", JSON.Serialize(pushModel), JSON.Serialize(saveStatusRlt));
@ -12130,11 +12214,11 @@ namespace Myshipping.Application
}
catch (Exception ex)
{
_logger.LogError("请求电放提交接口过程中发生未知异常mblno={mblno}, ex={ex}", order.MBLNO, ex);
_logger.LogError("请求电放服务的过程中发生未知异常mblno={mblno}, ex={ex}", order.MBLNO, ex);
result.Add(new SubmitTelexResultDto(order.MBLNO, false, $"错误:{ex.Message}"));
continue;
}
}
return result;
}
#endregion

@ -12561,6 +12561,13 @@
<member name="M:Myshipping.Core.Service.DjyTenantParamService.List(System.String,System.String)">
<summary>
获取租户参数类别
准备废弃,使用/DJYTenantParam/page替代
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.DjyTenantParamService.Page(Myshipping.Core.Service.QueryDJYTenantParamInput)">
<summary>
分页获取租户参数类别
</summary>
<returns></returns>
</member>
@ -12591,6 +12598,13 @@
<member name="M:Myshipping.Core.Service.DjyTenantParamService.GetParamValue(System.Int64,System.String)">
<summary>
获取参数
准备废弃,使用/DJYTenantParam/PageParamValue替代
</summary>
<returns></returns>
</member>
<member name="M:Myshipping.Core.Service.DjyTenantParamService.PageParamValue(Myshipping.Core.Service.QueryTenantParamValueInput)">
<summary>
分页获取参数值
</summary>
<returns></returns>
</member>
@ -12713,11 +12727,6 @@
租户参数类别表查询输入参数
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDJYTenantParamInput.Id">
<summary>
主键Id
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDJYTenantParamInput.ParaCode">
<summary>
类别代码
@ -12733,14 +12742,19 @@
业务大类
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDJYTenantParamInput.Remark">
<member name="T:Myshipping.Core.Service.QueryTenantParamValueInput">
<summary>
备注
租户参数值查询输入参数
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryDJYTenantParamInput.Sort">
<member name="P:Myshipping.Core.Service.QueryTenantParamValueInput.ParaCode">
<summary>
排序
类别代码
</summary>
</member>
<member name="P:Myshipping.Core.Service.QueryTenantParamValueInput.TenantId">
<summary>
租户id
</summary>
</member>
<member name="T:Myshipping.Core.Service.DJYTenantParamOutput">
@ -12768,6 +12782,11 @@
业务大类
</summary>
</member>
<member name="P:Myshipping.Core.Service.DJYTenantParamOutput.TypeName">
<summary>
业务大类名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.DJYTenantParamOutput.Remark">
<summary>
备注
@ -12778,6 +12797,51 @@
排序
</summary>
</member>
<member name="T:Myshipping.Core.Service.DjyTenantParamValueListOutput">
<summary>
列表输出
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.ParaCode">
<summary>
参数类别
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.ParaName">
<summary>
类别名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.TenantId">
<summary>
租户id
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.TenantName">
<summary>
租户名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.ItemCode">
<summary>
参数值
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.ItemCodeName">
<summary>
参数值名称
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.Remark">
<summary>
备注
</summary>
</member>
<member name="P:Myshipping.Core.Service.DjyTenantParamValueListOutput.Sort">
<summary>
排序
</summary>
</member>
<member name="T:Myshipping.Core.Service.DjyUserConfigService">
<summary>
用户自定义配置服务

@ -25,13 +25,19 @@ namespace Myshipping.Core.Service
private readonly SqlSugarRepository<DjyTenantParamValue> _valuerep;
private readonly ILogger<DjyTenantParam> _logger;
private readonly ISysCacheService _cache;
public DjyTenantParamService(SqlSugarRepository<DjyTenantParam> rep, SqlSugarRepository<DjyTenantParamItem> itemrep, SqlSugarRepository<DjyTenantParamValue> valuerep, ISysCacheService cache, ILogger<DjyTenantParam> logger)
private readonly SqlSugarRepository<SysTenant> _repTenant;
public DjyTenantParamService(SqlSugarRepository<DjyTenantParam> rep,
SqlSugarRepository<DjyTenantParamItem> itemrep,
SqlSugarRepository<DjyTenantParamValue> valuerep,
ISysCacheService cache, ILogger<DjyTenantParam> logger,
SqlSugarRepository<SysTenant> repTenant)
{
_rep = rep;
_logger = logger;
_itemrep = itemrep;
_valuerep = valuerep;
_cache = cache;
_repTenant = repTenant;
}
#region 类别
@ -119,6 +125,7 @@ namespace Myshipping.Core.Service
/// <summary>
/// 获取租户参数类别
/// 准备废弃,使用/DJYTenantParam/page替代
/// </summary>
/// <returns></returns>
[HttpGet("/DJYTenantParam/list")]
@ -126,6 +133,31 @@ namespace Myshipping.Core.Service
{
return await _rep.AsQueryable().WhereIF(!string.IsNullOrEmpty(Type), x => x.Type == Type).WhereIF(!string.IsNullOrEmpty(ParaName), x => x.ParaName.Contains(ParaName)).OrderBy(x => x.Sort).ToListAsync();
}
/// <summary>
/// 分页获取租户参数类别
/// </summary>
/// <returns></returns>
[HttpGet("/DJYTenantParam/page")]
public async Task<SqlSugarPagedList<DJYTenantParamOutput>> Page(QueryDJYTenantParamInput input)
{
var list = await _rep.AsQueryable()
.WhereIF(!string.IsNullOrEmpty(input.Type), x => x.Type == input.Type)
.WhereIF(!string.IsNullOrEmpty(input.ParaCode), x => x.ParaCode == input.ParaCode)
.WhereIF(!string.IsNullOrEmpty(input.ParaName), x => x.ParaName.Contains(input.ParaName))
.OrderBy(x => x.Sort)
.ToPagedListAsync(input.PageNo, input.PageSize);
var rtn = list.Adapt<SqlSugarPagedList<DJYTenantParamOutput>>();
var dict = await _cache.GetAllDictData();
foreach (var item in rtn.Items)
{
var d = dict.FirstOrDefault(x => x.TypeCode == "tenant_param_group" && x.Code == item.Type);
item.TypeName = d.Value;
}
return rtn;
}
#endregion
#region 参数
@ -232,6 +264,7 @@ namespace Myshipping.Core.Service
#region 值
/// <summary>
/// 获取参数
/// 准备废弃,使用/DJYTenantParam/PageParamValue替代
/// </summary>
/// <returns></returns>
[HttpGet("/DJYTenantParam/getParamValue")]
@ -239,6 +272,44 @@ namespace Myshipping.Core.Service
{
return await _valuerep.AsQueryable().Filter(null, true).WhereIF(paraCode != null, x => x.ParaCode == paraCode).OrderBy(x => x.Sort).ToListAsync();
}
/// <summary>
/// 分页获取参数值
/// </summary>
/// <returns></returns>
[HttpGet("/DJYTenantParam/PageParamValue")]
public async Task<SqlSugarPagedList<DjyTenantParamValueListOutput>> PageParamValue(QueryTenantParamValueInput input)
{
var list = await _valuerep.AsQueryable().Filter(null, true)
.WhereIF(!string.IsNullOrEmpty(input.ParaCode), x => x.ParaCode == input.ParaCode)
.WhereIF(input.TenantId.HasValue, x => x.TenantId == input.TenantId)
.OrderBy(x => x.Sort)
.ToPagedListAsync(input.PageNo, input.PageSize);
var rtn = list.Adapt<SqlSugarPagedList<DjyTenantParamValueListOutput>>();
var listParam = await _rep.AsQueryable().ToListAsync();
var listParamItem = await _itemrep.AsQueryable().ToListAsync();
var listTenant = await _repTenant.AsQueryable().Select(x => new { x.Id, x.Name }).ToListAsync();
foreach (var item in rtn.Items)
{
var p = listParam.FirstOrDefault(x => x.ParaCode == item.ParaCode);
item.ParaName = p.ParaName;
var t = listTenant.FirstOrDefault(x => x.Id == item.TenantId);
item.TenantName = t.Name;
var it= listParamItem.FirstOrDefault(x=>x.ParaCode == item.ParaCode&&x.ItemCode==item.ItemCode);
if (it != null)
{
item.ItemCodeName = it.ItemName;
}
}
return rtn;
}
/// <summary>
/// 增加参数
/// </summary>
@ -323,19 +394,19 @@ namespace Myshipping.Core.Service
[NonAction]
public async Task<List<DjyTenantParamValueOutput>> GetParaCodeWithValue(string[] paraCodes)
{
List<DjyTenantParamValueOutput> result = await _rep.AsQueryable()
.Filter(null, true)
.LeftJoin<DjyTenantParamValue>((t1, t2) => t1.ParaCode == t2.ParaCode)
.Where((t1, t2) => t2.TenantId == UserManager.TENANT_ID)
.WhereIF(paraCodes?.Any() == true, (t1, t2) => paraCodes.Contains(t1.ParaCode))
.Select((t1, t2) => new DjyTenantParamValueOutput()
{
ParaCode = t1.ParaCode,
ParaName = t1.ParaName,
ParaType = t1.Type,
ParaValue = t2.ItemCode
})
.ToListAsync();
List<DjyTenantParamValueOutput> result = await _rep.AsQueryable()
.Filter(null, true)
.LeftJoin<DjyTenantParamValue>((t1, t2) => t1.ParaCode == t2.ParaCode)
.Where((t1, t2) => t2.TenantId == UserManager.TENANT_ID)
.WhereIF(paraCodes?.Any() == true, (t1, t2) => paraCodes.Contains(t1.ParaCode))
.Select((t1, t2) => new DjyTenantParamValueOutput()
{
ParaCode = t1.ParaCode,
ParaName = t1.ParaName,
ParaType = t1.Type,
ParaValue = t2.ItemCode
})
.ToListAsync();
return result;
}
#endregion

@ -74,11 +74,6 @@ namespace Myshipping.Core.Service
/// </summary>
public class QueryDJYTenantParamInput : PageInputBase
{
/// <summary>
/// 主键Id
/// </summary>
public virtual long Id { get; set; }
/// <summary>
/// 类别代码
/// </summary>
@ -94,15 +89,24 @@ namespace Myshipping.Core.Service
/// </summary>
public virtual string Type { get; set; }
}
/// <summary>
/// 租户参数值查询输入参数
/// </summary>
public class QueryTenantParamValueInput : PageInputBase
{
/// <summary>
/// 备注
/// 类别代码
/// </summary>
public virtual string Remark { get; set; }
public virtual string ParaCode { get; set; }
/// <summary>
/// 排序
/// 租户id
/// </summary>
public virtual int Sort { get; set; }
public long? TenantId { get; set; }
}
}

@ -27,6 +27,11 @@ namespace Myshipping.Core.Service
/// </summary>
public string Type { get; set; }
/// <summary>
/// 业务大类名称
/// </summary>
public string TypeName { get; set; }
/// <summary>
/// 备注
/// </summary>

@ -7,4 +7,45 @@
public string ParaType { get; set; }
public string ParaValue { get; set; }
}
/// <summary>
/// 列表输出
/// </summary>
public class DjyTenantParamValueListOutput
{
/// <summary>
/// 参数类别
/// </summary>
public string ParaCode { get; set; }
/// <summary>
/// 类别名称
/// </summary>
public string ParaName { get; set; }
/// <summary>
/// 租户id
/// </summary>
public long? TenantId { get; set; }
/// <summary>
/// 租户名称
/// </summary>
public string TenantName { get; set; }
/// <summary>
/// 参数值
/// </summary>
public string ItemCode { get; set; }
/// <summary>
/// 参数值名称
/// </summary>
public string ItemCodeName { get; set; }
/// <summary>
/// 备注
/// </summary>
public string Remark { get; set; }
/// <summary>
/// 排序
/// </summary>
public int? Sort { get; set; }
}
}

Loading…
Cancel
Save