天擎统一调用接口优化

This commit is contained in:
zhangqinbin
2024-06-12 14:08:29 +08:00
parent 499053ff9d
commit e99f85671d
2 changed files with 11 additions and 4 deletions

View File

@ -26,5 +26,11 @@ public class UniBssBean {
*/
@ApiModelProperty(value = "天擎接口地址")
public String url;
/**
*返回值校验成功参数
* 校验天擎返回结果是否成功
* 默认 ":200"
*/
@ApiModelProperty(value = "返回值校验成功参数")
public String retValue = ":200";
}

View File

@ -13,6 +13,7 @@ import com.chinaunicom.mall.ebtp.extend.blockchain.service.IBlockChainLogService
import com.chinaunicom.mall.ebtp.extend.uniBss.UniBssUtil;
import com.chinaunicom.mall.ebtp.extend.uniBss.entity.UniBssBean;
import com.chinaunicom.mall.ebtp.extend.uniBss.service.UniService;
import com.chinaunicom.mall.ebtp.extend.wps.vo.UniBssMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -45,15 +46,15 @@ public class UniServiceImpl implements UniService {
log.info("天擎接口 请求参数:"+json);
String str = UniBssServiceImpl.uniBssHttpPost(uniBssBean.getUrl(), json);
log.info("天擎接口 返回参数:"+str);
UniBss uniBssRsp = JSONArray.parseObject(str, UniBss.class);
UniBssMap uniBssRsp = JSONArray.parseObject(str, UniBssMap.class);
if (uniBssRsp != null && UniBssConstant.RESP_CODE_00000.equals(uniBssRsp.getUniBssHead().getRespCode())) {
Map uniBssMap = JSONArray.parseObject(str, Map.class);
log.info("uniBssMap :"+uniBssMap);
String body = JSON.toJSONString(uniBssMap.get("UNI_BSS_BODY"));
log.info("天擎接口 UNI_BSS_BODY 返回参数:"+body);
log.info("天擎接口 body2 返回参数:"+(body.indexOf(":200")>=0));
if(body!=null&&!"".equals(body)&&body.indexOf(":200")>=0){
log.info("天擎接口 body2 返回参数:"+(body.indexOf(uniBssBean.getRetValue())>=0));
if(body!=null&&!"".equals(body)&&body.indexOf(uniBssBean.getRetValue())>=0){
return str;
}
}