公告结构化

This commit is contained in:
zhangqinbin
2023-12-12 09:08:30 +08:00
parent ae8f85ec49
commit a2b8c918eb
3 changed files with 97 additions and 26 deletions

View File

@ -0,0 +1,45 @@
package com.chinaunicom.mall.ebtp.extend.wps.entity;
import lombok.Data;
@Data
public class KingSoftWpsPreviewVo {
/**
* 前端 host
*/
private String srcWpsNgProxy;
/**
* 当前编辑用户工号
*/
private String staffCode;
/**
* 文件唯一标识
*/
private String fileKey;
/**
* 文件名
*/
private String fileName;
/**
* 文件下载URL
*/
private String fileUrl;
/**
* 文件大小
*/
private Integer fileSize;
/**
* 文件创建者工号
*/
private String fileCreator;
/**
* 文件创建时间;yyyy-MM-dd HH:mm:ss
*/
private String fileCreateTime;
/**
* 文件最近一次修改时间;yyyy-MM-dd HH:mm:ss
*/
private String fileLastModifiedTime;
}

View File

@ -24,6 +24,7 @@ import com.chinaunicom.mall.ebtp.extend.feign.client.UnicomOAuthClient;
import com.chinaunicom.mall.ebtp.extend.shortmessage.utils.RSA;
import com.chinaunicom.mall.ebtp.extend.uniBss.UniBssUtil;
import com.chinaunicom.mall.ebtp.extend.wps.entity.KingSoftFileSaveVo;
import com.chinaunicom.mall.ebtp.extend.wps.entity.KingSoftWpsPreviewVo;
import com.chinaunicom.mall.ebtp.extend.wps.entity.KingSoftWpsRet;
import com.chinaunicom.mall.ebtp.extend.wps.entity.KingSoftWpsVo;
import com.chinaunicom.mall.ebtp.extend.wps.enums.WpsExceptionEnum;
@ -501,6 +502,22 @@ public class WpsServiceImpl implements WpsService {
@Override
public String getKSWpsUrl(WpsClientInVo in){
String url = "";
String dataJson = "";
String callBackUrl = "";
byte[] b = getFileByFileId(in.getFileId());
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
try {
callBackUrl = kswdownloadUrl+"?key="+URLEncoder.encode(getDownloadEncrypt(in.getFileId(),in.getUserToken()), "utf-8");
}catch (UnsupportedEncodingException e){
log.error("url转换失败",e);
CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("url获取失败", true);
}
if("9527007".equals(in.getType())){
url = kswpsurl;
KingSoftWpsVo vo = new KingSoftWpsVo();
vo.setSrcId(7);
vo.setStaffCode("ebtp");
@ -509,34 +526,38 @@ public class WpsServiceImpl implements WpsService {
vo.setFileName(fileName);
vo.setFileExtension(fileName.substring(fileName.lastIndexOf(".")+1,fileName.length()));
vo.setVersion(1);
vo.setDownloadUrl(callBackUrl);
try {
String url = kswdownloadUrl+"?key="+URLEncoder.encode(getDownloadEncrypt(in.getFileId(),in.getUserToken()), "utf-8");
vo.setDownloadUrl(url);
}catch (UnsupportedEncodingException e){
log.error("url转换失败",e);
CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("url获取失败", true);
}
byte[] b = getFileByFileId(in.getFileId());
vo.setSize(b.length);
vo.setCreator("ebtp");
vo.setModifier("ebtp");
String time = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
vo.setCreateTime(time);
//HttpServletRequest request = HttpContextUtils.getHttpServletRequest();
vo.setHost(kswhost);
vo.setLastModifiedTime(time);
String url = "";
if("9527007".equals(in.getType())){
url = kswpsurl;
dataJson = JSON.toJSONString(vo);
}else{
url = kswpsurl_preview;
KingSoftWpsPreviewVo vo = new KingSoftWpsPreviewVo();
vo.setSrcWpsNgProxy(kswhost);
vo.setStaffCode("ebtp");
vo.setFileKey(in.getFileId());
vo.setFileName(in.getFileName());
vo.setFileUrl(callBackUrl);
vo.setFileSize(b.length);
vo.setFileCreator("ebtp");
vo.setFileCreateTime(time);
vo.setFileLastModifiedTime(time);
dataJson = JSON.toJSONString(vo);
}
String retJson = HttpsUtils.UrlPost(url, "utf-8", JSON.toJSONString(vo));//httpPost(kswpsurl,json);
String retJson = HttpsUtils.UrlPost(url, "utf-8", dataJson);//httpPost(kswpsurl,json);
log.info("ret:"+retJson);
//String retJson = HttpUtils.httpPost(kswpsurl,json);

View File

@ -30,4 +30,9 @@ public class WpsClientInVo {
*0 查看 9527007 编辑
*/
private String type;
/**
* 文件后缀 初次编辑需要传 doc docx xls ...
*/
private String fileExtension;
}