WANG %!s(int64=6) %!d(string=hai) anos
pai
achega
bdb02870c4

+ 75 - 6
examcloud-exchange-outer-api-provider/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/provider/ExamOuterServiceProvider.java

@@ -1,5 +1,8 @@
 package cn.com.qmth.examcloud.exchange.outer.api.provider;
 
+import java.util.Date;
+
+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;
@@ -7,11 +10,20 @@ import org.springframework.web.bind.annotation.RestController;
 
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.commons.web.support.StatusResponse;
+import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
+import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
+import cn.com.qmth.examcloud.examwork.api.request.GetExamReq;
+import cn.com.qmth.examcloud.examwork.api.request.SaveExamReq;
+import cn.com.qmth.examcloud.examwork.api.response.GetExamResp;
+import cn.com.qmth.examcloud.examwork.api.response.SaveExamResp;
 import cn.com.qmth.examcloud.exchange.outer.api.ExamOuterService;
+import cn.com.qmth.examcloud.exchange.outer.api.request.OuterGetExamReq;
 import cn.com.qmth.examcloud.exchange.outer.api.request.OuterSaveExamReq;
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetExamResp;
 import cn.com.qmth.examcloud.exchange.outer.api.response.OuterSaveExamResp;
 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;
 
@@ -27,18 +39,75 @@ import io.swagger.annotations.ApiResponses;
 @RequestMapping("${$rmp.cloud.exchange.outer}/exam")
 public class ExamOuterServiceProvider extends ControllerSupport implements ExamOuterService {
 
-	/**
-	 * 属性注释
-	 */
 	private static final long serialVersionUID = 4007321110021402052L;
 
+	@Autowired
+	ExamCloudService examCloudService;
+
 	@ApiOperation(value = "保存考试信息", httpMethod = "POST")
 	@ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterSaveExamResp.class),
 			@ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
-	@PostMapping("saveExamStudent")
+	@PostMapping("saveExam")
+	@Override
+	public OuterSaveExamResp saveExam(
+			@RequestBody @ApiParam(required = true) OuterSaveExamReq req) {
+
+		Date beginTime = req.getBeginTime();
+		Integer duration = req.getDuration();
+		Date endTime = req.getEndTime();
+		String examType = req.getExamType();
+		String name = req.getName();
+		String remark = req.getRemark();
+		Long rootOrgId = req.getRootOrgId();
+
+		SaveExamReq saveExamReq = new SaveExamReq();
+		saveExamReq.setBeginTime(beginTime);
+		saveExamReq.setDuration(duration);
+		saveExamReq.setEndTime(endTime);
+		saveExamReq.setExamType(examType);
+		saveExamReq.setName(name);
+		saveExamReq.setRemark(remark);
+		saveExamReq.setRootOrgId(rootOrgId);
+
+		SaveExamResp r = examCloudService.saveExam(saveExamReq);
+
+		OuterSaveExamResp resp = new OuterSaveExamResp();
+		resp.setExamId(r.getExamId());
+		return resp;
+	}
+
+	@ApiOperation(value = "查询考试信息", httpMethod = "POST")
+	@ApiResponses({@ApiResponse(code = 200, message = "成功", response = OuterSaveExamResp.class),
+			@ApiResponse(code = 500, message = "系统异常(异常信息见响应体)", response = StatusResponse.class)})
+	@PostMapping("getExam")
 	@Override
-	public OuterSaveExamResp saveExam(@RequestBody OuterSaveExamReq req) {
-		return null;
+	public OuterGetExamResp getExam(@RequestBody @ApiParam(required = true) OuterGetExamReq req) {
+		Long id = req.getId();
+		String name = req.getName();
+		Long orgId = req.getOrgId();
+		Long rootOrgId = req.getRootOrgId();
+
+		GetExamReq getExamReq = new GetExamReq();
+		getExamReq.setId(id);
+		getExamReq.setName(name);
+		getExamReq.setOrgId(orgId);
+		getExamReq.setRootOrgId(rootOrgId);
+		GetExamResp r = examCloudService.getExam(getExamReq);
+		ExamBean e = r.getExamBean();
+
+		OuterGetExamResp resp = new OuterGetExamResp();
+		resp.setBeginTime(e.getBeginTime());
+		resp.setDuration(e.getDuration());
+		resp.setEnable(e.getEnable());
+		resp.setEndTime(e.getEndTime());
+		resp.setExamTimes(e.getExamTimes());
+		resp.setExamType(e.getExamType());
+		resp.setId(e.getId());
+		resp.setName(e.getName());
+		resp.setRemark(e.getRemark());
+		resp.setRootOrgId(e.getRootOrgId());
+
+		return resp;
 	}
 
 }

