Forráskód Böngészése

1.0.2,实施第一天bug修改

xiaofei 2 éve
szülő
commit
3a606530cb
19 módosított fájl, 250 hozzáadás és 34 törlés
  1. 11 0
      paper-library-business/src/main/java/com/qmth/paper/library/business/entity/PaperScanTask.java
  2. 2 0
      paper-library-business/src/main/java/com/qmth/paper/library/business/mapper/PaperLibraryMapper.java
  3. 36 0
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/BusinessCacheService.java
  4. 1 5
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/PaperLibraryCommonService.java
  5. 3 0
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/PaperLibraryService.java
  6. 90 0
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/BusinessCacheServiceImpl.java
  7. 21 3
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/ClientServiceImpl.java
  8. 21 6
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryCommonServiceImpl.java
  9. 6 0
      paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryServiceImpl.java
  10. 7 6
      paper-library-business/src/main/java/com/qmth/paper/library/business/templete/service/impl/TaskLogicServiceImpl.java
  11. 5 1
      paper-library-business/src/main/resources/mapper/PaperLibraryMapper.xml
  12. 2 2
      paper-library-business/src/main/resources/mapper/PaperScanTaskMapper.xml
  13. 8 5
      paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysSetting.java
  14. 1 1
      paper-library-common/src/main/java/com/qmth/paper/library/common/lock/LockType.java
  15. 1 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/CommonCacheService.java
  16. 7 3
      paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/LibraryCommonServiceImpl.java
  17. 20 0
      paper-library-common/src/main/java/com/qmth/paper/library/common/util/FileStoreUtil.java
  18. 6 0
      paper-library/src/main/java/com/qmth/paper/library/start/StartRunning.java
  19. 2 2
      sql/paper_library_db.sql

+ 11 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/entity/PaperScanTask.java

