身份证校验代码简化

This commit is contained in:
张磊 2018-06-25 19:03:18 +08:00
parent 34d971235c
commit 49a7c402e8
3 changed files with 45 additions and 16 deletions

View File

@ -1 +1 @@
key=JTNGdiUzRnpVJTNEJTVDWCU1Q1olM0YlNUIlNUM5ZHgrJTI0JTVDJTIwMyUyM0IlM0RLNCUzRmMlM0ZvJTNGZyUzRmslM0ZoJTNGb2JTN19SS0gwY2Q3JTI5MSUyNUQ5RyU1RCUzRmMlM0ZvYjRLL1J0ZEUlM0Z6JTNGeCUyNi0lM0Z2JTVDakAvUmthM0piJTYwVkR4JTNGeCUzRnZNciU1Q2glNUJwR3FVaSU1QnFFdkBoJTNGeCUzRnYlNUR3Tm1PbU0vL2slM0ZnKnklM0ZkJTNBcyUzRnM2ZyUzRnYlMjYvJTVCaiU1QiUzQkdnQm0lM0Z4JTNGdk93Tm1JekpnJTNGeDViKnklM0ZkJTNGZiUzRmQyYSUzRnYyb1h4RWZPbU9zJTNGeCUzRnZKal9lTWJjNiUzRnhVQiUzQVVBNSU1QlhGLSU1RCUyMFQlNjAvQS9yJTNGZCUzRC4lM0ZnJTNEZjluMm9VaFRpYjBacCUyNnIlM0Z2TnAlNjAlNUNZYSU1RGdUdk1jT29EeiUzRnhNdiUzRmclM0ZnJTNGZyUzRmclM0ZnJTNGdi54TnBPZyU1RGclNUVmVnhQJTVCTmklNjAzJTNGeCUzRnZJelkvNnQlM0Z4JTNGdiUzRmpOdWNaJTVCcCU1Qi8lNUNxTnpJaCU1RWslM0Z4JTNGdmNaJTYwNCU1Q2dWeiU1Q3FBY0tnVWlZZVNxJTYwJTIwMWglM0Z2RnpIJTVCQS5HdiUzRng3diUzRG4lM0YvJTNGcyUzRnYlM0ZqJTVCb015ViU1QmI1JTNGeCUzRnYlM0ZqQCUzQmI2UXZHa0ZoQHZfeVolM0JUeUJiUCU1QiUzRnhkJTI1JTNGaiU2MC0lNUVlTGhWJTNCQ2ZhQ2I2JTNGeA==
key =P3Y/elU9XFhcWj9bXDlkeCskXCAzI0I9SzQ/Yz9vP2c/az9oP29iUzdfUktIMGNkNykxJUQ5R10/Yz9vYjRLL1J0ZEU/ej94Ji0/dlxqQC9Sa2EzSmJgVkR4P3g/dk1yXGhbcEdxVWlbcUV2QGg/eD92XXdObU9tTS8vaz9nKnk/ZDpzP3M2Zz92Ji9bals7R2dCbT94P3ZPd05tSXpKZz94NWIqeT9kP2Y/ZDJhP3Yyb1h4RWZPbU9zP3g/dkpqX2VNYmM2P3hVQjpVQTVbWEYtXSBUYC9BL3I/ZD0uP2c9ZjluMm9VaFRpYjBacCZyP3ZOcGBcWWFdZ1R2TWNPb0R6P3hNdj9nP2c/Zz9nP2c/di54TnBPZ11nXmZWeFBbTmlgMz94P3ZJelkvNnQ/eD92P2pOdWNaW3BbL1xxTnpJaF5rP3g/dmNaYDRcZ1Z6XHFBY0tnVWlZZVNxYCAxaD92RnpIW0EuR3Y/eDd2PW4/Lz9zP3Y/altvTXlWW2I1P3g/dj9qQDtiNlF2R2tGaEB2X3laO1R5QmJQWz94ZCU/amAtXmVMaFY7Q2ZhQ2I2P3g=

View File

@ -1,13 +1,10 @@
package com.tenwa.lease.flow.project.validate;
import java.io.InputStream;
import java.net.URLDecoder;
import java.util.List;
import java.util.Properties;
import org.apache.commons.codec.binary.Base64;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import sun.misc.BASE64Decoder;
import jbo.app.tenwa.customer.CUSTOMER_PERSON_TEMP;
import com.amarsoft.are.jbo.BizObject;
import com.amarsoft.are.jbo.BizObjectManager;
@ -30,17 +27,9 @@ public class IdentityVerification {
try {
BizObjectManager bom1 = JBOFactory.getBizObjectManager(CUSTOMER_PERSON_TEMP.CLASS_NAME,tx);
BizObject identityObject = bom1.createQuery("ID=:id").setParameter("id", id).getSingleResult(false);
//读取授权文件因为其他方法都读取不到只能通过此方法
Properties prop = new Properties();
InputStream in= IdentityVerification.class.getClassLoader().getResourceAsStream("license.properties");
prop.load(in);
String property = prop.getProperty("key");
Base64 base64 = new Base64();
String msg = new String(base64.decode(property.getBytes("utf-8")),"utf-8");
String decode = URLDecoder.decode(msg,"utf-8");
char[] charArray = decode.toCharArray();
charArray[16]='+';
decode = new String(charArray);
//读取授权文件
String license =ValidatePropertiesUtil.get("key");
String decode = new String(new BASE64Decoder().decodeBuffer(license));
String inConditions = SoapRequest.XMLConfiguration(identityObject.getAttribute("CERTID").getString(),identityObject.getAttribute("FULLNAME").getString());
String result = NciicClient.executeClient("NciicServices",decode,inConditions);
Document document = DocumentHelper.parseText(result);

View File

@ -0,0 +1,40 @@
package com.tenwa.lease.flow.project.validate;
import java.io.IOException;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;
import com.amarsoft.are.ARE;
/**
* 信贷校验配置文件读取类
* @author 张磊
* 2018年6月25日 下午5:15:34
*/
public class ValidatePropertiesUtil {
private static final Map<String,String> attributes ;
static{
attributes = new ConcurrentHashMap<String,String>();
Properties prop = new Properties();
try {
prop.load(ValidatePropertiesUtil.class.getResourceAsStream("/license.properties"));
for(Entry<Object, Object> entry : prop.entrySet()){
if(entry.getKey()==null || entry.getValue() == null){
continue;
}
attributes.put(entry.getKey().toString(),entry.getValue().toString());
}
} catch (IOException e) {
e.printStackTrace();
ARE.getLog().error("init ValidatePropertiesUtil info failed");
}
ARE.getLog().info("init ValidatePropertiesUtil info success");
}
public static String get(String propName){
return attributes.get(propName);
}
}