浏览代码

Merge branch 'dev' of http://git.qmth.com.cn/wangliang/distributed-print-service into dev

xiaof 4 年之前
父节点
当前提交
719ccfcf6a

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

@@ -32,6 +32,7 @@ public class ClientStatusServiceImpl extends ServiceImpl<ClientStatusMapper, Cli
             queryWrapper.lambda().eq(ClientStatus::getSchoolId, schoolId).eq(ClientStatus::getExamDetailId, examDetailCours.getExamDetailId()).eq(ClientStatus::getPrintPlanId, printPlanId).eq(ClientStatus::getCourseCode, courseCode).eq(ClientStatus::getPaperNumber, paperNumber).eq(ClientStatus::getMachineCode, machineCode);
             ClientStatus clientStatus = this.getOne(queryWrapper);
             if(clientStatus != null){
+                clientStatus.setTry(true);
                 clientStatus.setPass(isPass);
                 clientStatus.setUpdateId(userId);
                 clientStatus.setUpdateTime(currentTime);

+ 1 - 1
distributed-print-business/src/main/java/com/qmth/distributed/print/business/templete/execute/AsyncCreatePdfTempleteService.java

@@ -50,7 +50,7 @@ public class AsyncCreatePdfTempleteService extends AsyncCreateTaskTemplete {
         StringJoiner stringJoinerSummary = new StringJoiner("\n").add(MessageFormat.format("{0}{1}{2}", DateUtil.format(new Date(), SystemConstant.DEFAULT_DATE_PATTERN), BEGIN_TITLE, OBJ_TITLE));
         TBTaskService tbTaskService = SpringContextHolder.getBean(TBTaskService.class);
         TBTask dbTask = tbTaskService.getById(tbTask.getId());
-        if (Objects.isNull(manual) && (dbTask.getStatus() == TaskStatusEnum.FINISH && Objects.nonNull(dbTask.getResult()))) {//无需重新生成pdf
+        if (Objects.isNull(manual) && (Objects.nonNull(dbTask) && dbTask.getStatus() == TaskStatusEnum.FINISH && Objects.nonNull(dbTask.getResult()))) {//无需重新生成pdf
             return ResultUtil.ok();
         }
         tbTask.setStatus(TaskStatusEnum.RUNNING);

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

@@ -609,7 +609,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
             }
         }
         List<ExaminationImportDto> examinationImportDtoList = new ArrayList<>();
-
         for (int r = 1; r < totalRows; r++) {
             Row row = sheet.getRow(r);
 
@@ -624,43 +623,45 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                 int index = fieldsDto.getIndex();
                 String level = fieldsDto.getLevel();
 
-                Cell cell = row.getCell(index);
-                if (cell == null) {
-                    throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
-                }
-                String cellValue = String.valueOf(ExcelUtil.convert(cell));
-                if (cellValue == null || cellValue.length() < 1 || cellValue.equals("null")) {
-                    throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
-                }
-
-                for (Field examinationImportDtoField : examinationImportDtoFields) {
-                    ExcelDBFieldDesc excelDBFieldDesc = examinationImportDtoField.getAnnotation(ExcelDBFieldDesc.class);
-                    if (excelDBFieldDesc == null) {
-                        // 如果没有注解,说明该数据库必须字段不是从excel中获得的,直接跳过
-                        continue;
+                if (Objects.nonNull(row)) {
+                    Cell cell = row.getCell(index);
+                    if (cell == null) {
+                        throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
+                    }
+                    String cellValue = String.valueOf(ExcelUtil.convert(cell));
+                    if (cellValue == null || cellValue.length() < 1 || cellValue.equals("null")) {
+                        throw ExceptionResultEnum.ERROR.exception("excel中第[" + (r + 1) + "]行,第[" + (index + 1) + "]列,字段[" + name + "]必填");
                     }
 
-                    // 如果数据库字段中文名和必填字段中文名称对应,则通过反射为数据库必选字段赋值
-                    String dbName = excelDBFieldDesc.name();
-                    int dbLength = excelDBFieldDesc.length();
-                    if (dbName.equals(name)) {
-                        if (dbLength > 0) {
-                            ConvertUtil.verifyLength(cellValue, dbLength, dbName);
+                    for (Field examinationImportDtoField : examinationImportDtoFields) {
+                        ExcelDBFieldDesc excelDBFieldDesc = examinationImportDtoField.getAnnotation(ExcelDBFieldDesc.class);
+                        if (excelDBFieldDesc == null) {
+                            // 如果没有注解,说明该数据库必须字段不是从excel中获得的,直接跳过
+                            continue;
+                        }
+
+                        // 如果数据库字段中文名和必填字段中文名称对应,则通过反射为数据库必选字段赋值
+                        String dbName = excelDBFieldDesc.name();
+                        int dbLength = excelDBFieldDesc.length();
+                        if (dbName.equals(name)) {
+                            if (dbLength > 0) {
+                                ConvertUtil.verifyLength(cellValue, dbLength, dbName);
+                            }
+                            examinationImportDtoField.setAccessible(true);
+                            examinationImportDtoField.set(examinationImportDto, cellValue);
+                            match = true;
+                            break;
                         }
-                        examinationImportDtoField.setAccessible(true);
-                        examinationImportDtoField.set(examinationImportDto, cellValue);
-                        match = true;
-                        break;
                     }
-                }
-                if (!match || "secondary".equals(level)) {
-                    // 必选+扩展字段不能匹配到数据库中的字段存放 或者 该字段为扩展字段,则添加到扩展字段中
-                    FieldsDto secondaryField = new FieldsDto();
-                    secondaryField.setCode(code);
-                    secondaryField.setName(name);
-                    secondaryField.setEnable(true);
-                    secondaryField.setValue(cellValue);
-                    secondaryFieldList.add(secondaryField);
+                    if (!match || "secondary".equals(level)) {
+                        // 必选+扩展字段不能匹配到数据库中的字段存放 或者 该字段为扩展字段,则添加到扩展字段中
+                        FieldsDto secondaryField = new FieldsDto();
+                        secondaryField.setCode(code);
+                        secondaryField.setName(name);
+                        secondaryField.setEnable(true);
+                        secondaryField.setValue(cellValue);
+                        secondaryFieldList.add(secondaryField);
+                    }
                 }
             }
             // 校验试卷编号
@@ -699,7 +700,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
         examDetailService.deleteExaminationData(printPlanId);
 
         // 卷袋号生成规则
-        SerialNumberParams serialNumberParams = new SerialNumberParams("packageCode-", "p", 6);
+        SerialNumberParams serialNumberParams = new SerialNumberParams("packageCode-", "1", 6);
         String key = serialNumberParams.getModel() + serialNumberParams.getPrefix();
         RedisAtomicLong counter = new RedisAtomicLong(key, Objects.requireNonNull(redisTemplate.getConnectionFactory()));
         Long value = counter.get();

+ 10 - 3
distributed-print-business/src/main/java/com/qmth/distributed/print/business/util/CreatePdfUtil.java

@@ -105,9 +105,16 @@ public class CreatePdfUtil {
         }
         Map<String, Object> htmlMap = new HashMap<>();
         if (Objects.nonNull(examStudentList) && examStudentList.size() > 0) {
-            htmlMap.put("examDetailCourseId", examStudentList.get(0).getExamDetailCourseId());
-            htmlMap.put("courseName", examStudentList.get(0).getCourseName());
-            htmlMap.put("courseCode", examStudentList.get(0).getCourseCode());
+            Set<Long> examDetailCourseIds = new HashSet<>();
+            Set<String> courseCodes = new HashSet<>(), courseNames = new HashSet<>();
+            for (ExamStudentCourseDto examStudentCourseDto : examStudentList) {
+                examDetailCourseIds.add(examStudentCourseDto.getExamDetailCourseId());
+                courseCodes.add(examStudentCourseDto.getCourseCode());
+                courseNames.add(examStudentCourseDto.getCourseName());
+            }
+            htmlMap.put("examDetailCourseId", StringUtils.join(examDetailCourseIds, ", "));
+            htmlMap.put("courseName", String.join(", ", courseNames));
+            htmlMap.put("courseCode", String.join(", ", courseCodes));
         } else {
             htmlMap.put("examDetailCourseId", "");
             htmlMap.put("courseName", "");

+ 1 - 1
distributed-print-business/src/main/resources/db/init-table.sql

@@ -113,7 +113,7 @@ CREATE TABLE `basic_message`  (
     `template_content` mediumtext CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '模板内容',
     `message_type` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息类型',
     `send_status` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息发送状态',
-    `send_result` varchar(45) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息发送结果',
+    `send_result` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '消息发送结果',
     `remark` TEXT CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '备注',
     `resend_count` INT CHARACTER SET utf8 COLLATE utf8_general_ci NULL COMMENT '失败重发次数',
     `create_id` bigint(20) NULL DEFAULT NULL COMMENT '创建人',

+ 2 - 1
distributed-print/src/main/java/com/qmth/distributed/print/aspect/ApiControllerAspect.java

@@ -17,6 +17,7 @@ import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.commons.CommonsMultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
 import java.util.Objects;
 
 /**
@@ -61,7 +62,7 @@ public class ApiControllerAspect {
                 log.info("============方法===========:{}", methodName);
                 if (Objects.nonNull(args) && args.length > 0) {
                     for (int i = 0; i < args.length; i++) {
-                        if (args[i] instanceof CommonsMultipartFile || args[i] instanceof MultipartFile || args[i] instanceof BeanPropertyBindingResult) {
+                        if (Objects.nonNull(args[i]) && (args[i] instanceof HttpServletRequest || args[i] instanceof HttpServletResponse || args[i] instanceof CommonsMultipartFile || args[i] instanceof MultipartFile || args[i] instanceof BeanPropertyBindingResult)) {
                             continue;
                         } else {
                             log.info("============参数key:{},参数value===========:{}", JacksonUtil.parseJson(paramsName[i]), JacksonUtil.parseJson(args[i]));