|
@@ -98,6 +98,8 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
private String urlV5;
|
|
|
@Value("${supplier.urlV6}")
|
|
|
private String urlV6;
|
|
|
+ @Value("${supplier.sensitive}")
|
|
|
+ private String[] sensitive;
|
|
|
@Autowired
|
|
|
SupplierProperties supplierProperties;
|
|
|
@Autowired
|
|
@@ -208,6 +210,7 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
String upstreamCode = "" + Constant.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
|
|
|
request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
String returnType = request.getHeader(Constant.CUSTOMER_RETURN_TYPE_PARA);
|
|
|
+ String channelId = request.getHeader("channelId");
|
|
|
if (StringUtils.isBlank(returnType)) {
|
|
|
returnType = Constant.CUSTOMER_RETURN_ZW;
|
|
|
}
|
|
@@ -215,20 +218,20 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
outTime = Constant.HTTPCLIENT_CONNECTTIMEOUT;
|
|
|
}
|
|
|
log.info("supplier10000043.twoElementsCheckNew---customBody={},outTime={}", customBody, outTime);
|
|
|
- /* String key="url"+twoElementsMethod;
|
|
|
+ String key="url"+twoElementsMethod;
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
String ymd = dateTimeFormatter.format(now);
|
|
|
String hashKey = "043-"+ymd;
|
|
|
- boolean flag = checkVisitCount(hashKey,key,supplierProperties.getUrlSecondUp());
|
|
|
+ boolean flag = checkVisitCount(hashKey,key,supplierProperties.getUrlSecondUp(),channelId);
|
|
|
if(!flag){
|
|
|
- countOver(ret);
|
|
|
+ countOver(ret,Constant.CUSTOMER_RETURN_JK);
|
|
|
return ret;
|
|
|
- }*/
|
|
|
+ }
|
|
|
if (!decodeType.equals(SjjhConstant.DECODE_TYPE_COMMON)) {
|
|
|
customBody = decodeParams(ret, returnType, customBody, decodeType);
|
|
|
if (StringUtils.isBlank(customBody)) {
|
|
|
ret.setCode(Constant.SUCCESS);
|
|
|
- //reduceVisitCount(hashKey,key);
|
|
|
+ reduceVisitCount(hashKey,key);
|
|
|
request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
return ret;
|
|
|
}
|
|
@@ -240,7 +243,7 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
// 参数校验
|
|
|
if (!validateRequestParams(ret, returnType, requestObject)) {
|
|
|
ret.setCode(Constant.SUCCESS);
|
|
|
- //reduceVisitCount(hashKey,key);
|
|
|
+ reduceVisitCount(hashKey,key);
|
|
|
request.setAttribute(Constant.LOG_UPSTREAM_RESPONSE_CODE, upstreamCode);
|
|
|
return ret;
|
|
|
}
|
|
@@ -448,10 +451,33 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
ret.setResultBody(Constant.JK_IDCODE_FORMAT_ERROR);
|
|
|
}
|
|
|
return false;
|
|
|
- } else {
|
|
|
+ } else if(existSensitiveInfo(requestObject.getName(),requestObject.getIdCode())){
|
|
|
+ if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
|
|
|
+ ret.setResultCode(Constant.OTHER_ERROR_CODE);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.JK_RETURN_CODE_OTHER_ERROR);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }else {
|
|
|
return true;
|
|
|
}
|
|
|
}
|
|
|
+ //过滤敏感信息
|
|
|
+ private boolean existSensitiveInfo(String name,String idCode){
|
|
|
+ if(sensitive == null || sensitive.length == 0){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < sensitive.length; i++) {
|
|
|
+ if (sensitive[i].equals(name) || sensitive[i].equals(idCode)){
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
|
|
|
private boolean validateParamNullValue(Object jsonResolveObject) {
|
|
|
ValidatorFactory vf = Validation.buildDefaultValidatorFactory();
|
|
@@ -737,6 +763,17 @@ public class ChannelServiceImpl implements ChannelService {
|
|
|
ret.setResultBody(Constant.JK_IDCODE_FORMAT_ERROR);
|
|
|
}
|
|
|
return false;
|
|
|
+ }else if(existSensitiveInfo(name,idCode)){
|
|
|
+ if (Constant.CUSTOMER_RETURN_ZW.equals(returnType)) {
|
|
|
+ ret.setResultCode(Constant.OTHER_ERROR_CODE);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ } else {
|
|
|
+ ret.setResultCode(Constant.JK_RETURN_CODE_OTHER_ERROR);
|
|
|
+ ret.setResultDesc(Constant.OTHER_ERROR);
|
|
|
+ ret.setResultBody(Constant.OTHER_ERROR);
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
return true;
|
|
|
}
|