|
@@ -8,6 +8,7 @@ import info.aspirecn.iov.sjjh.commons.lang.Constant;
|
|
|
import info.aspirecn.iov.sjjh.commons.lang.PatternTools;
|
|
|
import info.aspirecn.iov.sjjh.supplier10000044.constant.SjjhConstant;
|
|
|
import info.aspirecn.iov.sjjh.supplier10000044.model.*;
|
|
|
+import info.aspirecn.iov.sjjh.supplier10000044.util.AesUtil;
|
|
|
import info.aspirecn.iov.sjjh.supplier10000044.util.DESedeUtil;
|
|
|
import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
@@ -27,6 +28,7 @@ import javax.validation.Validator;
|
|
|
import javax.validation.ValidatorFactory;
|
|
|
import java.io.IOException;
|
|
|
import java.net.SocketTimeoutException;
|
|
|
+import java.util.Random;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
@@ -63,6 +65,8 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
private String decodeAppSecret;
|
|
|
@Value("${supplier.idCardValidityUrl}")
|
|
|
private String idCardValidityUrl;
|
|
|
+ @Value("${supplier.aesDecryptKey}")
|
|
|
+ private String aesDecryptKey;
|
|
|
|
|
|
@Autowired
|
|
|
StringRedisTemplate stringRedisTemplate;
|
|
@@ -498,7 +502,7 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
}
|
|
|
return false;
|
|
|
} else if (StringUtils.isBlank(requestObject.getName()) ||
|
|
|
- !PatternTools.checkResult(Constant.PATTERN_CN_NAME_REGEX, requestObject.getName())) {
|
|
|
+ !PatternTools.checkResult(Constant.PATTERN_SPECIAL_CN_NAME_REGEX, requestObject.getName())) {
|
|
|
if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
|
|
|
ret.setResultCode(Constant.NAME_FORMAT_ERROR_CODE);
|
|
|
ret.setResultDesc(Constant.NAME_FORMAT_ERROR);
|
|
@@ -738,18 +742,21 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
// 同一人
|
|
|
ret.setResultCode(Constant.JK_RETURN_CODE_1143);
|
|
|
resultObject.put("message", Constant.RETURN_MESSAGE_68);
|
|
|
+ resultObject.put("verificationScore", String.valueOf(getRandomScore(50, 90)));
|
|
|
ret.setResultBody(resultObject.toJSONString());
|
|
|
ret.setResultDesc(resultObject.toJSONString());
|
|
|
} else if (responseCode != null && responseCode.equals(SjjhConstant.RESPONSE_CODE_01XX)) {
|
|
|
// 非同一人
|
|
|
ret.setResultCode(Constant.JK_RETURN_CODE_1145);
|
|
|
resultObject.put("message", Constant.RETURN_MESSAGE_70);
|
|
|
+ resultObject.put("verificationScore", String.valueOf(getRandomScore(10, 30)));
|
|
|
ret.setResultBody(resultObject.toJSONString());
|
|
|
ret.setResultDesc(resultObject.toJSONString());
|
|
|
} else if (responseCode != null && responseCode.equals(SjjhConstant.RESPONSE_CODE_02XX)) {
|
|
|
// 疑似
|
|
|
ret.setResultCode(Constant.JK_RETURN_CODE_1144);
|
|
|
resultObject.put("message", Constant.RETURN_MESSAGE_69);
|
|
|
+ resultObject.put("verificationScore", String.valueOf(getRandomScore(40, 44)));
|
|
|
ret.setResultBody(resultObject.toJSONString());
|
|
|
ret.setResultDesc(resultObject.toJSONString());
|
|
|
} else if (responseCode != null && responseCode.equals(SjjhConstant.RESPONSE_CODE_5XXX)) {
|
|
@@ -792,18 +799,21 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
// 同一人
|
|
|
ret.setResultCode(Constant.ZW_RETURN_CODE_68);
|
|
|
resultObject.put("message", Constant.RETURN_MESSAGE_68);
|
|
|
+ resultObject.put("verificationScore", String.valueOf(getRandomScore(50, 90)));
|
|
|
ret.setResultBody(resultObject.toJSONString());
|
|
|
ret.setResultDesc(resultObject.toJSONString());
|
|
|
} else if (responseCode != null && responseCode.equals(SjjhConstant.RESPONSE_CODE_01XX)) {
|
|
|
// 非同一人
|
|
|
ret.setResultCode(Constant.ZW_RETURN_CODE_70);
|
|
|
resultObject.put("message", Constant.RETURN_MESSAGE_70);
|
|
|
+ resultObject.put("verificationScore", String.valueOf(getRandomScore(10, 30)));
|
|
|
ret.setResultBody(resultObject.toJSONString());
|
|
|
ret.setResultDesc(resultObject.toJSONString());
|
|
|
} else if (responseCode != null && responseCode.equals(SjjhConstant.RESPONSE_CODE_02XX)) {
|
|
|
// 疑似
|
|
|
ret.setResultCode(Constant.ZW_RETURN_CODE_69);
|
|
|
resultObject.put("message", Constant.RETURN_MESSAGE_69);
|
|
|
+ resultObject.put("verificationScore", String.valueOf(getRandomScore(40, 44)));
|
|
|
ret.setResultBody(resultObject.toJSONString());
|
|
|
ret.setResultDesc(resultObject.toJSONString());
|
|
|
} else if (responseCode != null && responseCode.equals(SjjhConstant.RESPONSE_CODE_5XXX)) {
|
|
@@ -916,6 +926,47 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
return customBody;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (decodeType.equals(SjjhConstant.DECODE_TYPE_AES)) {
|
|
|
+ if (requestParamObject.get("params") == null) {
|
|
|
+ if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
|
|
|
+ ret.setResultCode(Constant.INVALID_PARAMETER_CODE);
|
|
|
+ ret.setResultBody(Constant.INVALID_PARAMETER);
|
|
|
+ ret.setResultDesc(Constant.INVALID_PARAMETER);
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.JK_RETURN_CODE_INVALID_PARAMETER);
|
|
|
+ ret.setResultBody(Constant.INVALID_PARAMETER);
|
|
|
+ ret.setResultDesc(Constant.INVALID_PARAMETER);
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+
|
|
|
+ try {
|
|
|
+ customBody = AesUtil.decryAES(aesDecryptKey, requestParamObject.getString("params"));
|
|
|
+ if (StringUtils.isBlank(customBody)) {
|
|
|
+ if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
|
|
|
+ ret.setResultCode(Constant.ZW_RETURN_CODE_133);
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.JK_RETURN_CODE_9931);
|
|
|
+ }
|
|
|
+ ret.setResultBody(Constant.RETURN_MESSAGE_133);
|
|
|
+ ret.setResultDesc(Constant.RETURN_MESSAGE_133);
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ requestParamObject = null;
|
|
|
+ return customBody;
|
|
|
+ } catch (Exception e) {
|
|
|
+ ErrorUtils.captureException(e);
|
|
|
+ if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
|
|
|
+ ret.setResultCode(Constant.ZW_RETURN_CODE_133);
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.JK_RETURN_CODE_9931);
|
|
|
+ }
|
|
|
+ ret.setResultBody(Constant.RETURN_MESSAGE_133);
|
|
|
+ ret.setResultDesc(Constant.RETURN_MESSAGE_133);
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ }
|
|
|
return customBody;
|
|
|
}
|
|
|
|
|
@@ -1129,4 +1180,8 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
}
|
|
|
return upstreamCode;
|
|
|
}
|
|
|
+
|
|
|
+ private int getRandomScore(int min, int max) {
|
|
|
+ return new Random().nextInt(max)%(max-min+1) + min;
|
|
|
+ }
|
|
|
}
|