xiaof %!s(int64=4) %!d(string=hai) anos
pai
achega
d025d00f69

+ 37 - 0
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/params/RelatePaperParam.java

@@ -0,0 +1,37 @@
+package com.qmth.distributed.print.business.bean.params;
+
+import com.qmth.distributed.print.business.base.BasePage;
+
+/**
+ * @Date: 2021/3/23.
+ */
+public class RelatePaperParam extends BasePage {
+
+    private Long examTaskId;
+    private String paperNumber;
+    private String relatePaperType;
+
+    public Long getExamTaskId() {
+        return examTaskId;
+    }
+
+    public void setExamTaskId(Long examTaskId) {
+        this.examTaskId = examTaskId;
+    }
+
+    public String getPaperNumber() {
+        return paperNumber;
+    }
+
+    public void setPaperNumber(String paperNumber) {
+        this.paperNumber = paperNumber;
+    }
+
+    public String getRelatePaperType() {
+        return relatePaperType;
+    }
+
+    public void setRelatePaperType(String relatePaperType) {
+        this.relatePaperType = relatePaperType;
+    }
+}

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

@@ -18,8 +18,6 @@ import java.util.List;
  */
  */
 public interface BasicAttachmentService extends IService<BasicAttachment> {
 public interface BasicAttachmentService extends IService<BasicAttachment> {
 
 
-    BasicAttachment save(MultipartFile file, String md5, Long userId);
-
     /**
     /**
      * 保存附件
      * 保存附件
      *
      *

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

@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.params.ExamCardParams;
 import com.qmth.distributed.print.business.bean.params.ExamCardParams;
+import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 
 
 import java.util.List;
 import java.util.List;
@@ -21,7 +22,7 @@ public interface ExamTaskDetailService extends IService<ExamTaskDetail> {
 
 
     boolean enable(ExamTaskDetail examTaskDetail);
     boolean enable(ExamTaskDetail examTaskDetail);
 
 
-    boolean updatePaper(Map<String, String> map);
+    boolean updatePaper(RelatePaperParam paperParam);
 
 
     IPage<ExamTaskDetailDto> list(String relateType, Long printPlanId, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize);
     IPage<ExamTaskDetailDto> list(String relateType, Long printPlanId, String courseCode, String paperNumber, Integer pageNumber, Integer pageSize);
 
 

+ 0 - 76
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/BasicAttachmentServiceImpl.java

@@ -57,82 +57,6 @@ public class BasicAttachmentServiceImpl extends ServiceImpl<BasicAttachmentMappe
     @Autowired
     @Autowired
     private DictionaryConfig dictionaryConfig;
     private DictionaryConfig dictionaryConfig;
 
 
-    @Override
-    public BasicAttachment save(MultipartFile file, String md5, Long userId) {
-        Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
-        try {
-            if (file == null) {
-                throw ExceptionResultEnum.ERROR.exception("文件为空");
-            }
-            if (StringUtils.isBlank(md5)) {
-                throw ExceptionResultEnum.ERROR.exception("md5为空");
-            }
-            // 文件名
-            String fileName = file.getOriginalFilename();
-            int lastIndex = fileName.lastIndexOf(".");
-            // 文件类型
-            String type = fileName.substring(lastIndex);
-            List<String> attachmentType = dictionaryConfig.sysDomain().getAttachmentType();
-            if (attachmentType != null && attachmentType.size() > 0) {
-                if (!attachmentType.contains(type)) {
-                    throw ExceptionResultEnum.ERROR.exception("文件格式不支持");
-                }
-            }
-
-            // 文件大小
-            long size = file.getSize();
-            if (size > 200 * 1024 * 1024) {
-                throw ExceptionResultEnum.ERROR.exception("文件大小不能超过200M");
-            }
-
-            // md5
-            String fileMd5 = DigestUtils.md5Hex(file.getBytes());
-            if (!md5.equals(fileMd5)) {
-                throw ExceptionResultEnum.ERROR.exception("md5不一致,文件可能损坏");
-            }
-
-            // 保存
-            BasicAttachment attachment = new BasicAttachment();
-
-            // 保存文件
-            boolean isOss = dictionaryConfig.sysDomain().isOss();
-            // 文件保存路径
-            LocalDateTime localDateTime = LocalDateTime.now();
-            String serverUpload = dictionaryConfig.sysDomain().getServerUpload();
-            StringJoiner sj = new StringJoiner(File.separator)
-                    .add(serverUpload)
-                    .add(String.valueOf(schoolId))
-                    .add(String.valueOf(localDateTime.getYear()))
-                    .add(String.valueOf(localDateTime.getMonthValue()))
-                    .add(String.valueOf(localDateTime.getDayOfMonth()));
-            if (isOss) {
-                // todo
-            } else {
-                File destFolder = new File(sj.toString());
-                if (!destFolder.exists()) {
-                    destFolder.mkdirs();
-                }
-                File newFile = new File(sj.toString(), UUID.fastUUID() + type);
-                FileUtils.copyInputStreamToFile(file.getInputStream(), newFile);
-                attachment.setPath(newFile.getPath());
-            }
-
-            attachment.setName(file.getOriginalFilename());
-            attachment.setType(type);
-            attachment.setSize(BigDecimal.valueOf(size));
-            attachment.setMd5(md5);
-            attachment.setCreateId(userId);
-            attachment.setCreateTime(System.currentTimeMillis());
-
-            this.save(attachment);
-            return attachment;
-        } catch (IOException e) {
-            e.printStackTrace();
-        } finally {
-        }
-        return null;
-    }
-
     /**
     /**
      * 保存附件
      * 保存附件
      *
      *

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

@@ -13,6 +13,7 @@ import com.qmth.distributed.print.business.enums.TemplateTypeEnum;
 import com.qmth.distributed.print.business.mapper.BasicCardRuleMapper;
 import com.qmth.distributed.print.business.mapper.BasicCardRuleMapper;
 import com.qmth.distributed.print.business.service.BasicCardRuleService;
 import com.qmth.distributed.print.business.service.BasicCardRuleService;
 import com.qmth.distributed.print.business.service.BasicTemplateOrgService;
 import com.qmth.distributed.print.business.service.BasicTemplateOrgService;
+import com.qmth.distributed.print.business.service.ExamTaskService;
 import com.qmth.distributed.print.business.util.ServletUtil;
 import com.qmth.distributed.print.business.util.ServletUtil;
 import com.qmth.distributed.print.common.contant.SystemConstant;
 import com.qmth.distributed.print.common.contant.SystemConstant;
 import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
 import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
@@ -38,7 +39,6 @@ public class BasicCardRuleServiceImpl extends ServiceImpl<BasicCardRuleMapper, B
     @Autowired
     @Autowired
     private BasicTemplateOrgService basicTemplateOrgService;
     private BasicTemplateOrgService basicTemplateOrgService;
 
 
-
     @Override
     @Override
     public IPage<CardRuleDto> list(Boolean enable, String name, Long createTime, Integer pageNumber, Integer pageSize) {
     public IPage<CardRuleDto> list(Boolean enable, String name, Long createTime, Integer pageNumber, Integer pageSize) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
@@ -58,8 +58,8 @@ public class BasicCardRuleServiceImpl extends ServiceImpl<BasicCardRuleMapper, B
     public List<BasicCardRule> list(String param) {
     public List<BasicCardRule> list(String param) {
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
         QueryWrapper<BasicCardRule> queryWrapper = new QueryWrapper<>();
         QueryWrapper<BasicCardRule> queryWrapper = new QueryWrapper<>();
-        queryWrapper.lambda().eq(BasicCardRule::getSchoolId, schoolId);
-        if(StringUtils.isNotBlank(param)){
+        queryWrapper.lambda().eq(BasicCardRule::getSchoolId, schoolId).eq(BasicCardRule::getEnable, true);
+        if (StringUtils.isNotBlank(param)) {
             queryWrapper.lambda().like(BasicCardRule::getName, param);
             queryWrapper.lambda().like(BasicCardRule::getName, param);
         }
         }
         return this.list(queryWrapper);
         return this.list(queryWrapper);
@@ -67,7 +67,6 @@ public class BasicCardRuleServiceImpl extends ServiceImpl<BasicCardRuleMapper, B
 
 
     @Override
     @Override
     public boolean enable(BasicCardRule cardRule) {
     public boolean enable(BasicCardRule cardRule) {
-        // todo 校验规则是否有使用
         UpdateWrapper<BasicCardRule> updateWrapper = new UpdateWrapper<>();
         UpdateWrapper<BasicCardRule> updateWrapper = new UpdateWrapper<>();
         updateWrapper.lambda().set(BasicCardRule::getEnable, cardRule.getEnable()).eq(BasicCardRule::getId, cardRule.getId());
         updateWrapper.lambda().set(BasicCardRule::getEnable, cardRule.getEnable()).eq(BasicCardRule::getId, cardRule.getId());
         return this.update(updateWrapper);
         return this.update(updateWrapper);

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

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.params.ExamCardParams;
 import com.qmth.distributed.print.business.bean.params.ExamCardParams;
+import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
 import com.qmth.distributed.print.business.entity.ExamTask;
 import com.qmth.distributed.print.business.entity.ExamTask;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.entity.ExamTaskDetail;
 import com.qmth.distributed.print.business.mapper.ExamTaskDetailMapper;
 import com.qmth.distributed.print.business.mapper.ExamTaskDetailMapper;
@@ -43,18 +44,16 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
 
 
     @Transactional
     @Transactional
     @Override
     @Override
-    public boolean updatePaper(Map<String, String> map) {
+    public boolean updatePaper(RelatePaperParam paperParam) {
         // 更新试卷编号
         // 更新试卷编号
         UpdateWrapper<ExamTask> examTaskUpdateWrapper = new UpdateWrapper<>();
         UpdateWrapper<ExamTask> examTaskUpdateWrapper = new UpdateWrapper<>();
-        examTaskUpdateWrapper.lambda().set(ExamTask::getPaperNumber, map.get("paperNumber"));
+        examTaskUpdateWrapper.lambda().set(ExamTask::getPaperNumber, paperParam.getPaperNumber());
         examTaskService.update(examTaskUpdateWrapper);
         examTaskService.update(examTaskUpdateWrapper);
 
 
         // 更新关联卷型
         // 更新关联卷型
         UpdateWrapper<ExamTaskDetail> updateWrapper = new UpdateWrapper<>();
         UpdateWrapper<ExamTaskDetail> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.lambda().set(ExamTaskDetail::getRelatePaperType, map.get("relatePaperType")).eq(ExamTaskDetail::getExamTaskId, map.get("examTaskId"));
+        updateWrapper.lambda().set(ExamTaskDetail::getRelatePaperType, paperParam.getRelatePaperType()).eq(ExamTaskDetail::getExamTaskId, paperParam.getExamTaskId());
         this.update(updateWrapper);
         this.update(updateWrapper);
-
-        // todo 更新卷型曝光类型
         return true;
         return true;
     }
     }
 
 

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

@@ -223,7 +223,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
         loginDto.setEnable(sysUser.getEnable());
         loginDto.setEnable(sysUser.getEnable());
         loginDto.setPwdUpdateTime(sysUser.getPwdUpdateTime());
         loginDto.setPwdUpdateTime(sysUser.getPwdUpdateTime());
 
 
-        if("sysadmin".equals(sysUser.getLoginName())){
+        if("admin".equals(sysUser.getLoginName())){
             loginDto.setRoles(Arrays.asList("ADMIN"));
             loginDto.setRoles(Arrays.asList("ADMIN"));
         } else {
         } else {
             List<SysRole> list = sysUserRoleService.listRoleByUserId(sysUser.getId());
             List<SysRole> list = sysUserRoleService.listRoleByUserId(sysUser.getId());

+ 1 - 1
distributed-print-business/src/main/resources/mapper/SysRoleMapper.xml

@@ -20,7 +20,7 @@
         select id, school_id, name, enable, type, create_id, create_time, update_id, update_time from sys_role
         select id, school_id, name, enable, type, create_id, create_time, update_id, update_time from sys_role
     </sql>
     </sql>
     <select id="listRolesByUserId" resultMap="BaseResultMap">
     <select id="listRolesByUserId" resultMap="BaseResultMap">
-        SELECT
+        SELECT distinct
             a.id,
             a.id,
             a.name,
             a.name,
             a.type
             a.type

+ 4 - 4
distributed-print/src/main/java/com/qmth/distributed/print/api/ExamPrintPlanController.java

@@ -9,6 +9,7 @@ import com.qmth.distributed.print.business.bean.dto.ExamTaskDetailDto;
 import com.qmth.distributed.print.business.bean.dto.RelatePaperDto;
 import com.qmth.distributed.print.business.bean.dto.RelatePaperDto;
 import com.qmth.distributed.print.business.bean.params.DeleteParams;
 import com.qmth.distributed.print.business.bean.params.DeleteParams;
 import com.qmth.distributed.print.business.bean.params.PrintPlanParams;
 import com.qmth.distributed.print.business.bean.params.PrintPlanParams;
+import com.qmth.distributed.print.business.bean.params.RelatePaperParam;
 import com.qmth.distributed.print.business.entity.ExamPrintPlan;
 import com.qmth.distributed.print.business.entity.ExamPrintPlan;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
 import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
 import com.qmth.distributed.print.business.service.ExamDetailService;
 import com.qmth.distributed.print.business.service.ExamDetailService;
@@ -130,13 +131,12 @@ public class ExamPrintPlanController {
     /**
     /**
      * 关联/更换试卷
      * 关联/更换试卷
      *
      *
-     * @param request
-     * @param map
+     * @param paperParam
      * @return
      * @return
      */
      */
     @RequestMapping(value = "/relate_update", method = RequestMethod.POST)
     @RequestMapping(value = "/relate_update", method = RequestMethod.POST)
-    public Result relateUpdate(HttpServletRequest request, @RequestBody Map<String, String> map) {
-        boolean isSuccess = examTaskDetailService.updatePaper(map);
+    public Result relateUpdate( @RequestBody RelatePaperParam paperParam) {
+        boolean isSuccess = examTaskDetailService.updatePaper(paperParam);
         return ResultUtil.ok(isSuccess);
         return ResultUtil.ok(isSuccess);
     }
     }