影像平台对接(草稿版)

This commit is contained in:
zhanglei@ap-leasing.com.cn 2022-03-18 16:06:42 +08:00
parent 8a75ee1695
commit fd6a8550df
20 changed files with 523 additions and 64 deletions

View File

@ -58,7 +58,8 @@
dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid"));
dwTemp.replaceColumn("customer_info", "<iframe type='iframe' id='frame_list' name=\"frame_list\" width=\"100%\" height=\"500px\" frameborder=\"0\" src=\""+sWebRootPath+userll+compClientID+"&sPhaseNo="+sPhaseNo+"\"></iframe>", CurPage.getObjectWindowOutput());
String sButtons[][] = {
{"ReadOnly".equals(rightType)?"false":"true","","Button","±£´æ","±£´æ","save()","","","","btn_icon_saveNew",""}
{"ReadOnly".equals(rightType)?"false":"true","","Button","괏닸","괏닸","save()","","","","btn_icon_saveNew",""},
{"ReadOnly".equals(rightType)?"false":"true","","Button","栗죕헌데","栗죕헌데","openFileList()","","","","btn_icon_saveNew",""}
};
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
@ -174,15 +175,22 @@
function openFileList(){
let url = getRequestUrl();
let param = getRequestParam();
post(url,param);
let params = getRequestParam();
post(url,params);
}
function getRequestUrl(){
let url = RunJavaMethod("","","");
let url = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestUrl","");
return url;
}
function getRequestParam(){
let param = RunJavaMethod("","","");
let appCode = 'BQCW-000010';
let appName = '撚蛟<E6929A>헝';
let code = 'ECM0002';
if(("<%=sPhaseNo%>"=="0010") && ("<%=FlowNo%>"=="BusinessApplyFlow" || "<%=FlowNo%>" == "BusinessChangeFlow")){
code = 'ECM0001';
}
let busiNo = '<%=sFlowUnid%>';
let param = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestParam","appCode="+appCode+",appName="+appName+",code="+code+",busiNo="+busiNo);
return param;
}
/**
@ -190,18 +198,18 @@
* @param URL
* @param PARAMS
*/
function post(URL, 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";
for (let param in PARAMS) {
let opt = document.createElement("textarea");
opt.name = param;
opt.value = PARAMS[param];
opt.name = 'data';
opt.value = param;
temp_form.appendChild(opt);
}
document.body.appendChild(temp_form);
temp_form.submit();
}

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,7 @@
url=http://39.106.190.65:8080/SunECM/servlet/RouterServlet
url=http://192.168.7.71:8081/SunICMS/servlet/RouterServlet
#链接有效时间,单位为秒
useful_life=10
useful_life=360
#业务系统授权密钥
secret_key=
secret_id=anpeng
secret_key=IU2VHdejDpUFzhoeT7tUSII3

View File

@ -1,4 +1,4 @@
package com.ample.icms.query;
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;

View File