@@ -84,6 +84,9 @@ public class PaperScanTask extends BaseEntity implements Serializable {
     @TableField("enable")
     private Boolean enable;
 
+    @TableField(exist = false)
+    private String archivesName;
+
     public Long getSchoolId() {
         return schoolId;
     }
@@ -171,4 +174,12 @@ public class PaperScanTask extends BaseEntity implements Serializable {
     public void setEnable(Boolean enable) {
         this.enable = enable;
     }
+
+    public String getArchivesName() {
+        return archivesName;
+    }
+
+    public void setArchivesName(String archivesName) {
+        this.archivesName = archivesName;
+    }
 }

+ 2 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/mapper/PaperLibraryMapper.java

@@ -39,4 +39,6 @@ public interface PaperLibraryMapper extends BaseMapper<PaperLibrary> {
     IPage<TaskStudentResult> pageStudent(@Param("objectPage") Page<Object> objectPage, @Param("schoolId") Long schoolId, @Param("paperScanTaskId") Long paperScanTaskId, @Param("param") String param);
 
     int countByPaperScanTaskDetailId(Long paperScanTaskDetailId);
+
+    Integer maxSequence(Long paperScanTaskId);
 }

+ 36 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/service/BusinessCacheService.java

@@ -0,0 +1,36 @@
+package com.qmth.paper.library.business.service;
+
+import com.qmth.paper.library.business.entity.PaperScanTask;
+import com.qmth.paper.library.common.bean.dto.syssetting.SimpleObject;
+import com.qmth.paper.library.common.entity.SysRole;
+import com.qmth.paper.library.common.entity.SysRolePrivilege;
+import com.qmth.paper.library.common.entity.SysUser;
+import com.qmth.paper.library.common.entity.TBSession;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+public interface BusinessCacheService {
+
+    /**
+     * 删除任务
+     *
+     * @param scanTaskId
+     * @return
+     */
+    void removeSysSetting(Long scanTaskId);
+
+    /**
+     * 查询任务
+     *
+     * @return
+     */
+    PaperScanTask getPaperScanTask(Long scanTaskId);
+
+    SysUser getSysUser(Long userId);
+
+    int getSequence(Long paperScanTaskId);
+
+    void setSequence();
+}

+ 1 - 5
paper-library-business/src/main/java/com/qmth/paper/library/business/service/PaperLibraryCommonService.java

@@ -1,17 +1,13 @@
 package com.qmth.paper.library.business.service;
 
-import com.alibaba.fastjson.JSONObject;
 import com.qmth.paper.library.common.entity.BasicAttachment;
 import com.qmth.paper.library.common.entity.SysOrg;
 import com.qmth.paper.library.common.enums.TaskTypeEnum;
 import com.qmth.paper.library.common.enums.UploadFileEnum;
 import org.springframework.web.multipart.MultipartFile;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
@@ -70,7 +66,7 @@ public interface PaperLibraryCommonService {
      */
     public Map<String, Object> saveTask(MultipartFile file, TaskTypeEnum taskTypeEnum);
 
-    String saveLibraryFile(UploadFileEnum uploadFileEnum, MultipartFile... files);
+    Map<String, String> saveLibraryFile(Long paperScanTaskId, UploadFileEnum uploadFileEnum, MultipartFile... files);
 
     String preViewPath(String path, String uploadType, String type, Boolean isExpire);
 

+ 3 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/service/PaperLibraryService.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.paper.library.business.bean.result.PaperLibraryResult;
 import com.qmth.paper.library.business.bean.result.TaskStudentResult;
 import com.qmth.paper.library.business.entity.PaperLibrary;
+import com.qmth.paper.library.business.entity.PaperScanTask;
 import com.qmth.paper.library.common.enums.RecognitionTypeEnum;
 
 import java.util.List;
@@ -45,4 +46,6 @@ public interface PaperLibraryService extends IService<PaperLibrary> {
     List<String> recognition(Long paperLibraryId, Integer index, Integer x, Integer y, Integer width, Integer height, Integer rotate, RecognitionTypeEnum type);
 
     Boolean abnormal(Long paperLibraryId);
+
+    Integer maxSequence(Long paperScanTaskId);
 }

+ 90 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/BusinessCacheServiceImpl.java

@@ -0,0 +1,90 @@
+package com.qmth.paper.library.business.service.impl;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.qmth.paper.library.business.entity.PaperScanTask;
+import com.qmth.paper.library.business.service.BusinessCacheService;
+import com.qmth.paper.library.business.service.PaperLibraryService;
+import com.qmth.paper.library.business.service.PaperScanTaskService;
+import com.qmth.paper.library.common.bean.dto.syssetting.SettingObject;
+import com.qmth.paper.library.common.bean.dto.syssetting.SimpleObject;
+import com.qmth.paper.library.common.contant.SystemConstant;
+import com.qmth.paper.library.common.entity.*;
+import com.qmth.paper.library.common.enums.ExceptionResultEnum;
+import com.qmth.paper.library.common.lock.LockService;
+import com.qmth.paper.library.common.lock.LockType;
+import com.qmth.paper.library.common.service.*;
+import org.springframework.cache.annotation.CacheEvict;
+import org.springframework.cache.annotation.CachePut;
+import org.springframework.cache.annotation.Cacheable;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class BusinessCacheServiceImpl implements BusinessCacheService {
+
+    Map<Long, Integer> scanTaskSequenceMap = new HashMap<>();
+
+    @Resource
+    PaperScanTaskService paperScanTaskService;
+
+    @Resource
+    PaperLibraryService paperLibraryService;
+
+    @Resource
+    SysUserService sysUserService;
+
+    @Resource
+    LockService lockService;
+
+    @Override
+    @Cacheable(value = SystemConstant.CACHE_NAME, key = "'paperScanTask' + #scanTaskId")
+    public PaperScanTask getPaperScanTask(Long scanTaskId) {
+        return paperScanTaskService.getById(scanTaskId);
+    }
+
+    @Override
+    @CacheEvict(value = SystemConstant.CACHE_NAME, key = "'paperScanTask' + #scanTaskId")
+    public void removeSysSetting(Long schoolId) {
+
+    }
+
+    @Override
+    @Cacheable(value = SystemConstant.CACHE_NAME, key = "'sysUser' + #userId")
+    public SysUser getSysUser(Long userId) {
+        return sysUserService.getById(userId);
+    }
+
+    @Override
+    public int getSequence(Long paperScanTaskId) {
+        try {
+            lockService.waitlock(LockType.GET_SEQUENCE, paperScanTaskId);
+            if (!scanTaskSequenceMap.containsKey(paperScanTaskId)) {
+                return 1;
+            }
+            Integer integer = scanTaskSequenceMap.get(paperScanTaskId);
+            int value = integer + 1;
+            scanTaskSequenceMap.put(paperScanTaskId, value);
+            return value;
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception("获取自增数失败:" + e.getMessage());
+        } finally {
+            lockService.unlock(LockType.GET_SEQUENCE, paperScanTaskId);
+        }
+    }
+
+    @Override
+    public void setSequence() {
+        QueryWrapper<PaperScanTask> queryWrapper = new QueryWrapper<>();
+        List<PaperScanTask> paperScanTaskList = paperScanTaskService.list(queryWrapper);
+        for (PaperScanTask paperScanTask : paperScanTaskList) {
+            Integer sequence = paperLibraryService.maxSequence(paperScanTask.getId());
+            int value = sequence == null ? 0 : sequence.intValue();
+            scanTaskSequenceMap.put(paperScanTask.getId(), value);
+        }
+    }
+}

+ 21 - 3
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/ClientServiceImpl.java

@@ -4,6 +4,7 @@ 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.paper.library.business.entity.PaperArchives;
 import com.qmth.paper.library.business.entity.PaperLibrary;
 import com.qmth.paper.library.business.entity.PaperScanTask;
 import com.qmth.paper.library.business.entity.PaperScanTaskDetail;
@@ -32,6 +33,7 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -68,6 +70,9 @@ public class ClientServiceImpl implements ClientService {
     @Resource
     PaperScanTaskDetailService paperScanTaskDetailService;
 
+    @Resource
+    PaperArchivesService paperArchivesService;
+
     @Resource
     LockService lockService;
 
@@ -92,7 +97,19 @@ public class ClientServiceImpl implements ClientService {
                 queryWrapper.lambda().isNull(PaperScanTask::getScanUserId);
             }
         }
-        return paperScanTaskService.page(new Page<>(pageNumber, pageSize), queryWrapper);
+        Page<PaperScanTask> taskPage = paperScanTaskService.page(new Page<>(pageNumber, pageSize), queryWrapper);
+        Map<Long, String> map = new HashMap<>();
+        for (PaperScanTask record : taskPage.getRecords()) {
+            if (!map.containsKey(record.getPaperArchivesId())) {
+                PaperArchives paperArchives = paperArchivesService.getById(record.getPaperArchivesId());
+                record.setArchivesName(paperArchives.getArchivesName());
+                map.put(paperArchives.getId(), paperArchives.getArchivesName());
+            } else {
+                record.setArchivesName(map.get(record.getPaperArchivesId()));
+            }
+
+        }
+        return taskPage;
     }
 
     @Override
@@ -161,13 +178,14 @@ public class ClientServiceImpl implements ClientService {
             }
 
             // 保存图片,生成路径
-            String path = paperLibraryCommonService.saveLibraryFile(UploadFileEnum.IMAGE, frontFile, versoFile);
+            Map<String, String> map = paperLibraryCommonService.saveLibraryFile(paperScanTaskId, UploadFileEnum.IMAGE, frontFile, versoFile);
 
             PaperLibrary paperLibrary = new PaperLibrary();
             paperLibrary.setId(SystemConstant.getDbUuid());
             paperLibrary.setSchoolId(schoolId);
             paperLibrary.setPaperScanTaskId(paperScanTaskId);
-            paperLibrary.setPath(path);
+            paperLibrary.setPath(map.get("path"));
+            paperLibrary.setSequence(Integer.valueOf(map.get("sequence")));
             paperLibrary.setAbnormal(false);
             paperLibrary.setCreateId(userId);
             paperLibrary.setCreateTime(System.currentTimeMillis());

+ 21 - 6
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryCommonServiceImpl.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.itextpdf.text.pdf.PdfReader;
 import com.qmth.boot.api.exception.ApiException;
+import com.qmth.paper.library.business.entity.PaperScanTask;
+import com.qmth.paper.library.business.service.BusinessCacheService;
 import com.qmth.paper.library.business.service.PaperLibraryCommonService;
 import com.qmth.paper.library.common.bean.dto.OrgDto;
 import com.qmth.paper.library.common.config.DictionaryConfig;
@@ -52,7 +54,10 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
     private final static Logger log = LoggerFactory.getLogger(PaperLibraryCommonServiceImpl.class);
     @Resource
     CommonCacheService commonCacheService;
-    @Autowired
+
+    @Resource
+    BusinessCacheService businessCacheService;
+    @Resource
     private DictionaryConfig dictionaryConfig;
 
     @Resource
@@ -259,19 +264,26 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
     }
 
     @Override
