浏览代码

3.4.2 update

xiaofei 6 月之前
父节点
当前提交
36e2ef1692

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

@@ -1023,7 +1023,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
             rootPath = tempFile.getPath() + File.separator + SystemConstant.getNanoId();
 
             // 下载文件保存目录(用uuid命名)
-            String downloadFilePath = rootPath + File.separator + SystemConstant.getNanoId();
+            String downloadFilePath = rootPath + File.separator + examTaskDetailPdfDownloadDto.getCourseNameCode().replaceAll(" ", "") + "试卷包";
             File downloadPathFile = new File(downloadFilePath);
             if (!downloadPathFile.exists()) {
                 downloadPathFile.mkdirs();

+ 2 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/service/impl/DownloadLogicServiceImpl.java

@@ -263,7 +263,7 @@ public class DownloadLogicServiceImpl implements DownloadLogicService {
                 stringJoiner.add(dictionaryConfig.fssPublicDomain().getConfig()).add(File.separator);
             }
             stringJoiner = SystemConstant.getDirName(stringJoiner, UploadFileEnum.FILE, true);
-            stringJoiner.add("卷库查询管理试卷、空白题卡批量下载_" + time).add(SystemConstant.ZIP_PREFIX);
+            stringJoiner.add("卷库查询批量下载试卷包").add(SystemConstant.ZIP_PREFIX);
 
             String zipDirName = FileUtil.replaceSplit(stringJoiner.toString());
             zipFile = SystemConstant.getFileTempDirVar(SystemConstant.ZIP_PREFIX);
@@ -529,7 +529,7 @@ public class DownloadLogicServiceImpl implements DownloadLogicService {
                 stringJoiner.add(dictionaryConfig.fssPublicDomain().getConfig()).add(File.separator);
             }
             stringJoiner = SystemConstant.getDirName(stringJoiner, UploadFileEnum.FILE, true);
-            stringJoiner.add("批量下载文件_" + System.currentTimeMillis()).add(SystemConstant.ZIP_PREFIX);
+            stringJoiner.add("批量下载试卷包").add(SystemConstant.ZIP_PREFIX);
 
             String zipDirName = FileUtil.replaceSplit(stringJoiner.toString());
             zipFile = SystemConstant.getFileTempDirVarForZip(SystemConstant.getNanoId(), SystemConstant.ZIP_PREFIX);

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

@@ -222,7 +222,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                         stringJoiner.add(dictionaryConfig.fssPublicDomain().getConfig()).add(File.separator);
                     }
                     stringJoiner = SystemConstant.getDirName(stringJoiner, UploadFileEnum.FILE, true);
-                    stringJoiner.add("印刷任务管理_批量下载PDF_" + time).add(SystemConstant.ZIP_PREFIX);
+                    stringJoiner.add("印刷任务管理批量下载印品数据包").add(SystemConstant.ZIP_PREFIX);
                     String zipDirName = FileUtil.replaceSplit(stringJoiner.toString());
                     SysUser sysUser = sysUserService.getById(tbTask.getCreateId());
                     JSONObject jsonObject = SystemConstant.createZip(zipFile, zipLocalRootPath, zipDirName, new String(Base64Util.decode(sysUser.getPassword())));

+ 3 - 5
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -23,10 +23,7 @@ import com.qmth.teachcloud.common.entity.*;
 import com.qmth.teachcloud.common.enums.*;
 import com.qmth.teachcloud.common.enums.log.OperationTypeEnum;
 import com.qmth.teachcloud.common.service.*;
-import com.qmth.teachcloud.common.util.FileUtil;
-import com.qmth.teachcloud.common.util.Result;
-import com.qmth.teachcloud.common.util.ResultUtil;
-import com.qmth.teachcloud.common.util.ServletUtil;
+import com.qmth.teachcloud.common.util.*;
 import io.swagger.annotations.*;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang3.StringUtils;
@@ -166,7 +163,8 @@ public class SysController {
                 throw ExceptionResultEnum.ERROR.exception("用户被禁用");
             }
 
