test: 明细导出 ENUM 断言随实现改为中文;历史版本口径回到 ADR 0012 的「同条件」

This commit is contained in:
weicw
2026-10-31 08:35:18 +08:00
parent 067f13ffff
commit 0fdb9acff4
4 changed files with 8 additions and 12 deletions
@@ -53,9 +53,8 @@ public class FacilityPriceQueryService implements ApprovalPriceProvider {
if (tenantId == null) {
return null;
}
// 当前生效版本:只看到期已生效的版本
List<FacilityPriceVersionRow> rows = priceMapper.selectArchivedVersions(
tenantId, false, LocalDate.now(), 0, 1);
tenantId, LocalDate.now(), 0, 1);
return rows.isEmpty() ? null : toVersion(tenantId, rows.get(0));
}
@@ -77,9 +76,8 @@ public class FacilityPriceQueryService implements ApprovalPriceProvider {
}
int size = limit <= 0 ? DEFAULT_HISTORY_LIMIT : limit;
int pageNo = page <= 0 ? 1 : page;
// 历史版本:包含未来生效的已归档版本(#58 验收要求历史可查)
List<FacilityPriceVersionRow> rows = priceMapper.selectArchivedVersions(
tenantId, true, LocalDate.now(), (pageNo - 1) * size, size);
tenantId, LocalDate.now(), (pageNo - 1) * size, size);
List<ApprovalPriceVersion> versions = new ArrayList<>(rows.size());
for (FacilityPriceVersionRow row : rows) {
ApprovalPriceVersion version = toVersion(tenantId, row);
@@ -25,7 +25,6 @@ public interface ApprovalFacilityPriceMapper {
*/
@InterceptorIgnore(tenantLine = "true")
List<FacilityPriceVersionRow> selectArchivedVersions(@Param("tenantId") Integer tenantId,
@Param("includeFuture") boolean includeFuture,
@Param("today") LocalDate today,
@Param("offset") int offset,
@Param("limit") int limit);
@@ -3,9 +3,9 @@
<mapper namespace="com.gxwebsoft.approval.mapper.ApprovalFacilityPriceMapper">
<!--
已归档价格表版本,按生效日期倒序。
includeFuture=true 时包含「未来生效」的已归档版本(历史版本列表要看得到它们);
当前生效版本只取 effective_date 不晚于今天的最新一版(ADR 0012)。
已归档且已生效的价格表版本,按生效日期倒序。
当前生效版本与历史版本是「同条件」(ADR 0012):未来生效的版本归档后
尚未生效,既不成为当前版本,也不进历史列表。
-->
<select id="selectArchivedVersions" resultType="com.gxwebsoft.approval.doc.facility.FacilityPriceVersionRow">
SELECT i.id AS instance_id,
@@ -18,9 +18,7 @@
WHERE i.tenant_id = #{tenantId}
AND i.flow_code = 'facility'
AND i.status = 'ARCHIVED'
<if test="!includeFuture">
AND f.effective_date &lt;= #{today}
</if>
ORDER BY f.effective_date DESC, i.archive_time DESC, i.id DESC
<if test="limit >= 0">
LIMIT #{limit} OFFSET #{offset}
@@ -412,11 +412,12 @@ class ApprovalVehicleIT {
assertThat(cellText(first.getCell(7))).isEqualTo("是");
assertThat(cellText(first.getCell(9))).isEqualTo("2026-01-01");
assertThat(cellText(first.getCell(10))).isEqualTo("2026-06-30");
assertThat(cellText(first.getCell(12))).isEqualTo(OWNER_GROUP);
// 导出给人看:车辆归属输出中文文案而不是 8 类编码
assertThat(cellText(first.getCell(12))).isEqualTo("威宁集团公司员工车辆");
Row second = sheet.getRow(2);
assertThat(cellText(second.getCell(6))).isEqualTo("桂A10002");
assertThat(cellText(second.getCell(12))).isEqualTo(OWNER_CLUB);
assertThat(cellText(second.getCell(12))).isEqualTo("合作俱乐部员工车辆");
}
}