一、BPM对接传递附件的需求。
附件传递目前有几个问题点需要解决
1、T100上传附件的方式
通过附件上传、上传到file文件夹。file中无法查看文件的具体名称。文件进行加密。
2、文件的保存方式
系统默认的浏览是将file中的文件复制到tmp文件夹中,将文件生成在tmp文件夹中,但是有一个问题是,每天会被sh脚本清空。BPM在第二天就无法查看附件,并且还有一个问题是,文件只有浏览过才会在tmp产生。
3、解决方案?
利用接口传递url,BPM每次调用接口产生临时文件。这样就不会担心每次文件的清空。
PRIVATE FUNCTION cwssp002_process()
#add-point: 服務邏輯主要處理段的ADP name="cwssp002.process"
DEFINE g_return RECORD
code STRING,
desc STRING
-- docno LIKE type_t.chr200
END RECORD
DEFINE l_docno LIKE pmdi_t.pmdidocno
DEFINE l_stus LIKE pmdi_t.pmdistus
DEFINE l_xmee900 LIKE xmee_t.xmee900
DEFINE l_apcald LIKE apca_t.apcald
DEFINE l_node xml.DomNode
DEFINE l_node2 xml.DomNode
DEFINE l_prog LIKE type_t.chr20
DEFine l_site LIKE type_t.chr20
DEFINE l_success LIKE type_t.num5
DEFINE r_success LIKE type_t.num5
DEFINE l_masterindex LIKE type_t.num5
DEFINE l_detailindex LIKE type_t.num5
DEFINE l_mastercount LIKE type_t.num5
DEFINE l_detailcount LIKE type_t.num5
DEFINE l_errno LIKE type_t.chr10
DEFINE l_str_m STRING
DEFINE l_wc STRING
DEFINE lb_status BOOLEAN
DEFINE l_json_obj util.JSONObject
DEFINE l_json_arr util.JSONArray
DEFINE l_ooac004 LIKE ooac_t.ooac004
DEFINE l_ooac002 LIKE ooac_t.ooac002
DEFINE l_flag1 LIKE type_t.num5
DEFINE l_user LIKE ooag_t.ooag001
DEFINE l_user_t LIKE ooag_t.ooag001
DEFINE p_pmdidocno LIKE pmdi_t.pmdidocno
DEFINE r_pmdi030 STRING
DEFINE l_sql STRING
DEFINE l_urlfile STRING
DEFINE ls_url STRING
DEFINE sr RECORD
loaa010 LIKE loaa_t.loaa010,
loaa009 LIKE loaa_t.loaa009
END RECORD
DEFINE ls_source STRING
DEFINE ls_target STRING
DEFINE ls_file_name STRING
DEFINE l_filename STRING
LET l_success = TRUE
CALL s_tax_recount_tmp()
#回傳值建立tmptable
CALL s_axmt510_create_temp()
CALL s_aic_carry_create_temp_table_xmd() RETURNING l_success
CALL s_aic_carry_create_temp_table_order() RETURNING l_success
LET l_prog = awsp900_01_getParameter("prog")
LET l_docno = awsp900_01_getParameter("docno") #单号
IF cl_null(l_prog) OR cl_null(l_docno) THEN
LET g_status.code = -1
LET g_status.description = '程序编号、单号、不能为空!'
LET l_success = FALSE
END IF
#获取URL地址
LET r_pmdi030=""
LET l_sql=" SELECT loaa010,loaa009",
" FROM loaa_t ",
" WHERE loaaent=",g_enterprise," AND loaa001 like '%",l_docno,"%'"
PREPARE sel_loaa FROM l_sql
DECLARE dec_loaa CURSOR FOR sel_loaa
FOREACH dec_loaa INTO sr.*
LET l_urlfile = sr.loaa010
LET l_filename = sr.loaa010
LET ls_target = os.Path.join(FGL_GETENV("TEMPDIR"),sr.loaa010)
LET ls_source = os.Path.join(cl_get_para(g_enterprise,g_site,"E-SYS-0008"),sr.loaa009 CLIPPED)
IF os.Path.copy(ls_source, ls_target) THEN END IF
LET l_urlfile = l_urlfile.trim()
LET l_urlfile = cl_trans_url_encode(l_urlfile)
LET ls_url = os.Path.join(os.Path.join(FGL_GETENV("FGLASIP"),"out"),l_urlfile CLIPPED)
#url
IF cl_null(r_pmdi030) THEN
LET r_pmdi030=ls_url
ELSE
LET r_pmdi030=r_pmdi030,";",ls_url
END IF
#文件名
IF cl_null(ls_file_name) THEN
LET ls_file_name = l_filename
ELSE
LET ls_file_name = ls_file_name,";",l_filename
END IF
END FOREACH
LET g_return.code = ls_file_name
LET g_return.desc = r_pmdi030
-- LET g_return.docno = ''
CALL awsp900_01_addParameterRecord(util.JSONObject.fromFGL(g_return))
CALL s_aic_carry_drop_temp_table_xmd()
CALL s_aic_carry_drop_temp_table_order()
CALL s_axmt510_drop_temp()
#end add-point
END FUNCTION
网友评论