修改EDI,增加主提单号为空取订舱编号填充

新增加规则用户反馈接口
optimize
jianghaiqing 1 year ago
parent 9461a6b866
commit ea0b6f4c3b

@ -6223,6 +6223,16 @@ namespace Myshipping.Application
primaryModel.ORDERNO = order.BOOKINGNO; primaryModel.ORDERNO = order.BOOKINGNO;
} }
//2023-06-15 按照沟通要求,如果主提单号为空,并且订舱编号不为空,可以去订舱编号填入主提单号
if (string.IsNullOrWhiteSpace(primaryModel.MBLNO))
{
if (!string.IsNullOrWhiteSpace(order.CUSTNO))
{
_logger.LogInformation("批次={no} 主题单号为空 MBLNO={mblno} 取订舱编号补到主提单号 custno={custno}", batchNo, primaryModel.MBLNO, order.CUSTNO);
primaryModel.MBLNO = order.CUSTNO;
}
}
var curBasePkgs = basePkgsList.FirstOrDefault(p => p.Name.Equals(order.KINDPKGS, StringComparison.OrdinalIgnoreCase)); var curBasePkgs = basePkgsList.FirstOrDefault(p => p.Name.Equals(order.KINDPKGS, StringComparison.OrdinalIgnoreCase));

@ -1182,6 +1182,129 @@ namespace Myshipping.Application
} }
#endregion #endregion
/// <summary>
/// 提交规则意见
/// </summary>
/// <param name="model">规则意见详情</param>
/// <returns>返回回执</returns>
[HttpPost("/BookingValueAdded/SubmitRuleOpinion")]
public async Task<TaskManageOrderResultDto> SubmitRuleOpinion([FromBody] RulesEngineUserFeedBackDto model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
string batchNo = IDGen.NextID().ToString();
DateTime nowDate = DateTime.Now;
try
{
RulesEngineUserFeedBackMessageInfo msgModel = new RulesEngineUserFeedBackMessageInfo();
msgModel.Head = new RulesEngineUserFeedBackHead
{
GID = batchNo,
MessageType = "BUSI_RULE",
SenderId = App.Configuration["RulesEngineSender"],
SenderName = App.Configuration["RulesEngineSenderName"],
SenderKey = App.Configuration["RulesEngineAuthKey"],
ReceiverId = "RulesEngine",
ReceiverName = "大简云规则引擎",
Version = "1.0",
RequestDate = nowDate.ToString("yyyy-MM-dd HH:mm:ss"),
RequestAction = "Add",
};
msgModel.Main = new RulesEngineUserFeedBackMain
{
ruleName = model.ruleName,
opinionType = model.opinionType,
opinionContent = model.opinionContent,
ruleNotice = model.ruleNotice,
submitUser = UserManager.Name
};
var rlt = await ExcuteRuleOpinion(App.Configuration["RulesEngineOpinionUrl"], msgModel, batchNo);
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"提交规则意见失败,{ex.Message}";
}
return result;
}
/// <summary>
/// 查询规则意见历史
/// </summary>
/// <param name="model">规则意见详情</param>
/// <returns>返回回执</returns>
[HttpPost("/BookingValueAdded/GetRuleOpinionLog")]
public async Task<TaskManageOrderResultDto> GetRuleOpinionLog([FromBody] RulesEngineUserFeedBackDto model)
{
TaskManageOrderResultDto result = new TaskManageOrderResultDto();
try
{
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"查询规则意见历史失败,{ex.Message}";
}
return result;
}
#region 规则用户反馈请求远端
/// <summary>
/// 规则用户反馈请求远端
/// </summary>
/// <param name="url">请求URL</param>
/// <param name="info">请求详情</param>
/// <param name="batchNo">批次号</param>
/// <returns>返回结果</returns>
[NonAction]
private async Task<RulesEngineWebApiResult> ExcuteRuleOpinion(string url, RulesEngineUserFeedBackMessageInfo info, string batchNo)
{
RulesEngineWebApiResult model = null;
/*
1JSON
2POST
3
*/
try
{
_logger.LogInformation("批次={no} 对应请求报文 request={res}", batchNo, JSON.Serialize(info));
var res = await url.OnClientCreating(client => {
// client 为 HttpClient 对象
client.Timeout = TimeSpan.FromMinutes(15); // 设置超时时间 15分钟
}).SetHttpMethod(HttpMethod.Post)
.SetBody(JSON.Serialize(info), "application/json")
.SetContentEncoding(Encoding.UTF8)
.PostAsync();
_logger.LogInformation("批次={no} 对应请求报文完成 res={res}", batchNo, JSON.Serialize(res));
if (res.StatusCode == System.Net.HttpStatusCode.OK)
{
var userResult = await res.Content.ReadAsStringAsync();
model = JSON.Deserialize<RulesEngineWebApiResult>(userResult);
}
}
catch (Exception ex)
{
//写日志
if (ex is HttpRequestException)
throw Oops.Oh(10000002);
}
return model;
}
#endregion
/// <summary> /// <summary>
/// 获取个人或公司网站账户配置 /// 获取个人或公司网站账户配置

