# ICE待办任务集成指南 ## 1. 概述 本文档介绍了如何在系统中集成ICE待办任务功能,包括推送待办消息和更新待办任务状态。 ## 2. 配置 在 `application.yml` 文件中配置ICE待办任务相关参数: ```yaml ice: # ... 其他配置 pending-task: # WSDL接口地址(请向ICE运维人员获取) wsdl-url: http://app.ceic.com:xxxx/xx/xxxx/xxxx?wsdl # 订阅号,找系统管理员获取 platform-id: your-platform-id # 系统唯一标识 system-id: your-system-id ``` ## 3. API接口 ### 3.1 推送待办消息 - **接口地址**: `/ice/pending-task/send` - **请求方式**: POST - **请求参数**: | 参数名 | 类型 | 必填 | 描述 | |--------|------|------|------| | platformId | String | 否 | 订阅号,如未填写则使用配置中的默认值 | | title | String | 是 | 标题 | | sumary | String | 否 | 摘要,如需换行用"\n" | | content | String | 否 | 消息正文 | | code | String | 是 | 用户工号 | | type | Integer | 否 | 类型,此处必须传入:2(默认值) | | url | String | 是 | 跳转的url链接 | | taskId | String | 否 | 此消息的任务ID,如果后续需要修改状态必填 | | isCompleted | String | 否 | 是否已完成状态,1待办,2已办 | | systemId | String | 否 | 系统的唯一识别,如未填写则使用配置中的默认值 | - **请求示例**: ```json { "title": "审批申请", "sumary": "张三提交的请假申请", "content": "张三于2023年1月1日提交了请假申请,请审批。", "code": "EMP001", "url": "http://your-app.com/approval/detail/123", "taskId": "task-123" } ``` ### 3.2 批量推送待办消息 - **接口地址**: `/ice/pending-task/batch-send` - **请求方式**: POST - **请求参数**: 待办消息请求对象数组 ### 3.3 更新待办任务状态 - **接口地址**: `/ice/pending-task/status` - **请求方式**: PUT - **请求参数**: | 参数名 | 类型 | 必填 | 描述 | |--------|------|------|------| | taskId | String | 是 | 此消息的任务ID | | isCompleted | String | 是 | 是否已完成状态,1待办,2已办 | | systemId | String | 是 | 系统的唯一识别 | ### 3.4 取消待办任务 - **接口地址**: `/ice/pending-task/cancel/{taskId}?systemId=xxx` - **请求方式**: DELETE - **路径参数**: - taskId: 任务ID - **请求参数**: - systemId: 系统ID ## 4. Java服务调用示例 ### 4.1 注入服务 ```java @Autowired private IcePendingTaskService icePendingTaskService; ``` ### 4.2 推送待办消息 ```java // 创建待办任务请求对象 IcePendingTaskRequest request = new IcePendingTaskRequest(); request.setTitle("审批申请"); request.setSumary("张三提交的请假申请"); request.setContent("张三于2023年1月1日提交了请假申请,请审批。"); request.setCode("EMP001"); request.setUrl("http://your-app.com/approval/detail/123"); request.setTaskId("task-123"); // 推送待办消息 IcePendingTaskResponse response = icePendingTaskService.sendPendingTask(request); if (response.getSuccess()) { System.out.println("推送成功"); } else { System.out.println("推送失败:" + response.getMsg()); } ``` ### 4.3 更新待办任务状态 ```java // 创建状态变更请求对象 IcePendingTaskStatusRequest statusRequest = new IcePendingTaskStatusRequest(); statusRequest.setTaskId("task-123"); statusRequest.setIsCompleted("2"); // 2表示已办 statusRequest.setSystemId("your-system-id"); // 更新状态 IcePendingTaskResponse response = icePendingTaskService.updatePendingTaskStatus(statusRequest); if (response.getSuccess()) { System.out.println("状态更新成功"); } else { System.out.println("状态更新失败:" + response.getMsg()); } ``` ## 5. 注意事项 1. 确保正确配置WSDL接口地址、平台ID和系统ID 2. type参数必须为2才能正确发送待办消息 3. 如需后续修改状态,务必保存taskId和systemId 4. isCompleted参数值:1表示待办,2表示已办 5. 在生产环境中确保接口的安全性,可能需要添加认证和授权机制