Merge branch 'ap007' into dailyfix

This commit is contained in:
ap007 2023-01-30 16:46:21 +08:00
commit 893ddfebe7
15 changed files with 838 additions and 21 deletions

View File

@ -0,0 +1,64 @@
<%@ page contentType="text/html; charset=GBK"%><%@
include file="/IncludeBegin.jsp"%><%
/*
Author: undefined 2017-10-24
Content:
History Log:
*/
%>
<%
String FlowNo=CurPage.getParameter("FlowNo");
String FlowUnid=CurPage.getParameter("ObjectNo");
String sPhaseNo = CurPage.getParameter("PhaseNo");
String userId= CurUser.getUserID();
String userName = CurUser.getUserName();
%>
<script type="text/javascript">
function openFileList(){
debugger;
let appInfo = getAppInfo();
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;
}
openAppointFileList(appCode,appName);
}
function openAppointFileList(appCode,appName){
let url = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestUrl","");
let code = getCode();
let params = getRequestParam(appCode,appName,code);
if(params!=null){
AsControl.postICMS(url,params);
}
}
function getAppInfo(){
let appInfo = RunJavaMethod("com.ample.icms.util.GetInfoUtil", "getAppInfoByFlowNoRJM", "flowNo=<%=FlowNo%>");
return appInfo;
}
function getCode(){
let code = 'ECM0002';
if("<%=sPhaseNo%>"=="0010"){
code = 'ECM0001';
}
return code;
}
function getRequestParam(appCode,appName,code){
let busiNo = "<%=FlowUnid%>";
let param = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestParam","appCode="+appCode+",appName="+appName+",code="+code+",busiNo="+busiNo+",userCode=<%=userId%>"+",userName=<%=userName%>");
return param;
}
$(function(){
openFileList();
});
</script>
<%@ include file="/IncludeEnd.jsp"%>

View File

@ -55,11 +55,11 @@
let sResult = RunJavaMethodTrans("com.ample.icms.service.ImageOcrService","invoiceOrcOfInvoice","contractId=<%=ContractId%>,flowNo=FundPaymentCarFlow");
if(sResult!=null&&sResult.error_code==0&&sResult.result.发票号码!=''){
const resultList = sResult.result;
let Invoice_code = resultList.发票码;
let Invoice_number = resultList.发票码;
let Invoice_code = resultList.发票码;
let Invoice_number = resultList.发票码;
let Invoice_date = resultList.开票日期;
Invoice_date = Invoice_date.substr(0,4)+'/'+Invoice_date.substr(4,2)+'/'+Invoice_date.substr(6,2);
let Invoice_money = resultList.不含税价小写;
let Invoice_money = resultList.价税合计小写;
let tax_due = resultList.增值税税额;
let tax_rate = resultList.增值税税率或征收税率;
setItemValue(0,0,"Invoice_code", Invoice_code);

View File

@ -30,7 +30,10 @@
String sFlowUnid = CurPage.getParameter("FlowUnid");//流程编号
String IsShowFormal = CurPage.getParameter("IsShowFormal");//流程编号
String projectNo=CurPage.getParameter("ProjectNo");//淃커긍뵀
String isHistory=CurPage.getParameter("IsHistory");
String userId= CurUser.getUserID();
String userName = CurUser.getUserName();
BizObject flow=GetFlowAction.getFlowBussinessObject(sFlowUnid);
String product_id="";
if("true".equals(IsShowFormal)){
@ -137,7 +140,8 @@
// 原版的
sButtons= new String[][]{
{"true",isAll,"Button","保存","保存所有修改","saveRecord()","","","",""}
{"true",isAll,"Button","괏닸","괏닸杰唐錦맣","saveRecord()","","","",""},
{"true","","Button","栗죕헌데","栗죕헌데","openFileList()","","","","btn_icon_saveNew",""},
};
@ -305,6 +309,39 @@
setItemValue(0,0,"subjectname",sReturn[1]);
},"请选择客户",'');
}
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(("<%=FlowNo%>"=="RentRebackFlow"||"<%=FlowNo%>"=="FundRebackFlow")&&"<%=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 param = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestParam","appCode="+appCode+",appName="+appName+",code="+code+",busiNo="+busiNo+",userCode=<%=userId%>"+",userName=<%=userName%>");
return param;
}
</script>
<%/*~END~*/%>

View File

@ -45,7 +45,7 @@
{btnflag,"","Button","查询签约结果","查询签约结果","getStatus()","","","","btn_icon_obtain",""},
{btnflag,"","Button","重新发送短信","重新发送短信","sendMessageAgain()","","","","btn_icon_refresh",""},
{signs,"","Button","公司盖章","公司盖章","sign()","","","","btn_icon_refresh",""},
{"true","","Button","上传合同","暂时测试上传用按钮","uploadContract()","","","","btn_icon_refresh",""},
{"false","","Button","上传合同","暂时测试上传用按钮","uploadContract()","","","","btn_icon_refresh",""},
};
%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
<style>

View File

