package com.gaojinsoft.htwy.y2015.ddm.util;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.imageio.stream.FileImageInputStream;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import com.alibaba.fastjson.JSON;
import com.baidu.aip.ocr.AipOcr;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
public class AipTool {
private static Properties prop = null;
private static String appId = null;
private static String appKey = null;
private static String secretKey = null;
private static final String TYPE_IDCARD = "1";
private static final String TYPE_LICENSE = "2";
private static String idcard_info = "";
private static String businessLicense_info = "";
private static Logger logger = Logger.getLogger(AipTool.class);
static {
try {
InputStreamReader inputStream = new InputStreamReader(AipTool.class.getResourceAsStream("/aip.properties"),"utf-8");
prop = new Properties();
prop.load(inputStream);
appId = prop.getProperty("aip.app_id").toString();
appKey = prop.getProperty("aip.api_key").toString();
secretKey = prop.getProperty("aip.secret_key").toString();
idcard_info = prop.getProperty("aip.idcard").toString();
businessLicense_info = prop.getProperty("aip.business_license").toString();
} catch (IOException e) {
e.printStackTrace();
System.out.println("error:AipTool加载配置文件失败!");
//logger.error("AipTool加载配置文件失败!");
}
}
public AipTool() {
}
/**
* 调用百度云的文字识别接口
*
* @param path :图片URL
* @param type : 1为身份证正面照;2为营业执照
* @return JSONObject
*/
public static JSONObject ocr(String path, String type) {
if (StringUtils.isBlank(appId) && StringUtils.isBlank(appKey) && StringUtils.isBlank(secretKey)) {
// logger.warn("aip接口调用缺失参数");
return null;
}
// 初始化一个AipOcr
AipOcr client = new AipOcr(appId, appKey, secretKey);
// 可选:设置网络连接参数
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
// 可选:设置代理服务器地址, http和socket二选一,或者均不设置
// client.setHttpProxy("proxy_host", proxy_port); // 设置http代理
// client.setSocketProxy("proxy_host", proxy_port); // 设置socket代理
// 可选:设置log4j日志输出格式,若不设置,则使用默认配置
// 也可以直接通过jvm启动参数设置此环境变量
System.setProperty("aip.log4j.conf", "/log4j.properties");
// 传入可选参数调用接口
HashMap<String, String> options = new HashMap<String, String>();
if(StringUtils.isNotBlank(type)
|| TYPE_IDCARD.equals(type)) {
//是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
//- true:检测朝向;
//- false:不检测朝向。
options.put("detect_direction", "true");
//是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,即:false。可选值:true-开启;false-不开启
options.put("detect_risk", "true");
}
// 调用接口
// JSONObject res = client.basicGeneral(path, new HashMap<String, String>());
if(StringUtils.isNotBlank(type)
|| TYPE_LICENSE.equals(type)) {
JSONObject res = client.idcard(path, "front", options);
return res;
}else {
JSONObject res = client.businessLicense(path, options);
return res;
}
}
/**
* 调用百度云的文字识别接口
*
* @param byte[] :图片二进制数组
* @param type : 1为身份证正面照;2为营业执照
* @return JSONObject
*/
/*
* 返回值说明:
* direction 否 number 图像方向,当detect_direction=true时存在。
- -1:未定义,
- 0:正向,
- 1: 逆时针90度,
- 2:逆时针180度,
- 3:逆时针270度
image_status 是 string normal-识别正常
reversed_side-未摆正身份证
non_idcard-上传的图片中不包含身份证
blurred-身份证模糊
over_exposure-身份证关键字段反光或过曝
unknown-未知状态
risk_type 否 string 输入参数 detect_risk = true 时,则返回该字段识别身份证类型: normal-正常身份证;copy-复印件;temporary-临时身份证;screen-翻拍;unknow-其他未知情况
edit_tool 否 string 如果参数 detect_risk = true 时,则返回此字段。如果检测身份证被编辑过,该字段指定编辑软件名称,如:Adobe Photoshop CC 2014 (Macintosh),如果没有被编辑过则返回值无此参数
log_id 是 number 唯一的log id,用于问题定位
words_result 是 array(object) 定位和识别结果数组
words_result_num 是 number 识别结果数,表示words_result的元素个数
+location 是 array(object) 位置数组(坐标0点为左上角)
++left 是 number 表示定位位置的长方形左上顶点的水平坐标
++top 是 number 表示定位位置的长方形左上顶点的垂直坐标
++width 是 number 表示定位位置的长方形的宽度
++height 是 number 表示定位位置的长方形的高度
+words 否 string 识别结果字符串
*
* */
public static Map ocr(byte[] imgData, String type) {
if (StringUtils.isBlank(appId) && StringUtils.isBlank(appKey) && StringUtils.isBlank(secretKey)) {
// logger.warn("aip接口调用缺失参数");
return null;
}
// 初始化一个AipOcr
AipOcr client = new AipOcr(appId, appKey, secretKey);
// 可选:设置网络连接参数
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
// 可选:设置代理服务器地址, http和socket二选一,或者均不设置
// client.setHttpProxy("proxy_host", proxy_port); // 设置http代理
// client.setSocketProxy("proxy_host", proxy_port); // 设置socket代理
// 可选:设置log4j日志输出格式,若不设置,则使用默认配置
// 也可以直接通过jvm启动参数设置此环境变量
System.setProperty("aip.log4j.conf", "/log4j.properties");
// 传入可选参数调用接口
HashMap<String, String> options = new HashMap<String, String>();
if(StringUtils.isNotBlank(type)
|| TYPE_IDCARD.equals(type)) {
//是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
//- true:检测朝向;
//- false:不检测朝向。
options.put("detect_direction", "true");
//是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,即:false。可选值:true-开启;false-不开启
options.put("detect_risk", "true");
}
// 调用接口
// JSONObject res = client.basicGeneral(path, new HashMap<String, String>());
Map<String,String> simpleResult = new HashMap<String, String>();
if(StringUtils.isNotBlank(type)
&& TYPE_LICENSE.equals(type)) {//营业执照
JSONObject res;
try {
res = client.businessLicense(imgData, options);
System.out.println(res.toString());
//对结果进行解析
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(res.toString(), Map.class);
if(resultMap !=null
&& resultMap.get("words_result") != null) {
Map<String, Object> wordsResult = (Map)resultMap.get("words_result");
String[] readDataItem = businessLicense_info.split(",");
for(String item :readDataItem) {
Map<String,Object> itemValueMap = (Map)wordsResult.get(item);
if(itemValueMap != null) {
simpleResult.put(item, (String)itemValueMap.get("words"));
}
}
}
System.out.println(gson.toJson(simpleResult));
return simpleResult;
} catch (Exception e) {
e.printStackTrace();
logger.error("百度OCR接口调用失败");
return null;
}
}else {//身份证
try {
JSONObject res = client.idcard(imgData, "front", options);
System.out.println(res.toString());
//对结果进行解析
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(res.toString(), Map.class);
if(resultMap !=null
&& resultMap.get("words_result") != null) {
Map<String, Object> wordsResult = (Map)resultMap.get("words_result");
String[] readDataItem = idcard_info.split(",");
for(String item :readDataItem) {
Map<String,Object> itemValueMap = (Map)wordsResult.get(item);
if(itemValueMap != null) {
simpleResult.put(item, (String)itemValueMap.get("words"));
}
}
}
System.out.println(gson.toJson(simpleResult));
return simpleResult;
} catch (Exception e) {
e.printStackTrace();
logger.error("百度OCR接口调用失败");
return null;
}
}
}
// 图片到byte数组
public static byte[] image2byte(String path) {
byte[] data = null;
FileImageInputStream input = null;
try {
input = new FileImageInputStream(new File(path));
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int numBytesRead = 0;
while ((numBytesRead = input.read(buf)) != -1) {
output.write(buf, 0, numBytesRead);
}
data = output.toByteArray();
output.close();
input.close();
} catch (FileNotFoundException ex1) {
ex1.printStackTrace();
} catch (IOException ex1) {
ex1.printStackTrace();
}
return data;
}
public static void main(String[] args) throws Exception{
//身份证
String path = "D:/OCRTEST_image/身份证02.jpg";
Map res = AipTool.ocr(image2byte(path), TYPE_IDCARD);
System.out.println("res == " + JSON.toJSONString(res));
path = "D:/OCRTEST_image/营业执照4.png";
res = AipTool.ocr(image2byte(path), TYPE_LICENSE);
System.out.println("res == " + JSON.toJSONString(res));
//营业执照
/*String path = "C:\\Users\\ouyf2\\Pictures\\营业执照.jpg";
JSONObject res = AipTool.ocr(image2byte(path), TYPE_LICENSE);*/
}
}
package com.gaojinsoft.htwy.y2019.marketManage.util;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.imageio.stream.FileImageInputStream;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.json.JSONObject;
import com.alibaba.fastjson.JSON;
import com.baidu.aip.ocr.AipOcr;
import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;
public class AipTool {
private static Properties prop = null;
private static String appId = null;
private static String appKey = null;
private static String secretKey = null;
private static final String TYPE_IDCARD = "1";
private static final String TYPE_LICENSE = "2";
private static final String BAND_CARD = "3";
private static final String TYPE_IDCARD_BACK = "4";
private static String idcard_info = "";
private static String businessLicense_info = "";
private static Logger logger = Logger.getLogger(AipTool.class);
static {
try {
InputStreamReader inputStream = new InputStreamReader(AipTool.class.getResourceAsStream("/aip.properties"),"utf-8");
prop = new Properties();
prop.load(inputStream);
appId = prop.getProperty("aip.app_id").toString();
appKey = prop.getProperty("aip.api_key").toString();
secretKey = prop.getProperty("aip.secret_key").toString();
idcard_info = prop.getProperty("aip.idcard").toString();
businessLicense_info = prop.getProperty("aip.business_license").toString();
} catch (IOException e) {
e.printStackTrace();
System.out.println("error:AipTool加载配置文件失败!");
//logger.error("AipTool加载配置文件失败!");
}
}
public AipTool() {
}
/**
* 调用百度云的文字识别接口
*
* @param path :图片URL
* @param type : 1为身份证正面照;2为营业执照
* @return JSONObject
*/
public static JSONObject ocr(String path, String type) {
if (StringUtils.isBlank(appId) && StringUtils.isBlank(appKey) && StringUtils.isBlank(secretKey)) {
// logger.warn("aip接口调用缺失参数");
return null;
}
// 初始化一个AipOcr
AipOcr client = new AipOcr(appId, appKey, secretKey);
// 可选:设置网络连接参数
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
// 可选:设置代理服务器地址, http和socket二选一,或者均不设置
// client.setHttpProxy("proxy_host", proxy_port); // 设置http代理
// client.setSocketProxy("proxy_host", proxy_port); // 设置socket代理
// 可选:设置log4j日志输出格式,若不设置,则使用默认配置
// 也可以直接通过jvm启动参数设置此环境变量
System.setProperty("aip.log4j.conf", "/log4j.properties");
// 传入可选参数调用接口
HashMap<String, String> options = new HashMap<String, String>();
if(StringUtils.isNotBlank(type)
|| TYPE_IDCARD.equals(type)) {
//是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
//- true:检测朝向;
//- false:不检测朝向。
options.put("detect_direction", "true");
//是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,即:false。可选值:true-开启;false-不开启
options.put("detect_risk", "true");
}
// 调用接口
// JSONObject res = client.basicGeneral(path, new HashMap<String, String>());
if(StringUtils.isNotBlank(type)
|| TYPE_LICENSE.equals(type)) {
JSONObject res = client.idcard(path, "front", options);
return res;
}else {
JSONObject res = client.businessLicense(path, options);
return res;
}
}
/**
* 调用百度云的文字识别接口
*
* @param byte[] :图片二进制数组
* @param type : 1为身份证正面照;2为营业执照
* @return JSONObject
*/
/*
* 返回值说明:
* direction 否 number 图像方向,当detect_direction=true时存在。
- -1:未定义,
- 0:正向,
- 1: 逆时针90度,
- 2:逆时针180度,
- 3:逆时针270度
image_status 是 string normal-识别正常
reversed_side-未摆正身份证
non_idcard-上传的图片中不包含身份证
blurred-身份证模糊
over_exposure-身份证关键字段反光或过曝
unknown-未知状态
risk_type 否 string 输入参数 detect_risk = true 时,则返回该字段识别身份证类型: normal-正常身份证;copy-复印件;temporary-临时身份证;screen-翻拍;unknow-其他未知情况
edit_tool 否 string 如果参数 detect_risk = true 时,则返回此字段。如果检测身份证被编辑过,该字段指定编辑软件名称,如:Adobe Photoshop CC 2014 (Macintosh),如果没有被编辑过则返回值无此参数
log_id 是 number 唯一的log id,用于问题定位
words_result 是 array(object) 定位和识别结果数组
words_result_num 是 number 识别结果数,表示words_result的元素个数
+location 是 array(object) 位置数组(坐标0点为左上角)
++left 是 number 表示定位位置的长方形左上顶点的水平坐标
++top 是 number 表示定位位置的长方形左上顶点的垂直坐标
++width 是 number 表示定位位置的长方形的宽度
++height 是 number 表示定位位置的长方形的高度
+words 否 string 识别结果字符串
*
* */
public static Map ocr(byte[] imgData, String type) {
if (StringUtils.isBlank(appId) && StringUtils.isBlank(appKey) && StringUtils.isBlank(secretKey)) {
// logger.warn("aip接口调用缺失参数");
return null;
}
// 初始化一个AipOcr
AipOcr client = new AipOcr(appId, appKey, secretKey);
// 可选:设置网络连接参数
client.setConnectionTimeoutInMillis(2000);
client.setSocketTimeoutInMillis(60000);
// 可选:设置代理服务器地址, http和socket二选一,或者均不设置
// client.setHttpProxy("proxy_host", proxy_port); // 设置http代理
// client.setSocketProxy("proxy_host", proxy_port); // 设置socket代理
// 可选:设置log4j日志输出格式,若不设置,则使用默认配置
// 也可以直接通过jvm启动参数设置此环境变量
System.setProperty("aip.log4j.conf", "/log4j.properties");
// 传入可选参数调用接口
HashMap<String, String> options = new HashMap<String, String>();
if(StringUtils.isNotBlank(type)
|| TYPE_IDCARD.equals(type)) {
//是否检测图像朝向,默认不检测,即:false。朝向是指输入图像是正常方向、逆时针旋转90/180/270度。可选值包括:
//- true:检测朝向;
//- false:不检测朝向。
options.put("detect_direction", "true");
//是否开启身份证风险类型(身份证复印件、临时身份证、身份证翻拍、修改过的身份证)功能,默认不开启,即:false。可选值:true-开启;false-不开启
options.put("detect_risk", "true");
}
// 调用接口
// JSONObject res = client.basicGeneral(path, new HashMap<String, String>());
Map<String,String> simpleResult = new HashMap<String, String>();
if(StringUtils.isNotBlank(type)
&& TYPE_LICENSE.equals(type)) {//营业执照
JSONObject res;
try {
res = client.businessLicense(imgData, options);
System.out.println(res.toString());
//对结果进行解析
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(res.toString(), Map.class);
if(resultMap !=null
&& resultMap.get("words_result") != null) {
Map<String, Object> wordsResult = (Map)resultMap.get("words_result");
String[] readDataItem = businessLicense_info.split(",");
for(String item :readDataItem) {
Map<String,Object> itemValueMap = (Map)wordsResult.get(item);
if(itemValueMap != null) {
simpleResult.put(item, (String)itemValueMap.get("words"));
}
}
}
System.out.println(gson.toJson(simpleResult));
return simpleResult;
} catch (Exception e) {
e.printStackTrace();
logger.error("百度OCR接口调用失败");
return null;
}
}else if(StringUtils.isNotBlank(type)
&& BAND_CARD.equals(type)) {//银行卡
JSONObject res;
try {
res = client.bankcard(imgData, options);
System.out.println(res.toString());
//对结果进行解析
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(res.toString(), Map.class);
// if(resultMap !=null
// && resultMap.get("words_result") != null) {
// Map<String, Object> wordsResult = (Map)resultMap.get("words_result");
// String[] readDataItem = businessLicense_info.split(",");
// for(String item :readDataItem) {
// Map<String,Object> itemValueMap = (Map)wordsResult.get(item);
// if(itemValueMap != null) {
// simpleResult.put(item, (String)itemValueMap.get("words"));
// }
// }
// }
System.out.println(gson.toJson(resultMap));
return resultMap;
} catch (Exception e) {
e.printStackTrace();
logger.error("百度OCR接口调用失败");
return null;
}
}else if(StringUtils.isNotBlank(type)
&& TYPE_IDCARD_BACK.equals(type)) {//身份证反面
try {
JSONObject res = client.idcard(imgData, "back", options);
System.out.println(res.toString());
//对结果进行解析
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(res.toString(), Map.class);
// if(resultMap !=null
// && resultMap.get("words_result") != null) {
// Map<String, Object> wordsResult = (Map)resultMap.get("words_result");
// String[] readDataItem = idcard_info.split(",");
// for(String item :readDataItem) {
// Map<String,Object> itemValueMap = (Map)wordsResult.get(item);
// if(itemValueMap != null) {
// simpleResult.put(item, (String)itemValueMap.get("words"));
// }
// }
// }
System.out.println(gson.toJson(resultMap));
return resultMap;
} catch (Exception e) {
e.printStackTrace();
logger.error("百度OCR接口调用失败");
return null;
}
}
else {//身份证
try {
JSONObject res = client.idcard(imgData, "front", options);
System.out.println(res.toString());
//对结果进行解析
Gson gson = new Gson();
Map<String, Object> resultMap = gson.fromJson(res.toString(), Map.class);
if(resultMap !=null
&& resultMap.get("words_result") != null) {
Map<String, Object> wordsResult = (Map)resultMap.get("words_result");
String[] readDataItem = idcard_info.split(",");
for(String item :readDataItem) {
Map<String,Object> itemValueMap = (Map)wordsResult.get(item);
if(itemValueMap != null) {
simpleResult.put(item, (String)itemValueMap.get("words"));
}
}
}
System.out.println(gson.toJson(simpleResult));
return simpleResult;
} catch (Exception e) {
e.printStackTrace();
logger.error("百度OCR接口调用失败");
return null;
}
}
}
// 图片到byte数组
public static byte[] image2byte(String path) {
byte[] data = null;
FileImageInputStream input = null;
try {
input = new FileImageInputStream(new File(path));
ByteArrayOutputStream output = new ByteArrayOutputStream();
byte[] buf = new byte[1024];
int numBytesRead = 0;
while ((numBytesRead = input.read(buf)) != -1) {
output.write(buf, 0, numBytesRead);
}
data = output.toByteArray();
output.close();
input.close();
} catch (FileNotFoundException ex1) {
ex1.printStackTrace();
} catch (IOException ex1) {
ex1.printStackTrace();
}
return data;
}
public static void main(String[] args) throws Exception{
//身份证
String path = "D:/OCRTEST_image/身份证02.jpg";
Map res = AipTool.ocr(image2byte(path), TYPE_IDCARD);
System.out.println("res == " + JSON.toJSONString(res));
path = "D:/OCRTEST_image/营业执照4.png";
res = AipTool.ocr(image2byte(path), TYPE_LICENSE);
System.out.println("res == " + JSON.toJSONString(res));
path = "D:/OCRTEST_image/银行卡002.jpg";
res = AipTool.ocr(image2byte(path), BAND_CARD);
System.out.println("res == " + JSON.toJSONString(res));
path = "D:/OCRTEST_image/123456.jpg";
res = AipTool.ocr(image2byte(path), TYPE_IDCARD_BACK);
System.out.println("res == " + JSON.toJSONString(res));
//营业执照
/*String path = "C:\\Users\\ouyf2\\Pictures\\营业执照.jpg";
JSONObject res = AipTool.ocr(image2byte(path), TYPE_LICENSE);*/
}
}
package com.gaojinsoft.htwy.y2019.marketManage.util;
import java.io.BufferedInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.apache.commons.net.util.*;
import org.apache.struts2.ServletActionContext;
import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
import com.kingzheng.common.CommonManage;
import com.kingzheng.htwy.po.fileUploadReturn;
import sun.misc.BASE64Decoder;
/**
*
* @功能概述:关于文件控制工具类
* @关联表、存储过程、视图:
* @作者:周超
* @创建日期:2015-04-27
*/
public class FileUtil {
public static String DDM_TEMP_FILE_SAVE_PATH="/bid_files/temp/";
public static String DDM_CREDENTIAL_FILE_SAVE_PATH="/ddm_files/credentials/";
public static String DDM_CUSTOMER_FILE_SAVE_PATH="/ddm_files/customer/";
public static String DDM_REFUND_FILE_SAVE_PATH="/ddm_files/refundApply/";
public static String TEMP_FILE_SAVE_PATH="/cams_files/temp/";
public static String CREDENTIAL_FILE_SAVE_PATH="/cams_files/credentials/";
public static String CONTRACT_TEMPLATE_FILE_SAVE_PATH="/cams_files/contractTemplate/";
public static String CONTRACT_ATTACHMENT_FILE_SAVE_PATH="/cams_files/contractAttachment/";
public static String CONTRACT_FILE_SAVE_PATH="/cams_files/contract_files/";
public static boolean debug=false;//debug为true时,所有文件操作都保存在本地。
private final static int BUFFER=1024;
/**
* 功能描述:获得以日为单位的路径
* @作者:周超
* @创建时间:2015-4-27
* @return
*/
public static String getDatePath(){
String path = "";
Calendar calendar = Calendar.getInstance();
int year = calendar.get(Calendar.YEAR);
int month = calendar.get(Calendar.MONTH);
int date = calendar.get(Calendar.DAY_OF_MONTH);
path += year+"/"+(month+1)+"/"+date+"/";
return path;
}
/**
* 功能描述:获得临时文件路径
* @作者:周超
* @创建时间:2015-4-27
* @return
*/
public static String getTempPath(){
Date now = new Date();
DateFormat df = new SimpleDateFormat("yyyyMMdd");
String dateStr = df.format(now);
String path = ServletActionContext.getServletContext().getRealPath(DDM_TEMP_FILE_SAVE_PATH);
path += System.getProperty("file.separator")+dateStr;
File tempPath = new File(path);
if(!tempPath.exists()){
tempPath.mkdirs();
}
tempPath = null;
return DDM_TEMP_FILE_SAVE_PATH + dateStr + "/";
}
/**
* 功能描述:文件拷贝
* @作者:周超
* @创建时间:2014-7-29
* @param sourcePath 原路径
* @param targetPath 目标路径
* @param deleteSourceFile 是否删除原文件
* @return
*/
public static boolean copy(String sourcePath,String targetPath,boolean deleteSourceFile){
boolean flag = false;
File sourceFile = new File(ServletActionContext.getServletContext().getRealPath(sourcePath));
if(sourceFile.exists()&&sourceFile.isFile()){
flag = CommonManage.saveFile(sourceFile, targetPath);
if(flag&&deleteSourceFile){
sourceFile.delete();
}
}
return flag;
}
/**
* 功能描述:文件拷贝从本地硬盘拷贝到smb服务器
* @作者:周超
* @创建时间:2015-4-27
* @param sourcePath 本地原文件相对路径(包括文件名)
* @param targetPath 目标文件相对路径(不包括文件名)
* @param deleteSourceFile 是否删除原文件
* @return smb服务器保存的文件名称(不包括路径)
*/
public static String copyLocalToRemote(String sourcePath,String targetPath,boolean deleteSourceFile){
if(!debug){
fileUploadReturn fileUploadReturn;
String path = ServletActionContext.getServletContext().getRealPath(sourcePath);
File sourceFile = new File(path);
if(sourceFile.exists()&&sourceFile.isFile()){
fileUploadReturn = CommonManage.smbUploadFile(targetPath, path);
if(fileUploadReturn.isSucess()&&deleteSourceFile){
sourceFile.delete();
}
return fileUploadReturn.getSysFileName();
}else{
return null;
}
}else{
File sourceFile = new File(ServletActionContext.getServletContext().getRealPath(sourcePath));
if(sourceFile.exists()&&sourceFile.isFile()){
String targetfileName = generateFileName(sourcePath);
boolean flag = CommonManage.saveFile(sourceFile, targetPath + "/" + targetfileName);
if(flag&&deleteSourceFile){
sourceFile.delete();
}
if(flag){
return targetfileName;
}else{
return null;
}
}else{
return null;
}
}
}
/**
* 功能描述:文件拷贝从本地硬盘拷贝到smb服务器
* @作者:周超
* @创建时间:2015-4-27
* @param sourcePath 本地原文件绝对路径(包括文件名)
* @param targetPath 目标文件相对路径(不包括文件名)
* @param deleteSourceFile 是否删除原文件
* @return smb服务器保存的文件名称(不包括路径)
*/
public static String copyLocalToRemote1(String sourcePath,String targetPath,boolean deleteSourceFile){
if(!debug){
fileUploadReturn fileUploadReturn;
File sourceFile = new File(sourcePath);
if(sourceFile.exists()&&sourceFile.isFile()){
fileUploadReturn = CommonManage.smbUploadFile(targetPath, sourcePath);
if(fileUploadReturn.isSucess()&&deleteSourceFile){
sourceFile.delete();
}
return fileUploadReturn.getSysFileName();
}else{
return null;
}
}else{
File sourceFile = new File(ServletActionContext.getServletContext().getRealPath(sourcePath));
if(sourceFile.exists()&&sourceFile.isFile()){
String targetfileName = generateFileName(sourcePath);
boolean flag = CommonManage.saveFile(sourceFile, targetPath + "/" + targetfileName);
if(flag&&deleteSourceFile){
sourceFile.delete();
}
if(flag){
return targetfileName;
}else{
return null;
}
}else{
return null;
}
}
}
/**
* 功能描述:smb文件服务器中的文件拷贝
* @作者:周超
* @创建时间:2015-4-27
* @param sourcePath 原文件路径(包括文件名)
* @param targetPath 目标文件路径(不包括文件名)
* @param deleteSourceFile 是否删除原文件
* @return 成功返回true,失败返回false
*/
public static fileUploadReturn copyRemoteToRemote(String sourcePath,String targetPath,boolean deleteSourceFile){
fileUploadReturn fur = new fileUploadReturn();
try{
String fileExt = sourcePath.substring(sourcePath.lastIndexOf('.') + 1);
String sysFileName = CommonManage.getUuid() + "." + fileExt;
CommonManage.smbDownloadFile(sourcePath, ServletActionContext.getServletContext().getRealPath(FileUtil.getTempPath()), sysFileName);
if(deleteSourceFile){
CommonManage.smbDeleteFile(sourcePath);
}
String fileName = FileUtil.copyLocalToRemote(FileUtil.getTempPath()+sysFileName, targetPath, true);
fur.setSucess(true);
fur.setSysFileName(fileName);
}catch(Exception e){
e.printStackTrace();
fur.setSucess(false);
fur.setMsg("复制文件时出现异常!");
}
return fur;
}
/**
* 功能描述:删除smb服务器文件
* @作者:周超
* @创建时间:2015-4-27
* @param filePath 文件路径(包含文件名称)
* @return
*/
public static boolean deleteRemoteFile(String filePath){
if(!debug){
return CommonManage.smbDeleteFile(filePath);
}else{
return delete(filePath);
}
}
/**
* 功能描述:文件删除
* @作者:周超
* @创建时间:2015-4-27
* @param filePath 文件路径
* @return
*/
public static boolean delete(String filePath){
File file = new File(ServletActionContext.getServletContext().getRealPath(filePath));
if(file.exists()&&file.isFile()){
return file.delete();
}else{
return true;
}
}
/**
* new文件名= 时间 + 全球唯一编号
* @param fileName old文件名
* @return new文件名
*/
public static String generateFileName(String fileName) {
String uuid=UUID.randomUUID().toString();
int position = fileName.lastIndexOf(".");
String extension = fileName.substring(position);
return uuid + extension;
}
public static Map buildFileZip(List filePathList , List packFilePathList){
String tempPath = ServletActionContext.getServletContext().getRealPath(FileUtil.getTempPath());
String uuidPath= CommonManage.getUuid()+".zip";
String zipPath = tempPath+System.getProperty("file.separator")+uuidPath;
ZipOutputStream zos=null;
InputStream is = null;
ZipEntry ze=null;
String filePh = "";//压缩包文件路径(包含文件名)
File file = null;
byte[] buf=new byte[BUFFER];
int readLen=0;
List<String> list1 = new ArrayList<String>();//错误文件名称列表
try{
zos = new ZipOutputStream(new FileOutputStream(zipPath));
for (int j = 0; j < filePathList.size(); j++) {
filePh = packFilePathList.get(j)==null?"":packFilePathList.get(j).toString();//包括文件名
if(filePh.substring(0,1).equals("/")){
filePh = filePh.substring(filePh.indexOf("/")+1);
}
String filePath = filePathList.get(j)==null?"":filePathList.get(j).toString();
// fileUploadReturn fur = CommonManage.smbDownloadFile(filePath, tempPath, "");
file = new File(ServletActionContext.getServletContext().getRealPath(filePath));
if(file!=null){
is = new BufferedInputStream(new FileInputStream(file));
ze=new ZipEntry(filePh);
ze.setSize(file.length());
ze.setTime(file.lastModified());
zos.putNextEntry(ze);
while ((readLen=is.read(buf, 0, BUFFER))!=-1) {
zos.write(buf, 0, readLen);
}
zos.setEncoding("GBK");
is.close();
file.delete();
}else{
list1.add(filePh);
list1.add("<br />");
}
}
}catch(Exception e){
e.printStackTrace();
return null;
}finally{
try {
if(is!=null){
is.close();
}
if(zos!=null){
zos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
/*//每隔2个错误文件进行换行操作
List<String> list = new ArrayList<String>();
list.addAll(list1);
int j = 0;
int x = 1;
for (int i = 0; i < list.size(); i++) {
if(i!=0&&i%2==0){
if(j==0){
list1.add(i,"<br />");
j++;
}else{
list1.add(i+x,"<br />");
x++;
}
}
}*/
if(list1.size()>2){
list1=list1.subList(0, list1.size()-1);
}
Map map = new HashMap();
map.put("filePath", uuidPath);
map.put("errorFileList", list1);
return map;
}
public static String getRealPath(String fileName) {
String serverPath = ServletActionContext.getServletContext().getRealPath(getRelativePath(fileName));
return serverPath;
}
public static String getRealPathByRelative(String relativePath) {
String serverPath = ServletActionContext.getServletContext().getRealPath(relativePath);
return serverPath;
}
public static String getRelativePath(String fileName){
UUID uuid = UUID.randomUUID();
String suffix = fileName.substring(fileName.lastIndexOf(".")+1);
String relativePath= "/userfiles/uploadFile/"+uuid+"."+suffix;
return relativePath;
}
public static String getRealRelativePath(String fileName){
String relativePath= "/userfiles/uploadFile/"+fileName;
return relativePath;
}
public static String getRelativePath(String fileName,String url){
UUID uuid = UUID.randomUUID();
String suffix = fileName.substring(fileName.lastIndexOf(".")+1);
String relativePath= url+"\\"+uuid+"."+suffix;
return relativePath;
}
public static File download(String urlString, String filename,String savePath) throws Exception {
URL url = new URL(urlString);
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setConnectTimeout(6*1000);
if(con.getResponseCode() == 302 || con.getResponseCode() == 301){
return download(con.getHeaderField("Location"), filename, savePath);
}else if (con.getResponseCode() != 200) {
System.out.println("url:"+url+"; responseMessage:"+con.getResponseMessage()+"; fileLength: "+ con.getContentLength());
throw new RuntimeException("下载文件失败!");
}
InputStream is = con.getInputStream();
byte[] bs = new byte[1024];
int len;
File sf=new File(savePath);
OutputStream os = new FileOutputStream(sf.getPath());
int count = 0;
while ((len = is.read(bs)) != -1) {
os.write(bs, 0, len);
count += len;
}
System.out.println("url: " + url+", len: "+count);
os.close();
is.close();
return sf;
}
public static File base64ToFile(String base64, String path) {
byte[] buffer;
File file = new File(path);
BASE64Decoder decoder = new BASE64Decoder();
try {
byte[] b = decoder.decodeBuffer(base64);
for (int i = 0; i < b.length; ++i) {
if (b[i] < 0) {
b[i] += 256;
}
}
OutputStream out = new FileOutputStream(path);
out.write(b);
out.flush();
out.close();
return file;
} catch (Exception e) {
throw new RuntimeException("base64转换失败\n" + e.getMessage());
}
}
/**
* 文件转base64字符串
* @param file
* @return
*/
//2-InputStream转化为base64
public static String getBase64FromInputStream(InputStream in) {
// 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
byte[] data = null;
// 读取图片字节数组
try {
ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
byte[] buff = new byte[1024];
int rc = 0;
while ((rc = in.read(buff, 0, 1024)) > 0) {
swapStream.write(buff, 0, rc);
}
data = swapStream.toByteArray();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
String str = new String(Base64.encodeBase64(data));
//System.out.println( "str length: " + str.length() + " str: " + str);
return str;
}
}
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<%
String loginName = (String)session.getAttribute("loginName");
%>
<head xmlns="http://www.w3.org/1999/xhtml">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<!-- <meta name="format-detection" content="telephone=no">-->
<title>银行卡识别</title>
<script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/boot.js" type="text/javascript"></script>
<link href="<%=request.getContextPath()%>/htwyRes/miniui/scripts/miniui/themes/default/miniui.css" rel="stylesheet"
type="text/css"/>
<!-- <link href="../miniui/scripts/miniui_3.7/themes/default/small-mode.css" rel="stylesheet" type="text/css"/>-->
<link href="<%=request.getContextPath()%>/htwyRes/miniui/scripts/miniui/themes/bootstrap/skin.css" rel="stylesheet"
type="text/css"/>
<script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/json2.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2015/ddm/publicService.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/commonJs.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/commonImageJs.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/layer/mobile/layer.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/layerCommonJs.js" type="text/javascript" charset="UTF-8"></script>
<!-- <script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/boot.js" type="text/javascript"></script>-->
<!-- <script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/json2.js" type="text/javascript"></script>-->
<!-- <script src="<%=request.getContextPath()%>/gaojinsoft/y2015/ddm/publicService.js" type="text/javascript" ></script>-->
<s:url action="load" id="load" namespace="/MiniData"></s:url>
<s:url action="delUpload" id="delUpload" namespace="/yami/CustomsDocumentationAction"></s:url>
<s:url action="selectAdd1" id="selectAdd1" namespace="/yami/DealerInformationManager"></s:url>
<s:url action="showselects" id="showselects" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="SaveHouseHold" id="SaveHouseHold" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="SaveHouseHoldSubmit" id="SaveHouseHoldSubmit"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="saveSubmitHistory" id="saveSubmitHistory" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="treeSelectScan" id="treeSelectScan" namespace="/yami/DealerInformationManager"></s:url>
<s:url action="submit" id="submit" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit" id="onButtonEdit" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="ddmEditOnline" id="ddmEditOnline" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="ddmAttachmentUpload" id="ddmAttachmentUpload"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="checkDoc" id="checkDoc" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit2" id="onButtonEdit2" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit3" id="onButtonEdit3" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit4" id="onButtonEdit4" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit5" id="onButtonEdit5" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEditzhbm" id="onButtonEditzhbm"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromData" id="showFromData" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromDataForKH" id="showFromDataForKH"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromDataForWL" id="showFromDataForWL"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="CancelData" id="CancelData" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="Download" id="Download" namespace="/yami/DealerInformationManagerQualification"></s:url>
<s:url action="areaTree" id="areaTree" namespace="/yami/DealerInformationManager"/>
<s:url action="organizationTree" id="organizationTree" namespace="/yami/DealerInformationManager"/>
<s:url action="syntoSap" id="syntoSap" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="syntoKh" id="syntoKh" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="delSyntoKh" id="delSyntoKh" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="fhSetUpHIP" id="fhSetUpHIP" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="saveAddList" id="saveAddList" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="selectRoute" id="selectRoute" namespace="/yami/dvAddress"></s:url>
<s:url action="updateValidityDateEnd" id="updateValidityDateEnd"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="selectBankCodePage" id="selectBankCodePage"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="organizationTree" id="organizationTree"
namespace="/yami/DealerInformationManager"></s:url>
<s:url action="imageIdentification" id="imageIdentification"
namespace="/yami/ImageIdentificationAction"></s:url>
<s:url action="saveStore" id="saveStore"
namespace="/yami/ImageIdentificationAction"></s:url>
<s:url action="attachmentUploadSave" id="attachmentUploadSave" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<!-- <link href="../css/ddm.css" rel="stylesheet" type="text/css"> -->
<style type="text/css">
/*.spanText {*/
/* color: red;*/
/* width: 50px;*/
/*}*/
/*.mybox, .mybox .mini-textbox-input {*/
/* color: #EA0000;*/
/*}*/
.panelSpace {
margin: 10px 10px;
border-top: 1px solid #ec7138;
}
.mustWrite {
color: red;
}
.onexs {
text-align: left;
/*width: 40%;*/
display: block;
margin-top: 10px;
}
.twoxs {
/*text-align: right;*/
/*width: 60%;*/
display: block;
}
td input {
text-align: right;
}
</style>
<style>
.showImageDiv {
/*width: 100%;*/
/*height: 250px;*/
border: grey dashed 1px;
border-radius: 20px;
position: relative;
margin: 10px 20px 10px 20px;
/*display: inline-block;*/
}
.showImageDiv::before {
content: '';
padding-top: 70%;
float: left;
}
.showImageDiv::after {
content: '';
display: block;
clear: both;
}
.showImageImg {
width: 100%;
height: 100%;
border-radius: inherit;
position: absolute;
top: 0px;
}
.showImageText {
/*margin: 0 auto;*/
text-align: center;
margin-top: -0px;
color: grey;
font-size: 25px;
}
.showImageImgShow {
display: inline;
}
.showImageImgHide {
display: none;
}
.showImageImgAddDiv {
width: 80%;
height: 80px;
/*border: grey dashed 1px;*/
border-radius: 10px;
/*margin: ;*/
text-align: center;
margin: 18% auto 0 auto;
}
.showImageImgAddSpan {
color: grey;
font-size: 100px;
line-height: 50px;
}
.showImageImgSpanShow {
z-index: 2;
display: inline-block;
position: absolute;
top: 0px;
right: -5px;
background: red;
width: 40px;
height: 40px;
text-align: center;
font-size: 50px;
line-height: 28px;
border-radius: 50%;
color: #fff;
}
.showImageImgSpanHide {
display: none;
}
.showImageContainerDiv {
display: flex;
margin: 10px;
}
</style>
<style>
.ystitle {
margin: 10px 10px;
font-size: 14px
/*border-top: 1px solid #ec7138;*/
}
</style>
<!-- </>-->
<!-- .panelSpace {-->
<!-- margin: 10px 10px;-->
<!-- border-top: 1px solid #ec7138;-->
<!-- }-->
<!-- </style>-->
<style>
body {
font-size: 14px;
}
.mini-panel-header {
height: 30px;
}
.mini-panel {
font-size: 14px;
}
.mini-tools span {
display: inline-block;
width: 30px;
height: 30px;
overflow: hidden;
cursor: pointer;
margin-right: 2px;
}
.mini-textbox{
height: 30px;
}
.mini-textbox-border{
height: 28px;
}
.mini-textbox-input {
height: 28px;
font-size: 14px;
color: #6e6e6e;
}
.mini-button-text {
padding: 5px 8px 5px 8px;
}
.mini-button {
font-size: 14px;
}
.mini-buttonedit {
height: 30px;
}
.mini-buttonedit-border {
height: 28px;
padding-right: 33px;
}
.mini-buttonedit-button{
width: 28px;
height: 28px;
}
.mini-buttonedit-input {
font-size: 14px;
height: 28px;
color: #6e6e6e;
}
.mini-buttonedit-icon {
margin-top: 6px;
margin-left: 7px;
}
.mini-button-text {
padding: 5px 8px 5px 8px;
}
.mini-popup {
width: 85%;
}
</style>
</head>
<body style="margin:10px;">
<div style="margin: 10px 10px">
<form id="formImage">
<div class="showImageDiv" id="busiess">
<div class="showImageImgAddDiv" onclick="divSelectImageFun(this)">
<span class="showImageImgAddSpan">+</span>
</div>
<input type="file" accept="image/*" onchange="showImageFileChageFun(this)"
style="display: none;">
<p class="showImageText">请上传银行卡</p>
<img src="" class="showImageImg showImageImgHide">
<span class="showImageImgSpanHide" onclick="showImageDeleteFun(this,'replace')">×</span>
<input type="text" value="" style="visibility: hidden" name="busiess" >
</div>
<!-- <div class="showImageDiv" id="cardBack">-->
<!-- <div class="showImageImgAddDiv" onclick="divSelectImageFun(this)">-->
<!-- <span class="showImageImgAddSpan">+</span>-->
<!-- </div>-->
<!-- <input type="file" accept="image/*" capture="camera" onchange="showImageFileChageFun(this)"-->
<!-- style="display: none;">-->
<!-- <p class="showImageText">请上传身份证反面</p>-->
<!-- <img src="" class="showImageImg showImageImgHide">-->
<!-- <span class="showImageImgSpanHide" onclick="showImageDeleteFun(this,'replace')">×</span>-->
<!-- <input type="text" value="" style="visibility: hidden" name="cardBack">-->
<!-- </div>-->
</form>
</div>
<div style="margin: 10px 10px">
<div style="width: 60%;margin: 0 auto">
<a class="mini-button"
style="width:100%;color: white;background-color: #357ebd; font-size: 25px;height: 30px;padding-top: 5px"
onclick="identificationFun()">进行识别</a>
</div>
</div>
<form id="form1" method="post" style="margin:0; padding:0">
<div>
<div class="ystitle" style="background-color:#fff;">
<span style="color :#ec7138; ">基本信息</span><br>
</div>
<div class="panelSpace">
<table id="table1" class="form-table" style="width:100%;" border="0">
<tr>
<td align="right" class="onexs">开户银行:</td>
<td align="left" class="twoxs">
<input style="width:100%;" class="mini-textbox" id="cardName"
name="cardName" value=''/></td>
</tr>
<!-- <tr>-->
<!-- <td align="right" class="onexs">性别:</td>-->
<!-- <td align="left" class="twoxs">-->
<!-- <input style="width:100%;" class="mini-textbox" id="cardSex"-->
<!-- name="cardSex" value=''/></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td align="right" class="onexs">地址:</td>-->
<!-- <td align="left" class="twoxs">-->
<!-- <input style="width:100%;" class="mini-textbox" id="cardAddr"-->
<!-- name="cardAddr" value=''/></td>-->
<!-- </tr>-->
<tr>
<td align="right" class="onexs">银行卡号:</td>
<td align="left" class="twoxs">
<input style="width:100%;" class="mini-textbox" id="cardNum"
name="cardNum" value=''/></td>
</tr>
<!-- <tr>-->
<!-- <td align="right" class="onexs">有效期:</td>-->
<!-- <td align="left" class="twoxs">-->
<!-- <input style="width:100%;" class="mini-textbox" id="endDate"-->
<!-- name="cardAddr" value=''/></td>-->
<!-- </tr>-->
</table>
</div>
</div>
</form>
<form id="form2" method="post" style="margin:0; padding:0">
</form>
<form id="form3" method="post" style="margin:0; padding:0">
</form>
<form id="form5" method="post" style="margin:0; padding:0">
</form>
<div class="panelSpace">
<div class="mini-toolbar" style="text-align:center;padding-top:8px;padding-bottom:8px;" borderStyle="border:0;">
<a class="mini-button" style="width:130px;color: white;background: #357ebd" onclick="onOk()">确定</a>
<span style="display:inline-block;width:25px;"></span>
<a class="mini-button" style="width:130px;color: white;background: #357ebd" onclick="onCancel()">取消</a>
</div>
</div>
<!--//用到空白加大-->
<div style="width: 100%;height: 200px">
</div>
</body>
<script type="text/javascript">
var dataInit = {
save:0,
uuid:'',
uploadFileName:'',
credentialsCode:'',
endDate:''
};
mini.parse();
function SetData(data) {
if(data){
dataInit = data;
}
}
function GetData() {
var data = {};
data.cardNum = mini.get("cardNum").getValue();
data.cardName = mini.get("cardName").getValue();
// data.endDate = mini.get("endDate").getValue();
// data.cardName = mini.get("cardName").getValue();
// data.cardNum = mini.get("cardNum").getValue();
// var dataURL = getShowImageInputTextValue('busiess');
// data.imageData = dataURL;
return data;
}
function showImageFileChageFun(th) {
// var ds= $(th).parent();
var filePath = $(th).val();//读取图片路径
if (!filePath) {
return;
}
if (filePath == "") {
return;
}
//读取文件进行显示
readImageFileAsDataURL(th.files[0], function (e) {
console.info("e.target.result len = " + e.target.result.length);
compressImageData(e.target.result, 1, function (data) {
console.info("data len = " + data.length)
setImageToShowImageContainerForTh(th, data, 2);
setShowImageInputTextValue(th, data);
});
});
}
function getFileDateString(base64ImageData){
var temp = replaceAll(base64ImageData,"data:image/jpeg;base64,","");
temp = replaceAll(temp,"data:image/jpg;base64,","");
temp = replaceAll(temp,"data:image/png;base64,","");
temp = replaceAll(temp,"data:image/bmp;base64,","");
return temp;
}
function identificationFun() {
var formDataTemp = getFormData("formImage");
console.info(formDataTemp);
if (formDataTemp.busiess != "") {
var fd = new FormData();
var temp = getFileDateString(formDataTemp.busiess);
// var temp = formDataTemp.cardPositive;
// fd.append("fileImage", encodeURI(temp));
fd.append("fileImage", convertBase64UrlToBlob(temp));
// for(var i in dataTemp){
// if(i=='imgUrl'){
// fd.append("fileList", convertBase64UrlToBlob(dataTemp.imgUrl));
// }else{
// fd.append(i, encodeURI(dataTemp[i]));
// }
// }
// for (var i in formDataTemp) {
// fd.append(i, encodeURI(formDataTemp[i]));
// }
fd.append("imageType", "3");
console.info(fd);
// var form = new mini.Form("formImage");
// var teet = $("#test").val();
// alert(formData)
// var formData = form.getData();
// console.info(formData);
var msgid = mini.loading("操作中,请稍后......");
$.ajax({
url: '${imageIdentification}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.flag==1){
mini.get("cardNum").setValue(resultData.data.result.bank_card_number);
mini.get("cardName").setValue(resultData.data.result.bank_name);
// mini.get("endDate").setValue(resultData.data['有效期']);
} else {
openAlert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid);
openAlert(result.msg, "提示");
}
});
}
// if (formDataTemp.cardBack != "") {
//
// }
}
function getFileDateString(base64ImageData){
var temp = replaceAll(base64ImageData,"data:image/jpeg;base64,","");
temp = replaceAll(temp,"data:image/jpg;base64,","");
temp = replaceAll(temp,"data:image/png;base64,","");
temp = replaceAll(temp,"data:image/bmp;base64,","");
return temp;
}
//===========
function CloseWindow(action) {
if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
else window.close();
}
function onOk() {
if(!dataInit){
CloseWindow("ok");
}
if(dataInit.save==0){
CloseWindow("ok");
}
var formDataTemp = getFormData("formImage");
console.info(formDataTemp);
if (formDataTemp.busiess != "") {
var fd = new FormData();
var temp = getFileDateString(formDataTemp.busiess);
fd.append("uploadFile", convertBase64UrlToBlob(temp));
fd.append("uploadFileName", encodeURI(dataInit.uploadFileName));
fd.append("uuid", encodeURI(dataInit.uuid));
fd.append("credentialsCode", encodeURI(dataInit.credentialsCode));
// fd.append("fileDate", encodeURI(dateTemp));
var msgid = mini.loading("操作中,请稍后......");
$.ajax({
url: '${attachmentUploadSave}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.flag==1){
CloseWindow("ok");
} else {
openAlert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid);
openAlert(result.msg, "提示");
}
});
}
CloseWindow("ok");
}
function onCancel() {
CloseWindow("cancel");
}
</script>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<%
String loginName = (String)session.getAttribute("loginName");
%>
<head xmlns="http://www.w3.org/1999/xhtml">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
<!-- <meta name="format-detection" content="telephone=no">-->
<title>营业执照识别</title>
<script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/boot.js" type="text/javascript"></script>
<link href="<%=request.getContextPath()%>/htwyRes/miniui/scripts/miniui/themes/default/miniui.css" rel="stylesheet"
type="text/css"/>
<!-- <link href="../miniui/scripts/miniui_3.7/themes/default/small-mode.css" rel="stylesheet" type="text/css"/>-->
<link href="<%=request.getContextPath()%>/htwyRes/miniui/scripts/miniui/themes/bootstrap/skin.css" rel="stylesheet"
type="text/css"/>
<script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/json2.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2015/ddm/publicService.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/commonJs.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/commonImageJs.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/layer/mobile/layer.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/layerCommonJs.js" type="text/javascript" charset="UTF-8"></script>
<!-- <script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/boot.js" type="text/javascript"></script>-->
<!-- <script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/json2.js" type="text/javascript"></script>-->
<!-- <script src="<%=request.getContextPath()%>/gaojinsoft/y2015/ddm/publicService.js" type="text/javascript" ></script>-->
<s:url action="load" id="load" namespace="/MiniData"></s:url>
<s:url action="delUpload" id="delUpload" namespace="/yami/CustomsDocumentationAction"></s:url>
<s:url action="selectAdd1" id="selectAdd1" namespace="/yami/DealerInformationManager"></s:url>
<s:url action="showselects" id="showselects" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="SaveHouseHold" id="SaveHouseHold" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="SaveHouseHoldSubmit" id="SaveHouseHoldSubmit"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="saveSubmitHistory" id="saveSubmitHistory" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="treeSelectScan" id="treeSelectScan" namespace="/yami/DealerInformationManager"></s:url>
<s:url action="submit" id="submit" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit" id="onButtonEdit" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="ddmEditOnline" id="ddmEditOnline" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="ddmAttachmentUpload" id="ddmAttachmentUpload"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="checkDoc" id="checkDoc" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit2" id="onButtonEdit2" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit3" id="onButtonEdit3" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit4" id="onButtonEdit4" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit5" id="onButtonEdit5" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEditzhbm" id="onButtonEditzhbm"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromData" id="showFromData" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromDataForKH" id="showFromDataForKH"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromDataForWL" id="showFromDataForWL"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="CancelData" id="CancelData" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="Download" id="Download" namespace="/yami/DealerInformationManagerQualification"></s:url>
<s:url action="areaTree" id="areaTree" namespace="/yami/DealerInformationManager"/>
<s:url action="organizationTree" id="organizationTree" namespace="/yami/DealerInformationManager"/>
<s:url action="syntoSap" id="syntoSap" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="syntoKh" id="syntoKh" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="delSyntoKh" id="delSyntoKh" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="fhSetUpHIP" id="fhSetUpHIP" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="saveAddList" id="saveAddList" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="selectRoute" id="selectRoute" namespace="/yami/dvAddress"></s:url>
<s:url action="updateValidityDateEnd" id="updateValidityDateEnd"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="selectBankCodePage" id="selectBankCodePage"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="organizationTree" id="organizationTree"
namespace="/yami/DealerInformationManager"></s:url>
<s:url action="imageIdentification" id="imageIdentification"
namespace="/yami/ImageIdentificationAction"></s:url>
<s:url action="saveStore" id="saveStore"
namespace="/yami/ImageIdentificationAction"></s:url>
<s:url action="attachmentUploadSave" id="attachmentUploadSave" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<!-- <link href="../css/ddm.css" rel="stylesheet" type="text/css"> -->
<style type="text/css">
/*.spanText {*/
/* color: red;*/
/* width: 50px;*/
/*}*/
/*.mybox, .mybox .mini-textbox-input {*/
/* color: #EA0000;*/
/*}*/
.panelSpace {
margin: 10px 10px;
border-top: 1px solid #ec7138;
}
.mustWrite {
color: red;
}
.onexs {
text-align: left;
/*width: 40%;*/
display: block;
margin-top: 10px;
}
.twoxs {
/*text-align: right;*/
/*width: 60%;*/
display: block;
}
td input {
text-align: right;
}
</style>
<style>
.showImageDiv {
/*width: 100%;*/
/*height: 250px;*/
border: grey dashed 1px;
border-radius: 20px;
position: relative;
margin: 10px 20px 10px 20px;
/*display: inline-block;*/
}
.showImageDiv::before {
content: '';
padding-top: 70%;
float: left;
}
.showImageDiv::after {
content: '';
display: block;
clear: both;
}
.showImageImg {
width: 100%;
height: 100%;
border-radius: inherit;
position: absolute;
top: 0px;
}
.showImageText {
/*margin: 0 auto;*/
text-align: center;
margin-top: -0px;
color: grey;
font-size: 25px;
}
.showImageImgShow {
display: inline;
}
.showImageImgHide {
display: none;
}
.showImageImgAddDiv {
width: 80%;
height: 80px;
/*border: grey dashed 1px;*/
border-radius: 10px;
/*margin: ;*/
text-align: center;
margin: 18% auto 0 auto;
}
.showImageImgAddSpan {
color: grey;
font-size: 100px;
line-height: 50px;
}
.showImageImgSpanShow {
z-index: 2;
display: inline-block;
position: absolute;
top: 0px;
right: -5px;
background: red;
width: 40px;
height: 40px;
text-align: center;
font-size: 50px;
line-height: 28px;
border-radius: 50%;
color: #fff;
}
.showImageImgSpanHide {
display: none;
}
.showImageContainerDiv {
display: flex;
margin: 10px;
}
</style>
<style>
.ystitle {
margin: 10px 10px;
font-size: 14px
/*border-top: 1px solid #ec7138;*/
}
</style>
<style>
body {
font-size: 14px;
}
.mini-panel-header {
height: 30px;
}
.mini-panel {
font-size: 14px;
}
.mini-tools span {
display: inline-block;
width: 30px;
height: 30px;
overflow: hidden;
cursor: pointer;
margin-right: 2px;
}
.mini-textbox{
height: 30px;
}
.mini-textbox-border{
height: 28px;
}
.mini-textbox-input {
height: 28px;
font-size: 14px;
color: #6e6e6e;
}
.mini-button-text {
padding: 5px 8px 5px 8px;
}
.mini-button {
font-size: 14px;
}
.mini-buttonedit {
height: 30px;
}
.mini-buttonedit-border {
height: 28px;
padding-right: 33px;
}
.mini-buttonedit-button{
width: 28px;
height: 28px;
}
.mini-buttonedit-input {
font-size: 14px;
height: 28px;
color: #6e6e6e;
}
.mini-buttonedit-icon {
margin-top: 6px;
margin-left: 7px;
}
.mini-button-text {
padding: 5px 8px 5px 8px;
}
.endTimeClass{
height: 28px;
font-size: 14px;
color: #6e6e6e;
font-family: Tahoma, Verdana, 宋体;
width: 98%;
text-align: right;
border: solid 1px #a5acb5;
border-radius: 3px;
}
</style>
<!-- </>-->
<!-- .panelSpace {-->
<!-- margin: 10px 10px;-->
<!-- border-top: 1px solid #ec7138;-->
<!-- }-->
<!-- </style>-->
</head>
<body style="margin:10px;">
<div style="margin: 10px 10px">
<form id="formImage">
<div class="showImageDiv" id="busiess">
<div class="showImageImgAddDiv" onclick="divSelectImageFun(this)">
<span class="showImageImgAddSpan">+</span>
</div>
<input type="file" accept="image/*" onchange="showImageFileChageFun(this)"
style="display: none;">
<p class="showImageText">请上传营业执照</p>
<img src="" class="showImageImg showImageImgHide">
<span class="showImageImgSpanHide" onclick="showImageDeleteFun(this,'replace')">×</span>
<input type="text" value="" style="visibility: hidden" name="busiess" >
</div>
<!-- <div class="showImageDiv" id="cardBack">-->
<!-- <div class="showImageImgAddDiv" onclick="divSelectImageFun(this)">-->
<!-- <span class="showImageImgAddSpan">+</span>-->
<!-- </div>-->
<!-- <input type="file" accept="image/*" capture="camera" onchange="showImageFileChageFun(this)"-->
<!-- style="display: none;">-->
<!-- <p class="showImageText">请上传身份证反面</p>-->
<!-- <img src="" class="showImageImg showImageImgHide">-->
<!-- <span class="showImageImgSpanHide" onclick="showImageDeleteFun(this,'replace')">×</span>-->
<!-- <input type="text" value="" style="visibility: hidden" name="cardBack">-->
<!-- </div>-->
</form>
</div>
<div style="margin: 10px 10px">
<div style="width: 60%;margin: 0 auto">
<a class="mini-button"
style="width:100%;color: white;background-color: #357ebd; font-size: 25px;height: 30px;padding-top: 5px"
onclick="identificationFun()">进行识别</a>
</div>
</div>
<form id="form1" method="post" style="margin:0; padding:0">
<div>
<div class="ystitle" style="background-color:#fff;">
<span style="color :#ec7138; ">基本信息</span><br>
</div>
<div class="panelSpace">
<table id="table1" class="form-table" style="width:100%;" border="0">
<tr>
<td align="right" class="onexs">单位名称:</td>
<td align="left" class="twoxs">
<input style="width:100%;" class="mini-textbox" id="company"
name="company" value=''/></td>
</tr>
<tr>
<td align="right" class="onexs">法人:</td>
<td align="left" class="twoxs">
<input style="width:100%;" class="mini-textbox" id="cardName"
name="cardName" value=''/></td>
</tr>
<!-- <tr>-->
<!-- <td align="right" class="onexs">性别:</td>-->
<!-- <td align="left" class="twoxs">-->
<!-- <input style="width:100%;" class="mini-textbox" id="cardSex"-->
<!-- name="cardSex" value=''/></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td align="right" class="onexs">地址:</td>-->
<!-- <td align="left" class="twoxs">-->
<!-- <input style="width:100%;" class="mini-textbox" id="cardAddr"-->
<!-- name="cardAddr" value=''/></td>-->
<!-- </tr>-->
<tr>
<td align="right" class="onexs">社会信用代码:</td>
<td align="left" class="twoxs">
<input style="width:100%;" class="mini-textbox" id="cardNum"
name="cardNum" value=''/></td>
</tr>
<tr>
<td align="right" class="onexs">有效期:</td>
<td align="left" class="twoxs">
<input class="endTimeClass" id="endDateTemp" type="date" value="" name="endDateTemp" style="width:100%;text-align: right" onchange="onEndDateFun(this)">
<input style="width:100%; display: none" class="mini-datepicker" id="endDate"
name="endDate" value=''/></td>
</tr>
</table>
</div>
</div>
</form>
<form id="form2" method="post" style="margin:0; padding:0">
</form>
<form id="form3" method="post" style="margin:0; padding:0">
</form>
<form id="form5" method="post" style="margin:0; padding:0">
</form>
<div class="panelSpace">
<div class="mini-toolbar" style="text-align:center;padding-top:8px;padding-bottom:8px;" borderStyle="border:0;">
<a class="mini-button" style="width:130px;color: white;background: #357ebd" onclick="onOk()">确定</a>
<span style="display:inline-block;width:25px;"></span>
<a class="mini-button" style="width:130px;color: white;background: #357ebd" onclick="onCancel()">取消</a>
</div>
</div>
<!--//用到空白加大-->
<div style="width: 100%;height: 200px">
</div>
</body>
<script type="text/javascript">
var dataInit = {
save:0,
uuid:'',
uploadFileName:'',
credentialsCode:'',
endDate:''
};
mini.parse();
function SetData(data) {
if(data){
dataInit = data;
}
}
function GetData() {
var data = {};
data.company = mini.get("company").getValue();
data.cardNum = mini.get("cardNum").getValue();
data.cardName = mini.get("cardName").getValue();
data.endDate = mini.get("endDate").getValue();
// data.endDate = $("#endDateTemp").val();
// data.cardName = mini.get("cardName").getValue();
// data.cardNum = mini.get("cardNum").getValue();
// var dataURL = getShowImageInputTextValue('busiess');
// data.imageData = dataURL;
return data;
}
function showImageFileChageFun(th) {
// var ds= $(th).parent();
var filePath = $(th).val();//读取图片路径
if (!filePath) {
return;
}
if (filePath == "") {
return;
}
//读取文件进行显示
readImageFileAsDataURL(th.files[0], function (e) {
console.info("e.target.result len = " + e.target.result.length);
compressImageData(e.target.result, 1, function (data) {
console.info("data len = " + data.length)
setImageToShowImageContainerForTh(th, data, 2);
setShowImageInputTextValue(th, data);
});
});
}
function identificationFun() {
var formDataTemp = getFormData("formImage");
console.info(formDataTemp);
if (formDataTemp.busiess != "") {
var fd = new FormData();
var temp = replaceAll(formDataTemp.busiess,"data:image/jpeg;base64,","");
// var temp = formDataTemp.cardPositive;
// fd.append("fileImage", encodeURI(temp));
fd.append("fileImage", convertBase64UrlToBlob(temp));
// for(var i in dataTemp){
// if(i=='imgUrl'){
// fd.append("fileList", convertBase64UrlToBlob(dataTemp.imgUrl));
// }else{
// fd.append(i, encodeURI(dataTemp[i]));
// }
// }
// for (var i in formDataTemp) {
// fd.append(i, encodeURI(formDataTemp[i]));
// }
fd.append("imageType", "2");
console.info(fd);
// var form = new mini.Form("formImage");
// var teet = $("#test").val();
// alert(formData)
// var formData = form.getData();
// console.info(formData);
var msgid = mini.loading("操作中,请稍后......");
$.ajax({
url: '${imageIdentification}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.flag==1){
mini.get("company").setValue(resultData.data['单位名称']);
mini.get("cardNum").setValue(resultData.data['社会信用代码']);
mini.get("cardName").setValue(resultData.data['法人']);
if(resultData.data['有效期']){
if(resultData.data['有效期']!=""){
if(resultData.data['有效期'].length>=11){
var y= resultData.data['有效期'].substring(0,4);
var m= resultData.data['有效期'].substring(5,7);
var d= resultData.data['有效期'].substring(8,10);
mini.get("endDate").setValue(y+"-"+m+"-"+d);
$("#endDateTemp").val(y+"-"+m+"-"+d)
}
}
}
} else {
mini.alert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid);
mini.alert(result.msg, "提示");
}
});
}
// if (formDataTemp.cardBack != "") {
//
// }
}
function onEndDateFun(th){
var time = $("#endDateTemp").val();
// time = replaceAll(time,"\\","-");
mini.get("endDate").setValue(time);
}
function getFileDateString(base64ImageData){
var temp = replaceAll(base64ImageData,"data:image/jpeg;base64,","");
temp = replaceAll(temp,"data:image/jpg;base64,","");
temp = replaceAll(temp,"data:image/png;base64,","");
temp = replaceAll(temp,"data:image/bmp;base64,","");
return temp;
}
//===========
function CloseWindow(action) {
if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
else window.close();
}
function onOk() {
if(!dataInit){
CloseWindow("ok");
}
if(dataInit.save==0){
CloseWindow("ok");
}
var formDataTemp = getFormData("formImage");
console.info(formDataTemp);
if (formDataTemp.busiess != "") {
var fd = new FormData();
var temp = getFileDateString(formDataTemp.busiess);
fd.append("uploadFile", convertBase64UrlToBlob(temp));
fd.append("uploadFileName", encodeURI(dataInit.uploadFileName));
fd.append("uuid", encodeURI(dataInit.uuid));
fd.append("credentialsCode", encodeURI(dataInit.credentialsCode));
// fd.append("fileDate", encodeURI(dateTemp));
var dateTemp = mini.get("endDate").getFormValue();
console.info("endDate == " + dateTemp);
fd.append("fileDate", encodeURI(dateTemp));
var msgid = mini.loading("操作中,请稍后......");
$.ajax({
url: '${attachmentUploadSave}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.flag==1){
CloseWindow("ok");
} else {
openAlert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid);
openAlert(result.msg, "提示");
}
});
}
CloseWindow("ok");
}
function onCancel() {
CloseWindow("cancel");
}
</script>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<%
String loginName = (String)session.getAttribute("loginName");
%>
<head xmlns="http://www.w3.org/1999/xhtml">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<!-- <meta name="format-detection" content="telephone=no">-->
<title>身份证识别</title>
<script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/boot.js" type="text/javascript"></script>
<link href="<%=request.getContextPath()%>/htwyRes/miniui/scripts/miniui/themes/default/miniui.css" rel="stylesheet"
type="text/css"/>
<!-- <link href="../miniui/scripts/miniui_3.7/themes/default/small-mode.css" rel="stylesheet" type="text/css"/>-->
<link href="<%=request.getContextPath()%>/htwyRes/miniui/scripts/miniui/themes/bootstrap/skin.css" rel="stylesheet"
type="text/css"/>
<script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/json2.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2015/ddm/publicService.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/commonJs.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/commonImageJs.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/layer/mobile/layer.js" type="text/javascript"></script>
<script src="<%=request.getContextPath()%>/gaojinsoft/y2017/me/js/layerCommonJs.js" type="text/javascript" charset="UTF-8"></script>
<!-- <script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/boot.js" type="text/javascript"></script>-->
<!-- <script src="<%=request.getContextPath()%>/htwyRes/miniui/scripts/json2.js" type="text/javascript"></script>-->
<!-- <script src="<%=request.getContextPath()%>/gaojinsoft/y2015/ddm/publicService.js" type="text/javascript" ></script>-->
<s:url action="load" id="load" namespace="/MiniData"></s:url>
<s:url action="delUpload" id="delUpload" namespace="/yami/CustomsDocumentationAction"></s:url>
<s:url action="selectAdd1" id="selectAdd1" namespace="/yami/DealerInformationManager"></s:url>
<s:url action="showselects" id="showselects" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="SaveHouseHold" id="SaveHouseHold" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="SaveHouseHoldSubmit" id="SaveHouseHoldSubmit"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="saveSubmitHistory" id="saveSubmitHistory" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="treeSelectScan" id="treeSelectScan" namespace="/yami/DealerInformationManager"></s:url>
<s:url action="submit" id="submit" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit" id="onButtonEdit" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="ddmEditOnline" id="ddmEditOnline" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="ddmAttachmentUpload" id="ddmAttachmentUpload"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="checkDoc" id="checkDoc" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit2" id="onButtonEdit2" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit3" id="onButtonEdit3" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit4" id="onButtonEdit4" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEdit5" id="onButtonEdit5" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="onButtonEditzhbm" id="onButtonEditzhbm"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromData" id="showFromData" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromDataForKH" id="showFromDataForKH"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="showFromDataForWL" id="showFromDataForWL"
namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="CancelData" id="CancelData" namespace="/yami/NewHouseholdDocumentInterfaceAction"></s:url>
<s:url action="Download" id="Download" namespace="/yami/DealerInformationManagerQualification"></s:url>
<s:url action="areaTree" id="areaTree" namespace="/yami/DealerInformationManager"/>
<s:url action="organizationTree" id="organizationTree" namespace="/yami/DealerInformationManager"/>
<s:url action="syntoSap" id="syntoSap" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="syntoKh" id="syntoKh" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="delSyntoKh" id="delSyntoKh" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="fhSetUpHIP" id="fhSetUpHIP" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="saveAddList" id="saveAddList" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="selectRoute" id="selectRoute" namespace="/yami/dvAddress"></s:url>
<s:url action="updateValidityDateEnd" id="updateValidityDateEnd"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="selectBankCodePage" id="selectBankCodePage"
namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<s:url action="organizationTree" id="organizationTree"
namespace="/yami/DealerInformationManager"></s:url>
<s:url action="imageIdentification" id="imageIdentification"
namespace="/yami/ImageIdentificationAction"></s:url>
<s:url action="saveStore" id="saveStore"
namespace="/yami/ImageIdentificationAction"></s:url>
<s:url action="attachmentUploadSave" id="attachmentUploadSave" namespace="/yami/NewCustomsDocumentationInterface"></s:url>
<!-- <link href="../css/ddm.css" rel="stylesheet" type="text/css"> -->
<style type="text/css">
/*.spanText {*/
/* color: red;*/
/* width: 50px;*/
/*}*/
/*.mybox, .mybox .mini-textbox-input {*/
/* color: #EA0000;*/
/*}*/
.panelSpace {
margin: 10px 10px;
border-top: 1px solid #ec7138;
}
.mustWrite {
color: red;
}
.onexs {
text-align: left;
/*width: 40%;*/
display: block;
margin-top: 10px;
}
.twoxs {
/*text-align: right;*/
/*width: 60%;*/
display: block;
}
td input {
text-align: right;
}
</style>
<style>
.showImageDiv {
/*width: 100%;*/
/*height: 250px;*/
border: grey dashed 1px;
border-radius: 20px;
position: relative;
margin: 10px 20px 10px 20px;
/*display: inline-block;*/
}
.showImageDiv::before {
content: '';
padding-top: 70%;
float: left;
}
.showImageDiv::after {
content: '';
display: block;
clear: both;
}
.showImageImg {
width: 100%;
height: 100%;
border-radius: inherit;
position: absolute;
top: 0px;
}
.showImageText {
/*margin: 0 auto;*/
text-align: center;
margin-top: -0px;
color: grey;
font-size: 25px;
}
.showImageImgShow {
display: inline;
}
.showImageImgHide {
display: none;
}
.showImageImgAddDiv {
width: 80%;
height: 80px;
/*border: grey dashed 1px;*/
border-radius: 10px;
/*margin: ;*/
text-align: center;
margin: 18% auto 0 auto;
}
.showImageImgAddSpan {
color: grey;
font-size: 100px;
line-height: 50px;
}
.showImageImgSpanShow {
z-index: 2;
display: inline-block;
position: absolute;
top: 0px;
right: -5px;
background: red;
width: 40px;
height: 40px;
text-align: center;
font-size: 50px;
line-height: 28px;
border-radius: 50%;
color: #fff;
}
.showImageImgSpanHide {
display: none;
}
.showImageContainerDiv {
display: flex;
margin: 10px;
}
</style>
<style>
.ystitle {
margin: 10px 10px;
font-size: 14px
/*border-top: 1px solid #ec7138;*/
}
</style>
<style>
body {
font-size: 14px;
}
.mini-panel-header {
height: 30px;
}
.mini-panel {
font-size: 14px;
}
.mini-tools span {
display: inline-block;
width: 30px;
height: 30px;
overflow: hidden;
cursor: pointer;
margin-right: 2px;
}
.mini-textbox{
height: 30px;
}
.mini-textbox-border{
height: 28px;
}
.mini-textbox-input {
height: 28px;
font-size: 14px;
color: #6e6e6e;
}
.mini-button-text {
padding: 5px 8px 5px 8px;
}
.mini-button {
font-size: 14px;
}
.mini-buttonedit {
height: 30px;
}
.mini-buttonedit-border {
height: 28px;
padding-right: 33px;
}
.mini-buttonedit-button{
width: 28px;
height: 28px;
}
.mini-buttonedit-input {
font-size: 14px;
height: 28px;
color: #6e6e6e;
}
.mini-buttonedit-icon {
margin-top: 6px;
margin-left: 7px;
}
.mini-button-text {
padding: 5px 8px 5px 8px;
}
.mini-popup {
background: white;
border: 1px solid #8B8B8B;
overflow: auto;
position: absolute;
left: 0;
top: 0;
font-size: 9pt;
font-family: Tahoma, Verdana, 宋体;
width: 85%;
}
.mini-calendar-title {
font-size: 14px;
}
.endTimeClass{
height: 28px;
font-size: 14px;
color: #6e6e6e;
font-family: Tahoma, Verdana, 宋体;
width: 98%;
text-align: right;
border: solid 1px #a5acb5;
border-radius: 3px;
}
</style>
<!-- </>-->
<!-- .panelSpace {-->
<!-- margin: 10px 10px;-->
<!-- border-top: 1px solid #ec7138;-->
<!-- }-->
<!-- </style>-->
</head>
<body style="margin:10px;">
<div style="margin: 10px 10px">
<form id="formImage">
<div class="showImageDiv" id="cardPositive">
<div class="showImageImgAddDiv" onclick="divSelectImageFun(this)">
<span class="showImageImgAddSpan">+</span>
</div>
<input type="file" accept="image/*" onchange="showImageFileChageFun(this)"
style="display: none;">
<p class="showImageText">请上传身份证正面</p>
<img src="" class="showImageImg showImageImgHide">
<span class="showImageImgSpanHide" onclick="showImageDeleteFun(this,'replace')">×</span>
<input type="text" value="" style="visibility: hidden" name="cardPositive" >
</div>
<div class="showImageDiv" id="cardBack">
<div class="showImageImgAddDiv" onclick="divSelectImageFun(this)">
<span class="showImageImgAddSpan">+</span>
</div>
<input type="file" accept="image/*" onchange="showImageFileChageFun(this)"
style="display: none;">
<p class="showImageText">请上传身份证反面</p>
<img src="" class="showImageImg showImageImgHide">
<span class="showImageImgSpanHide" onclick="showImageDeleteFun(this,'replace')">×</span>
<input type="text" value="" style="visibility: hidden" name="cardBack">
</div>
</form>
</div>
<div style="margin: 10px 10px">
<div style="width: 60%;margin: 0 auto">
<a class="mini-button"
style="width:100%;color: white;background-color: #357ebd; font-size: 25px;height: 30px;padding-top: 5px"
onclick="identificationFun()">进行识别</a>
</div>
</div>
<form id="form1" method="post" style="margin:0; padding:0">
<div>
<div class="ystitle" style="background-color:#fff;">
<span style="color :#ec7138; ">基本信息</span><br>
</div>
<div class="panelSpace">
<table id="table1" class="form-table" style="width:100%;" border="0">
<tr>
<td align="right" class="onexs">姓名:</td>
<td align="left" class="twoxs">
<input style="width:100%;" class="mini-textbox" id="cardName"
name="cardName" value=''/></td>
</tr>
<!-- <tr>-->
<!-- <td align="right" class="onexs">性别:</td>-->
<!-- <td align="left" class="twoxs">-->
<!-- <input style="width:100%;" class="mini-textbox" id="cardSex"-->
<!-- name="cardSex" value=''/></td>-->
<!-- </tr>-->
<!-- <tr>-->
<!-- <td align="right" class="onexs">地址:</td>-->
<!-- <td align="left" class="twoxs">-->
<!-- <input style="width:100%;" class="mini-textbox" id="cardAddr"-->
<!-- name="cardAddr" value=''/></td>-->
<!-- </tr>-->
<tr>
<td align="right" class="onexs">身份证号码:</td>
<td align="left" class="twoxs">
<input style="width:100%;" class="mini-textbox" id="cardNum"
name="cardAddr" value=''/></td>
</tr>
<tr>
<td align="right" class="onexs">有效期:</td>
<td align="left" class="twoxs">
<input class="endTimeClass" id="endDateTemp" type="date" value="" name="endDateTemp" style="width:100%;text-align: right" onchange="onEndDateFun(this)">
<input style="width:100%; display: none" class="mini-datepicker" id="endDate"
name="endDate" value='' /></td>
</tr>
</table>
</div>
</div>
</form>
<form id="form2" method="post" style="margin:0; padding:0">
</form>
<form id="form3" method="post" style="margin:0; padding:0">
</form>
<form id="form5" method="post" style="margin:0; padding:0">
</form>
<div class="panelSpace">
<div class="mini-toolbar" style="text-align:center;padding-top:8px;padding-bottom:8px;" borderStyle="border:0;">
<a class="mini-button" style="width:130px;color: white;background: #357ebd" onclick="onOk()">确定</a>
<span style="display:inline-block;width:25px;"></span>
<a class="mini-button" style="width:130px;color: white;background: #357ebd" onclick="onCancel()">取消</a>
</div>
</div>
<!--//用到空白加大-->
<div style="width: 100%;height: 200px">
</div>
</body>
<script type="text/javascript">
mini.parse();
var fileIdList = [];
var dataInit = {
save:0,
uuid:'',
uploadFileName:'',
credentialsCode:'',
endDate:''
};
function GetData() {
var data = {};
data.cardNum = mini.get("cardNum").getValue();
data.cardName = mini.get("cardName").getValue();
data.endDate = mini.get("endDate").getValue();
// data.endDate = $("#endDateTemp").val();
// var dataURL = getShowImageInputTextValue('cardPositive');
// data.imageData = dataURL;
data.fileIdList= fileIdList;
return data;
}
function SetData(data) {
if(data){
dataInit = data;
}
}
function showImageFileChageFun(th) {
// var ds= $(th).parent();
var filePath = $(th).val();//读取图片路径
if (!filePath) {
return;
}
if (filePath == "") {
return;
}
//读取文件进行显示
readImageFileAsDataURL(th.files[0], function (e) {
console.info("e.target.result len = " + e.target.result.length);
compressImageData(e.target.result, 1, function (data) {
console.info("data len = " + data.length)
setImageToShowImageContainerForTh(th, data, 2);
setShowImageInputTextValue(th, data);
});
});
}
function getFileDateString(base64ImageData){
var temp = replaceAll(base64ImageData,"data:image/jpeg;base64,","");
temp = replaceAll(temp,"data:image/jpg;base64,","");
temp = replaceAll(temp,"data:image/png;base64,","");
temp = replaceAll(temp,"data:image/bmp;base64,","");
return temp;
}
function identificationFun() {
var formDataTemp = getFormData("formImage");
console.info(formDataTemp);
if (formDataTemp.cardPositive != "") {
var fd = new FormData();
var temp = getFileDateString(formDataTemp.cardPositive);
fd.append("fileImage", convertBase64UrlToBlob(temp));
fd.append("imageType", "1");
console.info(fd);
var msgid = mini.loading("操作中,请稍后......");
$.ajax({
url: '${imageIdentification}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.flag==1){
mini.get("cardNum").setValue(resultData.data['公民身份号码']);
mini.get("cardName").setValue(resultData.data['姓名']);
} else {
openAlert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid);
openAlert(result.msg, "提示");
}
});
}
if (formDataTemp.cardBack != "") {
var fd = new FormData();
var temp = getFileDateString(formDataTemp.cardBack);
fd.append("fileImage", convertBase64UrlToBlob(temp));
fd.append("imageType", "4");
console.info(fd);
var msgid2 = mini.loading("操作中,请稍后......");
$.ajax({
url: '${imageIdentification}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid2);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.data.words_result['失效日期'].words){
if(resultData.data.words_result['失效日期'].words!=""){
if(resultData.data.words_result['失效日期'].words.length>=8){
var y= resultData.data.words_result['失效日期'].words.substring(0,4);
var m= resultData.data.words_result['失效日期'].words.substring(4,6);
var d= resultData.data.words_result['失效日期'].words.substring(6,8);
mini.get("endDate").setValue(y+"-"+m+"-"+d);
$("#endDateTemp").val(y+"-"+m+"-"+d);
}
}
} else {
openAlert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid2);
openAlert(result.msg, "提示");
}
});
}
}
function onEndDateFun(th){
var time = $("#endDateTemp").val();
// time = replaceAll(time,"\\","-");
mini.get("endDate").setValue(time);
}
//===========
function CloseWindow(action) {
if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
else window.close();
}
function onOk() {
if(!dataInit){
CloseWindow("ok");
}
if(dataInit.save==0){
CloseWindow("ok");
}
var formDataTemp = getFormData("formImage");
console.info(formDataTemp);
if (formDataTemp.cardPositive == ""){
openAlert("请上传身份证正面", "提示");
return;
}
if (formDataTemp.cardBack == ""){
openAlert("请上传身份证反面", "提示");
return;
}
if (formDataTemp.cardPositive != "") {
var fd = new FormData();
var temp = getFileDateString(formDataTemp.cardPositive);
fd.append("uploadFile", convertBase64UrlToBlob(temp));
fd.append("uploadFileName", encodeURI(dataInit.uploadFileName));
fd.append("uuid", encodeURI(dataInit.uuid));
fd.append("credentialsCode", encodeURI(dataInit.credentialsCode));
var dateTemp = mini.get("endDate").getFormValue();
console.info("endDate == " + dateTemp);
fd.append("fileDate", encodeURI(dateTemp));
var msgid = mini.loading("操作中,请稍后......");
$.ajax({
url: '${attachmentUploadSave}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.flag==1){
fileIdList.push(resultData.pk);
if (formDataTemp.cardBack != "") {
var fd = new FormData();
var temp = getFileDateString(formDataTemp.cardBack);
fd.append("uploadFile", convertBase64UrlToBlob(temp));
fd.append("uploadFileName", encodeURI(dataInit.uploadFileName));
fd.append("uuid", encodeURI(dataInit.uuid));
fd.append("credentialsCode", encodeURI(dataInit.credentialsCode));
var dateTemp = mini.get("endDate").getFormValue();
console.info("endDate == " + dateTemp);
fd.append("fileDate", encodeURI(dateTemp));
var msgid2 = mini.loading("操作中,请稍后......");
$.ajax({
url: '${attachmentUploadSave}',
type: 'post',
//dataType:'json',
data: fd,
dataType: "text",
processData: false, // 告诉jQuery不要去处理发送的数据
contentType: false, // 告诉jQuery不要去设置Content-Type请求头
success: function (result) {
mini.hideMessageBox(msgid2);
var resultData = commonJsonParse(result);
console.info(resultData);
if(resultData.flag==1){
fileIdList.push(resultData.pk);
CloseWindow("ok");
} else {
openAlert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid2);
openAlert(result.msg, "提示");
}
});
}
} else {
openAlert(resultData.msg, "提示");
}
},
error: function (result) {
mini.hideMessageBox(msgid);
openAlert(result.msg, "提示");
}
});
}
// if (formDataTemp.cardPositive == "" && formDataTemp.cardBack == "")
//
//
// CloseWindow("ok");
}
function onCancel() {
CloseWindow("cancel");
}
</script>
</html>
分享到:
相关推荐
在IT行业中,身份证识别是一项重要的技术,特别是在身份验证、实名制应用以及公共服务等领域。本文将深入探讨如何在C#编程环境下实现身份证识别,并结合源码进行详细解析。 首先,我们要明白身份证识别的核心是光学...
本文将详细介绍如何使用Java封装百度身份证识别接口,并将其整合到你的项目中,以便于实现高效的身份验证服务。 首先,让我们理解JavaEE(Java企业版)的角色。JavaEE是一种用于构建分布式、多层的企业级应用的平台...
百度OCR作为业界领先的人工智能技术,提供了强大的图像识别功能,特别是在身份证识别方面,能够准确地提取出身份证上的文字信息。 首先,我们需要了解什么是百度OCR。百度OCR(Optical Character Recognition,光学...
标题中的"C#基于百度飞桨实现的身份证识别源代码"表明了这个项目是使用C#编程语言,并结合了百度的飞桨(PaddlePaddle)深度学习框架来开发的身份证识别系统。飞桨是中国首个开源的深度学习平台,提供丰富的模型库和...
首先,我们需要了解的是百度AI的身份证识别服务。这是百度智能云提供的一项功能,它利用深度学习技术对身份证图片进行分析,能够准确地提取出姓名、性别、出生日期、住址、身份证号等关键信息。这项服务适用于多种...
标题中的“百度OCR身份证识别C++离线SDKV3.0 C#WinFormTest.rar”表明这是一个关于使用百度OCR技术,特别是针对身份证识别的开发工具包。这个工具包提供了C++和C#两种编程语言的支持,并且有Windows Forms应用程序的...
【delphi百度文字识别】支持 通用文字识别、通用文字识别(高精度版)、通用文字识别(含位置信息版)、通用文字识别(高精度含位置版)、手写文字识别、身份证识别、银行卡识别、营业执照识别、护照识别、名片识别...
身份证识别OCR, 从身份证图片中自动提取身份证号或者其他字段。 测试图片来自百度搜索的样例图片。 找到的图片比较少,目前都能正确识别。 可用的数据集个人很难找到。 Update for Windows 百度开源了PaddleOcr,...
身份证批量识别 免费 身份证OCR 使用的是腾讯的识别引擎 百度盘链接:https://pan.baidu.com/s/1uTnkYXh8jBcaeda-JoQDuQ 提取码:jbkv
这里以"Android-调用百度云API实现身份证识别和银行卡识别"为主题,详细讲解如何利用百度云API在Android应用程序中实现实体证件的自动识别。 首先,百度云提供了OCR(Optical Character Recognition)服务,它能够...
百度OCR的身份证识别功能支持正面和反面的识别,甚至能在复杂背景下准确提取信息。 描述中的链接指向了一个CSDN博客文章,虽然具体内容无法在这里详述,但通常这样的博客会包含以下内容: 1. OCR技术介绍:简述OCR...
百度OCR是百度提供的云服务,提供了强大的图像识别功能,包括身份证识别。它能准确地提取身份证上的姓名、性别、出生日期、地址等关键信息,大大提高了处理效率。 4. **身份证识别**:身份证识别是OCR技术的一个...
百度OCR是一项基于AI技术的云服务,能够识别图像中的文字,包括身份证、驾驶证等证件上的信息。在前端开发中,通过JavaScript调用API接口,可以实现在H5页面上直接进行文本识别,大大提高了用户体验。 在本案例中,...
在身份证识别场景下,百度OCR通常能准确提取身份证上的姓名、性别、出生日期、地址等关键信息。开发者需要在百度云注册账号,申请API密钥,然后在C#代码中嵌入这些密钥以调用服务。 调用OCR API通常包括以下步骤: ...
在Android平台上进行身份证识别是一项常见的需求,特别是在移动支付、实名认证等场景中。这个名为"SfzDemo"的项目提供了一个小型的演示程序,专门用于身份证正面上的信息读取。由于描述中提到,背面识别的代码已被...
总之,这个"Android身份证识别demo"通过集成百度的文字识别技术,展示了如何在Android应用中实现高效、准确的身份证信息自动识别。开发者可以通过学习和修改这个demo,将其应用到自己的项目中,或者作为进一步开发...
使用百度开放平台的身份证识别API实现身份证正面、反面信息的识别,包含信息及位置等,代码使用Java实现,JUnit测试代码。
2. 然后,创建OCR身份证识别工具类,使用AipOcr对象调用身份证识别接口,传入可选参数,获取识别结果。 3. 通过result方法获取识别结果,结果为Json对象,可以通过JSONObject对象解析获取识别结果。 高精度OCR识别...
本项目是一个基于百度OCR的示例,涵盖了通用文字识别、身份证识别和营业执照识别等功能,并结合Apache POI库将识别结果转换为docx文档。 首先,我们来看通用文字识别。这个功能可以处理各种场景下的文字图像,如...
3. **百度OCR库**:百度提供了丰富的AI开放平台,其中包括OCR(Optical Character Recognition)服务,该服务支持多种文档和图像的文本识别,包括身份证识别。Java开发者可以通过调用百度的SDK或API来接入这个服务。...