xiaofei vor 1 Jahr
Ursprung
Commit
cf18a65da5
16 geänderte Dateien mit 243 neuen und 194 gelöschten Zeilen
  1. 2 2
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/ClientService.java
  2. 3 3
      distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/ClientServiceImpl.java
  3. 2 2
      distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml
  4. 1 0
      distributed-print/install/mysql/init/teachcloud_db.sql
  5. 2 1
      distributed-print/install/mysql/upgrade/3.3.1.sql
  6. 142 134
      distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java
  7. 3 3
      distributed-print/src/main/java/com/qmth/distributed/print/api/client/PrintController.java
  8. 10 11
      teachcloud-common-api/src/main/java/com/qmth/teachcloud/common/api/api/BasicSchoolController.java
  9. 12 0
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicSchool.java
  10. 1 2
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicSchoolMapper.java
  11. 2 3
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicSchoolService.java
  12. 40 11
      teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicSchoolServiceImpl.java
  13. 2 13
      teachcloud-common/src/main/resources/mapper/BasicSchoolMapper.xml
  14. 18 4
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/answercard/CardFile.java
  15. 2 4
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkGroupServiceImpl.java
  16. 1 1
      teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/utils/CardParseUtils.java

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

@@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.dto.client.PrintSingleDto;
-import com.qmth.teachcloud.common.bean.dto.SchoolDto;
+import com.qmth.teachcloud.common.entity.BasicSchool;
 
 import javax.servlet.http.HttpServletResponse;
 import java.util.List;