@ -5,8 +5,13 @@
Content: ʾÀýÏêÇéÒ³Ãæ
History Log:
*/
String userId= CurUser.getUserID();
String userName = CurUser.getUserName();
String ishistory = CurPage.getParameter("IsHistory");
String flowunid = CurPage.getParameter("FlowUnid");
String phaseNo = CurPage.getParameter("PhaseNo");
String projectNo=CurPage.getParameter("ProjectNo");
String FlowNo = CurPage.getParameter("FlowNo");
String productid = Sqlca.getString("select PRODUCT_ID from LB_CONTRACT_INFO_TEMP where flowunid = '"+flowunid+"'");
String sTempletNo = "LBContractInfoTemp";//--Ä£°åºÅ--
if("004".equals(productid)){
@ -22,9 +27,51 @@
dwTemp.genHTMLObjectWindow(CurPage.getParameter("FlowUnid"));
String sButtons[][] = {
{"true","","Button","×ÊÁÏÇåµ¥","×ÊÁÏÇåµ¥","openFileList()","","","","btn_icon_saveNew",""}
};
sButtonPosition = "south";
%><%@ include file="/Frame/resources/include/ui/include_info.jspf"%>
<script type="text/javascript">
function openFileList(){
let appInfo = getAppInfo();
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;
}
openAppointFileList(appCode,appName);
}
function openAppointFileList(appCode,appName){
let url = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestUrl","");
let code = getCode();
let params = getRequestParam(appCode,appName,code);
if(params!=null){
AsControl.postICMS(url,params);
}
}
function getAppInfo(){
let appInfo = RunJavaMethod("com.ample.icms.util.GetInfoUtil", "getAppInfoByFlowNoRJM", "flowNo=<%=FlowNo%>");
return appInfo;
}
function getCode(){
let code = 'ECM0002';
if("<%=phaseNo%>"=="0010"){
code = 'ECM0001';
}
return code;
}
function getRequestParam(appCode,appName,code){
let busiNo = '<%=projectNo%>';
if(busiNo==null||busiNo==""||busiNo=="null"){
busiNo = RunJavaMethod("com.ample.icms.util.GetInfoUtil", "getProjectNoByFlowUnidRJM", "flowUnid=<%=flowunid%>");
}
let param = RunJavaMethod("com.ample.icms.query.ImageQuery","getRequestParam","appCode="+appCode+",appName="+appName+",code="+code+",busiNo="+busiNo+",userCode=<%=userId%>"+",userName=<%=userName%>");
return param;
}
</script>
<%@ include file="/Frame/resources/include/include_end.jspf"%>

View File

