派生自 projectDept/qhighschool

EricsHu
2023-11-25 79ab2cbd31c022916a8e696903d5eb34b70aa403
src/main/java/com/qxueyou/scc/courseware/action/CourceCategoryController.java
@@ -37,10 +37,10 @@
import com.qxueyou.scc.school.model.SchHandoutReCourse;
/**
 * 科目类别管理controller
 * 科目类别管理controller
 * 
 * @author 德虎
 * @history 2014-11-25 新建 夏德虎
 * @author 德虎
 * @history 2014-11-25 新建 夏德虎
 *
 */
@Controller
@@ -65,24 +65,24 @@
   ISysBusinessCacheService sysBusinessCacheService ;*/
   /**
    * APP2.0: 课程超市 选课 获取所有分类 <br>
    * APP2.0: 课程超市 选课 获取所有分类 <br>
    * URL /org/courcecategory/courseCatNew<br>
    * 
    * @method GET
    * @return 返回值JSON串:<br>
    * @return 返回值JSON串:<br>
    *
    *         <pre>
    * [{"index":1,"code":"1CKJR","categoryName":"财会金融","categoryId":"18","imgPath":"/web/res/img/app/coursemarket_ico_accounting.png"},
    * [{"index":1,"code":"1CKJR","categoryName":"财会金融","categoryId":"18","imgPath":"/web/res/img/app/coursemarket_ico_accounting.png"},
    * ......
    * {"index":8,"code":"9QB","categoryName":"全部","categoryId":"26","imgPath":"/web/res/img/app/coursemarket_ico_classify.png"}]
    * {"index":8,"code":"9QB","categoryName":"全部","categoryId":"26","imgPath":"/web/res/img/app/coursemarket_ico_classify.png"}]
    * </pre>
    *
    *         字段值说明:
    *         字段值说明:
    * 
    *         <pre>
    * index:索引
    * code:编码
    * categoryName:名字
    * index:索引
    * code:编码
    * categoryName:名字
    * categoryId:id
    * imgPath:logo URL
    * </pre>
@@ -94,7 +94,7 @@
      page.setPageNum(1);
      page.setPageSize(Integer.MAX_VALUE);
      // 1. 查询该机构下所有的科目
      // 1. 查询该机构下所有的科目
      String hql = "select c from OrgCourseCategory c where c.deleteFlag is false and c.categoryLevel = ? order by c.code asc ";
      List<OrgCourseCategory> lstLastCategory = commonDAO.findList(hql, page, CollectionUtils.newList(OrgCourseCategory.CATEGORY_LEVEL_FIRST), OrgCourseCategory.class);
@@ -144,29 +144,29 @@
   }
   /**
    * APP2.0: 课程超市 所有查询条件 <br>
    * APP2.0: 课程超市 所有查询条件 <br>
    * URL /org/courcecategory/courseCatContitionNew<br>
    * 
    * 返回值JSON串:<br>
    * 返回值JSON串:<br>
    *
    * <pre>
    * {
    * "course":[
    *       {"code":"0QB","children":[],"index":1,"categoryName":"全部","categoryId":"26","parentId":null},
    *       {"code":"1CKJR","children":[],"index":2,"categoryName":"财会金融","categoryId":"18","parentId":null},
    *       {"code":"2YYKS","children":[],"index":3,"categoryName":"语言考试","categoryId":"19","parentId":null},
    *       {"code":"3YYL","children":[],"index":4,"categoryName":"医药类","categoryId":"20","parentId":null},
    *       {"code":"4JGL","children":[],"index":5,"categoryName":"建工类","categoryId":"21","parentId":null},
    *       {"code":"5ZYKZ","children":null,"index":6,"categoryName":"职业考证","categoryId":"22","parentId":null},
    *       {"code":"0QB","children":[],"index":1,"categoryName":"全部","categoryId":"26","parentId":null},
    *       {"code":"1CKJR","children":[],"index":2,"categoryName":"财会金融","categoryId":"18","parentId":null},
    *       {"code":"2YYKS","children":[],"index":3,"categoryName":"语言考试","categoryId":"19","parentId":null},
    *       {"code":"3YYL","children":[],"index":4,"categoryName":"医药类","categoryId":"20","parentId":null},
    *       {"code":"4JGL","children":[],"index":5,"categoryName":"建工类","categoryId":"21","parentId":null},
    *       {"code":"5ZYKZ","children":null,"index":6,"categoryName":"职业考证","categoryId":"22","parentId":null},
    *       {"code":"6XLJY","children":[
    *             {"code":null,"index":1,"categoryName":"经济学","categoryId":"5","parentId":"23"},
    *          {"code":null,"index":2,"categoryName":"法学","categoryId":"6","parentId":"23"}
    *          ],"index":7,"categoryName":"学历教育","categoryId":"23","parentId":null},
    *       {"code":"7ITJN","children":[],"index":8,"categoryName":"IT技能","categoryId":"24","parentId":null},
    *       {"code":"8QT","children":[],"index":9,"categoryName":"其他","categoryId":"25","parentId":null}
    *             {"code":null,"index":1,"categoryName":"经济学","categoryId":"5","parentId":"23"},
    *          {"code":null,"index":2,"categoryName":"法学","categoryId":"6","parentId":"23"}
    *          ],"index":7,"categoryName":"学历教育","categoryId":"23","parentId":null},
    *       {"code":"7ITJN","children":[],"index":8,"categoryName":"IT技能","categoryId":"24","parentId":null},
    *       {"code":"8QT","children":[],"index":9,"categoryName":"其他","categoryId":"25","parentId":null}
    *    ],
    * "city":[{"name":"深圳","index":1,"code":"sz"},{"name":"广州","index":2,"code":"gz"}],
    * "sort":[{"name":"价格由低到高","index":1,"code":"PRICE_ASC"},{"name":"价格由高到低","index":2,"code":"PRICE_DESC"}]
    * "city":[{"name":"深圳","index":1,"code":"sz"},{"name":"广州","index":2,"code":"gz"}],
    * "sort":[{"name":"价格由低到高","index":1,"code":"PRICE_ASC"},{"name":"价格由高到低","index":2,"code":"PRICE_DESC"}]
    * }
    * 
    * <pre>
@@ -179,7 +179,7 @@
   }
   /**
    * APP2.0: 该机构下所有课程的分类和科目 URL: /org/courcecategory/courseCategoryNew
    * APP2.0: 该机构下所有课程的分类和科目 URL: /org/courcecategory/courseCategoryNew
    * 
    * @return
    */
