完善流程

This commit is contained in:
jinqiming 2022-01-11 19:05:35 +08:00
parent d7a614b1c4
commit 78d00fae65
5 changed files with 110 additions and 5 deletions

View File

@ -176,6 +176,17 @@ public class BaseConstantUrl {
*/
public static final String GET_PROCESSLIST_USERID="https://oapi.dingtalk.com/topapi/process/listbyuserid";
/**
* 创建待办事项()
*/
public static final String CREATE_PROCESS_TASK="https://oapi.dingtalk.com/topapi/process/workrecord/task/create";
/**
*
*/
public static final String UPDATE_PROCESS_TASK="https://oapi.dingtalk.com/topapi/process/workrecord/task/update";
public static final String UPDATE_PROCESS_WORKRECORD="https://oapi.dingtalk.com/topapi/process/workrecord/update";
//************************************************外部联系人

View File

@ -0,0 +1,41 @@
package com.snow.dingtalk.model.request;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @author qimingjin
* @Title:
* @Description:
* @date 2022/1/4 17:28
*/
@Data
public class SaveTaskRequest implements Serializable {
/**
* 审批实例ID
*/
private String processInstanceId;
/**
* 待办事项列表
*/
private List<TaskTopVo> tasks;
@Data
public static class TaskTopVo implements Serializable {
private static final long serialVersionUID = 7216484491466141389L;
/**
* 待办事项执行人的userid
*/
private String userId;
/**
* 待办事项跳转URL
*/
private String url;
}
}

View File

@ -0,0 +1,27 @@
package com.snow.dingtalk.model.response;
import lombok.Data;
import java.io.Serializable;
/**
* @author qimingjin
* @Title:
* @Description:
* @date 2022/1/4 17:54
*/
@Data
public class DingCreateTaskResponse implements Serializable {
/**
* 待办事项ID
*/
private String taskId;
/**
* 待办事项执行人的userid
*/
private String userid;
}

View File

@ -4,6 +4,7 @@ import com.dingtalk.api.response.OapiProcessListbyuseridResponse;
import com.dingtalk.api.response.OapiProcessTemplateManageGetResponse;
import com.dingtalk.api.response.OapiProcessinstanceGetResponse;
import com.snow.dingtalk.model.request.*;
import com.snow.dingtalk.model.response.DingCreateTaskResponse;
import java.util.List;
@ -74,8 +75,9 @@ public interface DingOfficialFlowService {
*/
String saveFakeProcessInstance(StartFakeProcessInstanceRequest startFakeProcessInstanceRequest);
void bpmsTaskChange();
List<DingCreateTaskResponse> createProcessTask(SaveTaskRequest saveTaskRequest);
void updateProcessTask();
}

View File

@ -14,6 +14,7 @@ import com.snow.common.utils.bean.BeanUtils;
import com.snow.dingtalk.common.BaseConstantUrl;
import com.snow.dingtalk.common.BaseService;
import com.snow.dingtalk.model.request.*;
import com.snow.dingtalk.model.response.DingCreateTaskResponse;
import com.snow.dingtalk.service.DingOfficialFlowService;
import com.snow.system.service.impl.SysConfigServiceImpl;
import com.taobao.api.ApiException;
@ -235,11 +236,34 @@ public class DingOfficialFlowServiceImpl extends BaseService implements DingOffi
}
}
@Override
public void bpmsTaskChange() {
public List<DingCreateTaskResponse> createProcessTask(SaveTaskRequest saveTaskRequest) {
DingTalkClient client = new DefaultDingTalkClient(BaseConstantUrl.CREATE_PROCESS_TASK);
OapiProcessWorkrecordTaskCreateRequest req = new OapiProcessWorkrecordTaskCreateRequest();
OapiProcessWorkrecordTaskCreateRequest.SaveTaskRequest taskRequest = new OapiProcessWorkrecordTaskCreateRequest.SaveTaskRequest();
taskRequest.setAgentid(11L);
taskRequest.setProcessInstanceId(saveTaskRequest.getProcessInstanceId());
List<OapiProcessWorkrecordTaskCreateRequest.TaskTopVo> taskTopVos = BeanUtils.transformList(saveTaskRequest.getTasks(), OapiProcessWorkrecordTaskCreateRequest.TaskTopVo.class);
taskRequest.setTasks(taskTopVos);
req.setRequest(taskRequest);
try {
OapiProcessWorkrecordTaskCreateResponse response = client.execute(req, getDingTalkToken());
if (response.getErrcode() != 0) {
throw new SyncDataException(JSON.toJSONString(req), response.getErrmsg());
}
return BeanUtils.transformList(response.getTasks(), DingCreateTaskResponse.class);
} catch (ApiException e) {
log.error("创建createProcessTask异常{}", e.getMessage());
throw new SyncDataException(JSON.toJSONString(req), e.getErrMsg());
}
}
@Override
public void updateProcessTask() {
}
}