@ -1,4 +1,4 @@
package com.ample.icms.query;
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@ -13,12 +13,34 @@ public class ImageBaseData {
//机构代码
@XStreamAlias("ORG_CODE")
private String orgCode;
//缓存机构代码
@XStreamAlias("COM_CODE")
private String comCode;
//机构名称
@XStreamAlias("ORG_NAME")
private String orgName;
//操作员角色
@XStreamAlias("ROLE_CODE")
private String roleCode;
//操作员角色
@XStreamAlias("ONE_BATCH")
private String oneBatch;
//操作员角色
@XStreamAlias("NEW_BATCH")
private String newBatch;
@XStreamAlias("BIZ_INFO")
private ImageBizInfo bizInfo ;
public ImageBizInfo getBizInfo() {
return bizInfo;
}
public void setBizInfo(ImageBizInfo bizInfo) {
this.bizInfo = bizInfo;
}
public String getUserCode() {
return userCode;
@ -59,4 +81,29 @@ public class ImageBaseData {
public void setRoleCode(String roleCode) {
this.roleCode = roleCode;
}
public String getComCode() {
return comCode;
}
public void setComCode(String comCode) {
this.comCode = comCode;
}
public String getOneBatch() {
return oneBatch;
}
public void setOneBatch(String oneBatch) {
this.oneBatch = oneBatch;
}
public String getNewBatch() {
return newBatch;
}
public void setNewBatch(String newBatch) {
this.newBatch = newBatch;
}
}

View File

@ -1,4 +1,4 @@
package com.ample.icms.query;
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@ -14,8 +14,8 @@ public class ImageBatch {
private String appName ;
//业务主索引
@XStreamAlias("CASENO")
private String caseNo ;
@XStreamAlias("BUSI_NO")
private String busiNo ;
//业务扩展索引(非必填)
@XStreamAlias("CARNO")
@ -29,13 +29,6 @@ public class ImageBatch {
@XStreamAlias("END_TIME")
private String endTime;
//
@XStreamAlias("VTREE")
private ImageTree vTree;
public ImageBatch(ImageTree vTree) {
this.vTree = vTree;
}
public String getAppCode() {
return appCode;
@ -53,12 +46,12 @@ public class ImageBatch {
this.appName = appName;
}
public String getCaseNo() {
return caseNo;
public String getBusiNo() {
return busiNo;
}
public void setCaseNo(String caseNo) {
this.caseNo = caseNo;
public void setBusiNo(String busiNo) {
this.busiNo = busiNo;
}
public String getCarNo() {

View File

@ -0,0 +1,14 @@
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("BIZ_INFO")
public class ImageBizInfo {
@XStreamAlias("BIZ_TYPE")
ImageBizType bizType;
public ImageBizInfo(ImageBizType bizType){
this.bizType=bizType;
}
}

View File

@ -0,0 +1,22 @@
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
@XStreamAlias("BIZ_TYPE")
public class ImageBizType {
@XStreamAlias("APP_CODE")
@XStreamAsAttribute
private String appCode;
@XStreamAlias("APP_NAME")
@XStreamAsAttribute
private String appName;
public ImageBizType(String appCode, String appName) {
this.appCode = appCode;
this.appName = appName;
}
}

View File

@ -0,0 +1,12 @@
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import java.util.List;
@XStreamAlias("META_DATA")
public class ImageMetaData {
@XStreamImplicit
public List<ImageBatch> imageBatchs ;
}

View File

@ -1,10 +1,12 @@
package com.ample.icms.query;
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
@XStreamAlias("root")
public class ImageRoot {
@XStreamAlias("BASE_DATA")
private ImageBaseData imageBaseData;
@XStreamAlias("META_DATA")
private ImageMetaData imageMetaData;
public ImageRoot(ImageBaseData imageBaseData, ImageMetaData imageMetaData) {

View File

@ -1,9 +1,10 @@
package com.ample.icms.query;
package com.ample.icms.bean;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import java.util.List;
@XStreamAlias("VTREE")
public class ImageTree {

View File

@ -0,0 +1,16 @@
package com.ample.icms.check;
import com.ample.icms.service.ImageService;
public class ImageCheck extends ImageService {
public void getResult(){
String result = doPost();
if(result.contains("200")){
//true
}else if(result.contains("-1")){
//error
}else{
//false
}
}
}

View File

@ -1,10 +0,0 @@
package com.ample.icms.query;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import java.util.List;
@XStreamAlias("META_DATA")
public class ImageMetaData {
public List<ImageBatch> imageBatchs;
}

View File

@ -1,5 +1,7 @@
package com.ample.icms.query;
public class ImageQuery {
import com.ample.icms.service.ImageService;
public class ImageQuery extends ImageService {
}

View File

@ -0,0 +1,27 @@
package com.ample.icms.scan;
import com.ample.icms.bean.ImageBaseData;
import com.ample.icms.service.ImageService;
public class ImageScan extends ImageService {
private String oneBatch;
@Override
public void addBaseData(){
base = new ImageBaseData();
base.setUserCode("admin");
base.setUserName("admin");
base.setOrgCode("0005");
base.setComCode("0005");
base.setOrgName("安鹏国际融资租赁(深圳)有限公司");
base.setRoleCode("admin");
base.setOneBatch(oneBatch);
}
public String getOneBatch() {
return oneBatch;
}
public void setOneBatch(String oneBatch) {
this.oneBatch = oneBatch;
}
}

View File

@ -0,0 +1,20 @@
package com.ample.icms.scan;
import com.sunyard.insurance.ecm.socket.client.AutoScanApi;
public class ImageUpload {
public void doUpload(){
String zipPath = "C:/Users/ivanl/Desktop/影像系统/ECM4.0Demo/ECM4.0Demo/第三方上传/1111.zip";
try {
// " sunyard#licenseKey" sunyard为接入系统IDlicenseKey为接入系统授权密钥
AutoScanApi autoScanApi = new AutoScanApi("192.168.7.71",8081,"anpeng#IU2VHdejDpUFzhoeT7tUSII3");
// // "10I" : 业务类型
// // zipPath 要上传批次文件的zip包的路径
// // returnMsg 第三方上传的返回状态
String returnMsg = autoScanApi.ScanImageFile("FBO2022031100000001", zipPath);
System.out.println(returnMsg);
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,163 @@
package com.ample.icms.service;
import com.ample.icms.bean.ImageBaseData;
import com.ample.icms.bean.ImageBatch;
import com.ample.icms.bean.ImageMetaData;
import com.ample.icms.bean.ImageRoot;
import com.ample.icms.util.PropertiesUtil;
import com.sunyard.insurance.encode.client.EncodeAccessParam;
import com.thoughtworks.xstream.XStream;
import org.apache.log4j.Logger;
import java.io.IOException;
import java.util.ArrayList;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.methods.PostMethod;
public class ImageService {
public Logger logger = Logger.getLogger(this.getClass());
protected String appCode;
protected String appName;
protected String code;
protected String busiNo;
protected ImageBaseData base;
protected ImageBatch batch;
protected ImageMetaData metaData;
public void addBaseData(){
base = new ImageBaseData();
base.setUserCode("admin");
base.setUserName("admin");
base.setOrgCode("0005");
base.setComCode("0005");
base.setOrgName("安鹏国际融资租赁(深圳)有限公司");
base.setRoleCode("admin");
}
public void addBatch(){
batch = new ImageBatch();
batch.setAppCode(this.appCode);
batch.setAppName(this.appName);
batch.setBusiNo(this.busiNo);
}
public void addMetaData(){
metaData = new ImageMetaData();
metaData.imageBatchs = new ArrayList<>();
metaData.imageBatchs.add(batch);
}
public ImageRoot createData(){
addBaseData();
addBatch();
addMetaData();
ImageRoot root = new ImageRoot(base,metaData);
return root;
}
public String getRequestXML(){
XStream xs = new XStream();
xs.processAnnotations(ImageRoot.class);
String xml = xs.toXML(createData());
xml = xml.replace("__","_");
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + xml;
logger.info("\n"+xml+"\n");
return xml;
}
public String transformXMLtoParam(String code ,String xml) throws Exception {
int time = Integer.parseInt(PropertiesUtil.get("useful_life"));
String secretKey = PropertiesUtil.get("secret_key");
String param = EncodeAccessParam.getEncodeParam("format=xml&code="+code+"&xml="+xml, time, secretKey);
return param;
}
public String doPost(){
String result="0000";
PostMethod postMethod = null;
HttpClient httpClient = null;
try {
postMethod = new PostMethod(PropertiesUtil.get("secret_key"));
// 设置格式
postMethod.getParams().setContentCharset("UTF-8");
postMethod.setParameter("data", getRequestParam());
// ICMS影像系统通过referer来验证白名单所以必须将ip填写在这里
//todo
postMethod.setRequestHeader("Referer", "http://172.16.20.212/imaging");
httpClient = new HttpClient();
// 执行postMethod
int statusCode = httpClient.executeMethod(postMethod);
System.out.println("结果状态:"+statusCode);
if (statusCode == HttpStatus.SC_OK) {
byte[] bodydata = postMethod.getResponseBody();
//取得返回值
result = new String(bodydata, "UTF-8");
System.out.println("影像系统返回结果:" + result);
}
}catch (HttpException e) {
//协议发生异常URL不合法请检查URL
e.printStackTrace();
} catch (IOException e) {
//请检查网络是否通畅检查网线是否插好
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}finally {
if (postMethod != null) {
try {
postMethod.releaseConnection();
} catch (Exception e) {
e.printStackTrace();
}
}
if (httpClient != null) {
try {
((SimpleHttpConnectionManager) httpClient.getHttpConnectionManager()).shutdown();
} catch (Exception e) {
e.printStackTrace();
}
httpClient = null;
}
}
return result;
}
public String getRequestUrl(){
return PropertiesUtil.get("url");
}
public String getRequestParam() throws Exception {
return transformXMLtoParam(this.code,this.getRequestXML());
}
public String getAppCode() {
return appCode;
}
public void setAppCode(String appCode) {
this.appCode = appCode;
}
public String getAppName() {
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getBusiNo() {
return busiNo;
}
public void setBusiNo(String busiNo) {
this.busiNo = busiNo;
}
}

View File

@ -0,0 +1,38 @@
package com.ample.icms.util;
import com.amarsoft.are.ARE;
import java.io.IOException;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
public class PropertiesUtil {
private static Map<String, String> attributes;
public static void load() {
attributes = new ConcurrentHashMap<String, String>();
Properties prop = new Properties();
try {
prop.load(PropertiesUtil.class.getResourceAsStream("/icms.properties"));
for(Map.Entry<Object, Object> entry : prop.entrySet()) {
if(entry.getKey() == null || entry.getValue() == null) {
continue;
}
attributes.put(entry.getKey().toString(), entry.getValue().toString());
}
} catch (IOException e) {
e.printStackTrace();
}
}
public static void destroy() {
if(attributes != null) attributes.clear();
}
public static String get(String propName) {
if(attributes == null) load();
return attributes.get(propName);
}
}

View File

@ -1,31 +1,133 @@
package com.tenwa.util;
import com.tenwa.flow.treeview.action.BaseInitTreeView;
import com.ample.icms.query.*;
import com.sunyard.insurance.ecm.socket.client.AutoScanApi;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.SimpleHttpConnectionManager;
import org.apache.commons.httpclient.methods.PostMethod;
import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import jbo.app.tenwa.doc.LB_DOCATTRIBUTE;
import jbo.app.tenwa.doc.LB_DOCRELATIVE;
import java.io.File;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
public class test {
public static void main(String[] args){
String zipPath = "C:/Users/ivanl/Desktop/11111.zip";
try {
// " sunyard#licenseKey" sunyard为接入系统IDlicenseKey为接入系统授权密钥
AutoScanApi autoScanApi = new AutoScanApi("192.168.7.71",8088,"anpeng#IU2VHdejDpUFzhoeT7tUSII3");
// // "10I" : 业务类型
// // zipPath 要上传批次文件的zip包的路径
// // returnMsg 第三方上传的返回状态
String returnMsg = autoScanApi.ScanImageFile("BQCW-000010", zipPath);
System.out.println(returnMsg);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void main1(String[] args) {
ImageQuery query = new ImageQuery();
query.setAppCode("BQCW-000010");
query.setAppName("业务申请");
query.setBusiNo("FBO2022031100000001");
query.setCode("ECM0013");
public static void main(String[] args) {
String sql = "select se.seriesid,se.seriesname from ("
+ "SELECT seriesid,max(seriesname) seriesname,max(brandid) brandid FROM vi_car_data where 1=1 group by seriesid"
+ ") se WHERE se.seriesname IS NOT NULL AND se.brandid='#brandid' ORDER BY se.seriesname DESC";
System.out.println(sql.substring(sql.toUpperCase().lastIndexOf("WHERE"), sql.length()));
System.out.println(sql.substring(0, sql.toLowerCase().lastIndexOf("where")));
sql = "SELECT DISTINCT O.ID, O.DOC_NAME,r.id " + "FROM O, "
+ LB_DOCRELATIVE.CLASS_NAME + " R "
+ "WHERE O.RELATIVE_ID = R.ID "
+ "AND O.ID NOT IN (SELECT A.LIBRARY_ID FROM "
+ LB_DOCATTRIBUTE.CLASS_NAME + " A) "
+ "AND R.ObjectType='BusinessApplyFlow' and R.proj_id=:projid " + "AND o.DOC_NATURE='01' "
+ "ORDER BY SERIAL_NUM";
System.out.println(sql);
String result="";
PostMethod postMethod = null;
HttpClient httpClient = null;
try {
String param =query.getRequestParam();
System.out.println("加密后数据:"+param);
postMethod = new PostMethod("http://192.168.7.71:8081/SunICMS/servlet/RouterServlet");
// 设置格式
postMethod.getParams().setContentCharset("UTF-8");
postMethod.setParameter("data", param);
postMethod.setRequestHeader("Referer", "http://172.16.20.212/imaging");
httpClient = new HttpClient();
// 执行postMethod
int statusCode = httpClient.executeMethod(postMethod);
System.out.println("结果状态:"+statusCode);
if (statusCode == HttpStatus.SC_OK) {
byte[] bodydata = postMethod.getResponseBody();
//取得返回值
result = new String(bodydata, "UTF-8");
System.out.println("结果" + result);
} else {
}
}catch (HttpException e) {
//协议发生异常URL不合法请检查URL
e.printStackTrace();
} catch (IOException e) {
//请检查网络是否通畅检查网线是否插好
e.printStackTrace();
} catch(Exception e){
e.printStackTrace();
}finally {
if (postMethod != null) {
try {
postMethod.releaseConnection();
} catch (Exception e) {
e.printStackTrace();
}
}
if (httpClient != null) {
try {
((SimpleHttpConnectionManager) httpClient.getHttpConnectionManager()).shutdown();
} catch (Exception e) {
e.printStackTrace();
}
httpClient = null;
}
}
}
// private static ArrayList<Book> bookList = new ArrayList<Book>();
public static void dom4j() {
// 解析books.xml文件
// 创建SAXReader的对象reader
SAXReader reader = new SAXReader();
try {
// 通过reader对象的read方法加载books.xml文件,获取docuemnt对象
Document document = reader.read(new File("src/res/books.xml"));
// 通过document对象获取根节点bookstore
Element bookStore = document.getRootElement();
// 通过element对象的elementIterator方法获取迭代器
Iterator it = bookStore.elementIterator();
// 遍历迭代器获取根节点中的信息书籍
while (it.hasNext()) {
System.out.println("=====开始遍历某一本书=====");
Element book = (Element) it.next();
// 获取book的属性名以及 属性值
List<Attribute> bookAttrs = book.attributes();
for (Attribute attr : bookAttrs) {
System.out.println("属性名:" + attr.getName() + "--属性值:"
+ attr.getValue());
}
Iterator itt = book.elementIterator();
while (itt.hasNext()) {
Element bookChild = (Element) itt.next();
System.out.println("节点名:" + bookChild.getName() + "--节点值:" + bookChild.getStringValue());
}
System.out.println("=====结束遍历某一本书=====");
}
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}