@@ -187,27 +187,27 @@
   @RequestMapping(value = "courseCategoryNew", method = RequestMethod.GET)
   public @ResponseBody List<OrgCourseCategory> getCourseCategoryData() {
      // 1. 查询该机构下所有的科目
      // 1. 查询该机构下所有的科目
      String hql = "select courseId,name,price,imgPath,courseCategoryId " + " from OrgCourse c where c.deleteFlag is false";
      // 2. 查询该机构下所有的科目对应的类别
      // 2. 查询该机构下所有的科目对应的类别
      String hql_type = "select distinct c.category.categoryId,c.category.categoryName from OrgCourse c where " + " c.deleteFlag is false order by c.createTime ";
      List<Object> args = new ArrayList<Object>(1);
      // 如果是游客班 查所有机构 1:表示游客班
      // 如果是游客班 查所有机构 1:表示游客班
//      if (!orgClassService.isCurrentVistorClass()) {
//         hql = hql.concat(" and c.org.organizationId=?");
//         hql_type = "select distinct c.category.categoryId,c.category.categoryName from OrgCourse c where " + " c.org.organizationId=? and c.deleteFlag is false order by c.createTime ";
//         args = CollectionUtils.newList(ClientUtils.getOrgId());
//      }
      // 1. 查询该机构下所有的科目
      // 1. 查询该机构下所有的科目
      List<OrgCollegeCourse> lstCourse = categoryService.queryOrgCourseListNew(hql, args);
      // 2. 查询该机构下所有的科目对应的类别
      // 2. 查询该机构下所有的科目对应的类别
      List<OrgCourseCategory> lstCategory = categoryService.queryOrgCourseCategoryList(hql_type, args);
      // 组装结构
      // 组装结构
      List<OrgCollegeCourse> newLstCourse = null;
      for (OrgCourseCategory category : lstCategory) {
         newLstCourse = new ArrayList<OrgCollegeCourse>();
@@ -218,19 +218,19 @@
         }
         category.setCourseList(newLstCourse);
      }
      // 不限制值
      // 不限制值
      String not_limit = Constants.NOT_LIMIT_VALUE;
      // 重新组装类型 添加不限
      // 重新组装类型 添加不限
      List<OrgCourseCategory> lstLastCategory = new ArrayList<OrgCourseCategory>();
      // 添加第一个不限
      // 添加第一个不限
      OrgCourseCategory category = new OrgCourseCategory();
      category.setCategoryId(not_limit);
      category.setCategoryName("不限");
      category.setCategoryName("不限");
      List<OrgCollegeCourse> lstLastCourse = new ArrayList<OrgCollegeCourse>();
      OrgCollegeCourse course = new OrgCollegeCourse();
      course.setCourseId(not_limit);
      course.setName("不限");
      course.setName("不限");
      lstLastCategory.add(category);
      lstLastCategory.addAll(lstCategory);
