|
|
|
@ -3,6 +3,7 @@ package com.ruoyi.flyingbook.LarkHelper.script;
|
|
|
|
|
import com.lark.oapi.service.bitable.v1.model.AppTableRecord;
|
|
|
|
|
import com.lark.oapi.service.bitable.v1.model.GetAppTableRecordResp;
|
|
|
|
|
import com.lark.oapi.service.drive.v1.model.UploadAllFileRespBody;
|
|
|
|
|
import com.lark.oapi.service.drive.v1.model.UploadAllMediaRespBody;
|
|
|
|
|
import com.ruoyi.common.core.domain.PdfEntity;
|
|
|
|
|
import com.ruoyi.common.enums.ConfigurationSubTypeEnum;
|
|
|
|
|
import com.ruoyi.common.enums.ConfigurationTypeEnum;
|
|
|
|
@ -24,10 +25,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @author yuxiangyong
|
|
|
|
@ -94,10 +92,12 @@ public class LarkCreatePdfHelper {
|
|
|
|
|
File file = new File(pdfWatermarkingAllPath);
|
|
|
|
|
Long length = file.length();
|
|
|
|
|
LarkFileRequest fileRequest = new LarkFileRequest(request.getAppId(),request.getAppSecret(),
|
|
|
|
|
file,file.getName(),length.intValue(),folderToken);
|
|
|
|
|
UploadAllFileRespBody uploadAllFileRespBody = larkFileHelper.uploadFile(fileRequest);
|
|
|
|
|
String fileToken = uploadAllFileRespBody.getFileToken();
|
|
|
|
|
fields.put("file_token", fileToken);
|
|
|
|
|
file,file.getName(),length.intValue(),tableRelation.getFromTableId());
|
|
|
|
|
UploadAllMediaRespBody uploadAllMediaRespBody = larkFileHelper.uploadMediaFile(fileRequest);
|
|
|
|
|
String fileToken = uploadAllMediaRespBody.getFileToken();
|
|
|
|
|
Map<String,Object> fileMap = new HashMap<>();
|
|
|
|
|
fileMap.put("file_token",fileToken);
|
|
|
|
|
fields.put("附件", Arrays.asList(fileMap));
|
|
|
|
|
LarkTableRequest updateRequest = new LarkTableRequest(request.getAppId(),request.getAppSecret(),
|
|
|
|
|
tableRelation.getFromAppToken(),tableRelation.getFromTableId(),record.getRecordId(),fields);
|
|
|
|
|
larkTableHelper.updateTableRecord(updateRequest);
|
|
|
|
|