|
|
@ -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;
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
|
|
|
1、填充请求的类,并生成JSON报文
|
|
|
|
|
|
|
|
2、POST请求接口,并记录回执。
|
|
|
|
|
|
|
|
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>
|
|
|
|
/// 获取个人或公司网站账户配置
|
|
|
|
/// 获取个人或公司网站账户配置
|
|
|
|