chenken %!s(int64=7) %!d(string=hai) anos
pai
achega
40c84d2960

+ 16 - 0
examcloud-core-examwork-api-client/src/main/java/cn/com/qmth/examcloud/examwork/api/client/BasicCloudClientSupport.java

@@ -0,0 +1,16 @@
+package cn.com.qmth.examcloud.examwork.api.client;
+
+import cn.com.qmth.examcloud.common.support.CloudClientSupport;
+
+/**
+ * @author WANGWEI
+ *
+ */
+public abstract class BasicCloudClientSupport extends CloudClientSupport {
+
+	@Override
+	public String getUrlPrefix() {
+		return "http://ExamCloud-service-exam-work/api/core/examwork/";
+	}
+
+}

+ 35 - 0
examcloud-core-examwork-api-client/src/main/java/cn/com/qmth/examcloud/examwork/api/client/ExamCloudClient.java

@@ -0,0 +1,35 @@
+package cn.com.qmth.examcloud.examwork.api.client;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.client.RestTemplate;
+
+import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
+import cn.com.qmth.examcloud.examwork.api.request.ExamReq;
+
+/**
+ * @author  	chenken
+ * @date    	2018年5月3日 上午9:18:19
+ * @company 	QMTH
+ * @description ExamClient.java
+ */
+@Service
+public class ExamCloudClient extends BasicCloudClientSupport implements ExamCloudService{
+	
+	private static final long serialVersionUID = -2880611326177571371L;
+	
+	@Autowired
+	RestTemplate restTemplate;
+	
+	@Override
+	protected RestTemplate getRestTemplate() {
+		return restTemplate;
+	}
+	
+	@Override
+	public void saveExam(ExamReq exam) {
+		post("exam", exam, ExamReq.class);
+	}
+	
+}
+

+ 65 - 0
examcloud-core-examwork-api-provider/src/main/java/cn/com/qmth/examcloud/core/examwork/api/provider/ExamProvider.java

@@ -0,0 +1,65 @@
+package cn.com.qmth.examcloud.core.examwork.api.provider;
+
+import io.swagger.annotations.ApiOperation;
+
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.GetMapping;
+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 cn.com.qmth.examcloud.common.support.exception.StatusException;
+import cn.com.qmth.examcloud.common.uac.entity.AccessUser;
+import cn.com.qmth.examcloud.examwork.api.request.ExamReq;
+import cn.com.qmth.examcloud.service.examwork.entity.Exam;
+import cn.com.qmth.examcloud.service.examwork.enums.ExamType;
+import cn.com.qmth.examcloud.service.examwork.service.ExamService;
+
+/**
+ * @author  	chenken
+ * @date    	2018年5月3日 下午2:08:59
+ * @company 	QMTH
+ * @description ExamProvider.java
+ */
+@RestController
+@RequestMapping("${url.prefix}/exam")
+public class ExamProvider {
+	
+	@Autowired
+	private ExamService examService;
+	//@RequestBody ExamReq examReq
+	@ApiOperation(value = "新增考试批次", notes = "新增")
+	@GetMapping
+	public void addExam(){
+		if(true){
+			throw new StatusException("EXAMWORK-EXAMEXSTED", "考试名称已存在,请重新填写");	
+		}
+		/*Exam exam = new Exam();
+		exam.setName(examReq.getName());
+		exam.setRemark(examReq.getRemark());
+		exam.setDuration(examReq.getDuration());
+		exam.setExamType(ExamType.valueOf(examReq.getExamType()));
+		exam.setBeginTime(examReq.getBeginTime());
+		exam.setEndTime(examReq.getEndTime());
+		//exam.setOrgId(accessUser.getOrgId());
+		exam.setOrgId(109L);
+		//exam.setRootOrgId(accessUser.getRootOrgId());
+		exam.setCreateTime(new Date());
+		exam.setCanStuDel(true);
+		if (!examService.checkExamName(exam)) {
+			throw new StatusException("EXAMWORK-EXAMEXSTED", "考试名称已存在,请重新填写");
+		}
+		examService.insertExam(exam, null);*/
+	}
+	
+}
+

+ 7 - 1
examcloud-core-examwork-api/pom.xml

@@ -9,5 +9,11 @@
 	</parent>
 	<artifactId>examcloud-core-examwork-api</artifactId>
 	<packaging>jar</packaging>
-
+	<dependencies>
+		<dependency>
+			<groupId>cn.com.qmth.examcloud.commons</groupId>
+			<artifactId>examcloud-commons-support</artifactId>
+			<version>${examcloud.version}</version>
+		</dependency>
+	</dependencies>
 </project>

+ 21 - 0
examcloud-core-examwork-api/src/main/java/cn/com/qmth/examcloud/examwork/api/ExamCloudService.java

@@ -0,0 +1,21 @@
+package cn.com.qmth.examcloud.examwork.api;
+
+import cn.com.qmth.examcloud.common.support.CloudService;
+import cn.com.qmth.examcloud.examwork.api.request.ExamReq;
+
+/**
+ * @author  	chenken
+ * @date    	2018年5月3日 上午9:20:02
+ * @company 	QMTH
+ * @description ExamService.java
+ */
+public interface ExamCloudService extends CloudService {
+	
+	/**
+	 * 保存考试
+	 * @param exam
+	 */
+	public void saveExam(ExamReq exam);
+	
+}
+

+ 90 - 0
examcloud-core-examwork-api/src/main/java/cn/com/qmth/examcloud/examwork/api/request/ExamReq.java

@@ -0,0 +1,90 @@
+package cn.com.qmth.examcloud.examwork.api.request;
+
+import java.util.Date;
+
+import cn.com.qmth.examcloud.common.support.BaseRequest;
+
+/**
+ * @author  	chenken
+ * @date    	2018年5月2日 下午3:44:54
+ * @company 	QMTH
+ * @description ExamReq.java
+ */
+public class ExamReq extends BaseRequest {
+
+	private static final long serialVersionUID = -5832266903859887508L;
+	/**
+	 * 考试名称
+	 */
+	private String name;
+	/**
+	 * 考试类型
+	 */
+	private String examType;
+	/**
+	 * 考试开始时间
+	 */
+	private Date beginTime;
+	/**
+	 * 考试结束时间
+	 */
+	private Date endTime;
+	/**
+	 * 考试时长(分钟)
+	 */
+	private Integer duration;
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	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 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 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;
+	}
+	
+}
+

+ 1 - 0
examcloud-core-examwork-starter/src/main/resources/application.properties

@@ -22,6 +22,7 @@ ribbon.ConnectTimeout=800000
 app.api.root=/api/ecs_exam_work
 app.api.core=/api/ecs_core
 app.api.oe=/api/ecs_oe
+url.prefix=/api/core/examwork
 
 app.em.photo.path=/Users/ting.yin/Downloads
 app.em.facepp.key=e94d4a6a1ea8749144328be96a40e388