瀏覽代碼

学生自主预约不再支持跨教学点,仅显示自己所在教学点

deason 8 月之前
父節點
當前提交
0467d6f1c4
共有 1 個文件被更改,包括 27 次插入9 次删除
  1. 27 9
      src/main/java/com/qmth/exam/reserve/service/impl/CategoryServiceImpl.java

+ 27 - 9
src/main/java/com/qmth/exam/reserve/service/impl/CategoryServiceImpl.java

@@ -12,7 +12,6 @@ import com.qmth.boot.core.exception.StatusException;
 import com.qmth.boot.tools.excel.ExcelReader;
 import com.qmth.boot.tools.excel.enums.ExcelType;
 import com.qmth.boot.tools.excel.model.DataMap;
-import com.qmth.exam.reserve.bean.applytask.CurrentApplyTaskVO;
 import com.qmth.exam.reserve.bean.category.CategoryCacheBean;
 import com.qmth.exam.reserve.bean.category.CategoryInfo;
 import com.qmth.exam.reserve.bean.login.LoginUser;
@@ -37,8 +36,10 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
 
 import java.io.InputStream;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 @Service
 public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity> implements CategoryService {
@@ -90,6 +91,23 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
 
         List<CategoryInfo> list = new ArrayList<>();
 
+        // 需求变更:学生自主预约不再支持跨教学点,仅显示自己所在教学点和城市
+        CategoryCacheBean curCategory = categoryCacheService.getCategoryById(student.getCategoryId());
+        if (curCategory == null) {
+            return list;
+        }
+        CategoryInfo curInfo = new CategoryInfo();
+        curInfo.setId(curCategory.getId());
+        curInfo.setName(curCategory.getName());
+        curInfo.setLevel(curCategory.getLevel());
+        curInfo.setParentId(curCategory.getParentId());
+        curInfo.setSubNodes(new ArrayList<>());
+
+        // 获取父级分类
+        CategoryInfo parent = this.fillParentCategory(curInfo);
+        list.add(parent);
+
+        /*
         // 获取当前启用的预约任务
         CurrentApplyTaskVO curApplyTask = applyTaskCacheService.currentApplyTask(student.getOrgId());
         if (curApplyTask == null) {
@@ -111,9 +129,9 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
             curInfo.setParentId(curCategory.getParentId());
             curInfo.setSubNodes(new ArrayList<>());
 
-            // 根节点
-            CategoryInfo root = this.fillParentCategory(curInfo);
-            list.add(root);
+            // 获取父级分类
+            CategoryInfo parent = this.fillParentCategory(curInfo);
+            list.add(parent);
 
             return list;
         }
@@ -140,7 +158,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
             this.fillSubCategory(curInfo, categoryMaps);
 
             list.add(curInfo);
-        }
+        }*/
 
         return list;
     }
@@ -336,7 +354,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
                 msg.append(" 教学点名称不能超过50个字符");
             } else {
                 List<CategoryEntity> categoryEntities = listTeachingByName(name);
-                if(categoryEntities != null && !categoryEntities.isEmpty()) {
+                if (categoryEntities != null && !categoryEntities.isEmpty()) {
                     msg.append(" 教学点名称不能重复");
                 } else {
                     category.setName(name);
@@ -424,7 +442,7 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, CategoryEntity
             baseMapper.insert(category);
         }
     }
-    
+
 
     private Long getIdByName(String cityName, List<CategoryVO> cityList) {
         for (CategoryVO city : cityList) {