Skip to content

创建待办接口v2

基本信息

中文名: 创建待办接口v2

接口名: /tc/v2/openapi/task/create.json

所在目录: 待办

调用方式: GET(HTTPS)

接口说明 : 创建待办实例

备注: ** 该接口同时只能创建一个待办任务,若需要给同一个实例创建多个待办任务,则需要循环调用此接口,取第一次创建后返回的packageUuid的值,在后续的调用中传入到packageUuid入参中。 **

最低可用版本V2.6.0

请求参数

名称类型是否必填示例值描述
assigneeInfoString{“imgId”:“”,“name”:“张三”}待办人信息,示例:{“imgId”:“”,“name”:“张三”}<br/>不传的话待办人缺少名称与头像信息
subjectString标题(上限200字符)
creatorInfoString{“imgId”:“”,“name”:“张三”}创建人信息,示例:{“imgId”:“”,“name”:“张三”}<br/>不传的话创建人缺少名称与头像信息
creatorIdString创建人ID,人员信息的accountId
dueTimeDate截止时间
tenantIdString租户ID
bizTaskIdString业务系统自定义ID,业务系统保证唯一,否则不保证幂等
mobileUrlString移动端详情URL(上限1000字符,必须为带着参数的get请求)
assigneeIdString待办人ID,人员信息中的accountId
urlStringPC端详情URL(上限1000字符,必须为带着参数的get请求)
packageUuidString实例唯一ID,任务会关联在这个实例下,不传的时候会同步创建一个新的实例
isSendDynamicCardBoolean是否发送动态卡片
dueNotifyTypeArrList<String>提醒方式<br/>app-应用内(弹窗);<br/>notification-工作通知
dueNotifyLevelInteger提醒时间(仅在配置截止时间后生效)<br/>0:截止时;<br/>1:15分钟前;<br/>2:1小时前;<br/>3:3小时前<br/>4:1天前
isSendWindowNoticeBoolean是否弹窗提醒
tagString标签
descriptionString待办描述
sourceAppkeyString待办来源appkey(由待办应用分配)
detailLinkOpenTypeString详情链接打开方式,支持传入 pc_slide:侧边栏打开(该方式url需支持识别海南省中台用户中心token参数拼接至URL,例:https://访问地址? accessToken=xxxx)<br/>ddtab:在新的tab页打开(默认)

返回参数

名称子参数名称子参数名称子参数名称类型描述
successBoolean是否成功
contentObject内容
└dataTaskDTO任务创建结果
└└appKeyString应用key
└└appNameString应用名
└└businessTypeString业务类型
└└taskUuidString任务uuid
└└packageUuidString实例uuid
└└bizTaskIdString任务业务id
└└creatorUserInfoDTO创建人
userIdString用户ID
nameString用户名
imgIdString头像ID
└└assigneeUserInfoDTO待办人
userIdString用户ID
nameString用户名
imgIdString头像ID
└└subjectString任务标题
└└urlString详情url
└└mobileUrlString移动详情url
└└createTimeDate任务创建时间
└└startTimeDate任务开始时间
└└dueTimeDate预计办结时间
└└priorityString优先级
└└finishTimeDate任务完成时间
└└formValuesList<ComponentValueDTO>表单值
└└└labelString标签名
└└└valueString组件值
└└└componentIdString组件id
└└packageCreateTimeDate实例创建时间
└└overdueBoolean是否逾期
└└acceleratorsList<AcceleratorDTO>
└└└labelString按钮显示内容
└└└idString动作ID,如AGREE、DISAGREE等
└└└clearBoolean是否完成待办<br/>true:完成<br/>false:不完成
└└needVpnBoolean是否需要vpn
└└dueNotifyTypeArrList<String>提醒方式 <br/>app-应用内(弹窗);<br/>notification-工作通知
└└dueNotifyLevelInteger提醒时间 (仅在配置截止时间后生效)<br/>0-截止时;<br/>1-15分钟前;<br/>2-1小时前;<br/>3-3小时前<br/>4-1天前
└└tagString标签
└successBoolean请求是否成功
└responseCodeString请求code
└responseMessageString请求msg

调用示例

java
String url= "https://xxxx";
String mobileUrl= "https://xxx";

Map<String, String> parameter = new HashMap<>();
parameter.put("subject", "xxx");
parameter.put("assigneeInfo", JSONObject.of("imgId", "xxx", "name", "xxx").toString());
parameter.put("assigneeId", "xxx");
parameter.put("creatorInfo", JSONObject.of("imgId", "xxx", "name", "xxx").toString());
parameter.put("creatorId", "xxx");
parameter.put("dueTime", "2024-06-06 12:00:03");
parameter.put("tenantId", "1");
parameter.put("bizTaskId", UUID.fastUUID().toString(true));
parameter.put("mobileUrl", mobileUrl);
parameter.put("url", detailUrl);
parameter.put("dueNotifyTypeArr", "app,notification");
parameter.put("dueNotifyLevel", "2");
parameter.put("isSendWindowNotice", "true");
parameter.put("sourceAppkey", "xxx");
parameter.put("detailLinkOpenType", "ddtab");


//拼装业务信息
HttpParameters parameters = HttpParameters.builder()
.api("/tc/v2/openapi/task/create.json")
.region("INTER")
.accessKey("xxx")
.secretKey("xxx")
.queryParamsMap(parameter)
.requestUrl("https://api-one.digitalhainan.com.cn/apione")
.mediaType(MediaType.parse("application/json"))
.method("GET")
.build();

HttpReturn call = HttpCaller.getInstance().call(parameters);
log.info("响应:" + call.response);

创建多人待办调用示例:

java
        String url= "https://xxxx";
        String mobileUrl= "https://xxx";
        // 执行人列表
        List<String> assigneeIdList = ListUtil.of("xxx", "xxx");
        // 待办实例id
        Object packageUuid = null;
        for (String assigneeId : assigneeIdList) {
            Map<String, String> parameter = new HashMap<>();
            parameter.put("subject", "xxx");
            parameter.put("assigneeInfo", JSONObject.of("imgId", "xxx", "name", "xxx").toString());
            parameter.put("assigneeId", assigneeId);
            parameter.put("creatorInfo", JSONObject.of("imgId", "xxx", "name", "xxx").toString());
            parameter.put("creatorId", "xxx");
            parameter.put("dueTime", "2024-06-06 12:00:03");
            parameter.put("tenantId", "1");
            parameter.put("bizTaskId", UUID.fastUUID().toString(true));
            parameter.put("mobileUrl", mobileUrl);
            parameter.put("url", url);
            parameter.put("dueNotifyTypeArr", "app,notification");
            parameter.put("dueNotifyLevel", "2");
            parameter.put("isSendWindowNotice", "true");
            parameter.put("detailLinkOpenType", "ddtab");
            parameter.put("sourceAppkey", "xxx");
            // 若需要给同一个实例创建多个待办任务,则需要传入packageUuid
            if (ObjectUtil.isNotNull(packageUuid)) {
                parameter.put("packageUuid", packageUuid.toString());
            }
            System.out.println("入参:" + JSON.toJSONString(parameter));
            //拼装业务信息
            HttpParameters parameters = HttpParameters.builder()
                    .api("/tc/v2/openapi/task/create.json")
                    .region("INTER")
                    .accessKey("xxx")
                    .secretKey("xxx")
                    .queryParamsMap(parameter)
                    .requestUrl("https://api-one.digitalhainan.com.cn/apione")
                    .mediaType(MediaType.parse("application/json"))
                    .method("GET")
                    .build();
            HttpReturn call = HttpCaller.getInstance().call(parameters);
            JSONObject resp = JSONObject.parseObject(call.getResponse());
            if (ObjectUtil.isNull(packageUuid)) {
                // 获取待办实例id
                packageUuid = resp.getByPath("content.data.packageUuid");
            }
        }