s-HR系统发送普通消息给系统用户
非多语言版本具体示例如下:
Context ctx ;//可以通过传参传入 Message message = MessageFactory.newMessage();//初始化消息对象 message.setBooleanHeader("isSendCommon", Boolean.TRUE); message.setLocaleStringHeader("title","");//消息头 message.setLocaleStringHeader("body","");//消息内容 //常用分类设置,可以参考对应枚举 message.setIntHeader("type", MsgType.NOTICE_VALUE);//通知类消息 message.setIntHeader("bizType", MsgBizType.HR_VALUE);//HR 业务领域 message.setIntHeader("priority", MsgPriority.HIGH_VALUE);//高优先级别 message.setIntHeader("sourceStatus", MsgSourceStatus.EMPTY_VALUE);//状态空 message.setStringHeader("solution", ctx.getSolution());//解决方案 message.setStringHeader("databaseCenter", ctx.getAIS());//数据中心 message.setStringHeader("receiver", userId);//消息接收人,如果是多个人,需要进行循环发送消息,这个根据业务需要进行处理 message.setStringHeader("senderId", userId);//消息发送人 //如果是通过链接能打开东西,可以增加url的设置 message.setStringHeader("url", "/shr/dynamic.do?uipk=xxx&method=xxx"); //注意,url中的参数,不需要进行url转码处理 //发送 DirectSenderAgent.getSenderAgent().sendMessage(message);
总体在8.5以上参考:com.kingdee.shr.base.syssetting.app.io.fileImport.ImportTaskExecutor#sendComplateMessage
多语言版本具体示例说明如下:
Context ctx = this.context; String userId = ctx.getCaller().toString();//获取上下文,场景不同有差异 Message message = MessageFactory.newMessage();//初始化消息对象 message.setBooleanHeader("isSendCommon", Boolean.TRUE); ImportTaskInfo task = this.task.getTaskInfo(); //消息头设置,s-HR860SP1及以上版本需要处理多语言 if (ImportTaskStateEnum.DONE.getValue() != task.getState().getValue()) { message.setLocaleStringHeader("title", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_stop", LocaleUtils.locale_l1, task.getName()), LocaleUtils.locale_l1); message.setLocaleStringHeader("title", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_stop", LocaleUtils.locale_l2, task.getName()), LocaleUtils.locale_l2); message.setLocaleStringHeader("title", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_stop", LocaleUtils.locale_l3, task.getName()), LocaleUtils.locale_l3); //title = MessageFormat.format(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_stop",context), task.getName()); //"导入任务【{0}】中止执行" } else { message.setLocaleStringHeader("title", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_completed", LocaleUtils.locale_l1, task.getName()), LocaleUtils.locale_l1); message.setLocaleStringHeader("title", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_completed", LocaleUtils.locale_l2, task.getName()), LocaleUtils.locale_l2); message.setLocaleStringHeader("title", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_completed", LocaleUtils.locale_l3, task.getName()), LocaleUtils.locale_l3); //title = MessageFormat.format(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "import_task_completed",context), task.getName()); //"导入任务【{0}】完成执行" } //消息体设置,s-HR860SP1及以上版本需要处理多语言 StringBuffer bodySb1 = new StringBuffer(message.getLocaleStringHeader("title", LocaleUtils.locale_l1)); StringBuffer bodySb2 = new StringBuffer(message.getLocaleStringHeader("title", LocaleUtils.locale_l2)); StringBuffer bodySb3 = new StringBuffer(message.getLocaleStringHeader("title", LocaleUtils.locale_l3)); bodySb1.append(" "); bodySb2.append(" "); bodySb3.append(" "); bodySb1.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "success",LocaleUtils.locale_l1)).append(":").append(task.getSuccessCount()).append(" "); //成功 bodySb1.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "fails",LocaleUtils.locale_l1)).append(":").append(task.getFailureCount()).append(" "); //失败 bodySb1.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "surplus",LocaleUtils.locale_l1)).append(":").append(task.getTotleCount() - task.getSuccessCount() - task.getFailureCount()).append(" "); //剩余 if (!StringUtils.isEmpty(task.getResultDesc())) { bodySb1.append(task.getResultDesc()).append(" "); } bodySb2.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "success",LocaleUtils.locale_l2)).append(":").append(task.getSuccessCount()).append(" "); //成功 bodySb2.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "fails",LocaleUtils.locale_l2)).append(":").append(task.getFailureCount()).append(" "); //失败 bodySb2.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "surplus",LocaleUtils.locale_l2)).append(":").append(task.getTotleCount() - task.getSuccessCount() - task.getFailureCount()).append(" "); //剩余 if (!StringUtils.isEmpty(task.getResultDesc())) { bodySb2.append(task.getResultDesc()).append(" "); } bodySb3.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "success",LocaleUtils.locale_l3)).append(":").append(task.getSuccessCount()).append(" "); //成功 bodySb3.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "fails",LocaleUtils.locale_l3)).append(":").append(task.getFailureCount()).append(" "); //失败 bodySb3.append(SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "surplus",LocaleUtils.locale_l3)).append(":").append(task.getTotleCount() - task.getSuccessCount() - task.getFailureCount()).append(" "); //剩余 if (!StringUtils.isEmpty(task.getResultDesc())) { bodySb3.append(task.getResultDesc()).append(" "); } message.setLocaleStringHeader("body", bodySb1.toString(), LocaleUtils.locale_l1); message.setLocaleStringHeader("body", bodySb2.toString(), LocaleUtils.locale_l2); message.setLocaleStringHeader("body", bodySb3.toString(), LocaleUtils.locale_l3); //消息发送者,s-HR860SP1及以上版本需要处理多语言,可以根据需要调整为对应用户 message.setLocaleStringHeader("sender", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "sys_auto_send",LocaleUtils.locale_l1), LocaleUtils.locale_l1); //"系统自动发送" message.setLocaleStringHeader("sender", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "sys_auto_send",LocaleUtils.locale_l2), LocaleUtils.locale_l2); //"系统自动发送" message.setLocaleStringHeader("sender", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "sys_auto_send",LocaleUtils.locale_l3), LocaleUtils.locale_l3); //"系统自动发送" //initiatorName,s-HR860SP1及以上版本需要处理多语言,可调整 message.setLocaleStringHeader("initiatorName", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "sys_auto_send",LocaleUtils.locale_l1), LocaleUtils.locale_l1); //"系统自动发送" message.setLocaleStringHeader("initiatorName", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "sys_auto_send",LocaleUtils.locale_l2), LocaleUtils.locale_l2); //"系统自动发送" message.setLocaleStringHeader("initiatorName", SHRServerResource.getString(Constants.COMMON_SERVICE_RESOURCE, "sys_auto_send",LocaleUtils.locale_l3), LocaleUtils.locale_l3); //"系统自动发送" //常用分类设置,可以参考对应枚举 message.setIntHeader("type", MsgType.NOTICE_VALUE); message.setIntHeader("bizType", MsgBizType.HR_VALUE); message.setIntHeader("priority", MsgPriority.HIGH_VALUE); message.setIntHeader("sourceStatus", MsgSourceStatus.EMPTY_VALUE); message.setStringHeader("solution", ctx.getSolution()); message.setStringHeader("databaseCenter", ctx.getAIS()); message.setStringHeader("receiver", userId); message.setStringHeader("senderId", userId); //如果是通过链接能打开东西,可以增加url的设置 message.setStringHeader("url", "/shr/dynamic.do?uipk=xxx&method=xxx"); //注意,url中的参数,不需要进行url转码处理 //发送 DirectSenderAgent.getSenderAgent().sendMessage(message);
以上举例中:
Context ctx //可以自己传 引入Constants全路径:com.kingdee.shr.base.syssetting.constant.Constants 自己的发送消息中,ImportTaskInfo task = this.task.getTaskInfo();及相关代码需要去掉 message.setLocaleStringHeader("body","");存入自己的消息内容 message.setLocaleStringHeader("title","");存入自己的消息头 message.setStringHeader("url", "/shr/dynamic.do?uipk=xxx&method=xxx");//消息需要url跳转,才设置此属性,注意,url中的参数,不需要进行url转码处理 其他的值基本一样,有特殊的再调整
请问这个接口为什么发不了消息到小铃铛,但数据库里面已经有数据
s-HR系统发送普通消息给系统用户
非多语言版本具体示例如下:Context ctx ;//可以通过传参传入Message message = MessageFactory.newMessage();//初始化消息对象message.se...
点击下载文档
上一篇:星瀚商城订单-eas的采购申请单下一篇:eas复杂query元数据建模
本文2024-09-16 22:18:44发表“eas cloud知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-eas-47328.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
- 鼎捷EAI整合規範文件V3.1.07 (集團).pdf
- 鼎捷OpenAPI應用場景說明_基礎資料.pdf
- 鼎捷OpenAPI應用場景說明_財務管理.pdf
- 鼎捷T100 API設計器使用手冊T100 APIDesigner(V1.0).docx
- 鼎新e-GoB2雲端ERP B2 線上課程E6-2應付票據整批郵寄 領取.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程A4使用者建立權限設定.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程C3會計開帳與會計傳票.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程E6-1應付票據.pdf
- 鼎新e-GoB2雲端ERP B2 線上課程A5-1進銷存參數設定(初階篇).pdf
- 鼎新e-GoB2雲端ERP B2 線上課程D2帳款開帳與票據開帳.pdf
热门文章