@ -556,5 +556,100 @@
</managerProperties>
</manager>
</class>
<class name="INVOICE_ORC_RESULT" label="发票ocr识别结果" describe="发票ocr识别结果" keyAttributes="ID">
<attributes>
<attribute name="ID" label="唯一标识" type="STRING" length="32" />
<attribute name="CONTRACT_ID" label="合同ID" type="STRING" length="32"/>
<attribute name="PROJECT_NO" label="项目编号" type="STRING" length="32"/>
<attribute name="ERROR_CODE" label="错误码" type="STRING" length="32"/>
<attribute name="RESULT" label="结果全文" type="STRING" length="32"/>
<attribute name="DATEISSUED" label="开票日期" type="STRING" length="32"/>
<attribute name="INVOICE_CODE" label="发票代码" type="STRING" length="32"/>
<attribute name="INVOICE_NO" label="发票号码" type="STRING" length="32"/>
<attribute name="PRINT_CODE" label="机打代码" type="STRING" length="32"/>
<attribute name="PRINT_NO" label="机打号码" type="STRING" length="32"/>
<attribute name="MACHINE_CODE" label="机器编号" type="STRING" length="32"/>
<attribute name="FISCAL_CODE" label="税控码" type="STRING" length="32"/>
<attribute name="ID_ORG_CODE" label="购买方名称及身份证号码/组织机构代码" type="STRING" length="32"/>
<attribute name="TAX_ID" label="纳税人识别号" type="STRING" length="32"/>
<attribute name="CAR_TYPE" label="车辆类型" type="STRING" length="32"/>
<attribute name="CAR_MODEL" label="厂商型号" type="STRING" length="32"/>
<attribute name="MADE_IN" label="产地" type="STRING" length="32"/>
<attribute name="CERTIFICATE_NO" label="合格证号" type="STRING" length="32"/>
<attribute name="IMPORT_CERTIFICATE_NO" label="进口证明书号" type="STRING" length="32"/>
<attribute name="COMMODITY_CHECK_NO" label="商检单号" type="STRING" length="32"/>
<attribute name="ENGINE_NO" label="发动机号码" type="STRING" length="32"/>
<attribute name="VIN" label="车辆识别代码/车架号" type="STRING" length="32"/>
<attribute name="TOTAL_IN_WORDS" label="税价合计(大写)" type="STRING" length="32"/>
<attribute name="TOTAL_IN_NUMBERS" label="税价合计(小写)" type="STRING" length="32"/>
<attribute name="SELLER_NAME" label="销售方名称" type="STRING" length="32"/>
<attribute name="SELLER_TEL" label="销货单位电话" type="STRING" length="32"/>
<attribute name="SELLER_TAX_ID" label="销货单位纳税人识别号" type="STRING" length="32"/>
<attribute name="SELLER_ACCOUNT" label="销货单位账号" type="STRING" length="32"/>
<attribute name="SELLER_ADDR" label="销货单位地址" type="STRING" length="32"/>
<attribute name="SELLER_ACCOUNT_NO" label="销货单位开户银行" type="STRING" length="32"/>
<attribute name="VAT_RATE" label="增值税税率或征收税率" type="STRING" length="32"/>
<attribute name="VAT_AMOUNT" label="增值税税额" type="STRING" length="32"/>
<attribute name="TAX_OFFICE_CODE" label="主管税务机关及代码" type="STRING" length="32"/>
<attribute name="EXCLUDING_TAX_AMOUNT" label="不含税价小写" type="STRING" length="32"/>
<attribute name="TAX_PAYMENT_NO" label="完税凭证号码" type="STRING" length="32"/>
<attribute name="TONNAGE" label="吨位" type="STRING" length="32"/>
<attribute name="PERSON_LIMITED" label="限乘人数" type="STRING" length="32"/>
<attribute name="OFFICIAL_SEAL" label="公章" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="创建时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="invoice_orc_result"/>
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="ID_CARD_OCR_RESULT" label="身份证ocr识别结果" describe="身份证ocr识别结果" keyAttributes="ID">
<attributes>
<attribute name="ID" label="唯一标识" type="STRING" length="32" />
<attribute name="CONTRACT_ID" label="合同ID" type="STRING" length="32"/>
<attribute name="PROJECT_NO" label="项目编号" type="STRING" length="32"/>
<attribute name="ERROR_CODE" label="错误码" type="STRING" length="32"/>
<attribute name="RESULT" label="结果全文" type="STRING" length="32"/>
<attribute name="FULL_NAME" label="姓名" type="STRING" length="32"/>
<attribute name="GENDER" label="性别" type="STRING" length="32"/>
<attribute name="ETHNICITY" label="民族" type="STRING" length="32"/>
<attribute name="BRITH" label="出生年月" type="STRING" length="32"/>
<attribute name="ADDR" label="住址" type="STRING" length="32"/>
<attribute name="ID_NO" label="公民身份号码" type="STRING" length="32"/>
<attribute name="HEAD" label="头像" type="STRING" length="32"/>
<attribute name="VERIFY" label="验证" type="STRING" length="32"/>
<attribute name="HEAD_COPY" label="人像面复印件" type="STRING" length="32"/>
<attribute name="ISSUED_OFFICE" label="签发机关" type="STRING" length="32"/>
<attribute name="TERM_VALIDITY" label="有限期限" type="STRING" length="32"/>
<attribute name="TYPE" label="类型" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="创建时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="id_card_ocr_result"/>
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
<class name="BANK_CARD_ORC_RESULT" label="银行卡ocr识别结果" describe="银行卡ocr识别结果" keyAttributes="ID">
<attributes>
<attribute name="ID" label="唯一标识" type="STRING" length="32" />
<attribute name="CONTRACT_ID" label="合同ID" type="STRING" length="32"/>
<attribute name="PROJECT_NO" label="项目编号" type="STRING" length="32"/>
<attribute name="ERROR_CODE" label="错误码" type="STRING" length="32"/>
<attribute name="RESULT" label="结果全文" type="STRING" length="32"/>
<attribute name="BANK_CARD_NO" label="银行卡号" type="STRING" length="32"/>
<attribute name="PASS_CHECK" label="银行卡号校验" type="STRING" length="32"/>
<attribute name="INPUTTIME" label="创建时间" type="STRING" length="32"/>
</attributes>
<manager>
<managerProperties>
<property name="table" value="bank_card_orc_result"/>
<property name="createKey" value="true" />
</managerProperties>
</manager>
</class>
</package>
</jbo>

View File

@ -4,6 +4,7 @@ import com.amarsoft.are.jbo.JBOException;
import com.amarsoft.are.jbo.JBOTransaction;
import com.ample.icms.query.ImageInfo;
import com.ample.icms.util.GetInfoUtil;
import com.ample.icms.util.PropertiesUtil;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
@ -51,17 +52,22 @@ public class ImageInfoService {
Element elm = (Element) it.next();
}*/
if(node==null){
throw new Exception("未找到对应的文件信息");
return null;
}
String pageId = node.element("LEAF").getTextTrim();
if("".equals(pageId)||pageId==null){
throw new Exception("未找到对应的图片信息");
return null;
}
Element page = (Element) root.selectSingleNode("//PAGE[@PAGEID='"+pageId+"']");
String pageUrl = page.attributeValue("PAGE_URL");
pageUrl ="http://172.28.1.59:5051/" + pageUrl.substring(33);
System.out.println("OCR文件路径"+pageUrl);
//生产环境没有直接链接外网需要通过前置机跳转返回的图片链接是外网地址所以需要替换
if(PropertiesUtil.get("page_switch_url").length()>0){
java.net.URL url = new java.net.URL(pageUrl);
String replaceStr = url.getProtocol()+"://"+url.getAuthority();
pageUrl = pageUrl.replace(replaceStr,PropertiesUtil.get("page_switch_url"));
}
System.out.println("文件路径:"+pageUrl);
return pageUrl;
}

