Commit 1251db50 authored by 5359's avatar 5359

e签宝调整

parent a6d91800
......@@ -619,6 +619,11 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
json2.put("operatorType", info.getAgentType());
//组织核验类型,“1”:三要素核验;“2”:四要素核验;不填为不指定核验类型
// json2.put("verifyType", "2");
if("92".equalsIgnoreCase(info.getIdNo().substring(0,2))){
json2.put("organizationType",2);
}else{
json2.put("organizationType",1);
}
//认证配置信息
String[] str = new String[]{};
......@@ -908,7 +913,7 @@ public class OrganSignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHc
userInfoHclc.setName(signInfoHclc.getName());
userInfoHclc.setAuthFlag("Y");
userInfoHclc.setIsManagerFlag("N");
userInfoHclcs = signInfoHclcMapper.select(signInfoHclc);
userInfoHclcs = signInfoHclcMapper.select(userInfoHclc);
if (Objects.nonNull(userInfoHclcs) && userInfoHclcs.size() > 0) {
logger.debug("存在非管理员经办人,请先完成管理权限转移,再注销!");
map.put("code", "000013");
......
......@@ -9,6 +9,8 @@ import com.hand.app.esignHclc.service.ISignInfoHclcFaceService;
import com.hand.app.esignHclc.service.ISignInfoHclcService;
import com.hand.hap.core.IRequest;
import com.hand.hap.system.service.impl.BaseServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -35,8 +37,10 @@ public class SignInfoHclcFaceServiceImpl extends BaseServiceImpl<SignUserFaceHcl
@Autowired
private IOrganSignInfoHclcService iOrganSignInfoHclcService;
public void postAuthResult(IRequest iRequest, JSONObject params) {
private Logger logger = LoggerFactory.getLogger(getClass());
public void postAuthResult(IRequest iRequest, JSONObject params) {
logger.info("认证结果通知信息 params: {}", params.toJSONString());
synchronized (lock) {
if (Objects.isNull(params.get("contextId"))) {
......@@ -48,7 +52,7 @@ public class SignInfoHclcFaceServiceImpl extends BaseServiceImpl<SignUserFaceHcl
signInfoHclcFace = this.selectByPrimaryKey(iRequest, signInfoHclcFace);
//判断认证识别流程是否存在
if (Objects.nonNull(signInfoHclcFace) && !"SUCCESS".equalsIgnoreCase(signInfoHclcFace.getAuthStatus())) {
if (Objects.nonNull(signInfoHclcFace) && !"SUCCESS".equalsIgnoreCase(signInfoHclcFace.getAuthStatus()) && Objects.nonNull(params.get("verifycode"))) {
//判断认证返回结果成功
if ("true".equalsIgnoreCase(params.get("success").toString())) {
......
......@@ -539,6 +539,51 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
//
// }
public JSONObject idcard(IRequest iRequest, String img) {
JSONObject resultjson = new JSONObject();
JSONObject result = new JSONObject();
result.put("img", img);
JSONObject json = new JSONObject(result);
SignHclcUtils signHclcUtils = new SignHclcUtils();
String tokenApiUrl = "https://smlopenapi.esign.cn/v1/oauth2/access_token";
this.logger.info("token url: {}", tokenApiUrl);
String token = signHclcUtils.getFaceApiToken(tokenApiUrl, "7438830952", "07e5a0e1bf7ff6891058c1f52b8e141b");
Map<String, String> headInfo = new HashMap();
headInfo.put("X-Tsign-Open-App-Id", "7438830952");
headInfo.put("X-Tsign-Open-Token", token);
JSONObject jsonResult = null;
try {
String url = "https://smlopenapi.esign.cn/v2/identity/auth/api/ocr/idcard";
this.logger.info("get ocr result url: {}", url);
SignHclcUtils signHclcUtils1 = new SignHclcUtils();
String stringResult = signHclcUtils1.postString(url, json, headInfo, "application/json");
jsonResult = JSONObject.parseObject(stringResult);
if ("0".equalsIgnoreCase(jsonResult.getString("code"))) {
JSONObject data = jsonResult.getJSONObject("data");
resultjson.put("姓名", data.getString("name"));
resultjson.put("民族", data.getString("nation"));
resultjson.put("住址", data.getString("address"));
resultjson.put("公民身份号码", data.getString("idNo"));
resultjson.put("出生", data.getString("birthDay"));
resultjson.put("性别", data.getString("gender"));
resultjson.put("code", "0");
resultjson.put("message", "e签宝身份证OCR成功!");
} else {
this.logger.info("get ocr result failed, code:{} ,message:{}", jsonResult.getString("code"), jsonResult.getString("message"));
resultjson.put("code", jsonResult.getString("code"));
resultjson.put("message", "e签宝身份证OCR失败," + jsonResult.getString("message"));
}
} catch (Exception var15) {
this.logger.info("get ocr result failed, msg:{}", var15.getMessage());
resultjson.put("code", "000006");
resultjson.put("message", "e签宝身份证OCR失败," + var15.getMessage());
}
return resultjson;
}
/***
* E签宝营业执照OCR;
* @param iRequest
......@@ -656,8 +701,11 @@ public class SignInfoHclcServiceImpl extends BaseServiceImpl<SignUserInfoHclc> i
if (!ArrayUtils.isEmpty(bytes)) {
//身份证ocr认证
SignHclcUtils signHclcUtils = new SignHclcUtils();
String img;
if ("app_file_id_card".equalsIgnoreCase(attachmentInfo.getSourceType())) {
json = signHclcUtils.idcard(bytes);
// json = signHclcUtils.idcard(bytes);
img = Base64.encodeBase64String(bytes);
json = this.idcard(iRequest, img);
} else {
//营业执照
// json = signHclcUtils.businessLicense(bytes);
......
......@@ -85,6 +85,9 @@
<logger name="com.hand.app.esignHclc.service.impl.SignInfoHclcServiceImpl" level="INFO" additivity="false">
<appender-ref ref="REQ"/>
</logger>
<logger name="com.hand.app.esignHclc.service.impl.SignInfoHclcFaceServiceImpl" level="INFO" additivity="false">
<appender-ref ref="REQ"/>
</logger>
<logger name="com.timevale" level="INFO" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment