优化扫描接口和第三方上传接口
This commit is contained in:
parent
8bb7cbfef7
commit
8ef28c5c3c
@ -209,33 +209,15 @@
|
||||
return;
|
||||
}
|
||||
if(params!=null){
|
||||
post(url,params);
|
||||
AsControl.postICMS(url,params);
|
||||
}
|
||||
}
|
||||
function getRequestParam(projectId){
|
||||
let code = 'ECM0002';
|
||||
let param = RunJavaMethodTrans("com.ample.icms.query.ImageQuery","getRequestParamByProjectIdJMT","projectId="+projectId+",code="+code);
|
||||
let param = RunJavaMethodTrans("com.ample.icms.service.ImageQueryService","getRequestParamByProjectIdJMT","projectId="+projectId+",code="+code);
|
||||
return param;
|
||||
}
|
||||
/**
|
||||
* 考虑防止一些浏览器的弹窗被阻止,不用ajax,而是用form表单提交的方式
|
||||
* @param URL
|
||||
* @param PARAMS
|
||||
*/
|
||||
function post(URL, param) {
|
||||
let temp_form = document.createElement("form");
|
||||
temp_form.action = URL;
|
||||
temp_form.target = "_blank";
|
||||
temp_form.method = "post";
|
||||
temp_form.style.display = "none";
|
||||
let opt = document.createElement("textarea");
|
||||
opt.name = 'data';
|
||||
opt.value = param;
|
||||
temp_form.appendChild(opt);
|
||||
|
||||
document.body.appendChild(temp_form);
|
||||
temp_form.submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -197,5 +197,13 @@
|
||||
document.getElementById("NETCERTNAME").value = '';
|
||||
}
|
||||
}
|
||||
function getIdentity(){
|
||||
var certId = getItemValue(0,getRow(),"CERTID");
|
||||
return certId;
|
||||
}
|
||||
function getCustomerName(){
|
||||
var customerName = getItemValue(0,getRow(),"enterprisename");
|
||||
return customerName;
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -8,7 +8,7 @@
|
||||
String custtype = CurPage.getParameter("CustomerType");
|
||||
String PhaseNo = CurPage.getParameter("PhaseNo");
|
||||
String projectId = CurPage.getParameter("ProjectId");
|
||||
// String signStatus = CurPage.getParameter("SignStatus");
|
||||
String ProjectNo = CurPage.getParameter("ProjectNo");
|
||||
String contractNumber = CurPage.getParameter("ContractNumber");
|
||||
String productId = CurPage.getParameter("ProductId");
|
||||
String flowunid = CurPage.getParameter("FlowUnid");
|
||||
@ -55,8 +55,9 @@
|
||||
</style>
|
||||
<script type="text/javascript">
|
||||
function uploadContract(){
|
||||
var sParams="ProjectId=<%=projectId%>,flowUnid=<%=flowunid%>,flowNo=<%=FlowNo%>";
|
||||
var sReturn = RunJavaMethod("com.ample.icms.scan.ImageUpload","upload",sParams);
|
||||
//因为要传到付款阶段的合同套系,所以这里的flowNo固定为FundPaymentCarFlow
|
||||
var sParams="ProjectId=<%=projectId%>,flowUnid=<%=flowunid%>,projectNo=<%=ProjectNo%>,flowNo=FundPaymentCarFlow";
|
||||
var sReturn = RunJavaMethod("com.ample.icms.service.ImageUploadService","upload",sParams);
|
||||
alert(sReturn);
|
||||
}
|
||||
//²âÊÔµç×ÓǩԼ
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
String FlowNo=CurPage.getParameter("FlowNo");//流程名称
|
||||
String projectNo=CurPage.getParameter("ProjectNo");//项目编号
|
||||
String sPrevUrl = CurPage.getParameter("PrevUrl");
|
||||
String ishistory=CurPage.getParameter("IsHistory");
|
||||
String isHistory=CurPage.getParameter("IsHistory");
|
||||
String compClientID = request.getParameter("CompClientID");
|
||||
String RightType = CurPage.getParameter("RightType");//页面是否 是只读
|
||||
String custype = CurPage.getParameter("customertype");//获取客户类型
|
||||
@ -110,6 +110,7 @@
|
||||
}
|
||||
function getRequestParam(){
|
||||
let appInfo = RunJavaMethod("com.ample.icms.util.GetInfoUtil", "getAppInfoByFlowUnidRJM", "flowUnid=<%=sFlowUnid%>");
|
||||
debugger;
|
||||
let index = appInfo.indexOf("@");
|
||||
if(index==-1){
|
||||
alert(appInfo);
|
||||
@ -122,7 +123,7 @@
|
||||
return;
|
||||
}
|
||||
let code = 'ECM0002';
|
||||
if(("<%=FlowNo%>"=="BContractApproveFlow"||"<%=FlowNo%>"=="BContractChangeFlow"||"<%=FlowNo%>"=="BContractSupportFlow"||"<%=FlowNo%>"=="ContractOnhireCarChangeFlow")&&"<%=sPhaseNo%>"=="0010"){
|
||||
if(("<%=FlowNo%>"=="BContractApproveFlow"||"<%=FlowNo%>"=="BContractChangeFlow"||"<%=FlowNo%>"=="BContractSupportFlow"||"<%=FlowNo%>"=="ContractOnhireCarChangeFlow")&&"<%=sPhaseNo%>"=="0010"&&"<%=isHistory%>"!="true"){
|
||||
code = 'ECM0001';
|
||||
}
|
||||
let busiNo= "<%=projectNo%>";
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
String sFlowUnid = CurPage.getParameter("FlowUnid");
|
||||
String sPhaseNo=CurPage.getParameter("PhaseNo");//쌓뙈뵀
|
||||
String FlowNo=CurPage.getParameter("FlowNo");//직넋츰냔
|
||||
String projectNo=CurPage.getParameter("ProjectNo");//ÏîÄ¿±àºÅ
|
||||
String isHistory=CurPage.getParameter("IsHistory");
|
||||
if(sPrevUrl == null) sPrevUrl = "";
|
||||
|
||||
String sTempletNo = "LbContactInfo";//--친겼뵀--
|
||||
@ -26,6 +26,7 @@
|
||||
//{"true","All","Button","괏닸","괏닸杰唐錦맣","as_save(0)","","","",""},
|
||||
//{String.valueOf(!com.amarsoft.are.lang.StringX.isSpace(sPrevUrl)),"All","Button","럿쀼","럿쀼죗깊","returnList()","","","",""}
|
||||
{"true","","Button","栗죕헌데","栗죕헌데","openFileList()","","","","btn_icon_saveNew",""},
|
||||
{"true","","Button","付款申请资料清单","资料清单","openPayFileList()","","","","btn_icon_saveNew",""},
|
||||
};
|
||||
//sButtonPosition = "south";
|
||||
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
|
||||
@ -47,35 +48,38 @@
|
||||
}
|
||||
function openFileList(){
|
||||
let url = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestUrl","");
|
||||
let params = getRequestParam();
|
||||
if(params!=null){
|
||||
AsControl.postICMS(url,params);
|
||||
}
|
||||
}
|
||||
function getRequestParam(){
|
||||
let appInfo = RunJavaMethod("com.ample.icms.util.GetInfoUtil", "getAppInfoByFlowUnidRJM", "flowUnid=<%=sFlowUnid%>");
|
||||
let index = appInfo.indexOf("@");
|
||||
if(index==-1){
|
||||
alert(appInfo);
|
||||
return;
|
||||
}
|
||||
let appCode = appInfo.substr(0,index);
|
||||
let appName = appInfo.substr(index+1,appInfo.length);
|
||||
if(appCode=='0000'){
|
||||
alert(appName);
|
||||
return;
|
||||
}
|
||||
let code = 'ECM0002';
|
||||
if("<%=sPhaseNo%>"=="0010"){
|
||||
if("<%=sPhaseNo%>"=="0010"&&"<%=isHistory%>"!="true"){
|
||||
code = 'ECM0001';
|
||||
}
|
||||
let busiNo = '<%=projectNo%>';
|
||||
if(busiNo==null||busiNo==""||busiNo=="null"){
|
||||
busiNo = RunJavaMethod("com.ample.icms.util.GetInfoUtil", "getProjectNoByFlowUnidRJM", "flowUnid=<%=sFlowUnid%>");
|
||||
let params = RunJavaMethod("com.ample.icms.service.ImageQueryService","getRequestParamByFlowUnidRJM","flowUnid=<%=sFlowUnid%>,code="+code+",userCode=<%=userId%>"+",userName=<%=userName%>");
|
||||
if(params==null){
|
||||
alert('获取影像参数失败,请联系管理员');
|
||||
return;
|
||||
}
|
||||
let param = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestParam","appCode="+appCode+",appName="+appName+",code="+code+",busiNo="+busiNo+",userCode=<%=userId%>"+",userName=<%=userName%>");
|
||||
return param;
|
||||
if(params.indexOf("0000@")!=-1){
|
||||
let result = params.split("@")[1];
|
||||
alert(result);
|
||||
return;
|
||||
}
|
||||
AsControl.postICMS(url,params);
|
||||
|
||||
}
|
||||
function openPayFileList(){
|
||||
let url = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestUrl","");
|
||||
let params = RunJavaMethod("com.ample.icms.service.ImageQueryService","getRequestParamByFlowNoRJM","flowNo=FundPaymentCarFlow,code=ECM0002,flowUnid=<%=sFlowUnid%>");
|
||||
if(params==null){
|
||||
alert('获取影像参数失败,请联系管理员');
|
||||
return;
|
||||
}
|
||||
if(params.indexOf("0000@")!=-1){
|
||||
let result = params.split("@")[1];
|
||||
alert(result);
|
||||
return;
|
||||
}
|
||||
AsControl.postICMS(url,params);
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
@ -200,11 +200,13 @@
|
||||
if(("<%=FlowNo%>"=="BusinessApplyFlow"||"<%=FlowNo%>"=="BusinessChangeFlow")&&"<%=sPhaseNo%>"=="0010"){
|
||||
code = 'ECM0001';
|
||||
}
|
||||
let busiNo="<%=projectNo%>"
|
||||
let busiNo="<%=projectNo%>";
|
||||
if(busiNo==null||busiNo==""||busiNo=="null"){
|
||||
busiNo = RunJavaMethod("com.ample.icms.util.GetInfoUtil", "getProjectNoByFlowUnidRJM", "flowUnid=<%=sFlowUnid%>");
|
||||
}
|
||||
let param = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestParam","appCode="+appCode+",appName="+appName+",code="+code+",busiNo="+busiNo+",userCode=<%=userId%>"+",userName=<%=userName%>");
|
||||
let identity = $("#frame_list")[0].contentWindow.getIdentity();
|
||||
let customerName = $("#frame_list")[0].contentWindow.getCustomerName();
|
||||
let param = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestParam","appCode="+appCode+",appName="+appName+",code="+code+",busiNo="+busiNo+",userCode=<%=userId%>"+",userName=<%=userName%>"+",identity="+identity+",customerName="+customerName);
|
||||
return param;
|
||||
}
|
||||
|
||||
|
||||
@ -693,7 +693,7 @@
|
||||
}
|
||||
function ValidityCheck(){
|
||||
|
||||
if(<%=customerType%> == '03'){ //个人客户
|
||||
if('<%=customerType%>' == '03'){ //个人客户
|
||||
//校验证件类型为身份证或临时身份证时,出生日期是否同证件编号中的日期一致
|
||||
var certType = getItemValue(0,getRow(),"CERTTYPE");
|
||||
var certID = getItemValue(0,getRow(),"CERTID");
|
||||
@ -898,5 +898,13 @@
|
||||
var sReturnInfo = RunJavaMethodTrans("com.tenwa.lease.flow.project.businessapply.CustomerInfoCheck","checkCertIdAll",sParams);
|
||||
return sReturnInfo;
|
||||
}
|
||||
function getIdentity(){
|
||||
var certId = getItemValue(0,getRow(),"CERTID");
|
||||
return certId;
|
||||
}
|
||||
function getCustomerName(){
|
||||
var customerName = getItemValue(0,getRow(),"FULLNAME");
|
||||
return customerName;
|
||||
}
|
||||
</script>
|
||||
<%@ include file="/Frame/resources/include/include_end.jspf"%>
|
||||
|
||||
@ -17,6 +17,14 @@ public class ImageBatch {
|
||||
@XStreamAlias("BUSI_NO")
|
||||
private String busiNo ;
|
||||
|
||||
//客户身份证号
|
||||
@XStreamAlias("IDENTITY")
|
||||
private String identity;
|
||||
//客户名称
|
||||
|
||||
@XStreamAlias("CUSTOMER_NAME")
|
||||
private String customerName;
|
||||
|
||||
//业务扩展索引(非必填)
|
||||
@XStreamAlias("CARNO")
|
||||
private String carNo ;
|
||||
@ -89,4 +97,19 @@ public class ImageBatch {
|
||||
public void setPages(ImagePages pages) {
|
||||
this.pages = pages;
|
||||
}
|
||||
public String getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
public void setIdentity(String identity) {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return customerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName) {
|
||||
this.customerName = customerName;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.ample.icms.bean.image;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
||||
|
||||
import java.util.List;
|
||||
@XStreamAlias("NODE")
|
||||
@ -20,7 +21,7 @@ public class ImageNode {
|
||||
@XStreamAlias("ACTION")
|
||||
@XStreamAsAttribute
|
||||
private String action ;
|
||||
|
||||
@XStreamImplicit
|
||||
private List<ImagePage> page;
|
||||
|
||||
public String getId() {
|
||||
|
||||
@ -1,12 +1,13 @@
|
||||
package com.ample.icms.bean.image;
|
||||
|
||||
import com.thoughtworks.xstream.annotations.XStreamAlias;
|
||||
import com.thoughtworks.xstream.annotations.XStreamImplicit;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@XStreamAlias("PAGES")
|
||||
public class ImagePages {
|
||||
|
||||
@XStreamImplicit
|
||||
private List<ImageNode> nodes;
|
||||
|
||||
public List<ImageNode> getNodes() {
|
||||
|
||||
@ -10,17 +10,31 @@ public class ImageCheck extends ImageService {
|
||||
public String getResult() throws DocumentException {
|
||||
this.setCode("ECM0013");
|
||||
String result = this.doPost();
|
||||
String responseCode = "";
|
||||
return result;
|
||||
}
|
||||
public String resultAnalysis(String result) throws DocumentException {
|
||||
String falg = "false";
|
||||
String responseMsg = "";
|
||||
if("0000".equals(result)){
|
||||
responseCode = "0000";
|
||||
responseMsg = "连接影像系统失败,请及时联系管理员!";
|
||||
}else {
|
||||
Document dom = DocumentHelper.parseText(result);
|
||||
Element root = dom.getRootElement();
|
||||
responseCode = root.element("RESPONSE_CODE").getTextTrim();
|
||||
responseMsg = root.element("RESPONSE_MSG").getTextTrim();
|
||||
String responseCode = root.element("RESPONSE_CODE").getTextTrim();
|
||||
String batchVer = root.element("BATCH_VER").getTextTrim();
|
||||
if("200".equals(responseCode)){
|
||||
falg = "true";
|
||||
responseMsg = "×ÊÁÏÒÑÌá½»";
|
||||
}
|
||||
if("400".equals(responseCode)){
|
||||
if("0".equals(batchVer)){
|
||||
responseMsg = "×ÊÁÏδÉÏ´«";
|
||||
}else {
|
||||
responseMsg = root.element("RESPONSE_MSG").getTextTrim();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return responseCode+"@"+responseMsg;
|
||||
return falg+"@"+responseMsg;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,13 +16,14 @@ public class IcmsRelationInit extends BaseBussiness {
|
||||
BizObject boLPIT = JBOFactory.getBizObjectManager(LB_PROJECT_INFO_TEMP.CLASS_NAME,tx).createQuery("flowunid=:flowunid").setParameter("flowunid",this.getAttribute("ObjectNo").toString()).getSingleResult(false);
|
||||
String projectNo = boLPIT.getAttribute("project_no").toString();
|
||||
String productId = boLPIT.getAttribute("product_id").toString();
|
||||
SqlObject sql_icms = new SqlObject("select flowno,app_code,app_name from icms_prd_rela where productid='"+productId+"' group by flowno,app_code");
|
||||
SqlObject sql_icms = new SqlObject("select flowno,app_code,app_name,is_must from icms_prd_rela where productid='"+productId+"' group by flowno,app_code");
|
||||
ASResultSet rs = Sqlca.getASResultSet(sql_icms);
|
||||
while (rs.next()){
|
||||
String flowNo = rs.getString("flowno");
|
||||
String appCode = rs.getString("app_code");
|
||||
String appName = rs.getString("app_name");
|
||||
SqlObject sql_rela = new SqlObject("insert into icms_rela (id,project_no,flow_no,app_code,app_name) values(REPLACE(UUID(), '-', ''),'"+projectNo+"','"+flowNo+"','"+appCode+"','"+appName+"')");
|
||||
String isMust = rs.getString("is_must");
|
||||
SqlObject sql_rela = new SqlObject("insert into icms_rela (id,project_no,flow_no,app_code,app_name,is_must) values(REPLACE(UUID(), '-', ''),'"+projectNo+"','"+flowNo+"','"+appCode+"','"+appName+"','"+isMust+"')");
|
||||
Sqlca.executeSQL(sql_rela);
|
||||
}
|
||||
String sMessage="true";
|
||||
|
||||
@ -1,13 +1,10 @@
|
||||
package com.ample.icms.query;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.ample.icms.bean.image.ImageBatch;
|
||||
import com.ample.icms.bean.image.ImageMetaData;
|
||||
import com.ample.icms.bean.image.ImageRoot;
|
||||
import com.ample.icms.service.ImageService;
|
||||
import com.ample.icms.util.GetInfoUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -30,23 +27,19 @@ public class ImageQuery extends ImageService {
|
||||
batchs.add(addBatch(appCode,appName,busiNo,null));
|
||||
}
|
||||
}else {
|
||||
batchs.add(addBatch(appCode,appName,busiNo,null));
|
||||
ImageBatch batch = new ImageBatch();
|
||||
batch.setAppCode(appCode);
|
||||
batch.setAppName(appName);
|
||||
batch.setBusiNo(busiNo);
|
||||
batch.setIdentity(identity);
|
||||
batch.setCustomerName(customerName);
|
||||
batchs.add(batch);
|
||||
}
|
||||
ImageMetaData metaData = addMetaData(batchs);
|
||||
ImageRoot root = new ImageRoot(base,metaData);
|
||||
return root;
|
||||
}
|
||||
public String getRequestParamByProjectIdJMT(JBOTransaction tx) throws Exception {
|
||||
Transaction Sqlca = Transaction.createTransaction(tx);
|
||||
GetInfoUtil gif = new GetInfoUtil();
|
||||
this.setBusiNo(gif.getProjectNoByProjectId(projectId,Sqlca));
|
||||
JSONArray ja = gif.getAllAppInfoJsonByProjectId(projectId,Sqlca);
|
||||
if(ja==null){
|
||||
return "error";
|
||||
}
|
||||
this.setAllAppInfoJson(ja);
|
||||
return transformXMLtoParam(this.code,this.getRequestXML());
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getProjectId() {
|
||||
|
||||
@ -1,66 +1,31 @@
|
||||
package com.ample.icms.scan;
|
||||
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectManager;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.awe.util.SqlObject;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.amarsoft.dict.als.manage.NameManager;
|
||||
import com.ample.icms.bean.image.*;
|
||||
import com.ample.icms.service.ImageService;
|
||||
import com.ample.icms.util.GetInfoUtil;
|
||||
import com.ample.icms.util.PropertiesUtil;
|
||||
import com.sunyard.insurance.ecm.socket.client.AutoScanApi;
|
||||
import com.tenwa.officetempalte.exportcallback.impl.ZipUtils;
|
||||
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.io.OutputFormat;
|
||||
import org.dom4j.io.SAXReader;
|
||||
import org.dom4j.io.XMLWriter;
|
||||
|
||||
import java.io.*;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImageUpload extends ImageService {
|
||||
private String projectId;
|
||||
private String flowUnid;
|
||||
private String flowNo;
|
||||
private String projecNo;
|
||||
private List<File> files;
|
||||
private List<ImagePage> pageList;
|
||||
private static final String FileSavePath = PropertiesUtil.get("fileSavePathTemp");
|
||||
|
||||
public List<ImageNode> addNodes() throws Exception {
|
||||
files = new ArrayList<>();
|
||||
List<ImagePage> pages = new ArrayList<>();
|
||||
BizObjectManager bom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME);
|
||||
List<BizObject> bos = bom.createQuery("sign_type='COMPLETE' and file_flag='yes' and project_id=:projectId and flow_unid=:flowUnid")
|
||||
.setParameter("projectId",projectId).setParameter("flowUnid",flowUnid).getResultList(false);
|
||||
for(BizObject bo : bos){
|
||||
String projectId = bo.getAttribute("project_id").toString();
|
||||
String fileName = bo.getAttribute("filename").toString();
|
||||
String inputUserId = bo.getAttribute("inputuserid").toString();
|
||||
String inputOrgId = bo.getAttribute("inputorgid").toString();
|
||||
String filePath = bo.getAttribute("fullpath").toString();
|
||||
|
||||
ImagePage page = new ImagePage();
|
||||
page.setFileName(fileName);
|
||||
page.setUpUser(inputUserId);
|
||||
page.setUpUserName(NameManager.getUserName(inputUserId));
|
||||
page.setUpOrg(inputOrgId);
|
||||
page.setUpOrgName(NameManager.getOrgName(inputOrgId));
|
||||
page.setUpTime(StringFunction.getTodayNow());
|
||||
pages.add(page);
|
||||
|
||||
File file = new File(filePath);
|
||||
files.add(file);
|
||||
}
|
||||
public List<ImageNode> addNodes(List<ImagePage> pages) throws Exception {
|
||||
ImageNode node = new ImageNode();
|
||||
//ÈÚ×Ê×âÁÞºÏͬÌ×ϵ
|
||||
node.setId("APZLJJ000080");
|
||||
node.setId("APZLJJ000400");
|
||||
node.setAction("ADD");
|
||||
node.setPage(pages);
|
||||
List<ImageNode> nodes = new ArrayList<>();
|
||||
@ -69,59 +34,21 @@ public class ImageUpload extends ImageService {
|
||||
}
|
||||
public ImageRoot createData() throws Exception {
|
||||
addBaseData();
|
||||
ImagePages pages = addPages(addNodes());
|
||||
ImagePages pages = addPages(addNodes(pageList));
|
||||
List<ImageBatch> batchs = new ArrayList<>();
|
||||
batchs.add(addBatch(appCode,appName,busiNo,pages));
|
||||
ImageMetaData metaData = addMetaData(batchs);
|
||||
ImageRoot root = new ImageRoot(base,metaData);
|
||||
return root;
|
||||
}
|
||||
public String doUpload(){
|
||||
// String zipPath = "C:/Users/ivanl/Desktop/影像系统/ECM4.0Demo/ECM4.0Demo/第三方上传/1111.zip";
|
||||
String zipPath = FileSavePath+"/"+flowUnid+".zip";
|
||||
public String doUpload(String zipPath) throws Exception {
|
||||
String result = "0";
|
||||
try {
|
||||
AutoScanApi autoScanApi = new AutoScanApi(PropertiesUtil.get("service_ip"),8088,PropertiesUtil.get("secret_id")+"#"+PropertiesUtil.get("secret_key"));
|
||||
result = autoScanApi.ScanImageFile(appCode, zipPath);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
AutoScanApi autoScanApi = new AutoScanApi(PropertiesUtil.get("service_ip"),8088,PropertiesUtil.get("secret_id")+"#"+PropertiesUtil.get("secret_key"));
|
||||
result = autoScanApi.ScanImageFile(appCode, zipPath);
|
||||
return result;
|
||||
}
|
||||
|
||||
public String upload() throws Exception {
|
||||
/**
|
||||
* 1.找出需要上传的影像
|
||||
* 2.在指定路径添加对应xml文件
|
||||
* 3.打包上传
|
||||
* 4.删除复制文件和打包文件
|
||||
*/
|
||||
createXMl();
|
||||
FileOutputStream fos = new FileOutputStream(new File(FileSavePath+"/"+flowUnid+".zip"));
|
||||
ZipUtils zdo = new ZipUtils();
|
||||
zdo.toZip(files,fos);
|
||||
String result = doUpload();
|
||||
String returnCode = result.substring(0,result.indexOf("@"));
|
||||
String returnMsg = result.substring(result.indexOf("@")+1,result.length()+1);
|
||||
if(returnCode == "1"){
|
||||
deleteTemp();
|
||||
};
|
||||
intoLog(returnCode,returnMsg);
|
||||
return returnMsg;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传成功后再删除
|
||||
*/
|
||||
public void deleteTemp(){
|
||||
File f = new File(FileSavePath);
|
||||
if(f.length()!=0){
|
||||
ZipUtils zdo = new ZipUtils();
|
||||
zdo.deleteFile(f,false);
|
||||
}
|
||||
}
|
||||
public void createXMl() throws Exception {
|
||||
getAppInfo();
|
||||
public String createXMl() throws Exception {
|
||||
String xml = getRequestXML();
|
||||
SAXReader saxReader = new SAXReader();
|
||||
Document document;
|
||||
@ -129,72 +56,25 @@ public class ImageUpload extends ImageService {
|
||||
document = saxReader.read(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
|
||||
OutputFormat format = OutputFormat.createPrettyPrint();
|
||||
format.setEncoding("UTF-8");
|
||||
XMLWriter writer = new XMLWriter(new FileWriter(new File(FileSavePath+"/"+flowUnid+".xml")),format);
|
||||
XMLWriter writer = new XMLWriter(new FileWriter(new File(FileSavePath+"/busi.xml")),format);
|
||||
writer.write(document);
|
||||
writer.close();
|
||||
return FileSavePath+"/busi.xml";
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public void getAppInfo() throws Exception {
|
||||
GetInfoUtil gif = new GetInfoUtil();
|
||||
String appInfo = gif.getAppInfoByFlowUnid(flowUnid);
|
||||
String[] app = appInfo.split("@");
|
||||
this.setAppCode(app[0]);
|
||||
this.setAppName(app[1]);
|
||||
this.setBusiNo(projecNo);
|
||||
return "error";
|
||||
}
|
||||
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
|
||||
public List<ImagePage> getPageList() {
|
||||
return pageList;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
public void setPageList(List<ImagePage> pageList) {
|
||||
this.pageList = pageList;
|
||||
}
|
||||
|
||||
public String getFlowUnid() {
|
||||
return flowUnid;
|
||||
}
|
||||
|
||||
public void setFlowUnid(String flowUnid) {
|
||||
this.flowUnid = flowUnid;
|
||||
}
|
||||
|
||||
public String getFlowNo() {
|
||||
return flowNo;
|
||||
}
|
||||
|
||||
public void setFlowNo(String flowNo) {
|
||||
this.flowNo = flowNo;
|
||||
}
|
||||
|
||||
public String getProjecNo() {
|
||||
return projecNo;
|
||||
}
|
||||
|
||||
public void setProjecNo(String projecNo) {
|
||||
this.projecNo = projecNo;
|
||||
}
|
||||
|
||||
public void intoLog(String code ,String msg) {
|
||||
Transaction transaction = null;
|
||||
Transaction.createTransaction("als");
|
||||
SqlObject so = null;
|
||||
try {
|
||||
so = new SqlObject("insert into icms_upload_log (flowunid,path,code,msg,inputtime) values (:flowunid,:path,:code,:msg,:inputtime)");
|
||||
so.setParameter("flowunid",flowUnid);
|
||||
so.setParameter("path","");
|
||||
so.setParameter("code",code);
|
||||
so.setParameter("msg",msg);
|
||||
so.setParameter("inputtime", StringFunction.getTodayNow());
|
||||
transaction.executeSQL(so);
|
||||
transaction.commit();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
120
src/com/ample/icms/service/ImageQueryService.java
Normal file
120
src/com/ample/icms/service/ImageQueryService.java
Normal file
@ -0,0 +1,120 @@
|
||||
package com.ample.icms.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.amarsoft.are.jbo.JBOTransaction;
|
||||
import com.amarsoft.awe.util.Transaction;
|
||||
import com.ample.icms.query.ImageQuery;
|
||||
import com.ample.icms.util.GetInfoUtil;
|
||||
|
||||
public class ImageQueryService {
|
||||
private String code;
|
||||
private String projectId;
|
||||
private String flowUnid;
|
||||
private String userCode;
|
||||
private String userName;
|
||||
private String projectNo;
|
||||
private String flowNo;
|
||||
public String getRequestParamByFlowNoRJM() throws Exception {
|
||||
GetInfoUtil gif = new GetInfoUtil();
|
||||
String projectNo = gif.getProjectNoByFlowUnid(flowUnid);
|
||||
String app = gif.getAppInfoByProjectNo(projectNo,flowNo);
|
||||
String[] appInfo = app.split("@");
|
||||
ImageQuery iq = new ImageQuery();
|
||||
iq.setBusiNo(projectNo);
|
||||
if("0000".equals(appInfo[0])){
|
||||
return app;
|
||||
}
|
||||
iq.setAppCode(appInfo[0]);
|
||||
iq.setAppName(appInfo[1]);
|
||||
iq.setUserCode(userCode);
|
||||
iq.setUserName(userName);
|
||||
return iq.transformXMLtoParam(this.code,iq.getRequestXML());
|
||||
}
|
||||
public String getRequestParamByFlowUnidRJM() throws Exception {
|
||||
GetInfoUtil gif = new GetInfoUtil();
|
||||
String projectNo = gif.getProjectNoByFlowUnid(flowUnid);
|
||||
String app = gif.getAppInfoByFlowUnid(flowUnid);
|
||||
String[] appInfo = app.split("@");
|
||||
ImageQuery iq = new ImageQuery();
|
||||
iq.setBusiNo(projectNo);
|
||||
if("0000".equals(appInfo[0])){
|
||||
return app;
|
||||
}
|
||||
iq.setAppCode(appInfo[0]);
|
||||
iq.setAppName(appInfo[1]);
|
||||
iq.setUserCode(userCode);
|
||||
iq.setUserName(userName);
|
||||
return iq.transformXMLtoParam(this.code,iq.getRequestXML());
|
||||
}
|
||||
public String getRequestParamByProjectIdJMT(JBOTransaction tx) throws Exception {
|
||||
Transaction Sqlca = Transaction.createTransaction(tx);
|
||||
GetInfoUtil gif = new GetInfoUtil();
|
||||
String projectNo = gif.getProjectNoByProjectId(projectId,Sqlca);
|
||||
JSONArray ja = gif.getAllAppInfoJsonByProjectId(projectId,Sqlca);
|
||||
if(ja==null){
|
||||
return "error";
|
||||
}
|
||||
ImageQuery iq = new ImageQuery();
|
||||
iq.setBusiNo(projectNo);
|
||||
iq.setAllAppInfoJson(ja);
|
||||
iq.setUserCode(userCode);
|
||||
iq.setUserName(userName);
|
||||
return iq.transformXMLtoParam(this.code,iq.getRequestXML());
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getFlowUnid() {
|
||||
return flowUnid;
|
||||
}
|
||||
|
||||
public void setFlowUnid(String flowUnid) {
|
||||
this.flowUnid = flowUnid;
|
||||
}
|
||||
|
||||
public String getUserCode() {
|
||||
return userCode;
|
||||
}
|
||||
|
||||
public void setUserCode(String userCode) {
|
||||
this.userCode = userCode;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getProjectNo() {
|
||||
return projectNo;
|
||||
}
|
||||
|
||||
public void setProjectNo(String projectNo) {
|
||||
this.projectNo = projectNo;
|
||||
}
|
||||
|
||||
public String getFlowNo() {
|
||||
return flowNo;
|
||||
}
|
||||
|
||||
public void setFlowNo(String flowNo) {
|
||||
this.flowNo = flowNo;
|
||||
}
|
||||
}
|
||||
@ -20,6 +20,8 @@ public abstract class ImageService {
|
||||
protected String allAppInfo;
|
||||
protected String userCode;
|
||||
protected String userName;
|
||||
protected String identity;
|
||||
protected String customerName ;
|
||||
protected String appCode;
|
||||
protected String appName;
|
||||
protected String code;
|
||||
@ -204,4 +206,20 @@ public abstract class ImageService {
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getIdentity() {
|
||||
return identity;
|
||||
}
|
||||
|
||||
public void setIdentity(String identity) {
|
||||
this.identity = identity;
|
||||
}
|
||||
|
||||
public String getCustomerName() {
|
||||
return customerName;
|
||||
}
|
||||
|
||||
public void setCustomerName(String customerName) {
|
||||
this.customerName = customerName;
|
||||
}
|
||||
}
|
||||
|
||||
147
src/com/ample/icms/service/ImageUploadService.java
Normal file
147
src/com/ample/icms/service/ImageUploadService.java
Normal file
@ -0,0 +1,147 @@
|
||||
package com.ample.icms.service;
|
||||
|
||||
import com.amarsoft.are.jbo.BizObject;
|
||||
import com.amarsoft.are.jbo.BizObjectManager;
|
||||
import com.amarsoft.are.jbo.JBOException;
|
||||
import com.amarsoft.are.jbo.JBOFactory;
|
||||
import com.amarsoft.are.util.StringFunction;
|
||||
import com.amarsoft.dict.als.manage.NameManager;
|
||||
import com.ample.icms.bean.image.ImagePage;
|
||||
import com.ample.icms.scan.ImageUpload;
|
||||
import com.ample.icms.util.GetInfoUtil;
|
||||
import com.ample.icms.util.PropertiesUtil;
|
||||
import com.tenwa.officetempalte.exportcallback.impl.ZipUtils;
|
||||
import jbo.app.tenwa.doc.LB_DOC_CONTRACT_LIST;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ImageUploadService {
|
||||
private String projectId;
|
||||
private String flowUnid;
|
||||
private String projectNo;
|
||||
private String flowNo;
|
||||
private final String FILE_SAVE_PATH_TEMP = PropertiesUtil.get("fileSavePathTemp");
|
||||
public List<BizObject> getFileBo() throws JBOException {
|
||||
BizObjectManager bom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME);
|
||||
List<BizObject> bos = bom.createQuery("sign_type='COMPLETE' and file_flag='yes' and project_id=:projectId and flow_unid=:flowUnid")
|
||||
.setParameter("projectId",projectId).setParameter("flowUnid",flowUnid).getResultList(false);
|
||||
return bos;
|
||||
}
|
||||
public List<File> getFile(List<BizObject> bos) throws Exception {
|
||||
List<File> files = new ArrayList<>();
|
||||
for(BizObject bo : bos){
|
||||
String fileName = bo.getAttribute("filename").toString();
|
||||
String filePath = bo.getAttribute("fullpath").toString();
|
||||
|
||||
File srcFile = new File(filePath);
|
||||
File destFile = new File(FILE_SAVE_PATH_TEMP+"/"+fileName);
|
||||
if(!destFile.getParentFile().exists()){
|
||||
destFile.getParentFile().mkdirs();
|
||||
}
|
||||
FileUtils.copyFile(srcFile, destFile, true);
|
||||
files.add(destFile);
|
||||
}
|
||||
return files;
|
||||
}
|
||||
public List<ImagePage> getPages(List<BizObject> bos) throws Exception {
|
||||
List<ImagePage> pages = new ArrayList<>();
|
||||
for(BizObject bo : bos){
|
||||
String fileName = bo.getAttribute("filename").toString();
|
||||
String inputUserId = bo.getAttribute("inputuserid").toString();
|
||||
String inputOrgId = bo.getAttribute("inputorgid").toString();
|
||||
|
||||
ImagePage page = new ImagePage();
|
||||
page.setFileName(fileName);
|
||||
page.setUpUser(inputUserId);
|
||||
page.setUpUserName(NameManager.getUserName(inputUserId));
|
||||
page.setUpOrg(inputOrgId);
|
||||
page.setUpOrgName(NameManager.getOrgName(inputOrgId));
|
||||
page.setUpTime(StringFunction.getTodayNow());
|
||||
pages.add(page);
|
||||
}
|
||||
return pages;
|
||||
}
|
||||
public String[] getAppInfo() throws Exception {
|
||||
GetInfoUtil gif = new GetInfoUtil();
|
||||
String appInfo = gif.getAppInfoByProjectNo(projectNo,flowNo);
|
||||
String[] app = appInfo.split("@");
|
||||
return app;
|
||||
}
|
||||
public String upload() throws Exception {
|
||||
/**
|
||||
* 1.找出需要上传的影像
|
||||
* 2.在指定路径添加对应xml文件
|
||||
* 3.打包上传
|
||||
* 4.删除复制文件和打包文件
|
||||
*/
|
||||
|
||||
List<BizObject> boList = this.getFileBo();
|
||||
List<File> files = this.getFile(boList);
|
||||
List<ImagePage> pageList = this.getPages(boList);
|
||||
|
||||
ImageUpload imageUp = new ImageUpload();
|
||||
String[] appInfo = this.getAppInfo();
|
||||
imageUp.setAppCode(appInfo[0]);
|
||||
imageUp.setAppName(appInfo[1]);
|
||||
imageUp.setBusiNo(projectNo);
|
||||
imageUp.setPageList(pageList);
|
||||
String xmlUrl = imageUp.createXMl();
|
||||
|
||||
files.add(new File(xmlUrl));
|
||||
String zipUrl = FILE_SAVE_PATH_TEMP+"/"+flowUnid+".zip";
|
||||
FileOutputStream fos = new FileOutputStream(new File(zipUrl));
|
||||
ZipUtils zdo = new ZipUtils();
|
||||
zdo.toZip(files,fos);
|
||||
String result = imageUp.doUpload(zipUrl);
|
||||
String returnCode = result.substring(0,result.indexOf("@"));
|
||||
String returnMsg = result.substring(result.indexOf("@")+1,result.length());
|
||||
// deleteTemp();
|
||||
return returnMsg;
|
||||
}
|
||||
/**
|
||||
* 上传成功后再删除
|
||||
*/
|
||||
public void deleteTemp(){
|
||||
File f = new File(FILE_SAVE_PATH_TEMP);
|
||||
if(f.length()!=0){
|
||||
ZipUtils zdo = new ZipUtils();
|
||||
zdo.deleteFile(f,false);
|
||||
}
|
||||
}
|
||||
|
||||
public String getProjectId() {
|
||||
return projectId;
|
||||
}
|
||||
|
||||
public void setProjectId(String projectId) {
|
||||
this.projectId = projectId;
|
||||
}
|
||||
|
||||
public String getFlowUnid() {
|
||||
return flowUnid;
|
||||
}
|
||||
|
||||
public void setFlowUnid(String flowUnid) {
|
||||
this.flowUnid = flowUnid;
|
||||
}
|
||||
|
||||
public String getProjectNo() {
|
||||
return projectNo;
|
||||
}
|
||||
|
||||
public void setProjectNo(String projectNo) {
|
||||
this.projectNo = projectNo;
|
||||
}
|
||||
|
||||
public String getFlowNo() {
|
||||
return flowNo;
|
||||
}
|
||||
|
||||
public void setFlowNo(String flowNo) {
|
||||
this.flowNo = flowNo;
|
||||
}
|
||||
}
|
||||
@ -34,9 +34,9 @@ public class IcmsDocListCheck extends AlarmBiz {
|
||||
ic.setAppCode(appCode);
|
||||
ic.setAppName(appName);
|
||||
ic.setBusiNo(projectNo);
|
||||
String result = ic.getResult();
|
||||
String result =ic.resultAnalysis(ic.getResult());
|
||||
String[] resultInfo = result.split("@");
|
||||
if("200".equals(resultInfo[0])){
|
||||
if("true".equals(resultInfo[0])){
|
||||
setPass(true);
|
||||
}else{
|
||||
setPass(false);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user