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