生成pdf路径修改
continuous-integration/drone/push Build is passing Details

yxy/生成PDF
YXY 1 year ago
parent 1f8158549e
commit e063d68d86

@ -113,4 +113,4 @@ lark:
group: https://open.feishu.cn/open-apis/bot/v2/hook/cf432ef4-e526-4595-8330-2d2a361f7a29 group: https://open.feishu.cn/open-apis/bot/v2/hook/cf432ef4-e526-4595-8330-2d2a361f7a29
pdf: pdf:
generate: generate:
path: /pdf/dependence/file path: D:\test\

@ -0,0 +1,63 @@
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.ruoyi.common.core.domain.PdfEntity;
import com.ruoyi.common.utils.PdfUtils;
import com.ruoyi.flyingbook.domain.RequestVo;
import com.ruoyi.flyingbook.domain.template.CourseFeedbackTemplateDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Map;
/**
* @author yuxiangyong
* @create 2023-05-31 22:26
*/
@Component
public class LarkCreatePdfHelper {
@Value("${pdf.generate.path}")
private String pdfGeneratePath;
@Autowired
private PdfUtils pdfUtils;
public void createAndUpload(RequestVo request){
PdfEntity entity = new PdfEntity();
// GetAppTableRecordResp respBody = request.getRespBody();
// AppTableRecord record = respBody.getData().getRecord();
// CourseFeedbackTemplateDto data = build(record.getFields());
String pdfAllPath = new StringBuilder(pdfGeneratePath).append("pdf\\test1.pdf").toString();
String pdfWatermarkingAllPath = new StringBuilder(pdfGeneratePath).append("pdf\\test2.pdf").toString();
entity.setPdfAllPath(pdfAllPath);
entity.setPdfWatermarkingAllPath(pdfWatermarkingAllPath);
entity.setTitlePicAllPath(new StringBuilder(pdfGeneratePath).append("photo\\title.jpg").toString());
entity.setTemplatePath(new StringBuilder(pdfGeneratePath).append("template").toString());
entity.setFontAllPath(new StringBuilder(pdfGeneratePath).append("font\\simsun.ttc").toString());
entity.setWatermarkingPickAllPath(new StringBuilder(pdfGeneratePath).append("photo\\watermark.jpg").toString());
entity.setData(build(null));
entity.setTemplateName("COURSE_FEEDBACK.ftl");
pdfUtils.createFile(entity);
}
private CourseFeedbackTemplateDto build(Map<String, Object> fields){
CourseFeedbackTemplateDto resultDTO = new CourseFeedbackTemplateDto();
resultDTO.setProgram("program");
resultDTO.setStudentName("student");
resultDTO.setTutor("tutor");
resultDTO.setStartClassTime("2023-05-21 15:51:45");
resultDTO.setEndClassTime("2023-05-22 15:51:45");
resultDTO.setFeedback("作业完成情况");
resultDTO.setFeedbackScore("7 /10");
resultDTO.setPerformance("课堂表现");
resultDTO.setPerformanceScore("9/10");
resultDTO.setContent("<p>1、课堂内容1</p><p>1、课堂内容2</p>");
resultDTO.setWork("<p>1、课后作业1</p><p>1、课后作业2</p><p>1、课后作业3</p>");
return resultDTO;
}
}

