|
|
|
@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -103,6 +104,7 @@ public class LarkCreatePdfHelper {
|
|
|
|
|
entity.setTemplateName("JTDX_PDF_TEMPLATE.ftl");
|
|
|
|
|
pdfUtils.createFile(entity);
|
|
|
|
|
File file = new File(pdfWatermarkingAllPath);
|
|
|
|
|
if (file.exists()) {
|
|
|
|
|
Long length = file.length();
|
|
|
|
|
LarkFileRequest fileRequest = new LarkFileRequest(request.getAppId(), request.getAppSecret(),
|
|
|
|
|
file, file.getName(), length.intValue(), tableRelation.getFromAppToken());
|
|
|
|
@ -115,6 +117,16 @@ public class LarkCreatePdfHelper {
|
|
|
|
|
LarkTableRequest updateRequest = new LarkTableRequest(request.getAppId(), request.getAppSecret(),
|
|
|
|
|
tableRelation.getFromAppToken(), tableRelation.getFromTableId(), record.getRecordId(), fields);
|
|
|
|
|
larkTableHelper.updateTableRecord(updateRequest);
|
|
|
|
|
removeLocalFile(file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void removeLocalFile(File file){
|
|
|
|
|
try {
|
|
|
|
|
file.delete();
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.error("LarkCreatePdfHelper removeLocalFile fail",e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private LarkTableConfiguration check(RequestVo request) {
|
|
|
|
@ -141,10 +153,12 @@ public class LarkCreatePdfHelper {
|
|
|
|
|
resultDTO.setProgram(program);
|
|
|
|
|
resultDTO.setStudentName(getUser(fields.get("人员"),"name"));
|
|
|
|
|
resultDTO.setTutor(getUser(fields.get("人员"),"name"));
|
|
|
|
|
String startTimeStr = getTimeByDate(fields.get("日期"));
|
|
|
|
|
String endTimeStr = getTimeByDate(fields.get("日期"));
|
|
|
|
|
resultDTO.setStartClassTime(startTimeStr);
|
|
|
|
|
resultDTO.setEndClassTime(endTimeStr);
|
|
|
|
|
LocalDateTime startTime = getTimeByDate(fields.get("日期"));
|
|
|
|
|
LocalDateTime endTime = getTimeByDate(fields.get("日期"));
|
|
|
|
|
resultDTO.setMonth(String.valueOf(startTime.getMonthValue()));
|
|
|
|
|
resultDTO.setDay(String.valueOf(startTime.getDayOfMonth()));
|
|
|
|
|
resultDTO.setStartClassTime(DateUtils.ldt2str(startTime,DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
|
|
resultDTO.setEndClassTime(DateUtils.ldt2str(endTime,DateUtils.YYYY_MM_DD_HH_MM_SS));
|
|
|
|
|
resultDTO.setFeedback("作业完成情况");
|
|
|
|
|
Integer feedbackScore = getNumber(fields.get("数字"));
|
|
|
|
|
resultDTO.setFeedbackScore(String.format("%s /10",feedbackScore));
|
|
|
|
@ -170,9 +184,9 @@ public class LarkCreatePdfHelper {
|
|
|
|
|
/**
|
|
|
|
|
* 获取日期信息
|
|
|
|
|
*/
|
|
|
|
|
private String getTimeByDate(Object data){
|
|
|
|
|
private LocalDateTime getTimeByDate(Object data){
|
|
|
|
|
try {
|
|
|
|
|
return DateUtils.e2Str(data,DateUtils.YYYY_MM_DD_HH_MM_SS);
|
|
|
|
|
return DateUtils.e2ldt(data);
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
log.info("LarkCreatePdfHelper getTimeByDate data",data,e);
|
|
|
|
|
}
|
|
|
|
|