# `Sp_Task_doAgingSmallai` (procedure)

> 小ai保驾护航-超期应收


- **Type:** PROCEDURE
- **Deterministic:** NO
- **SQL data access:** CONTAINS SQL

## Parameters

| # | Mode | Name | Type |
|---|---|---|---|
| 1 | OUT | `cardTitle` | `varchar(255)` |
| 2 | OUT | `title` | `varchar(255)` |
| 3 | OUT | `sAbstract` | `varchar(255)` |
| 4 | OUT | `cardDate` | `varchar(255)` |
| 5 | OUT | `itemMemo` | `varchar(255)` |
| 6 | OUT | `sCode` | `int` |
| 7 | OUT | `sReturn` | `longtext` |
| 8 | OUT | `sUserList` | `longtext` |
| 9 | OUT | `sUserData` | `longtext` |

## Body

_Body is not pre-cached. To inspect: `mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURE `Sp_Task_doAgingSmallai`'`._

## Narrative

**Business context:** 小ai保驾护航 — scheduled push of the 超期应收帐款 (overdue-receivables) digest. Member of the `Sp_Task_*` family: each routine produces a card-title summary plus a `Sp_Task_doTestMsg` temp-table data set keyed for use in a configured message template (微信/邮件/站内信).

**What it does:** Defaults `sBrId/sSuId/sCode`, sets `title='应收帐款超期未收分析报告'`, then `CALL Sp_Receivables_AgingSmallai` to load `TmpAll` with overdue buckets (`dDueThisBalanceMoney`, `dDueSalesMoney/60/90/120/150`). Aggregates total overdue and customer count, formats `cardTitle` ("截至今天…位客户超期应收…万元"), builds the per-customer rows by joining `TmpAll` to `elecustomer`, and emits them through the `Sp_Task_doTestMsg` temp table so the message template can render an item list.

**Invocation:** Dispatched by the Quartz scheduler — `QuartzTask` (xlyFlow) calls `TaskServiceImpl.doProOne()` which executes the procedure named in the scheduler-job config (`Procedure.sProcedureName='Sp_Task_doAgingSmallai'`), then `sendMsgDoNew(...)` pipes the OUT params plus the result set to the message template referenced by `sMestemplateId`. Install script `script/标版/30100101/Sp_Task_doAgingSmallai.sql`; no `gdsmodule`/form-master binding.