+ 11 - 0
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/ExamOuterService.java

@@ -1,7 +1,9 @@
 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.OuterGetExamReq;
 import cn.com.qmth.examcloud.exchange.outer.api.request.OuterSaveExamReq;
+import cn.com.qmth.examcloud.exchange.outer.api.response.OuterGetExamResp;
 import cn.com.qmth.examcloud.exchange.outer.api.response.OuterSaveExamResp;
 
 /**
@@ -22,4 +24,13 @@ public interface ExamOuterService extends OuterService {
 	 */
 	OuterSaveExamResp saveExam(OuterSaveExamReq req);
 
+	/**
+	 * 查询考试
+	 *
+	 * @author WANGWEI
+	 * @param req
+	 * @return
+	 */
+	OuterGetExamResp getExam(OuterGetExamReq req);
+
 }

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

@@ -0,0 +1,61 @@
+package cn.com.qmth.examcloud.exchange.outer.api.request;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.BaseRequest;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年11月16日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class OuterGetExamReq extends BaseRequest {
+
+	private static final long serialVersionUID = -2827676106721670081L;
+
+	@ApiModelProperty(value = "考试ID", example = "128", required = true)
+	private Long id;
+
+	@ApiModelProperty(value = "顶级机构", example = "0", required = true)
+	private Long rootOrgId;
+
+	@ApiModelProperty(value = "考试名称", example = "2018年6月期末考试", required = true)
+	private String name;
+
+	@ApiModelProperty(value = "机构ID(机构特殊配置不为空时覆盖考试信息)", example = "1111", required = false)
+	private Long orgId;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+}

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

