Преглед изворни кода

新增模式4答题卡管理

wangliang пре 3 месеци
родитељ
комит
b53dc192a9

+ 9 - 10
distributed-print-business/src/main/java/com/qmth/distributed/print/business/bean/dto/admin/SetFontDto.java

@@ -1,7 +1,5 @@
 package com.qmth.distributed.print.business.bean.dto.admin;
 
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.qmth.teachcloud.common.entity.BasicAttachment;
 import io.swagger.annotations.ApiModelProperty;
 import org.jetbrains.annotations.NotNull;
@@ -19,8 +17,7 @@ import java.util.Objects;
 public class SetFontDto implements Serializable, Comparable<SetFontDto> {
 
     @ApiModelProperty(value = "附件id")
-    @JsonSerialize(using = ToStringSerializer.class)
-    private Long attachmentId;
+    private String attachmentId;
 
     @ApiModelProperty(value = "字体名称")
     private String fontName;
@@ -36,24 +33,24 @@ public class SetFontDto implements Serializable, Comparable<SetFontDto> {
     }
 
     public SetFontDto(String fontName) {
-        this.attachmentId = -1L;
+        this.attachmentId = "-1";
         this.fontName = fontName;
         this.format = "null";
         this.choose = false;
     }
 
     public SetFontDto(BasicAttachment basicAttachment, Boolean choose) {
-        this.attachmentId = basicAttachment.getId();
+        this.attachmentId = basicAttachment.getId().toString();
         this.fontName = basicAttachment.getName();
         this.format = basicAttachment.getType();
         this.choose = choose;
     }
 
-    public Long getAttachmentId() {
+    public String getAttachmentId() {
         return attachmentId;
     }
 
-    public void setAttachmentId(Long attachmentId) {
+    public void setAttachmentId(String attachmentId) {
         this.attachmentId = attachmentId;
     }
 
@@ -100,9 +97,11 @@ public class SetFontDto implements Serializable, Comparable<SetFontDto> {
 
     @Override
     public int compareTo(@NotNull SetFontDto o) {
-        if (o.getAttachmentId().longValue() < this.getAttachmentId().longValue()) {
+        Long l1 = Long.parseLong(o.getAttachmentId());
+        Long l2 = Long.parseLong(this.getAttachmentId());
+        if (l1.longValue() < l2.longValue()) {
             return 1;
-        } else if (o.getAttachmentId().longValue() > this.getAttachmentId().longValue()) {
+        } else if (l1.longValue() > l2.longValue()) {
             return -1;
         } else {
             return 0;

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

@@ -37,11 +37,11 @@ public class ExamCardModelFourController {
     @Resource
     ExamCardModelFourService examCardModelFourService;
 
-    @ApiOperation(value = "分页查询")
+    @ApiOperation(value = "模式4题卡列表")
     @RequestMapping(value = "/page", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "新增", response = EditResult.class)})
-    public Result page(@ApiParam(value = "学期ID") @RequestParam(required = false) Long semesterId,
-                       @ApiParam(value = "考试ID") @RequestParam(required = false) Long examId,
+    public Result page(@ApiParam(value = "学期ID", required = true) @RequestParam Long semesterId,
+                       @ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
                        @ApiParam(value = "课程代码") @RequestParam(required = false) Long courseId,
                        @ApiParam(value = "试卷编号") @RequestParam(required = false) String paperNumber,
                        @ApiParam(value = "开课学院ID") @RequestParam(required = false) Long collegeId,

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

@@ -728,7 +728,7 @@ public class SysAdminSetController {
     @Transactional
     @OperationLogDetail(operationType = OperationTypeEnum.SAVE)
     public Result sysadminFontSave(@ApiParam(value = "学校ID", required = true) @RequestParam Long schoolId,
-                                   @ApiParam(value = "附件ID", required = true) @RequestParam Long attachmentId) {
+                                   @ApiParam(value = "附件ID", required = true) @RequestParam String attachmentId) {
         BasicAttachment basicAttachment = basicAttachmentService.getById(attachmentId);
         Objects.requireNonNull(basicAttachment, "未找到附件信息");
 
@@ -764,18 +764,18 @@ public class SysAdminSetController {
     @RequestMapping(value = "/font/update", method = RequestMethod.POST)
     @Transactional
     public Result sysadminFontUpdate(@ApiParam(value = "学校ID", required = true) @RequestParam Long schoolId,
-                                     @ApiParam(value = "附件ID", required = true) @RequestParam Long attachmentId) {
+                                     @ApiParam(value = "附件ID", required = true) @RequestParam String attachmentId) {
         SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.SCHOOL_FONT_TEMPLATE);
         Objects.requireNonNull(sysConfig, "未找到字体信息");
 
         List<SetFontDto> setFontDtoList = GsonUtil.fromJson(sysConfig.getConfigValue(), new TypeToken<List<SetFontDto>>() {
         }.getType());
         setFontDtoList.stream().map(s -> {
-            if (s.getAttachmentId().longValue() == attachmentId.longValue() && attachmentId.longValue() == -1L && s.getChoose()) {
+            if (Objects.equals(s.getAttachmentId(), attachmentId) && Objects.equals(attachmentId, "-1") && s.getChoose()) {
                 throw ExceptionResultEnum.ERROR.exception("系统默认字体已被选择");
-            } else if (s.getAttachmentId().longValue() == attachmentId.longValue() && s.getChoose()) {
+            } else if (Objects.equals(s.getAttachmentId(), attachmentId) && s.getChoose()) {
                 throw ExceptionResultEnum.ERROR.exception("当前字体已被选择");
-            } else if (s.getAttachmentId().longValue() == attachmentId.longValue()) {
+            } else if (Objects.equals(s.getAttachmentId(), attachmentId)) {
                 s.setChoose(true);
             } else {
                 s.setChoose(false);
@@ -798,16 +798,16 @@ public class SysAdminSetController {
     @RequestMapping(value = "/font/delete", method = RequestMethod.POST)
     @Transactional
     public Result sysadminFontDelete(@ApiParam(value = "学校ID", required = true) @RequestParam Long schoolId,
-                                     @ApiParam(value = "附件ID", required = true) @RequestParam Long attachmentId) {
+                                     @ApiParam(value = "附件ID", required = true) @RequestParam String attachmentId) {
         SysConfig sysConfig = commonCacheService.addSysConfigCache(schoolId, SystemConstant.SCHOOL_FONT_TEMPLATE);
         Objects.requireNonNull(sysConfig, "未找到字体信息");
-        if (attachmentId.longValue() == -1L) {
+        if (Objects.equals(attachmentId, "-1")) {
             throw ExceptionResultEnum.ERROR.exception("系统默认字体无法删除");
         }
 
         List<SetFontDto> setFontDtoList = GsonUtil.fromJson(sysConfig.getConfigValue(), new TypeToken<List<SetFontDto>>() {
         }.getType());
-        List<SetFontDto> setFontDtoDelList = setFontDtoList.stream().filter(s -> s.getAttachmentId().longValue() == attachmentId.longValue()).collect(Collectors.toList());
+        List<SetFontDto> setFontDtoDelList = setFontDtoList.stream().filter(s -> Objects.equals(s.getAttachmentId(), attachmentId)).collect(Collectors.toList());
         if (CollectionUtils.isEmpty(setFontDtoDelList)) {
             throw ExceptionResultEnum.ERROR.exception("未找到字体");
         } else {