fix: 日终价格「数据来源」改为价格行自身语义(人工/系统两档)

移除中债估值细分与操作人姓名显示,按价格行自身 DataSource 列判定:期货/股票读 DataSource(otc-marketdata 同步写系统、手工写人工);债券 update_user 非空→人工、否则→系统。筛选仅人工/系统两选项,异常来源值返回空。ResolveBondDisplaySource 精简为单参纯函数。
This commit is contained in:
hjhan
2026-07-13 15:42:28 +08:00
parent 02624abf75
commit 0fda5fd1cc
5 changed files with 32 additions and 86 deletions
@@ -6,7 +6,7 @@ namespace YLErp.Modules.EodModule
/// 日终价格管理 —— 纯单元测试(不连库、秒级)。
/// 锁定两处改动的意图:
/// 问题4:列表"标的种类"按真实类型显示,且路由键 UnderlyingInstrumentType 不变;
/// 问题3:债券(china_bond_valuation)数据来源固定为"中债估值"(聚源仅转发,无人手工维护)
/// 问题3:债券(china_bond_valuation)数据来源按是否手工改过区分"人工"/"系统"
/// </summary>
[TestClass]
public class EodPriceDtoTest
@@ -85,28 +85,22 @@ namespace YLErp.Modules.EodModule
#endregion
#region 3"中债估值"
#region 3"人工"/"系统"
[TestMethod]
[Description("债券来源恒为'中债估值',不随 JSID 是否为空变化(聚源仅转发中债,无人手工维护)")]
public void ()
[Description("债券来源:被手工改过(update_user 有值)→人工,中债自动同步(update_user 为 NULL)→系统")]
public void _手工改过为人工_否则为系统()
{
// 无论是否有 JSID,债券来源都应是中债估值(对应 SearchUnderlyingList 后处理固定赋值)
var dtoWithJsid = new EodUnderlyingPriceDto { IsBond = true };
var dtoNoJsid = new EodUnderlyingPriceDto { IsBond = true };
// 生产逻辑在后处理统一置为 EodPriceBase.中债估值,这里直接断言常量值与约定一致
Assert.AreEqual("中债估值", EodPriceBase.);
Assert.AreEqual(EodPriceBase., dtoWithJsid.IsBond ? EodPriceBase. : "");
Assert.AreEqual(EodPriceBase., dtoNoJsid.IsBond ? EodPriceBase. : "");
Assert.AreEqual(EodPriceBase., EodPriceService.ResolveBondDisplaySource(1024L));
Assert.AreEqual(EodPriceBase., EodPriceService.ResolveBondDisplaySource(null));
}
[TestMethod]
[Description("来源常量应为约定的中文'人工'/'系统'/'中债估值'")]
[Description("来源常量应为约定的中文'人工'/'系统'")]
public void ()
{
Assert.AreEqual("系统", EodPriceBase.);
Assert.AreEqual("人工", EodPriceBase.);
Assert.AreEqual("中债估值", EodPriceBase.);
}
#endregion
@@ -172,34 +166,7 @@ namespace YLErp.Modules.EodModule
#endregion
#region 3 "中债估值"
[TestMethod]
[Description("债券被手工改过(update_user 有值)且能解析到姓名 → 来源列显示改这个人名")]
public void _显示操作人姓名()
{
var nameMap = new Dictionary<long, string> { [1024] = "张三" };
Assert.AreEqual("张三", EodPriceService.ResolveBondDisplaySource(1024L, nameMap));
}
[TestMethod]
[Description("聚源自动同步(update_user 为 NULL) → 来源列固定显示'中债估值'")]
public void _显示中债估值()
{
var nameMap = new Dictionary<long, string> { [1024] = "张三" };
Assert.AreEqual(EodPriceBase., EodPriceService.ResolveBondDisplaySource(null, nameMap));
}
[TestMethod]
[Description("手工改过但解析不到姓名(用户已删除/字典为空) → 回退显示'中债估值',不崩")]
public void _回退中债估值()
{
var nameMap = new Dictionary<long, string> { [1024] = "张三" };
Assert.AreEqual(EodPriceBase., EodPriceService.ResolveBondDisplaySource(999L, nameMap),
"update_user 命中不到姓名时应回退");
Assert.AreEqual(EodPriceBase., EodPriceService.ResolveBondDisplaySource(7L, null),
"姓名字典为空时应回退");
}
#region 3/"问题3"
#endregion
@@ -90,10 +90,10 @@ namespace YLErp.Modules.EodModule
RealInstrumentType = row.RealInstrumentType, // 真实类型
IsBond = row.IsBond
};
// 债券来源固定为中债估值(等价 SearchUnderlyingList 后处理赋值)
// 债券来源:自动同步(中债)→系统(等价 SearchUnderlyingList 后处理赋值synthetic 无 UpdateUser 故为系统
if (dto.IsBond)
{
dto.DataSource = EodPriceBase.;
dto.DataSource = EodPriceBase.;
}
// 守护点1:显示按真实类型
@@ -153,7 +153,7 @@ namespace YLErp.Modules.EodModule
.Select(x => new { x.UnderlyingCode, x.UnderlyingInstrumentType })
.Take(30).ToList();
// 债券估值采样(来源恒为中债估值,无需按 JSID 判定
// 债券估值采样(来源:自动同步→系统,手工改过→人工
var bonds = db.china_bond_valuation
.Select(b => new { b.bond_id })
.Take(200).ToList();
@@ -176,7 +176,7 @@ namespace YLErp.Modules.EodModule
RealInstrumentType = un.UnderlyingInstrumentType,
IsBond = isBond,
ExpectedTypeCn = ConsGlobal.InstrumentType.GetDesc(un.UnderlyingInstrumentType),
ExpectedDataSource = isBond ? EodPriceBase. : null
ExpectedDataSource = isBond ? EodPriceBase. : null
});
}
}