yangdamao 1 gadu atpakaļ
vecāks
revīzija
4c679dbb80

+ 6 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/exam/ExamApplyController.java

@@ -280,4 +280,10 @@ public class ExamApplyController extends BaseController {
         return AjaxResult.success(iExamApplyService.examUserProfileExport(bo));
     }
 
+    @ApiOperation("修改考场人数")
+    @PostMapping ("/update/applyNum")
+    public AjaxResult updateApplyNum(@RequestBody UpdateApplyNumBo bo) {
+        return toAjax(iExamApplyService.updateApplyNum(bo) ? 1 : 0);
+    }
+
 }

+ 17 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/bo/UpdateApplyNumBo.java

@@ -0,0 +1,17 @@
+package com.zhongzheng.modules.exam.bo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2024年04月11日 15:03
+ */
+@Data
+public class UpdateApplyNumBo implements Serializable {
+
+    private Long applyId;
+
+    private Integer num;
+}

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/IExamApplyService.java

@@ -113,4 +113,6 @@ public interface IExamApplyService extends IService<ExamApply> {
     String examApplyResultCertificate(List<MultipartFile> files);
 
 	List<UserProfile> getUserProfiles(String idCard, String businessName, String major);
+
+    boolean updateApplyNum(UpdateApplyNumBo bo);
 }

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -1150,6 +1150,27 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
        return baseMapper.getUserProfileList(idCard,businessName,major);
     }
 
+    @Override
+    public boolean updateApplyNum(UpdateApplyNumBo bo) {
+        ExamApply apply = getById(bo.getApplyId());
+        if (ObjectUtils.isNull(apply)){
+            throw new CustomException("考试信息获取有误!");
+        }
+        List<ExamApplySiteTime> siteTimeList = iExamApplySiteTimeService
+                .list(new LambdaQueryWrapper<ExamApplySiteTime>().eq(ExamApplySiteTime::getApplyId, bo.getApplyId()));
+        if (CollectionUtils.isNotEmpty(siteTimeList)){
+            siteTimeList.forEach(item -> {
+                List<ExamApplySiteTimeTwoAddBo> siteTimeTwoAddBos = JSONArray.parseArray(item.getSiteTime(), ExamApplySiteTimeTwoAddBo.class);
+                if (CollectionUtils.isNotEmpty(siteTimeTwoAddBos)){
+                    siteTimeTwoAddBos.forEach(x -> x.setNum(bo.getNum().longValue()));
+                    String s = JSONArray.toJSONString(siteTimeTwoAddBos);
+                    item.setSiteTime(s);
+                }
+            });
+        }
+        return iExamApplySiteTimeService.updateBatchById(siteTimeList);
+    }
+
     @Override
     public String examUserProfileExport(UserProfileQueryBo bo) {
         List<UserProfileVo> userProfileVos = iUserProfileService.queryList(bo);