Browse Source

3.3.1 update

xiaofei 1 năm trước cách đây
mục cha
commit
897e1b31ac

+ 37 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/ExaminationImportDto.java

@@ -66,10 +66,18 @@ public class ExaminationImportDto {
     @ExcelDBFieldDesc(name = "专业")
     private String majorName;
 
-    @ApiModelProperty(value = "班级")
-    @ExcelDBFieldDesc(name = "班级")
+    @ApiModelProperty(value = "教学班")
+    @ExcelDBFieldDesc(name = "教学班")
+    private String teachClazzName;
+
+    @ApiModelProperty(value = "行政班")
+    @ExcelDBFieldDesc(name = "行政班")
     private String clazzName;
 
+    @ApiModelProperty(value = "任课老师")
+    @ExcelDBFieldDesc(name = "任课老师")
+    private String teacherName;
+
     @ApiModelProperty(value = "课程创建的任务序号")
     private String sequence;
 
@@ -90,6 +98,9 @@ public class ExaminationImportDto {
     @ApiModelProperty(value = "报错信息")
     private String errorMessage;
 
+    @ApiModelProperty(value = "任课老师ID")
+    private Long teacherId;
+
     public ExaminationImportDto() {
     }
 
@@ -253,6 +264,30 @@ public class ExaminationImportDto {
         this.clazzName = clazzName;
     }
 
+    public String getTeachClazzName() {
+        return teachClazzName;
+    }
+
+    public void setTeachClazzName(String teachClazzName) {
+        this.teachClazzName = teachClazzName;
+    }
+
+    public String getTeacherName() {
+        return teacherName;
+    }
+
+    public void setTeacherName(String teacherName) {
+        this.teacherName = teacherName;
+    }
+
+    public Long getTeacherId() {
+        return teacherId;
+    }
+
+    public void setTeacherId(Long teacherId) {
+        this.teacherId = teacherId;
+    }
+
     public String getErrorMessage() {
         return errorMessage;
     }

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/PrintCommonService.java

@@ -18,6 +18,7 @@ import com.qmth.teachcloud.common.entity.BasicCourse;
 import com.qmth.teachcloud.common.entity.SysOrg;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ClassifyEnum;
+import com.qmth.teachcloud.common.enums.PageSizeEnum;
 import com.qmth.teachcloud.common.enums.TaskTypeEnum;
 import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.mark.entity.MarkPaper;
@@ -73,8 +74,7 @@ public interface PrintCommonService {
 
     BasicAttachment saveAttachmentPdfFromHtml(String fileName, String htmlContent, Long userId, List<PdfDto> localFileList, List<File> fileTempList) throws IOException;
 
-    BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList) throws IOException;
-
+    BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList, PageSizeEnum pageSizeEnum) throws IOException;
     /**
      * 保存html附件和该html转成pdf的附件
      *

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicExamStudentServiceImpl.java

@@ -289,7 +289,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
 
         // 校验2 试卷编号存在时,任课教师,考试时间,考点考场均必填;
         BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
-        boolean needPaperNumber = basicSchool.getHasPaperNumber();
+        boolean needPaperNumber = basicSchool.getHasPaperNumber() == null ? false : basicSchool.getHasPaperNumber();
         if (SystemConstant.strNotNull(paperNumber)) {
             String hasPaperNumberError = "试卷编号不为空时: ";
             if (!SystemConstant.strNotNull(teacherCode) || !SystemConstant.strNotNull(teacherName)) {

+ 3 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ExamDetailServiceImpl.java

@@ -791,6 +791,9 @@ public class ExamDetailServiceImpl extends ServiceImpl<ExamDetailMapper, ExamDet
             examStudent.setCollegeName(collegeName);
             examStudent.setMajorName(majorName);
             examStudent.setTeachClazzName(clazzName);
+            examStudent.setTeachClazzName(examinationImportDto.getTeachClazzName());
+            examStudent.setTeacherName(examinationImportDto.getTeacherName());
+            examStudent.setTeacherId(examinationImportDto.getTeacherId());
             examStudent.setCreateId(sysUser.getId());
             examStudentList.add(examStudent);
         }

+ 4 - 4
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/PrintCommonServiceImpl.java

@@ -654,7 +654,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
             htmlFileTemp = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
             FileCopyUtils.copy(htmlContent.getBytes(StandardCharsets.UTF_8), htmlFileTemp);
 
-            return saveAttachmentPdfFromHtml(fileName, htmlFileTemp, userId, localFileList, fileTempList);
+            return saveAttachmentPdfFromHtml(fileName, htmlFileTemp, userId, localFileList, fileTempList, PageSizeEnum.A3);
         } catch (Exception e) {
             log.error(SystemConstant.LOG_ERROR, e);
             basicAttachmentService.deleteAttachment(basicAttachment);
@@ -673,14 +673,14 @@ public class PrintCommonServiceImpl implements PrintCommonService {
 
     @Override
     @Transactional
-    public BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList) {
+    public BasicAttachment saveAttachmentPdfFromHtml(String fileName, File file, Long userId, List<PdfDto> localFileList, List<File> fileTempList, PageSizeEnum pageSizeEnum) {
         BasicAttachment basicAttachment = null;
         File pdfFileTemp = null;
         try {
 
             pdfFileTemp = SystemConstant.getFileTempVar(SystemConstant.PDF_PREFIX);
             // html转pdf
-            HtmlToPdfUtil.convert(file.getPath(), pdfFileTemp.getPath(), PageSizeEnum.A3);
+            HtmlToPdfUtil.convert(file.getPath(), pdfFileTemp.getPath(), pageSizeEnum);
 
             //pdf上传
             String pdfDirName = SystemConstant.getNanoId() + SystemConstant.PDF_PREFIX;
@@ -688,7 +688,7 @@ public class PrintCommonServiceImpl implements PrintCommonService {
 
             PdfDto pdfDto = PdfUtil.addPdfPage(pdfFileTemp);
             if (localFileList != null) {
-                localFileList.add(new PdfDto(pdfFileTemp.getPath(), PageSizeEnum.A3, pdfDto.getPageCount()));
+                localFileList.add(new PdfDto(pdfFileTemp.getPath(), pageSizeEnum, pdfDto.getPageCount()));
             }
             basicAttachment = new BasicAttachment(JSON.toJSONString(filePathVo), fileName, SystemConstant.PDF_PREFIX, new BigDecimal(file.length()), filePathVo.getMd5(), userId);
             basicAttachment.setPages(pdfDto.getActualPageCount());

+ 9 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -824,6 +824,15 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             String courseName = examinationImportDto.getCourseName();
             String paperNumber = examinationImportDto.getPaperNumber();
             String studentCode = examinationImportDto.getStudentCode();
+            String teacherName = examinationImportDto.getTeacherName();
+            if (StringUtils.isNotBlank(teacherName)) {
+                SysUser user = sysUserService.getByLoginName(schoolId, teacherName);
+                if (user == null) {
+                    errorRowDate.add("任课老师[" + teacherName + "]在用户管理中不存在");
+                } else {
+                    examinationImportDto.setTeacherId(user.getId());
+                }
+            }
 
             if (!SystemConstant.isOneNull(courseCode, courseName)) {
                 // 校验1 - 文件中课程代码对应多个不同的课程名称

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/pdf/CreatePdfNewUtil.java

@@ -109,7 +109,7 @@ public class CreatePdfNewUtil {
         } else {
             File htmlFileTemp = SystemConstant.getFileTempVar(SystemConstant.HTML_PREFIX);
             fileUploadService.downloadFile(basicAttachment.getId(), htmlFileTemp.getPath());
-            BasicAttachment attachment = printCommonService.saveAttachmentPdfFromHtml(String.valueOf(basicAttachment.getId()), htmlFileTemp, examDetail.getCreateId(), null, fileTempList);
+            BasicAttachment attachment = printCommonService.saveAttachmentPdfFromHtml(String.valueOf(basicAttachment.getId()), htmlFileTemp, examDetail.getCreateId(), null, fileTempList, PageSizeEnum.A4);
             FilePathVo filePathVo1 = JSON.parseObject(attachment.getPath(), FilePathVo.class);
             PrintPathVo printPathVo = new PrintPathVo(ClassifyEnum.CHECK_IN, filePathVo1.getUploadType(), filePathVo1.getType(), filePathVo1.getPath(), attachment.getMd5(), null, null);
             examDetail.setAttachmentPath(printCommonService.parseAttachmentPath(examDetail.getAttachmentPath(), printPathVo));

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/SysUserService.java

@@ -295,4 +295,6 @@ public interface SysUserService extends IService<SysUser> {
     SysUser getByUserId(Long userId);
 
 	void updateUiSetting(Long userId, String unescapeHtml);
+
+    SysUser getByLoginName(Long schoolId, String teacherName);
 }

+ 8 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java

@@ -1296,4 +1296,12 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
                 .eq(SysUser::getId, userId);
         this.update(updateWrapper);
     }
+
+    @Override
+    public SysUser getByLoginName(Long schoolId, String teacherName) {
+        QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(SysUser::getSchoolId, schoolId)
+                .eq(SysUser::getLoginName, teacherName);
+        return this.getOne(queryWrapper);
+    }
 }