@@ -0,0 +1,159 @@
+package cn.com.qmth.examcloud.exchange.outer.api.response;
+
+import java.util.Date;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.BaseResponse;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年11月16日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class OuterGetExamResp extends BaseResponse {
+
+	private static final long serialVersionUID = 1030154836013325322L;
+
+	/**
+	 * ID
+	 */
+	@ApiModelProperty(value = "考试ID", example = "128", required = true)
+	private Long id;
+
+	/**
+	 * 顶级机构Id
+	 */
+	@ApiModelProperty(value = "顶级机构", example = "0", required = true)
+	private Long rootOrgId;
+
+	/**
+	 * 考试批次开始时间
+	 */
+	@ApiModelProperty(value = " 考试批次开始时间", example = "2018-10-10 08:00:00", required = true)
+	private Date beginTime;
+
+	/**
+	 * 考试批次结束时间
+	 */
+	@ApiModelProperty(value = " 考试批次结束时间", example = "2018-10-10 08:00:00", required = true)
+	private Date endTime;
+
+	/**
+	 * 考试名称
+	 */
+	@ApiModelProperty(value = "考试名称", example = "2018年6月期末考试", required = true)
+	private String name;
+
+	/**
+	 * 考试类型
+	 */
+	@ApiModelProperty(value = " 考试类型(ONLINE:网考;TRADITION:传统;OFFLINE:离线;PRACTICE:练习;PRINT_EXAM:PRINT_EXAM.)", example = "ONLINE", required = true)
+	private String examType;
+
+	/**
+	 * 考试时长(分钟)
+	 */
+	@ApiModelProperty(value = "考试时长(单位:分钟)", example = "120", required = true)
+	private Integer duration;
+
+	/**
+	 * 是否可用
+	 */
+	@ApiModelProperty(value = "是否可用", example = "true", required = true)
+	private Boolean enable;
+
+	/**
+	 * 考试备注
+	 */
+	@ApiModelProperty(value = "考试备注", example = "xxx", required = true)
+	private String remark;
+
+	/**
+	 * 考试次数
+	 */
+	@ApiModelProperty(value = "考试次数", example = "2", required = true)
+	private Long examTimes;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public Date getBeginTime() {
+		return beginTime;
+	}
+
+	public void setBeginTime(Date beginTime) {
+		this.beginTime = beginTime;
+	}
+
+	public Date getEndTime() {
+		return endTime;
+	}
+
+	public void setEndTime(Date endTime) {
+		this.endTime = endTime;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public String getExamType() {
+		return examType;
+	}
+
+	public void setExamType(String examType) {
+		this.examType = examType;
+	}
+
+	public Integer getDuration() {
+		return duration;
+	}
+
+	public void setDuration(Integer duration) {
+		this.duration = duration;
+	}
+
+	public Boolean getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Boolean enable) {
+		this.enable = enable;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Long getExamTimes() {
+		return examTimes;
+	}
+
+	public void setExamTimes(Long examTimes) {
+		this.examTimes = examTimes;
+	}
+
+}

+ 6 - 96
examcloud-exchange-outer-api/src/main/java/cn/com/qmth/examcloud/exchange/outer/api/response/OuterSaveExamResp.java

@@ -1,7 +1,5 @@
 package cn.com.qmth.examcloud.exchange.outer.api.response;
 
-import java.util.Date;
-
 import cn.com.qmth.examcloud.commons.web.cloud.api.BaseResponse;
 import io.swagger.annotations.ApiModelProperty;
 
@@ -16,103 +14,15 @@ public class OuterSaveExamResp extends BaseResponse {
 
 	private static final long serialVersionUID = -8997559197584414927L;
 
-	@ApiModelProperty(value = "考试ID", example = "0", required = true)
-	private Long id;
-
-	@ApiModelProperty(value = "顶级机构", example = "0", required = true)
-	private Long rootOrgId;
-
-	@ApiModelProperty(value = " 考试批次开始时间", example = "2018-10-10 08:00:00", required = true)
-	private Date beginTime;
-
-	@ApiModelProperty(value = " 考试批次结束时间", example = "2018-10-10 08:00:00", required = true)
-	private Date endTime;
-
-	@ApiModelProperty(value = "考试名称", example = "2018年6月期末考试", required = true)
-	private String name;
-
-	@ApiModelProperty(value = " 考试类型(ONLINE:网考;TRADITION:传统;OFFLINE:离线;PRACTICE:练习;PRINT_EXAM:PRINT_EXAM.)", example = "ONLINE", required = true)
-	private String examType;
-
-	@ApiModelProperty(value = "考试时长(单位:分钟)", example = "120", required = true)
-	private Integer duration;
-
-	@ApiModelProperty(value = "考试备注", example = "xxx", required = true)
-	private String remark;
-
-	@ApiModelProperty(value = "考试次数", example = "2", required = true)
-	private Long examTimes;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public Date getBeginTime() {
-		return beginTime;
-	}
-
-	public void setBeginTime(Date beginTime) {
-		this.beginTime = beginTime;
-	}
-
-	public Date getEndTime() {
-		return endTime;
-	}
-
-	public void setEndTime(Date endTime) {
-		this.endTime = endTime;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getExamType() {
-		return examType;
-	}
-
-	public void setExamType(String examType) {
-		this.examType = examType;
-	}
-
-	public Integer getDuration() {
-		return duration;
-	}
-
-	public void setDuration(Integer duration) {
-		this.duration = duration;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
+	@ApiModelProperty(value = "考试ID", example = "128", required = true)
+	private Long examId;
 
-	public Long getExamTimes() {
-		return examTimes;
+	public Long getExamId() {
+		return examId;
 	}
 
-	public void setExamTimes(Long examTimes) {
-		this.examTimes = examTimes;
+	public void setExamId(Long examId) {
+		this.examId = examId;
 	}
 
 }