|
@@ -33,6 +33,7 @@
|
|
|
use bos_core::BosError;
|
|
use bos_core::BosError;
|
|
|
use bos_platform::audit::AuditEvent;
|
|
use bos_platform::audit::AuditEvent;
|
|
|
use bos_platform::clients::uds::{de, DmlStatement, UdsClient};
|
|
use bos_platform::clients::uds::{de, DmlStatement, UdsClient};
|
|
|
|
|
+use chrono::NaiveDate;
|
|
|
use serde::Deserialize;
|
|
use serde::Deserialize;
|
|
|
use serde_json::{json, Value};
|
|
use serde_json::{json, Value};
|
|
|
|
|
|
|
@@ -45,6 +46,42 @@ use crate::ids;
|
|
|
/// 审计/清单备注(建单时点标识,工单§3.2.3)。
|
|
/// 审计/清单备注(建单时点标识,工单§3.2.3)。
|
|
|
const GEN_NOTE: &str = "订阅保存触发的系统建单(工单§3.2.3 时点 1/2/3)";
|
|
const GEN_NOTE: &str = "订阅保存触发的系统建单(工单§3.2.3 时点 1/2/3)";
|
|
|
|
|
|
|
|
|
|
+/// 开通类工单的**计划执行日**(=订阅服务开始日)与面向人的说明。
|
|
|
|
|
+///
|
|
|
|
|
+/// 开始日取不到/格式不对 ⇒ 按工单§4.5.1 的常规口径「建单日+7」兜底,并把兜底原因写进
|
|
|
|
|
+/// 返回说明(调用方拼进 `GenOutcome.note`):运营看到的应是"工单已出、执行日按 7 天算,
|
|
|
|
|
+/// 请核对订阅开始日",而不是一张默默按 7 天跑的单。⛔ 因此把订阅保存整体打回。
|
|
|
|
|
+fn activation_exec_date(input: &SubTicketInput) -> (NaiveDate, String) {
|
|
|
|
|
+ let today = bos_core::biz_today();
|
|
|
|
|
+ let raw = input.start_date.trim();
|
|
|
|
|
+ match NaiveDate::parse_from_str(raw, "%Y-%m-%d") {
|
|
|
|
|
+ Ok(d) => (
|
|
|
|
|
+ d,
|
|
|
|
|
+ format!("计划执行日=服务开始日 {d}(当天执行,⛔ 提前回填/核对/报文生效)。"),
|
|
|
|
|
+ ),
|
|
|
|
|
+ Err(_) => {
|
|
|
|
|
+ let fallback = domain::expected_done_on(today);
|
|
|
|
|
+ (
|
|
|
|
|
+ fallback,
|
|
|
|
|
+ format!(
|
|
|
|
|
+ "订阅开始日「{raw}」不可用,计划执行日按建单日+7 兜底为 {fallback},请核对订阅开始日。"
|
|
|
|
|
+ ),
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/// 既有开户工单的计划执行日是否**与本订阅的开始日相同**(§7.5 并入前置,2026-11-17)。
|
|
|
|
|
+///
|
|
|
|
|
+/// 不同 ⇒ ⛔ 并入:一张单只有一个 `expected_done_date`,把开始日不同的两份服务塞进去,
|
|
|
|
|
+/// 必然有一份被提前或延后执行。存量单执行日为 `NULL` 同样按"不同"处理(保守)。
|
|
|
|
|
+fn same_exec_date(existing: Option<&str>, target: NaiveDate) -> bool {
|
|
|
|
|
+ existing
|
|
|
|
|
+ .map(str::trim)
|
|
|
|
|
+ .and_then(|s| NaiveDate::parse_from_str(s, "%Y-%m-%d").ok())
|
|
|
|
|
+ .is_some_and(|d| d == target)
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
/// 「还没走完」的开户工单态(§7.5「未完成的开户工单」=还能往里追加清单项的那几张)。
|
|
/// 「还没走完」的开户工单态(§7.5「未完成的开户工单」=还能往里追加清单项的那几张)。
|
|
|
const UNFINISHED: [&str; 3] = [
|
|
const UNFINISHED: [&str; 3] = [
|
|
|
domain::S_UNASSIGNED,
|
|
domain::S_UNASSIGNED,
|
|
@@ -63,6 +100,12 @@ pub const KIND_NONE: &str = "none";
|
|
|
pub struct SubTicketInput {
|
|
pub struct SubTicketInput {
|
|
|
pub customer_id: String,
|
|
pub customer_id: String,
|
|
|
pub subscription_id: String,
|
|
pub subscription_id: String,
|
|
|
|
|
+ /// **订阅开始日=服务开始日**(`YYYY-MM-DD`):开通类三类工单的计划执行日真源
|
|
|
|
|
+ /// (2026-11-17 定案,工单§3.2.3)。合同签订日可以先于它,工单必须等到那一天才执行。
|
|
|
|
|
+ ///
|
|
|
|
|
+ /// ⚠️ 空串/解析失败 ⇒ 建单侧兜底为「建单日+7」并在 `GenOutcome.note` 留痕,
|
|
|
|
|
+ /// ⛔ 把它升级成订阅保存失败(工单§3.1)。
|
|
|
|
|
+ pub start_date: String,
|
|
|
/// 套餐名称快照(清单行 `item_name` 的真源,⛔ 现取 `catalog_plan`)。
|
|
/// 套餐名称快照(清单行 `item_name` 的真源,⛔ 现取 `catalog_plan`)。
|
|
|
pub plan_name: String,
|
|
pub plan_name: String,
|
|
|
/// 订阅的线路出口快照(清单逐出口一行)。
|
|
/// 订阅的线路出口快照(清单逐出口一行)。
|
|
@@ -201,6 +244,9 @@ struct OpenTicketRow {
|
|
|
ticket_id: String,
|
|
ticket_id: String,
|
|
|
#[serde(default, deserialize_with = "de::as_opt_string")]
|
|
#[serde(default, deserialize_with = "de::as_opt_string")]
|
|
|
ticket_no: Option<String>,
|
|
ticket_no: Option<String>,
|
|
|
|
|
+ /// 该单的计划执行日(=建单时那份订阅的服务开始日)。并入前要比对新订阅的开始日。
|
|
|
|
|
+ #[serde(default, deserialize_with = "de::as_opt_string")]
|
|
|
|
|
+ expected_done_date: Option<String>,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
#[derive(Debug, Deserialize)]
|
|
@@ -245,7 +291,8 @@ async fn unfinished_open_ticket(db: &UdsClient, customer_id: &str) -> Result<Opt
|
|
|
let t = p.text(domain::T_OPEN);
|
|
let t = p.text(domain::T_OPEN);
|
|
|
let states: Vec<String> = UNFINISHED.iter().map(|s| p.text(*s)).collect();
|
|
let states: Vec<String> = UNFINISHED.iter().map(|s| p.text(*s)).collect();
|
|
|
let sql = format!(
|
|
let sql = format!(
|
|
|
- "SELECT t.ticket_id::text AS ticket_id, t.ticket_no::text AS ticket_no FROM ticket t \
|
|
|
|
|
|
|
+ "SELECT t.ticket_id::text AS ticket_id, t.ticket_no::text AS ticket_no, \
|
|
|
|
|
+ t.expected_done_date::text AS expected_done_date FROM ticket t \
|
|
|
WHERE t.customer_id = {a}::text AND t.ticket_type = {t}::text \
|
|
WHERE t.customer_id = {a}::text AND t.ticket_type = {t}::text \
|
|
|
AND t.status IN ({}) ORDER BY t.created_at DESC LIMIT 1",
|
|
AND t.status IN ({}) ORDER BY t.created_at DESC LIMIT 1",
|
|
|
states.join(", ")
|
|
states.join(", ")
|
|
@@ -405,6 +452,7 @@ async fn generate(db: &UdsClient, input: &SubTicketInput) -> Result<GenOutcome,
|
|
|
),
|
|
),
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
|
|
|
+ let (exec_date, exec_note) = activation_exec_date(input);
|
|
|
let built = create_core(
|
|
let built = create_core(
|
|
|
db,
|
|
db,
|
|
|
&Draft {
|
|
&Draft {
|
|
@@ -412,8 +460,7 @@ async fn generate(db: &UdsClient, input: &SubTicketInput) -> Result<GenOutcome,
|
|
|
customer_id: input.customer_id.clone(),
|
|
customer_id: input.customer_id.clone(),
|
|
|
title: format!("开户-{cust_name}"),
|
|
title: format!("开户-{cust_name}"),
|
|
|
detail: Some(format!(
|
|
detail: Some(format!(
|
|
|
- "订阅 {}({})已建立,客户服务开通状态={},系统按工单§3.2.3 时点 {} 自动生成开户工单。\
|
|
|
|
|
- 要求完成日=建单日+7。",
|
|
|
|
|
|
|
+ "订阅 {}({})已建立,客户服务开通状态={},系统按工单§3.2.3 时点 {} 自动生成开户工单。{exec_note}",
|
|
|
input.subscription_id,
|
|
input.subscription_id,
|
|
|
input.plan_name,
|
|
input.plan_name,
|
|
|
domain::acct_status_label(&acct_status),
|
|
domain::acct_status_label(&acct_status),
|
|
@@ -421,6 +468,7 @@ async fn generate(db: &UdsClient, input: &SubTicketInput) -> Result<GenOutcome,
|
|
|
)),
|
|
)),
|
|
|
subscription_id: Some(input.subscription_id.clone()),
|
|
subscription_id: Some(input.subscription_id.clone()),
|
|
|
renew_from_contract_id: None,
|
|
renew_from_contract_id: None,
|
|
|
|
|
+ service_start_date: Some(exec_date),
|
|
|
submitter_type: domain::SUB_OPS,
|
|
submitter_type: domain::SUB_OPS,
|
|
|
submitter_user_id: Some(input.actor_user_id),
|
|
submitter_user_id: Some(input.actor_user_id),
|
|
|
reporter_account_id: 0,
|
|
reporter_account_id: 0,
|
|
@@ -450,48 +498,61 @@ async fn generate(db: &UdsClient, input: &SubTicketInput) -> Result<GenOutcome,
|
|
|
built.ticket_no.clone(),
|
|
built.ticket_no.clone(),
|
|
|
landed,
|
|
landed,
|
|
|
format!(
|
|
format!(
|
|
|
- "已自动生成开户工单 {}({} 行服务清单,进待分派)。",
|
|
|
|
|
|
|
+ "已自动生成开户工单 {}({} 行服务清单,进待分派)。{exec_note}",
|
|
|
built.ticket_no, landed
|
|
built.ticket_no, landed
|
|
|
),
|
|
),
|
|
|
));
|
|
));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// ── 时点 3:在用 ⇒ 并入未完成开户工单,否则新建服务开通工单 ──
|
|
// ── 时点 3:在用 ⇒ 并入未完成开户工单,否则新建服务开通工单 ──
|
|
|
|
|
+ let (exec_date, exec_note) = activation_exec_date(input);
|
|
|
if let Some(hit) = unfinished_open_ticket(db, &input.customer_id).await? {
|
|
if let Some(hit) = unfinished_open_ticket(db, &input.customer_id).await? {
|
|
|
- let seq = max_seq(db, &hit.ticket_id).await?;
|
|
|
|
|
- let landed = insert_items(db, &hit.ticket_id, &items, seq).await?;
|
|
|
|
|
- let no = hit.ticket_no.clone().unwrap_or_default();
|
|
|
|
|
- append_log(db, &hit.ticket_id, input.actor_user_id, &format!(
|
|
|
|
|
- "客户在用新增订阅 {}({}),按工单§7.5 并入本开户工单,追加服务清单项 {landed} 行。",
|
|
|
|
|
- input.subscription_id, input.plan_name
|
|
|
|
|
- ))
|
|
|
|
|
- .await?;
|
|
|
|
|
- dbx::audit(
|
|
|
|
|
- db,
|
|
|
|
|
- &AuditEvent {
|
|
|
|
|
- actor_user_id: input.actor_user_id.to_string(),
|
|
|
|
|
- action: domain::AUD_CREATE_SUPPRESSED.to_string(),
|
|
|
|
|
- resource_type: "ticket".to_string(),
|
|
|
|
|
- resource_id: hit.ticket_id.clone(),
|
|
|
|
|
- before: None,
|
|
|
|
|
- after: None,
|
|
|
|
|
- detail: Some(json!({
|
|
|
|
|
- "customer_id": input.customer_id,
|
|
|
|
|
- "subscription_id": input.subscription_id,
|
|
|
|
|
- "merged_into": no,
|
|
|
|
|
- "items_appended": landed,
|
|
|
|
|
- "note": GEN_NOTE,
|
|
|
|
|
- })),
|
|
|
|
|
- },
|
|
|
|
|
- )
|
|
|
|
|
- .await;
|
|
|
|
|
- return Ok(GenOutcome::ok(
|
|
|
|
|
- "merged",
|
|
|
|
|
- hit.ticket_id.clone(),
|
|
|
|
|
- no.clone(),
|
|
|
|
|
- landed,
|
|
|
|
|
- format!("客户已有未完成的开户工单 {no},本次新增条目并入该单(工单§7.5),追加服务清单项 {landed} 行。",),
|
|
|
|
|
- ));
|
|
|
|
|
|
|
+ // §7.5 并入前置(2026-11-17):执行日不同就不并入——一张单只有一个计划执行日,
|
|
|
|
|
+ // 塞进两份开始日不同的服务,必然有一份被提前或延后执行。
|
|
|
|
|
+ if !same_exec_date(hit.expected_done_date.as_deref(), exec_date) {
|
|
|
|
|
+ tracing::info!(
|
|
|
|
|
+ customer_id = %input.customer_id,
|
|
|
|
|
+ subscription_id = %input.subscription_id,
|
|
|
|
|
+ existing_exec_date = ?hit.expected_done_date,
|
|
|
|
|
+ wanted_exec_date = %exec_date,
|
|
|
|
|
+ "§7.5 并入跳过:未完成开户工单的计划执行日与本订阅开始日不同,改为单独建单"
|
|
|
|
|
+ );
|
|
|
|
|
+ } else {
|
|
|
|
|
+ let seq = max_seq(db, &hit.ticket_id).await?;
|
|
|
|
|
+ let landed = insert_items(db, &hit.ticket_id, &items, seq).await?;
|
|
|
|
|
+ let no = hit.ticket_no.clone().unwrap_or_default();
|
|
|
|
|
+ append_log(db, &hit.ticket_id, input.actor_user_id, &format!(
|
|
|
|
|
+ "客户在用新增订阅 {}({}),按工单§7.5 并入本开户工单,追加服务清单项 {landed} 行。",
|
|
|
|
|
+ input.subscription_id, input.plan_name
|
|
|
|
|
+ ))
|
|
|
|
|
+ .await?;
|
|
|
|
|
+ dbx::audit(
|
|
|
|
|
+ db,
|
|
|
|
|
+ &AuditEvent {
|
|
|
|
|
+ actor_user_id: input.actor_user_id.to_string(),
|
|
|
|
|
+ action: domain::AUD_CREATE_SUPPRESSED.to_string(),
|
|
|
|
|
+ resource_type: "ticket".to_string(),
|
|
|
|
|
+ resource_id: hit.ticket_id.clone(),
|
|
|
|
|
+ before: None,
|
|
|
|
|
+ after: None,
|
|
|
|
|
+ detail: Some(json!({
|
|
|
|
|
+ "customer_id": input.customer_id,
|
|
|
|
|
+ "subscription_id": input.subscription_id,
|
|
|
|
|
+ "merged_into": no,
|
|
|
|
|
+ "items_appended": landed,
|
|
|
|
|
+ "note": GEN_NOTE,
|
|
|
|
|
+ })),
|
|
|
|
|
+ },
|
|
|
|
|
+ )
|
|
|
|
|
+ .await;
|
|
|
|
|
+ return Ok(GenOutcome::ok(
|
|
|
|
|
+ "merged",
|
|
|
|
|
+ hit.ticket_id.clone(),
|
|
|
|
|
+ no.clone(),
|
|
|
|
|
+ landed,
|
|
|
|
|
+ format!("客户已有未完成的开户工单 {no},本次新增条目并入该单(工单§7.5),追加服务清单项 {landed} 行。",),
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if let Some(hit) =
|
|
if let Some(hit) =
|
|
@@ -518,12 +579,12 @@ async fn generate(db: &UdsClient, input: &SubTicketInput) -> Result<GenOutcome,
|
|
|
customer_id: input.customer_id.clone(),
|
|
customer_id: input.customer_id.clone(),
|
|
|
title: format!("服务开通-{cust_name}"),
|
|
title: format!("服务开通-{cust_name}"),
|
|
|
detail: Some(format!(
|
|
detail: Some(format!(
|
|
|
- "客户在用新增订阅 {}({}),按工单§3.2.3 时点 3 自动生成服务开通工单。\
|
|
|
|
|
- 要求完成日=建单日+7。",
|
|
|
|
|
|
|
+ "客户在用新增订阅 {}({}),按工单§3.2.3 时点 3 自动生成服务开通工单。{exec_note}",
|
|
|
input.subscription_id, input.plan_name
|
|
input.subscription_id, input.plan_name
|
|
|
)),
|
|
)),
|
|
|
subscription_id: Some(input.subscription_id.clone()),
|
|
subscription_id: Some(input.subscription_id.clone()),
|
|
|
renew_from_contract_id: None,
|
|
renew_from_contract_id: None,
|
|
|
|
|
+ service_start_date: Some(exec_date),
|
|
|
submitter_type: domain::SUB_OPS,
|
|
submitter_type: domain::SUB_OPS,
|
|
|
submitter_user_id: Some(input.actor_user_id),
|
|
submitter_user_id: Some(input.actor_user_id),
|
|
|
reporter_account_id: 0,
|
|
reporter_account_id: 0,
|
|
@@ -552,7 +613,10 @@ async fn generate(db: &UdsClient, input: &SubTicketInput) -> Result<GenOutcome,
|
|
|
built.ticket_id.clone(),
|
|
built.ticket_id.clone(),
|
|
|
built.ticket_no.clone(),
|
|
built.ticket_no.clone(),
|
|
|
landed,
|
|
landed,
|
|
|
- format!("已自动生成服务开通工单 {}({} 行服务清单,进待分派)。", built.ticket_no, landed),
|
|
|
|
|
|
|
+ format!(
|
|
|
|
|
+ "已自动生成服务开通工单 {}({} 行服务清单,进待分派)。{exec_note}",
|
|
|
|
|
+ built.ticket_no, landed
|
|
|
|
|
+ ),
|
|
|
))
|
|
))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -646,6 +710,7 @@ async fn updown_ticket(
|
|
|
cust_name: &str,
|
|
cust_name: &str,
|
|
|
) -> Result<GenOutcome, BosError> {
|
|
) -> Result<GenOutcome, BosError> {
|
|
|
let items = build_updown_items(input, orig);
|
|
let items = build_updown_items(input, orig);
|
|
|
|
|
+ let (exec_date, exec_note) = activation_exec_date(input);
|
|
|
// 重放保护:同订阅已有未闭环 `updown` ⇒ 只补清单,⛔ 再发一张。
|
|
// 重放保护:同订阅已有未闭环 `updown` ⇒ 只补清单,⛔ 再发一张。
|
|
|
if let Some(hit) =
|
|
if let Some(hit) =
|
|
|
covered_by_ticket(db, &input.customer_id, domain::T_UPDOWN, &input.subscription_id).await?
|
|
covered_by_ticket(db, &input.customer_id, domain::T_UPDOWN, &input.subscription_id).await?
|
|
@@ -673,11 +738,12 @@ async fn updown_ticket(
|
|
|
title: format!("升降配-{cust_name}"),
|
|
title: format!("升降配-{cust_name}"),
|
|
|
detail: Some(format!(
|
|
detail: Some(format!(
|
|
|
"订阅 {}({})替换原订阅 {}({}):交付新档位并回收原档位。\
|
|
"订阅 {}({})替换原订阅 {}({}):交付新档位并回收原档位。\
|
|
|
- 原档位截止新订阅生效前一日。要求完成日=建单日+7。",
|
|
|
|
|
|
|
+ 原档位截止新订阅生效前一日。{exec_note}",
|
|
|
input.subscription_id, input.plan_name, orig.subscription_id, orig.plan_name
|
|
input.subscription_id, input.plan_name, orig.subscription_id, orig.plan_name
|
|
|
)),
|
|
)),
|
|
|
subscription_id: Some(input.subscription_id.clone()),
|
|
subscription_id: Some(input.subscription_id.clone()),
|
|
|
renew_from_contract_id: None,
|
|
renew_from_contract_id: None,
|
|
|
|
|
+ service_start_date: Some(exec_date),
|
|
|
submitter_type: domain::SUB_SYSTEM,
|
|
submitter_type: domain::SUB_SYSTEM,
|
|
|
submitter_user_id: Some(input.actor_user_id),
|
|
submitter_user_id: Some(input.actor_user_id),
|
|
|
reporter_account_id: 0,
|
|
reporter_account_id: 0,
|
|
@@ -710,7 +776,7 @@ async fn updown_ticket(
|
|
|
built.ticket_no.clone(),
|
|
built.ticket_no.clone(),
|
|
|
landed,
|
|
landed,
|
|
|
format!(
|
|
format!(
|
|
|
- "已自动生成升降配工单 {}({landed} 行对照清单:原档 {before} ⇒ 新档 {after};含原档回收 1 行),进待分派。",
|
|
|
|
|
|
|
+ "已自动生成升降配工单 {}({landed} 行对照清单:原档 {before} ⇒ 新档 {after};含原档回收 1 行),进待分派。{exec_note}",
|
|
|
built.ticket_no
|
|
built.ticket_no
|
|
|
),
|
|
),
|
|
|
))
|
|
))
|
|
@@ -763,3 +829,53 @@ mod tests {
|
|
|
assert_eq!(out.to_json()["kind"], KIND_NONE);
|
|
assert_eq!(out.to_json()["kind"], KIND_NONE);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+#[cfg(test)]
|
|
|
|
|
+mod activation_exec_tests {
|
|
|
|
|
+ use super::*;
|
|
|
|
|
+
|
|
|
|
|
+ fn input(start: &str) -> SubTicketInput {
|
|
|
|
|
+ SubTicketInput {
|
|
|
|
|
+ customer_id: "1001".to_string(),
|
|
|
|
|
+ subscription_id: "2002".to_string(),
|
|
|
|
|
+ start_date: start.to_string(),
|
|
|
|
|
+ plan_name: "集团专线·标准档".to_string(),
|
|
|
|
|
+ line_exits: vec![],
|
|
|
|
|
+ quota_slots: 1,
|
|
|
|
|
+ actor_user_id: 1,
|
|
|
|
|
+ original: None,
|
|
|
|
|
+ service_unchanged: false,
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ fn d(s: &str) -> NaiveDate {
|
|
|
|
|
+ NaiveDate::parse_from_str(s, "%Y-%m-%d").expect("测试日期必须是 YYYY-MM-DD")
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// 建单侧:计划执行日=订阅服务开始日,⛔ 建单日+7。
|
|
|
|
|
+ #[test]
|
|
|
|
|
+ fn exec_date_is_subscription_start() {
|
|
|
|
|
+ let (day, note) = activation_exec_date(&input("2026-12-01"));
|
|
|
|
|
+ assert_eq!(day, d("2026-12-01"));
|
|
|
|
|
+ assert!(note.contains("2026-12-01"), "说明里要写出计划执行日:{note}");
|
|
|
|
|
+ assert!(note.contains("计划执行日"), "{note}");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// 开始日给不出/格式错 ⇒ 建单日+7 兜底并留痕,⛔ 让订阅保存失败。
|
|
|
|
|
+ #[test]
|
|
|
|
|
+ fn unparsable_start_falls_back_to_plus_seven() {
|
|
|
|
|
+ let (day, note) = activation_exec_date(&input(""));
|
|
|
|
|
+ assert_eq!(day, domain::expected_done_on(bos_core::biz_today()));
|
|
|
|
|
+ assert!(note.contains("兜底"), "兜底必须留痕:{note}");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /// 并入前置:执行日不同就不并入(含存量单期限为空的保守处理)。
|
|
|
|
|
+ #[test]
|
|
|
|
|
+ fn merge_requires_identical_exec_date() {
|
|
|
|
|
+ let target = d("2026-12-01");
|
|
|
|
|
+ assert!(same_exec_date(Some("2026-12-01"), target));
|
|
|
|
|
+ assert!(same_exec_date(Some(" 2026-12-01 "), target));
|
|
|
|
|
+ assert!(!same_exec_date(Some("2026-12-02"), target), "开始日不同不得合并");
|
|
|
|
|
+ assert!(!same_exec_date(None, target), "执行日为空的存量单⛔ 并入");
|
|
|
|
|
+ }
|
|
|
|
|
+}
|