|
@@ -4,9 +4,11 @@ import cn.com.qmth.examcloud.api.commons.enums.CourseLevel;
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.GetCourseByOrgReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.GetCoursesByIdListReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.request.SaveCourseReq;
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.GetCourseByOrgResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetCourseResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetCoursesByIdListResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.SaveCourseResp;
|
|
@@ -20,6 +22,8 @@ import cn.com.qmth.examcloud.web.helpers.GlobalHelper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -158,4 +162,30 @@ public class CourseCloudServiceProvider implements CourseCloudService {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public GetCourseByOrgResp getCourseByOrg(GetCourseByOrgReq req) {
|
|
|
+ GetCourseByOrgResp resp = new GetCourseByOrgResp();
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
+ if (null == rootOrgId) {
|
|
|
+ throw new StatusException("rootOrgId is null");
|
|
|
+ }
|
|
|
+ List<CourseEntity> cc=courseRepo.findByRootOrgId(rootOrgId);
|
|
|
+ if(CollectionUtils.isNotEmpty(cc)) {
|
|
|
+ List<CourseBean> list = Lists.newArrayList();
|
|
|
+ for(CourseEntity c:cc) {
|
|
|
+ CourseBean courseBean = new CourseBean();
|
|
|
+ courseBean.setId(c.getId());
|
|
|
+ courseBean.setCode(c.getCode());
|
|
|
+ courseBean.setLevel(c.getLevel().name());
|
|
|
+ courseBean.setName(c.getName());
|
|
|
+ courseBean.setRootOrgId(c.getRootOrgId());
|
|
|
+ courseBean.setEnable(c.getEnable());
|
|
|
+
|
|
|
+ list.add(courseBean);
|
|
|
+ }
|
|
|
+ resp.setCourseList(list);
|
|
|
+ }
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
}
|