|
|
@ -3,20 +3,25 @@ package com.ruoyi.flyingbook.LarkHelper.script;
|
|
|
|
import com.google.gson.internal.LinkedTreeMap;
|
|
|
|
import com.google.gson.internal.LinkedTreeMap;
|
|
|
|
import com.lark.oapi.service.bitable.v1.model.AppTableRecord;
|
|
|
|
import com.lark.oapi.service.bitable.v1.model.AppTableRecord;
|
|
|
|
import com.lark.oapi.service.bitable.v1.model.GetAppTableRecordResp;
|
|
|
|
import com.lark.oapi.service.bitable.v1.model.GetAppTableRecordResp;
|
|
|
|
|
|
|
|
import com.lark.oapi.service.drive.v1.model.BatchGetTmpDownloadUrlMediaRespBody;
|
|
|
|
|
|
|
|
import com.lark.oapi.service.drive.v1.model.TmpDownloadUrl;
|
|
|
|
import com.lark.oapi.service.drive.v1.model.UploadAllMediaRespBody;
|
|
|
|
import com.lark.oapi.service.drive.v1.model.UploadAllMediaRespBody;
|
|
|
|
import com.ruoyi.common.constant.Constants;
|
|
|
|
import com.ruoyi.common.constant.Constants;
|
|
|
|
import com.ruoyi.common.core.domain.PdfEntity;
|
|
|
|
import com.ruoyi.common.core.domain.PdfEntity;
|
|
|
|
import com.ruoyi.common.enums.ConfigurationSubTypeEnum;
|
|
|
|
import com.ruoyi.common.enums.ConfigurationSubTypeEnum;
|
|
|
|
import com.ruoyi.common.enums.ConfigurationTypeEnum;
|
|
|
|
import com.ruoyi.common.enums.ConfigurationTypeEnum;
|
|
|
|
import com.ruoyi.common.enums.FlagStatus;
|
|
|
|
import com.ruoyi.common.enums.FlagStatus;
|
|
|
|
|
|
|
|
import com.ruoyi.common.enums.TemplateSubTypeEnum;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
|
import com.ruoyi.common.utils.PdfUtils;
|
|
|
|
import com.ruoyi.common.utils.PdfUtils;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkFileHelper;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkFileHelper;
|
|
|
|
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkRobotHelper;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
|
|
|
|
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkTableConfiguration;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkTableConfiguration;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkTableRelation;
|
|
|
|
import com.ruoyi.flyingbook.domain.LarkTableRelation;
|
|
|
|
import com.ruoyi.flyingbook.domain.RequestVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.RequestVo;
|
|
|
|
import com.ruoyi.flyingbook.domain.lark.LarkFileRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.lark.LarkFileRequest;
|
|
|
|
|
|
|
|
import com.ruoyi.flyingbook.domain.lark.LarkRobotRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.lark.LarkTableRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.lark.LarkTableRequest;
|
|
|
|
import com.ruoyi.flyingbook.domain.template.CourseFeedbackTemplateDto;
|
|
|
|
import com.ruoyi.flyingbook.domain.template.CourseFeedbackTemplateDto;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkTableConfigurationMapper;
|
|
|
|
import com.ruoyi.flyingbook.mapper.LarkTableConfigurationMapper;
|
|
|
@ -51,6 +56,8 @@ public class LarkCreatePdfHelper {
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private LarkTableHelper larkTableHelper;
|
|
|
|
private LarkTableHelper larkTableHelper;
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
|
|
private LarkRobotHelper larkRobotHelper;
|
|
|
|
|
|
|
|
|
|
|
|
private static final String FOLDER_SPLIT = Constants.FOLDER_SPLIT;
|
|
|
|
private static final String FOLDER_SPLIT = Constants.FOLDER_SPLIT;
|
|
|
|
|
|
|
|
|
|
|
@ -112,12 +119,23 @@ public class LarkCreatePdfHelper {
|
|
|
|
String fileToken = uploadAllMediaRespBody.getFileToken();
|
|
|
|
String fileToken = uploadAllMediaRespBody.getFileToken();
|
|
|
|
Map<String, Object> fileMap = new HashMap<>();
|
|
|
|
Map<String, Object> fileMap = new HashMap<>();
|
|
|
|
fileMap.put("file_token", fileToken);
|
|
|
|
fileMap.put("file_token", fileToken);
|
|
|
|
|
|
|
|
String user = getUser(fields.get("人员"), "id");
|
|
|
|
fields.clear();
|
|
|
|
fields.clear();
|
|
|
|
fields.put(attachment, Arrays.asList(fileMap));
|
|
|
|
fields.put(attachment, Arrays.asList(fileMap));
|
|
|
|
LarkTableRequest updateRequest = new LarkTableRequest(request.getAppId(), request.getAppSecret(),
|
|
|
|
LarkTableRequest updateRequest = new LarkTableRequest(request.getAppId(), request.getAppSecret(),
|
|
|
|
tableRelation.getFromAppToken(), tableRelation.getFromTableId(), record.getRecordId(), fields);
|
|
|
|
tableRelation.getFromAppToken(), tableRelation.getFromTableId(), record.getRecordId(), fields);
|
|
|
|
larkTableHelper.updateTableRecord(updateRequest);
|
|
|
|
larkTableHelper.updateTableRecord(updateRequest);
|
|
|
|
removeLocalFile(file);
|
|
|
|
removeLocalFile(file);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LarkFileRequest getTokenUrl = new LarkFileRequest(request.getAppId(), request.getAppSecret(), fileToken);
|
|
|
|
|
|
|
|
BatchGetTmpDownloadUrlMediaRespBody temporaryMediaFileLink = larkFileHelper.getTemporaryMediaFileLink(getTokenUrl);
|
|
|
|
|
|
|
|
TmpDownloadUrl[] tmpDownloadUrls = temporaryMediaFileLink.getTmpDownloadUrls();
|
|
|
|
|
|
|
|
if (tmpDownloadUrls != null && tmpDownloadUrls.length > 0){
|
|
|
|
|
|
|
|
TmpDownloadUrl tmpDownloadUrl = tmpDownloadUrls[0];
|
|
|
|
|
|
|
|
String content = String.format("{\"text\":\"课程反馈表已生成完毕,%s\"}", tmpDownloadUrl.getTmpDownloadUrl());
|
|
|
|
|
|
|
|
LarkRobotRequest larkRobotRequest = new LarkRobotRequest(request.getAppId(), request.getAppSecret(), user, TemplateSubTypeEnum.TEXT.getCode(),content);
|
|
|
|
|
|
|
|
larkRobotHelper.sendUserMessage(larkRobotRequest);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|