From 8ef28c5c3ce86d2d9c0df8d6485dbf5b21ede1e0 Mon Sep 17 00:00:00 2001 From: ap007 Date: Tue, 5 Jul 2022 18:16:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=89=AB=E6=8F=8F=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E5=92=8C=E7=AC=AC=E4=B8=89=E6=96=B9=E4=B8=8A=E4=BC=A0?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LBnotAllMailHndHandoverTempList.jsp | 22 +-- .../Lessee/Person/CustomerCompanyTempInfo.jsp | 8 + .../Comm/LBContract/LBContractPrintList.jsp | 7 +- .../LBContractPersonBaseInfo.jsp | 5 +- .../MortgageFile/LbContactInfo.jsp | 54 +++--- .../BusinessProjectTempInfo.jsp | 6 +- .../BusinessApplication/CustomerInfo.jsp | 10 +- src/com/ample/icms/bean/image/ImageBatch.java | 23 +++ src/com/ample/icms/bean/image/ImageNode.java | 3 +- src/com/ample/icms/bean/image/ImagePages.java | 3 +- src/com/ample/icms/check/ImageCheck.java | 24 ++- src/com/ample/icms/init/IcmsRelationInit.java | 5 +- src/com/ample/icms/query/ImageQuery.java | 23 +-- src/com/ample/icms/scan/ImageUpload.java | 160 +++--------------- .../ample/icms/service/ImageQueryService.java | 120 +++++++++++++ src/com/ample/icms/service/ImageService.java | 18 ++ .../icms/service/ImageUploadService.java | 147 ++++++++++++++++ .../project/commcheck/IcmsDocListCheck.java | 4 +- 18 files changed, 423 insertions(+), 219 deletions(-) create mode 100644 src/com/ample/icms/service/ImageQueryService.java create mode 100644 src/com/ample/icms/service/ImageUploadService.java diff --git a/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverTempList.jsp b/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverTempList.jsp index 1a0c50513..575487c85 100644 --- a/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverTempList.jsp +++ b/WebContent/Tenwa/Apzl/FileUpload/LBnotAllMailHndHandoverTempList.jsp @@ -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(); - } <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp b/WebContent/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp index 7381c2037..c96470b7f 100644 --- a/WebContent/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp +++ b/WebContent/Tenwa/Customer/Lessee/Person/CustomerCompanyTempInfo.jsp @@ -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; + } <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp index e5d249bac..495d24eb8 100644 --- a/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp +++ b/WebContent/Tenwa/Lease/Flow/Comm/LBContract/LBContractPrintList.jsp @@ -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 @@ <%@ include file="/Frame/resources/include/include_end.jspf"%> \ No newline at end of file diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp index 46020e1d6..27dcf44e3 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/BusinessProjectTempInfo.jsp @@ -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; } diff --git a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp index 8f431cd14..de5888cc2 100644 --- a/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp +++ b/WebContent/Tenwa/Lease/Flow/Project/BusinessApplication/CustomerInfo.jsp @@ -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; + } <%@ include file="/Frame/resources/include/include_end.jspf"%> diff --git a/src/com/ample/icms/bean/image/ImageBatch.java b/src/com/ample/icms/bean/image/ImageBatch.java index f1413cf06..c56bfd85e 100644 --- a/src/com/ample/icms/bean/image/ImageBatch.java +++ b/src/com/ample/icms/bean/image/ImageBatch.java @@ -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; + } } diff --git a/src/com/ample/icms/bean/image/ImageNode.java b/src/com/ample/icms/bean/image/ImageNode.java index 1843942dd..4c149c964 100644 --- a/src/com/ample/icms/bean/image/ImageNode.java +++ b/src/com/ample/icms/bean/image/ImageNode.java @@ -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 page; public String getId() { diff --git a/src/com/ample/icms/bean/image/ImagePages.java b/src/com/ample/icms/bean/image/ImagePages.java index b75e1c789..337480d4c 100644 --- a/src/com/ample/icms/bean/image/ImagePages.java +++ b/src/com/ample/icms/bean/image/ImagePages.java @@ -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 nodes; public List getNodes() { diff --git a/src/com/ample/icms/check/ImageCheck.java b/src/com/ample/icms/check/ImageCheck.java index afa7a6405..9fa850a6a 100644 --- a/src/com/ample/icms/check/ImageCheck.java +++ b/src/com/ample/icms/check/ImageCheck.java @@ -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; } } diff --git a/src/com/ample/icms/init/IcmsRelationInit.java b/src/com/ample/icms/init/IcmsRelationInit.java index db3f8e840..93249e668 100644 --- a/src/com/ample/icms/init/IcmsRelationInit.java +++ b/src/com/ample/icms/init/IcmsRelationInit.java @@ -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"; diff --git a/src/com/ample/icms/query/ImageQuery.java b/src/com/ample/icms/query/ImageQuery.java index afc816c18..de4079208 100644 --- a/src/com/ample/icms/query/ImageQuery.java +++ b/src/com/ample/icms/query/ImageQuery.java @@ -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() { diff --git a/src/com/ample/icms/scan/ImageUpload.java b/src/com/ample/icms/scan/ImageUpload.java index 67c3fd1b6..2a730ef9c 100644 --- a/src/com/ample/icms/scan/ImageUpload.java +++ b/src/com/ample/icms/scan/ImageUpload.java @@ -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 files; + private List pageList; private static final String FileSavePath = PropertiesUtil.get("fileSavePathTemp"); - public List addNodes() throws Exception { - files = new ArrayList<>(); - List pages = new ArrayList<>(); - BizObjectManager bom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME); - List 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 addNodes(List pages) throws Exception { ImageNode node = new ImageNode(); //融资租赁合同套系 - node.setId("APZLJJ000080"); + node.setId("APZLJJ000400"); node.setAction("ADD"); node.setPage(pages); List 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 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 getPageList() { + return pageList; } - public void setProjectId(String projectId) { - this.projectId = projectId; + public void setPageList(List 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(); - } - - } } diff --git a/src/com/ample/icms/service/ImageQueryService.java b/src/com/ample/icms/service/ImageQueryService.java new file mode 100644 index 000000000..6c5482d51 --- /dev/null +++ b/src/com/ample/icms/service/ImageQueryService.java @@ -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; + } +} diff --git a/src/com/ample/icms/service/ImageService.java b/src/com/ample/icms/service/ImageService.java index be3b0a676..229a11267 100644 --- a/src/com/ample/icms/service/ImageService.java +++ b/src/com/ample/icms/service/ImageService.java @@ -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; + } } diff --git a/src/com/ample/icms/service/ImageUploadService.java b/src/com/ample/icms/service/ImageUploadService.java new file mode 100644 index 000000000..fc36f80cf --- /dev/null +++ b/src/com/ample/icms/service/ImageUploadService.java @@ -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 getFileBo() throws JBOException { + BizObjectManager bom = JBOFactory.getBizObjectManager(LB_DOC_CONTRACT_LIST.CLASS_NAME); + List 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 getFile(List bos) throws Exception { + List 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 getPages(List bos) throws Exception { + List 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 boList = this.getFileBo(); + List files = this.getFile(boList); + List 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; + } +} diff --git a/src_tenwa/com/tenwa/lease/flow/project/commcheck/IcmsDocListCheck.java b/src_tenwa/com/tenwa/lease/flow/project/commcheck/IcmsDocListCheck.java index b43ef1e48..408626f99 100644 --- a/src_tenwa/com/tenwa/lease/flow/project/commcheck/IcmsDocListCheck.java +++ b/src_tenwa/com/tenwa/lease/flow/project/commcheck/IcmsDocListCheck.java @@ -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);