haogh 1 year ago
parent
commit
04766573a0

+ 1 - 1
src/main/java/com/qmth/exam/reserve/bean/examsite/ExamSiteSaveReq.java

@@ -22,6 +22,6 @@ public class ExamSiteSaveReq implements IModel {
     private String address;
 
     @ApiModelProperty(value = "考点所属教学点ID",required = true)
-    private Long categoryId;
+    private Long teachingId;
 
 }

+ 3 - 0
src/main/java/com/qmth/exam/reserve/bean/examsite/ExamSiteVO.java

@@ -29,5 +29,8 @@ public class ExamSiteVO implements IModel {
 
     @ApiModelProperty("考点状态")
     private Boolean enable;
+
+    @ApiModelProperty("考点所属教学点ID")
+    private Long teachingId;
 }
 

+ 6 - 0
src/main/java/com/qmth/exam/reserve/bean/room/ExamRoomVO.java

@@ -32,4 +32,10 @@ public class ExamRoomVO implements IModel {
 
     @ApiModelProperty("考场状态")
     private Boolean enable;
+
+    @ApiModelProperty("所属考点ID")
+    private Long examSiteId;
+
+    @ApiModelProperty("所属教学点ID")
+    private Long teachingId;
 }

+ 22 - 0
src/main/java/com/qmth/exam/reserve/bean/stdapply/SiteApplyExportVO.java

@@ -0,0 +1,22 @@
+package com.qmth.exam.reserve.bean.stdapply;
+
+import com.qmth.boot.tools.excel.annotation.ExcelColumn;
+import com.qmth.exam.reserve.bean.IModel;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class SiteApplyExportVO implements IModel {
+
+    @ExcelColumn(name = "考试时段", index = 0)
+    private String timePeriod;
+
+    @ExcelColumn(name = "考场1", index = 0)
+    private String roomName1;
+
+    @ExcelColumn(name = "考场2", index = 0)
+    private String roomName2;
+
+    ;
+}

+ 3 - 0
src/main/java/com/qmth/exam/reserve/bean/teaching/TeachingVO.java

@@ -30,4 +30,7 @@ public class TeachingVO implements IModel {
     @ApiModelProperty("状态")
     private Boolean enable;
 
+    @ApiModelProperty("教学点所属城市")
+    private Long cityId;
+
 }

+ 11 - 14
src/main/java/com/qmth/exam/reserve/controller/admin/StudentApplyController.java

@@ -3,22 +3,16 @@ package com.qmth.exam.reserve.controller.admin;
 import java.io.File;
 import java.io.IOException;
 import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 import javax.servlet.http.HttpServletResponse;
 
 import com.qmth.boot.tools.excel.ExcelWriter;
 import com.qmth.boot.tools.excel.enums.ExcelType;
+import com.qmth.exam.reserve.bean.stdapply.*;
 import com.qmth.exam.reserve.bean.studentimport.StudentImportTaskExport;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -27,10 +21,6 @@ import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.boot.core.collection.PageResult;
 import com.qmth.boot.core.exception.StatusException;
 import com.qmth.exam.reserve.bean.login.LoginUser;
-import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
-import com.qmth.exam.reserve.bean.stdapply.SignInVO;
-import com.qmth.exam.reserve.bean.stdapply.StudentApplyReq;
-import com.qmth.exam.reserve.bean.stdapply.StudentApplyVO;
 import com.qmth.exam.reserve.controller.BaseController;
 import com.qmth.exam.reserve.enums.Role;
 import com.qmth.exam.reserve.service.ApplyTaskService;
