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

@ -1,12 +1,14 @@
package com.ruoyi.flyingbook.strategy.operate;
import com.alibaba.fastjson.JSONObject;
import com.lark.oapi.service.bitable.v1.model.*;
import com.ruoyi.common.enums.*;
import com.lark.oapi.service.bitable.v1.model.AppTableRecord;
import com.lark.oapi.service.bitable.v1.model.GetAppTableRecordResp;
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.LarkTableHelper;
import com.ruoyi.flyingbook.domain.*;
import com.ruoyi.flyingbook.domain.lark.LarkTableFieldRequest;
import com.ruoyi.flyingbook.domain.lark.LarkTableRequest;
import com.ruoyi.flyingbook.service.*;
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.stereotype.Component;
import java.lang.reflect.Field;
import java.util.*;
@ -45,18 +46,6 @@ public class MultidimensionalTableMaintenanceRowOperate extends LarkAbstract {
protected IEventService eventService;
@Autowired
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
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.ruoyi.common.constant.RedisConstants;
import com.ruoyi.common.enums.*;
import com.ruoyi.common.utils.sign.Md5Utils;
import com.ruoyi.flyingbook.LarkHelper.LarkTableFieldHelper;
import com.ruoyi.flyingbook.LarkHelper.LarkTableHelper;
import com.ruoyi.flyingbook.domain.*;
@ -16,7 +15,6 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;

@ -1,13 +1,18 @@
package com.ruoyi.flyingbook.strategy.operate;
import com.ruoyi.common.enums.TableDetailRelationTypeEnum;
import com.ruoyi.flyingbook.domain.*;
import com.ruoyi.flyingbook.service.*;
import com.ruoyi.flyingbook.domain.LarkTableRelation;
import com.ruoyi.flyingbook.domain.LarkTableRowRelation;
import com.ruoyi.flyingbook.domain.RequestVo;
import com.ruoyi.flyingbook.service.ILarkTableRowRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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