diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 0ceb0d1..639ec4f 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -47,6 +47,11 @@ com.ruoyi ruoyi-generator + + org.projectlombok + lombok + provided + diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 91a46c3..972f8c1 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -17,7 +17,13 @@ - + + + com.itextpdf + itext7-core + 7.2.0 + pom + @@ -158,6 +164,11 @@ com.baomidou lock4j-redisson-spring-boot-starter + + org.projectlombok + lombok + provided + diff --git a/ruoyi-framework/pom.xml b/ruoyi-framework/pom.xml index 29693b4..fb0dde6 100644 --- a/ruoyi-framework/pom.xml +++ b/ruoyi-framework/pom.xml @@ -77,6 +77,11 @@ commons-codec 1.15 + + org.projectlombok + lombok + provided + diff --git a/ruoyi-generator/pom.xml b/ruoyi-generator/pom.xml index 8073706..8181fc4 100644 --- a/ruoyi-generator/pom.xml +++ b/ruoyi-generator/pom.xml @@ -28,6 +28,11 @@ com.ruoyi ruoyi-common + + org.projectlombok + lombok + provided + diff --git a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java index 5d5c6a4..9cd4265 100644 --- a/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java +++ b/ruoyi-generator/src/main/java/com/ruoyi/generator/domain/GenTable.java @@ -234,4 +234,4 @@ public class GenTable implements Serializable { } return StrUtil.equalsAnyIgnoreCase(javaField, GenConstants.BASE_ENTITY); } -} \ No newline at end of file +} diff --git a/ruoyi-quartz/pom.xml b/ruoyi-quartz/pom.xml index cfcbffc..b1a3a97 100644 --- a/ruoyi-quartz/pom.xml +++ b/ruoyi-quartz/pom.xml @@ -34,6 +34,11 @@ com.ruoyi ruoyi-common + + org.projectlombok + lombok + provided + diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java index b1c8941..6174b01 100644 --- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java +++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/domain/SysJob.java @@ -11,6 +11,8 @@ import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; + + import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.io.Serializable; diff --git a/ruoyi-system/pom.xml b/ruoyi-system/pom.xml index 256c42c..ccb0057 100644 --- a/ruoyi-system/pom.xml +++ b/ruoyi-system/pom.xml @@ -28,6 +28,11 @@ 5.5.12 compile + + org.projectlombok + lombok + provided + diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppCheckDailyNewspaperRes.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppCheckDailyNewspaperRes.java index 5934f93..e3f1f08 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppCheckDailyNewspaperRes.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/bo/res/WgzAppCheckDailyNewspaperRes.java @@ -82,11 +82,11 @@ public class WgzAppCheckDailyNewspaperRes implements Serializable { @ApiModelProperty("备注") private String remark; - @ApiModelProperty("姓名") - private String username; + @ApiModelProperty("审核人姓名") + private String auditorUserName; @ApiModelProperty("头像地址") - private String avatarName; + private String auditorUserHead; @ApiModelProperty("日报状态(0正常 1补卡)") private String status; diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzReissueacard.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzReissueacard.java index a7f6271..43dcfdf 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzReissueacard.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/domain/WgzReissueacard.java @@ -51,6 +51,12 @@ public class WgzReissueacard implements Serializable { @ApiModelProperty("打卡ID") private Long attendanceId; + /** 考勤招工申请Id */ + @Excel(name = "考勤招工申请Id") + @ApiModelProperty("考勤招工申请Id") + private Long applyKey; + + /** 状态(0上班补卡 1下班补卡) */ @Excel(name = "状态" , readConverterExp = "0=上班补卡,1=下班补卡") @ApiModelProperty("状态(0上班补卡 1下班补卡)") diff --git a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java index 92b0a16..d12ed41 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/wgz/service/impl/WgzDailyClockServiceImpl.java @@ -327,7 +327,7 @@ public class WgzDailyClockServiceImpl extends ServicePlusImpl we = baseMapper.pdfSc(userId); if (!we.isEmpty()) { @@ -262,69 +278,106 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl 0 { -// value, _ := dao.BusQuestionSave.Ctx(ctx).Where("openid", req.Openid).Where("correct", "1").Fields("sum(score)").Value() -// s := configurationEntity.SingleChoice -// m := configurationEntity.MultipleChoice -// e := configurationEntity.Estimate -// var rs *model.ExaminationPaperRes -// rs = &model.ExaminationPaperRes{ -// UserName: we[0].UserName, -// Pass: we[0].Pass, -// SumScore: value.String(), -// Sign: signature.Signature, -// Openid: req.Openid, -// } -// var one = new(model.ExaminationPaperOne) -// var two = new(model.ExaminationPaperOne) -// var three = new(model.ExaminationPaperOne) -// one.Topic = "一、单选题,共" + strconv.Itoa(s) + "道题,每小题" + strconv.FormatFloat(configurationEntity.SingleScore, 'f', -1, 64) + "分,共计" + strconv.FormatFloat(float64(s)*configurationEntity.SingleScore, 'f', -1, 64) + "分" -// two.Topic = "二、多选题,共" + strconv.Itoa(m) + "道题,每小题" + strconv.FormatFloat(configurationEntity.MultipleScore, 'f', -1, 64) + "分,共计" + strconv.FormatFloat(float64(m)*configurationEntity.MultipleScore, 'f', -1, 64) + "分" -// three.Topic = "三、判断题,共" + strconv.Itoa(e) + "道题,每小题" + strconv.FormatFloat(configurationEntity.EstimateScore, 'f', -1, 64) + "分,共计" + strconv.FormatFloat(float64(e)*configurationEntity.EstimateScore, 'f', -1, 64) + "分" -// var sEntity []*model.ExaminationPaperTwo -// var mEntity []*model.ExaminationPaperTwo -// var eEntity []*model.ExaminationPaperTwo -// for _, data := range we { -// var sy *model.ExaminationPaperTwo -// sy = &model.ExaminationPaperTwo{ -// QuestionText: data.QuestionText, -// Options: data.Options, -// Answer: data.Answer, -// CorrectAnswer: data.CorrectAnswer, -// Correct: data.Correct, -// Score: data.Score, -// } -// if data.QuestionType == "1" { -// sEntity = append(sEntity, sy) -// } else if data.QuestionType == "2" { -// mEntity = append(mEntity, sy) -// } else if data.QuestionType == "3" { -// eEntity = append(eEntity, sy) -// } -// } -// one.List = sEntity -// two.List = mEntity -// three.List = eEntity -// rs.Single = one -// rs.Multiple = two -// rs.Estimate = three -// path, errPath := Wo(rs) -// if errPath != nil { -// errPath = errors.New("生成PDF试卷出现了意外,请重新提交!") -// liberr.ErrIsNil(ctx, errPath) -// return -// } else { -// path = strings.Replace(path, "resource/public", "/wxfile", 1) -// _, err = g.DB().Insert(ctx, "bus_question_save_pdf", gdb.Map{ -// "openid": req.Openid, -// "path": path, -// }) -// res.PdfStr = path + throw new RuntimeException("未获取到试卷信息!"); + } + + public String generateExamPaper(ExaminationPaper rs) throws IOException { + String fileName = "exam_paper_" + System.currentTimeMillis() + ".pdf"; + String outputPath = Paths.get(System.getProperty("user.dir"), fileName).toString(); + + PdfWriter writer = new PdfWriter(outputPath); + PdfDocument pdfDoc = new PdfDocument(writer); + Document document = new Document(pdfDoc, PageSize.A4); + + // 加载字体(确保 simhei.ttf 可用) + String fontPath = "ruoyi/uploadPath/appResource/font/simhei.ttf"; + PdfFont simhei = PdfFontFactory.createFont(fontPath, PdfEncodings.IDENTITY_H); + PdfFont simheiBold = PdfFontFactory.createFont(fontPath, PdfEncodings.IDENTITY_H); + + // 标题 + document.setFont(simheiBold).setFontSize(36); + + document.add(new Paragraph("《灵活用工岗前培训》") + .setTextAlignment(TextAlignment.CENTER)); + + document.add(new Paragraph("\n")); + + // 考生信息 + document.setFont(simhei).setFontSize(16); + document.add(new Paragraph("姓名: " + rs.getUserName())); + document.add(new Paragraph("及格线/总分: " + rs.getPass())); + document.add(new Paragraph("实际得分: " + rs.getSumScore())); + document.add(new Paragraph("\n")); + + // 处理单选、多选、判断题 + for (int i = 1; i <= 3; i++) { + ExaminationPaperOne ep; + if (i == 1) { + ep = rs.getSingle(); + } else if (i == 2) { + ep = rs.getMultiple(); + } else { + ep = rs.getEstimate(); + } + + document.setFont(simhei).setFontSize(20); + document.add(new Paragraph(ep.getTopic())); + + document.setFont(simhei).setFontSize(12); + List questionList = ep.getList(); + for (int qIndex = 0; qIndex < questionList.size(); qIndex++) { + ExaminationPaperTwo data = questionList.get(qIndex); + String questionText = (i == 3) ? + (qIndex + 1) + "、" + data.getQuestionText() + "( " + data.getAnswer() + " )" + : (qIndex + 1) + "、" + replaceBrackets(data.getQuestionText(), data.getAnswer()); + + document.add(new Paragraph(questionText)); + + // 选项 + String[] options = data.getOptions().split("@"); + for (String option : options) { + document.add(new Paragraph(" " + option)); + } + + // 标记错误答案 + if ("2".equals(data.getCorrect())) { + document.add(new Paragraph("正确答案为:" + data.getCorrectAnswer()) + .setFontColor(com.itextpdf.kernel.colors.ColorConstants.RED)); + } + + document.add(new Paragraph("\n")); + } + } + +// // 签名部分 +// document.add(new Paragraph("\n\n\n")); +// document.setFont(simheiBold).setFontSize(16); +// document.add(new Paragraph("签字:").setTextAlignment(TextAlignment.RIGHT)); +// // 嵌入签名图片 +// if (rs.getSign() != null && !rs.getSign().isEmpty()) { +// String signPath = Paths.get(System.getProperty("user.dir"), rs.getSign()).toString(); +// File signFile = new File(signPath); +// if (signFile.exists()) { +// ImageData imageData = ImageDataFactory.create(signPath); +// Image image = new Image(imageData).scaleToFit(100, 50); +// document.add(image.setRotationAngle(Math.PI / 2)); // } // } -// liberr.ErrIsNil(ctx, err, "添加失败") + + document.close(); + return outputPath; + } + + private static String replaceBrackets(String text, String replacement) { + Pattern pattern = Pattern.compile("\\s*(\\s*)\\s*"); + Matcher matcher = pattern.matcher(text); + return matcher.replaceAll("( " + replacement + " )"); } @Override @@ -402,4 +455,5 @@ public class WgzQuestionSaveServiceImpl extends ServicePlusImpl