@@ -238,7 +238,7 @@
      for (OrgCourseCategory cate : lstLastCategory) {
         lstLastCourse = new ArrayList<OrgCollegeCourse>();
         lstLastCourse.add(course);
         if (not_limit.equals(cate.getCategoryId())) {// 不限
         if (not_limit.equals(cate.getCategoryId())) {// 不限
            lstLastCourse.addAll(lstCourse);
         } else {
            lstLastCourse.addAll(cate.getCourseList());
@@ -250,10 +250,10 @@
      return lstLastCategory;
   }
   /******************************************************************* 上面为App接口,下面为后台接口 **************************/
   /******************************************************************* 上面为App接口,下面为后台接口 **************************/
   /**
    * 科目类别列表
    * 科目类别列表
    * 
    * @return
    */
@@ -265,7 +265,7 @@
   }
   /**
    * 根据科目ID查询科目
    * 根据科目ID查询科目
    * 
    * @return
    */
@@ -276,7 +276,7 @@
   }
   /**
    * 新增
    * 新增
    * 
    * @return
    */
@@ -287,7 +287,7 @@
   }
   /**
    * 删除
    * 删除
    * 
    * @return
    */
@@ -298,7 +298,7 @@
   }
   /**
    * 更新
    * 更新
    * 
    * @return
    */
@@ -309,7 +309,7 @@
   }
   /**
    * 新增类别层级
    * 新增类别层级
    * 
    * @return
    */
@@ -325,12 +325,12 @@
         return result;
      }
      
      return new Result(false,"参数错误");
      return new Result(false,"参数错误");
      
   }
   /**
    * 类别层级数据
    * 类别层级数据
    * 
    * @return
    */
@@ -355,7 +355,7 @@
         if(null == orgCollegeCourse){
            continue;
         }
         //去除掉不content内容
         //去除掉不content内容
         orgCollegeCourse.setContent("");
   
         if(null == map.get(orgCollegeCourse.getCourseCategoryId())){
@@ -374,7 +374,7 @@
   }
   
   /**
    * 视频类别层级数据
    * 视频类别层级数据
    * 
    * @return
    */
@@ -384,7 +384,7 @@
   }
   
   /**
    * 讲义类别层级数据
    * 讲义类别层级数据
    * 
    * @return
    */
@@ -394,7 +394,7 @@
   }
   
   /**
    * 练习类别层级数据
    * 练习类别层级数据
    * 
    * @return
    */
@@ -404,7 +404,7 @@
   }
   
   /**
    * 讲义类别层级数据
    * 讲义类别层级数据
    * 
    * @return
    */
@@ -414,8 +414,8 @@
   }
   
   /**
    * 查询视频讲义练习在各个科目下的数量
    * @param type 1:视频 2:讲义 3:练习
    * 查询视频讲义练习在各个科目下的数量
    * @param type 1:视频 2:讲义 3:练习
    * @return
    */
   @SuppressWarnings("unchecked")
