|
@@ -13,12 +13,13 @@ import info.aspirecn.cloud.yysj.commons.lang.BillItemResult;
|
|
|
import info.aspirecn.cloud.yysj.commons.lang.Constants;
|
|
|
import info.aspirecn.cloud.yysj.commons.lang.OtherCommonResult;
|
|
|
import info.aspirecn.iov.yysj.product.check.entity.*;
|
|
|
-import org.apache.commons.lang.ArrayUtils;
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.google.gson.Gson;
|
|
@@ -42,7 +43,7 @@ public class ZuulHelper {
|
|
|
@Autowired
|
|
|
private ZuulHelper helper;
|
|
|
public Boolean hasProcessFlag(RequestContext requestContext) {
|
|
|
-
|
|
|
+
|
|
|
Boolean ret = (Boolean)requestContext.get("process");
|
|
|
if( ret != null )
|
|
|
{
|
|
@@ -53,9 +54,10 @@ public class ZuulHelper {
|
|
|
return Boolean.FALSE;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public void responseHandle(BillItemResult responseObject, RequestContext requestContext) throws JsonProcessingException{
|
|
|
String json = mapper.writeValueAsString(responseObject);
|
|
|
+ log.info("json:{}",json);
|
|
|
requestContext.set("process", Boolean.TRUE);
|
|
|
requestContext.setResponseBody(json);
|
|
|
requestContext.getResponse().setCharacterEncoding("utf-8");
|
|
@@ -87,7 +89,7 @@ public class ZuulHelper {
|
|
|
return bodyStr;
|
|
|
}
|
|
|
//根据响应参数,判断结果
|
|
|
- public void handleResult(String productId,ResponseObject responseObject,Map<String,Object> requestParams,BillItemResult billItemResult){
|
|
|
+ public void handleResult(String productId,ResponseObject responseObject,Map<String,Object> requestParams,BillItemResult billItemResult,String productCode){
|
|
|
Set<String> inconsistentList = new HashSet<String>();//不一致项列表
|
|
|
Set<String> emptyList = new HashSet<String>();
|
|
|
String result =Constants.consistent_code;
|
|
@@ -104,9 +106,13 @@ public class ZuulHelper {
|
|
|
billItemResult.setResult(Constants.inconsistent_code);
|
|
|
billItemResult.setExceptionInformation(errorResponse);
|
|
|
return ;
|
|
|
+ }else if("536".equals(responseObject.getResultCode())||"9963".equals(responseObject.getResultCode())){
|
|
|
+ errorResponse.setCode(Constants.ErrorCode.MONEYNOTENOUGH.getErrorCode());
|
|
|
+ billItemResult.setResult(Constants.inconsistent_code);
|
|
|
+ billItemResult.setExceptionInformation(errorResponse);
|
|
|
+ return ;
|
|
|
}
|
|
|
Map<String, String> productMap = property.getProductMap();
|
|
|
- // todo 在这个地方加一个product简称,再进行业务判断
|
|
|
if (productMap.get("clxszyz").equals(productId)) {//行驶证
|
|
|
|
|
|
if ("128".equals(responseObject.getResultCode())||"1000".equals(responseObject.getResultCode())) {
|
|
@@ -239,27 +245,9 @@ public class ZuulHelper {
|
|
|
errorResponse.setCode(Constants.ErrorCode.INCONSISTENT_DETAIL.getErrorCode());
|
|
|
errorResponse.setResultList(inconsistentList);
|
|
|
}
|
|
|
- } else if (productMap.get("zxhdwyz").equals(productId)) {
|
|
|
- if (responseObject.getResultCode().equals("1")) {
|
|
|
- // 一致,返回结果
|
|
|
- result = Constants.consistent_code;
|
|
|
- billItemResult.setResultMessage(resultBody);
|
|
|
- } else if (responseObject.getResultCode().equals("2")) {
|
|
|
- // 不一致
|
|
|
- result = Constants.inconsistent_code;
|
|
|
- } else if (responseObject.getResultCode().equals("4")) {
|
|
|
- // 查无
|
|
|
- // 查询错误
|
|
|
- errorResponse.setCode(Constants.ErrorCode.DATA_NULL.getErrorCode());
|
|
|
- billItemResult.setResult(Constants.inconsistent_code);
|
|
|
- } else {
|
|
|
- // 查询错误
|
|
|
- errorResponse.setCode(Constants.ErrorCode.Exception.getErrorCode());
|
|
|
- billItemResult.setResult(Constants.inconsistent_code);
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- if (!"1".equals(responseObject.getResultCode())) {
|
|
|
+ }else {
|
|
|
+ log.info("codes:{},productCode:{}",property.getDetailProductCodes(),productCode);
|
|
|
+ if (!"1".equals(responseObject.getResultCode())&&!"1000".equals(responseObject.getResultCode())) {
|
|
|
/*if("3".equals(responseObject.getResultCode())){
|
|
|
errorResponse.setCode(Constants.ErrorCode.Exception.getErrorCode());
|
|
|
billItemResult.setResult(Constants.inconsistent_code);
|
|
@@ -284,6 +272,17 @@ public class ZuulHelper {
|
|
|
errorInfo = "数据源" + StringUtils.join(list.toArray(), ",") + "为空";
|
|
|
|
|
|
}*/
|
|
|
+ }else if(("1".equals(responseObject.getResultCode())||"1000".equals(responseObject.getResultCode())) &&
|
|
|
+ StringUtils.isNotEmpty(productCode) &&
|
|
|
+ property.getDetailProductCodes().contains(productCode)) {//&&productCode在匹配的列表
|
|
|
+
|
|
|
+ Object body = responseObject.getResultBody() ;
|
|
|
+ if(body instanceof String) {
|
|
|
+ billItemResult.setDetail((String)body);
|
|
|
+ }else {
|
|
|
+ billItemResult.setDetail(JSON.toJSONString(body));
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -410,7 +409,7 @@ public class ZuulHelper {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- public ResponseObject getResult(SjjhTransferReq sjjhTransferReq,BillItemResult billItemResult) throws IOException {
|
|
|
+ public ResponseObject getResult(SjjhTransferReq sjjhTransferReq,BillItemResult billItemResult,String productCode) throws IOException {
|
|
|
BillItemResult.ErrorResponse errorResponse = new BillItemResult.ErrorResponse();
|
|
|
|
|
|
billItemResult.setResult(Constants.consistent_code);
|
|
@@ -427,7 +426,7 @@ public class ZuulHelper {
|
|
|
errorResponse.setCode(Constants.ErrorCode.Exception.getErrorCode());
|
|
|
billItemResult.setExceptionInformation(errorResponse);
|
|
|
} else {
|
|
|
- helper.handleResult(sjjhTransferReq.getSjjhProductId(), responseObject, sjjhTransferReq.getOriginCustomBody(),billItemResult);
|
|
|
+ helper.handleResult(sjjhTransferReq.getSjjhProductId(), responseObject, sjjhTransferReq.getOriginCustomBody(),billItemResult,productCode);
|
|
|
|
|
|
}
|
|
|
|