@@ -173,13 +163,20 @@ public class StudentApplyController extends BaseController {
 
 
     @ApiOperation(value = "导出考场预约情况表")
-    @PostMapping(value = "/export/agent/available")
+    @GetMapping(value = "/export/site/available")
     public void exportApplyAvailable(@ApiParam("考点ID") @RequestParam Long examSiteId, HttpServletResponse response) {
         try {
             String fileName = URLEncoder.encode("考场预约情况表", "UTF-8");
             response.setHeader("Content-Disposition", "inline; filename=" + fileName + ".xlsx");
             response.setContentType("application/vnd.ms-excel");
             ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
+            List<SiteApplyExportVO> exportList = studentApplyService.exportPage(examSiteId);
+            String [] titles= {"测试1" ,"测试2", "测试3"};
+            List<String[]> list = new ArrayList<>();
+            list.add(titles);
+            list.add(titles);
+            list.add(titles);
+            writer.writeDataArrays("考场预约情况表", null, titles, list.iterator());
             writer.output(response.getOutputStream());
         } catch (IOException e) {
             e.printStackTrace();

+ 2 - 1
src/main/java/com/qmth/exam/reserve/service/StudentApplyService.java

@@ -8,11 +8,11 @@ import java.util.Map;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.boot.core.collection.PageResult;
 import com.qmth.exam.reserve.bean.login.LoginUser;
+import com.qmth.exam.reserve.bean.stdapply.SiteApplyExportVO;
 import com.qmth.exam.reserve.bean.stdapply.SignInVO;
 import com.qmth.exam.reserve.bean.stdapply.StudentApplyReq;
 import com.qmth.exam.reserve.bean.stdapply.StudentApplyVO;
 import com.qmth.exam.reserve.entity.StudentApplyEntity;
-import com.qmth.exam.reserve.entity.UserEntity;
 
 public interface StudentApplyService extends IService<StudentApplyEntity> {
 
@@ -32,4 +32,5 @@ public interface StudentApplyService extends IService<StudentApplyEntity> {
 
     List<SignInVO> listSignInDate(Long taskId);
 
+    List<SiteApplyExportVO> exportPage(Long examSiteId);
 }

+ 2 - 2
src/main/java/com/qmth/exam/reserve/service/impl/ExamSiteServiceImpl.java

@@ -247,12 +247,12 @@ public class ExamSiteServiceImpl extends ServiceImpl<ExamSiteDao, ExamSiteEntity
         if (StringUtils.isEmpty(req.getAddress())) {
             throw new StatusException("考点地址不能为空");
         }
-        if (req.getCategoryId() == null) {
+        if (req.getTeachingId() == null) {
             throw new StatusException("请选择考点所属教学点");
         }
         if (req.getId() == null) {
             LambdaQueryWrapper<ExamSiteEntity> wrapper = new LambdaQueryWrapper<>();
-            wrapper.eq(ExamSiteEntity::getCategoryId, req.getCategoryId());
+            wrapper.eq(ExamSiteEntity::getCategoryId, req.getTeachingId());
             wrapper.eq(ExamSiteEntity::getCode, req.getCode());
             ExamSiteEntity existSite = baseMapper.selectOne(wrapper);
             if (existSite != null) {

+ 6 - 9
src/main/java/com/qmth/exam/reserve/service/impl/StudentApplyServiceImpl.java

@@ -5,15 +5,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.time.LocalDate;
 import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
@@ -997,6 +989,11 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
         return signInList;
     }
 
+    @Override
+    public List<SiteApplyExportVO> exportPage(Long examSiteId) {
+        return Collections.emptyList();
+    }
+
     private boolean isInTimePeriod(Date date, List<TimePeriodEntity> timePeriodList) {
         for (TimePeriodEntity timePeriod : timePeriodList) {
             Date day = new Date(timePeriod.getStartTime());

+ 2 - 1
src/main/resources/mapper/CategoryMapper.xml

@@ -8,7 +8,8 @@
             c.NAME,
             c.capacity,
             c.ENABLE,
-            p.NAME cityName
+            p.NAME cityName,
+            p.ID cityId
         FROM
             t_category c,
             t_category p

+ 2 - 0
src/main/resources/mapper/ExamRoomMapper.xml

@@ -9,7 +9,9 @@
             r.address,
             r.capacity,
             s.NAME examSiteName,
+            s.ID examsiteid,
             g.NAME teachingName,
+            g.ID teachingId,
             r.ENABLE
         FROM
             t_exam_room r,

+ 1 - 0
src/main/resources/mapper/ExamSiteMapper.xml

@@ -26,6 +26,7 @@
             s.NAME,
             s.CODE,
             g.NAME teachingName,
+            g.id teachingId,
             s.address,
             s.capacity,
             s.enable