- BondCalcHepler.BondCalc 新增可选 targetDate(估值日) 参数并写入请求体,透传至代理 zszq-bond-oms 的 targetDate(→bond-calc settlementDate);不传则沿用代理默认 T+1,与 bond-oms-ui 契约一致。 - 新增 out errorMsg 重载:地址未配/无响应/success=false/业务错误码 errCode!=0/异常 均返回 null 并透出真实中文原因;日志级别由 Info 升为 Error,try/catch 包裹。 - BondController.CalcBond 把 errorMsg 透传给 JsonError,不再硬编码"计算价格失败"。 - BondCalcByDate(自动结算路径) 同步加 errCode/空守卫,避免回写坏数据。
24 lines
791 B
C#
24 lines
791 B
C#
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
|
namespace YLErp.Web.Controllers
|
|
{
|
|
public class BondController : BaseController
|
|
{
|
|
|
|
[AllowAnonymous]
|
|
public JsonResult CalcBond(string underlyingCode, decimal price, string priceType, string targetDate = null)
|
|
{
|
|
string errorMsg;
|
|
var obj = BondCalcHepler.BondCalc(underlyingCode, price, priceType, out errorMsg, targetDate);
|
|
if (obj == null)
|
|
{
|
|
// 透传计算器返回的真实原因(债券不存在/信息不全/参数非法/服务异常),前端以非阻塞 toast 展示
|
|
return JsonError(errorMsg ?? "计算价格失败");
|
|
}
|
|
|
|
return JsonSuccess("", obj);
|
|
}
|
|
}
|
|
}
|