@@ -48,7 +48,7 @@ public interface ClientService {
 
     boolean updatePassword(Long userId, String password);
 
-    List<SchoolDto> listSchool(String code);
+    List<BasicSchool> listSchool(String code);
 
     List<Map<String, String>> getPaperUrl(Long schoolId, Long printPlanId, Long examTaskId);
 

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

@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.qmth.teachcloud.common.bean.vo.PrintPathVo;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.dto.client.PrintSingleDto;
 import com.qmth.distributed.print.business.bean.dto.client.UrlMd5Dto;
@@ -15,11 +14,12 @@ import com.qmth.distributed.print.business.enums.ExamDetailStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
 import com.qmth.distributed.print.business.mapper.ClientMapper;
 import com.qmth.distributed.print.business.service.*;
-import com.qmth.teachcloud.common.bean.dto.SchoolDto;
 import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
+import com.qmth.teachcloud.common.bean.vo.PrintPathVo;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
+import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.entity.SysPrivilege;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.enums.ClassifyEnum;
@@ -749,7 +749,7 @@ public class ClientServiceImpl implements ClientService {
     }
 
     @Override
-    public List<SchoolDto> listSchool(String code) {
+    public List<BasicSchool> listSchool(String code) {
         return basicSchoolService.listSchool(code);
     }
 

+ 2 - 2
distributed-print-business/src/main/resources/mapper/ExamDetailMapper.xml

@@ -688,8 +688,8 @@
             exam_detail_course edc ON ed.id = edc.exam_detail_id
                 LEFT JOIN
             exam_task et ON ed.exam_id = et.exam_id AND edc.paper_number = et.paper_number
-                LEFT JOIN
-            basic_exam be ON be.id = ed.exam_id
+                JOIN
+            (select * from basic_exam where enable = true)be ON be.id = ed.exam_id
         WHERE
             ed.status = #{printStatus}
           AND ed.print_end_time > #{startTime}

+ 1 - 0
distributed-print/install/mysql/init/teachcloud_db.sql

@@ -398,6 +398,7 @@ CREATE TABLE IF NOT EXISTS `basic_school` (
   `init_password` varchar(100) DEFAULT NULL COMMENT '该学校用户的初始密码,默认为12345678',
   `default_school` tinyint(1) DEFAULT '0',
   `has_paper_number` tinyint(1) DEFAULT '0' COMMENT '该学校是否有固定试卷编号',
+  `background_image` VARCHAR(500) DEFAULT NULL COMMENT '学校首页背景图',
   PRIMARY KEY (`id`) USING BTREE,
   UNIQUE KEY `code` (`code`) USING BTREE
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='学校表';

+ 2 - 1
distributed-print/install/mysql/upgrade/3.3.1.sql

@@ -728,4 +728,5 @@ INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1137, '客观题导入', 'ObjectiveStructImport', 'BUTTON', '897', '6', 'AUTH', '1135', '1', '0', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (1138, '主观题导入', 'SubjectiveStructImport', 'BUTTON', '897', '7', 'AUTH', '1136', '1', '0', '1');
 
-update sys_privilege set related = '490,543,955' where id = 488;
+update sys_privilege set related = '490,543,955' where id = 488;
+ALTER TABLE `basic_school` ADD COLUMN `background_image` VARCHAR(500) NULL COMMENT '学校首页背景图' AFTER `has_paper_number`;

+ 142 - 134
distributed-print/src/main/java/com/qmth/distributed/print/api/SysController.java

@@ -83,18 +83,16 @@ public class SysController {
     BasicAttachmentService basicAttachmentService;
     @Resource
     SysUserRoleService sysUserRoleService;
-
     @Resource
     TeachcloudCommonService teachcloudCommonService;
-
     @Resource
     BasicMajorService basicMajorService;
     @Resource
     BasicCourseService basicCourseService;
-
     @Resource
     BasicSemesterService basicSemesterService;
-
+    @Resource
+    private FileUploadService fileUploadService;
     @Resource
     TBSyncTaskService tbSyncTaskService;
 
@@ -446,6 +444,15 @@ public class SysController {
             authInfoService.appHasExpired(code);
             SysConfig sysConfig = commonCacheService.addSysConfigCache(basicSchool.getId(), SystemConstant.ACCOUNT_SMS_VERIFY);
             map.put(SystemConstant.LOGO, basicSchool.getLogo());
+            String backgroundImageUrl = null;
+            if (StringUtils.isNotBlank(basicSchool.getBackgroundImage())) {
+                try {
+                    backgroundImageUrl = fileUploadService.filePreview(basicSchool.getBackgroundImage());
+                } catch (Exception e) {
+                    // 不处理,返回null
+                }
+            }
+            map.put("backgroundImageUrl", backgroundImageUrl);
             map.put("name", basicSchool.getName());
             map.put("accountSmsVerify", Objects.nonNull(sysConfig) ? Boolean.valueOf(sysConfig.getConfigValue()) : false);
             // 若为在线激活,则允许手机号登录
@@ -454,6 +461,7 @@ public class SysController {
         } else {
             SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.ADMIN_LOGO_URL);
             map.put(SystemConstant.LOGO, Objects.nonNull(sysConfig) ? sysConfig.getConfigValue() : null);
+            map.put("backgroundImageUrl", null);
             map.put("name", null);
             map.put("accountSmsVerify", false);
             // 若为在线激活,则允许手机号登录,超管默认false
@@ -659,136 +667,136 @@ public class SysController {
         Long schoolId = SystemConstant.convertIdToLong(ServletUtil.getRequestHeaderSchoolId().toString());
         List<DictionaryResult> dictionaryResultList = new ArrayList<>();
         switch (dictionaryEnum) {
-        case SEMESTER:
-            List<BasicSemester> basicSemesterList = basicSemesterService.list(
-                    new QueryWrapper<BasicSemester>().lambda().eq(BasicSemester::getSchoolId, schoolId).eq(BasicSemester::getEnable, true).orderByDesc(BasicSemester::getCreateTime));
-            dictionaryResultList = basicSemesterList.stream().map(e -> {
-                DictionaryResult dictionaryResult = new DictionaryResult();
-                dictionaryResult.setId(e.getId());
-                dictionaryResult.setCode(e.getCode());
-                dictionaryResult.setName(e.getName());
-                return dictionaryResult;
-            }).collect(Collectors.toList());
-            break;
-        case COLLEGE:
-            List<SysOrg> sysOrgs = conditionService.listCollege();
-            dictionaryResultList = sysOrgs.stream().map(e -> {
-                DictionaryResult dictionaryResult = new DictionaryResult();
-                dictionaryResult.setId(e.getId());
-                dictionaryResult.setName(e.getName());
-                return dictionaryResult;
-            }).collect(Collectors.toList());
-            break;
-        //            case COLLEGE:
-        //                if (Objects.nonNull(semesterId)) {
-        //                    QueryWrapper<BasicExam> basicExamQueryWrapper = new QueryWrapper<>();
-        //                    basicExamQueryWrapper.lambda().eq(BasicExam::getSemesterId, SystemConstant.convertIdToLong(semesterId));
-        //                    List<BasicExam> basicExamList = basicExamService.list(basicExamQueryWrapper);
-        //                    if (Objects.nonNull(basicExamList) && basicExamList.size() > 0) {
-        //                        List<Long> examIdList = basicExamList.stream().map(BaseEntity::getId).collect(Collectors.toList());
-        //                        QueryWrapper<ExamPrintPlan> examPrintPlanQueryWrapper = new QueryWrapper<>();
-        //                        examPrintPlanQueryWrapper.lambda().in(ExamPrintPlan::getExamId, examIdList);
-        //                        List<ExamPrintPlan> examPrintPlanList = examPrintPlanService.list(examPrintPlanQueryWrapper);
-        //                        if (Objects.nonNull(examPrintPlanList) && examPrintPlanList.size() > 0) {
-        //                            Set<Long> orgIdSet = examPrintPlanList.stream().map(ExamPrintPlan::getOrgId).collect(Collectors.toSet());
-        //                            QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
-        //                            sysOrgQueryWrapper.lambda().in(SysOrg::getId, orgIdSet);
-        //                            List<SysOrg> sysOrgList = sysOrgService.list(sysOrgQueryWrapper);
-        //                            List<SysOrg> newSysOrgList = new ArrayList<>(sysOrgList);
-        //                            for (SysOrg s : sysOrgList) {
-        //                                if (s.getType() == OrgTypeEnum.SCHOOL) {
-        //                                    newSysOrgList.addAll(sysOrgService.findByConnectByRootOrgId(s.getId()));
-        //                                } else if (s.getType() == OrgTypeEnum.TEACHING_ROOM || s.getType() == OrgTypeEnum.FACULTY || s.getType() == OrgTypeEnum.PRINTING_HOUSE) {
-        //                                    newSysOrgList.addAll(sysOrgService.findByConnectByParentId(s.getId(), true, false));
-        //                                }
-        //                            }
-        //                            Map<Long, SysOrg> sysOrgMap = new LinkedHashMap<>();
-        //                            for (SysOrg s : newSysOrgList) {
-        //                                if (s.getType() == OrgTypeEnum.COLLEGE) {
-        //                                    sysOrgMap.put(s.getId(), s);
-        //                                }
-        //                            }
-        //                            List<DictionaryResult> finalDictionaryResultList = dictionaryResultList;
-        //                            sysOrgMap.forEach((k, v) -> {
-        //                                DictionaryResult dictionaryResult = new DictionaryResult();
-        //                                dictionaryResult.setId(v.getId());
-        //                                dictionaryResult.setCode(v.getCode());
-        //                                dictionaryResult.setName(v.getName());
-        //                                finalDictionaryResultList.add(dictionaryResult);
-        //                            });
-        //                        }
-        //                    }
-        //                } else {
-        //                    List<SysOrg> sysOrgList = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getSchoolId, schoolId).eq(SysOrg::getEnable, true));
-        //                    dictionaryResultList = sysOrgList.stream().map(e -> {
-        //                        DictionaryResult dictionaryResult = new DictionaryResult();
-        //                        dictionaryResult.setId(e.getId());
-        //                        dictionaryResult.setCode(e.getCode());
-        //                        dictionaryResult.setName(e.getName());
-        //                        return dictionaryResult;
-        //                    }).collect(Collectors.toList());
-        //                }
-        //                break;
-        case MAJOR:
-            QueryWrapper<BasicMajor> majorQueryWrapper = new QueryWrapper<>();
-            majorQueryWrapper.lambda().eq(BasicMajor::getSchoolId, schoolId).eq(BasicMajor::getEnable, true);
-
-            if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
-                majorQueryWrapper.lambda().eq(BasicMajor::getBelongOrgId, collegeId);
-            }
-            List<BasicMajor> basicMajorList = basicMajorService.list(majorQueryWrapper);
-            dictionaryResultList = basicMajorList.stream().map(e -> {
-                DictionaryResult dictionaryResult = new DictionaryResult();
-                dictionaryResult.setId(e.getId());
-                dictionaryResult.setCode(e.getCode());
-                dictionaryResult.setName(e.getName());
-                return dictionaryResult;
-            }).collect(Collectors.toList());
-            break;
-        case CLAZZ:
-            QueryWrapper<BasicTeachClazz> clazzQueryWrapper = new QueryWrapper<>();
-            clazzQueryWrapper.lambda().eq(BasicTeachClazz::getSchoolId, schoolId).eq(BasicTeachClazz::getExamId, examId);
-            List<BasicTeachClazz> basicTeachClazzList = basicTeachClazzService.list(clazzQueryWrapper);
-            List<DictionaryResult> resultBasicClazzList = basicTeachClazzList.stream().map(e -> {
-                DictionaryResult dictionaryResult = new DictionaryResult();
-                dictionaryResult.setId(e.getId());
-                dictionaryResult.setName(e.getClazzName());
-                return dictionaryResult;
-            }).collect(Collectors.toList());
-            dictionaryResultList.addAll(resultBasicClazzList);
-            break;
-        case ALL_CLAZZ: //针对归档管理临时处理用
-            throw ExceptionResultEnum.ERROR.exception("使用枚举[CLAZZ]");
-        case COURSE: // 考生字典查询课程
-            dictionaryResultList = basicCourseService.list(
-                    new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream().flatMap(e -> {
-                DictionaryResult dictionaryResult = new DictionaryResult();
-                dictionaryResult.setId(e.getId());
-                dictionaryResult.setCode(e.getCode());
-                dictionaryResult.setName(e.getName());
-                return Stream.of(dictionaryResult);
-            }).collect(Collectors.toList());
-            break;
-        case STUDENT:
-            QueryWrapper<BasicExamStudent> studentQueryWrapper = new QueryWrapper<>();
-            studentQueryWrapper.lambda().eq(BasicExamStudent::getSchoolId, schoolId);
-            if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(clazzId))) {
-                studentQueryWrapper.lambda().eq(BasicExamStudent::getClazzId, clazzId);
-            }
-            if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(studentId))) {
-                studentQueryWrapper.lambda().eq(BasicExamStudent::getId, studentId);
-            }
-            List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(studentQueryWrapper);
-            dictionaryResultList = basicExamStudentList.stream().map(e -> {
-                DictionaryResult dictionaryResult = new DictionaryResult();
-                dictionaryResult.setId(e.getId());
-                dictionaryResult.setCode(e.getStudentCode());
-                dictionaryResult.setName(e.getStudentName());
-                return dictionaryResult;
-            }).collect(Collectors.toList());
-            break;
-        default:
-            break;
+            case SEMESTER:
+                List<BasicSemester> basicSemesterList = basicSemesterService.list(
+                        new QueryWrapper<BasicSemester>().lambda().eq(BasicSemester::getSchoolId, schoolId).eq(BasicSemester::getEnable, true).orderByDesc(BasicSemester::getCreateTime));
+                dictionaryResultList = basicSemesterList.stream().map(e -> {
+                    DictionaryResult dictionaryResult = new DictionaryResult();
+                    dictionaryResult.setId(e.getId());
+                    dictionaryResult.setCode(e.getCode());
+                    dictionaryResult.setName(e.getName());
+                    return dictionaryResult;
+                }).collect(Collectors.toList());
+                break;
+            case COLLEGE:
+                List<SysOrg> sysOrgs = conditionService.listCollege();
+                dictionaryResultList = sysOrgs.stream().map(e -> {
+                    DictionaryResult dictionaryResult = new DictionaryResult();
+                    dictionaryResult.setId(e.getId());
+                    dictionaryResult.setName(e.getName());
+                    return dictionaryResult;
+                }).collect(Collectors.toList());
+                break;
+            //            case COLLEGE:
+            //                if (Objects.nonNull(semesterId)) {
+            //                    QueryWrapper<BasicExam> basicExamQueryWrapper = new QueryWrapper<>();
+            //                    basicExamQueryWrapper.lambda().eq(BasicExam::getSemesterId, SystemConstant.convertIdToLong(semesterId));
+            //                    List<BasicExam> basicExamList = basicExamService.list(basicExamQueryWrapper);
+            //                    if (Objects.nonNull(basicExamList) && basicExamList.size() > 0) {
+            //                        List<Long> examIdList = basicExamList.stream().map(BaseEntity::getId).collect(Collectors.toList());
+            //                        QueryWrapper<ExamPrintPlan> examPrintPlanQueryWrapper = new QueryWrapper<>();
+            //                        examPrintPlanQueryWrapper.lambda().in(ExamPrintPlan::getExamId, examIdList);
+            //                        List<ExamPrintPlan> examPrintPlanList = examPrintPlanService.list(examPrintPlanQueryWrapper);
+            //                        if (Objects.nonNull(examPrintPlanList) && examPrintPlanList.size() > 0) {
+            //                            Set<Long> orgIdSet = examPrintPlanList.stream().map(ExamPrintPlan::getOrgId).collect(Collectors.toSet());
+            //                            QueryWrapper<SysOrg> sysOrgQueryWrapper = new QueryWrapper<>();
+            //                            sysOrgQueryWrapper.lambda().in(SysOrg::getId, orgIdSet);
+            //                            List<SysOrg> sysOrgList = sysOrgService.list(sysOrgQueryWrapper);
+            //                            List<SysOrg> newSysOrgList = new ArrayList<>(sysOrgList);
+            //                            for (SysOrg s : sysOrgList) {
+            //                                if (s.getType() == OrgTypeEnum.SCHOOL) {
+            //                                    newSysOrgList.addAll(sysOrgService.findByConnectByRootOrgId(s.getId()));
+            //                                } else if (s.getType() == OrgTypeEnum.TEACHING_ROOM || s.getType() == OrgTypeEnum.FACULTY || s.getType() == OrgTypeEnum.PRINTING_HOUSE) {
+            //                                    newSysOrgList.addAll(sysOrgService.findByConnectByParentId(s.getId(), true, false));
+            //                                }
+            //                            }
+            //                            Map<Long, SysOrg> sysOrgMap = new LinkedHashMap<>();
+            //                            for (SysOrg s : newSysOrgList) {
+            //                                if (s.getType() == OrgTypeEnum.COLLEGE) {
+            //                                    sysOrgMap.put(s.getId(), s);
+            //                                }
+            //                            }
+            //                            List<DictionaryResult> finalDictionaryResultList = dictionaryResultList;
+            //                            sysOrgMap.forEach((k, v) -> {
+            //                                DictionaryResult dictionaryResult = new DictionaryResult();
+            //                                dictionaryResult.setId(v.getId());
+            //                                dictionaryResult.setCode(v.getCode());
+            //                                dictionaryResult.setName(v.getName());
+            //                                finalDictionaryResultList.add(dictionaryResult);
+            //                            });
+            //                        }
+            //                    }
+            //                } else {
+            //                    List<SysOrg> sysOrgList = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getSchoolId, schoolId).eq(SysOrg::getEnable, true));
+            //                    dictionaryResultList = sysOrgList.stream().map(e -> {
+            //                        DictionaryResult dictionaryResult = new DictionaryResult();
+            //                        dictionaryResult.setId(e.getId());
+            //                        dictionaryResult.setCode(e.getCode());
+            //                        dictionaryResult.setName(e.getName());
+            //                        return dictionaryResult;
+            //                    }).collect(Collectors.toList());
+            //                }
+            //                break;
+            case MAJOR:
+                QueryWrapper<BasicMajor> majorQueryWrapper = new QueryWrapper<>();
+                majorQueryWrapper.lambda().eq(BasicMajor::getSchoolId, schoolId).eq(BasicMajor::getEnable, true);
+
+                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(collegeId))) {
+                    majorQueryWrapper.lambda().eq(BasicMajor::getBelongOrgId, collegeId);
+                }
+                List<BasicMajor> basicMajorList = basicMajorService.list(majorQueryWrapper);
+                dictionaryResultList = basicMajorList.stream().map(e -> {
+                    DictionaryResult dictionaryResult = new DictionaryResult();
+                    dictionaryResult.setId(e.getId());
+                    dictionaryResult.setCode(e.getCode());
+                    dictionaryResult.setName(e.getName());
+                    return dictionaryResult;
+                }).collect(Collectors.toList());
+                break;
+            case CLAZZ:
+                QueryWrapper<BasicTeachClazz> clazzQueryWrapper = new QueryWrapper<>();
+                clazzQueryWrapper.lambda().eq(BasicTeachClazz::getSchoolId, schoolId).eq(BasicTeachClazz::getExamId, examId);
+                List<BasicTeachClazz> basicTeachClazzList = basicTeachClazzService.list(clazzQueryWrapper);
+                List<DictionaryResult> resultBasicClazzList = basicTeachClazzList.stream().map(e -> {
+                    DictionaryResult dictionaryResult = new DictionaryResult();
+                    dictionaryResult.setId(e.getId());
+                    dictionaryResult.setName(e.getClazzName());
+                    return dictionaryResult;
+                }).collect(Collectors.toList());
+                dictionaryResultList.addAll(resultBasicClazzList);
+                break;
+            case ALL_CLAZZ: //针对归档管理临时处理用
+                throw ExceptionResultEnum.ERROR.exception("使用枚举[CLAZZ]");
+            case COURSE: // 考生字典查询课程
+                dictionaryResultList = basicCourseService.list(
+                        new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream().flatMap(e -> {
+                    DictionaryResult dictionaryResult = new DictionaryResult();
+                    dictionaryResult.setId(e.getId());
+                    dictionaryResult.setCode(e.getCode());
+                    dictionaryResult.setName(e.getName());
+                    return Stream.of(dictionaryResult);
+                }).collect(Collectors.toList());
+                break;
+            case STUDENT:
+                QueryWrapper<BasicExamStudent> studentQueryWrapper = new QueryWrapper<>();
+                studentQueryWrapper.lambda().eq(BasicExamStudent::getSchoolId, schoolId);
+                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(clazzId))) {
+                    studentQueryWrapper.lambda().eq(BasicExamStudent::getClazzId, clazzId);
+                }
+                if (SystemConstant.longNotNull(SystemConstant.convertIdToLong(studentId))) {
+                    studentQueryWrapper.lambda().eq(BasicExamStudent::getId, studentId);
+                }
+                List<BasicExamStudent> basicExamStudentList = basicExamStudentService.list(studentQueryWrapper);
+                dictionaryResultList = basicExamStudentList.stream().map(e -> {
+                    DictionaryResult dictionaryResult = new DictionaryResult();
+                    dictionaryResult.setId(e.getId());
+                    dictionaryResult.setCode(e.getStudentCode());
+                    dictionaryResult.setName(e.getStudentName());
+                    return dictionaryResult;
+                }).collect(Collectors.toList());
+                break;
+            default:
+                break;
         }
         return ResultUtil.ok(dictionaryResultList);
     }

