WANG 6 tahun lalu
induk
melakukan
e47aceea84

+ 78 - 0
examcloud-exchange-outer-api-provider/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/provider/CourseGroupOuterServiceProvider.java

@@ -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;
+	}
+
+}

+ 25 - 0
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/CourseGroupOuterService.java

@@ -0,0 +1,25 @@
+package cn.com.qmth.examcloud.exchange.outer.api;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.OuterService;
+import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetCourseListReq;
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetCourseListResp;
+
+/**
+ * 课程组服务
+ *
+ * @author WANGWEI
+ * @date 2019年1月7日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public interface CourseGroupOuterService extends OuterService {
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param req
+	 * @return
+	 */
+	OuterGetCourseListResp getCourseList(OuterGetCourseListReq req);
+
+}

+ 46 - 0
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/bean/CourseBean.java

@@ -0,0 +1,46 @@
+package cn.com.qmth.examcloud.exchange.outer.api.bean;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年9月4日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class CourseBean implements JsonSerializable {
+
+	private static final long serialVersionUID = 2064501395377152957L;
+
+	private String code;
+
+	private String name;
+
+	private String level;
+
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getLevel() {
+		return level;
+	}
+
+	public void setLevel(String level) {
+		this.level = level;
+	}
+
+}

+ 32 - 0
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/request/OuterGetCourseListReq.java

@@ -0,0 +1,32 @@
+package cn.com.qmth.examcloud.exchange.outer.api.request;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.BaseRequest;
+import io.swagger.annotations.ApiModelProperty;
+
+public class OuterGetCourseListReq extends BaseRequest {
+
+	private static final long serialVersionUID = -8374755306658040184L;
+
+	@ApiModelProperty(value = "顶级机构", example = "0", required = true)
+	private Long rootOrgId;
+
+	@ApiModelProperty(value = "课程组", example = "计算机本科", required = true)
+	private String courseGroupName;
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public String getCourseGroupName() {
+		return courseGroupName;
+	}
+
+	public void setCourseGroupName(String courseGroupName) {
+		this.courseGroupName = courseGroupName;
+	}
+
+}

+ 22 - 0
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/response/OuterGetCourseListResp.java

@@ -0,0 +1,22 @@
+package cn.com.qmth.examcloud.exchange.outer.api.response;
+
+import java.util.List;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.BaseResponse;
+import cn.com.qmth.examcloud.exchange.outer.api.bean.CourseBean;
+
+public class OuterGetCourseListResp extends BaseResponse {
+
+	private static final long serialVersionUID = 8290190579593586203L;
+
+	private List<CourseBean> courseList;
+
+	public List<CourseBean> getCourseList() {
+		return courseList;
+	}
+
+	public void setCourseList(List<CourseBean> courseList) {
+		this.courseList = courseList;
+	}
+
+}