R35-2 审批通知补结构化摘要
这个提交包含在:
@@ -8,6 +8,10 @@ const {
|
||||
createNotifications,
|
||||
resolveRecipientsForAssignee,
|
||||
} = require("../services/notifications");
|
||||
const {
|
||||
buildPendingTaskCopy,
|
||||
buildWorkflowEntityMeta,
|
||||
} = require("../services/notifications/workflowCopy");
|
||||
const { enqueueImNotifications } = require("../services/notifications/imEnqueue");
|
||||
const { NOTIFICATION_TYPES } = require("../constants/notificationTypes");
|
||||
const { sendNotificationEmailSafe } = require("../services/email");
|
||||
@@ -468,6 +472,23 @@ function buildSkippedEmailResult(reason, failed = 0) {
|
||||
return { skipped: true, reason, sent: 0, failed };
|
||||
}
|
||||
|
||||
async function loadReimbursementSubmitSummary(prisma, reimbursementId) {
|
||||
return prisma.reimbursementForm.findUnique({
|
||||
where: { id: reimbursementId },
|
||||
select: {
|
||||
id: true,
|
||||
form_number: true,
|
||||
total_amount: true,
|
||||
owner: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async function finalizeReimbursementSubmitSideEffects({
|
||||
prisma,
|
||||
config,
|
||||
@@ -479,13 +500,39 @@ async function finalizeReimbursementSubmitSideEffects({
|
||||
assigneeId,
|
||||
assigneeRole,
|
||||
actorId,
|
||||
loadSummary = loadReimbursementSubmitSummary,
|
||||
resolveRecipients = resolveRecipientsForAssignee,
|
||||
createAppNotifications = createNotifications,
|
||||
enqueueIm = enqueueImNotifications,
|
||||
sendEmailSafe = sendNotificationEmailSafe,
|
||||
}) {
|
||||
const title = `【待办】报销单 ${formNumber} 待审批`;
|
||||
const body = `报销单 ${formNumber} 已提交,请及时处理。`;
|
||||
let copy = buildPendingTaskCopy(
|
||||
buildWorkflowEntityMeta("reimbursement", { form_number: formNumber }, reimbursementId),
|
||||
);
|
||||
try {
|
||||
const summary = await loadSummary(prisma, reimbursementId);
|
||||
copy = buildPendingTaskCopy(
|
||||
buildWorkflowEntityMeta(
|
||||
"reimbursement",
|
||||
{
|
||||
...summary,
|
||||
form_number: summary?.form_number ?? formNumber,
|
||||
},
|
||||
reimbursementId,
|
||||
),
|
||||
);
|
||||
} catch (error) {
|
||||
logger?.error?.(
|
||||
{
|
||||
err: error,
|
||||
requestId,
|
||||
reimbursementId,
|
||||
},
|
||||
"Failed to load reimbursement submit notification summary",
|
||||
);
|
||||
}
|
||||
|
||||
const { title, body } = copy;
|
||||
const targetPath = `/workflow/tasks/${workflowTaskId}`;
|
||||
|
||||
let recipientEmployeeIds = [];
|
||||
|
||||
在新工单中引用
屏蔽一个用户