Ver código fonte

增加考生那个导入

ting.yin 8 anos atrás
pai
commit
5d3f1fdc8e
15 arquivos alterados com 562 adições e 101 exclusões
  1. 9 15
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamApi.java
  2. 20 11
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamStudentApi.java
  3. 3 2
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/ExamService.java
  4. 71 15
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/ExamStudentService.java
  5. 27 0
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/CourseService.java
  6. 27 0
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/OrgService.java
  7. 6 0
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/StudentService.java
  8. 19 0
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/client/CourseClient.java
  9. 19 0
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/client/OrgClient.java
  10. 6 1
      exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/client/StudentClient.java
  11. 5 0
      exam-work-domain/pom.xml
  12. 67 0
      exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/assembler/ExamStudentAssembler.java
  13. 236 0
      exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/dto/ExamStudentDTO.java
  14. 45 57
      exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/ExamStudent.java
  15. 2 0
      exam-work-main/src/main/resources/application.properties

+ 9 - 15
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamApi.java

@@ -37,22 +37,16 @@ public class ExamApi {
     @Autowired
     ExamService examService;
 
-//    @ApiOperation(value="查询所有考试批次",notes = "分页带查询")
-//    @GetMapping("/exam/all/{curPage}/{pageSize}")
-//    public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria, @PathVariable Integer curPage,@PathVariable Integer pageSize){
-//    	return new ResponseEntity(examService.getAllExam(examCriteria,new PageRequest(curPage - 1,pageSize)), HttpStatus.OK);
-//    }
-//
-//    @ApiOperation(value="查询所有考试批次",notes = "不分页带查询")
-//    @GetMapping("/exam/all")
-//    public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria){
-//        return new ResponseEntity(examService.getAllExam(examCriteria), HttpStatus.OK);
-//    }
+    @ApiOperation(value="查询所有考试批次",notes = "分页带查询")
+    @GetMapping("/exam/all/{curPage}/{pageSize}")
+    public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria, @PathVariable Integer curPage,@PathVariable Integer pageSize){
+    	return new ResponseEntity(examService.getAllExam(examCriteria,new PageRequest(curPage - 1,pageSize)), HttpStatus.OK);
+    }
 