View File

@ -17,7 +17,9 @@ public class ImageOcrService {
iis.setContractId(contractId);
iis.setFlowNo(flowNo);
String fileUrl = iis.getFileUrl(floder,tx);
if(fileUrl==null){
return "未找到对应的文件";
}
ImageOcr io = new ImageOcr();
String result = io.doPost(fileUrl, ocrType);

View File

@ -44,6 +44,9 @@ public class GetInfoUtil {
String productId = getProductIdByFlowUnid(flowUnid, Sqlca);
appInfo = this.getAppInfoByProductId(productId, flowNo, Sqlca);
}
if(appInfo==null||appInfo.contains("0000@")){
appInfo = this.getAppInfoByFlowNo(flowNo, Sqlca);
}
if (Sqlca != null) {
Sqlca.commit();
}
@ -228,7 +231,7 @@ public class GetInfoUtil {
String sql = "select PROJECT_NO from lb_project_info_temp where FLOWUNID='" + flowUnid + "'";
String projectNo = Sqlca.getString(new SqlObject(sql));
if (projectNo == null || "".equals(projectNo) || projectNo.length() == 0) {
sql = "select PROJECT_NO from lb_project_info where id=(select project_id from lb_contract_info_temp where FLOWUNID='" + flowUnid + "')";
sql = "select PROJECT_NO from lb_project_info where id=(select proj_id from flow_bussiness_object where flow_unid='" + flowUnid + "')";
projectNo = Sqlca.getString(new SqlObject(sql));
}
if (projectNo == null || "".equals(projectNo) || projectNo.length() == 0) {

View File

@ -1,12 +1,5 @@
package com.tenwa.flow.tabviewservice;
import java.util.List;
import jbo.sys.FLOW_MODEL;
import jbo.sys.FLOW_TASK;
import jbo.sys.OBJECTTYPE_CATALOG;
import jbo.sys.OBJECTTYPE_RELA;
import com.amarsoft.app.awe.config.InitDBType;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
@ -14,6 +7,12 @@ import com.amarsoft.are.jbo.BizObjectQuery;
import com.amarsoft.are.jbo.JBOFactory;
import com.amarsoft.are.util.StringFunction;
import com.amarsoft.awe.ui.widget.Button;
import jbo.sys.FLOW_MODEL;
import jbo.sys.FLOW_TASK;
import jbo.sys.OBJECTTYPE_CATALOG;
import jbo.sys.OBJECTTYPE_RELA;
import java.util.List;
public class FlowTaskViewTab {
private String flowNo; //Á÷³ÌÅäÖñàºÅ
@ -114,7 +113,12 @@ public class FlowTaskViewTab {
BizObjectManager bm = null;
BizObjectQuery bq = null;
bm = JBOFactory.getFactory().getManager(OBJECTTYPE_RELA.CLASS_NAME);
bq = bm.createQuery("O.OBJECTTYPE=:OBJECTTYPE and isinuse='Y' order by O.sortno ").setParameter("OBJECTTYPE", this.getObjectType());
String sql = "O.OBJECTTYPE=:OBJECTTYPE and isinuse='Y' order by O.sortno ";
//todo 再添加的话就把这个改为页面后台配置
if("OtherPayFlow".equals(getFlowNo())||"DealerDepositChargeFlow".equals(getFlowNo())||"DealerDepositReturnFlow".equals(getFlowNo())){
sql = "O.OBJECTTYPE=:OBJECTTYPE and (isinuse='Y' or ATTRIBUTE1='flow') order by O.sortno ";
}
bq = bm.createQuery(sql).setParameter("OBJECTTYPE", this.getObjectType());
this.viewTabItemList=bq.getResultList(true);

View File

@ -0,0 +1,48 @@
package jbo.oti;
import java.lang.String;
/**
* 银行卡ocr识别结果 - JBO命名常量类<br><br>
* Note: This file is generated by ADE tools, <em>dont</em> modify it.<br>
*/
public interface BANK_CARD_ORC_RESULT{
/**
* 银行卡ocr识别结果<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.oti.BANK_CARD_ORC_RESULT";
/**
* 唯一标识 STRING(32)<br>
*/
public static final String ID = "ID";
/**
* 合同ID STRING(32)<br>
*/
public static final String CONTRACT_ID = "CONTRACT_ID";
/**
* 项目编号 STRING(32)<br>
*/
public static final String PROJECT_NO = "PROJECT_NO";
/**
* 错误码 STRING(32)<br>
*/
public static final String ERROR_CODE = "ERROR_CODE";
/**
* 结果全文 STRING(32)<br>
*/
public static final String RESULT = "RESULT";
/**
* 银行卡号 STRING(32)<br>
*/
public static final String BANK_CARD_NO = "BANK_CARD_NO";
/**
* 银行卡号校验 STRING(32)<br>
*/
public static final String PASS_CHECK = "PASS_CHECK";
/**
* 创建时间 STRING(32)<br>
*/
public static final String INPUTTIME = "INPUTTIME";
}

View File

@ -0,0 +1,88 @@
package jbo.oti;
import java.lang.String;
/**
* 身份证ocr识别结果 - JBO命名常量类<br><br>
* Note: This file is generated by ADE tools, <em>dont</em> modify it.<br>
*/
public interface ID_CARD_OCR_RESULT{
/**
* 身份证ocr识别结果<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.oti.ID_CARD_OCR_RESULT";
/**
* 唯一标识 STRING(32)<br>
*/
public static final String ID = "ID";
/**
* 合同ID STRING(32)<br>
*/
public static final String CONTRACT_ID = "CONTRACT_ID";
/**
* 项目编号 STRING(32)<br>
*/
public static final String PROJECT_NO = "PROJECT_NO";
/**
* 错误码 STRING(32)<br>
*/
public static final String ERROR_CODE = "ERROR_CODE";
/**
* 结果全文 STRING(32)<br>
*/
public static final String RESULT = "RESULT";
/**
* 姓名 STRING(32)<br>
*/
public static final String FULL_NAME = "FULL_NAME";
/**
* 性别 STRING(32)<br>
*/
public static final String GENDER = "GENDER";
/**
* 民族 STRING(32)<br>
*/
public static final String ETHNICITY = "ETHNICITY";
/**
* 出生年月 STRING(32)<br>
*/
public static final String BRITH = "BRITH";
/**
* 住址 STRING(32)<br>
*/
public static final String ADDR = "ADDR";
/**
* 公民身份号码 STRING(32)<br>
*/
public static final String ID_NO = "ID_NO";
/**
* 头像 STRING(32)<br>
*/
public static final String HEAD = "HEAD";
/**
* 验证 STRING(32)<br>
*/
public static final String VERIFY = "VERIFY";
/**
* 人像面复印件 STRING(32)<br>
*/
public static final String HEAD_COPY = "HEAD_COPY";
/**
* 签发机关 STRING(32)<br>
*/
public static final String ISSUED_OFFICE = "ISSUED_OFFICE";
/**
* 有限期限 STRING(32)<br>
*/
public static final String TERM_VALIDITY = "TERM_VALIDITY";
/**
* 类型 STRING(32)<br>
*/
public static final String TYPE = "TYPE";
/**
* 创建时间 STRING(32)<br>
*/
public static final String INPUTTIME = "INPUTTIME";
}

View File

@ -0,0 +1,172 @@
package jbo.oti;
import java.lang.String;
/**
* 发票ocr识别结果 - JBO命名常量类<br><br>
* Note: This file is generated by ADE tools, <em>dont</em> modify it.<br>
*/
public interface INVOICE_ORC_RESULT{
/**
* 发票ocr识别结果<br><br>
* 代表本类映射的BizObjectClass
*/
public static final String CLASS_NAME = "jbo.oti.INVOICE_ORC_RESULT";
/**
* 唯一标识 STRING(32)<br>
*/
public static final String ID = "ID";
/**
* 合同ID STRING(32)<br>
*/
public static final String CONTRACT_ID = "CONTRACT_ID";
/**
* 项目编号 STRING(32)<br>
*/
public static final String PROJECT_NO = "PROJECT_NO";
/**
* 错误码 STRING(32)<br>
*/
public static final String ERROR_CODE = "ERROR_CODE";
/**
* 结果全文 STRING(32)<br>
*/
public static final String RESULT = "RESULT";
/**
* 开票日期 STRING(32)<br>
*/
public static final String DATEISSUED = "DATEISSUED";
/**
* 发票代码 STRING(32)<br>
*/
public static final String INVOICE_CODE = "INVOICE_CODE";
/**
* 发票号码 STRING(32)<br>
*/
public static final String INVOICE_NO = "INVOICE_NO";
/**
* 机打代码 STRING(32)<br>
*/
public static final String PRINT_CODE = "PRINT_CODE";
/**
* 机打号码 STRING(32)<br>
*/
public static final String PRINT_NO = "PRINT_NO";
/**
* 机器编号 STRING(32)<br>
*/
public static final String MACHINE_CODE = "MACHINE_CODE";
/**
* 税控码 STRING(32)<br>
*/
public static final String FISCAL_CODE = "FISCAL_CODE";
/**
* 购买方名称及身份证号码/组织机构代码 STRING(32)<br>
*/
public static final String ID_ORG_CODE = "ID_ORG_CODE";
/**
* 纳税人识别号 STRING(32)<br>
*/
public static final String TAX_ID = "TAX_ID";
/**
* 车辆类型 STRING(32)<br>
*/
public static final String CAR_TYPE = "CAR_TYPE";
/**
* 厂商型号 STRING(32)<br>
*/
public static final String CAR_MODEL = "CAR_MODEL";
/**
* 产地 STRING(32)<br>
*/
public static final String MADE_IN = "MADE_IN";
/**
* 合格证号 STRING(32)<br>
*/
public static final String CERTIFICATE_NO = "CERTIFICATE_NO";
/**
* 进口证明书号 STRING(32)<br>
*/
public static final String IMPORT_CERTIFICATE_NO = "IMPORT_CERTIFICATE_NO";
/**
* 商检单号 STRING(32)<br>
*/
public static final String COMMODITY_CHECK_NO = "COMMODITY_CHECK_NO";
/**
* 发动机号码 STRING(32)<br>
*/
public static final String ENGINE_NO = "ENGINE_NO";
/**
* 车辆识别代码/车架号 STRING(32)<br>
*/
public static final String VIN = "VIN";
/**
* 税价合计大写 STRING(32)<br>
*/
public static final String TOTAL_IN_WORDS = "TOTAL_IN_WORDS";
/**
* 税价合计小写 STRING(32)<br>
*/
public static final String TOTAL_IN_NUMBERS = "TOTAL_IN_NUMBERS";
/**
* 销售方名称 STRING(32)<br>
*/
public static final String SELLER_NAME = "SELLER_NAME";
/**
* 销货单位电话 STRING(32)<br>
*/
public static final String SELLER_TEL = "SELLER_TEL";
/**
* 销货单位纳税人识别号 STRING(32)<br>
*/
public static final String SELLER_TAX_ID = "SELLER_TAX_ID";
/**
* 销货单位账号 STRING(32)<br>
*/
public static final String SELLER_ACCOUNT = "SELLER_ACCOUNT";
/**
* 销货单位地址 STRING(32)<br>
*/
public static final String SELLER_ADDR = "SELLER_ADDR";
/**
* 销货单位开户银行 STRING(32)<br>
*/
public static final String SELLER_ACCOUNT_NO = "SELLER_ACCOUNT_NO";
/**
* 增值税税率或征收税率 STRING(32)<br>
*/
public static final String VAT_RATE = "VAT_RATE";
/**
* 增值税税额 STRING(32)<br>
*/
public static final String VAT_AMOUNT = "VAT_AMOUNT";
/**
* 主管税务机关及代码 STRING(32)<br>
*/
public static final String TAX_OFFICE_CODE = "TAX_OFFICE_CODE";
/**
* 不含税价小写 STRING(32)<br>
*/
public static final String EXCLUDING_TAX_AMOUNT = "EXCLUDING_TAX_AMOUNT";
/**
* 完税凭证号码 STRING(32)<br>
*/
public static final String TAX_PAYMENT_NO = "TAX_PAYMENT_NO";
/**
* 吨位 STRING(32)<br>
*/
public static final String TONNAGE = "TONNAGE";
/**
* 限乘人数 STRING(32)<br>
*/
public static final String PERSON_LIMITED = "PERSON_LIMITED";
/**
* 公章 STRING(32)<br>
*/
public static final String OFFICIAL_SEAL = "OFFICIAL_SEAL";
/**
* 创建时间 STRING(32)<br>
*/
public static final String INPUTTIME = "INPUTTIME";
}

View File

@ -0,0 +1,208 @@
package com.tenwa.lease.app.quartzmession;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONException;
import com.alibaba.fastjson.JSONObject;
import com.amarsoft.are.jbo.*;
import com.amarsoft.are.util.StringFunction;
import com.ample.icms.scan.ImageOcr;
import com.ample.icms.service.ImageOcrService;
import com.ample.icms.util.GetInfoUtil;
import com.ample.icms.util.PropertiesUtil;
import jbo.com.tenwa.lease.comm.LB_CONTRACT_INFO;
import jbo.oti.BANK_CARD_ORC_RESULT;
import jbo.oti.ID_CARD_OCR_RESULT;
import jbo.oti.INVOICE_ORC_RESULT;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import java.util.List;
public class AutoOcr implements Job {
private JobInitUserName jboName;
@Override
public synchronized void execute(JobExecutionContext arg0){
JBOTransaction tx =null;
try {
tx = JBOFactory.createJBOTransaction();
ImageOcrService is = new ImageOcrService();
GetInfoUtil giu = new GetInfoUtil();
String sql = PropertiesUtil.get("auto_sql");
List<BizObject> lciBos = JBOFactory.getBizObjectManager(LB_CONTRACT_INFO.CLASS_NAME,tx).createQuery(sql).getResultList(false);
if(lciBos.size()==0){
throw new Exception("未找到需要跑批的合同");
}
int limitCount =Integer.valueOf(PropertiesUtil.get("limit_count").length()>0?PropertiesUtil.get("limit_count"):"0");
for(int i=0;i<limitCount;i++){
if(i==lciBos.size()){
return;
}
BizObject bo = lciBos.get(i);
String contractId = bo.getAttribute("ID").toString();
String projectNo = giu.getProjectNoByContractId(contractId,tx);
is.setContractId(contractId);
is.setFlowNo("FundPaymentCarFlow");
String invoiceResult = is.invoiceOrc("APZLJJ000060", ImageOcr.ocrType.vehicle_invoice_ocr,tx);
System.out.println("定时任务机动车发票返回结果:"+invoiceResult);
JSONObject invoiceResultJson = this.getfullResult(contractId,projectNo,invoiceResult);
resultSave(invoiceResultJson,INVOICE_ORC_RESULT.CLASS_NAME,tx);
is.setFlowNo("BusinessApplyFlow");
String bankResult = is.invoiceOrc("APZLJJ000260", ImageOcr.ocrType.bank_card_ocr,tx);
System.out.println("定时任务银行卡返回结果:"+bankResult);
JSONObject bankResultJson = this.getfullResult(contractId,projectNo,bankResult);
resultSave(bankResultJson,BANK_CARD_ORC_RESULT.CLASS_NAME,tx);
String idResult = is.invoiceOrc("APZLJJ000130", ImageOcr.ocrType.id_card,tx);
System.out.println("定时任务身份证返回结果:"+idResult);
JSONObject idResultJson = this.getfullResult(contractId,projectNo,idResult);
resultSave(idResultJson,ID_CARD_OCR_RESULT.CLASS_NAME,tx);
}
} catch (Exception e2) {
e2.printStackTrace();
if (tx != null) {
try {
tx.rollback();
tx=null;
} catch (JBOException e1) {
e1.printStackTrace();
}
}
}finally{
try {
if(tx !=null){
tx.commit();
}
} catch (JBOException e) {
e.printStackTrace();
}
}
}
public void resultSave(JSONObject fullResultJson,String clazz,JBOTransaction tx) throws JBOException {
BizObjectManager bom = JBOFactory.getBizObjectManager(clazz,tx);
BizObject bo = setPublicResult(fullResultJson,bom.newObject());
if("0".equals(fullResultJson.getString("error_code"))&&jsonValidByFastjson(fullResultJson.getString("result"))){
JSONObject resultInfo = fullResultJson.getJSONObject("result");
switch (clazz){
case INVOICE_ORC_RESULT.CLASS_NAME:
bo = setInvoiceOrcResult(resultInfo,bo);
break;
case BANK_CARD_ORC_RESULT.CLASS_NAME:
setBanCardOrcResult(resultInfo,bo);
break;
case ID_CARD_OCR_RESULT.CLASS_NAME:
setIOrcResultSave(resultInfo,bo);
break;
default:
break;
}
}
bom.saveObject(bo);
}
public BizObject setPublicResult(JSONObject fullResultJson,BizObject bo) throws JBOException {
String errorCode = fullResultJson.getString("error_code");
String resultStr = fullResultJson.getString("result");
String contractId = fullResultJson.getString("CONTRACT_ID");
String projectNo = fullResultJson.getString("PROJECT_NO");
bo.setAttributeValue("CONTRACT_ID",contractId);
bo.setAttributeValue("PROJECT_NO",projectNo);
bo.setAttributeValue("ERROR_CODE",errorCode);
bo.setAttributeValue("RESULT",resultStr);
bo.setAttributeValue("INPUTTIME", StringFunction.getTodayNow());
return bo;
}
public BizObject setInvoiceOrcResult(JSONObject resultInfo,BizObject bo) throws JBOException {
bo.setAttributeValue("DATEISSUED",resultInfo.getString("开票日期"));
bo.setAttributeValue("INVOICE_CODE",resultInfo.getString("发票代码"));
bo.setAttributeValue("INVOICE_NO",resultInfo.getString("发票号码"));
bo.setAttributeValue("PRINT_CODE",resultInfo.getString("机打代码"));
bo.setAttributeValue("PRINT_NO",resultInfo.getString("机打号码"));
bo.setAttributeValue("MACHINE_CODE",resultInfo.getString("机器编号"));
bo.setAttributeValue("FISCAL_CODE",resultInfo.getString("税控码"));
bo.setAttributeValue("ID_ORG_CODE",resultInfo.getString("购买方名称及身份证号码/组织机构代码"));
bo.setAttributeValue("TAX_ID",resultInfo.getString("纳税人识别号"));
bo.setAttributeValue("CAR_TYPE",resultInfo.getString("车辆类型"));
bo.setAttributeValue("CAR_MODEL",resultInfo.getString("厂牌型号"));
bo.setAttributeValue("MADE_IN",resultInfo.getString("产地"));
bo.setAttributeValue("CERTIFICATE_NO",resultInfo.getString("合格证号"));
bo.setAttributeValue("IMPORT_CERTIFICATE_NO",resultInfo.getString("进口证明书号"));
bo.setAttributeValue("COMMODITY_CHECK_NO",resultInfo.getString("商检单号"));
bo.setAttributeValue("ENGINE_NO",resultInfo.getString("发动机号码"));
bo.setAttributeValue("VIN",resultInfo.getString("车辆识别代号/车架号码"));
bo.setAttributeValue("TOTAL_IN_WORDS",resultInfo.getString("价税合计大写"));
bo.setAttributeValue("TOTAL_IN_NUMBERS",resultInfo.getString("价税合计小写"));
bo.setAttributeValue("SELLER_NAME",resultInfo.getString("销货单位名称"));
bo.setAttributeValue("SELLER_TEL",resultInfo.getString("销货单位电话"));
bo.setAttributeValue("SELLER_TAX_ID",resultInfo.getString("销货单位纳税人识别号"));
bo.setAttributeValue("SELLER_ACCOUNT",resultInfo.getString("销货单位账号"));
bo.setAttributeValue("SELLER_ADDR",resultInfo.getString("销货单位地址"));
bo.setAttributeValue("SELLER_ACCOUNT_NO",resultInfo.getString("销货单位开户银行"));
bo.setAttributeValue("VAT_RATE",resultInfo.getString("增值税税率或征收税率"));
bo.setAttributeValue("VAT_AMOUNT",resultInfo.getString("增值税税额"));
bo.setAttributeValue("TAX_OFFICE_CODE",resultInfo.getString("主管税务机关及代码"));
bo.setAttributeValue("EXCLUDING_TAX_AMOUNT",resultInfo.getString("不含税价小写"));
bo.setAttributeValue("TAX_PAYMENT_NO",resultInfo.getString("完税凭证号码"));
bo.setAttributeValue("TONNAGE",resultInfo.getString("吨位"));
bo.setAttributeValue("PERSON_LIMITED",resultInfo.getString("限乘人数"));
bo.setAttributeValue("OFFICIAL_SEAL",resultInfo.getString("公章"));
return bo;
}
public BizObject setBanCardOrcResult(JSONObject resultInfo,BizObject bo) throws JBOException {
bo.setAttributeValue("BANK_CARD_NO", resultInfo.getString("bankCardNum"));
bo.setAttributeValue("PASS_CHECK", resultInfo.getString("passCheck"));
return bo;
}
public BizObject setIOrcResultSave(JSONObject resultInfo,BizObject bo) throws JBOException {
bo.setAttributeValue("FULL_NAME", resultInfo.getString("姓名"));
bo.setAttributeValue("GENDER", resultInfo.getString("性别"));
bo.setAttributeValue("ETHNICITY", resultInfo.getString("民族"));
bo.setAttributeValue("BRITH", resultInfo.getString("出生年月"));
bo.setAttributeValue("ADDR", resultInfo.getString("住址"));
bo.setAttributeValue("ID_NO", resultInfo.getString("公民身份号码"));
bo.setAttributeValue("HEAD", resultInfo.getString("头像"));
bo.setAttributeValue("VERIFY", resultInfo.getString("验证"));
bo.setAttributeValue("HEAD_COPY", resultInfo.getString("人像面复印件"));
bo.setAttributeValue("ISSUED_OFFICE", resultInfo.getString("签发机关"));
bo.setAttributeValue("TERM_VALIDITY", resultInfo.getString("有效期限"));
bo.setAttributeValue("TYPE", resultInfo.getString("类型"));
return bo;
}
public Boolean jsonValidByFastjson(String jsonStr){
try {
JSONObject.parseObject(jsonStr);
} catch (Exception e) {
try {
JSONObject.parseArray(jsonStr);
} catch (JSONException ex) {
return false;
}
}
return true;
}
public JSONObject praseJsonObject(String fullResult){
JSONObject fullResultJson = null;
if(jsonValidByFastjson(fullResult)){
fullResultJson = JSON.parseObject(fullResult);
}else{
fullResultJson = new JSONObject();
fullResultJson.put("error_code","fail");
fullResultJson.put("result",fullResult);
}
return fullResultJson;
}
public JSONObject getfullResult(String contractId, String projectNo, String responseStr) throws JBOException {
JSONObject fullResultJson = praseJsonObject(responseStr);
fullResultJson.put("CONTRACT_ID",contractId);
fullResultJson.put("PROJECT_NO",projectNo);
return fullResultJson;
}
}

View File

@ -0,0 +1,43 @@
package com.tenwa.lease.flow.project.commcheck;
import com.amarsoft.app.alarm.AlarmBiz;
import com.amarsoft.awe.util.Transaction;
import com.ample.icms.check.ImageCheck;
import com.ample.icms.util.GetInfoUtil;
/**
* ×ÊÁÏÇåµ¥¼ì²é
* @author 20170524
*
*/
public class IcmsDocListCheckByFlowunid extends AlarmBiz {
@Override
public Object run(Transaction Sqlca) throws Exception {
String flowUnid = this.getAttribute("ObjectNo").toString();
String flowNo = this.getAttribute("FlowNo").toString();
GetInfoUtil gif = new GetInfoUtil();
String busiNo = flowUnid;
String app = gif.getAppInfoByFlowNo(flowNo,Sqlca);
String [] appInfo = app.split("@");
String appCode = appInfo[0];
String appName = appInfo[1];
if("0000".equals(appCode)){
setPass(false);
putMsg(appName);
return null;
}
ImageCheck ic= new ImageCheck();
ic.setAppCode(appCode);
ic.setAppName(appName);
ic.setBusiNo(busiNo);
String result =ic.resultAnalysis(ic.getResult());
String[] resultInfo = result.split("@");
if("true".equals(resultInfo[0])){
setPass(true);
}else{
setPass(false);
}
putMsg(resultInfo[1]);
return null;
}
}