|
|
|
@ -1673,21 +1673,39 @@ namespace Myshipping.Application
|
|
|
|
|
if (rtnList.Count(x => x.Success == false) == 0)
|
|
|
|
|
{
|
|
|
|
|
var tCustId = list.First().BookingTenantId;
|
|
|
|
|
_logger.LogInformation($"提交成功,准备自动订舱和审核");
|
|
|
|
|
|
|
|
|
|
//自动订舱和自动审核
|
|
|
|
|
var cust = await _repCustomer.AsQueryable().FirstAsync(x => x.CustSysId == tCustId);
|
|
|
|
|
var cust = await _repCustomer.AsQueryable().Filter(null, true).FirstAsync(x => x.CustSysId == tCustId);
|
|
|
|
|
if (cust != null)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"找到客户端租户对应客户:{cust.FullName}");
|
|
|
|
|
|
|
|
|
|
var paraCallApiAuditAuto = await _repCustomerParamValue.AsQueryable().FirstAsync(x => x.CustomerId == cust.Id && x.ParaCode == "BookingCallApiAndAuditAuto");
|
|
|
|
|
if (paraCallApiAuditAuto != null && paraCallApiAuditAuto.ItemCode == "YES")
|
|
|
|
|
{
|
|
|
|
|
foreach (var ordId in ordIdList)
|
|
|
|
|
{
|
|
|
|
|
await PostApiSO(ordId);
|
|
|
|
|
await AuditBooking(ordId, true, "系统自动审核");
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_logger.LogInformation($"自动订舱:{ordId}");
|
|
|
|
|
await PostApiSO(ordId);
|
|
|
|
|
_logger.LogInformation($"自动审核:{ordId}");
|
|
|
|
|
await AuditBooking(ordId, true, "系统自动审核");
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
_logger.LogWarning($"自动订舱失败:{ordId},错误信息:{ex.Message}");
|
|
|
|
|
await AuditBooking(ordId, false, ex.Message, notFeedback: true);
|
|
|
|
|
throw ex;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_logger.LogWarning($"未找到客户,CustSysId:{tCustId}");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return rtnList;
|
|
|
|
@ -1698,9 +1716,9 @@ namespace Myshipping.Application
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
[HttpPost("/BookingCustomerOrder/AuditBooking")]
|
|
|
|
|
public async Task AuditBooking(long id, bool accept, string comment)
|
|
|
|
|
public async Task AuditBooking(long id, bool accept, string comment, bool notFeedback = false)
|
|
|
|
|
{
|
|
|
|
|
var model = _rep.FirstOrDefault(x => x.Id == id);
|
|
|
|
|
var model = await _rep.AsQueryable().Filter(null, true).FirstAsync(x => x.Id == id);
|
|
|
|
|
if (model == null)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah("未找到业务信息");
|
|
|
|
@ -1720,33 +1738,37 @@ namespace Myshipping.Application
|
|
|
|
|
model.BSSTATUS = "已驳回";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//回推回执
|
|
|
|
|
var feedbackData = new BookingCustomerRecAduitFeedbackDto()
|
|
|
|
|
JObject jobjRtn = null;
|
|
|
|
|
if (!notFeedback)
|
|
|
|
|
{
|
|
|
|
|
Id = model.BSNO,
|
|
|
|
|
Accept = accept,
|
|
|
|
|
Comment = comment
|
|
|
|
|
};
|
|
|
|
|
//回推回执
|
|
|
|
|
var feedbackData = new BookingCustomerRecAduitFeedbackDto()
|
|
|
|
|
{
|
|
|
|
|
Id = model.BSNO,
|
|
|
|
|
Accept = accept,
|
|
|
|
|
Comment = comment
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var feedbackObj = new BookingFeedbackDto(BookingFeedbackType.Audit.ToString());
|
|
|
|
|
feedbackObj.JsonContent = feedbackData.ToJsonString();
|
|
|
|
|
var feedbackObj = new BookingFeedbackDto(BookingFeedbackType.Audit.ToString());
|
|
|
|
|
feedbackObj.JsonContent = feedbackData.ToJsonString();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"回推审核数据:{JsonConvert.SerializeObject(feedbackObj)},URL:{model.FeedbackUrl}");
|
|
|
|
|
_logger.LogInformation($"回推审核数据:{JsonConvert.SerializeObject(feedbackObj)},URL:{model.FeedbackUrl}");
|
|
|
|
|
|
|
|
|
|
var rtn = await model.FeedbackUrl
|
|
|
|
|
.SetHeaders(new Dictionary<string, object> {
|
|
|
|
|
var rtn = await model.FeedbackUrl
|
|
|
|
|
.SetHeaders(new Dictionary<string, object> {
|
|
|
|
|
{ CommonConst.API_USER_HEADER_KEY, model.FeedbackKey},
|
|
|
|
|
{ CommonConst.API_USER_HEADER_SECRET, model.FeedbackSecret}
|
|
|
|
|
})
|
|
|
|
|
.SetBody(feedbackObj, "application/x-www-form-urlencoded")
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
})
|
|
|
|
|
.SetBody(feedbackObj, "application/x-www-form-urlencoded")
|
|
|
|
|
.PostAsStringAsync();
|
|
|
|
|
|
|
|
|
|
_logger.LogInformation($"回推审核返回:{rtn}");
|
|
|
|
|
_logger.LogInformation($"回推审核返回:{rtn}");
|
|
|
|
|
|
|
|
|
|
var jobjRtn = JObject.Parse(rtn);
|
|
|
|
|
if (jobjRtn.GetIntValue("code") != 200)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(jobjRtn.GetStringValue("message"));
|
|
|
|
|
jobjRtn = JObject.Parse(rtn);
|
|
|
|
|
if (jobjRtn.GetIntValue("code") != 200)
|
|
|
|
|
{
|
|
|
|
|
throw Oops.Bah(jobjRtn.GetStringValue("message"));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1757,7 +1779,7 @@ namespace Myshipping.Application
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//进入订舱台账
|
|
|
|
|
if (accept)
|
|
|
|
|
if (accept && jobjRtn != null)
|
|
|
|
|
{
|
|
|
|
|
var custBookId = jobjRtn.GetStringValue("data"); //返回的客户订舱系统的订舱数据id
|
|
|
|
|
var bkOrder = model.Adapt<BookingOrder>();
|
|
|
|
|