-    @ApiOperation(value="查询所有考试批次(orgId)",notes = "不分页带查询")
-    @GetMapping("/exam")
-    public ResponseEntity getAllExam(@RequestParam Long orgId){
-        return new ResponseEntity(examRepo.findByOrgId(orgId), HttpStatus.OK);
+    @ApiOperation(value="查询所有考试批次",notes = "不分页带查询")
+    @GetMapping("/exam/all")
+    public ResponseEntity getAllExam(@ModelAttribute Exam examCriteria){
+        return new ResponseEntity(examService.getAllExam(examCriteria), HttpStatus.OK);
     }
 
     @ApiOperation(value="按ID查询考试批次",notes = "ID查询")

+ 20 - 11
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/api/ExamStudentApi.java

@@ -3,8 +3,11 @@ package cn.com.qmth.examcloud.service.examwork.api;
 import io.swagger.annotations.ApiOperation;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 
+import javax.servlet.http.HttpServletResponse;
+
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.http.HttpStatus;
@@ -23,9 +26,12 @@ import org.springframework.web.multipart.MultipartFile;
 
 import cn.com.qmth.examcloud.common.util.ErrorMsg;
 import cn.com.qmth.examcloud.common.util.excel.ExcelError;
+import cn.com.qmth.examcloud.service.examwork.assembler.ExamStudentAssembler;
 import cn.com.qmth.examcloud.service.examwork.dao.ExamStudentRepo;
+import cn.com.qmth.examcloud.service.examwork.dto.ExamStudentDTO;
 import cn.com.qmth.examcloud.service.examwork.entity.ExamStudent;
 import cn.com.qmth.examcloud.service.examwork.service.ExamStudentService;
+import cn.com.qmth.examcloud.service.examwork.util.ExportUtils;
 
 /**
  * 考生服务API
@@ -40,16 +46,19 @@ public class ExamStudentApi {
 
     @Autowired
     ExamStudentService examStudentService;
+    
+    @Autowired
+    ExamStudentAssembler examStudentAssembler;
 
     @ApiOperation(value="查询考试学生带条件和分页",notes = "带条件带分页")
     @GetMapping("/all/{curPage}/{pageSize}")
-    public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudent examCriteria, @PathVariable Integer curPage, @PathVariable Integer pageSize){
+    public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudentDTO examCriteria, @PathVariable Integer curPage, @PathVariable Integer pageSize){
         return new ResponseEntity(examStudentService.getAllExamStudent(examCriteria,new PageRequest(curPage - 1,pageSize)),HttpStatus.OK);
     }
 
     @ApiOperation(value="查询所有考试学生带条件",notes = "带条件不分页")
     @GetMapping("/exam_student/all")
-    public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudent examCriteria){
+    public ResponseEntity getAllExamStudent(@ModelAttribute ExamStudentDTO examCriteria){
         return new ResponseEntity(examStudentService.getAllExamStudent(examCriteria), HttpStatus.OK);
     }
 
@@ -114,13 +123,13 @@ public class ExamStudentApi {
 		}
     }
     
-//    @ApiOperation(value="导出考试学生带条件",notes = "导出")
-//    @GetMapping("/export")
-//    public void exportExamStudent(@ModelAttribute ExamStudent examCriteria,HttpServletResponse response){
-//    	List<CourseDTO> list = new ArrayList<CourseDTO>();
-//    	courseRepo.findByOrgId(orgId).forEach(c -> {
-//    		list.add(courseAssembler.toDTO(c));
-//        });
-//    	ExportUtils.exportEXCEL("课程列表", CourseDTO.class, list, response);
-//    }
+    @ApiOperation(value="导出考试学生带条件",notes = "导出")
+    @GetMapping("/export")
+    public void exportExamStudent(@ModelAttribute ExamStudentDTO examCriteria,HttpServletResponse response){
+    	List<ExamStudentDTO> list = new ArrayList<ExamStudentDTO>();
+    	examStudentService.getAllExamStudent(examCriteria).forEach(c -> {
+    		list.add(examStudentAssembler.toDTO(c));
+        });
+    	ExportUtils.exportEXCEL("课程列表", ExamStudentDTO.class, list, response);
+    }
 }

+ 3 - 2
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/ExamService.java

@@ -43,8 +43,9 @@ public class ExamService {
      * @return
      */
     public List<Exam> getAllExam(Exam examCriteria){
-//        ExampleMatcher exampleMatcher = ExampleMatcher.matching();
-        Example<Exam> examExample = Example.of(examCriteria);
+    	ExampleMatcher exampleMatcher = ExampleMatcher.matching()
+                .withMatcher("name",startsWith());
+        Example<Exam> examExample = Example.of(examCriteria,exampleMatcher);
         return examRepo.findAll(examExample);
     }
 

+ 71 - 15
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/ExamStudentService.java

@@ -1,7 +1,5 @@
 package cn.com.qmth.examcloud.service.examwork.service;
 
-import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.startsWith;
-
 import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
@@ -9,22 +7,29 @@ import java.util.List;
 import javax.persistence.criteria.Predicate;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Example;
-import org.springframework.data.domain.ExampleMatcher;
 import org.springframework.data.domain.Page;
 import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.util.StringUtils;
 
+import cn.com.qmth.examcloud.common.dto.core.Course;
+import cn.com.qmth.examcloud.common.dto.core.Org;
+import cn.com.qmth.examcloud.common.dto.core.Student;
+import cn.com.qmth.examcloud.common.dto.core.User;
 import cn.com.qmth.examcloud.common.util.ErrorMsg;
 import cn.com.qmth.examcloud.common.util.excel.ExcelError;
 import cn.com.qmth.examcloud.common.util.excel.ExcelReader;
 import cn.com.qmth.examcloud.common.util.excel.ExcelReaderHandle;
+import cn.com.qmth.examcloud.service.examwork.assembler.ExamStudentAssembler;
 import cn.com.qmth.examcloud.service.examwork.dao.ExamRepo;
 import cn.com.qmth.examcloud.service.examwork.dao.ExamStudentRepo;
+import cn.com.qmth.examcloud.service.examwork.dto.ExamStudentDTO;
 import cn.com.qmth.examcloud.service.examwork.entity.Exam;
 import cn.com.qmth.examcloud.service.examwork.entity.ExamStudent;
+import cn.com.qmth.examcloud.service.examwork.service.rpc.CourseService;
+import cn.com.qmth.examcloud.service.examwork.service.rpc.OrgService;
+import cn.com.qmth.examcloud.service.examwork.service.rpc.StudentService;
 
 /**
  * 考试学生服务类
@@ -36,6 +41,14 @@ public class ExamStudentService {
     ExamStudentRepo examStudentRepo;
     @Autowired
     ExamRepo examRepo;
+    @Autowired
+    ExamStudentAssembler examStudentAssembler;
+    @Autowired
+    StudentService studentService;
+    @Autowired
+    CourseService courseService;
+    @Autowired
+    OrgService orgService;
     
 //    @Value("${app.em.photo.path}")
 //    private String PHOTO_PATH ;
@@ -51,12 +64,12 @@ public class ExamStudentService {
      * @return 
      * @return
      */
-    public Page<ExamStudent> getAllExamStudent(ExamStudent examCriteria, Pageable pageable){
+    public Page<ExamStudent> getAllExamStudent(ExamStudentDTO examCriteria, Pageable pageable){
 //        ExampleMatcher exampleMatcher = ExampleMatcher.matching()
 //                .withMatcher("name",startsWith());
 //        Example<ExamStudent> examExamStudentple = Example.of(examCriteria, exampleMatcher);
 //        return examStudentRepo.findAll(examExamStudentple,pageable);
-    	Specification<ExamStudent> specification = getStudentSpecification(examCriteria);
+    	Specification<ExamStudent> specification = getSpecification(examCriteria);
         return examStudentRepo.findAll(specification,pageable);
     }
 
@@ -66,8 +79,8 @@ public class ExamStudentService {
      * @return 
      * @return
      */
-    public  List<ExamStudent> getAllExamStudent(ExamStudent examCriteria){
-    	Specification<ExamStudent> specification = getStudentSpecification(examCriteria);
+    public  List<ExamStudent> getAllExamStudent(ExamStudentDTO examCriteria){
+    	Specification<ExamStudent> specification = getSpecification(examCriteria);
         return examStudentRepo.findAll(specification);
     }
 
@@ -122,20 +135,34 @@ public class ExamStudentService {
      */
 	public List<ExcelError> importExamStudent(Long examId, InputStream inputStream) {
 		Exam exam = examRepo.findOne(examId);
+		if(exam == null){
+			new RuntimeException("请先创建考试");
+		}
 		List<ExamStudent> examStudents = new ArrayList<ExamStudent>();
-		ExcelReader excelReader = new ExcelReader(ExamStudent.class);
+		ExcelReader excelReader = new ExcelReader(ExamStudentDTO.class);
         List<ExcelError> excelErrors = excelReader.reader(inputStream, new ExcelReaderHandle() {
             @Override
             public ExcelError handle(Object obj) {
-                ExamStudent dto = (ExamStudent) obj;
+                ExamStudentDTO dto = (ExamStudentDTO) obj;
                 dto.setRootOrgId(exam.getOrgId());
                 dto.setExam(exam);
                 ExcelError error = importCheck(dto);
                 if (error == null) {
-                	examStudents.add(dto);
+                	examStudents.add(examStudentAssembler.toDomain(dto));
                 }
                 if (examStudents.size() % 1000 == 0) {
                     examStudentRepo.save(examStudents);
+                    for (ExamStudent examStudent : examStudents) {
+						Student student = new Student();
+						student.setIdentityNumber(examStudent.getIdentityNumber());
+						student.setName(examStudent.getName());
+						student.setStudentCode(examStudent.getStudentCode());
+						User user = new User();
+						user.setOrgId(examStudent.getOrgId());
+						user.setRootOrgId(examStudent.getRootOrgId());
+						student.setUser(user);
+						studentService.addStudent(student);
+					}
                     examStudents.removeAll(examStudents);
                 }
                 return error;
@@ -151,8 +178,30 @@ public class ExamStudentService {
 	 * @param stu
 	 * @return
 	 */
-	public ExcelError importCheck(ExamStudent dto){
-		
+	public ExcelError importCheck(ExamStudentDTO dto){
+		if(dto.getName()==null){
+			return new ExcelError("姓名不能为空");
+		}
+		if(dto.getStudentCode()==null||dto.getIdentityNumber()==null){
+			return new ExcelError("学号或身份证号不能为空");
+		}
+		if(dto.getCourseCode()==null){
+			return new ExcelError("课程代码不能为空");
+		}
+		if(dto.getOrgCode()==null){
+			return new ExcelError("学习中心代码不能为空");
+		}
+		Course course = courseService.findByOrgIdAndCode(dto.getRootOrgId(), dto.getCourseCode());
+		if(course == null || !course.getEnable()){
+			return new ExcelError("课程不存在/被禁用");
+		}
+		dto.setCourseLevel(course.getLevel().toString());
+		dto.setCourseName(course.getName());
+		Org org = orgService.findByParentIdAndCode(dto.getRootOrgId(), dto.getOrgCode());
+		if(org == null || !org.getEnable()){
+			return new ExcelError("学习中心不存在/禁用");
+		}
+		dto.setOrgId(org.getId());
 		return null;
 	}
 	
@@ -168,8 +217,13 @@ public class ExamStudentService {
 			ErrorMsg errorMsg = null;
 			if(!StringUtils.isEmpty(examStudent.getStudentCode())){
 				
+				errorMsg = new ErrorMsg(examStudent.getStudentCode());
 			}else if(!StringUtils.isEmpty(examStudent.getIdentityNumber())){
 				
+				errorMsg =  new ErrorMsg(examStudent.getIdentityNumber());
+			}
+			if(errorMsg != null){
+				msgs.add(errorMsg);
 			}
 		}
 		return msgs;
@@ -180,7 +234,7 @@ public class ExamStudentService {
 	 * @param examCriteria
 	 * @return
 	 */
-	private Specification<ExamStudent> getStudentSpecification(ExamStudent examCriteria) {
+	private Specification<ExamStudent> getSpecification(ExamStudentDTO examCriteria) {
 		Specification<ExamStudent> specification = (root, query, cb) -> {
 		    List<Predicate> predicates = new ArrayList<>();
 		    predicates.add(cb.equal(root.get("rootOrgId"),examCriteria.getRootOrgId()));
@@ -196,7 +250,9 @@ public class ExamStudentService {
 		    if(null!=examCriteria.getStudentCode()){
 		    	predicates.add(cb.like(root.get("studentCode"),examCriteria.getStudentCode()));
 		    }
-		    predicates.add(cb.equal(root.get("finished"),examCriteria.isFinished()));
+		    if(null!=examCriteria.getFinished()){
+		    	predicates.add(cb.equal(root.get("finished"),examCriteria.getFinished()));
+		    }
 		    return cb.and(predicates.toArray(new Predicate[predicates.size()]));
 		};
 		return specification;

+ 27 - 0
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/CourseService.java

@@ -0,0 +1,27 @@
+package cn.com.qmth.examcloud.service.examwork.service.rpc;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.examcloud.common.dto.core.Course;
+import cn.com.qmth.examcloud.common.util.GsonUtil;
+import cn.com.qmth.examcloud.service.examwork.service.rpc.client.CourseClient;
+
+/**
+ * 
+ * @author ting.yin
+ * @date 2017年1月14日
+ */
+@Service
+public class CourseService {
+
+	@Autowired
+	CourseClient courseClient;
+
+	public Course findByOrgIdAndCode(Long orgId,String code) {
+		String json = courseClient.findByOrgIdAndCode(orgId,code);
+		Course domain = GsonUtil.getInstanceByJson(json, Course.class);
+		return domain;
+	}
+
+}

+ 27 - 0
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/OrgService.java

@@ -0,0 +1,27 @@
+package cn.com.qmth.examcloud.service.examwork.service.rpc;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.examcloud.common.dto.core.Org;
+import cn.com.qmth.examcloud.common.util.GsonUtil;
+import cn.com.qmth.examcloud.service.examwork.service.rpc.client.OrgClient;
+
+/**
+ * 
+ * @author ting.yin
+ * @date 2017年1月14日
+ */
+@Service
+public class OrgService {
+
+	@Autowired
+	OrgClient orgClient;
+
+	public Org findByParentIdAndCode(Long orgId,String code) {
+		String json = orgClient.findByParentIdAndCode(orgId, code);
+		Org domain = GsonUtil.getInstanceByJson(json, Org.class);
+		return domain;
+	}
+
+}

+ 6 - 0
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/StudentService.java

@@ -23,5 +23,11 @@ public class StudentService {
 		Student domain = GsonUtil.getInstanceByJson(json, Student.class);
 		return domain;
 	}
+	
+	public Student addStudent(Student student) {
+		String json = studentClient.addStudent(student);
+		Student domain = GsonUtil.getInstanceByJson(json, Student.class);
+		return domain;
+	}
 
 }

+ 19 - 0
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/client/CourseClient.java

@@ -0,0 +1,19 @@
+package cn.com.qmth.examcloud.service.examwork.service.rpc.client;
+
+import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * @Description: TODO
+ * @author ting.yin
+ * @date 2017年1月14日
+ */
+@FeignClient(value = "ExamCloud-service-core")
+public interface CourseClient {
+
+	@RequestMapping(method = RequestMethod.GET, value = "${app.api.core}/course")
+	String findByOrgIdAndCode(@RequestParam("orgId") Long orgId,@RequestParam("code") String code);
+
+}

+ 19 - 0
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/client/OrgClient.java

@@ -0,0 +1,19 @@
+package cn.com.qmth.examcloud.service.examwork.service.rpc.client;
+
+import org.springframework.cloud.netflix.feign.FeignClient;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * @Description: TODO
+ * @author ting.yin
+ * @date 2017年1月14日
+ */
+@FeignClient(value = "ExamCloud-service-core")
+public interface OrgClient {
+
+	@RequestMapping(method = RequestMethod.GET, value = "${app.api.core}/org")
+	String findByParentIdAndCode(@RequestParam("parentId") Long parentId,@RequestParam("code") String code);
+
+}

+ 6 - 1
exam-work-api/src/main/java/cn/com/qmth/examcloud/service/examwork/service/rpc/client/StudentClient.java

@@ -5,6 +5,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import cn.com.qmth.examcloud.common.dto.core.Student;
+
 /**
  * @Description: TODO
  * @author ting.yin
@@ -13,7 +15,10 @@ import org.springframework.web.bind.annotation.RequestParam;
 @FeignClient(value = "ExamCloud-service-core")
 public interface StudentClient {
 
-	@RequestMapping(method = RequestMethod.GET, value = "${app.api.core}/student/")
+	@RequestMapping(method = RequestMethod.GET, value = "${app.api.core}/student")
 	String updatePhoto(@RequestParam("identityNumber") String identityNumber);
 
+	@RequestMapping(method = RequestMethod.POST, value = "${app.api.core}/student")
+	String addStudent(@RequestParam("student")Student student);
+
 }

+ 5 - 0
exam-work-domain/pom.xml

@@ -28,5 +28,10 @@
             <artifactId>hibernate-validator</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>cn.com.qmth.examcloud.common</groupId>
+            <artifactId>common-util</artifactId>
+            <version>${project.version}</version>
+        </dependency>
     </dependencies>
 </project>

+ 67 - 0
exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/assembler/ExamStudentAssembler.java

@@ -0,0 +1,67 @@
+package cn.com.qmth.examcloud.service.examwork.assembler;
+
+import org.springframework.stereotype.Component;
+
+import cn.com.qmth.examcloud.service.examwork.dto.ExamStudentDTO;
+import cn.com.qmth.examcloud.service.examwork.entity.ExamStudent;
+
+@Component
+public class ExamStudentAssembler {
+	
+	public ExamStudentDTO toDTO(ExamStudent examStudent){
+		ExamStudentDTO dto = null;
+		if(examStudent != null){
+			dto = new ExamStudentDTO();
+			dto.setCourseCode(examStudent.getCourseCode());
+			dto.setCourseLevel(examStudent.getCourseLevel());
+			dto.setCourseName(examStudent.getCourseName());
+			dto.setDegree(examStudent.getDegree());
+			dto.setExam(examStudent.getExam());
+			dto.setExamNumber(examStudent.getExamNumber());
+			dto.setFinished(examStudent.getFinished());
+			dto.setGrade(examStudent.getGrade());
+			dto.setGraduated(examStudent.getGraduated());
+			dto.setId(examStudent.getId());
+			dto.setIdentityNumber(examStudent.getIdentityNumber());
+			dto.setName(examStudent.getName());
+			dto.setOrgCode(examStudent.getOrgCode());
+			dto.setOrgId(examStudent.getOrgId());
+			dto.setRemark(examStudent.getRemark());
+			dto.setPaperType(examStudent.getPaperType());
+			dto.setRepair(examStudent.getRepair());
+			dto.setRootOrgId(examStudent.getRootOrgId());
+			dto.setSpecialtyName(examStudent.getSpecialtyName());
+			dto.setStudentCode(examStudent.getStudentCode());
+		}
+		return dto;
+	}
+	
+	public ExamStudent toDomain(ExamStudentDTO dto){
+		ExamStudent domain = null;
+		if(dto != null){
+			domain = new ExamStudent();
+			domain.setCourseCode(dto.getCourseCode());
+			domain.setCourseLevel(dto.getCourseLevel());
+			domain.setCourseName(dto.getCourseName());
+			domain.setDegree(dto.getDegree());
+			domain.setExam(dto.getExam());
+			domain.setExamNumber(dto.getExamNumber());
+			domain.setFinished(dto.getFinished());
+			domain.setGrade(dto.getGrade());
+			domain.setGraduated(dto.getGraduated());
+			domain.setId(dto.getId());
+			domain.setIdentityNumber(dto.getIdentityNumber());
+			domain.setName(dto.getName());
+			domain.setOrgCode(dto.getOrgCode());
+			domain.setOrgId(dto.getOrgId());
+			domain.setPaperType(dto.getPaperType());
+			domain.setRemark(dto.getRemark());
+			domain.setRepair(dto.getRepair());
+			domain.setRootOrgId(dto.getRootOrgId());
+			domain.setSpecialtyName(dto.getSpecialtyName());
+			domain.setStudentCode(dto.getStudentCode());
+		}
+		return domain;
+	}
+	
+}

+ 236 - 0
exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/dto/ExamStudentDTO.java

@@ -0,0 +1,236 @@
+package cn.com.qmth.examcloud.service.examwork.dto;
+
+import cn.com.qmth.examcloud.common.util.excel.ExcelProperty;
+import cn.com.qmth.examcloud.service.examwork.entity.Exam;
+
+public class ExamStudentDTO {
+
+	private long id;
+	
+	@ExcelProperty(index = 0,name = "姓名")
+	private String name;
+
+	private Exam exam;
+	/**
+	 * 学校id
+	 */
+    private Long rootOrgId;
+	/**
+	 * 学习中心id
+	 */
+    private Long orgId;
+	/**
+	 * 学习中心code
+	 */
+    @ExcelProperty(index = 3,name = "学习中心代码")
+    private String orgCode;
+
+    @ExcelProperty(index = 1,name = "学号")
+	private String studentCode;
+    @ExcelProperty(index = 2,name = "身份证号")
+	private String identityNumber;
+
+	private String examNumber;
+	@ExcelProperty(index = 4,name = "课程代码")
+	private String courseCode;
+
+	private String courseName;
+	
+	private String courseLevel;
+	
+	/**
+	 * 试卷类型
+	 */
+	@ExcelProperty(index = 5,name = "试卷类型")
+	private String paperType;
+	/**
+	 * 学位
+	 */
+	private Boolean degree;
+
+	private String specialtyName;
+	
+	/**
+	 * 是否重修
+	 */
+	private Boolean repair;
+	
+	/**
+	 * 年级
+	 */
+	private String grade;
+	/**
+	 * 是否毕业
+	 */
+	private Boolean graduated;
+
+	private String remark;
+	
+	/**
+	 * 是否缺考 
+	 */
+	private Boolean finished;
+
+	public long getId() {
+		return id;
+	}
+
+	public void setId(long id) {
+		this.id = id;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Exam getExam() {
+		return exam;
+	}
+
+	public void setExam(Exam exam) {
+		this.exam = exam;
+	}
+
+	public String getStudentCode() {
+		return studentCode;
+	}
+
+	public void setStudentCode(String studentCode) {
+		this.studentCode = studentCode;
+	}
+
+	public String getIdentityNumber() {
+		return identityNumber;
+	}
+
+	public void setIdentityNumber(String identityNumber) {
+		this.identityNumber = identityNumber;
+	}
+
+	public String getExamNumber() {
+		return examNumber;
+	}
+
+	public void setExamNumber(String examNumber) {
+		this.examNumber = examNumber;
+	}
+
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+	public String getCourseName() {
+		return courseName;
+	}
+
+	public void setCourseName(String courseName) {
+		this.courseName = courseName;
+	}
+
+	public String getSpecialtyName() {
+		return specialtyName;
+	}
+
+	public void setSpecialtyName(String specialtyName) {
+		this.specialtyName = specialtyName;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public String getGrade() {
+		return grade;
+	}
+
+	public void setGrade(String grade) {
+		this.grade = grade;
+	}
+
+	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 getOrgCode() {
+		return orgCode;
+	}
+
+	public void setOrgCode(String orgCode) {
+		this.orgCode = orgCode;
+	}
+
+	public String getPaperType() {
+		return paperType;
+	}
+
+	public void setPaperType(String paperType) {
+		this.paperType = paperType;
+	}
+
+	public String getCourseLevel() {
+		return courseLevel;
+	}
+
+	public void setCourseLevel(String courseLevel) {
+		this.courseLevel = courseLevel;
+	}
+
+	public Boolean getDegree() {
+		return degree;
+	}
+
+	public void setDegree(Boolean degree) {
+		this.degree = degree;
+	}
+
+	public Boolean getRepair() {
+		return repair;
+	}
+
+	public void setRepair(Boolean repair) {
+		this.repair = repair;
+	}
+
+	public Boolean getGraduated() {
+		return graduated;
+	}
+
+	public void setGraduated(Boolean graduated) {
+		this.graduated = graduated;
+	}
+
+	public Boolean getFinished() {
+		return finished;
+	}
+
+	public void setFinished(Boolean finished) {
+		this.finished = finished;
+	}
+
+	public ExamStudentDTO() {
+	}
+}

+ 45 - 57
exam-work-domain/src/main/java/cn/com/qmth/examcloud/service/examwork/entity/ExamStudent.java

@@ -36,10 +36,11 @@ public class ExamStudent implements Serializable {
 	/**
 	 * 学习中心code
 	 */
-    private Long orgCode;
+    private String orgCode;
 
 	private String studentCode;
 
+	@Column(unique=true)
 	private String identityNumber;
 
 	private String examNumber;
@@ -53,23 +54,18 @@ public class ExamStudent implements Serializable {
 	/**
 	 * 试卷类型
 	 */
-	private String examType;
+	private String paperType;
 	/**
 	 * 学位
 	 */
-	private boolean degree;
+	private Boolean degree;
 
 	private String specialtyName;
 	
-	/**
-	 * 专业类型
-	 */
-	private String specialtyType;
-	
 	/**
 	 * 是否重修
 	 */
-	private boolean repair;
+	private Boolean repair;
 	
 	/**
 	 * 年级
@@ -78,14 +74,14 @@ public class ExamStudent implements Serializable {
 	/**
 	 * 是否毕业
 	 */
-	private boolean graduated;
+	private Boolean graduated;
 
 	private String remark;
 	
 	/**
 	 * 是否缺考 
 	 */
-	private boolean finished;
+	private Boolean finished;
 
 	public static long getSerialVersionUID() {
 		return serialVersionUID;
@@ -155,14 +151,6 @@ public class ExamStudent implements Serializable {
 		this.courseName = courseName;
 	}
 
-	public boolean isDegree() {
-		return degree;
-	}
-
-	public void setDegree(boolean degree) {
-		this.degree = degree;
-	}
-
 	public String getSpecialtyName() {
 		return specialtyName;
 	}
@@ -179,30 +167,6 @@ public class ExamStudent implements Serializable {
 		this.remark = remark;
 	}
 
-	public boolean isFinished() {
-		return finished;
-	}
-
-	public void setFinished(boolean finished) {
-		this.finished = finished;
-	}
-
-	public String getSpecialtyType() {
-		return specialtyType;
-	}
-
-	public void setSpecialtyType(String specialtyType) {
-		this.specialtyType = specialtyType;
-	}
-
-	public boolean isRepair() {
-		return repair;
-	}
-
-	public void setRepair(boolean repair) {
-		this.repair = repair;
-	}
-
 	public String getGrade() {
 		return grade;
 	}
@@ -211,14 +175,6 @@ public class ExamStudent implements Serializable {
 		this.grade = grade;
 	}
 
-	public boolean isGraduated() {
-		return graduated;
-	}
-
-	public void setGraduated(boolean graduated) {
-		this.graduated = graduated;
-	}
-
 	public static long getSerialversionuid() {
 		return serialVersionUID;
 	}
@@ -239,20 +195,20 @@ public class ExamStudent implements Serializable {
 		this.orgId = orgId;
 	}
 
-	public Long getOrgCode() {
+	public String getOrgCode() {
 		return orgCode;
 	}
 
-	public void setOrgCode(Long orgCode) {
+	public void setOrgCode(String orgCode) {
 		this.orgCode = orgCode;
 	}
 
-	public String getExamType() {
-		return examType;
+	public String getPaperType() {
+		return paperType;
 	}
 
-	public void setExamType(String examType) {
-		this.examType = examType;
+	public void setPaperType(String paperType) {
+		this.paperType = paperType;
 	}
 
 	public String getCourseLevel() {
@@ -263,6 +219,38 @@ public class ExamStudent implements Serializable {
 		this.courseLevel = courseLevel;
 	}
 
+	public Boolean getDegree() {
+		return degree;
+	}
+
+	public void setDegree(Boolean degree) {
+		this.degree = degree;
+	}
+
+	public Boolean getRepair() {
+		return repair;
+	}
+
+	public void setRepair(Boolean repair) {
+		this.repair = repair;
+	}
+
+	public Boolean getGraduated() {
+		return graduated;
+	}
+
+	public void setGraduated(Boolean graduated) {
+		this.graduated = graduated;
+	}
+
+	public Boolean getFinished() {
+		return finished;
+	}
+
+	public void setFinished(Boolean finished) {
+		this.finished = finished;
+	}
+
 	public ExamStudent() {
 	}
 }

+ 2 - 0
exam-work-main/src/main/resources/application.properties

@@ -25,6 +25,8 @@ spring.http.multipart.max-file-size=10Mb
 spring.application.name=ExamCloud-service-exam-work
 server.port=8001
 eureka.client.serviceUrl.defaultZone=http://localhost:1111/eureka/
+hystrix.command.default.execution.timeout.enabled=false
+
 app.api.root=/api/ecs_exam_work
 app.api.core=/api/ecs_core
 #\u5b66\u751f\u7167\u7247\u4e0a\u4f20\u5730\u5740