创建接口

在服务管理平台中创建一个接口,接口代码如下:

/*
* resources.getEntityManagerContainer() // 实体管理容器.
* resources.getContext() //上下文根.
* resources.getOrganization() //组织访问接口.
* requestText //请求内容.
* request //请求对象.
*/



/*
    传入的参数
    假设requestText = {
        "title" : "关于某某某的通知公告(标题,必填)",  //标题
        "from" : "办公室(来文单位,必填)",
        "to" : "qhsnynctrsc(OA的部门人事处ID,必填)",
        "date" : "2020-05-09(收文日期,选填)",
        "no" : "农123(字号,选填)",
        "key" : "nmt(文件加密私钥,选填,为空则认为没加密)",
        "contents" : [ {
            "filepath" : "http://xxxxx.com?file=aaaa.docx",
            "filename" : "aaaa.docx"
        } ],
        "slaves" : [ {
            "filepath" : "http://xxxxx.com?file=slaves.docx",
            "filename" : "slaves.docx"
        } ]
    }
*/
try{
    var result = {

    }

    print( "requestText="+requestText );

    var requestJson = JSON.parse(requestText);
    print( "type of requestJson = " + typeof( requestJson ));

    print( "type of requestJson = " + requestJson );
    if( typeof(requestJson) === "string" ){
        requestJson = JSON.parse(requestJson);
    }

    var workId = "b4cbb9a4-3410-45a4-9c0e-4dad0dcf94b4";  //流程文档的workId

    //上传附件-----------------------------------------------------------begin
    var token = getToken();  

    //print( "contents个数:" + requestJson.contents.length);
    //print( "slaves个数:" + requestJson.slaves.length);
    var contentsSite = "attachment"; //正文附件放置的附件区域
    var slavesSite = "attachment_1"; //普通附件放置的附件区域
    //处理contents
    var conArr = requestJson.contents;
    for(var i=0;i//print( "contents-filepath:" + conArr[i].filepath);