+ 3 - 3
distributed-print/src/main/java/com/qmth/distributed/print/api/client/PrintController.java

@@ -8,8 +8,8 @@ import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.dto.client.PrintSingleDto;
 import com.qmth.distributed.print.business.service.ClientService;
-import com.qmth.teachcloud.common.bean.dto.SchoolDto;
 import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import io.swagger.annotations.Api;
@@ -274,10 +274,10 @@ public class PrintController {
     @RequestMapping(value = "/school/list", method = RequestMethod.POST)
     @Aac(strict = false, auth = false)
     public Result list(@ApiParam(value = "学校Code") @RequestParam(required = false) String code) {
-        List<SchoolDto> list = clientService.listSchool(code);
+        List<BasicSchool> list = clientService.listSchool(code);
         // 指定code后,只返回code对应学校,否则查默认学校,没有默认,返回所有
         if (CollectionUtils.isNotEmpty(list) && StringUtils.isBlank(code)) {
-            List<SchoolDto> defaultSchools = list.stream().filter(m -> m.getDefaultSchool() != null && m.getDefaultSchool()).collect(Collectors.toList());
+            List<BasicSchool> defaultSchools = list.stream().filter(m -> m.getDefaultSchool() != null && m.getDefaultSchool()).collect(Collectors.toList());
             if (CollectionUtils.isNotEmpty(defaultSchools)) {
                 return ResultUtil.ok(defaultSchools);
             }

+ 10 - 11
teachcloud-common-api/src/main/java/com/qmth/teachcloud/common/api/api/BasicSchoolController.java

@@ -1,7 +1,6 @@
 package com.qmth.teachcloud.common.api.api;
 
 import com.qmth.boot.api.constant.ApiConstant;
-import com.qmth.teachcloud.common.bean.dto.SchoolDto;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.service.BasicSchoolService;
 import com.qmth.teachcloud.common.util.Result;
@@ -15,8 +14,6 @@ import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.util.List;
-
 /**
  * <p>
  * 学校表 前端控制器
@@ -27,7 +24,7 @@ import java.util.List;
  */
 @Api(tags = "学校Controller")
 @RestController
-@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX  + SystemConstant.PREFIX_URL_COMMON + "/school")
+@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COMMON + "/school")
 public class BasicSchoolController {
 
     @Autowired
@@ -41,8 +38,7 @@ public class BasicSchoolController {
     @ApiOperation(value = "查询")
     @RequestMapping(value = "/list", method = RequestMethod.POST)
     public Result list() {
-        List<SchoolDto> list = basicSchoolService.listSchool(null);
-        return ResultUtil.ok(list);
+        return ResultUtil.ok(basicSchoolService.listSchool(null));
     }
 
     /**
@@ -53,13 +49,16 @@ public class BasicSchoolController {
     @ApiOperation(value = "修改")
     @RequestMapping(value = "/update", method = RequestMethod.POST)
     public Result update(@RequestParam(value = "id") Long id, @RequestParam(value = "code") String code, @RequestParam(value = "name") String name,
-            @RequestParam(value = "initPassword") String initPassword,
-            @RequestParam(value = "defaultSchool", defaultValue = "false") Boolean defaultSchool,
-            @RequestParam(value = "hasPaperNumber", defaultValue = "false") Boolean hasPaperNumber, @RequestParam(value = "logo", required = false) MultipartFile logo,
-            @RequestParam(value = "logoMd5") String logoMd5) {
+                         @RequestParam(value = "initPassword") String initPassword,
+                         @RequestParam(value = "defaultSchool", defaultValue = "false") Boolean defaultSchool,
+                         @RequestParam(value = "hasPaperNumber", defaultValue = "false") Boolean hasPaperNumber,
+                         @RequestParam(value = "logo", required = false) MultipartFile logo,
+                         @RequestParam(value = "logoMd5") String logoMd5,
+                         @RequestParam(value = "backgroundImage", required = false) MultipartFile backgroundImage,
+                         @RequestParam(value = "backgroundImageMd5") String backgroundImageMd5) {
         return ResultUtil.ok(
                 basicSchoolService.updateSchool(id, code, name, initPassword, defaultSchool, hasPaperNumber, logo,
-                        logoMd5));
+                        logoMd5, backgroundImage, backgroundImageMd5));
     }
 }
 

+ 12 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/entity/BasicSchool.java

@@ -58,6 +58,10 @@ public class BasicSchool extends BaseEntity implements Serializable {
     @TableField(value = "has_paper_number")
     private Boolean hasPaperNumber;
 
+    @ApiModelProperty(value = "学校首页背景")
+    @TableField(value = "background_image")
+    private String backgroundImage;
+
     public BasicSchool() {
 
     }
@@ -192,4 +196,12 @@ public class BasicSchool extends BaseEntity implements Serializable {
     public void setHasPaperNumber(Boolean hasPaperNumber) {
         this.hasPaperNumber = hasPaperNumber;
     }
+
+    public String getBackgroundImage() {
+        return backgroundImage;
+    }
+
+    public void setBackgroundImage(String backgroundImage) {
+        this.backgroundImage = backgroundImage;
+    }
 }

+ 1 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/mapper/BasicSchoolMapper.java

@@ -1,7 +1,6 @@
 package com.qmth.teachcloud.common.mapper;
 
 import com.qmth.teachcloud.common.base.CustomBaseMapper;
-import com.qmth.teachcloud.common.bean.dto.SchoolDto;
 import com.qmth.teachcloud.common.entity.BasicSchool;
 import org.apache.ibatis.annotations.Param;
 
@@ -17,5 +16,5 @@ import java.util.List;
  */
 public interface BasicSchoolMapper extends CustomBaseMapper<BasicSchool> {
 
-    List<SchoolDto> listSchool(@Param("code") String code);
+    List<BasicSchool> listSchool(@Param("code") String code);
 }

+ 2 - 3
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/BasicSchoolService.java

@@ -1,7 +1,6 @@
 package com.qmth.teachcloud.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
-import com.qmth.teachcloud.common.bean.dto.SchoolDto;
 import com.qmth.teachcloud.common.entity.BasicSchool;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -17,9 +16,9 @@ import java.util.List;
  */
 public interface BasicSchoolService extends IService<BasicSchool> {
 
-    List<SchoolDto> listSchool(String code);
+    List<BasicSchool> listSchool(String code);
 
-    boolean updateSchool(Long id, String code, String name, String initPassword, Boolean defaultSchool, Boolean hasPaperNumber, MultipartFile logo, String logoMd5);
+    boolean updateSchool(Long id, String code, String name, String initPassword, Boolean defaultSchool, Boolean hasPaperNumber, MultipartFile logo, String logoMd5, MultipartFile backgroundImage, String backgroundImageMd5);
 
     List<BasicSchool> listByDefaultSchool(boolean defaultSchool);
 

+ 40 - 11
teachcloud-common/src/main/java/com/qmth/teachcloud/common/service/impl/BasicSchoolServiceImpl.java

@@ -1,23 +1,29 @@
 package com.qmth.teachcloud.common.service.impl;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.qmth.teachcloud.common.bean.dto.SchoolDto;
+import com.qmth.teachcloud.common.bean.vo.FilePathVo;
 import com.qmth.teachcloud.common.config.DictionaryConfig;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicSchool;
 import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.enums.UploadFileEnum;
 import com.qmth.teachcloud.common.mapper.BasicSchoolMapper;
 import com.qmth.teachcloud.common.service.BasicSchoolService;
 import com.qmth.teachcloud.common.service.CommonCacheService;
+import com.qmth.teachcloud.common.service.FileUploadService;
 import com.qmth.teachcloud.common.service.SysUserService;
 import com.qmth.teachcloud.common.util.Base64Util;
 import com.qmth.teachcloud.common.util.FileStoreUtil;
 import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.FilenameUtils;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
 import org.springframework.stereotype.Service;
+import org.springframework.util.DigestUtils;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
@@ -36,10 +42,7 @@ import java.util.List;
 public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, BasicSchool> implements BasicSchoolService {
 
     @Resource
-    DictionaryConfig dictionaryConfig;
-
-    @Resource
-    FileStoreUtil fileStoreUtil;
+    FileUploadService fileUploadService;
 
     @Resource
     CommonCacheService commonCacheService;
@@ -48,28 +51,54 @@ public class BasicSchoolServiceImpl extends ServiceImpl<BasicSchoolMapper, Basic
     SysUserService sysUserService;
 
     @Override
-    public List<SchoolDto> listSchool(String code) {
-        List<SchoolDto> schoolDtos = this.baseMapper.listSchool(code);
-        for (SchoolDto schoolDto : schoolDtos) {
+    public List<BasicSchool> listSchool(String code) {
+        List<BasicSchool> schoolDtos = this.baseMapper.listSchool(code);
+        for (BasicSchool schoolDto : schoolDtos) {
             if (StringUtils.isNotBlank(schoolDto.getInitPassword())) {
                 schoolDto.setInitPassword(new String(Base64Util.decode(schoolDto.getInitPassword())));
             }
+            String backgroundImageUrl = null;
+            if (StringUtils.isNotBlank(schoolDto.getBackgroundImage())) {
+                try {
+                    backgroundImageUrl = fileUploadService.filePreview(schoolDto.getBackgroundImage());
+                } catch (Exception e) {
+
+                }
+            }
+            schoolDto.setBackgroundImage(backgroundImageUrl);
         }
         return schoolDtos;
     }
 
     @Override
-    public boolean updateSchool(Long id, String code, String name, String initPassword, Boolean defaultSchool, Boolean hasPaperNumber, MultipartFile logo, String logoMd5) {
+    public boolean updateSchool(Long id, String code, String name, String initPassword, Boolean defaultSchool, Boolean hasPaperNumber, MultipartFile logo, String logoMd5, MultipartFile backgroundImage, String backgroundImageMd5) {
         BasicSchool basicSchool = this.getById(id);
         basicSchool.setCode(code);
         basicSchool.setName(name);
 
+        // 学校logo
         if (logo != null) {
             try {
+                if (!DigestUtils.md5DigestAsHex(logo.getBytes()).equals(logoMd5)) {
+                    throw ExceptionResultEnum.ERROR.exception("学校logo图片上传有误");
+                }
                 String toBase64 = "data:image/png;base64," + new String(Base64.getEncoder().encode(logo.getBytes()), SystemConstant.CHARSET);
                 basicSchool.setLogo(toBase64);
             } catch (Exception e) {
-                log.error(SystemConstant.LOG_ERROR, e);
+                throw ExceptionResultEnum.ERROR.exception(e.getMessage());
+            }
+        }
+        // 登录页背景图
+        if (backgroundImage != null) {
+            try {
+                if (!DigestUtils.md5DigestAsHex(backgroundImage.getBytes()).equals(backgroundImageMd5)) {
+                    throw ExceptionResultEnum.ERROR.exception("登录页背景图片上传有误");
+                }
+                String backgroundFileName = basicSchool.getCode() + FilenameUtils.getExtension(backgroundImage.getOriginalFilename());
+                FilePathVo filePathVo = fileUploadService.uploadFile(backgroundImage, UploadFileEnum.FILE, backgroundFileName, backgroundImageMd5);
+                basicSchool.setBackgroundImage(JSON.toJSONString(filePathVo));
+            } catch (Exception e) {
+                throw ExceptionResultEnum.ERROR.exception(e.getMessage());
             }
         }
 

+ 2 - 13
teachcloud-common/src/main/resources/mapper/BasicSchoolMapper.xml

@@ -20,19 +20,8 @@
         id,
         code, name, enable, access_key, access_secret, remark, create_time, update_time
     </sql>
-    <select id="listSchool" resultType="com.qmth.teachcloud.common.bean.dto.SchoolDto">
-        select
-            id,
-            code,
-            name,
-            enable,
-            access_key accessKey,
-            access_secret accessSecret,
-            logo,
-            init_password initPassword,
-            default_school defaultSchool,
-            has_paper_number hasPaperNumber
-        from basic_school
+    <select id="listSchool" resultType="com.qmth.teachcloud.common.entity.BasicSchool">
+        select * from basic_school
         where enable = true
         <if test="code != null and code != ''">
             and code = #{code}

+ 18 - 4
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/answercard/CardFile.java

@@ -21,6 +21,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.qmth.boot.core.exception.ParameterException;
 import com.qmth.teachcloud.common.bean.dto.mark.PictureConfig;
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.boot.web.embedded.tomcat.ConfigurableTomcatWebServerFactory;
 
 /**
  * 卡格式文件内容结构
@@ -69,10 +70,23 @@ public class CardFile {
 
     public static String getMarkConfigAdd(List<PictureConfig> list, double position) {
         for (PictureConfig configItem : list) {
-            configItem.setX(configItem.getX() < position ? configItem.getX() : configItem.getX() - position);
-            configItem.setY(configItem.getY() < position ? configItem.getY() : configItem.getY() - position);
-            configItem.setW(configItem.getW() + position * 2);
-            configItem.setH(configItem.getH() + position * 2);
+            if (configItem.getX() < position) {
+                double calcW = configItem.getX() + configItem.getW() + position;
+                configItem.setW(calcW <= 1 ? configItem.getW() + position : 1 - configItem.getX());
+            } else {
+                configItem.setX(configItem.getX() - position);
+                double calcW = configItem.getX() + configItem.getW() + position * 2;
+                configItem.setW(calcW <= 1 ? configItem.getW() + position * 2 : 1 - configItem.getX());
+            }
+
+            if (configItem.getY() < position) {
+                double calcH = configItem.getY() + configItem.getH() + position;
+                configItem.setH(calcH <= 1 ? configItem.getH() + position : 1 - configItem.getY());
+            } else {
+                configItem.setY(configItem.getY() - position);
+                double calcH = configItem.getY() + configItem.getH() + position * 2;
+                configItem.setH(calcH <= 1 ? configItem.getH() + position * 2 : 1 - configItem.getH());
+            }
         }
         return JSON.toJSONString(list);
     }

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

@@ -105,7 +105,7 @@ public class MarkGroupServiceImpl extends MppServiceImpl<MarkGroupMapper, MarkGr
         // 分班阅参数
         MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
         markGroupTaskDto.setOpenMarkClass(markPaper != null && markPaper.getOpenMarkClass());
-        markGroupTaskDto.setOpenDoubleMarking(markPaper!= null && markPaper.getOpenDoubleMarking());
+        markGroupTaskDto.setOpenDoubleMarking(markPaper != null && markPaper.getOpenDoubleMarking());
         return markGroupTaskDto;
     }
 
@@ -376,9 +376,7 @@ public class MarkGroupServiceImpl extends MppServiceImpl<MarkGroupMapper, MarkGr
         markGroup.setDoubleRate(markGroupDto.getDoubleRate());
         markGroup.setScorePolicy(markGroupDto.getScorePolicy());
         markGroup.setArbitrateThreshold(markGroupDto.getArbitrateThreshold());
-        if (!CollectionUtils.isEqualCollection(JSON.parseArray(markGroup.getPicList(), PictureConfig.class), markGroupDto.getPictureConfigs())) {
-            markGroup.setPicList(CardFile.getMarkConfigAdd(markGroupDto.getPictureConfigs(), 0.015));
-        }
+        markGroup.setPicList(JSON.toJSONString(markGroupDto.getPictureConfigs()));
         this.updateByMultiId(markGroup);
 
         List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndGroupNumber(examId, paperNumber, markGroupDto.getGroupNumber(), false);

+ 1 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/utils/CardParseUtils.java

@@ -91,7 +91,7 @@ public class CardParseUtils {
                     String key = struct.getMainNumber() + "-" + struct.getSubNumber();
                     if (answerMap.containsKey(key)) {
                         Answer answer = JSON.parseObject(JSON.toJSONString(answerMap.get(key)), Answer.class);
-                        struct.setAnswer(answer.getAnswer().replaceAll(",", ""));
+                        struct.setAnswer(StringUtils.isBlank(answer.getAnswer()) ? null : answer.getAnswer().replaceAll(",", ""));
                         struct.setScore(answer.getScore());
                     }
                 }