-            if (!password.equals(userList.get(0).getPassword())) {
+            String decodePassword =  Base64Util.encode(AesECBUtil.decryptSimple(password).getBytes());
+            if (!decodePassword.equals(userList.get(0).getPassword())) {
                 throw ExceptionResultEnum.ERROR.exception("用户名或密码错误");
             }
 

+ 5 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/SysUserServiceImpl.java

@@ -206,7 +206,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
     @Transactional
     @Override
     public LoginResult updatePassword(SysUser user) throws NoSuchAlgorithmException {
-        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        Long userId = ServletUtil.getRequestUserId();
+        SysUser sysUser = this.getById(userId);
         if (sysUser == null) {
             throw ExceptionResultEnum.ERROR.exception("用户不存在");
         }
@@ -214,13 +215,14 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         String mobileNumber = user.getMobileNumber();
         String verifyCode = user.getVerifyCode();
         if (SystemConstant.strNotNull(newPwd)) {
+            String decodePassword =  Base64Util.encode(AesECBUtil.decryptSimple(newPwd).getBytes());
             // 参数中存在密码->更新密码
-            if (sysUser.getPassword().equals(newPwd)) {
+            if (sysUser.getPassword().equals(decodePassword)) {
                 throw ExceptionResultEnum.ERROR.exception("新密码和旧密码一致,请重新输入");
             }
             sysUser.setPwdCount(sysUser.getPwdCount() == null ? 1 : sysUser.getPwdCount() + 1);
             sysUser.setPwdUpdateTime(System.currentTimeMillis());
-            sysUser.setPassword(newPwd);
+            sysUser.setPassword(decodePassword);
         }
         if (SystemConstant.strNotNull(mobileNumber)) {
             // 校验验证码

+ 16 - 6
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/AesECBUtil.java

@@ -1,10 +1,16 @@
 package com.qmth.teachcloud.common.util;
 
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.crypto.BadPaddingException;
 import javax.crypto.Cipher;
+import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.NoSuchPaddingException;
 import javax.crypto.spec.SecretKeySpec;
+import java.security.InvalidKeyException;
+import java.security.NoSuchAlgorithmException;
 import java.util.Base64;
 
 /**
@@ -26,12 +32,16 @@ public class AesECBUtil {
         return Base64.getEncoder().encodeToString(encryptedBytes);
     }
 
-    public static String decryptSimple(String encryptedData) throws Exception {
-        SecretKeySpec secretKeySpec = new SecretKeySpec(KEY_SIMPLE.getBytes(), "AES");
-        Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
-        cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
-        byte[] decryptedBytes = cipher.doFinal(Base64.getDecoder().decode(encryptedData));
-        return new String(decryptedBytes);
+    public static String decryptSimple(String encryptedData) {
+        try {
+            SecretKeySpec secretKeySpec = new SecretKeySpec(KEY_SIMPLE.getBytes(), "AES");
+            Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
+            cipher.init(Cipher.DECRYPT_MODE, secretKeySpec);
+            byte[] decryptedBytes = cipher.doFinal(Base64.getDecoder().decode(encryptedData));
+            return new String(decryptedBytes);
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception("密码解析错误,请联系管理员");
+        }
     }
 
 

+ 1 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkGroupServiceImpl.java

@@ -188,7 +188,7 @@ public class MarkGroupServiceImpl extends MppServiceImpl<MarkGroupMapper, MarkGr
         MarkGroupTotalProgressDto markGroupTotalProgressDto = new MarkGroupTotalProgressDto();
         markGroupTotalProgressDto.setStudentCount(markPaper.getStudentCount());
         markGroupTotalProgressDto.setUploadCount(markStudentService.countUploadedByExamIdAndPaperNumber(examId, paperNumber));
-        markGroupTotalProgressDto.setAbsentCount(markPaper.getAbsentCount());
+        markGroupTotalProgressDto.setAbsentCount(markStudentService.countAbsentByExamIdAndPaperNumber(examId, paperNumber));
 
         int totalCount = markTaskService.countByExamIdAndPaperNumber(examId, paperNumber);
         int markedCount = markTaskService.countByExamIdAndPaperNumberAndStatusIn(examId, paperNumber, Arrays.asList(MarkTaskStatus.MARKED, MarkTaskStatus.ARBITRATED));

+ 4 - 4
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkQuestionServiceImpl.java

@@ -100,8 +100,8 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
         List<MarkQuestion> markQuestionList = this.listQuestionByExamIdAndPaperNumber(examId, paperNumber);
         if (CollectionUtils.isEmpty(markQuestionList)) {
             for (MarkQuestion question : questions) {
-                if (question.getTotalScore() <= 0) {
-                    throw ExceptionResultEnum.ERROR.exception("小题满分必须大于0");
+                if (question.getTotalScore() < 0) {
+                    throw ExceptionResultEnum.ERROR.exception("小题满分不能小于0");
                 }
                 if (!question.getObjective() && (question.getIntervalScore() == null || question.getIntervalScore() <= 0)) {
                     throw ExceptionResultEnum.ERROR.exception("间隔分必须大于0");
@@ -140,8 +140,8 @@ public class MarkQuestionServiceImpl extends ServiceImpl<MarkQuestionMapper, Mar
                                 throw ExceptionResultEnum.ERROR.exception("大题号" + markQuestion.getMainNumber() + "小题号" + markQuestion.getSubNumber() + "已分组,不能修改为客观题题型");
                             }
                         }
-                        if (question.getTotalScore() <= 0) {
-                            throw ExceptionResultEnum.ERROR.exception("小题满分必须大于0");
+                        if (question.getTotalScore() < 0) {
+                            throw ExceptionResultEnum.ERROR.exception("小题满分不能小于0");
                         }
                         if (!QuestionType.findByValue(question.getQuestionType()).getObjective() && question.getIntervalScore() <= 0) {
                             throw ExceptionResultEnum.ERROR.exception("间隔分必须大于0");

+ 9 - 4
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -835,7 +835,9 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
                 .eq(MarkStudent::getUpload, true)
                 .eq(MarkStudent::getScanStatus, ScanStatus.SCANNED)
-                .eq(MarkStudent::getAbsent, false);
+                .eq(MarkStudent::getAbsent, false)
+                .eq(MarkStudent::getManualAbsent, false)
+                .eq(MarkStudent::getOmrAbsent, false);
         return this.count(queryWrapper);
     }
 
@@ -1108,8 +1110,11 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         lw.set(MarkStudent::getMissScan, false);
         lw.eq(MarkStudent::getId, student.getId());
         update(lw);
-        markPaperService.updateAbsentCount(examId, student.getPaperNumber(),
-                this.countAbsentByExamIdAndPaperNumber(examId, student.getPaperNumber()));
+        // 更新课程表中上传人数
+        markPaperService.updateUploadCount(student.getExamId(), student.getPaperNumber(),
+                this.countUploadedByExamIdAndPaperNumber(student.getExamId(), student.getPaperNumber()));
+        markPaperService.updateAbsentCount(student.getExamId(), student.getPaperNumber(),
+                this.countAbsentByExamIdAndPaperNumber(student.getExamId(), student.getPaperNumber()));
 
         return AbsentManualUpdateVo.create(manualAbsent);
     }
@@ -1901,7 +1906,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
     public int countAbsentByExamIdAndPaperNumber(Long examId, String paperNumber) {
         QueryWrapper<MarkStudent> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(MarkStudent::getExamId, examId).eq(MarkStudent::getPaperNumber, paperNumber)
-                .and(o -> o.eq(MarkStudent::getAbsent, true).or().eq(MarkStudent::getOmrAbsent, true));
+                .and(o -> o.eq(MarkStudent::getAbsent, true).or().eq(MarkStudent::getManualAbsent, true).or().eq(MarkStudent::getOmrAbsent, true));
         return this.count(queryWrapper);
     }
 

+ 2 - 2
teachcloud-mark/src/main/resources/mapper/MarkStudentMapper.xml

@@ -249,7 +249,7 @@
         WHERE ms.exam_id = #{examId}
           AND ms.paper_number = #{paperNumber}
           AND ms.is_upload = TRUE
-          AND (is_absent = TRUE OR omr_absent = TRUE)
+          AND (is_absent = TRUE OR is_manual_absent = TRUE OR omr_absent = TRUE)
           AND EXISTS(SELECT 1
                      FROM mark_task mt
                      WHERE ms.id = mt.student_id)
@@ -261,7 +261,7 @@
           AND ms.paper_number = #{paperNumber}
           AND ms.is_upload = TRUE
           AND is_absent = FALSE
-          AND is_breach = FALSE
+          AND is_manual_absent = FALSE
           AND omr_absent = FALSE
           AND NOT EXISTS(SELECT 1
                          FROM mark_task mt