haogh 1 éve
szülő
commit
74e8a9f728

+ 0 - 5
src/main/java/com/qmth/exam/reserve/bean/teaching/TeachingSaveReq.java

@@ -21,9 +21,4 @@ public class TeachingSaveReq implements IModel {
     @ApiModelProperty(value="教学点所在城市", required = true)
     @ApiModelProperty(value="教学点所在城市", required = true)
     private Long cityId;
     private Long cityId;
 
 
-    @ApiModelProperty(value="教学点容量")
-    private Integer capacity;
-
-    @ApiModelProperty(value="教学点状态", required = true)
-    private Boolean enable;
 }
 }

+ 29 - 0
src/main/java/com/qmth/exam/reserve/bean/teaching/TeachingSingleVO.java

@@ -0,0 +1,29 @@
+package com.qmth.exam.reserve.bean.teaching;
+
+import com.qmth.exam.reserve.bean.IModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+@Getter
+@Setter
+public class TeachingSingleVO implements IModel {
+
+    @ApiModelProperty("ID")
+    private Long id;
+
+    @ApiModelProperty("教学点状态")
+    private Boolean enable;
+
+    @ApiModelProperty("教学点所属城市")
+    private Long cityId;
+
+    @ApiModelProperty("教学点代码")
+    private String code;
+
+    @ApiModelProperty("教学点名称")
+    private String name;
+
+    @ApiModelProperty("教学点所在层级")
+    private Integer level;
+}

+ 19 - 0
src/main/java/com/qmth/exam/reserve/controller/admin/StudentApplyController.java

@@ -2,6 +2,7 @@ package com.qmth.exam.reserve.controller.admin;
 
 
 import java.io.File;
 import java.io.File;
 import java.io.IOException;
 import java.io.IOException;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -9,6 +10,9 @@ import java.util.Map;
 
 
 import javax.servlet.http.HttpServletResponse;
 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.studentimport.StudentImportTaskExport;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -167,4 +171,19 @@ public class StudentApplyController extends BaseController {
         return studentApplyService.listSignInDate(taskId);
         return studentApplyService.listSignInDate(taskId);
     }
     }
 
 
+
+    @ApiOperation(value = "导出考场预约情况表")
+    @PostMapping(value = "/export/agent/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);
+            writer.output(response.getOutputStream());
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
 }
 }

+ 4 - 8
src/main/java/com/qmth/exam/reserve/controller/admin/TeachingController.java

@@ -5,11 +5,9 @@ import com.qmth.boot.core.exception.StatusException;
 import com.qmth.exam.reserve.bean.login.LoginUser;
 import com.qmth.exam.reserve.bean.login.LoginUser;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
-import com.qmth.exam.reserve.entity.CategoryEntity;
-import com.qmth.exam.reserve.entity.ExamSiteEntity;
+import com.qmth.exam.reserve.bean.teaching.TeachingSingleVO;
 import com.qmth.exam.reserve.enums.Role;
 import com.qmth.exam.reserve.enums.Role;
 import com.qmth.exam.reserve.util.ResourceUtil;
 import com.qmth.exam.reserve.util.ResourceUtil;
-import io.swagger.annotations.ApiModelProperty;
 import io.swagger.annotations.ApiParam;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -26,9 +24,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.multipart.MultipartFile;
 import org.springframework.web.multipart.MultipartFile;
 
 
