haogh 7 månader sedan
förälder
incheckning
eedf457aa6

+ 4 - 3
src/main/java/com/qmth/exam/reserve/controller/admin/StudentApplyController.java

@@ -215,12 +215,13 @@ public class StudentApplyController extends BaseController {
 
     @ApiOperation(value = "导出考生预约的详情信息")
     @PostMapping(value = "/detail/export")
-    public String exportStudentApplyDetail(@ApiParam("教学点ID") @RequestParam(required = false) Long teachingId) {
+    public String exportStudentApplyDetail(@RequestBody StudentApplyReq req) {
         LoginUser user = curLoginUser();
+        // 教学点管理员
         if (Role.TEACHING.equals(user.getRole())) {
-            teachingId = user.getCategoryId();
+            req.setTeachingId(user.getCategoryId());
         }
-        studentApplyService.exportStudentApplyDetail(teachingId, user.getId());
+        studentApplyService.exportStudentApplyDetail(req, user.getId());
         return Constants.ASYNC_TIPS;
     }
 

+ 1 - 1
src/main/java/com/qmth/exam/reserve/dao/StudentApplyDao.java

@@ -41,5 +41,5 @@ public interface StudentApplyDao extends BaseMapper<StudentApplyEntity> {
 
     List<StudentExport> listStudentNoApply(@Param("teachingId") Long teachingId,@Param("taskId") Long taskId, String teachingName);
 
-    List<StudentApplyExport> listStudentApplyDetail(@Param("teachingId") Long teachingId, @Param("taskId") Long taskId);
+    List<StudentApplyExport> listStudentApplyDetail(@Param("req") StudentApplyReq req, @Param("taskId") Long taskId);
 }

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

@@ -32,13 +32,13 @@ public interface StudentApplyService extends IService<StudentApplyEntity> {
 
     List<String[]> listExamSiteAvailable(List<CategoryVO> examSiteList);
 
-    List<StudentApplyExport> listStudentApplyDetail(Long teachingId);
+    List<StudentApplyExport> listStudentApplyDetail(StudentApplyReq req);
 
     List<StudentExport> listStudentNoApply(Long teachingId);
 
     void exportNoApplyStudent(Long teachingId, Long id);
 
-    void exportStudentApplyDetail(Long teachingId, Long operateId);
+    void exportStudentApplyDetail(StudentApplyReq req, Long operateId);
 
     void saveOrUpdateStudentApply(StudentApplyEntity studentApplyEntity);
 }

+ 11 - 4
src/main/java/com/qmth/exam/reserve/service/impl/StudentApplyServiceImpl.java

@@ -206,6 +206,13 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
             throw new StatusException("[cancel] 只能取消本教学点的考生");
         }
 
+        // 考生是否已经取消判断
+        ApplyRecordCacheBean studentApplyRecord = cacheService.getStudentApplyRecord(studentApplyEntity.getStudentId(), studentApplyEntity.getExamSiteId(),
+                studentApplyEntity.getTimePeriodId());
+        if (studentApplyRecord != null && studentApplyRecord.getCancel()) {
+            throw new StatusException("[cancel] 考生已经取消,请稍后查看");
+        }
+
         String studentApplyLockKey = String.format(CacheConstants.LOCK_STUDENT_APPLY, studentApplyEntity.getStudentId());
         RLock studentApplyLock = (RLock) concurrentService.getLock(studentApplyLockKey);
         try {
@@ -1130,13 +1137,13 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
     }
 
     @Override
-    public List<StudentApplyExport> listStudentApplyDetail(Long teachingId) {
+    public List<StudentApplyExport> listStudentApplyDetail(StudentApplyReq req) {
         OrgInfo org = orgCacheService.currentOrg();
         CurrentApplyTaskVO curApplyTask = cacheService.currentApplyTask(org.getOrgId());
         if (curApplyTask == null) {
             return Collections.emptyList();
         }
-        return baseMapper.listStudentApplyDetail(teachingId, curApplyTask.getTaskId());
+        return baseMapper.listStudentApplyDetail(req, curApplyTask.getTaskId());
     }
 
     @Override
@@ -1159,12 +1166,12 @@ public class StudentApplyServiceImpl extends ServiceImpl<StudentApplyDao, Studen
     }
 
     @Override
-    public void exportStudentApplyDetail(Long teachingId, Long operateId) {
+    public void exportStudentApplyDetail(StudentApplyReq req, Long operateId) {
         //写入异步任务
         Map<String, Object> taskMap = asyncTaskService.saveAsyncTask(AsyncTaskType.STUDENT_APPLY_EXPORT,
                 operateId);
-        taskMap.computeIfAbsent("teachingId", v -> teachingId);
         taskMap.computeIfAbsent("operateId", v -> operateId);
+        taskMap.computeIfAbsent("condition", v -> req);
         try {
             studentApplyDetailExportService.exportTask(taskMap);
         } catch (Exception e) {

+ 6 - 4
src/main/java/com/qmth/exam/reserve/template/execute/StudentApplyDetailExportService.java

@@ -4,6 +4,7 @@ import com.alibaba.excel.EasyExcel;
 import com.qmth.boot.tools.uuid.FastUUID;
 import com.qmth.exam.reserve.bean.Constants;
 import com.qmth.exam.reserve.bean.stdapply.StudentApplyExport;
+import com.qmth.exam.reserve.bean.stdapply.StudentApplyReq;
 import com.qmth.exam.reserve.entity.AsyncTaskEntity;
 import com.qmth.exam.reserve.enums.AsyncTaskResult;
 import com.qmth.exam.reserve.enums.AsyncTaskStatus;
@@ -59,11 +60,12 @@ public class StudentApplyDetailExportService extends AsyncExportTaskTemplate {
         asyncTaskService.updateById(task);
 
         try {
-            Long teachingId = null;
-            if (map.get("teachingId") != null) {
-                teachingId = Long.parseLong(map.get("teachingId").toString());
+            StudentApplyReq req = new StudentApplyReq();
+            if(map.get("condition") != null) {
+                req = (StudentApplyReq) map.get("condition");
             }
-            List<StudentApplyExport> studentApplyDetailList = studentApplyService.listStudentApplyDetail(teachingId);
+
+            List<StudentApplyExport> studentApplyDetailList = studentApplyService.listStudentApplyDetail(req);
             String url = createExportFile(studentApplyDetailList);
 
             //设置导出的条数

+ 21 - 3
src/main/resources/mapper/StudentApplyMapper.xml

@@ -274,9 +274,27 @@
           AND tp.id = sa.time_period_id
           AND sa.cancel = 0
           AND s.apply_task_id = #{taskId}
-          <if test="teachingId != null">
-              AND s.category_id= #{teachingId}
-          </if>
+        <if test="req.teachingId != null">
+            AND s.category_id= #{teachingId}
+        </if>
+        <if test="req.agentId != null">
+            and sa.exam_site_id=#{req.agentId}
+        </if>
+        <if test="req.name != null and req.name !=''">
+            and s.name like concat('%',#{req.name},'%')
+        </if>
+        <if test="req.identityNumber != null and req.identityNumber !=''">
+            and s.identity_number like concat('%',#{req.identityNumber},'%')
+        </if>
+        <if test="req.studentCode != null and req.studentCode !=''">
+            and s.student_code like concat('%',#{req.studentCode},'%')
+        </if>
+        <if test="req.startDate != null and req.startDate !=''">
+            and tp.start_time&gt;=#{req.startDate}
+        </if>
+        <if test="req.endDate != null and req.endDate !=''">
+            and tp.start_time&lt;= #{req.endDate}
+        </if>
         ORDER BY
             tp.start_time
     </select>