@ -4,6 +4,7 @@ import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.PdfEntity; import com.ruoyi.common.core.domain.PdfEntity;
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.script.LarkCreatePdfHelper;
import com.ruoyi.flyingbook.domain.edi.EdiResponseVo; import com.ruoyi.flyingbook.domain.edi.EdiResponseVo;
import com.ruoyi.flyingbook.domain.edi.SyncToTableRequest; import com.ruoyi.flyingbook.domain.edi.SyncToTableRequest;
import com.ruoyi.flyingbook.domain.template.CourseFeedbackTemplateDto; import com.ruoyi.flyingbook.domain.template.CourseFeedbackTemplateDto;
@ -11,6 +12,7 @@ import com.ruoyi.flyingbook.edi.EdiOperateService;
import com.ruoyi.flyingbook.service.IEventLogService; import com.ruoyi.flyingbook.service.IEventLogService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -25,12 +27,17 @@ public class EdiController extends BaseController {
@Autowired @Autowired
private PdfUtils pdfUtils; private PdfUtils pdfUtils;
@Autowired @Autowired
private LarkCreatePdfHelper larkCreatePdfHelper;
@Autowired
private LarkFileHelper larkFileHelper; private LarkFileHelper larkFileHelper;
@Autowired @Autowired
ResourceLoader resourceLoader; ResourceLoader resourceLoader;
@Autowired @Autowired
private IEventLogService iEventLogService; private IEventLogService iEventLogService;
@Value("${pdf.generate.path}")
private String pdfGeneratePath;
/** /**
* *
*/ */
@ -41,28 +48,20 @@ public class EdiController extends BaseController {
@RequestMapping("/createPdf") @RequestMapping("/createPdf")
public void exportPdfDemo(@RequestParam("param") String param) throws Exception { public void exportPdfDemo(@RequestParam("param") String param) throws Exception {
larkCreatePdfHelper.createAndUpload(null);
PdfEntity entity = new PdfEntity(); // PdfEntity entity = new PdfEntity();
CourseFeedbackTemplateDto data = build(); // CourseFeedbackTemplateDto data = build();
String pdfAllPath = "D:\\test\\pdf\\test1.pdf"; // String pdfAllPath = "D:\\test\\pdf\\test1.pdf";
String pdfWatermarkingAllPath = "D:\\test\\pdf\\test2.pdf"; // String pdfWatermarkingAllPath = "D:\\test\\pdf\\test2.pdf";
entity.setPdfAllPath(pdfAllPath); // entity.setPdfAllPath(pdfAllPath);
entity.setPdfWatermarkingAllPath(pdfWatermarkingAllPath); // entity.setPdfWatermarkingAllPath(pdfWatermarkingAllPath);
entity.setTitlePicAllPath("D:\\test\\photo\\title.jpg"); // entity.setTitlePicAllPath("D:\\test\\photo\\title.jpg");
entity.setTemplatePath("D:\\test\\template"); // entity.setTemplatePath("D:\\test\\template");
entity.setFontAllPath("D:\\test\\font\\simsun.ttc"); // entity.setFontAllPath("D:\\test\\font\\simsun.ttc");
entity.setWatermarkingPickAllPath("D:\\test\\photo\\watermark.jpg"); // entity.setWatermarkingPickAllPath("D:\\test\\photo\\watermark.jpg");
entity.setData(data); // entity.setData(data);
entity.setTemplateName("COURSE_FEEDBACK.ftl"); // entity.setTemplateName("COURSE_FEEDBACK.ftl");
pdfUtils.createFile(entity); // pdfUtils.createFile(entity);
File file1 = new File(pdfAllPath);
if (file1.exists()){
file1.delete();
}
File file2 = new File(pdfWatermarkingAllPath);
if (file2.exists()){
file2.delete();
}
// LarkFileRequest fileRequest = new LarkFileRequest("cli_a482a8572cbc9013","lZNXbCLlOslWbwBIVc4qvgxOdnfA8Mos", // LarkFileRequest fileRequest = new LarkFileRequest("cli_a482a8572cbc9013","lZNXbCLlOslWbwBIVc4qvgxOdnfA8Mos",
// file2,file2.getName(),length.intValue(),"fldcnLt2RyUgDDD6rgC6K9gIWlM"); // file2,file2.getName(),length.intValue(),"fldcnLt2RyUgDDD6rgC6K9gIWlM");
// larkFileHelper.uploadFile(fileRequest); // larkFileHelper.uploadFile(fileRequest);

@ -1,12 +1,14 @@
package com.ruoyi.flyingbook.strategy.operate; package com.ruoyi.flyingbook.strategy.operate;
import com.alibaba.fastjson.JSONObject; import com.lark.oapi.service.bitable.v1.model.AppTableRecord;
import com.lark.oapi.service.bitable.v1.model.*; import com.lark.oapi.service.bitable.v1.model.GetAppTableRecordResp;
import com.ruoyi.common.enums.*; import com.ruoyi.common.enums.EventOperateStatus;
import com.ruoyi.common.enums.EventOperateType;
import com.ruoyi.common.enums.FlagStatus;
import com.ruoyi.common.enums.TableDetailRelationTypeEnum;
import com.ruoyi.flyingbook.LarkHelper.LarkTableFieldHelper; import com.ruoyi.flyingbook.LarkHelper.LarkTableFieldHelper;
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper; import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
import com.ruoyi.flyingbook.domain.*; import com.ruoyi.flyingbook.domain.*;
import com.ruoyi.flyingbook.domain.lark.LarkTableFieldRequest;
import com.ruoyi.flyingbook.domain.lark.LarkTableRequest; import com.ruoyi.flyingbook.domain.lark.LarkTableRequest;
import com.ruoyi.flyingbook.service.*; import com.ruoyi.flyingbook.service.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -15,7 +17,6 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.lang.reflect.Field;
import java.util.*; import java.util.*;
@ -45,18 +46,6 @@ public class MultidimensionalTableMaintenanceRowOperate extends LarkAbstract {
protected IEventService eventService; protected IEventService eventService;
@Autowired @Autowired
protected IEventLogService eventLogService; protected IEventLogService eventLogService;
/**
*
*/
protected static final String CREATE_OPERATE = "CREATE_OPERATE";
/**
*
*/
protected static final String UPDATE_OPERATE = "UPDATE_OPERATE";
/**
*
*/
protected static final String DELETE_OPERATE = "DELETE_OPERATE";
@Override @Override
protected void preOperate(RequestVo request) { protected void preOperate(RequestVo request) {

@ -5,7 +5,6 @@ import com.google.gson.internal.LinkedTreeMap;
import com.lark.oapi.service.bitable.v1.model.*; import com.lark.oapi.service.bitable.v1.model.*;
import com.ruoyi.common.constant.RedisConstants; import com.ruoyi.common.constant.RedisConstants;
import com.ruoyi.common.enums.*; import com.ruoyi.common.enums.*;
import com.ruoyi.common.utils.sign.Md5Utils;
import com.ruoyi.flyingbook.LarkHelper.LarkTableFieldHelper; import com.ruoyi.flyingbook.LarkHelper.LarkTableFieldHelper;
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper; import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
import com.ruoyi.flyingbook.domain.*; import com.ruoyi.flyingbook.domain.*;
@ -16,7 +15,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;

@ -1,13 +1,18 @@
package com.ruoyi.flyingbook.strategy.operate; package com.ruoyi.flyingbook.strategy.operate;
import com.ruoyi.common.enums.TableDetailRelationTypeEnum; import com.ruoyi.common.enums.TableDetailRelationTypeEnum;
import com.ruoyi.flyingbook.domain.*; import com.ruoyi.flyingbook.domain.LarkTableRelation;
import com.ruoyi.flyingbook.service.*; import com.ruoyi.flyingbook.domain.LarkTableRowRelation;
import com.ruoyi.flyingbook.domain.RequestVo;
import com.ruoyi.flyingbook.service.ILarkTableRowRelationService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**

Loading…
Cancel
Save