修改规则用户反馈

optimize
jianghaiqing 1 year ago
parent 2b46bb5ffa
commit f068d82dd8

@ -1197,6 +1197,15 @@ namespace Myshipping.Application
DateTime nowDate = DateTime.Now;
try
{
if(string.IsNullOrWhiteSpace(model.ruleName))
throw Oops.Oh($"规则名称不能为空");
if (string.IsNullOrWhiteSpace(model.opinionType))
throw Oops.Oh($"意见类型不能为空");
if (string.IsNullOrWhiteSpace(model.opinionContent))
throw Oops.Oh($"意见内容不能为空");
RulesEngineUserFeedBackMessageInfo msgModel = new RulesEngineUserFeedBackMessageInfo();
msgModel.Head = new RulesEngineUserFeedBackHead
@ -1222,13 +1231,31 @@ namespace Myshipping.Application
submitUser = UserManager.Name
};
DateTime bDate = DateTime.Now;
var rlt = await ExcuteRuleOpinion(App.Configuration["RulesEngineOpinionUrl"], msgModel, batchNo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, rlt.succ ? "成功" : "失败");
if (!rlt.succ)
{
throw Oops.Oh($"请求失败,原因={rlt.msg}");
}
result.succ = true;
result.msg = "提交成功";
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"提交规则意见失败,{ex.Message}";
_logger.LogInformation("批次={no} 异常,{msg}", batchNo, ex.Message);
}
return result;
@ -1244,14 +1271,63 @@ namespace Myshipping.Application
{
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
};
DateTime bDate = DateTime.Now;
var rlt = await ExcuteRuleOpinion(App.Configuration["RulesEngineQueryOpinionUrl"], msgModel, batchNo);
DateTime eDate = DateTime.Now;
TimeSpan ts = eDate.Subtract(bDate);
var timeDiff = ts.TotalMilliseconds;
_logger.LogInformation("批次={no} 请求完成,耗时:{timeDiff}ms. 结果{msg}", batchNo, timeDiff, rlt.succ ? "成功" : "失败");
if (!rlt.succ)
{
throw Oops.Oh($"请求失败,原因={rlt.msg}");
}
result.succ = true;
result.msg = "查询成功";
result.rows = rlt.rows;
}
catch (Exception ex)
{
result.succ = false;
result.msg = $"查询规则意见历史失败,{ex.Message}";
_logger.LogInformation("批次={no} 异常,{msg}", batchNo, ex.Message);
}
return result;

Loading…
Cancel
Save