diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java index 3c3fea1..54be906 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/service/impl/WpsServiceImpl.java @@ -62,14 +62,12 @@ public class WpsServiceImpl implements WpsService { private AttachmentClient attachmentClient; - @Value("${mconfig.bss.app-id}") - private String app_id; - @Value("${mconfig.bss.app-secret}") - private String app_secret; - @Value("${mconfig.bss.app-url-test}") - private String app_url_test; - @Value("${mconfig.bss.app-url}") - private String app_url; + @Value("${mconfig.wps.bssAppId}") + private String bss_app_id; + @Value("${mconfig.wps.bssAppSecret}") + private String bss_app_secret; + @Value("${mconfig.wps.bssAppUrl}") + private String bss_app_url; @Value("${mconfig.wps.appid}") private String wpsAppId; @@ -235,8 +233,8 @@ public class WpsServiceImpl implements WpsService { */ @OperationLogDetail(businessModule = EbtpLogBusinessModule.OTHER,operationType = EbtpLogType.SELECT,detail = "沃文档-获取应用权限") public String getWpsAppToken(){ - if(redisTemplate.opsForValue().get("wpsAppToken:"+app_id)!=null){ - return String.valueOf(redisTemplate.opsForValue().get("wpsAppToken:"+app_id)); + if(redisTemplate.opsForValue().get("wpsAppToken:"+bss_app_id)!=null){ + return String.valueOf(redisTemplate.opsForValue().get("wpsAppToken:"+bss_app_id)); } CrypBean bean=new CrypBean(); bean.setUrl(wpsAppTokenUrl); @@ -247,7 +245,7 @@ public class WpsServiceImpl implements WpsService { bean.setReqName("APPTOKEN_REQ"); bean.setContentJson(""); Map tokenMap=this.callUniWpsInterfaceJson(bean); - redisTemplate.opsForValue().set("wpsAppToken:"+app_id,tokenMap.get("app_token"),23, TimeUnit.HOURS); + redisTemplate.opsForValue().set("wpsAppToken:"+bss_app_id,tokenMap.get("app_token"),23, TimeUnit.HOURS); return String.valueOf(tokenMap.get("app_token")); } @@ -260,17 +258,7 @@ public class WpsServiceImpl implements WpsService { @OperationLogDetail(businessModule = EbtpLogBusinessModule.OTHER,operationType = EbtpLogType.SELECT,detail = "沃文档-调用天擎接口") public Map callUniWpsInterfaceJson(CrypBean bean) { log.info("沃文档-天擎接口------callUniInterface:---入参-----" + JSON.toJSONString(bean)); - String url= ""; - //天擎地址 - if ("1mb6n6635cJkDb3pEQPUFXc2nRJ8RPaS".equals(app_secret)) { - //测试环境 - url=app_url_test; - } else { - //生产环境 - url=app_url; - } - - log.info("请求路径:" +url+ bean.getUrl()); + log.info("请求路径:" +bss_app_url+ bean.getUrl()); String json = ""; String str = ""; try { @@ -283,8 +271,11 @@ public class WpsServiceImpl implements WpsService { String nlptDate=getGmtDate(); String contentType = "application/json;charset=utf-8"; String nlptAuth="WPS-3:"+wpsAppId+":"+sha1Encode(wpsAppKey+contentMd5+bean.getUrl()+contentType+nlptDate); - str = this.uniBssWpsHttpPost(url+bean.getUrl(), json,nlptDate,nlptAuth,contentMd5,contentType); - operationLogService.addOperationLog("沃文档天擎接口调用信息,请求地址{}"+bean.getUrl()+",参数{}"+json+",返回信息{}"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); + log.warn("沃文档请求头--------- nlpt-Date="+nlptDate); + log.warn("沃文档请求头--------- nlpt-X-Auth="+nlptAuth); + log.warn("沃文档请求头--------- nlpt-Content-Md5="+contentMd5); + str = this.uniBssWpsHttpPost(bss_app_url+bean.getUrl(), json,nlptDate,nlptAuth,contentMd5,contentType); + operationLogService.addOperationLog("沃文档天擎接口调用信息,请求地址:"+bean.getUrl()+",参数:"+json+",返回信息:"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); Map callMap = (Map)JSON.parse(str); log.info("天擎接口--沃文档接口--返回数据callMap:"+ JSONObject.toJSONString(callMap)); Object head = callMap.get("UNI_BSS_HEAD"); @@ -336,7 +327,7 @@ public class WpsServiceImpl implements WpsService { UniBssMap uniBss = new UniBssMap(); uniBss.setUniBssAttached(new UniBssAttached().setMediaInf("")); //天擎部分head - UniBssUtil util = new UniBssUtil(app_id, app_secret); + UniBssUtil util = new UniBssUtil(bss_app_id, bss_app_secret); uniBss.setUniBssHead(util.getUniBssHead()); log.info("业务参数封装前:" + map); @@ -378,6 +369,7 @@ public class WpsServiceImpl implements WpsService { conn.setDoOutput(true); conn.setDoInput(true); conn.setRequestMethod("POST"); + log.warn("沃文档天擎接口调用信息,HttpURLConnection1={}"+JSONObject.toJSONString(conn)+",参数{}"+data+",返回信息{}"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); operationLogService.addOperationLog("沃文档天擎接口调用信息,HttpURLConnection1={}"+JSONObject.toJSONString(conn)+",参数{}"+data+",返回信息{}"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); out = new PrintWriter(conn.getOutputStream()); @@ -394,9 +386,11 @@ public class WpsServiceImpl implements WpsService { is.close(); conn.disconnect(); + log.warn("沃文档天擎接口调用信息,HttpURLConnection2={}"+JSONObject.toJSONString(conn)+",参数{}"+data+",返回信息{}"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); operationLogService.addOperationLog("沃文档天擎接口调用信息,HttpURLConnection2={}"+JSONObject.toJSONString(conn)+",参数{}"+data+",返回信息{}"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); } catch (Exception var9) { - var9.printStackTrace(); + log.warn("沃文档天擎接口调用信息异常,异常信息={}"+JSONObject.toJSONString(var9)+",参数{}"+data+",返回信息{}"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); + operationLogService.addOperationLog("沃文档天擎接口调用信息异常,异常信息={}"+JSONObject.toJSONString(var9)+",参数{}"+data+",返回信息{}"+str,true, EbtpLogBusinessModule.OTHER, EbtpLogType.INSERT); } return str;