@@ -470,7 +470,7 @@
   }
   /**
    * ztree层级数据
    * ztree层级数据
    * 
    * @return
    *//*
@@ -482,7 +482,7 @@
   }
   
   *//**
    * ztree层级数据
    * ztree层级数据
    * 
    * @return
    *//*
@@ -494,7 +494,7 @@
   }*/
   /**
    * 查询
    * 查询
    * 
    * @return
    */
@@ -506,7 +506,7 @@
   }
   
   /**
    * 查询专业信息
    * 查询专业信息
    * 
    * @return
    */
@@ -556,7 +556,7 @@
   }
   /**
    * 获取机构名字
    * 获取机构名字
    * 
    * @return
    */
@@ -568,7 +568,7 @@
   }
   /**
    * 删除科目
    * 删除科目
    * 
    * @return
    */
@@ -579,7 +579,7 @@
   }
   /**
    * 删除专业
    * 删除专业
    * 
    * @return
    */
@@ -590,7 +590,7 @@
   }
   /**
    * 3初始化科目
    * 3初始化科目
    * 
    * @return
    */
@@ -651,18 +651,18 @@
         
         i++;
      }
      return new Result(true,"总共有"+lstCourse.size()+",初始化了"+i+"条");
      return new Result(true,"总共有"+lstCourse.size()+",初始化了"+i+"条");
   }
   
   /**
    * 2先初始化课件数据,再初始化上面的科目
    * 2先初始化课件数据,再初始化上面的科目
    * 
    * @return
    */
   @RequestMapping(value = "/initCourseWare", method = RequestMethod.POST)
   public @ResponseBody Result initCourseWare() {
      
      //视频
      //视频
      int i = 0;
      String hql = " from MediaVideoReCourse where deleteFlag is false";
      List<MediaVideoReCourse> videos = commonDAO.find(hql, MediaVideoReCourse.class);
@@ -677,7 +677,7 @@
         commonService.save(course);
         i++;
      }
      //讲义
      //讲义
      int y = 0;
      hql = " from SchHandoutReCourse where deleteFlag is false";
      List<SchHandoutReCourse> handouts = commonDAO.find(hql, SchHandoutReCourse.class);
@@ -692,7 +692,7 @@
         commonService.save(course);
         y++;
      }
      //练习
      //练习
      int z = 0;
      hql = " from ExerciseReCourse where deleteFlag is false";
      List<ExerciseReCourse> exers = commonDAO.find(hql, ExerciseReCourse.class);
@@ -707,11 +707,11 @@
         commonService.save(course);
         z++;
      }
      return new Result(true,"视频总共"+videos.size()+"个,成功了"+i+"个"+"讲义总共"+handouts.size()+"个,成功了"+y+"个"+"练习总共"+exers.size()+"个,成功了"+z+"个");
      return new Result(true,"视频总共"+videos.size()+"个,成功了"+i+"个"+"讲义总共"+handouts.size()+"个,成功了"+y+"个"+"练习总共"+exers.size()+"个,成功了"+z+"个");
   }
   
   /**
    * 1初始化班级 机构ID
    * 1初始化班级 机构ID
    * 
    * @return
    */
@@ -736,11 +736,11 @@
         commonService.save(orgClass);
         i++;
      }
      return new Result(true,"班级总共"+ocs.size()+",成功了"+i+"个");
      return new Result(true,"班级总共"+ocs.size()+",成功了"+i+"个");
   }
   
   /**
    * 初始化levelCode
    * 初始化levelCode
    * 
    * @return
    */
@@ -834,8 +834,8 @@
   @SuppressWarnings("unused")
   private String generateLevelCode(String name) {
      // 转拼音
      //使用微软自带中文输入法用鼠标翻页,选择第一页之后的数据时,会生成(li'zhi.dr)这种账号
      // 转拼音
      //使用微软自带中文输入法用鼠标翻页,选择第一页之后的数据时,会生成(li'zhi.dr)这种账号
      String[] arrUnidecode = WordProcessUtils.toPinyin(name.replace(" ",""), " ").replaceAll("'", "").split(" ");
      
      String orgCode = "";