dp2 icon indicating copy to clipboard operation
dp2 copied to clipboard

dp2library SetReaderInfo() API notifyOverdue 和 notifyRecall 功能

Open DigitalPlatform opened this issue 3 years ago • 1 comments

新版 dp2library 为 SetReaderInfo() API 增加了两个功能:notifyOverdue 和 notifyRecall。分别是通知超期和通知召回功能。

通知超期,是触发一次读者超期在借册检查,将超期的信息通过几种消息发送给读者。 通知召回,是将读者所有的在借册信息通过几种消息发送给读者,提醒读者立即将这些书刊还回图书馆。

用法: strRecPath 参数值为读者记录路径。 strAction 参数值为 notifyOverdue 或 notifyRecall。 strNewXml 参数值为操作细节。其中 bodytypes 子参数为希望发送的消息类型,注意它们之间用竖线间隔。例如 bodytypes:mq|email|dpmail|sms。其中,mq 表示消息队列;email 表示 Email;dpmail 表示 dp2 系统内置的邮箱;sms 表示手机短信。reason 子参数为召回的事由(如果缺省,等于“业务需要”)。

mq 消息

超期消息格式:

<root>
    <type>patronNotify</type>
    <recipient>!refID:be13ecc5-6a9c-4400-9453-a072c50cede1@LUID:62637a12-1965-4876-af3a-fc1d3009af8a</recipient>
    <mime>xml</mime>
    <body>...</body>
<root>

其中 body 元素展开:
<root>
    <type>超期通知</type>
    <items overdueCount="1" normalCount="0">
        <item barcode="0000001" location="测试库" refID="" summary="..." borrowDate="Sat, 28 May 2022 00:00:26 +0800" borrowPeriod="31day" timeReturning="2022/6/28" overdue="已超期 351 天" overdueType="overdue" />
    </items>
    <text>您借阅的下列书刊:
... 应还日期: 2022/6/28 已超期 351 天
</text>
    <patronRecord>
        <barcode>R0000001</barcode>
        <name>张三</name>
        <refID>be13ecc5-6a9c-4400-9453-a072c50cede1</refID>
        <borrows>
            <borrow barcode="0000001" oi="CN-0000001-ZG1" recPath="中文编目实体/21" biblioRecPath="中文编目/624" location="测试库" borrowDate="Sat, 28 May 2022 00:00:26 +0800" borrowPeriod="31day" borrowID="f285d678-d4c7-47db-b4ea-a9399e4e34e7" returningDate="Tue, 28 Jun 2022 12:00:00 +0800" operator="supervisor" type="教学参考" price="$10.65" notifyHistory="nnyn" />
        </borrows>
        <readerType>本科生</readerType>
    </patronRecord>
</root>

召回消息格式:

<root>
    <type>patronNotify</type>
    <recipient>!refID:be13ecc5-6a9c-4400-9453-a072c50cede1@LUID:62637a12-1965-4876-af3a-fc1d3009af8a</recipient>
    <mime>xml</mime>
    <body>...</body>
<root>

其中 body 元素展开:
<root>
    <type>召回通知</type>
    <items overdueCount="0" normalCount="1">
        <item barcode="0000001" location="测试库" refID="" summary="..." borrowDate="Sat, 28 May 2022 00:00:26 +0800" borrowPeriod="31day" timeReturning="2022/6/28" overdue="已超期 351 天" overdueType="overdue" />
    </items>
    <text>因 毕业手续需要,图书馆提醒您尽快归还下列书刊:
...
</text>
    <patronRecord>
        <barcode>R0000001</barcode>
        <name>张三</name>
        <refID>be13ecc5-6a9c-4400-9453-a072c50cede1</refID>
        <email>...</email>
        <borrows>
            <borrow barcode="0000001" oi="CN-0000001-ZG1" recPath="中文编目实体/21" biblioRecPath="中文编目/624" location="测试库" borrowDate="Sat, 28 May 2022 00:00:26 +0800" borrowPeriod="31day" borrowID="f285d678-d4c7-47db-b4ea-a9399e4e34e7" returningDate="Tue, 28 Jun 2022 12:00:00 +0800" operator="supervisor" type="教学参考" price="$10.65" notifyHistory="nnyn" />
        </borrows>
        <readerType>本科生</readerType>
    </patronRecord>
</root>

注:两种消息的差异主要是 body 元素展开后,其中的 type 元素内容不同。

DigitalPlatform avatar Jun 14 '22 06:06 DigitalPlatform

消息日志

为了方便维护和调试,dp2library 最新版对各类消息提供了专用的日志文件,记录了消息的创建和发送过程信息。

如何启用消息日志

在 library.xml 中,找到 message 元素:

    <message logTypes="dpmail,email,mq,sms" />

为 message 元素添加 logTypes 属性。可以指定哪些类型的消息要产生日志。logTypes 属性的缺省值为空,表示不产生任何消息类型的日志。

消息日志文件的命名规则

消息日志文件出现在 dp2library 数据目录的 log 子目录中。文件名以消息类型开头,比如 mq 类型的消息,其消息日志文件名为 mq_20220614.txt。每天一个日志文件。

readersMonitor_xxxxxxxx.txt 日志文件

除了上述每种类型的单独的消息日志文件,dp2library 还提供了 readersMonitor_xxx 日志文件,里面记载了后台读者超期通知的详细过程信息,也包括通过 setReaderInfo() API 的 notifyOverdue 和 notifyRecall 功能触发的通知过程信息。

dp2 系统内置邮箱

dp2 系统内置邮箱还可以直接用 dp2OPAC 打开邮箱观察消息是否正确发送到邮箱了。

DigitalPlatform avatar Jun 14 '22 07:06 DigitalPlatform