-    public String saveLibraryFile(UploadFileEnum uploadFileEnum, MultipartFile... files) {
-        String rootPath = fileStoreUtil.buildPath(UploadFileEnum.IMAGE, false);
+    public Map<String, String> saveLibraryFile(Long paperScanTaskId, UploadFileEnum uploadFileEnum, MultipartFile... files) {
+        PaperScanTask paperScanTask = businessCacheService.getPaperScanTask(paperScanTaskId);
+        if (paperScanTask == null) {
+            throw ExceptionResultEnum.ERROR.exception("任务不存在");
+        }
+        SysUser sysUser = businessCacheService.getSysUser(paperScanTask.getScanUserId());
+        String rootPath = fileStoreUtil.buildPath(paperScanTask.getSchoolId(), paperScanTask.getPaperArchivesId(), paperScanTaskId, UploadFileEnum.IMAGE, false);
         // 根目录
         List<JSONObject> objects = new ArrayList<>();
+        int sequence = businessCacheService.getSequence(paperScanTaskId);
+        String sequenceStr = String.valueOf(sequence);
         try {
             int idx = 1;
-            String uuid = IdUtil.objectId();
+            String prefix = sysUser.getLoginName() + "-" + System.currentTimeMillis() + "-" + sequenceStr;
             for (MultipartFile file : files) {
                 JSONObject jsonObject = new JSONObject();
                 String fileName = file.getOriginalFilename();
                 String suffix = fileName.substring(fileName.lastIndexOf("."));
                 // 目标文件名
-                String dirName = rootPath + File.separator + uuid + "-" + idx + suffix;
+                String dirName = rootPath + File.separator + prefix + "-" + idx + suffix;
                 fileStoreUtil.fileUpload(dirName, file.getInputStream(), DigestUtils.md5Hex(file.getInputStream()));
                 jsonObject.put(SystemConstant.TYPE, fileStoreUtil.isOssStore() ? SystemConstant.OSS : SystemConstant.LOCAL);
                 jsonObject.put(SystemConstant.PATH, dirName);
@@ -287,7 +299,10 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
                 ResultUtil.error(e.getMessage());
             }
         }
-        return JSON.toJSONString(objects);
+        Map<String, String> map = new HashMap<>();
+        map.put("path", JSON.toJSONString(objects));
+        map.put("sequence", sequenceStr);
+        return map;
     }
 
     @Override

+ 6 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryServiceImpl.java

@@ -11,6 +11,7 @@ import com.qmth.paper.library.business.bean.result.PaperLibraryResult;
 import com.qmth.paper.library.business.bean.result.PaperScanTaskResult;
 import com.qmth.paper.library.business.bean.result.TaskStudentResult;
 import com.qmth.paper.library.business.entity.PaperLibrary;
+import com.qmth.paper.library.business.entity.PaperScanTask;
 import com.qmth.paper.library.business.entity.PaperScanTaskDetail;
 import com.qmth.paper.library.business.mapper.PaperLibraryMapper;
 import com.qmth.paper.library.business.service.PaperLibraryCommonService;
@@ -400,6 +401,11 @@ public class PaperLibraryServiceImpl extends ServiceImpl<PaperLibraryMapper, Pap
         return this.update(updateWrapper);
     }
 