-import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
@@ -57,8 +53,8 @@ public class TeachingController extends BaseController {
 
 
     @ApiOperation(value = "教学点查询")
     @ApiOperation(value = "教学点查询")
     @PostMapping(value = "/find")
     @PostMapping(value = "/find")
-    public CategoryEntity find(@ApiParam("教学点ID") @RequestParam Long id) {
-        return categoryService.getById(id);
+    public TeachingSingleVO find(@ApiParam("教学点ID") @RequestParam Long id) {
+        return categoryService.getTeaching(id);
     }
     }
 
 
 
 
@@ -78,7 +74,7 @@ public class TeachingController extends BaseController {
 
 
     @ApiOperation(value = "教学点模版下载")
     @ApiOperation(value = "教学点模版下载")
     @PostMapping(value = "/import/template")
     @PostMapping(value = "/import/template")
-    public void download(HttpServletResponse response) {
+    public void download() {
         exportFile("教学点模板.xlsx", ResourceUtil.getStream("templates/teachingImport.xlsx"));
         exportFile("教学点模板.xlsx", ResourceUtil.getStream("templates/teachingImport.xlsx"));
     }
     }
 
 

+ 3 - 0
src/main/java/com/qmth/exam/reserve/service/CategoryService.java

@@ -11,6 +11,7 @@ import com.qmth.exam.reserve.bean.login.LoginUser;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
+import com.qmth.exam.reserve.bean.teaching.TeachingSingleVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingVO;
 import com.qmth.exam.reserve.entity.CategoryEntity;
 import com.qmth.exam.reserve.entity.CategoryEntity;
 
 
@@ -31,4 +32,6 @@ public interface CategoryService extends IService<CategoryEntity> {
     List<Map<String, Object>> importTeaching(LoginUser user, InputStream inputStream);
     List<Map<String, Object>> importTeaching(LoginUser user, InputStream inputStream);
 
 
     void updateTeachingCapacity(Long teachingId);
     void updateTeachingCapacity(Long teachingId);
+
+    TeachingSingleVO getTeaching(Long id);
 }
 }

+ 22 - 6
src/main/java/com/qmth/exam/reserve/service/impl/CategoryServiceImpl.java

@@ -19,6 +19,7 @@ import com.qmth.exam.reserve.bean.stdapply.CategoryVO;
 import com.qmth.exam.reserve.bean.task.ApplyTaskVO;
 import com.qmth.exam.reserve.bean.task.ApplyTaskVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
 import com.qmth.exam.reserve.bean.teaching.TeachingSaveReq;
+import com.qmth.exam.reserve.bean.teaching.TeachingSingleVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingVO;
 import com.qmth.exam.reserve.bean.teaching.TeachingVO;
 import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.cache.impl.ApplyTaskCacheService;
 import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
 import com.qmth.exam.reserve.cache.impl.CategoryCacheService;
@@ -205,13 +206,14 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
     @Transactional
     @Transactional
     @Override
     @Override
     public void saveTeaching(LoginUser user, TeachingSaveReq req) {
     public void saveTeaching(LoginUser user, TeachingSaveReq req) {
-        checkTeaching(req);
+        checkTeaching(user.getOrgId(), req);
         CategoryEntity category = new CategoryEntity();
         CategoryEntity category = new CategoryEntity();
         BeanUtils.copyProperties(req, category);
         BeanUtils.copyProperties(req, category);
         category.setLevel(CategoryLevel.TEACHING.getValue());
         category.setLevel(CategoryLevel.TEACHING.getValue());
         category.setOrgId(user.getOrgId());
         category.setOrgId(user.getOrgId());
         category.setParentId(getById(req.getCityId()).getId());
         category.setParentId(getById(req.getCityId()).getId());
-        if(req.getId() == null) {
+        if (req.getId() == null) {
+            category.setEnable(Boolean.TRUE);
             save(category);
             save(category);
         } else {
         } else {
             updateById(category);
             updateById(category);
@@ -227,7 +229,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
         updateById(category);
         updateById(category);
     }
     }
 
 
-    private void checkTeaching(TeachingSaveReq req) {
+    private void checkTeaching(Long orgId, TeachingSaveReq req) {
         if (StringUtils.isBlank(req.getCode())) {
         if (StringUtils.isBlank(req.getCode())) {
             throw new StatusException("教学点代码不能为空");
             throw new StatusException("教学点代码不能为空");
         }
         }
@@ -240,8 +242,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
         if (req.getId() == null) {
         if (req.getId() == null) {
             LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
             LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
             wrapper.eq(CategoryEntity::getCode, req.getCode());
             wrapper.eq(CategoryEntity::getCode, req.getCode());
-            List<CategoryEntity> list = baseMapper.selectList(wrapper);
-            if (!list.isEmpty()) {
+            wrapper.eq(CategoryEntity::getOrgId, orgId);
+            CategoryEntity categoryEntity = baseMapper.selectOne(wrapper);
+            if (categoryEntity != null) {
                 throw new StatusException("教学点代码已经存在");
                 throw new StatusException("教学点代码已经存在");
             }
             }
         }
         }
@@ -331,7 +334,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
             }
             }
         }
         }
         if (CollectionUtils.isNotEmpty(failRecords)) {
         if (CollectionUtils.isNotEmpty(failRecords)) {
-             TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
             return failRecords;
             return failRecords;
         }
         }
         return failRecords;
         return failRecords;
@@ -342,6 +345,19 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
         baseMapper.updateTeachingCapacity(teachingId);
         baseMapper.updateTeachingCapacity(teachingId);
     }
     }
 
 
+    @Override
+    public TeachingSingleVO getTeaching(Long id) {
+        CategoryEntity category = getById(id);
+        TeachingSingleVO vo = new TeachingSingleVO();
+        vo.setId(category.getId());
+        vo.setCode(category.getCode());
+        vo.setName(category.getName());
+        vo.setCityId(category.getParentId());
+        vo.setEnable(category.getEnable());
+        vo.setLevel(category.getLevel());
+        return vo;
+    }
+
     private void saveTeaching(CategoryEntity category) {
     private void saveTeaching(CategoryEntity category) {
         LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<CategoryEntity> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(CategoryEntity::getCode, category.getCode());
         wrapper.eq(CategoryEntity::getCode, category.getCode());