|
@@ -0,0 +1,78 @@
|
|
|
+package cn.com.qmth.examcloud.exchange.outer.api.provider;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.google.common.collect.Lists;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
+import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
+import cn.com.qmth.examcloud.commons.web.support.StatusResponse;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.CourseGroupOuterService;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.bean.CourseBean;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetCourseListReq;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetCourseListResp;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.service.CourseGroupService;
|
|
|
+import cn.com.qmth.examcloud.exchange.outer.service.bean.Course;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 课程组服务
|
|
|
+ *
|
|
|
+ * @author WANGWEI
|
|
|
+ * @date 2019年1月7日
|
|
|
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
+ */
|
|
|
+@Api(value = "课程组服务")
|
|
|
+@RestController
|
|
|
+@RequestMapping("${$rmp.cloud.exchange.outer}/courseGroup")
|
|
|
+public class CourseGroupOuterServiceProvider extends ControllerSupport
|
|
|
+ implements
|
|
|
+ CourseGroupOuterService {
|
|
|
+
|
|
|
+ private static final long serialVersionUID = -1645240245909412821L;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ CourseGroupService courseGroupService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "查询课程组课程集合", httpMethod = "POST")
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 200, message = "成功", response = OuterGetCourseListResp.class),
|
|
|
+ @ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
|
|
|
+ @PostMapping("getCourseList")
|
|
|
+ @Override
|
|
|
+ public OuterGetCourseListResp getCourseList(
|
|
|
+ @RequestBody @ApiParam(required = true) OuterGetCourseListReq req) {
|
|
|
+ Long rootOrgId = req.getRootOrgId();
|
|
|
+ String courseGroupName = req.getCourseGroupName();
|
|
|
+
|
|
|
+ if (!getSecurityRootOrgId().equals(req.getRootOrgId())) {
|
|
|
+ throw new StatusException("EX-1000001", "rootOrgId is wrong");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<Course> courseList = courseGroupService.getCourseList(rootOrgId, courseGroupName);
|
|
|
+
|
|
|
+ List<CourseBean> list = Lists.newArrayList();
|
|
|
+ for (Course cur : courseList) {
|
|
|
+ CourseBean bean = new CourseBean();
|
|
|
+ bean.setCode(cur.getCode());
|
|
|
+ bean.setLevel(cur.getLevel());
|
|
|
+ bean.setName(cur.getName());
|
|
|
+ list.add(bean);
|
|
|
+ }
|
|
|
+
|
|
|
+ OuterGetCourseListResp resp = new OuterGetCourseListResp();
|
|
|
+ resp.setCourseList(list);
|
|
|
+ return resp;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|