+    @Override
+    public Integer maxSequence(Long paperScanTaskId) {
+        return this.baseMapper.maxSequence(paperScanTaskId);
+    }
+
     private List<PaperLibrary> createBindData(Long userId, Long schoolId) {
         try {
             lockService.waitlock(LockType.BIND_PAPER_TASK, schoolId);

+ 7 - 6
paper-library-business/src/main/java/com/qmth/paper/library/business/templete/service/impl/TaskLogicServiceImpl.java

@@ -267,19 +267,20 @@ public class TaskLogicServiceImpl implements TaskLogicService {
                     throw ExceptionResultEnum.ERROR.exception("任务名称[" + scanTaskName + "],[学号][姓名]其中一个有值时,另一个必填");
                 }
 
-                if (studentCodeMap.containsKey(scanTaskName)) {
-                    studentCodeMap.get(scanTaskName).add(courseCode);
-                } else {
+                if (!studentCodeMap.containsKey(scanTaskName)) {
                     List<String> initList = new ArrayList<>();
                     studentCodeMap.put(scanTaskName, initList);
+
                 }
 
-                if (listMap.containsKey(scanTaskName)) {
-                    listMap.get(scanTaskName).add(paperScanTaskImportDto);
-                } else {
+                studentCodeMap.get(scanTaskName).add(courseCode);
+
+                if (!listMap.containsKey(scanTaskName)) {
                     List<PaperScanTaskImportDto> initList = new ArrayList<>();
                     listMap.put(scanTaskName, initList);
                 }
+
+                listMap.get(scanTaskName).add(paperScanTaskImportDto);
             }
             List<PaperScanTaskDetail> paperScanTaskDetailList = new ArrayList<>();
             List<BasicStudent> basicStudentDbList = basicStudentService.list(new QueryWrapper<BasicStudent>().lambda().eq(BasicStudent::getSchoolId, schoolId));

+ 5 - 1
paper-library-business/src/main/resources/mapper/PaperLibraryMapper.xml

@@ -118,7 +118,7 @@
             <if test="isMatch == true">
                 and (pl.user_id is null or pl.user_id = #{userId})
             </if>
-            <if test="isMatch == false">
+            <if test="isMatch == false and listSubOrgIds != null">
                 and su.org_id in
                 <foreach collection="listSubOrgIds" open="(" close=")" separator="," item="item">
                     #{item}
@@ -150,6 +150,7 @@
             AND user_id = #{userId}
             AND paper_scan_task_detail_id is null
             AND abnormal = false
+            order by paper_scan_task_id, sequence
             limit 10
         </where>
     </select>
@@ -212,4 +213,7 @@
     <select id="countByPaperScanTaskDetailId" resultType="java.lang.Integer">
         select count(1) from paper_library where paper_scan_task_detail_id = #{paperScanTaskDetailId}
     </select>
+    <select id="maxSequence" resultType="java.lang.Integer">
+        select max(sequence) from paper_library where paper_scan_task_id = #{paperScanTaskId} and sequence is not null
+    </select>
 </mapper>

+ 2 - 2
paper-library-business/src/main/resources/mapper/PaperScanTaskMapper.xml

@@ -135,8 +135,8 @@
         FROM
             paper_scan_task_detail pstd
         <where>
-            pst.school_id = #{schoolId}
-            and exsits (
+            pstd.school_id = #{schoolId}
+            and exists (
                 select 1 from paper_scan_task pst where pstd.paper_scan_task_id = pst.id
                 <if test="paperArchivesId != null">
                     and pst.paper_archives_id = #{paperArchivesId}

+ 8 - 5
paper-library-common/src/main/java/com/qmth/paper/library/common/entity/SysSetting.java

@@ -15,7 +15,9 @@ import org.apache.commons.lang3.StringUtils;
 
 import java.io.Serializable;
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -85,11 +87,12 @@ public class SysSetting extends BaseEntity implements Serializable {
 
     public static String parseParameterObject(SysSetting sysSetting, String key) {
         if (sysSetting != null && StringUtils.isNotBlank(sysSetting.getParameterObject())) {
-            JSONObject object = JSON.parseObject(sysSetting.getParameterObject());
-            if (object.containsKey(key)) {
-                Object value = object.get(key);
-                if (value != null && "".equals(value)) {
-                    return String.valueOf(value);
+            List<SettingObject> settingObjects = JSON.parseArray(sysSetting.getParameterObject(), SettingObject.class);
+            for (SettingObject settingObject : settingObjects) {
+                for (SimpleObject simpleObject : settingObject.getData()) {
+                    if (simpleObject.getCode().equals(key)) {
+                        return simpleObject.getValue();
+                    }
                 }
             }
         }

+ 1 - 1
paper-library-common/src/main/java/com/qmth/paper/library/common/lock/LockType.java

@@ -1,7 +1,7 @@
 package com.qmth.paper.library.common.lock;
 
 public enum LockType {
-    BIND_SCAN_USER("绑定扫描员"), BIND_PAPER_TASK("绑定图片任务");
+    BIND_SCAN_USER("绑定扫描员"), BIND_PAPER_TASK("绑定图片任务"), GET_SEQUENCE("获取自增数");
 
     private String name;
 

+ 1 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/service/CommonCacheService.java

@@ -72,4 +72,5 @@ public interface CommonCacheService {
     public List<SysRolePrivilege> updateRolePrivilegeCache(Long roleId);
 
     SysRole updateRoleCache(Long roleId);
+
 }

+ 7 - 3
paper-library-common/src/main/java/com/qmth/paper/library/common/service/impl/LibraryCommonServiceImpl.java

@@ -492,9 +492,13 @@ public class LibraryCommonServiceImpl implements LibraryCommonService {
         }
         loginResult.setUserLoginCheckResult(new UserLoginCheckResult(sysUser.getId(), mobileNumber, pwdCount));
 
-        // 设置条码识别参数
-        Map<String, SimpleObject> stringStringMap = commonCacheService.getSysSetting(sysUser.getSchoolId());
-        loginResult.setOpenBarCode(!stringStringMap.containsKey(SysSettingConstant.BAR_CODE_OPEN) ? false : Boolean.parseBoolean(stringStringMap.get(SysSettingConstant.BAR_CODE_OPEN).getValue()));
+        if(sysUser.getSchoolId() != null) {
+            // 设置条码识别参数
+            Map<String, SimpleObject> stringStringMap = commonCacheService.getSysSetting(sysUser.getSchoolId());
+            loginResult.setOpenBarCode(!stringStringMap.containsKey(SysSettingConstant.BAR_CODE_OPEN) ? false : Boolean.parseBoolean(stringStringMap.get(SysSettingConstant.BAR_CODE_OPEN).getValue()));
+        } else {
+            loginResult.setOpenBarCode(false);
+        }
         return loginResult;
     }
 

+ 20 - 0
paper-library-common/src/main/java/com/qmth/paper/library/common/util/FileStoreUtil.java

@@ -139,6 +139,26 @@ public class FileStoreUtil {
         }
     }
 
+    /**
+     * 拼接文件路径
+     *
+     * @param uploadFileEnum 文件类型
+     * @param hasConfig      是否加上config参数
+     * @return path 拼接后路径
+     */
+    public String buildPath(Long schoolId, Long paperArchivesId, Long paperScanTaskId, UploadFileEnum uploadFileEnum, boolean hasConfig) {
+        validDictionaryConfig(dictionaryConfig);
+        LocalDateTime nowTime = LocalDateTime.now();
+        String prefix = uploadFileEnum.getPrefix();
+
+        String config = dictionaryConfig.fssDomain().getConfig();
+        if (config.startsWith("oss://key:secret") && !hasConfig) {
+            return FssUtils.buildPath(prefix, String.valueOf(schoolId), String.valueOf(paperArchivesId), String.valueOf(paperScanTaskId));
+        } else {
+            return FssUtils.buildPath(config, prefix, String.valueOf(schoolId), String.valueOf(paperArchivesId), String.valueOf(paperScanTaskId));
+        }
+    }
+
     /**
      * 校验oss和local
      *

+ 6 - 0
paper-library/src/main/java/com/qmth/paper/library/start/StartRunning.java

@@ -1,5 +1,7 @@
 package com.qmth.paper.library.start;
 
+import com.google.j2objc.annotations.ReflectionSupport;
+import com.qmth.paper.library.business.service.BusinessCacheService;
 import com.qmth.paper.library.common.contant.SystemConstant;
 import com.qmth.paper.library.common.service.AuthInfoService;
 import org.slf4j.Logger;
@@ -23,10 +25,14 @@ public class StartRunning implements CommandLineRunner {
     @Resource
     AuthInfoService authInfoService;
 
+    @Resource
+    BusinessCacheService businessCacheService;
+
     @Override
     public void run(String... args) throws Exception {
         log.info("服务器启动时执行 start");
         authInfoService.appInfoInit();
+        businessCacheService.setSequence();
         log.info("服务器启动时执行 end");
     }
 }

+ 2 - 2
sql/paper_library_db.sql

@@ -478,8 +478,8 @@ 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 (412, '查询全局系统设置参数', '/api/admin/sys/setting_global/get', 'URL', 149, 16, 'SYS', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (413, '新增/修改全局系统设置参数', '/api/admin/sys/setting_global/save', 'URL', 149, 17, 'SYS', NULL, 1, 1, 1);
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (414, '查询识别方式', '/api/admin/sys/setting/recognition_mode', 'URL', 409, 3, 'AUTH', NULL, 1, 1, 1);
-INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (507, '菜单管理', 'MenuManage', 'MENU', 1, 7, NULL, NULL, 1, 0, 1);
-INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (508, '自定义菜单', 'CustomMenu', 'MENU', 507, 1, NULL, NULL, 1, 0, 1);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (507, '菜单管理', 'MenuManage', 'MENU', 1, 7, NULL, NULL, 1, 0, 0);
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (508, '自定义菜单', 'CustomMenu', 'MENU', 507, 1, NULL, NULL, 1, 0, 0);
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (510, '学期管理', 'SemesterManage', 'MENU', 112, 2, NULL, NULL, 1, 0, 1);
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (511, '新建学期', 'Add', 'BUTTON', 510, 1, 'AUTH', '534', 1, 0, 1);
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `related`, `enable`, `default_auth`, `front_display`) VALUES (512, '编辑', 'Edit', 'LINK', 510, 1, 'AUTH', '534', 1, 0, 1);