Parcourir la source

add. 超管-题卡规格配置

caozixuan il y a 10 mois
Parent
commit
19bdfcbb47

+ 2 - 0
distributed-print-business/src/main/resources/db/log/脚本-caozx.sql

@@ -1,3 +1,5 @@
 -- 2024-08-21
 INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3055', '首页-评卷待办数量', '/api/admin/work/mark/task/ready_count', 'URL', '16', '11', 'SYS', '1', '1', '1');
 INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3056', '首页-评卷待办列表', '/api/admin/work/mark/task/ready', 'URL', '16', '12', 'SYS', '1', '1', '1');
+
+INSERT INTO `sys_config` (`id`, `school_id`, `org_id`, `config_key`, `config_name`, `config_value`, `remark`, `enable`, `sort`, `create_id`, `create_time`, `update_id`, `update_time`) VALUES (43, NULL, NULL, 'sys.card.size.list', '全局题卡格式清单', '[A3, 8K]', NULL, 1, 2, 1, NULL, NULL, NULL);

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

@@ -2567,6 +2567,7 @@ INSERT INTO `sys_config` (`id`, `school_id`, `org_id`, `config_key`, `config_nam
 INSERT INTO `sys_config` (`id`, `school_id`, `org_id`, `config_key`, `config_name`, `config_value`, `remark`, `enable`, `sort`, `create_id`, `create_time`, `update_id`, `update_time`) VALUES (40, NULL, NULL, 'sys.txt.charset', 'txt文件编码', 'UTF-8', NULL, 1, 1, 1, NULL, NULL, NULL);
 INSERT INTO `sys_config` (`id`, `school_id`, `org_id`, `config_key`, `config_name`, `config_value`, `remark`, `enable`, `sort`, `create_id`, `create_time`, `update_id`, `update_time`) VALUES (41, NULL, NULL, 'package.barcode.position', '签到表条码坐标', '[0.7,0,0.3,0.1]', NULL, 1, 17, 1, NULL, NULL, NULL);
 INSERT INTO `sys_config` (`id`, `school_id`, `org_id`, `config_key`, `config_name`, `config_value`, `remark`, `enable`, `sort`, `create_id`, `create_time`, `update_id`, `update_time`) VALUES (42, NULL, NULL, 'create.pdf.job.db.limit', '创建pdf查询条数', 'limit 0,100', NULL, 1, 18, 1, NULL, NULL, NULL);
+INSERT INTO `sys_config` (`id`, `school_id`, `org_id`, `config_key`, `config_name`, `config_value`, `remark`, `enable`, `sort`, `create_id`, `create_time`, `update_id`, `update_time`) VALUES (43, NULL, NULL, 'sys.card.size.list', '全局题卡格式清单', '[A3, 8K]', NULL, 1, 2, 1, NULL, NULL, NULL);
 
 -- ----------------------------
 -- Table structure for sys_org

+ 42 - 12
distributed-print/src/main/java/com/qmth/distributed/print/api/SysAdminSetController.java

@@ -157,12 +157,22 @@ public class SysAdminSetController {
     @ApiResponses({@ApiResponse(code = 200, message = "系统试卷规格配置信息", response = CustomPrivilegeResult.class)})
     @RequestMapping(value = "/paper/sys/select", method = RequestMethod.POST)
     public Result sysadminPaperSysSelect() {
-        SysConfig sysConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
-        Optional.ofNullable(sysConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局上传试卷规格"));
         SysAdminSetResult sysAdminSetResult = new SysAdminSetResult();
-        SysConfigResult sysConfigResult = new SysConfigResult(sysConfig);
-        sysConfigResult.setValue(Arrays.asList(sysConfigResult.getValue().toString().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")));
-        sysAdminSetResult.setResult(Arrays.asList(sysConfigResult));
+        List<SysConfigResult> list = new ArrayList<>();
+        // pdf全局格式
+        SysConfig sysPdfConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_PDF_SIZE_LIST);
+        Optional.ofNullable(sysPdfConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局上传试卷规格"));
+        SysConfigResult pdfCell = new SysConfigResult(sysPdfConfig);
+        pdfCell.setValue(Arrays.asList(sysPdfConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")));
+        list.add(pdfCell);
+
+        // 题卡全局格式
+        SysConfig sysCardConfig = commonCacheService.addSysConfigCache(SystemConstant.SYS_CARD_SIZE_LIST);
+        Optional.ofNullable(sysCardConfig).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("未配置全局上传试卷规格"));
+        SysConfigResult cardCell = new SysConfigResult(sysCardConfig);
+        cardCell.setValue(Arrays.asList(sysCardConfig.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", ")));
+        list.add(cardCell);
+        sysAdminSetResult.setResult(list);
         return ResultUtil.ok(sysAdminSetResult);
     }
 
@@ -170,18 +180,38 @@ public class SysAdminSetController {
     @ApiResponses({@ApiResponse(code = 200, message = "试卷规格配置信息", response = SysAdminSetResult.class)})
     @RequestMapping(value = "/paper/select", method = RequestMethod.POST)
     public Result sysadminPaperSelect(@ApiParam(value = "学校id ", required = true) @RequestParam Long schoolId) {
+        List<SysConfigResult> resultList = new ArrayList<>();
+        // 试卷规格
         SysConfig sysConfigPdfSize = commonCacheService.addSysConfigCache(schoolId, SystemConstant.PDF_SIZE_LIST);
-        List<String> pdfSize = null;
-        SysConfigResult sysConfigResult = null;
+        List<String> pdfSize;
+        SysConfigResult sysPdfConfigResult;
         if (Objects.nonNull(sysConfigPdfSize)) {
-            pdfSize = Arrays.asList(sysConfigPdfSize.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", "));
-            sysConfigResult = new SysConfigResult(sysConfigPdfSize);
-            sysConfigResult.setValue(pdfSize);
+            pdfSize = Arrays.asList(
+                    sysConfigPdfSize.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", "));
+            sysPdfConfigResult = new SysConfigResult(sysConfigPdfSize);
+            sysPdfConfigResult.setValue(pdfSize);
+        } else {
+            sysPdfConfigResult = new SysConfigResult(null, SystemConstant.PDF_SIZE_LIST, "允许上传试卷规格", new ArrayList<>(),
+                    1);
+        }
+        resultList.add(sysPdfConfigResult);
+
+        // 题卡规格
+        SysConfig sysConfigCardSize = commonCacheService.addSysConfigCache(schoolId, SystemConstant.CARD_SIZE_LIST);
+        List<String> cardSize;
+        SysConfigResult sysCardConfigResult;
+        if (Objects.nonNull(sysConfigCardSize)) {
+            cardSize = Arrays.asList(
+                    sysConfigCardSize.getConfigValue().replaceAll("\\[", "").replaceAll("\\]", "").split(", "));
+            sysCardConfigResult = new SysConfigResult(sysConfigCardSize);
+            sysCardConfigResult.setValue(cardSize);
         } else {
-            sysConfigResult = new SysConfigResult(null, SystemConstant.PDF_SIZE_LIST, "允许上传试卷规格", new ArrayList<>(), 1);
+            sysCardConfigResult = new SysConfigResult(null, SystemConstant.CARD_SIZE_LIST, "允许上传题卡规格", new ArrayList<>(), 2);
         }
+        resultList.add(sysCardConfigResult);
+
         SysAdminSetResult sysAdminSetResult = new SysAdminSetResult(schoolId);
-        sysAdminSetResult.setResult(Arrays.asList(sysConfigResult));
+        sysAdminSetResult.setResult(resultList);
         return ResultUtil.ok(sysAdminSetResult);
     }
 

+ 2 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/contant/SystemConstant.java

@@ -170,6 +170,7 @@ public class SystemConstant {
     public static final String SYS_CONFIG_KEY_CHARSETS = "sys.txt.charset";
     public static final String PACKAGE_BARCODE_POSITION = "package.barcode.position";
     public static final String SYS_PDF_SIZE_LIST = "sys.pdf.size.list";
+    public static final String SYS_CARD_SIZE_LIST = "sys.card.size.list";
     public static final String ADMIN_LOGO_URL = "admin.logo.url";
     public static final String ATTACHMENT_TYPE = "attachment.type";
     public static final String ATTACHMENT_LENGTH = "attachment.length";
@@ -217,6 +218,7 @@ public class SystemConstant {
     public static final String ACCOUNT_SMS_VERIFY = "account.sms.verify";
     public static final String TEACHCLOUD_EXCHANGE_HOST_URL = "teachcloud.exchange.host.url";
     public static final String PDF_SIZE_LIST = "pdf.size.list";
+    public static final String CARD_SIZE_LIST = "card.size.list";
 
     /**
      * 系统常量