提交 金山pws接口
This commit is contained in:
@ -81,4 +81,51 @@ public class WpsController {
|
||||
return this.wpsService.saveWpsFile(token,userId,userName,fileId,fileName,file);
|
||||
}
|
||||
|
||||
/**
|
||||
* (金山)获得编辑或查看链接
|
||||
*
|
||||
* @param in
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("(金山)获得编辑或查看链接")
|
||||
@PostMapping("/kingSoft/getWpsUrl")
|
||||
public BaseResponse<WpsResultVo> getKSWpsUrl(WpsClientInVo in) {
|
||||
WpsResultVo str = null;//this.wpsService.getWpsUrl(in);
|
||||
log.info("----调用天擎WPS接口---getWpsUrl-------:"+str);
|
||||
return BaseResponse.success(str);
|
||||
}
|
||||
/**
|
||||
* (金山)沃文档回调-查询文档
|
||||
* 编辑 permission=write
|
||||
* 预览 permission=read
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("(金山)沃文档回调-查询文档")
|
||||
@GetMapping("/kingSoft/file/{id}")
|
||||
public BaseResponse<String> getKSFile(@PathVariable String id) {
|
||||
return BaseResponse.success(this.wpsService.getKSWpsFile(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 沃文档回调-保存文档
|
||||
* @param token
|
||||
* @param userId
|
||||
* @param userName
|
||||
* @param fileId
|
||||
* @param fileName
|
||||
* @param file
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation("沃文档回调-保存文档")
|
||||
@PostMapping("/kingSoft/file/save")
|
||||
@OperationLogDetail(businessModule = EbtpLogBusinessModule.OTHER,operationType = EbtpLogType.SELECT,detail = "沃文档回调-保存文档")
|
||||
public Object saveKSFile(@RequestHeader("X-Weboffice-Token") String token,
|
||||
@RequestParam("_w_third_user_id") String userId,
|
||||
@RequestParam("_w_third_user_name") String userName,
|
||||
@RequestParam("_w_third_file_id") String fileId,
|
||||
@RequestParam("_w_third_file_name") String fileName,
|
||||
@RequestPart("file") File file) {
|
||||
return this.wpsService.saveWpsFile(token,userId,userName,fileId,fileName,file);
|
||||
}
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypBean;
|
||||
import com.chinaunicom.mall.ebtp.extend.crypconfigure.entity.CrypConfigure;
|
||||
import com.chinaunicom.mall.ebtp.extend.wps.vo.WpsClientInVo;
|
||||
import com.chinaunicom.mall.ebtp.extend.wps.vo.WpsResultVo;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Map;
|
||||
@ -22,4 +23,6 @@ public interface WpsService{
|
||||
Object getWpsFile(String token, String userId, String userName, String fileId, String fileName, String permission);
|
||||
|
||||
Object saveWpsFile(String token, String userId, String userName, String fileId, String fileName, File file);
|
||||
|
||||
String getKSWpsFile(String id);
|
||||
}
|
||||
|
@ -2,12 +2,14 @@ package com.chinaunicom.mall.ebtp.extend.wps.service.impl;
|
||||
|
||||
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.api.AttachmentClient;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentDetail;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.AttachmentEntity;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.DownloadEntity;
|
||||
import com.chinaunicom.ebtp.mall.cloud.attachment.sdk.model.UploadObject;
|
||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
|
||||
import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
|
||||
@ -44,6 +46,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.zip.ZipEntry;
|
||||
|
||||
/**
|
||||
* 沃文档-wps在线文档
|
||||
@ -467,6 +470,7 @@ public class WpsServiceImpl implements WpsService {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws UnsupportedEncodingException {
|
||||
String str = URLEncoder.encode("file_preview,file_edit,file_format_control","utf-8");
|
||||
System.out.println(str);
|
||||
@ -475,4 +479,14 @@ public class WpsServiceImpl implements WpsService {
|
||||
System.out.println(str1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getKSWpsFile(String id){
|
||||
Optional<AttachmentEntity> optional=attachmentClient.findByObjectId(id);
|
||||
|
||||
Optional<byte[]> optional1 = attachmentClient.downloadFileByObjectId(optional.get().getId());
|
||||
|
||||
return new String(Base64.getEncoder().encode(optional1.get()));
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user