wangwei před 7 roky
rodič
revize
8ed9584287

+ 9 - 6
examcloud-core-basic-api-client/src/main/java/cn/com/qmth/examcloud/core/basic/api/client/StudentCloudServiceClient.java

@@ -6,16 +6,21 @@ import org.springframework.web.client.RestTemplate;
 
 import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
 import cn.com.qmth.examcloud.core.basic.api.request.InsertOrUpdateStudentReq;
+import cn.com.qmth.examcloud.core.basic.api.response.InsertOrUpdateStudentResp;
 
 @Service
-public class StudentCloudServiceClient extends BasicCloudClientSupport implements StudentCloudService{
+public class StudentCloudServiceClient extends BasicCloudClientSupport
+		implements
+			StudentCloudService {
+
+	private static final long serialVersionUID = 7669672850482842766L;
 
 	@Autowired
 	private RestTemplate restTemplate;
-	
+
 	@Override
-	public void insertOrUpdateStudent(InsertOrUpdateStudentReq studentReq) {
-		post("student", studentReq, InsertOrUpdateStudentReq.class);
+	public InsertOrUpdateStudentResp insertOrUpdateStudent(InsertOrUpdateStudentReq studentReq) {
+		return post("student/insertOrUpdateStudent", studentReq, InsertOrUpdateStudentResp.class);
 	}
 
 	@Override
@@ -23,6 +28,4 @@ public class StudentCloudServiceClient extends BasicCloudClientSupport implement
 		return restTemplate;
 	}
 
-	
-	
 }

+ 14 - 2
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/StudentCloudServiceProvider.java

@@ -9,9 +9,12 @@ import org.springframework.web.bind.annotation.RestController;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
 import cn.com.qmth.examcloud.core.basic.api.request.InsertOrUpdateStudentReq;
+import cn.com.qmth.examcloud.core.basic.api.response.InsertOrUpdateStudentResp;
 import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
 import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
 import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
+import cn.com.qmth.examcloud.core.basic.dao.entity.Student;
 import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
 import cn.com.qmth.examcloud.core.basic.service.impl.StudentServiceImpl;
 import io.swagger.annotations.ApiOperation;
@@ -37,7 +40,8 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
 	@ApiOperation(value = "插入或更新学生")
 	@PostMapping("insertOrUpdateStudent")
 	@Override
-	public void insertOrUpdateStudent(@RequestBody InsertOrUpdateStudentReq req) {
+	public InsertOrUpdateStudentResp insertOrUpdateStudent(
+			@RequestBody InsertOrUpdateStudentReq req) {
 
 		StudentInfo studentInfo = new StudentInfo();
 		studentInfo.setName(req.getName());
@@ -52,7 +56,15 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
 		studentInfo.setPhotoPath(req.getPhotoPath());
 		studentInfo.setRemark(req.getRemark());
 
-		studentService.insertOrUpdateStudent(studentInfo);
+		Student student = studentService.insertOrUpdateStudent(studentInfo);
+		InsertOrUpdateStudentResp resp = new InsertOrUpdateStudentResp();
+
+		resp.setRootOrgId(student.getRootOrgId());
+
+		Org org = orgRepo.findOne(student.getOrgId());
+		resp.setOrgId(org.getId());
+		resp.setOrgName(org.getName());
+		return resp;
 	}
 
 }

+ 2 - 1
examcloud-core-basic-api/src/main/java/cn/com/qmth/examcloud/core/basic/api/StudentCloudService.java

@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.core.basic.api;
 
 import cn.com.qmth.examcloud.commons.web.cloud.api.CloudService;
 import cn.com.qmth.examcloud.core.basic.api.request.InsertOrUpdateStudentReq;
+import cn.com.qmth.examcloud.core.basic.api.response.InsertOrUpdateStudentResp;
 
 /**
  * 学生接口服务
@@ -19,6 +20,6 @@ public interface StudentCloudService extends CloudService {
 	 * @author WANGWEI
 	 * @param req
 	 */
-	public void insertOrUpdateStudent(InsertOrUpdateStudentReq req);
+	public InsertOrUpdateStudentResp insertOrUpdateStudent(InsertOrUpdateStudentReq req);
 
 }

+ 59 - 0
examcloud-core-basic-api/src/main/java/cn/com/qmth/examcloud/core/basic/api/response/InsertOrUpdateStudentResp.java

@@ -0,0 +1,59 @@
+package cn.com.qmth.examcloud.core.basic.api.response;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.BaseResponse;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年6月29日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class InsertOrUpdateStudentResp extends BaseResponse {
+
+	/**
+	 * 属性注释
+	 */
+	private static final long serialVersionUID = 2263704597882102664L;
+
+	private Long studentId;
+
+	private Long rootOrgId;
+
+	private Long orgId;
+
+	private String orgName;
+
+	public Long getStudentId() {
+		return studentId;
+	}
+
+	public void setStudentId(Long studentId) {
+		this.studentId = studentId;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public String getOrgName() {
+		return orgName;
+	}
+
+	public void setOrgName(String orgName) {
+		this.orgName = orgName;
+	}
+
+}