init import

This commit is contained in:
weiyunlong 2024-08-28 16:44:56 +08:00
commit d0f87645fb
4 changed files with 115 additions and 0 deletions

View File

@ -0,0 +1,67 @@
package shkd.repc.recon.opplugin;
import com.alibaba.fastjson.JSONObject;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.mvc.list.AttachmentModel;
import kd.bos.util.HttpClientUtils;
import kd.bos.util.StringUtils;
import java.io.IOException;
import java.util.*;
/**
* @description
*/
public class TestOPPlugin extends AbstractOperationServicePlugIn {
private static final Log logger = LogFactory.getLog(TestOPPlugin.class);
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
String operationKey = e.getOperationKey();
if ("submit".equals(operationKey)) {
// String url = System.getProperty("efms.infcompany.url.ip");
// logger.info("url");
/**
* ---------------------生成上传文件链接----------------------------
*/
String linkUrl = "http://172.31.254.241:8869/file/v1/generateUploadUrl";
//TODO:请求头 2.2.1
Map<String, String> linkHeader = new HashMap<>();
linkHeader.put("Content-Type", "application/json");
//生成上传文件链接接口请求体
JSONObject linkBody = new JSONObject();
linkBody.put("expire",5);
linkBody.put("requestID", "550E8400E29B11D4A716446655440000");
linkBody.put("type", 0);
//获取上传链接类型0-上传文件并分割适用于100M以内的pdf文件1-上传文件适用于大于100M的pdf文件以及其他类型的文件ofddocdocxxlsxlsxjpgjpegpngziprar
try {
String linkPostjson = HttpClientUtils.postjson(linkUrl, linkHeader,linkBody.toJSONString());
if (StringUtils.isNotEmpty(linkPostjson)) {
/**
* ---------------------上传文件----------------------------
*/
String uploadUrl = linkPostjson;
//TODO:请求头 2.2.1
Map<String, String> uploadHeader = new HashMap<>();
linkHeader.put("Content-Type", "application/json");
//生成上传文件链接接口请求体
JSONObject uploadBody = new JSONObject();
linkBody.put("file",new AttachmentModel());//附件
String uploadPostjson = HttpClientUtils.postjson(uploadUrl, uploadHeader,uploadBody.toJSONString());
if ("success".equals(uploadPostjson)) {
//上传成功
}
}
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}
}
}

View File

@ -0,0 +1,48 @@
package shkd.repc.recon.workflowplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.servicehelper.workflow.WorkflowServiceHelper;
import kd.bos.util.StringUtils;
import kd.bos.workflow.api.AgentExecution;
import kd.bos.workflow.api.AgentTask;
import kd.bos.workflow.component.approvalrecord.ApprovalAttachmentInfo;
import kd.bos.workflow.component.approvalrecord.IApprovalRecordGroup;
import kd.bos.workflow.component.approvalrecord.IApprovalRecordItem;
import kd.bos.workflow.engine.extitf.IWorkflowPlugin;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* 工作流插件---合同会签后自动节点获取链接
* 集成E签宝电子签署
* 元数据:qeug_recon_contractbi_ext(合同)
*/
public class WorkflowAutGetLinkPlugin implements IWorkflowPlugin {
private static final Log log = LogFactory.getLog(WorkflowAutGetLinkPlugin.class);
@Override
public void notify(AgentExecution execution) {
IWorkflowPlugin.super.notify(execution);
log.info("开始获取链接信息");
AgentTask currentTask = execution.getCurrentTask();
Long id = currentTask.getId();
//进入自动节点
if (null == id) {
String businessKey = currentTask.getBusinessKey();//id
String entityNumber = execution.getEntityNumber();//标识
}
}
}