@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 规则用户反馈
/// </summary>
public class RulesEngineUserFeedBackDto
{
/// <summary>
/// 规则名称
/// </summary>
public string ruleName { get; set; }
/// <summary>
/// 规则提示
/// </summary>
public string ruleNotice { get; set; }
/// <summary>
/// 规则反馈用户名
/// </summary>
public string submitUser { get; set; }
/// <summary>
/// 规则反馈意见类型
/// </summary>
public string opinionType { get; set; }
/// <summary>
/// 规则反馈意见内容
/// </summary>
public string opinionContent { get; set; }
}
}

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Myshipping.Application
{
/// <summary>
/// 规则用户反馈报文详情
/// </summary>
public class RulesEngineUserFeedBackMessageInfo
{
/// <summary>
/// 表头
/// </summary>
public RulesEngineUserFeedBackHead Head { get; set; }
/// <summary>
/// 表体
/// </summary>
public RulesEngineUserFeedBackMain Main { get; set; }
}
/// <summary>
/// 报文表头
/// </summary>
public class RulesEngineUserFeedBackHead : WebAPIHeadBase
{
/// <summary>
/// 请求授权KEY
/// </summary>
/// <example>FQbjpRF6vgrrGqxdcArDHtuQQqbXhefn+1KY28aeNUho7dL25glogc0n1uIJUwsCdsEhTdWM0w6qj7HgxWi9nD0r3aONCdP+nOYtRx2+BvA=</example>
[Required(ErrorMessage = "必填")]
public string SenderKey { get; set; }
}
/// <summary>
/// 报文表体
/// </summary>
public class RulesEngineUserFeedBackMain
{
/// <summary>
/// 规则名称
/// </summary>
public string ruleName { get; set; }
/// <summary>
/// 规则提示
/// </summary>
public string ruleNotice { get; set; }
/// <summary>
/// 规则反馈用户名
/// </summary>
public string submitUser { get; set; }
/// <summary>
/// 规则反馈意见类型
/// </summary>
public string opinionType { get; set; }
/// <summary>
/// 规则反馈意见内容
/// </summary>
public string opinionContent { get; set; }
}
}

@ -57,5 +57,21 @@ namespace Myshipping.Application
/// <param name="batchBCList">批量BC更新列表</param> /// <param name="batchBCList">批量BC更新列表</param>
/// <returns>返回回执</returns> /// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> BatchBCUpdate(List<BatchBCDto> batchBCList); Task<TaskManageOrderResultDto> BatchBCUpdate(List<BatchBCDto> batchBCList);
/// <summary>
/// 提交规则意见
/// </summary>
/// <param name="model">规则意见详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> SubmitRuleOpinion(RulesEngineUserFeedBackDto model);
/// <summary>
/// 查询规则意见历史
/// </summary>
/// <param name="model">规则意见详情</param>
/// <returns>返回回执</returns>
Task<TaskManageOrderResultDto> GetRuleOpinionLog(RulesEngineUserFeedBackDto model);
} }
} }

@ -112,6 +112,8 @@
"RulesEngineSender": "NewOceanBooking", "RulesEngineSender": "NewOceanBooking",
"RulesEngineSenderName": "新海运订舱平台", "RulesEngineSenderName": "新海运订舱平台",
"RulesEngineProjects": "OCEAN_BOOKING", "RulesEngineProjects": "OCEAN_BOOKING",
"RulesEngineOpinionUrl": "http://60.209.125.238:35210/api/RulesEngineUserFeedBackManage/SubmitUserFeedBack",
"RulesEngineQueryOpinionUrl": "http://60.209.125.238:35210/api/RulesEngineUserFeedBackManage/QueryUserFeedBackLog",
"FriendlyExceptionSettings": { "FriendlyExceptionSettings": {
"HideErrorCode": true "HideErrorCode": true
}, },

Loading…
Cancel
Save