wangwei 6 tahun lalu
induk
melakukan
7d94494bed
81 mengubah file dengan 6566 tambahan dan 6566 penghapusan
  1. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/AppController.java
  2. 3 3
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/Auth2Controller.java
  3. 179 179
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/AuthController.java
  4. 521 521
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/CourseController.java
  5. 3 3
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/CourseSpeciatlyRelationController.java
  6. 3 3
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/ExamSiteController.java
  7. 88 88
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/FaceController.java
  8. 5 5
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/LogController.java
  9. 9 9
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java
  10. 7 7
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/RolePrivilegeController.java
  11. 6 6
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/SpecialtyController.java
  12. 8 8
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/StudentController.java
  13. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/SysConfigController.java
  14. 51 51
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/TestController.java
  15. 5 5
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/UserController.java
  16. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/CourseDomain.java
  17. 115 115
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/ExamSiteDomain.java
  18. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/OrgDomain.java
  19. 273 273
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/PrivilegeDomain.java
  20. 107 107
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/PrivilegeGroupDomain.java
  21. 68 68
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/RoleDomain.java
  22. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/SpecialtyDomain.java
  23. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/StudentDomain.java
  24. 86 86
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/StudentFaceDomain.java
  25. 58 58
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/UpdateRolePrivilegeRelationsDomain.java
  26. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/UserDomain.java
  27. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/UserFormDomain.java
  28. 48 48
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/AuthCloudServiceProvider.java
  29. 66 66
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/CommonCloudServiceProvider.java
  30. 1 1
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/CourseCloudServiceProvider.java
  31. 152 152
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/FaceCloudServiceProvider.java
  32. 4 4
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/OrgCloudServiceProvider.java
  33. 132 132
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/RolePrivilegeCloudServiceProvider.java
  34. 3 3
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/StudentCloudServiceProvider.java
  35. 78 78
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/SysConfigCloudServiceProvider.java
  36. 290 290
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/UserCloudServiceProvider.java
  37. 67 67
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/AppEntity.java
  38. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/CourseEntity.java
  39. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/CourseSpeciatlyRelationEntity.java
  40. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/ExamSiteEntity.java
  41. 90 90
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/FacesetEntity.java
  42. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/OrgEntity.java
  43. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/OrgPropertyEntity.java
  44. 248 248
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/PrivilegeEntity.java
  45. 81 81
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/PrivilegeGroupEntity.java
  46. 84 84
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/RoleEntity.java
  47. 57 57
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/RolePrivilegeRelationEntity.java
  48. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/SpecialtyEntity.java
  49. 168 168
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/StudentEntity.java
  50. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/StudentFaceEntity.java
  51. 71 71
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/SysConfigEntity.java
  52. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/ThirdPartyAccessEntity.java
  53. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/UserEntity.java
  54. 57 57
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/UserPrivilegeRelationEntity.java
  55. 66 66
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/UserRoleRelationEntity.java
  56. 1 1
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/enums/CourseLevel.java
  57. 34 34
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/enums/OrgProperty.java
  58. 59 59
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/AuthService.java
  59. 1 1
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/CourseInfo.java
  60. 115 115
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/ExamSiteInfo.java
  61. 145 145
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/LoginInfo.java
  62. 1 1
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/OrgInfo.java
  63. 68 68
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/RoleInfo.java
  64. 1 1
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/SpecialtyInfo.java
  65. 86 86
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/StudentFaceInfo.java
  66. 198 198
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/StudentInfo.java
  67. 625 625
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/AuthServiceImpl.java
  68. 281 281
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/CourseServiceImpl.java
  69. 132 132
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/ExamSiteServiceImpl.java
  70. 154 154
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/FaceServiceImpl.java
  71. 45 45
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/ImgCodeServiceImpl.java
  72. 6 6
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/OrgServiceImpl.java
  73. 157 157
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/RolePrivilegeServiceImpl.java
  74. 65 65
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/SmsCodeServiceImpl.java
  75. 200 200
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/SpecialtyServiceImpl.java
  76. 341 341
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/StudentServiceImpl.java
  77. 124 124
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/SysConfigServiceImpl.java
  78. 56 56
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/UserServiceImpl.java
  79. 131 131
      examcloud-core-basic-starter/src/main/java/cn/com/qmth/examcloud/core/basic/starter/CoreBasicApp.java
  80. 39 39
      examcloud-core-basic-starter/src/main/java/cn/com/qmth/examcloud/core/basic/starter/config/AppSelfInspection.java
  81. 126 126
      examcloud-core-basic-starter/src/main/java/cn/com/qmth/examcloud/core/basic/starter/config/DefaultWebMvcConfigurerAdapter.java

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/AppController.java

@@ -9,9 +9,9 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.core.basic.dao.AppRepo;
 import cn.com.qmth.examcloud.core.basic.dao.entity.AppEntity;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 3 - 3
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/Auth2Controller.java

@@ -14,14 +14,14 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.google.common.collect.Maps;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.base.enums.AccountType;
 import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
 import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
 import cn.com.qmth.examcloud.core.basic.service.AuthService;
 import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 179 - 179
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/AuthController.java

@@ -1,180 +1,180 @@
-package cn.com.qmth.examcloud.core.basic.api.controller;
-
-import java.io.IOException;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.commons.web.support.ResponseStatus;
-import cn.com.qmth.examcloud.commons.web.support.StatusResponse;
-import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
-import cn.com.qmth.examcloud.core.basic.service.AuthService;
-import cn.com.qmth.examcloud.core.basic.service.ImgCodeService;
-import cn.com.qmth.examcloud.core.basic.service.SmsCodeService;
-import cn.com.qmth.examcloud.core.basic.service.StudentService;
-import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 鉴权
- *
- * @author WANGWEI
- * @date 2018年5月25日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.ctr.basic}/" + "auth")
-public class AuthController extends ControllerSupport {
-
-	@Autowired
-	AuthService authService;
-
-	@Autowired
-	RedisClient redisClient;
-
-	@Autowired
-	SmsCodeService smsCodeService;
-
-	@Autowired
-	StudentRepo studentRepo;
-
-	@Autowired
-	StudentService studentService;
-
-	@Autowired
-	ImgCodeService imgCodeService;
-
-	@ApiOperation(value = "登入", notes = "")
-	@PostMapping("login")
-	public Object login(@RequestBody LoginInfo loginInfo, HttpServletRequest request) {
-
-		Boolean alwaysOK = loginInfo.getAlwaysOK();
-		if (null != alwaysOK && alwaysOK) {
-			setAlwaysOKResponse();
-		}
-
-		trim(loginInfo, false);
-
-		String realIp = request.getHeader("x-forwarded-for");
-		if (StringUtils.isBlank(realIp)) {
-			realIp = request.getHeader("x-real-ip");
-		}
-		if (StringUtils.isNotBlank(realIp)) {
-			loginInfo.setClientIp(realIp);
-		} else {
-			loginInfo.setClientIp(null);
-		}
-
-		User user = authService.login(loginInfo);
-
-		if (null != alwaysOK && alwaysOK) {
-			return new StatusResponse(ResponseStatus.OK, user);
-		} else {
-			return user;
-		}
-	}
-
-	@ApiOperation(value = "登出", notes = "")
-	@PostMapping("logout")
-	public void logout() {
-		User user = getAccessUser();
-		authService.logout(user);
-	}
-
-	@ApiOperation(value = "获取登录用户", notes = "")
-	@PostMapping("getLoginUser")
-	public User getLoginUser(@RequestParam String key, @RequestParam String token) {
-
-		if (StringUtils.isBlank(key)) {
-			throw new StatusException("B-001009", "key is blank");
-		}
-		if (StringUtils.isBlank(token)) {
-			throw new StatusException("B-001010", "token is blank");
-		}
-
-		return authService.getLoginUser(key, token);
-	}
-
-	@ApiOperation(value = "第三方机构接入", notes = "")
-	@PostMapping("/thirdPartyAccess")
-	public User thirdPartyAccess(HttpServletRequest request, @RequestParam Long orgId,
-			@RequestParam String loginName, @RequestParam String appId,
-			@RequestParam String timestamp, @RequestParam String token) {
-		String realIp = request.getHeader("x-forwarded-for");
-		if (StringUtils.isBlank(realIp)) {
-			realIp = request.getHeader("x-real-ip");
-		}
-		return authService.thirdPartyAccess(orgId, loginName, appId, timestamp, token, realIp);
-	}
-
-	@ApiOperation(value = "发送验证码", notes = "")
-	@PostMapping("sendVerificationCode4Student")
-	public void sendVerificationCode4Student(@RequestParam(required = true) String phone,
-			@RequestParam(required = true) Boolean bound) {
-
-		Boolean hasBeBound = studentService.hasBeBound(phone);
-		if (bound && !hasBeBound.equals(bound)) {
-			throw new StatusException("B-002050", "手机号未被关联");
-		} else if ((!bound) && hasBeBound.equals(bound)) {
-			throw new StatusException("B-002050", "手机号已被关联");
-		}
-
-		smsCodeService.sendSmsCode(phone);
-	}
-
-	@ApiOperation(value = "发送验证码", notes = "")
-	@PostMapping("/sendVerificationCode")
-	public void sendVerificationCode(@RequestParam String phone) {
-		smsCodeService.sendSmsCode(phone);
-	}
-
-	@ApiOperation(value = "绑定手机号", notes = "")
-	@PostMapping("/bindSecurityPhone")
-	public void bindSecurityPhone(@RequestParam String phone,
-			@RequestParam String verificationCode) {
-
-		smsCodeService.checkSmsCode(phone, verificationCode);
-
-		User accessUser = getAccessUser();
-		Long studentId = accessUser.getUserId();
-
-		StudentEntity sb = studentRepo.findBySecurityPhone(phone);
-		if (null != sb) {
-			if (!sb.getId().equals(studentId)) {
-				throw new StatusException("B-001052", "手机号已被其他用户绑定,请更换手机号");
-			} else {
-				throw new StatusException("B-001053", "手机号已绑定成功,无需重复绑定");
-			}
-		}
-
-		StudentEntity s = studentRepo.findOne(studentId);
-		s.setSecurityPhone(phone);
-		studentRepo.saveAndFlush(s);
-	}
-
-	@ApiOperation(value = "获取验证码图片", notes = "")
-	@GetMapping("code.jpg")
-	public void getCodeImg(@RequestParam(required = true) String sessionId,
-			HttpServletRequest request, HttpServletResponse response) throws IOException {
-		response.setContentType("image/jpg");
-		String code = imgCodeService.generate(response.getOutputStream());
-		redisClient.set("$_IMG_" + sessionId, code, 30);
-	}
-
+package cn.com.qmth.examcloud.core.basic.api.controller;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
+import cn.com.qmth.examcloud.core.basic.service.AuthService;
+import cn.com.qmth.examcloud.core.basic.service.ImgCodeService;
+import cn.com.qmth.examcloud.core.basic.service.SmsCodeService;
+import cn.com.qmth.examcloud.core.basic.service.StudentService;
+import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
+import cn.com.qmth.examcloud.web.redis.RedisClient;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.web.support.ResponseStatus;
+import cn.com.qmth.examcloud.web.support.StatusResponse;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 鉴权
+ *
+ * @author WANGWEI
+ * @date 2018年5月25日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.ctr.basic}/" + "auth")
+public class AuthController extends ControllerSupport {
+
+	@Autowired
+	AuthService authService;
+
+	@Autowired
+	RedisClient redisClient;
+
+	@Autowired
+	SmsCodeService smsCodeService;
+
+	@Autowired
+	StudentRepo studentRepo;
+
+	@Autowired
+	StudentService studentService;
+
+	@Autowired
+	ImgCodeService imgCodeService;
+
+	@ApiOperation(value = "登入", notes = "")
+	@PostMapping("login")
+	public Object login(@RequestBody LoginInfo loginInfo, HttpServletRequest request) {
+
+		Boolean alwaysOK = loginInfo.getAlwaysOK();
+		if (null != alwaysOK && alwaysOK) {
+			setAlwaysOKResponse();
+		}
+
+		trim(loginInfo, false);
+
+		String realIp = request.getHeader("x-forwarded-for");
+		if (StringUtils.isBlank(realIp)) {
+			realIp = request.getHeader("x-real-ip");
+		}
+		if (StringUtils.isNotBlank(realIp)) {
+			loginInfo.setClientIp(realIp);
+		} else {
+			loginInfo.setClientIp(null);
+		}
+
+		User user = authService.login(loginInfo);
+
+		if (null != alwaysOK && alwaysOK) {
+			return new StatusResponse(ResponseStatus.OK, user);
+		} else {
+			return user;
+		}
+	}
+
+	@ApiOperation(value = "登出", notes = "")
+	@PostMapping("logout")
+	public void logout() {
+		User user = getAccessUser();
+		authService.logout(user);
+	}
+
+	@ApiOperation(value = "获取登录用户", notes = "")
+	@PostMapping("getLoginUser")
+	public User getLoginUser(@RequestParam String key, @RequestParam String token) {
+
+		if (StringUtils.isBlank(key)) {
+			throw new StatusException("B-001009", "key is blank");
+		}
+		if (StringUtils.isBlank(token)) {
+			throw new StatusException("B-001010", "token is blank");
+		}
+
+		return authService.getLoginUser(key, token);
+	}
+
+	@ApiOperation(value = "第三方机构接入", notes = "")
+	@PostMapping("/thirdPartyAccess")
+	public User thirdPartyAccess(HttpServletRequest request, @RequestParam Long orgId,
+			@RequestParam String loginName, @RequestParam String appId,
+			@RequestParam String timestamp, @RequestParam String token) {
+		String realIp = request.getHeader("x-forwarded-for");
+		if (StringUtils.isBlank(realIp)) {
+			realIp = request.getHeader("x-real-ip");
+		}
+		return authService.thirdPartyAccess(orgId, loginName, appId, timestamp, token, realIp);
+	}
+
+	@ApiOperation(value = "发送验证码", notes = "")
+	@PostMapping("sendVerificationCode4Student")
+	public void sendVerificationCode4Student(@RequestParam(required = true) String phone,
+			@RequestParam(required = true) Boolean bound) {
+
+		Boolean hasBeBound = studentService.hasBeBound(phone);
+		if (bound && !hasBeBound.equals(bound)) {
+			throw new StatusException("B-002050", "手机号未被关联");
+		} else if ((!bound) && hasBeBound.equals(bound)) {
+			throw new StatusException("B-002050", "手机号已被关联");
+		}
+
+		smsCodeService.sendSmsCode(phone);
+	}
+
+	@ApiOperation(value = "发送验证码", notes = "")
+	@PostMapping("/sendVerificationCode")
+	public void sendVerificationCode(@RequestParam String phone) {
+		smsCodeService.sendSmsCode(phone);
+	}
+
+	@ApiOperation(value = "绑定手机号", notes = "")
+	@PostMapping("/bindSecurityPhone")
+	public void bindSecurityPhone(@RequestParam String phone,
+			@RequestParam String verificationCode) {
+
+		smsCodeService.checkSmsCode(phone, verificationCode);
+
+		User accessUser = getAccessUser();
+		Long studentId = accessUser.getUserId();
+
+		StudentEntity sb = studentRepo.findBySecurityPhone(phone);
+		if (null != sb) {
+			if (!sb.getId().equals(studentId)) {
+				throw new StatusException("B-001052", "手机号已被其他用户绑定,请更换手机号");
+			} else {
+				throw new StatusException("B-001053", "手机号已绑定成功,无需重复绑定");
+			}
+		}
+
+		StudentEntity s = studentRepo.findOne(studentId);
+		s.setSecurityPhone(phone);
+		studentRepo.saveAndFlush(s);
+	}
+
+	@ApiOperation(value = "获取验证码图片", notes = "")
+	@GetMapping("code.jpg")
+	public void getCodeImg(@RequestParam(required = true) String sessionId,
+			HttpServletRequest request, HttpServletResponse response) throws IOException {
+		response.setContentType("image/jpg");
+		String code = imgCodeService.generate(response.getOutputStream());
+		redisClient.set("$_IMG_" + sessionId, code, 30);
+	}
+
 }

+ 521 - 521
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/CourseController.java

@@ -1,521 +1,521 @@
-package cn.com.qmth.examcloud.core.basic.api.controller;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.persistence.criteria.Subquery;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.fileupload.disk.DiskFileItem;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.domain.Sort.Direction;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.commons.CommonsMultipartFile;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.poi.ExcelWriter;
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.commons.web.config.SystemConfig;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
-import cn.com.qmth.examcloud.core.basic.api.controller.bean.CourseDomain;
-import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.CourseEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.CourseSpeciatlyRelationEntity;
-import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
-import cn.com.qmth.examcloud.core.basic.service.CourseService;
-import cn.com.qmth.examcloud.core.basic.service.bean.CourseInfo;
-import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
-import cn.com.qmth.examcloud.task.api.request.SyncCourseReq;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 课程服务API Created by songyue on 17/1/14.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.ctr.basic}/course")
-public class CourseController extends ControllerSupport {
-
-	@Autowired
-	CourseRepo courseRepo;
-
-	@Autowired
-	CourseService courseService;
-
-	@Autowired
-	CourseCloudService courseCloudService;
-
-	@Autowired
-	DataSyncCloudService dataSyncCloudService;
-
-	private static final String[] EXCEL_HEADER = new String[]{"课程名称", "课程代码", "层次(ZSB,GQZ,ALL)"};
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param curPage
-	 * @param pageSize
-	 * @param name
-	 * @param code
-	 * @param level
-	 * @param enable
-	 * @param specialtyId
-	 * @return
-	 */
-	@ApiOperation(value = "分页查询课程")
-	@GetMapping("coursePage/{curPage}/{pageSize}")
-	public Page<CourseEntity> getCoursePage(@PathVariable Integer curPage,
-			@PathVariable Integer pageSize, @RequestParam(required = false) String name,
-			@RequestParam(required = false) String code,
-			@RequestParam(required = false) String level,
-			@RequestParam(required = false) Boolean enable,
-			@RequestParam(required = false) Long specialtyId) {
-
-		User accessUser = getAccessUser();
-
-		Specification<CourseEntity> specification = (root, query, cb) -> {
-			List<Predicate> predicates = new ArrayList<>();
-
-			predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
-
-			if (StringUtils.isNotBlank(name)) {
-				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
-			}
-			if (StringUtils.isNotBlank(code)) {
-				predicates.add(cb.like(root.get("code"), toSqlSearchPattern(code)));
-			}
-			if (StringUtils.isNotBlank(level)) {
-				predicates.add(cb.equal(root.get("level"), CourseLevel.valueOf(level)));
-			}
-			if (null != enable) {
-				predicates.add(cb.equal(root.get("enable"), enable));
-			}
-
-			if (null != specialtyId) {
-				Subquery<CourseSpeciatlyRelationEntity> subquery = query
-						.subquery(CourseSpeciatlyRelationEntity.class);
-				Root<CourseSpeciatlyRelationEntity> subRoot = subquery
-						.from(CourseSpeciatlyRelationEntity.class);
-				subquery.select(subRoot.get("courseId"));
-				Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
-				Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
-				subquery.where(cb.and(p1, p2));
-				predicates.add(cb.exists(subquery));
-			}
-
-			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-
-		PageRequest pageRequest = new PageRequest(curPage, pageSize,
-				new Sort(Direction.DESC, "updateTime"));
-
-		Page<CourseEntity> page = courseRepo.findAll(specification, pageRequest);
-		return page;
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param name
-	 * @param level
-	 * @param enable
-	 * @param specialtyId
-	 * @return
-	 */
-	@ApiOperation(value = "查询课程")
-	@GetMapping("query")
-	public List<CourseEntity> query(@RequestParam(required = false) Long rootOrgId,
-			@RequestParam(required = false) String name,
-			@RequestParam(required = false) String level,
-			@RequestParam(required = false) Boolean enable,
-			@RequestParam(required = false) Long specialtyId) {
-
-		User accessUser = getAccessUser();
-		if (null == rootOrgId) {
-			rootOrgId = accessUser.getRootOrgId();
-		}
-
-		final Long finalRootOrgId = rootOrgId;
-
-		Specification<CourseEntity> specification = (root, query, cb) -> {
-			List<Predicate> predicates = new ArrayList<>();
-
-			predicates.add(cb.equal(root.get("rootOrgId"), finalRootOrgId));
-
-			Predicate pr1 = cb.like(root.get("name"), toSqlSearchPattern(name));
-			Predicate pr2 = cb.like(root.get("code"), toSqlSearchPattern(name));
-
-			predicates.add(cb.or(pr1, pr2));
-
-			if (StringUtils.isNotBlank(level)) {
-				predicates.add(cb.equal(root.get("level"), toSqlSearchPattern(level)));
-			}
-			if (null != enable) {
-				predicates.add(cb.equal(root.get("enable"), enable));
-			}
-
-			if (null != specialtyId) {
-				Subquery<CourseSpeciatlyRelationEntity> subquery = query
-						.subquery(CourseSpeciatlyRelationEntity.class);
-				Root<CourseSpeciatlyRelationEntity> subRoot = subquery
-						.from(CourseSpeciatlyRelationEntity.class);
-				subquery.select(subRoot.get("courseId"));
-				Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
-				Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
-				subquery.where(cb.and(p1, p2));
-				predicates.add(cb.exists(subquery));
-			}
-
-			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-
-		PageRequest pageRequest = new PageRequest(0, 50, new Sort(Direction.DESC, "updateTime"));
-
-		Page<CourseEntity> page = courseRepo.findAll(specification, pageRequest);
-
-		Iterator<CourseEntity> iterator = page.iterator();
-		List<CourseEntity> list = Lists.newArrayList();
-
-		while (iterator.hasNext()) {
-			CourseEntity next = iterator.next();
-
-			CourseEntity bean = new CourseEntity();
-			bean.setCode(next.getCode());
-			bean.setEnable(next.getEnable());
-			bean.setId(next.getId());
-			bean.setLevel(next.getLevel());
-			bean.setName(next.getName());
-			bean.setRootOrgId(next.getRootOrgId());
-
-			list.add(bean);
-		}
-
-		return list;
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param id
-	 * @return
-	 */
-	@ApiOperation(value = "按ID查询课程", notes = "ID查询")
-	@GetMapping("{id}")
-	public CourseEntity getCourseById(@PathVariable Long id) {
-		CourseEntity course = courseRepo.findOne(id);
-		if (null == course) {
-			throw new StatusException("B-540001", "课程不存在");
-		}
-
-		Long rootOrgId = course.getRootOrgId();
-		validateRootOrgIsolation(rootOrgId);
-		return course;
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param rootOrgId
-	 * @param code
-	 * @return
-	 */
-	@ApiOperation(value = "按code查询课程", notes = "code查询")
-	@GetMapping("byCode")
-	public CourseEntity getCourseByCode(@RequestParam Long rootOrgId, @RequestParam String code) {
-		validateRootOrgIsolation(rootOrgId);
-
-		CourseEntity course = courseRepo.findByRootOrgIdAndCode(rootOrgId, code);
-		if (null == course) {
-			throw new StatusException("B-540001", "课程不存在");
-		}
-
-		return course;
-	}
-
-	/**
-	 * 修正
-	 *
-	 * @author WANGWEI
-	 * @param domain
-	 * @return
-	 */
-	@ApiOperation(value = "新增课程", notes = "新增")
-	@PostMapping
-	public Long addCourse(@RequestBody CourseDomain domain) {
-		trim(domain, true);
-
-		User accessUser = getAccessUser();
-		Long rootOrgId = accessUser.getRootOrgId();
-
-		String code = domain.getCode();
-		String name = domain.getName();
-		if (StringUtils.isBlank(code)) {
-			throw new StatusException("B-620001", "课程编码不能为空");
-		}
-		if (StringUtils.isBlank(name)) {
-			throw new StatusException("B-620002", "课程名称不能为空");
-		}
-		if (name.length() > 50) {
-			throw new StatusException("B-620003", "课程名称不能超过50个字符");
-		}
-		CourseEntity course = courseRepo.findByRootOrgIdAndCode(rootOrgId, code);
-		if (null != course) {
-			throw new StatusException("B-620002", "课程编码已被占用");
-		}
-
-		CourseInfo info = new CourseInfo();
-		info.setRootOrgId(rootOrgId);
-		info.setCode(domain.getCode());
-		info.setEnable(domain.getEnable());
-		info.setId(domain.getId());
-		info.setLevel(domain.getLevel());
-		info.setName(domain.getName());
-
-		CourseEntity saved = courseService.saveCourse(info);
-		return saved.getId();
-	}
-
-	/**
-	 * 修正
-	 *
-	 * @author WANGWEI
-	 * @param domain
-	 * @return
-	 */
-	@ApiOperation(value = "更新课程", notes = "更新")
-	@PutMapping
-	public Long updateCourse(@RequestBody CourseDomain domain) {
-		trim(domain, true);
-
-		User accessUser = getAccessUser();
-		Long rootOrgId = accessUser.getRootOrgId();
-
-		String code = domain.getCode();
-		String name = domain.getName();
-		if (StringUtils.isBlank(code)) {
-			throw new StatusException("B-620001", "课程编码不能为空");
-		}
-		if (StringUtils.isBlank(name)) {
-			throw new StatusException("B-620002", "课程名称不能为空");
-		}
-		if (name.length() > 50) {
-			throw new StatusException("B-620003", "课程名称不能超过50个字符");
-		}
-
-		CourseInfo info = new CourseInfo();
-		info.setRootOrgId(rootOrgId);
-		info.setCode(domain.getCode());
-		info.setEnable(domain.getEnable());
-		info.setId(domain.getId());
-		info.setLevel(domain.getLevel());
-		info.setName(domain.getName());
-
-		CourseEntity saved = courseService.saveCourse(info);
-		return saved.getId();
-	}
-
-	@ApiOperation(value = "删除课程", notes = "删除")
-	@DeleteMapping("{ids}")
-	public void deleteCourse(@PathVariable String ids) {
-		List<Long> courseIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
-				.collect(Collectors.toList());
-		for (Long courseId : courseIds) {
-			CourseEntity one = courseRepo.findOne(courseId);
-			if (null == one) {
-				continue;
-			}
-			validateRootOrgIsolation(one.getRootOrgId());
-			courseRepo.delete(one);
-		}
-	}
-
-	@ApiOperation(value = "下载导入模板", notes = "下载导入模板")
-	@GetMapping("importTemplate")
-	public void getImportTemplate(HttpServletResponse response) {
-		String resoucePath = PathUtil.getResoucePath("templates/courseImportTemplate.xlsx");
-		exportFile("课程导入模板.xlsx", new File(resoucePath));
-	}
-
-	@ApiOperation(value = "导入课程", notes = "导入")
-	@PostMapping("import")
-	public Map<String, Object> importCourse(@RequestParam CommonsMultipartFile file) {
-		DiskFileItem item = (DiskFileItem) file.getFileItem();
-		File storeLocation = item.getStoreLocation();
-		List<Map<String, Object>> failRecords = courseService.importCourse(getRootOrgId(),
-				storeLocation);
-		Map<String, Object> map = Maps.newHashMap();
-		map.put("hasError", CollectionUtils.isNotEmpty(failRecords));
-		map.put("failRecords", failRecords);
-		return map;
-	}
-
-	@ApiOperation(value = "导出课程", notes = "导出")
-	@GetMapping("export")
-	public void export(@RequestParam(required = false) String name,
-			@RequestParam(required = false) String code,
-			@RequestParam(required = false) String level,
-			@RequestParam(required = false) Boolean enable,
-			@RequestParam(required = false) Long specialtyId) {
-
-		User accessUser = getAccessUser();
-
-		Specification<CourseEntity> specification = (root, query, cb) -> {
-			List<Predicate> predicates = new ArrayList<>();
-
-			predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
-
-			if (StringUtils.isNotBlank(name)) {
-				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
-			}
-			if (StringUtils.isNotBlank(code)) {
-				predicates.add(cb.like(root.get("code"), toSqlSearchPattern(code)));
-			}
-			if (StringUtils.isNotBlank(level)) {
-				predicates.add(cb.equal(root.get("level"), CourseLevel.valueOf(level)));
-			}
-			if (null != enable) {
-				predicates.add(cb.equal(root.get("enable"), enable));
-			}
-
-			if (null != specialtyId) {
-				Subquery<CourseSpeciatlyRelationEntity> subquery = query
-						.subquery(CourseSpeciatlyRelationEntity.class);
-				Root<CourseSpeciatlyRelationEntity> subRoot = subquery
-						.from(CourseSpeciatlyRelationEntity.class);
-				subquery.select(subRoot.get("courseId"));
-				Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
-				Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
-				subquery.where(cb.and(p1, p2));
-				predicates.add(cb.exists(subquery));
-			}
-
-			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-
-		long count = courseRepo.count(specification);
-		if (100000 < count) {
-			throw new StatusException("B-620200", "数据量过大,无法导出");
-		}
-
-		List<CourseEntity> list = courseRepo.findAll(specification);
-
-		List<Object[]> datas = Lists.newArrayList();
-
-		for (CourseEntity cur : list) {
-			datas.add(new Object[]{cur.getName(), cur.getCode(), cur.getLevel().getName()});
-		}
-
-		String filePath = SystemConfig.getTempDataDir() + File.separator
-				+ System.currentTimeMillis() + ".xlsx";
-		File file = new File(filePath);
-
-		ExcelWriter.write(EXCEL_HEADER, new Class[]{String.class, String.class, String.class},
-				datas, new File(filePath));
-
-		exportFile("课程列表-" + getRootOrgId() + ".xlsx", file);
-
-		FileUtils.deleteQuietly(file);
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param ids
-	 * @return
-	 */
-	@ApiOperation(value = "禁用课程", notes = "禁用")
-	@PutMapping("disable/{ids}")
-	public List<Long> disableCourse(@PathVariable String ids) {
-		List<Long> courseIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
-				.collect(Collectors.toList());
-
-		for (Long courseId : courseIds) {
-			CourseEntity course = courseRepo.findOne(courseId);
-			course.setEnable(false);
-			courseRepo.save(course);
-		}
-
-		for (Long courseId : courseIds) {
-			CourseEntity ce = courseRepo.findOne(courseId);
-			SyncCourseReq req = new SyncCourseReq();
-			req.setCode(ce.getCode());
-			req.setEnable(ce.getEnable());
-			req.setId(ce.getId());
-			req.setLevel(ce.getLevel().name());
-			req.setName(ce.getName());
-			req.setRootOrgId(ce.getRootOrgId());
-			req.setSyncType("update");
-			dataSyncCloudService.syncCourse(req);
-		}
-
-		return courseIds;
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param ids
-	 * @return
-	 */
-	@ApiOperation(value = "启用课程", notes = "启用")
-	@PutMapping("enable/{ids}")
-	public List<Long> enableCourse(@PathVariable String ids) {
-		List<Long> courseIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
-				.collect(Collectors.toList());
-
-		for (Long courseId : courseIds) {
-			CourseEntity course = courseRepo.findOne(courseId);
-			course.setEnable(true);
-			courseRepo.save(course);
-		}
-
-		for (Long courseId : courseIds) {
-			CourseEntity ce = courseRepo.findOne(courseId);
-			SyncCourseReq req = new SyncCourseReq();
-			req.setCode(ce.getCode());
-			req.setEnable(ce.getEnable());
-			req.setId(ce.getId());
-			req.setLevel(ce.getLevel().name());
-			req.setName(ce.getName());
-			req.setRootOrgId(ce.getRootOrgId());
-			req.setSyncType("update");
-			dataSyncCloudService.syncCourse(req);
-		}
-
-		return courseIds;
-	}
-}
+package cn.com.qmth.examcloud.core.basic.api.controller;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.persistence.criteria.Subquery;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.fileupload.disk.DiskFileItem;
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.domain.Sort.Direction;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.poi.ExcelWriter;
+import cn.com.qmth.examcloud.commons.util.PathUtil;
+import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
+import cn.com.qmth.examcloud.core.basic.api.controller.bean.CourseDomain;
+import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.CourseEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.CourseSpeciatlyRelationEntity;
+import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
+import cn.com.qmth.examcloud.core.basic.service.CourseService;
+import cn.com.qmth.examcloud.core.basic.service.bean.CourseInfo;
+import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
+import cn.com.qmth.examcloud.task.api.request.SyncCourseReq;
+import cn.com.qmth.examcloud.web.config.SystemConfig;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 课程服务API Created by songyue on 17/1/14.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.ctr.basic}/course")
+public class CourseController extends ControllerSupport {
+
+	@Autowired
+	CourseRepo courseRepo;
+
+	@Autowired
+	CourseService courseService;
+
+	@Autowired
+	CourseCloudService courseCloudService;
+
+	@Autowired
+	DataSyncCloudService dataSyncCloudService;
+
+	private static final String[] EXCEL_HEADER = new String[]{"课程名称", "课程代码", "层次(ZSB,GQZ,ALL)"};
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param curPage
+	 * @param pageSize
+	 * @param name
+	 * @param code
+	 * @param level
+	 * @param enable
+	 * @param specialtyId
+	 * @return
+	 */
+	@ApiOperation(value = "分页查询课程")
+	@GetMapping("coursePage/{curPage}/{pageSize}")
+	public Page<CourseEntity> getCoursePage(@PathVariable Integer curPage,
+			@PathVariable Integer pageSize, @RequestParam(required = false) String name,
+			@RequestParam(required = false) String code,
+			@RequestParam(required = false) String level,
+			@RequestParam(required = false) Boolean enable,
+			@RequestParam(required = false) Long specialtyId) {
+
+		User accessUser = getAccessUser();
+
+		Specification<CourseEntity> specification = (root, query, cb) -> {
+			List<Predicate> predicates = new ArrayList<>();
+
+			predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
+
+			if (StringUtils.isNotBlank(name)) {
+				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
+			}
+			if (StringUtils.isNotBlank(code)) {
+				predicates.add(cb.like(root.get("code"), toSqlSearchPattern(code)));
+			}
+			if (StringUtils.isNotBlank(level)) {
+				predicates.add(cb.equal(root.get("level"), CourseLevel.valueOf(level)));
+			}
+			if (null != enable) {
+				predicates.add(cb.equal(root.get("enable"), enable));
+			}
+
+			if (null != specialtyId) {
+				Subquery<CourseSpeciatlyRelationEntity> subquery = query
+						.subquery(CourseSpeciatlyRelationEntity.class);
+				Root<CourseSpeciatlyRelationEntity> subRoot = subquery
+						.from(CourseSpeciatlyRelationEntity.class);
+				subquery.select(subRoot.get("courseId"));
+				Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
+				Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
+				subquery.where(cb.and(p1, p2));
+				predicates.add(cb.exists(subquery));
+			}
+
+			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+		};
+
+		PageRequest pageRequest = new PageRequest(curPage, pageSize,
+				new Sort(Direction.DESC, "updateTime"));
+
+		Page<CourseEntity> page = courseRepo.findAll(specification, pageRequest);
+		return page;
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param name
+	 * @param level
+	 * @param enable
+	 * @param specialtyId
+	 * @return
+	 */
+	@ApiOperation(value = "查询课程")
+	@GetMapping("query")
+	public List<CourseEntity> query(@RequestParam(required = false) Long rootOrgId,
+			@RequestParam(required = false) String name,
+			@RequestParam(required = false) String level,
+			@RequestParam(required = false) Boolean enable,
+			@RequestParam(required = false) Long specialtyId) {
+
+		User accessUser = getAccessUser();
+		if (null == rootOrgId) {
+			rootOrgId = accessUser.getRootOrgId();
+		}
+
+		final Long finalRootOrgId = rootOrgId;
+
+		Specification<CourseEntity> specification = (root, query, cb) -> {
+			List<Predicate> predicates = new ArrayList<>();
+
+			predicates.add(cb.equal(root.get("rootOrgId"), finalRootOrgId));
+
+			Predicate pr1 = cb.like(root.get("name"), toSqlSearchPattern(name));
+			Predicate pr2 = cb.like(root.get("code"), toSqlSearchPattern(name));
+
+			predicates.add(cb.or(pr1, pr2));
+
+			if (StringUtils.isNotBlank(level)) {
+				predicates.add(cb.equal(root.get("level"), toSqlSearchPattern(level)));
+			}
+			if (null != enable) {
+				predicates.add(cb.equal(root.get("enable"), enable));
+			}
+
+			if (null != specialtyId) {
+				Subquery<CourseSpeciatlyRelationEntity> subquery = query
+						.subquery(CourseSpeciatlyRelationEntity.class);
+				Root<CourseSpeciatlyRelationEntity> subRoot = subquery
+						.from(CourseSpeciatlyRelationEntity.class);
+				subquery.select(subRoot.get("courseId"));
+				Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
+				Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
+				subquery.where(cb.and(p1, p2));
+				predicates.add(cb.exists(subquery));
+			}
+
+			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+		};
+
+		PageRequest pageRequest = new PageRequest(0, 50, new Sort(Direction.DESC, "updateTime"));
+
+		Page<CourseEntity> page = courseRepo.findAll(specification, pageRequest);
+
+		Iterator<CourseEntity> iterator = page.iterator();
+		List<CourseEntity> list = Lists.newArrayList();
+
+		while (iterator.hasNext()) {
+			CourseEntity next = iterator.next();
+
+			CourseEntity bean = new CourseEntity();
+			bean.setCode(next.getCode());
+			bean.setEnable(next.getEnable());
+			bean.setId(next.getId());
+			bean.setLevel(next.getLevel());
+			bean.setName(next.getName());
+			bean.setRootOrgId(next.getRootOrgId());
+
+			list.add(bean);
+		}
+
+		return list;
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param id
+	 * @return
+	 */
+	@ApiOperation(value = "按ID查询课程", notes = "ID查询")
+	@GetMapping("{id}")
+	public CourseEntity getCourseById(@PathVariable Long id) {
+		CourseEntity course = courseRepo.findOne(id);
+		if (null == course) {
+			throw new StatusException("B-540001", "课程不存在");
+		}
+
+		Long rootOrgId = course.getRootOrgId();
+		validateRootOrgIsolation(rootOrgId);
+		return course;
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param rootOrgId
+	 * @param code
+	 * @return
+	 */
+	@ApiOperation(value = "按code查询课程", notes = "code查询")
+	@GetMapping("byCode")
+	public CourseEntity getCourseByCode(@RequestParam Long rootOrgId, @RequestParam String code) {
+		validateRootOrgIsolation(rootOrgId);
+
+		CourseEntity course = courseRepo.findByRootOrgIdAndCode(rootOrgId, code);
+		if (null == course) {
+			throw new StatusException("B-540001", "课程不存在");
+		}
+
+		return course;
+	}
+
+	/**
+	 * 修正
+	 *
+	 * @author WANGWEI
+	 * @param domain
+	 * @return
+	 */
+	@ApiOperation(value = "新增课程", notes = "新增")
+	@PostMapping
+	public Long addCourse(@RequestBody CourseDomain domain) {
+		trim(domain, true);
+
+		User accessUser = getAccessUser();
+		Long rootOrgId = accessUser.getRootOrgId();
+
+		String code = domain.getCode();
+		String name = domain.getName();
+		if (StringUtils.isBlank(code)) {
+			throw new StatusException("B-620001", "课程编码不能为空");
+		}
+		if (StringUtils.isBlank(name)) {
+			throw new StatusException("B-620002", "课程名称不能为空");
+		}
+		if (name.length() > 50) {
+			throw new StatusException("B-620003", "课程名称不能超过50个字符");
+		}
+		CourseEntity course = courseRepo.findByRootOrgIdAndCode(rootOrgId, code);
+		if (null != course) {
+			throw new StatusException("B-620002", "课程编码已被占用");
+		}
+
+		CourseInfo info = new CourseInfo();
+		info.setRootOrgId(rootOrgId);
+		info.setCode(domain.getCode());
+		info.setEnable(domain.getEnable());
+		info.setId(domain.getId());
+		info.setLevel(domain.getLevel());
+		info.setName(domain.getName());
+
+		CourseEntity saved = courseService.saveCourse(info);
+		return saved.getId();
+	}
+
+	/**
+	 * 修正
+	 *
+	 * @author WANGWEI
+	 * @param domain
+	 * @return
+	 */
+	@ApiOperation(value = "更新课程", notes = "更新")
+	@PutMapping
+	public Long updateCourse(@RequestBody CourseDomain domain) {
+		trim(domain, true);
+
+		User accessUser = getAccessUser();
+		Long rootOrgId = accessUser.getRootOrgId();
+
+		String code = domain.getCode();
+		String name = domain.getName();
+		if (StringUtils.isBlank(code)) {
+			throw new StatusException("B-620001", "课程编码不能为空");
+		}
+		if (StringUtils.isBlank(name)) {
+			throw new StatusException("B-620002", "课程名称不能为空");
+		}
+		if (name.length() > 50) {
+			throw new StatusException("B-620003", "课程名称不能超过50个字符");
+		}
+
+		CourseInfo info = new CourseInfo();
+		info.setRootOrgId(rootOrgId);
+		info.setCode(domain.getCode());
+		info.setEnable(domain.getEnable());
+		info.setId(domain.getId());
+		info.setLevel(domain.getLevel());
+		info.setName(domain.getName());
+
+		CourseEntity saved = courseService.saveCourse(info);
+		return saved.getId();
+	}
+
+	@ApiOperation(value = "删除课程", notes = "删除")
+	@DeleteMapping("{ids}")
+	public void deleteCourse(@PathVariable String ids) {
+		List<Long> courseIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
+				.collect(Collectors.toList());
+		for (Long courseId : courseIds) {
+			CourseEntity one = courseRepo.findOne(courseId);
+			if (null == one) {
+				continue;
+			}
+			validateRootOrgIsolation(one.getRootOrgId());
+			courseRepo.delete(one);
+		}
+	}
+
+	@ApiOperation(value = "下载导入模板", notes = "下载导入模板")
+	@GetMapping("importTemplate")
+	public void getImportTemplate(HttpServletResponse response) {
+		String resoucePath = PathUtil.getResoucePath("templates/courseImportTemplate.xlsx");
+		exportFile("课程导入模板.xlsx", new File(resoucePath));
+	}
+
+	@ApiOperation(value = "导入课程", notes = "导入")
+	@PostMapping("import")
+	public Map<String, Object> importCourse(@RequestParam CommonsMultipartFile file) {
+		DiskFileItem item = (DiskFileItem) file.getFileItem();
+		File storeLocation = item.getStoreLocation();
+		List<Map<String, Object>> failRecords = courseService.importCourse(getRootOrgId(),
+				storeLocation);
+		Map<String, Object> map = Maps.newHashMap();
+		map.put("hasError", CollectionUtils.isNotEmpty(failRecords));
+		map.put("failRecords", failRecords);
+		return map;
+	}
+
+	@ApiOperation(value = "导出课程", notes = "导出")
+	@GetMapping("export")
+	public void export(@RequestParam(required = false) String name,
+			@RequestParam(required = false) String code,
+			@RequestParam(required = false) String level,
+			@RequestParam(required = false) Boolean enable,
+			@RequestParam(required = false) Long specialtyId) {
+
+		User accessUser = getAccessUser();
+
+		Specification<CourseEntity> specification = (root, query, cb) -> {
+			List<Predicate> predicates = new ArrayList<>();
+
+			predicates.add(cb.equal(root.get("rootOrgId"), accessUser.getRootOrgId()));
+
+			if (StringUtils.isNotBlank(name)) {
+				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
+			}
+			if (StringUtils.isNotBlank(code)) {
+				predicates.add(cb.like(root.get("code"), toSqlSearchPattern(code)));
+			}
+			if (StringUtils.isNotBlank(level)) {
+				predicates.add(cb.equal(root.get("level"), CourseLevel.valueOf(level)));
+			}
+			if (null != enable) {
+				predicates.add(cb.equal(root.get("enable"), enable));
+			}
+
+			if (null != specialtyId) {
+				Subquery<CourseSpeciatlyRelationEntity> subquery = query
+						.subquery(CourseSpeciatlyRelationEntity.class);
+				Root<CourseSpeciatlyRelationEntity> subRoot = subquery
+						.from(CourseSpeciatlyRelationEntity.class);
+				subquery.select(subRoot.get("courseId"));
+				Predicate p1 = cb.equal(subRoot.get("specialtyId"), specialtyId);
+				Predicate p2 = cb.equal(subRoot.get("courseId"), root.get("id"));
+				subquery.where(cb.and(p1, p2));
+				predicates.add(cb.exists(subquery));
+			}
+
+			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+		};
+
+		long count = courseRepo.count(specification);
+		if (100000 < count) {
+			throw new StatusException("B-620200", "数据量过大,无法导出");
+		}
+
+		List<CourseEntity> list = courseRepo.findAll(specification);
+
+		List<Object[]> datas = Lists.newArrayList();
+
+		for (CourseEntity cur : list) {
+			datas.add(new Object[]{cur.getName(), cur.getCode(), cur.getLevel().getName()});
+		}
+
+		String filePath = SystemConfig.getTempDataDir() + File.separator
+				+ System.currentTimeMillis() + ".xlsx";
+		File file = new File(filePath);
+
+		ExcelWriter.write(EXCEL_HEADER, new Class[]{String.class, String.class, String.class},
+				datas, new File(filePath));
+
+		exportFile("课程列表-" + getRootOrgId() + ".xlsx", file);
+
+		FileUtils.deleteQuietly(file);
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value = "禁用课程", notes = "禁用")
+	@PutMapping("disable/{ids}")
+	public List<Long> disableCourse(@PathVariable String ids) {
+		List<Long> courseIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
+				.collect(Collectors.toList());
+
+		for (Long courseId : courseIds) {
+			CourseEntity course = courseRepo.findOne(courseId);
+			course.setEnable(false);
+			courseRepo.save(course);
+		}
+
+		for (Long courseId : courseIds) {
+			CourseEntity ce = courseRepo.findOne(courseId);
+			SyncCourseReq req = new SyncCourseReq();
+			req.setCode(ce.getCode());
+			req.setEnable(ce.getEnable());
+			req.setId(ce.getId());
+			req.setLevel(ce.getLevel().name());
+			req.setName(ce.getName());
+			req.setRootOrgId(ce.getRootOrgId());
+			req.setSyncType("update");
+			dataSyncCloudService.syncCourse(req);
+		}
+
+		return courseIds;
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param ids
+	 * @return
+	 */
+	@ApiOperation(value = "启用课程", notes = "启用")
+	@PutMapping("enable/{ids}")
+	public List<Long> enableCourse(@PathVariable String ids) {
+		List<Long> courseIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
+				.collect(Collectors.toList());
+
+		for (Long courseId : courseIds) {
+			CourseEntity course = courseRepo.findOne(courseId);
+			course.setEnable(true);
+			courseRepo.save(course);
+		}
+
+		for (Long courseId : courseIds) {
+			CourseEntity ce = courseRepo.findOne(courseId);
+			SyncCourseReq req = new SyncCourseReq();
+			req.setCode(ce.getCode());
+			req.setEnable(ce.getEnable());
+			req.setId(ce.getId());
+			req.setLevel(ce.getLevel().name());
+			req.setName(ce.getName());
+			req.setRootOrgId(ce.getRootOrgId());
+			req.setSyncType("update");
+			dataSyncCloudService.syncCourse(req);
+		}
+
+		return courseIds;
+	}
+}

+ 3 - 3
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/CourseSpeciatlyRelationController.java

@@ -8,9 +8,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
 import cn.com.qmth.examcloud.core.basic.dao.CourseSpeciatlyRelationRepo;
 import cn.com.qmth.examcloud.core.basic.dao.SpecialtyRepo;
@@ -18,6 +16,8 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.CourseEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.CourseSpeciatlyRelationEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.CourseSpeciatlyRelationPK;
 import cn.com.qmth.examcloud.core.basic.dao.entity.SpecialtyEntity;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 3 - 3
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/ExamSiteController.java

@@ -25,14 +25,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.ExamSiteDomain;
 import cn.com.qmth.examcloud.core.basic.dao.ExamSiteRepo;
 import cn.com.qmth.examcloud.core.basic.dao.entity.ExamSiteEntity;
 import cn.com.qmth.examcloud.core.basic.service.bean.ExamSiteInfo;
 import cn.com.qmth.examcloud.core.basic.service.impl.ExamSiteServiceImpl;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 88 - 88
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/FaceController.java

@@ -1,88 +1,88 @@
-package cn.com.qmth.examcloud.core.basic.api.controller;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-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.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.basic.api.controller.bean.StudentFaceDomain;
-import cn.com.qmth.examcloud.core.basic.dao.StudentFaceRepo;
-import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.FacesetEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceEntity;
-import cn.com.qmth.examcloud.core.basic.service.FaceService;
-import cn.com.qmth.examcloud.core.basic.service.bean.StudentFaceInfo;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年9月4日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.ctr.basic}/face")
-public class FaceController extends ControllerSupport {
-
-	@Autowired
-	StudentFaceRepo studentFaceRepo;
-
-	@Autowired
-	StudentRepo studentRepo;
-
-	@Autowired
-	FaceService studentFaceService;
-
-	@ApiOperation(value = "保存学生人脸数据")
-	@PostMapping("saveStudentFace")
-	public StudentFaceEntity saveStudentFace(@RequestBody StudentFaceDomain req) {
-		StudentFaceInfo info = new StudentFaceInfo();
-		info.setFacesetToken(req.getFacesetToken());
-		info.setFaceToken(req.getFaceToken());
-		info.setOperator(req.getOperator());
-		info.setPhotoName(req.getPhotoName());
-		info.setRootOrgId(req.getRootOrgId());
-		info.setStudentId(req.getStudentId());
-		info.setFaceCount(req.getFaceCount());
-
-		StudentFaceEntity saved = studentFaceService.saveStudentFace(info);
-		return saved;
-	}
-
-	@ApiOperation(value = "获取可用的faceset集合")
-	@GetMapping("getUsableFacesetList")
-	public List<FacesetEntity> getUsableFacesetList() {
-
-		List<FacesetEntity> facesetList = studentFaceService.getUsableFacesetList();
-
-		return facesetList;
-	}
-
-	@ApiOperation(value = "获取可用的faceset集合")
-	@GetMapping("studentFace/{studentId}")
-	public StudentFaceEntity getStudentFace(@PathVariable Long studentId) {
-
-		if (null == studentId) {
-			throw new StatusException("B-710001", "studentId is null");
-		}
-
-		StudentFaceEntity studentFaceEntity = studentFaceRepo.findOne(studentId);
-
-		if (null == studentFaceEntity) {
-			throw new StatusException("B-710001", "studentFaceEntity is null");
-		}
-
-		return studentFaceEntity;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+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.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.api.controller.bean.StudentFaceDomain;
+import cn.com.qmth.examcloud.core.basic.dao.StudentFaceRepo;
+import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.FacesetEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceEntity;
+import cn.com.qmth.examcloud.core.basic.service.FaceService;
+import cn.com.qmth.examcloud.core.basic.service.bean.StudentFaceInfo;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年9月4日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.ctr.basic}/face")
+public class FaceController extends ControllerSupport {
+
+	@Autowired
+	StudentFaceRepo studentFaceRepo;
+
+	@Autowired
+	StudentRepo studentRepo;
+
+	@Autowired
+	FaceService studentFaceService;
+
+	@ApiOperation(value = "保存学生人脸数据")
+	@PostMapping("saveStudentFace")
+	public StudentFaceEntity saveStudentFace(@RequestBody StudentFaceDomain req) {
+		StudentFaceInfo info = new StudentFaceInfo();
+		info.setFacesetToken(req.getFacesetToken());
+		info.setFaceToken(req.getFaceToken());
+		info.setOperator(req.getOperator());
+		info.setPhotoName(req.getPhotoName());
+		info.setRootOrgId(req.getRootOrgId());
+		info.setStudentId(req.getStudentId());
+		info.setFaceCount(req.getFaceCount());
+
+		StudentFaceEntity saved = studentFaceService.saveStudentFace(info);
+		return saved;
+	}
+
+	@ApiOperation(value = "获取可用的faceset集合")
+	@GetMapping("getUsableFacesetList")
+	public List<FacesetEntity> getUsableFacesetList() {
+
+		List<FacesetEntity> facesetList = studentFaceService.getUsableFacesetList();
+
+		return facesetList;
+	}
+
+	@ApiOperation(value = "获取可用的faceset集合")
+	@GetMapping("studentFace/{studentId}")
+	public StudentFaceEntity getStudentFace(@PathVariable Long studentId) {
+
+		if (null == studentId) {
+			throw new StatusException("B-710001", "studentId is null");
+		}
+
+		StudentFaceEntity studentFaceEntity = studentFaceRepo.findOne(studentId);
+
+		if (null == studentFaceEntity) {
+			throw new StatusException("B-710001", "studentFaceEntity is null");
+		}
+
+		return studentFaceEntity;
+	}
+
+}

+ 5 - 5
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/LogController.java

@@ -12,11 +12,11 @@ import org.springframework.web.bind.annotation.RestController;
 
 import com.google.common.collect.Maps;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
-import cn.com.qmth.examcloud.commons.base.util.DateUtil;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
+import cn.com.qmth.examcloud.commons.util.DateUtil;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 9 - 9
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java

@@ -42,15 +42,12 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnum;
-import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnumManager;
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.commons.base.util.RegExpUtil;
-import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.DynamicEnum;
+import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
+import cn.com.qmth.examcloud.commons.util.PathUtil;
+import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
+import cn.com.qmth.examcloud.commons.util.RegExpUtil;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.OrgDomain;
 import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
 import cn.com.qmth.examcloud.core.basic.dao.OrgPropertyRepo;
@@ -60,6 +57,9 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.OrgPropertyEntity;
 import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
 import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
 import cn.com.qmth.examcloud.core.basic.service.impl.OrgServiceImpl;
+import cn.com.qmth.examcloud.web.helpers.page.PageInfo;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 7 - 7
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/RolePrivilegeController.java

@@ -23,13 +23,8 @@ import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.util.RegExpUtil;
-import cn.com.qmth.examcloud.commons.web.helpers.tree.EleTreeNode;
-import cn.com.qmth.examcloud.commons.web.helpers.tree.TreeUtil;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.RegExpUtil;
 import cn.com.qmth.examcloud.core.basic.api.bean.RoleBean;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.PrivilegeDomain;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.PrivilegeGroupDomain;
@@ -49,6 +44,11 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
 import cn.com.qmth.examcloud.core.basic.service.RolePrivilegeService;
 import cn.com.qmth.examcloud.core.basic.service.bean.RoleInfo;
+import cn.com.qmth.examcloud.web.helpers.tree.EleTreeNode;
+import cn.com.qmth.examcloud.web.helpers.tree.TreeUtil;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.security.enums.RoleMeta;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 

+ 6 - 6
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/SpecialtyController.java

@@ -37,12 +37,9 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.poi.ExcelWriter;
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.commons.web.config.SystemConfig;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.poi.ExcelWriter;
+import cn.com.qmth.examcloud.commons.util.PathUtil;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.SpecialtyDomain;
 import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
 import cn.com.qmth.examcloud.core.basic.dao.CourseSpeciatlyRelationRepo;
@@ -51,6 +48,9 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.CourseSpeciatlyRelationEntity
 import cn.com.qmth.examcloud.core.basic.dao.entity.SpecialtyEntity;
 import cn.com.qmth.examcloud.core.basic.service.SpecialtyService;
 import cn.com.qmth.examcloud.core.basic.service.bean.SpecialtyInfo;
+import cn.com.qmth.examcloud.web.config.SystemConfig;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 8 - 8
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/StudentController.java

@@ -28,14 +28,9 @@ 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.base.helpers.poi.ExcelWriter;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.commons.web.config.SystemConfig;
-import cn.com.qmth.examcloud.commons.web.enums.BooleanSelect;
-import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.poi.ExcelWriter;
+import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.StudentDomain;
 import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
 import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
@@ -48,6 +43,11 @@ import cn.com.qmth.examcloud.core.basic.service.StudentService;
 import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
 import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
 import cn.com.qmth.examcloud.task.api.request.SyncStudentReq;
+import cn.com.qmth.examcloud.web.config.SystemConfig;
+import cn.com.qmth.examcloud.web.enums.BooleanSelect;
+import cn.com.qmth.examcloud.web.helpers.page.PageInfo;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/SysConfigController.java

@@ -7,8 +7,8 @@ import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 51 - 51
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/TestController.java

@@ -1,51 +1,51 @@
-package cn.com.qmth.examcloud.core.basic.api.controller;
-
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import cn.com.qmth.examcloud.commons.base.util.DateUtil;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 测试状态.勿修改或删除
- *
- * @author WANGWEI
- * @date 2018年8月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.ctr.basic}")
-public class TestController extends ControllerSupport {
-
-	@ApiOperation(value = "测试")
-	@GetMapping()
-	public String get() {
-		return DateUtil.getNowISO();
-	}
-
-	@ApiOperation(value = "测试")
-	@PostMapping()
-	public String post() {
-		return DateUtil.getNowISO();
-	}
-
-	@ApiOperation(value = "测试")
-	@PutMapping()
-	public String put() {
-		return DateUtil.getNowISO();
-	}
-
-	@ApiOperation(value = "测试")
-	@DeleteMapping()
-	public String delete() {
-		return DateUtil.getNowISO();
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller;
+
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import cn.com.qmth.examcloud.commons.util.DateUtil;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 测试状态.勿修改或删除
+ *
+ * @author WANGWEI
+ * @date 2018年8月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.ctr.basic}")
+public class TestController extends ControllerSupport {
+
+	@ApiOperation(value = "测试")
+	@GetMapping()
+	public String get() {
+		return DateUtil.getNowISO();
+	}
+
+	@ApiOperation(value = "测试")
+	@PostMapping()
+	public String post() {
+		return DateUtil.getNowISO();
+	}
+
+	@ApiOperation(value = "测试")
+	@PutMapping()
+	public String put() {
+		return DateUtil.getNowISO();
+	}
+
+	@ApiOperation(value = "测试")
+	@DeleteMapping()
+	public String delete() {
+		return DateUtil.getNowISO();
+	}
+
+}

+ 5 - 5
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/UserController.java

@@ -36,11 +36,7 @@ import org.springframework.web.bind.annotation.RestController;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.UserDomain;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.UserFormDomain;
 import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
@@ -53,6 +49,10 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.UserRoleRelationEntity;
 import cn.com.qmth.examcloud.core.basic.service.UserService;
+import cn.com.qmth.examcloud.web.helpers.page.PageInfo;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.security.enums.RoleMeta;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/CourseDomain.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.examcloud.core.basic.api.controller.bean;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
 import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 /**
  * 类注释

+ 115 - 115
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/ExamSiteDomain.java

@@ -1,115 +1,115 @@
-package cn.com.qmth.examcloud.core.basic.api.controller.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年8月31日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class ExamSiteDomain implements JsonSerializable {
-
-	private static final long serialVersionUID = 1353662143659247163L;
-
-	private Long id;
-
-	private Long rootOrgId;
-
-	private Long orgId;
-
-	private String code;
-
-	private String name;
-
-	private Boolean enable;
-
-	/**
-	 * 联系电话
-	 */
-	private String telephone;
-
-	/**
-	 * 联系人
-	 */
-	private String contacts;
-
-	/**
-	 * 备注
-	 */
-	private String remark;
-
-	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 Long getOrgId() {
-		return orgId;
-	}
-
-	public void setOrgId(Long orgId) {
-		this.orgId = orgId;
-	}
-
-	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 Boolean getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Boolean enable) {
-		this.enable = enable;
-	}
-
-	public String getTelephone() {
-		return telephone;
-	}
-
-	public void setTelephone(String telephone) {
-		this.telephone = telephone;
-	}
-
-	public String getContacts() {
-		return contacts;
-	}
-
-	public void setContacts(String contacts) {
-		this.contacts = contacts;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年8月31日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class ExamSiteDomain implements JsonSerializable {
+
+	private static final long serialVersionUID = 1353662143659247163L;
+
+	private Long id;
+
+	private Long rootOrgId;
+
+	private Long orgId;
+
+	private String code;
+
+	private String name;
+
+	private Boolean enable;
+
+	/**
+	 * 联系电话
+	 */
+	private String telephone;
+
+	/**
+	 * 联系人
+	 */
+	private String contacts;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	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 Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	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 Boolean getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Boolean enable) {
+		this.enable = enable;
+	}
+
+	public String getTelephone() {
+		return telephone;
+	}
+
+	public void setTelephone(String telephone) {
+		this.telephone = telephone;
+	}
+
+	public String getContacts() {
+		return contacts;
+	}
+
+	public void setContacts(String contacts) {
+		this.contacts = contacts;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/OrgDomain.java

@@ -3,7 +3,7 @@ package cn.com.qmth.examcloud.core.basic.api.controller.bean;
 import java.util.Date;
 import java.util.Map;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 /**
  * 类注释

+ 273 - 273
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/PrivilegeDomain.java

@@ -1,273 +1,273 @@
-package cn.com.qmth.examcloud.core.basic.api.controller.bean;
-
-import java.util.Date;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-import cn.com.qmth.examcloud.commons.web.helpers.tree.TreeNode;
-
-/**
- * 权限信息
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class PrivilegeDomain implements JsonSerializable, TreeNode {
-
-	private static final long serialVersionUID = -8828760710678965127L;
-
-	/**
-	 * 权限ID
-	 */
-	private Long id;
-
-	/**
-	 * 权限码
-	 */
-	private String code;
-
-	/**
-	 * 权限名称
-	 */
-	private String name;
-
-	/**
-	 * 父权限ID
-	 */
-	private Long parentId;
-
-	/**
-	 * 组ID(权限分组,同一组的权限构成权限树)
-	 */
-	private Long groupId;
-
-	/**
-	 * 组编码
-	 */
-	private String groupCode;
-
-	/**
-	 * 是否有权限
-	 */
-	private boolean hasPrivilege;
-
-	/**
-	 * 描述
-	 */
-	private String description;
-
-	private Date updateTime;
-
-	private Date creationTime;
-
-	private Long weight = 0L;
-
-	/**
-	 * 扩展属性
-	 */
-	private String ext1;
-
-	/**
-	 * 扩展属性
-	 */
-	private String ext2;
-
-	/**
-	 * 扩展属性
-	 */
-	private String ext3;
-
-	/**
-	 * 扩展属性
-	 */
-	private String ext4;
-
-	/**
-	 * 扩展属性
-	 */
-	private String ext5;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	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 Long getParentId() {
-		return parentId;
-	}
-
-	public void setParentId(Long parentId) {
-		this.parentId = parentId;
-	}
-
-	public Long getGroupId() {
-		return groupId;
-	}
-
-	public void setGroupId(Long groupId) {
-		this.groupId = groupId;
-	}
-
-	public String getGroupCode() {
-		return groupCode;
-	}
-
-	public void setGroupCode(String groupCode) {
-		this.groupCode = groupCode;
-	}
-
-	public boolean isHasPrivilege() {
-		return hasPrivilege;
-	}
-
-	public void setHasPrivilege(boolean hasPrivilege) {
-		this.hasPrivilege = hasPrivilege;
-	}
-
-	public String getDescription() {
-		return description;
-	}
-
-	public void setDescription(String description) {
-		this.description = description;
-	}
-
-	public Date getUpdateTime() {
-		return updateTime;
-	}
-
-	public void setUpdateTime(Date updateTime) {
-		this.updateTime = updateTime;
-	}
-
-	public Date getCreationTime() {
-		return creationTime;
-	}
-
-	public void setCreationTime(Date creationTime) {
-		this.creationTime = creationTime;
-	}
-
-	public Long getWeight() {
-		return weight;
-	}
-
-	public void setWeight(Long weight) {
-		this.weight = weight;
-	}
-
-	public String getExt1() {
-		return ext1;
-	}
-
-	public void setExt1(String ext1) {
-		this.ext1 = ext1;
-	}
-
-	public String getExt2() {
-		return ext2;
-	}
-
-	public void setExt2(String ext2) {
-		this.ext2 = ext2;
-	}
-
-	public String getExt3() {
-		return ext3;
-	}
-
-	public void setExt3(String ext3) {
-		this.ext3 = ext3;
-	}
-
-	public String getExt4() {
-		return ext4;
-	}
-
-	public void setExt4(String ext4) {
-		this.ext4 = ext4;
-	}
-
-	public String getExt5() {
-		return ext5;
-	}
-
-	public void setExt5(String ext5) {
-		this.ext5 = ext5;
-	}
-
-	@Override
-	public String getNodeId() {
-		if (null == this.id) {
-			return null;
-		}
-		return String.valueOf(this.id);
-	}
-
-	@Override
-	public void setNodeId(String nodeId) {
-		if (null == nodeId) {
-			this.id = null;
-		}
-		this.id = Long.parseLong(nodeId);
-	}
-
-	@Override
-	public String getNodeName() {
-		if (null == this.name) {
-			return null;
-		}
-		return String.valueOf(this.name);
-	}
-
-	@Override
-	public void setNodeName(String nodeName) {
-		this.name = nodeName;
-	}
-
-	@Override
-	public String getParentNodeId() {
-		if (null == this.parentId) {
-			return null;
-		}
-		return String.valueOf(this.parentId);
-	}
-
-	@Override
-	public void setParentNodeId(String parentNodeId) {
-		if (null == parentNodeId) {
-			this.parentId = null;
-		}
-		this.parentId = Long.parseLong(parentNodeId);
-	}
-
-	@Override
-	public String getNodeCode() {
-		return this.code;
-	}
-
-	@Override
-	public void setNodeCode(String code) {
-		this.code = code;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller.bean;
+
+import java.util.Date;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.helpers.tree.TreeNode;
+
+/**
+ * 权限信息
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class PrivilegeDomain implements JsonSerializable, TreeNode {
+
+	private static final long serialVersionUID = -8828760710678965127L;
+
+	/**
+	 * 权限ID
+	 */
+	private Long id;
+
+	/**
+	 * 权限码
+	 */
+	private String code;
+
+	/**
+	 * 权限名称
+	 */
+	private String name;
+
+	/**
+	 * 父权限ID
+	 */
+	private Long parentId;
+
+	/**
+	 * 组ID(权限分组,同一组的权限构成权限树)
+	 */
+	private Long groupId;
+
+	/**
+	 * 组编码
+	 */
+	private String groupCode;
+
+	/**
+	 * 是否有权限
+	 */
+	private boolean hasPrivilege;
+
+	/**
+	 * 描述
+	 */
+	private String description;
+
+	private Date updateTime;
+
+	private Date creationTime;
+
+	private Long weight = 0L;
+
+	/**
+	 * 扩展属性
+	 */
+	private String ext1;
+
+	/**
+	 * 扩展属性
+	 */
+	private String ext2;
+
+	/**
+	 * 扩展属性
+	 */
+	private String ext3;
+
+	/**
+	 * 扩展属性
+	 */
+	private String ext4;
+
+	/**
+	 * 扩展属性
+	 */
+	private String ext5;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	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 Long getParentId() {
+		return parentId;
+	}
+
+	public void setParentId(Long parentId) {
+		this.parentId = parentId;
+	}
+
+	public Long getGroupId() {
+		return groupId;
+	}
+
+	public void setGroupId(Long groupId) {
+		this.groupId = groupId;
+	}
+
+	public String getGroupCode() {
+		return groupCode;
+	}
+
+	public void setGroupCode(String groupCode) {
+		this.groupCode = groupCode;
+	}
+
+	public boolean isHasPrivilege() {
+		return hasPrivilege;
+	}
+
+	public void setHasPrivilege(boolean hasPrivilege) {
+		this.hasPrivilege = hasPrivilege;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public Date getUpdateTime() {
+		return updateTime;
+	}
+
+	public void setUpdateTime(Date updateTime) {
+		this.updateTime = updateTime;
+	}
+
+	public Date getCreationTime() {
+		return creationTime;
+	}
+
+	public void setCreationTime(Date creationTime) {
+		this.creationTime = creationTime;
+	}
+
+	public Long getWeight() {
+		return weight;
+	}
+
+	public void setWeight(Long weight) {
+		this.weight = weight;
+	}
+
+	public String getExt1() {
+		return ext1;
+	}
+
+	public void setExt1(String ext1) {
+		this.ext1 = ext1;
+	}
+
+	public String getExt2() {
+		return ext2;
+	}
+
+	public void setExt2(String ext2) {
+		this.ext2 = ext2;
+	}
+
+	public String getExt3() {
+		return ext3;
+	}
+
+	public void setExt3(String ext3) {
+		this.ext3 = ext3;
+	}
+
+	public String getExt4() {
+		return ext4;
+	}
+
+	public void setExt4(String ext4) {
+		this.ext4 = ext4;
+	}
+
+	public String getExt5() {
+		return ext5;
+	}
+
+	public void setExt5(String ext5) {
+		this.ext5 = ext5;
+	}
+
+	@Override
+	public String getNodeId() {
+		if (null == this.id) {
+			return null;
+		}
+		return String.valueOf(this.id);
+	}
+
+	@Override
+	public void setNodeId(String nodeId) {
+		if (null == nodeId) {
+			this.id = null;
+		}
+		this.id = Long.parseLong(nodeId);
+	}
+
+	@Override
+	public String getNodeName() {
+		if (null == this.name) {
+			return null;
+		}
+		return String.valueOf(this.name);
+	}
+
+	@Override
+	public void setNodeName(String nodeName) {
+		this.name = nodeName;
+	}
+
+	@Override
+	public String getParentNodeId() {
+		if (null == this.parentId) {
+			return null;
+		}
+		return String.valueOf(this.parentId);
+	}
+
+	@Override
+	public void setParentNodeId(String parentNodeId) {
+		if (null == parentNodeId) {
+			this.parentId = null;
+		}
+		this.parentId = Long.parseLong(parentNodeId);
+	}
+
+	@Override
+	public String getNodeCode() {
+		return this.code;
+	}
+
+	@Override
+	public void setNodeCode(String code) {
+		this.code = code;
+	}
+
+}

+ 107 - 107
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/PrivilegeGroupDomain.java

@@ -1,107 +1,107 @@
-package cn.com.qmth.examcloud.core.basic.api.controller.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 权限组
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class PrivilegeGroupDomain implements JsonSerializable {
-
-	private static final long serialVersionUID = -3654724059677675683L;
-
-	/**
-	 * 权限组ID
-	 */
-	private Long id;
-
-	/**
-	 * 权限组名称
-	 */
-	private String name;
-
-	/**
-	 * 权限组编码
-	 */
-	private String code;
-
-	/**
-	 * 应用ID
-	 */
-	private Long appId;
-
-	/**
-	 * 应用名称
-	 */
-	private String appName;
-
-	/**
-	 * 顶级机构ID
-	 */
-	private Long rootOrgId;
-
-	/**
-	 * 顶级机构名称
-	 */
-	private String rootOrgName;
-
-	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 String getCode() {
-		return code;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-	public Long getAppId() {
-		return appId;
-	}
-
-	public void setAppId(Long appId) {
-		this.appId = appId;
-	}
-
-	public String getAppName() {
-		return appName;
-	}
-
-	public void setAppName(String appName) {
-		this.appName = appName;
-	}
-
-	public Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public String getRootOrgName() {
-		return rootOrgName;
-	}
-
-	public void setRootOrgName(String rootOrgName) {
-		this.rootOrgName = rootOrgName;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 权限组
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class PrivilegeGroupDomain implements JsonSerializable {
+
+	private static final long serialVersionUID = -3654724059677675683L;
+
+	/**
+	 * 权限组ID
+	 */
+	private Long id;
+
+	/**
+	 * 权限组名称
+	 */
+	private String name;
+
+	/**
+	 * 权限组编码
+	 */
+	private String code;
+
+	/**
+	 * 应用ID
+	 */
+	private Long appId;
+
+	/**
+	 * 应用名称
+	 */
+	private String appName;
+
+	/**
+	 * 顶级机构ID
+	 */
+	private Long rootOrgId;
+
+	/**
+	 * 顶级机构名称
+	 */
+	private String rootOrgName;
+
+	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 String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Long getAppId() {
+		return appId;
+	}
+
+	public void setAppId(Long appId) {
+		this.appId = appId;
+	}
+
+	public String getAppName() {
+		return appName;
+	}
+
+	public void setAppName(String appName) {
+		this.appName = appName;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public String getRootOrgName() {
+		return rootOrgName;
+	}
+
+	public void setRootOrgName(String rootOrgName) {
+		this.rootOrgName = rootOrgName;
+	}
+
+}

+ 68 - 68
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/RoleDomain.java

@@ -1,68 +1,68 @@
-package cn.com.qmth.examcloud.core.basic.api.controller.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 角色
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class RoleDomain implements JsonSerializable {
-
-	private static final long serialVersionUID = -2167420238674588632L;
-
-	/**
-	 * 角色ID
-	 */
-	private Long id;
-
-	/**
-	 * 角色码
-	 */
-	private String code;
-
-	/**
-	 * 角色名称
-	 */
-	private String name;
-
-	/**
-	 * 顶级机构.为null时,为全局角色
-	 */
-	private Long rootOrgId;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	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 Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 角色
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class RoleDomain implements JsonSerializable {
+
+	private static final long serialVersionUID = -2167420238674588632L;
+
+	/**
+	 * 角色ID
+	 */
+	private Long id;
+
+	/**
+	 * 角色码
+	 */
+	private String code;
+
+	/**
+	 * 角色名称
+	 */
+	private String name;
+
+	/**
+	 * 顶级机构.为null时,为全局角色
+	 */
+	private Long rootOrgId;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	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 Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/SpecialtyDomain.java

@@ -1,6 +1,6 @@
 package cn.com.qmth.examcloud.core.basic.api.controller.bean;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 public class SpecialtyDomain implements JsonSerializable {
 

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/StudentDomain.java

@@ -2,7 +2,7 @@ package cn.com.qmth.examcloud.core.basic.api.controller.bean;
 
 import java.util.Date;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 /**
  * 类注释

+ 86 - 86
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/StudentFaceDomain.java

@@ -1,86 +1,86 @@
-package cn.com.qmth.examcloud.core.basic.api.controller.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.BaseRequest;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年7月18日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class StudentFaceDomain extends BaseRequest {
-
-	private static final long serialVersionUID = -8260481601116583797L;
-
-	private Long rootOrgId;
-
-	private Long studentId;
-
-	private String faceToken;
-
-	private String facesetToken;
-
-	private String photoName;
-
-	private String operator;
-
-	private Long faceCount;
-
-	public Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public Long getStudentId() {
-		return studentId;
-	}
-
-	public void setStudentId(Long studentId) {
-		this.studentId = studentId;
-	}
-
-	public String getFaceToken() {
-		return faceToken;
-	}
-
-	public void setFaceToken(String faceToken) {
-		this.faceToken = faceToken;
-	}
-
-	public String getFacesetToken() {
-		return facesetToken;
-	}
-
-	public void setFacesetToken(String facesetToken) {
-		this.facesetToken = facesetToken;
-	}
-
-	public String getPhotoName() {
-		return photoName;
-	}
-
-	public void setPhotoName(String photoName) {
-		this.photoName = photoName;
-	}
-
-	public String getOperator() {
-		return operator;
-	}
-
-	public void setOperator(String operator) {
-		this.operator = operator;
-	}
-
-	public Long getFaceCount() {
-		return faceCount;
-	}
-
-	public void setFaceCount(Long faceCount) {
-		this.faceCount = faceCount;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.BaseRequest;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年7月18日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class StudentFaceDomain extends BaseRequest {
+
+	private static final long serialVersionUID = -8260481601116583797L;
+
+	private Long rootOrgId;
+
+	private Long studentId;
+
+	private String faceToken;
+
+	private String facesetToken;
+
+	private String photoName;
+
+	private String operator;
+
+	private Long faceCount;
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public Long getStudentId() {
+		return studentId;
+	}
+
+	public void setStudentId(Long studentId) {
+		this.studentId = studentId;
+	}
+
+	public String getFaceToken() {
+		return faceToken;
+	}
+
+	public void setFaceToken(String faceToken) {
+		this.faceToken = faceToken;
+	}
+
+	public String getFacesetToken() {
+		return facesetToken;
+	}
+
+	public void setFacesetToken(String facesetToken) {
+		this.facesetToken = facesetToken;
+	}
+
+	public String getPhotoName() {
+		return photoName;
+	}
+
+	public void setPhotoName(String photoName) {
+		this.photoName = photoName;
+	}
+
+	public String getOperator() {
+		return operator;
+	}
+
+	public void setOperator(String operator) {
+		this.operator = operator;
+	}
+
+	public Long getFaceCount() {
+		return faceCount;
+	}
+
+	public void setFaceCount(Long faceCount) {
+		this.faceCount = faceCount;
+	}
+
+}

+ 58 - 58
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/UpdateRolePrivilegeRelationsDomain.java

@@ -1,58 +1,58 @@
-package cn.com.qmth.examcloud.core.basic.api.controller.bean;
-
-import java.util.Set;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 更新角色权限关联 请求
- *
- * @author WANGWEI
- * @date 2018年6月14日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class UpdateRolePrivilegeRelationsDomain implements JsonSerializable {
-
-	private static final long serialVersionUID = -9173265174568713167L;
-
-	private String rootOrgId;
-
-	private String roleId;
-
-	private String privilegeGroupId;
-
-	private Set<Long> privilegeIdSet;
-
-	public String getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(String rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public String getRoleId() {
-		return roleId;
-	}
-
-	public void setRoleId(String roleId) {
-		this.roleId = roleId;
-	}
-
-	public String getPrivilegeGroupId() {
-		return privilegeGroupId;
-	}
-
-	public void setPrivilegeGroupId(String privilegeGroupId) {
-		this.privilegeGroupId = privilegeGroupId;
-	}
-
-	public Set<Long> getPrivilegeIdSet() {
-		return privilegeIdSet;
-	}
-
-	public void setPrivilegeIdSet(Set<Long> privilegeIdSet) {
-		this.privilegeIdSet = privilegeIdSet;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.controller.bean;
+
+import java.util.Set;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 更新角色权限关联 请求
+ *
+ * @author WANGWEI
+ * @date 2018年6月14日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class UpdateRolePrivilegeRelationsDomain implements JsonSerializable {
+
+	private static final long serialVersionUID = -9173265174568713167L;
+
+	private String rootOrgId;
+
+	private String roleId;
+
+	private String privilegeGroupId;
+
+	private Set<Long> privilegeIdSet;
+
+	public String getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(String rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public String getRoleId() {
+		return roleId;
+	}
+
+	public void setRoleId(String roleId) {
+		this.roleId = roleId;
+	}
+
+	public String getPrivilegeGroupId() {
+		return privilegeGroupId;
+	}
+
+	public void setPrivilegeGroupId(String privilegeGroupId) {
+		this.privilegeGroupId = privilegeGroupId;
+	}
+
+	public Set<Long> getPrivilegeIdSet() {
+		return privilegeIdSet;
+	}
+
+	public void setPrivilegeIdSet(Set<Long> privilegeIdSet) {
+		this.privilegeIdSet = privilegeIdSet;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/UserDomain.java

@@ -3,7 +3,7 @@ package cn.com.qmth.examcloud.core.basic.api.controller.bean;
 import java.util.Date;
 import java.util.List;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 /**
  * 全量用户信息

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/bean/UserFormDomain.java

@@ -2,7 +2,7 @@ package cn.com.qmth.examcloud.core.basic.api.controller.bean;
 
 import java.util.List;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 /**
  * 用户表单

+ 48 - 48
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/AuthCloudServiceProvider.java

@@ -1,48 +1,48 @@
-package cn.com.qmth.examcloud.core.basic.api.provider;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.basic.api.AuthCloudService;
-import cn.com.qmth.examcloud.core.basic.api.request.LoginReq;
-import cn.com.qmth.examcloud.core.basic.api.response.LoginResp;
-import cn.com.qmth.examcloud.core.basic.service.AuthService;
-import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
-import io.swagger.annotations.ApiOperation;
-
-@Transactional
-@RestController
-@RequestMapping("${$rmp.cloud.basic}" + "auth")
-public class AuthCloudServiceProvider extends ControllerSupport implements AuthCloudService {
-
-	private static final long serialVersionUID = 4189424508654646499L;
-
-	@Autowired
-	AuthService authService;
-
-	@ApiOperation(value = "登录")
-	@PostMapping("login")
-	@Override
-	public LoginResp login(@RequestBody LoginReq req) {
-		LoginInfo loginInfo = new LoginInfo();
-		loginInfo.setAccountType(req.getAccountType());
-		loginInfo.setAccountValue(req.getAccountValue());
-		loginInfo.setClientIp(req.getClientIp());
-		loginInfo.setDomain(req.getDomain());
-		loginInfo.setPassword(req.getPassword());
-		loginInfo.setRootOrgId(req.getRootOrgId());
-
-		User user = authService.login(loginInfo);
-
-		LoginResp resp = new LoginResp();
-		resp.setUser(user);
-		return resp;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.provider;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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.core.basic.api.AuthCloudService;
+import cn.com.qmth.examcloud.core.basic.api.request.LoginReq;
+import cn.com.qmth.examcloud.core.basic.api.response.LoginResp;
+import cn.com.qmth.examcloud.core.basic.service.AuthService;
+import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+@Transactional
+@RestController
+@RequestMapping("${$rmp.cloud.basic}" + "auth")
+public class AuthCloudServiceProvider extends ControllerSupport implements AuthCloudService {
+
+	private static final long serialVersionUID = 4189424508654646499L;
+
+	@Autowired
+	AuthService authService;
+
+	@ApiOperation(value = "登录")
+	@PostMapping("login")
+	@Override
+	public LoginResp login(@RequestBody LoginReq req) {
+		LoginInfo loginInfo = new LoginInfo();
+		loginInfo.setAccountType(req.getAccountType());
+		loginInfo.setAccountValue(req.getAccountValue());
+		loginInfo.setClientIp(req.getClientIp());
+		loginInfo.setDomain(req.getDomain());
+		loginInfo.setPassword(req.getPassword());
+		loginInfo.setRootOrgId(req.getRootOrgId());
+
+		User user = authService.login(loginInfo);
+
+		LoginResp resp = new LoginResp();
+		resp.setUser(user);
+		return resp;
+	}
+
+}

+ 66 - 66
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/CommonCloudServiceProvider.java

@@ -1,66 +1,66 @@
-package cn.com.qmth.examcloud.core.basic.api.provider;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.basic.api.CommonCloudService;
-import cn.com.qmth.examcloud.core.basic.api.bean.ThirdPartyAccessBean;
-import cn.com.qmth.examcloud.core.basic.api.request.GetThirdPartyAccessInfoReq;
-import cn.com.qmth.examcloud.core.basic.api.response.GetThirdPartyAccessInfoResp;
-import cn.com.qmth.examcloud.core.basic.dao.ThirdPartyAccessRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessPK;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年7月6日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.cloud.basic}" + "common")
-public class CommonCloudServiceProvider extends ControllerSupport implements CommonCloudService {
-
-	private static final long serialVersionUID = 8860099250569635574L;
-
-	@Autowired
-	ThirdPartyAccessRepo thirdPartyAccessRepo;
-
-	@ApiOperation(value = "获取第三方接入信息")
-	@PostMapping("getThirdPartyAccessInfo")
-	@Override
-	public GetThirdPartyAccessInfoResp getThirdPartyAccessInfo(
-			@RequestBody GetThirdPartyAccessInfoReq req) {
-
-		String appId = req.getAppId();
-		Long rootOrgId = req.getRootOrgId();
-
-		ThirdPartyAccessEntity entity = thirdPartyAccessRepo
-				.findOne(new ThirdPartyAccessPK(rootOrgId, appId));
-
-		if (null == entity) {
-			throw new StatusException("B-001001", "第三方接入信息不存在");
-		}
-
-		ThirdPartyAccessBean bean = new ThirdPartyAccessBean();
-		bean.setAppId(entity.getAppId());
-		bean.setRootOrgId(bean.getRootOrgId());
-		bean.setSecretKey(entity.getSecretKey());
-		bean.setTimeRange(entity.getTimeRange());
-
-		GetThirdPartyAccessInfoResp resp = new GetThirdPartyAccessInfoResp();
-		resp.setThirdPartyAccessBean(bean);
-
-		return resp;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.provider;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.api.CommonCloudService;
+import cn.com.qmth.examcloud.core.basic.api.bean.ThirdPartyAccessBean;
+import cn.com.qmth.examcloud.core.basic.api.request.GetThirdPartyAccessInfoReq;
+import cn.com.qmth.examcloud.core.basic.api.response.GetThirdPartyAccessInfoResp;
+import cn.com.qmth.examcloud.core.basic.dao.ThirdPartyAccessRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessPK;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年7月6日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.cloud.basic}" + "common")
+public class CommonCloudServiceProvider extends ControllerSupport implements CommonCloudService {
+
+	private static final long serialVersionUID = 8860099250569635574L;
+
+	@Autowired
+	ThirdPartyAccessRepo thirdPartyAccessRepo;
+
+	@ApiOperation(value = "获取第三方接入信息")
+	@PostMapping("getThirdPartyAccessInfo")
+	@Override
+	public GetThirdPartyAccessInfoResp getThirdPartyAccessInfo(
+			@RequestBody GetThirdPartyAccessInfoReq req) {
+
+		String appId = req.getAppId();
+		Long rootOrgId = req.getRootOrgId();
+
+		ThirdPartyAccessEntity entity = thirdPartyAccessRepo
+				.findOne(new ThirdPartyAccessPK(rootOrgId, appId));
+
+		if (null == entity) {
+			throw new StatusException("B-001001", "第三方接入信息不存在");
+		}
+
+		ThirdPartyAccessBean bean = new ThirdPartyAccessBean();
+		bean.setAppId(entity.getAppId());
+		bean.setRootOrgId(bean.getRootOrgId());
+		bean.setSecretKey(entity.getSecretKey());
+		bean.setTimeRange(entity.getTimeRange());
+
+		GetThirdPartyAccessInfoResp resp = new GetThirdPartyAccessInfoResp();
+		resp.setThirdPartyAccessBean(bean);
+
+		return resp;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/CourseCloudServiceProvider.java

@@ -8,7 +8,7 @@ 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.commons.base.exception.StatusException;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
 import cn.com.qmth.examcloud.core.basic.api.CourseCloudService;
 import cn.com.qmth.examcloud.core.basic.api.bean.CourseBean;
 import cn.com.qmth.examcloud.core.basic.api.request.GetCourseReq;

+ 152 - 152
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/FaceCloudServiceProvider.java

@@ -1,152 +1,152 @@
-package cn.com.qmth.examcloud.core.basic.api.provider;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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.core.basic.api.FaceCloudService;
-import cn.com.qmth.examcloud.core.basic.api.bean.FacesetBean;
-import cn.com.qmth.examcloud.core.basic.api.bean.StudentFaceBean;
-import cn.com.qmth.examcloud.core.basic.api.request.GetStudentFaceReq;
-import cn.com.qmth.examcloud.core.basic.api.request.GetUsableFacesetListReq;
-import cn.com.qmth.examcloud.core.basic.api.request.SaveStudentFaceReq;
-import cn.com.qmth.examcloud.core.basic.api.response.GetStudentFaceResp;
-import cn.com.qmth.examcloud.core.basic.api.response.GetUsableFacesetListResp;
-import cn.com.qmth.examcloud.core.basic.api.response.SaveStudentFaceResp;
-import cn.com.qmth.examcloud.core.basic.dao.FacesetRepo;
-import cn.com.qmth.examcloud.core.basic.dao.StudentFaceRepo;
-import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.FacesetEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceEntity;
-import cn.com.qmth.examcloud.core.basic.service.FaceService;
-import cn.com.qmth.examcloud.core.basic.service.bean.StudentFaceInfo;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年8月14日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.cloud.basic}" + "studentFace")
-public class FaceCloudServiceProvider extends ControllerSupport implements FaceCloudService {
-
-	private static final long serialVersionUID = 8674317301051207328L;
-
-	@Autowired
-	StudentFaceRepo studentFaceRepo;
-
-	@Autowired
-	FacesetRepo facesetRepo;
-
-	@Autowired
-	StudentRepo studentRepo;
-
-	@Autowired
-	FaceService studentFaceService;
-
-	@ApiOperation(value = "保存学生人脸数据")
-	@PostMapping("saveStudentFace")
-	@Override
-	public SaveStudentFaceResp saveStudentFace(@RequestBody SaveStudentFaceReq req) {
-		trim(req);
-		StudentFaceInfo info = new StudentFaceInfo();
-		info.setFacesetToken(req.getFacesetToken());
-		info.setFaceToken(req.getFaceToken());
-		info.setOperator(req.getOperator());
-		info.setPhotoName(req.getPhotoName());
-		info.setRootOrgId(req.getRootOrgId());
-		info.setStudentId(req.getStudentId());
-		info.setFaceCount(req.getFaceCount());
-
-		StudentFaceEntity saved = studentFaceService.saveStudentFace(info);
-		SaveStudentFaceResp resp = new SaveStudentFaceResp();
-		resp.setId(saved.getStudentId());
-		return resp;
-	}
-
-	@ApiOperation(value = "获取可用的faceset集合")
-	@PostMapping("getUsableFacesetList")
-	@Override
-	public GetUsableFacesetListResp getUsableFacesetList(@RequestBody GetUsableFacesetListReq req) {
-
-		List<FacesetEntity> facesetList = studentFaceService.getUsableFacesetList();
-
-		List<FacesetBean> list = Lists.newArrayList();
-
-		for (FacesetEntity cur : facesetList) {
-			FacesetBean bean = new FacesetBean();
-			list.add(bean);
-
-			bean.setDisplayName(cur.getDisplayName());
-			bean.setFaceCount(cur.getFaceCount());
-			bean.setFacesetToken(cur.getFacesetToken());
-			bean.setId(cur.getId());
-			bean.setOuterId(cur.getOuterId());
-			bean.setTags(cur.getTags());
-		}
-
-		GetUsableFacesetListResp resp = new GetUsableFacesetListResp();
-		resp.setFacesetBeanList(list);
-		return resp;
-	}
-
-	@ApiOperation(value = "获取可用的faceset集合")
-	@PostMapping("getStudentFace")
-	@Override
-	public GetStudentFaceResp getStudentFace(@RequestBody GetStudentFaceReq req) {
-		Long studentId = req.getStudentId();
-
-		if (null == studentId) {
-			throw new StatusException("B-710001", "studentId is null");
-		}
-
-		StudentFaceEntity studentFaceEntity = studentFaceRepo.findOne(studentId);
-
-		if (null == studentFaceEntity) {
-			throw new StatusException("B-710001", "studentFaceEntity is null");
-		}
-
-		StudentFaceBean studentFaceBean = new StudentFaceBean();
-
-		studentFaceBean.setCreator(studentFaceEntity.getCreator());
-		studentFaceBean.setFacesetId(studentFaceEntity.getFacesetId());
-		studentFaceBean.setFaceToken(studentFaceEntity.getFaceToken());
-		studentFaceBean.setModifiedBy(studentFaceEntity.getModifiedBy());
-		studentFaceBean.setStudentId(studentFaceEntity.getStudentId());
-
-		GetStudentFaceResp resp = new GetStudentFaceResp();
-		resp.setStudentFaceBean(studentFaceBean);
-
-		if (null != studentFaceEntity.getFacesetId()) {
-			FacesetEntity facesetEntity = facesetRepo.findOne(studentFaceEntity.getFacesetId());
-			if (null != facesetEntity) {
-				FacesetBean facesetBean = new FacesetBean();
-				facesetBean.setDisplayName(facesetEntity.getDisplayName());
-				facesetBean.setFaceCount(facesetEntity.getFaceCount());
-				facesetBean.setFacesetToken(facesetEntity.getFacesetToken());
-				facesetBean.setId(facesetEntity.getId());
-				facesetBean.setOuterId(facesetEntity.getOuterId());
-				facesetBean.setTags(facesetEntity.getTags());
-
-				resp.setFacesetBean(facesetBean);
-			}
-
-		}
-
-		return resp;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.provider;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.api.FaceCloudService;
+import cn.com.qmth.examcloud.core.basic.api.bean.FacesetBean;
+import cn.com.qmth.examcloud.core.basic.api.bean.StudentFaceBean;
+import cn.com.qmth.examcloud.core.basic.api.request.GetStudentFaceReq;
+import cn.com.qmth.examcloud.core.basic.api.request.GetUsableFacesetListReq;
+import cn.com.qmth.examcloud.core.basic.api.request.SaveStudentFaceReq;
+import cn.com.qmth.examcloud.core.basic.api.response.GetStudentFaceResp;
+import cn.com.qmth.examcloud.core.basic.api.response.GetUsableFacesetListResp;
+import cn.com.qmth.examcloud.core.basic.api.response.SaveStudentFaceResp;
+import cn.com.qmth.examcloud.core.basic.dao.FacesetRepo;
+import cn.com.qmth.examcloud.core.basic.dao.StudentFaceRepo;
+import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.FacesetEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceEntity;
+import cn.com.qmth.examcloud.core.basic.service.FaceService;
+import cn.com.qmth.examcloud.core.basic.service.bean.StudentFaceInfo;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年8月14日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.cloud.basic}" + "studentFace")
+public class FaceCloudServiceProvider extends ControllerSupport implements FaceCloudService {
+
+	private static final long serialVersionUID = 8674317301051207328L;
+
+	@Autowired
+	StudentFaceRepo studentFaceRepo;
+
+	@Autowired
+	FacesetRepo facesetRepo;
+
+	@Autowired
+	StudentRepo studentRepo;
+
+	@Autowired
+	FaceService studentFaceService;
+
+	@ApiOperation(value = "保存学生人脸数据")
+	@PostMapping("saveStudentFace")
+	@Override
+	public SaveStudentFaceResp saveStudentFace(@RequestBody SaveStudentFaceReq req) {
+		trim(req);
+		StudentFaceInfo info = new StudentFaceInfo();
+		info.setFacesetToken(req.getFacesetToken());
+		info.setFaceToken(req.getFaceToken());
+		info.setOperator(req.getOperator());
+		info.setPhotoName(req.getPhotoName());
+		info.setRootOrgId(req.getRootOrgId());
+		info.setStudentId(req.getStudentId());
+		info.setFaceCount(req.getFaceCount());
+
+		StudentFaceEntity saved = studentFaceService.saveStudentFace(info);
+		SaveStudentFaceResp resp = new SaveStudentFaceResp();
+		resp.setId(saved.getStudentId());
+		return resp;
+	}
+
+	@ApiOperation(value = "获取可用的faceset集合")
+	@PostMapping("getUsableFacesetList")
+	@Override
+	public GetUsableFacesetListResp getUsableFacesetList(@RequestBody GetUsableFacesetListReq req) {
+
+		List<FacesetEntity> facesetList = studentFaceService.getUsableFacesetList();
+
+		List<FacesetBean> list = Lists.newArrayList();
+
+		for (FacesetEntity cur : facesetList) {
+			FacesetBean bean = new FacesetBean();
+			list.add(bean);
+
+			bean.setDisplayName(cur.getDisplayName());
+			bean.setFaceCount(cur.getFaceCount());
+			bean.setFacesetToken(cur.getFacesetToken());
+			bean.setId(cur.getId());
+			bean.setOuterId(cur.getOuterId());
+			bean.setTags(cur.getTags());
+		}
+
+		GetUsableFacesetListResp resp = new GetUsableFacesetListResp();
+		resp.setFacesetBeanList(list);
+		return resp;
+	}
+
+	@ApiOperation(value = "获取可用的faceset集合")
+	@PostMapping("getStudentFace")
+	@Override
+	public GetStudentFaceResp getStudentFace(@RequestBody GetStudentFaceReq req) {
+		Long studentId = req.getStudentId();
+
+		if (null == studentId) {
+			throw new StatusException("B-710001", "studentId is null");
+		}
+
+		StudentFaceEntity studentFaceEntity = studentFaceRepo.findOne(studentId);
+
+		if (null == studentFaceEntity) {
+			throw new StatusException("B-710001", "studentFaceEntity is null");
+		}
+
+		StudentFaceBean studentFaceBean = new StudentFaceBean();
+
+		studentFaceBean.setCreator(studentFaceEntity.getCreator());
+		studentFaceBean.setFacesetId(studentFaceEntity.getFacesetId());
+		studentFaceBean.setFaceToken(studentFaceEntity.getFaceToken());
+		studentFaceBean.setModifiedBy(studentFaceEntity.getModifiedBy());
+		studentFaceBean.setStudentId(studentFaceEntity.getStudentId());
+
+		GetStudentFaceResp resp = new GetStudentFaceResp();
+		resp.setStudentFaceBean(studentFaceBean);
+
+		if (null != studentFaceEntity.getFacesetId()) {
+			FacesetEntity facesetEntity = facesetRepo.findOne(studentFaceEntity.getFacesetId());
+			if (null != facesetEntity) {
+				FacesetBean facesetBean = new FacesetBean();
+				facesetBean.setDisplayName(facesetEntity.getDisplayName());
+				facesetBean.setFaceCount(facesetEntity.getFaceCount());
+				facesetBean.setFacesetToken(facesetEntity.getFacesetToken());
+				facesetBean.setId(facesetEntity.getId());
+				facesetBean.setOuterId(facesetEntity.getOuterId());
+				facesetBean.setTags(facesetEntity.getTags());
+
+				resp.setFacesetBean(facesetBean);
+			}
+
+		}
+
+		return resp;
+	}
+
+}

+ 4 - 4
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/OrgCloudServiceProvider.java

@@ -23,10 +23,9 @@ import org.springframework.web.bind.annotation.RestController;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnum;
-import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnumManager;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.DynamicEnum;
+import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
 import cn.com.qmth.examcloud.core.basic.api.OrgCloudService;
 import cn.com.qmth.examcloud.core.basic.api.bean.OrgBean;
 import cn.com.qmth.examcloud.core.basic.api.request.GetAllOrgPropertiesReq;
@@ -46,6 +45,7 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.OrgPropertyEntity;
 import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
 import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
 import cn.com.qmth.examcloud.core.basic.service.impl.OrgServiceImpl;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 132 - 132
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/RolePrivilegeCloudServiceProvider.java

@@ -1,132 +1,132 @@
-package cn.com.qmth.examcloud.core.basic.api.provider;
-
-import java.util.List;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.basic.api.RolePrivilegeCloudService;
-import cn.com.qmth.examcloud.core.basic.api.bean.RoleBean;
-import cn.com.qmth.examcloud.core.basic.api.request.DeleteRoleReq;
-import cn.com.qmth.examcloud.core.basic.api.request.GetPrivilegeListReq;
-import cn.com.qmth.examcloud.core.basic.api.request.SaveRoleReq;
-import cn.com.qmth.examcloud.core.basic.api.response.DeleteRoleResp;
-import cn.com.qmth.examcloud.core.basic.api.response.GetPrivilegeListResp;
-import cn.com.qmth.examcloud.core.basic.api.response.SaveRoleResp;
-import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
-import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
-import cn.com.qmth.examcloud.core.basic.dao.RolePrivilegeRelationRepo;
-import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
-import cn.com.qmth.examcloud.core.basic.service.RolePrivilegeService;
-import cn.com.qmth.examcloud.core.basic.service.bean.RoleInfo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 角色权限服务
- *
- * @author WANGWEI
- * @date 2018年6月8日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Api("角色权限")
-@Transactional
-@RestController
-@RequestMapping("${$rmp.cloud.basic}" + "rolePrivilege")
-public class RolePrivilegeCloudServiceProvider extends ControllerSupport
-		implements
-			RolePrivilegeCloudService {
-
-	private static final long serialVersionUID = -4360164791713797878L;
-
-	@Autowired
-	RoleRepo roleRepo;
-
-	@Autowired
-	RolePrivilegeRelationRepo rolePrivilegeRelationRepo;
-
-	@Autowired
-	PrivilegeRepo privilegeRepo;
-
-	@Autowired
-	PrivilegeGroupRepo privilegeGroupRepo;
-
-	@Autowired
-	RolePrivilegeService rolePrivilegeService;
-
-	@ApiOperation(value = "添加角色")
-	@PostMapping("saveRole")
-	@Override
-	public SaveRoleResp saveRole(@RequestBody SaveRoleReq req) {
-		RoleInfo info = new RoleInfo();
-		info.setCode(req.getCode());
-		info.setName(req.getName());
-		info.setRootOrgId(req.getRootOrgId());
-
-		RoleEntity saved = rolePrivilegeService.saveRole(info);
-
-		RoleBean roleBean = new RoleBean();
-		roleBean.setRoleCode(saved.getCode());
-		roleBean.setRoleId(saved.getId());
-		roleBean.setRoleName(saved.getName());
-
-		SaveRoleResp resp = new SaveRoleResp();
-		resp.setRoleBean(roleBean);
-		return resp;
-	}
-
-	@ApiOperation(value = "删除角色")
-	@PostMapping("deleteRole")
-	@Override
-	public DeleteRoleResp deleteRole(@RequestBody DeleteRoleReq req) {
-		RoleInfo info = new RoleInfo();
-		info.setId(req.getId());
-		info.setCode(req.getCode());
-		info.setName(req.getName());
-		info.setRootOrgId(req.getRootOrgId());
-
-		RoleEntity saved = rolePrivilegeService.deleteRole(info, req.isCascade());
-
-		RoleBean roleBean = new RoleBean();
-		roleBean.setRoleCode(saved.getCode());
-		roleBean.setRoleId(saved.getId());
-		roleBean.setRoleName(saved.getName());
-
-		DeleteRoleResp resp = new DeleteRoleResp();
-		resp.setRoleBean(roleBean);
-		return resp;
-	}
-
-	@ApiOperation(value = "查询权限集合")
-	@PostMapping("getPrivilegeList")
-	@Override
-	public GetPrivilegeListResp getPrivilegeList(@RequestBody GetPrivilegeListReq req) {
-		Long rootOrgId = req.getRootOrgId();
-		Long roleId = req.getRoleId();
-
-		List<RolePrivilegeRelationEntity> relationList = rolePrivilegeRelationRepo
-				.findAllByRoleIdAndRootOrgId(roleId, rootOrgId);
-
-		List<String> privilegeCodeList = Lists.newArrayList();
-		for (RolePrivilegeRelationEntity cur : relationList) {
-
-			PrivilegeEntity privilegeEntity = privilegeRepo.findOne(cur.getPrivilegeId());
-			privilegeCodeList.add(privilegeEntity.getCode());
-		}
-
-		GetPrivilegeListResp resp = new GetPrivilegeListResp();
-		resp.setPrivilegeCodeList(privilegeCodeList);
-		return resp;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.provider;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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.core.basic.api.RolePrivilegeCloudService;
+import cn.com.qmth.examcloud.core.basic.api.bean.RoleBean;
+import cn.com.qmth.examcloud.core.basic.api.request.DeleteRoleReq;
+import cn.com.qmth.examcloud.core.basic.api.request.GetPrivilegeListReq;
+import cn.com.qmth.examcloud.core.basic.api.request.SaveRoleReq;
+import cn.com.qmth.examcloud.core.basic.api.response.DeleteRoleResp;
+import cn.com.qmth.examcloud.core.basic.api.response.GetPrivilegeListResp;
+import cn.com.qmth.examcloud.core.basic.api.response.SaveRoleResp;
+import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
+import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
+import cn.com.qmth.examcloud.core.basic.dao.RolePrivilegeRelationRepo;
+import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
+import cn.com.qmth.examcloud.core.basic.service.RolePrivilegeService;
+import cn.com.qmth.examcloud.core.basic.service.bean.RoleInfo;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 角色权限服务
+ *
+ * @author WANGWEI
+ * @date 2018年6月8日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Api("角色权限")
+@Transactional
+@RestController
+@RequestMapping("${$rmp.cloud.basic}" + "rolePrivilege")
+public class RolePrivilegeCloudServiceProvider extends ControllerSupport
+		implements
+			RolePrivilegeCloudService {
+
+	private static final long serialVersionUID = -4360164791713797878L;
+
+	@Autowired
+	RoleRepo roleRepo;
+
+	@Autowired
+	RolePrivilegeRelationRepo rolePrivilegeRelationRepo;
+
+	@Autowired
+	PrivilegeRepo privilegeRepo;
+
+	@Autowired
+	PrivilegeGroupRepo privilegeGroupRepo;
+
+	@Autowired
+	RolePrivilegeService rolePrivilegeService;
+
+	@ApiOperation(value = "添加角色")
+	@PostMapping("saveRole")
+	@Override
+	public SaveRoleResp saveRole(@RequestBody SaveRoleReq req) {
+		RoleInfo info = new RoleInfo();
+		info.setCode(req.getCode());
+		info.setName(req.getName());
+		info.setRootOrgId(req.getRootOrgId());
+
+		RoleEntity saved = rolePrivilegeService.saveRole(info);
+
+		RoleBean roleBean = new RoleBean();
+		roleBean.setRoleCode(saved.getCode());
+		roleBean.setRoleId(saved.getId());
+		roleBean.setRoleName(saved.getName());
+
+		SaveRoleResp resp = new SaveRoleResp();
+		resp.setRoleBean(roleBean);
+		return resp;
+	}
+
+	@ApiOperation(value = "删除角色")
+	@PostMapping("deleteRole")
+	@Override
+	public DeleteRoleResp deleteRole(@RequestBody DeleteRoleReq req) {
+		RoleInfo info = new RoleInfo();
+		info.setId(req.getId());
+		info.setCode(req.getCode());
+		info.setName(req.getName());
+		info.setRootOrgId(req.getRootOrgId());
+
+		RoleEntity saved = rolePrivilegeService.deleteRole(info, req.isCascade());
+
+		RoleBean roleBean = new RoleBean();
+		roleBean.setRoleCode(saved.getCode());
+		roleBean.setRoleId(saved.getId());
+		roleBean.setRoleName(saved.getName());
+
+		DeleteRoleResp resp = new DeleteRoleResp();
+		resp.setRoleBean(roleBean);
+		return resp;
+	}
+
+	@ApiOperation(value = "查询权限集合")
+	@PostMapping("getPrivilegeList")
+	@Override
+	public GetPrivilegeListResp getPrivilegeList(@RequestBody GetPrivilegeListReq req) {
+		Long rootOrgId = req.getRootOrgId();
+		Long roleId = req.getRoleId();
+
+		List<RolePrivilegeRelationEntity> relationList = rolePrivilegeRelationRepo
+				.findAllByRoleIdAndRootOrgId(roleId, rootOrgId);
+
+		List<String> privilegeCodeList = Lists.newArrayList();
+		for (RolePrivilegeRelationEntity cur : relationList) {
+
+			PrivilegeEntity privilegeEntity = privilegeRepo.findOne(cur.getPrivilegeId());
+			privilegeCodeList.add(privilegeEntity.getCode());
+		}
+
+		GetPrivilegeListResp resp = new GetPrivilegeListResp();
+		resp.setPrivilegeCodeList(privilegeCodeList);
+		return resp;
+	}
+
+}

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

@@ -10,9 +10,8 @@ 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.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
 import cn.com.qmth.examcloud.core.basic.api.StudentCloudService;
 import cn.com.qmth.examcloud.core.basic.api.bean.StudentBean;
 import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
@@ -29,6 +28,7 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
 import cn.com.qmth.examcloud.core.basic.service.StudentService;
 import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
 import io.swagger.annotations.ApiOperation;
 
 /**

+ 78 - 78
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/SysConfigCloudServiceProvider.java

@@ -1,78 +1,78 @@
-package cn.com.qmth.examcloud.core.basic.api.provider;
-
-import java.util.Date;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
-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.commons.base.util.DateUtil;
-import cn.com.qmth.examcloud.commons.base.util.DateUtil.DatePatterns;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.basic.api.SysConfigCloudService;
-import cn.com.qmth.examcloud.core.basic.api.request.GetSysConfigReq;
-import cn.com.qmth.examcloud.core.basic.api.request.SetSysConfigReq;
-import cn.com.qmth.examcloud.core.basic.api.response.GetSysConfigResp;
-import cn.com.qmth.examcloud.core.basic.api.response.SetSysConfigResp;
-import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年12月3日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.cloud.basic}" + "sysConfig")
-public class SysConfigCloudServiceProvider extends ControllerSupport
-		implements
-			SysConfigCloudService {
-
-	private static final long serialVersionUID = 2299432976949405946L;
-
-	@Autowired
-	SysConfigService sysConfigService;
-
-	@ApiOperation(value = "设置配置")
-	@PostMapping("setSysConfig")
-	@Override
-	public SetSysConfigResp setSysConfig(@RequestBody SetSysConfigReq req) {
-		String key = req.getKey();
-		String value = req.getValue();
-		sysConfigService.set(key, value);
-
-		SetSysConfigResp resp = new SetSysConfigResp();
-		resp.setKey(key);
-		resp.setValue(value);
-		return resp;
-	}
-
-	@ApiOperation(value = "获取配置")
-	@PostMapping("getSysConfig")
-	@Override
-	public GetSysConfigResp getSysConfig(@RequestBody GetSysConfigReq req) {
-		String key = req.getKey();
-		Object value = sysConfigService.get(key);
-
-		String strValue = null;
-		if (null == value) {
-			strValue = null;
-		} else if (value instanceof Date) {
-			strValue = DateUtil.format((Date) value, DatePatterns.ISO);
-		} else {
-			strValue = String.valueOf(value);
-		}
-
-		GetSysConfigResp resp = new GetSysConfigResp();
-		resp.setKey(key);
-		resp.setValue(strValue);
-		return resp;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.provider;
+
+import java.util.Date;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+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.commons.util.DateUtil;
+import cn.com.qmth.examcloud.commons.util.DateUtil.DatePatterns;
+import cn.com.qmth.examcloud.core.basic.api.SysConfigCloudService;
+import cn.com.qmth.examcloud.core.basic.api.request.GetSysConfigReq;
+import cn.com.qmth.examcloud.core.basic.api.request.SetSysConfigReq;
+import cn.com.qmth.examcloud.core.basic.api.response.GetSysConfigResp;
+import cn.com.qmth.examcloud.core.basic.api.response.SetSysConfigResp;
+import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年12月3日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.cloud.basic}" + "sysConfig")
+public class SysConfigCloudServiceProvider extends ControllerSupport
+		implements
+			SysConfigCloudService {
+
+	private static final long serialVersionUID = 2299432976949405946L;
+
+	@Autowired
+	SysConfigService sysConfigService;
+
+	@ApiOperation(value = "设置配置")
+	@PostMapping("setSysConfig")
+	@Override
+	public SetSysConfigResp setSysConfig(@RequestBody SetSysConfigReq req) {
+		String key = req.getKey();
+		String value = req.getValue();
+		sysConfigService.set(key, value);
+
+		SetSysConfigResp resp = new SetSysConfigResp();
+		resp.setKey(key);
+		resp.setValue(value);
+		return resp;
+	}
+
+	@ApiOperation(value = "获取配置")
+	@PostMapping("getSysConfig")
+	@Override
+	public GetSysConfigResp getSysConfig(@RequestBody GetSysConfigReq req) {
+		String key = req.getKey();
+		Object value = sysConfigService.get(key);
+
+		String strValue = null;
+		if (null == value) {
+			strValue = null;
+		} else if (value instanceof Date) {
+			strValue = DateUtil.format((Date) value, DatePatterns.ISO);
+		} else {
+			strValue = String.valueOf(value);
+		}
+
+		GetSysConfigResp resp = new GetSysConfigResp();
+		resp.setKey(key);
+		resp.setValue(strValue);
+		return resp;
+	}
+
+}

+ 290 - 290
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/UserCloudServiceProvider.java

@@ -1,290 +1,290 @@
-package cn.com.qmth.examcloud.core.basic.api.provider;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.persistence.criteria.Predicate;
-import javax.persistence.criteria.Root;
-import javax.persistence.criteria.Subquery;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.transaction.annotation.Transactional;
-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.security.enums.RoleMeta;
-import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
-import cn.com.qmth.examcloud.core.basic.api.UserCloudService;
-import cn.com.qmth.examcloud.core.basic.api.bean.RoleBean;
-import cn.com.qmth.examcloud.core.basic.api.bean.UserBean;
-import cn.com.qmth.examcloud.core.basic.api.request.AddUserReq;
-import cn.com.qmth.examcloud.core.basic.api.request.GetUserListReq;
-import cn.com.qmth.examcloud.core.basic.api.request.GetUserReq;
-import cn.com.qmth.examcloud.core.basic.api.response.AddUserResp;
-import cn.com.qmth.examcloud.core.basic.api.response.GetUserListResp;
-import cn.com.qmth.examcloud.core.basic.api.response.GetUserResp;
-import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
-import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
-import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserRoleRelationRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserRoleRelationEntity;
-import cn.com.qmth.examcloud.core.basic.service.UserService;
-import io.swagger.annotations.ApiOperation;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年7月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Transactional
-@RestController
-@RequestMapping("${$rmp.cloud.basic}" + "user")
-public class UserCloudServiceProvider extends ControllerSupport implements UserCloudService {
-
-	private static final long serialVersionUID = -7881522922704971610L;
-
-	@Autowired
-	UserRepo userRepo;
-
-	@Autowired
-	OrgRepo orgRepo;
-
-	@Autowired
-	RoleRepo roleRepo;
-
-	@Autowired
-	UserService userService;
-
-	@Autowired
-	UserRoleRelationRepo userRoleRelationRepo;
-
-	@ApiOperation(value = "保存用户")
-	@PostMapping("addUser")
-	@Override
-	public AddUserResp addUser(@RequestBody AddUserReq req) {
-		trim(req);
-		Long rootOrgId = req.getRootOrgId();
-		String loginName = req.getLoginName();
-		String name = req.getName();
-
-		UserEntity userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
-
-		if (null != userEntity) {
-			throw new StatusException("B-650001", "用户名已经存在");
-		}
-
-		userEntity = new UserEntity();
-		userEntity.setEnable(true);
-		userEntity.setLoginName(loginName);
-		userEntity.setRootOrgId(rootOrgId);
-		userEntity.setName(name);
-		if (StringUtils.isBlank(req.getPassword())) {
-			userEntity.setPassword(BasicConsts.DEFAULT_PASSWORD);
-		} else {
-			userEntity.setPassword(req.getPassword());
-		}
-
-		UserEntity saved = userService.save(userEntity);
-
-		List<String> roleCodeList = req.getRoleCodeList();
-
-		if (CollectionUtils.isEmpty(roleCodeList)) {
-			throw new StatusException("B-650002", "角色不能为空");
-		}
-
-		List<UserRoleRelationEntity> userRoles = Lists.newArrayList();
-		for (String roleCode : roleCodeList) {
-			RoleEntity roleEntity = roleRepo.findByCodeAndRootOrgIdIsNull(roleCode);
-			if (null == roleEntity) {
-				roleEntity = roleRepo.findByCodeAndRootOrgId(roleCode, rootOrgId);
-			}
-			if (null == roleEntity) {
-				throw new StatusException("B-002002", "role code is wrong. roleCode=" + roleCode);
-			}
-			if (roleEntity.getCode().equals(RoleMeta.SUPER_ADMIN.name())) {
-				throw new StatusException("B-150007", "不允许新增或修改超级管理员");
-			}
-			UserRoleRelationEntity relation = new UserRoleRelationEntity(saved.getId(),
-					roleEntity.getId());
-			userRoles.add(relation);
-		}
-
-		userRoleRelationRepo.deleteByUserId(saved.getId());
-		userRoleRelationRepo.save(userRoles);
-		AddUserResp resp = new AddUserResp();
-		resp.setUserId(saved.getId());
-
-		return resp;
-	}
-
-	@ApiOperation(value = "获取用户")
-	@PostMapping("getUser")
-	@Override
-	public GetUserResp getUser(@RequestBody GetUserReq req) {
-		Long rootOrgId = req.getRootOrgId();
-		String loginName = req.getLoginName();
-		Long userId = req.getUserId();
-
-		UserEntity userEntity = null;
-		if (null != userId) {
-			userEntity = userRepo.findOne(userId);
-		} else if (StringUtils.isNotBlank(loginName)) {
-			userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
-		} else {
-			throw new StatusException("B-230001", "userId and  loginName can not be all null");
-		}
-
-		GetUserResp resp = new GetUserResp();
-		if (null == userEntity) {
-			resp.setExisting(false);
-			return resp;
-		}
-
-		resp.setExisting(true);
-
-		UserBean userBean = new UserBean();
-		userBean.setUserId(userEntity.getId());
-		userBean.setName(userEntity.getName());
-		userBean.setLoginName(userEntity.getLoginName());
-		userBean.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
-		userBean.setOrgId(userEntity.getOrgId());
-		userBean.setRootOrgId(userEntity.getRootOrgId());
-		OrgEntity rootOrg = orgRepo.findOne(userBean.getRootOrgId());
-		userBean.setRootOrgName(rootOrg.getName());
-
-		if (null != userBean.getOrgId()) {
-			OrgEntity org = orgRepo.findOne(userBean.getOrgId());
-			userBean.setOrgName(org.getName());
-		}
-
-		List<RoleBean> roleList = getUserRoles(userEntity.getId());
-		userBean.setRoleList(roleList);
-
-		resp.setUserBean(userBean);
-		return resp;
-	}
-
-	/**
-	 * 获取角色集合
-	 *
-	 * @author WANGWEI
-	 * @param userId
-	 * @return
-	 */
-	private List<RoleBean> getUserRoles(Long userId) {
-		List<UserRoleRelationEntity> relationList = userRoleRelationRepo.findAllByUserId(userId);
-		List<RoleBean> roleList = Lists.newArrayList();
-		if (CollectionUtils.isNotEmpty(relationList)) {
-			for (UserRoleRelationEntity cur : relationList) {
-				Long roleId = cur.getRoleId();
-				RoleEntity roleEntity = roleRepo.findOne(roleId);
-				if (null == roleEntity) {
-					throw new StatusException("B-002002", "roleId wrong. roleId=" + roleId);
-				}
-				RoleBean role = new RoleBean(roleEntity.getRootOrgId(), roleEntity.getId(),
-						roleEntity.getCode(), roleEntity.getName());
-				roleList.add(role);
-			}
-		}
-		return roleList;
-	}
-
-	@ApiOperation(value = "获取用户集合")
-	@PostMapping("getUserList")
-	@Override
-	public GetUserListResp getUserList(@RequestBody GetUserListReq req) {
-		Long rootOrgId = req.getRootOrgId();
-		Long roleId = req.getRoleId();
-		String roleCode = req.getRoleCode();
-
-		if (null != roleId) {
-			RoleEntity roleEntity = roleRepo.findOne(roleId);
-			if (null == roleEntity) {
-				throw new StatusException("B-150001", "角色不存在");
-			}
-		} else if (StringUtils.isNotBlank(roleCode)) {
-			RoleEntity roleEntity = roleRepo.findByCodeAndRootOrgIdIsNull(roleCode.trim());
-			if (null == roleEntity) {
-				roleEntity = roleRepo.findByCodeAndRootOrgId(roleCode.trim(), rootOrgId);
-			}
-			if (null == roleEntity) {
-				throw new StatusException("B-150002", "角色不存在");
-			}
-			roleId = roleEntity.getId();
-		} else {
-			throw new StatusException("B-150003", "roleId,roleCode不能都为空");
-		}
-		final Long finalRoleId = roleId;
-
-		final long start = null == req.getStart() ? 1 : req.getStart();
-
-		Pageable pageable = new PageRequest(0, 100, Sort.Direction.ASC, "id");
-
-		Specification<UserEntity> specification = (root, query, cb) -> {
-			List<Predicate> predicates = new ArrayList<>();
-			predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
-
-			predicates.add(cb.greaterThanOrEqualTo(root.get("id"), start));
-
-			Subquery<UserRoleRelationEntity> subquery = query
-					.subquery(UserRoleRelationEntity.class);
-			Root<UserRoleRelationEntity> subRoot = subquery.from(UserRoleRelationEntity.class);
-			subquery.select(subRoot.get("userId"));
-			Predicate p1 = cb.equal(subRoot.get("roleId"), finalRoleId);
-			Predicate p2 = cb.equal(subRoot.get("userId"), root.get("id"));
-			subquery.where(cb.and(p1, p2));
-			predicates.add(cb.exists(subquery));
-
-			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-
-		Page<UserEntity> page = userRepo.findAll(specification, pageable);
-
-		Iterator<UserEntity> iterator = page.iterator();
-
-		List<UserBean> list = Lists.newArrayList();
-		long next = start;
-		while (iterator.hasNext()) {
-			UserEntity userEntity = iterator.next();
-			UserBean userBean = new UserBean();
-			userBean.setUserId(userEntity.getId());
-			userBean.setName(userEntity.getName());
-			userBean.setLoginName(userEntity.getLoginName());
-			userBean.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
-			userBean.setOrgId(userEntity.getOrgId());
-			userBean.setRootOrgId(userEntity.getRootOrgId());
-
-			next = userEntity.getId();
-			list.add(userBean);
-		}
-
-		GetUserListResp resp = new GetUserListResp();
-		if (next != start) {
-			next++;
-		}
-		resp.setNext(next);
-		resp.setUserBeanList(list);
-
-		return resp;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.api.provider;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.persistence.criteria.Predicate;
+import javax.persistence.criteria.Root;
+import javax.persistence.criteria.Subquery;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Pageable;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.transaction.annotation.Transactional;
+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.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.api.UserCloudService;
+import cn.com.qmth.examcloud.core.basic.api.bean.RoleBean;
+import cn.com.qmth.examcloud.core.basic.api.bean.UserBean;
+import cn.com.qmth.examcloud.core.basic.api.request.AddUserReq;
+import cn.com.qmth.examcloud.core.basic.api.request.GetUserListReq;
+import cn.com.qmth.examcloud.core.basic.api.request.GetUserReq;
+import cn.com.qmth.examcloud.core.basic.api.response.AddUserResp;
+import cn.com.qmth.examcloud.core.basic.api.response.GetUserListResp;
+import cn.com.qmth.examcloud.core.basic.api.response.GetUserResp;
+import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
+import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
+import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
+import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
+import cn.com.qmth.examcloud.core.basic.dao.UserRoleRelationRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.UserRoleRelationEntity;
+import cn.com.qmth.examcloud.core.basic.service.UserService;
+import cn.com.qmth.examcloud.web.security.enums.RoleMeta;
+import cn.com.qmth.examcloud.web.support.ControllerSupport;
+import io.swagger.annotations.ApiOperation;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年7月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Transactional
+@RestController
+@RequestMapping("${$rmp.cloud.basic}" + "user")
+public class UserCloudServiceProvider extends ControllerSupport implements UserCloudService {
+
+	private static final long serialVersionUID = -7881522922704971610L;
+
+	@Autowired
+	UserRepo userRepo;
+
+	@Autowired
+	OrgRepo orgRepo;
+
+	@Autowired
+	RoleRepo roleRepo;
+
+	@Autowired
+	UserService userService;
+
+	@Autowired
+	UserRoleRelationRepo userRoleRelationRepo;
+
+	@ApiOperation(value = "保存用户")
+	@PostMapping("addUser")
+	@Override
+	public AddUserResp addUser(@RequestBody AddUserReq req) {
+		trim(req);
+		Long rootOrgId = req.getRootOrgId();
+		String loginName = req.getLoginName();
+		String name = req.getName();
+
+		UserEntity userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
+
+		if (null != userEntity) {
+			throw new StatusException("B-650001", "用户名已经存在");
+		}
+
+		userEntity = new UserEntity();
+		userEntity.setEnable(true);
+		userEntity.setLoginName(loginName);
+		userEntity.setRootOrgId(rootOrgId);
+		userEntity.setName(name);
+		if (StringUtils.isBlank(req.getPassword())) {
+			userEntity.setPassword(BasicConsts.DEFAULT_PASSWORD);
+		} else {
+			userEntity.setPassword(req.getPassword());
+		}
+
+		UserEntity saved = userService.save(userEntity);
+
+		List<String> roleCodeList = req.getRoleCodeList();
+
+		if (CollectionUtils.isEmpty(roleCodeList)) {
+			throw new StatusException("B-650002", "角色不能为空");
+		}
+
+		List<UserRoleRelationEntity> userRoles = Lists.newArrayList();
+		for (String roleCode : roleCodeList) {
+			RoleEntity roleEntity = roleRepo.findByCodeAndRootOrgIdIsNull(roleCode);
+			if (null == roleEntity) {
+				roleEntity = roleRepo.findByCodeAndRootOrgId(roleCode, rootOrgId);
+			}
+			if (null == roleEntity) {
+				throw new StatusException("B-002002", "role code is wrong. roleCode=" + roleCode);
+			}
+			if (roleEntity.getCode().equals(RoleMeta.SUPER_ADMIN.name())) {
+				throw new StatusException("B-150007", "不允许新增或修改超级管理员");
+			}
+			UserRoleRelationEntity relation = new UserRoleRelationEntity(saved.getId(),
+					roleEntity.getId());
+			userRoles.add(relation);
+		}
+
+		userRoleRelationRepo.deleteByUserId(saved.getId());
+		userRoleRelationRepo.save(userRoles);
+		AddUserResp resp = new AddUserResp();
+		resp.setUserId(saved.getId());
+
+		return resp;
+	}
+
+	@ApiOperation(value = "获取用户")
+	@PostMapping("getUser")
+	@Override
+	public GetUserResp getUser(@RequestBody GetUserReq req) {
+		Long rootOrgId = req.getRootOrgId();
+		String loginName = req.getLoginName();
+		Long userId = req.getUserId();
+
+		UserEntity userEntity = null;
+		if (null != userId) {
+			userEntity = userRepo.findOne(userId);
+		} else if (StringUtils.isNotBlank(loginName)) {
+			userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
+		} else {
+			throw new StatusException("B-230001", "userId and  loginName can not be all null");
+		}
+
+		GetUserResp resp = new GetUserResp();
+		if (null == userEntity) {
+			resp.setExisting(false);
+			return resp;
+		}
+
+		resp.setExisting(true);
+
+		UserBean userBean = new UserBean();
+		userBean.setUserId(userEntity.getId());
+		userBean.setName(userEntity.getName());
+		userBean.setLoginName(userEntity.getLoginName());
+		userBean.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
+		userBean.setOrgId(userEntity.getOrgId());
+		userBean.setRootOrgId(userEntity.getRootOrgId());
+		OrgEntity rootOrg = orgRepo.findOne(userBean.getRootOrgId());
+		userBean.setRootOrgName(rootOrg.getName());
+
+		if (null != userBean.getOrgId()) {
+			OrgEntity org = orgRepo.findOne(userBean.getOrgId());
+			userBean.setOrgName(org.getName());
+		}
+
+		List<RoleBean> roleList = getUserRoles(userEntity.getId());
+		userBean.setRoleList(roleList);
+
+		resp.setUserBean(userBean);
+		return resp;
+	}
+
+	/**
+	 * 获取角色集合
+	 *
+	 * @author WANGWEI
+	 * @param userId
+	 * @return
+	 */
+	private List<RoleBean> getUserRoles(Long userId) {
+		List<UserRoleRelationEntity> relationList = userRoleRelationRepo.findAllByUserId(userId);
+		List<RoleBean> roleList = Lists.newArrayList();
+		if (CollectionUtils.isNotEmpty(relationList)) {
+			for (UserRoleRelationEntity cur : relationList) {
+				Long roleId = cur.getRoleId();
+				RoleEntity roleEntity = roleRepo.findOne(roleId);
+				if (null == roleEntity) {
+					throw new StatusException("B-002002", "roleId wrong. roleId=" + roleId);
+				}
+				RoleBean role = new RoleBean(roleEntity.getRootOrgId(), roleEntity.getId(),
+						roleEntity.getCode(), roleEntity.getName());
+				roleList.add(role);
+			}
+		}
+		return roleList;
+	}
+
+	@ApiOperation(value = "获取用户集合")
+	@PostMapping("getUserList")
+	@Override
+	public GetUserListResp getUserList(@RequestBody GetUserListReq req) {
+		Long rootOrgId = req.getRootOrgId();
+		Long roleId = req.getRoleId();
+		String roleCode = req.getRoleCode();
+
+		if (null != roleId) {
+			RoleEntity roleEntity = roleRepo.findOne(roleId);
+			if (null == roleEntity) {
+				throw new StatusException("B-150001", "角色不存在");
+			}
+		} else if (StringUtils.isNotBlank(roleCode)) {
+			RoleEntity roleEntity = roleRepo.findByCodeAndRootOrgIdIsNull(roleCode.trim());
+			if (null == roleEntity) {
+				roleEntity = roleRepo.findByCodeAndRootOrgId(roleCode.trim(), rootOrgId);
+			}
+			if (null == roleEntity) {
+				throw new StatusException("B-150002", "角色不存在");
+			}
+			roleId = roleEntity.getId();
+		} else {
+			throw new StatusException("B-150003", "roleId,roleCode不能都为空");
+		}
+		final Long finalRoleId = roleId;
+
+		final long start = null == req.getStart() ? 1 : req.getStart();
+
+		Pageable pageable = new PageRequest(0, 100, Sort.Direction.ASC, "id");
+
+		Specification<UserEntity> specification = (root, query, cb) -> {
+			List<Predicate> predicates = new ArrayList<>();
+			predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
+
+			predicates.add(cb.greaterThanOrEqualTo(root.get("id"), start));
+
+			Subquery<UserRoleRelationEntity> subquery = query
+					.subquery(UserRoleRelationEntity.class);
+			Root<UserRoleRelationEntity> subRoot = subquery.from(UserRoleRelationEntity.class);
+			subquery.select(subRoot.get("userId"));
+			Predicate p1 = cb.equal(subRoot.get("roleId"), finalRoleId);
+			Predicate p2 = cb.equal(subRoot.get("userId"), root.get("id"));
+			subquery.where(cb.and(p1, p2));
+			predicates.add(cb.exists(subquery));
+
+			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+		};
+
+		Page<UserEntity> page = userRepo.findAll(specification, pageable);
+
+		Iterator<UserEntity> iterator = page.iterator();
+
+		List<UserBean> list = Lists.newArrayList();
+		long next = start;
+		while (iterator.hasNext()) {
+			UserEntity userEntity = iterator.next();
+			UserBean userBean = new UserBean();
+			userBean.setUserId(userEntity.getId());
+			userBean.setName(userEntity.getName());
+			userBean.setLoginName(userEntity.getLoginName());
+			userBean.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
+			userBean.setOrgId(userEntity.getOrgId());
+			userBean.setRootOrgId(userEntity.getRootOrgId());
+
+			next = userEntity.getId();
+			list.add(userBean);
+		}
+
+		GetUserListResp resp = new GetUserListResp();
+		if (next != start) {
+			next++;
+		}
+		resp.setNext(next);
+		resp.setUserBeanList(list);
+
+		return resp;
+	}
+
+}

+ 67 - 67
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/AppEntity.java

@@ -1,67 +1,67 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 应用
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_APP")
-public class AppEntity extends JpaEntity {
-
-	private static final long serialVersionUID = -6288949236298877031L;
-
-	/**
-	 * 应用ID
-	 */
-	@Id
-	@GeneratedValue
-	private Long id;
-
-	/**
-	 * 应用名称
-	 */
-	@Column(unique = true, nullable = false)
-	private String name;
-
-	/**
-	 * 应用编码
-	 */
-	@Column(unique = true, nullable = false)
-	private String code;
-
-	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 String getCode() {
-		return code;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 应用
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_APP")
+public class AppEntity extends JpaEntity {
+
+	private static final long serialVersionUID = -6288949236298877031L;
+
+	/**
+	 * 应用ID
+	 */
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	/**
+	 * 应用名称
+	 */
+	@Column(unique = true, nullable = false)
+	private String name;
+
+	/**
+	 * 应用编码
+	 */
+	@Column(unique = true, nullable = false)
+	private String code;
+
+	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 String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/CourseEntity.java

@@ -9,8 +9,8 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
 import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * 

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/CourseSpeciatlyRelationEntity.java

@@ -6,7 +6,7 @@ import javax.persistence.Id;
 import javax.persistence.IdClass;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * @Description 专业课程关联

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/ExamSiteEntity.java

@@ -7,7 +7,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * Created by songyue on 17/7/27.

+ 90 - 90
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/FacesetEntity.java

@@ -1,90 +1,90 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * face++ faceset
- *
- * @author WANGWEI
- * @date 2018年9月3日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_FACESET")
-public class FacesetEntity extends JpaEntity {
-
-	private static final long serialVersionUID = -1831392800541099736L;
-
-	@Id
-	@GeneratedValue
-	private Long id;
-
-	@Column(nullable = false, unique = true)
-	private String facesetToken;
-
-	private Long faceCount;
-
-	private String outerId;
-
-	private String displayName;
-
-	private String tags;
-
-	@Column(nullable = false)
-	private Boolean enable;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public String getFacesetToken() {
-		return facesetToken;
-	}
-
-	public void setFacesetToken(String facesetToken) {
-		this.facesetToken = facesetToken;
-	}
-
-	public Long getFaceCount() {
-		return faceCount;
-	}
-
-	public void setFaceCount(Long faceCount) {
-		this.faceCount = faceCount;
-	}
-
-	public String getOuterId() {
-		return outerId;
-	}
-
-	public void setOuterId(String outerId) {
-		this.outerId = outerId;
-	}
-
-	public String getDisplayName() {
-		return displayName;
-	}
-
-	public void setDisplayName(String displayName) {
-		this.displayName = displayName;
-	}
-
-	public String getTags() {
-		return tags;
-	}
-
-	public void setTags(String tags) {
-		this.tags = tags;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * face++ faceset
+ *
+ * @author WANGWEI
+ * @date 2018年9月3日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_FACESET")
+public class FacesetEntity extends JpaEntity {
+
+	private static final long serialVersionUID = -1831392800541099736L;
+
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	@Column(nullable = false, unique = true)
+	private String facesetToken;
+
+	private Long faceCount;
+
+	private String outerId;
+
+	private String displayName;
+
+	private String tags;
+
+	@Column(nullable = false)
+	private Boolean enable;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public String getFacesetToken() {
+		return facesetToken;
+	}
+
+	public void setFacesetToken(String facesetToken) {
+		this.facesetToken = facesetToken;
+	}
+
+	public Long getFaceCount() {
+		return faceCount;
+	}
+
+	public void setFaceCount(Long faceCount) {
+		this.faceCount = faceCount;
+	}
+
+	public String getOuterId() {
+		return outerId;
+	}
+
+	public void setOuterId(String outerId) {
+		this.outerId = outerId;
+	}
+
+	public String getDisplayName() {
+		return displayName;
+	}
+
+	public void setDisplayName(String displayName) {
+		this.displayName = displayName;
+	}
+
+	public String getTags() {
+		return tags;
+	}
+
+	public void setTags(String tags) {
+		this.tags = tags;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/OrgEntity.java

@@ -7,7 +7,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * 顶级机构:parentId is null; id=rootId<br>

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/OrgPropertyEntity.java

@@ -8,7 +8,7 @@ import javax.persistence.Index;
 import javax.persistence.Lob;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * 机构属性配置

+ 248 - 248
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/PrivilegeEntity.java

@@ -1,248 +1,248 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.helpers.tree.TreeNode;
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 权限
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_PRIVILEGE")
-public class PrivilegeEntity extends JpaEntity implements TreeNode {
-
-	private static final long serialVersionUID = -6288949236298877031L;
-
-	/**
-	 * 权限ID
-	 */
-	@Id
-	@GeneratedValue
-	private Long id;
-
-	/**
-	 * 权限码
-	 */
-	@Column(unique = true, nullable = false)
-	private String code;
-
-	/**
-	 * 权限名称
-	 */
-	@Column(unique = false, nullable = false)
-	private String name;
-
-	/**
-	 * 父权限ID
-	 */
-	private Long parentId;
-
-	/**
-	 * 组(权限分组,同一组的权限构成权限树)
-	 */
-	@Column(unique = false, nullable = false)
-	private Long groupId;
-
-	/**
-	 * 描述
-	 */
-	@Column(unique = false, nullable = true)
-	private String description;
-
-	/**
-	 * 权重(越大越靠前)
-	 */
-	@Column(unique = false, nullable = false)
-	private Long weight = 0L;
-
-	/**
-	 * 扩展属性
-	 */
-	@Column(unique = false, nullable = true)
-	private String ext1;
-
-	/**
-	 * 扩展属性
-	 */
-	@Column(unique = false, nullable = true)
-	private String ext2;
-
-	/**
-	 * 扩展属性
-	 */
-	@Column(unique = false, nullable = true)
-	private String ext3;
-
-	/**
-	 * 扩展属性
-	 */
-	@Column(unique = false, nullable = true)
-	private String ext4;
-
-	/**
-	 * 扩展属性
-	 */
-	@Column(unique = false, nullable = true)
-	private String ext5;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	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 Long getParentId() {
-		return parentId;
-	}
-
-	public void setParentId(Long parentId) {
-		this.parentId = parentId;
-	}
-
-	public Long getGroupId() {
-		return groupId;
-	}
-
-	public void setGroupId(Long groupId) {
-		this.groupId = groupId;
-	}
-
-	public String getDescription() {
-		return description;
-	}
-
-	public void setDescription(String description) {
-		this.description = description;
-	}
-
-	public Long getWeight() {
-		return weight;
-	}
-
-	public void setWeight(Long weight) {
-		this.weight = weight;
-	}
-
-	public String getExt1() {
-		return ext1;
-	}
-
-	public void setExt1(String ext1) {
-		this.ext1 = ext1;
-	}
-
-	public String getExt2() {
-		return ext2;
-	}
-
-	public void setExt2(String ext2) {
-		this.ext2 = ext2;
-	}
-
-	public String getExt3() {
-		return ext3;
-	}
-
-	public void setExt3(String ext3) {
-		this.ext3 = ext3;
-	}
-
-	public String getExt4() {
-		return ext4;
-	}
-
-	public void setExt4(String ext4) {
-		this.ext4 = ext4;
-	}
-
-	public String getExt5() {
-		return ext5;
-	}
-
-	public void setExt5(String ext5) {
-		this.ext5 = ext5;
-	}
-
-	@Override
-	public String getNodeId() {
-		if (null == this.id) {
-			return null;
-		}
-		return String.valueOf(this.id);
-	}
-
-	@Override
-	public void setNodeId(String nodeId) {
-		if (null == nodeId) {
-			this.id = null;
-		}
-		this.id = Long.parseLong(nodeId);
-	}
-
-	@Override
-	public String getNodeName() {
-		if (null == this.name) {
-			return null;
-		}
-		return String.valueOf(this.name);
-	}
-
-	@Override
-	public void setNodeName(String nodeName) {
-		this.name = nodeName;
-	}
-
-	@Override
-	public String getParentNodeId() {
-		if (null == this.parentId) {
-			return null;
-		}
-		return String.valueOf(this.parentId);
-	}
-
-	@Override
-	public void setParentNodeId(String parentNodeId) {
-		if (null == parentNodeId) {
-			this.parentId = null;
-		}
-		this.parentId = Long.parseLong(parentNodeId);
-	}
-
-	@Override
-	public String getNodeCode() {
-		return this.code;
-	}
-
-	@Override
-	public void setNodeCode(String code) {
-		this.code = code;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.helpers.tree.TreeNode;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 权限
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_PRIVILEGE")
+public class PrivilegeEntity extends JpaEntity implements TreeNode {
+
+	private static final long serialVersionUID = -6288949236298877031L;
+
+	/**
+	 * 权限ID
+	 */
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	/**
+	 * 权限码
+	 */
+	@Column(unique = true, nullable = false)
+	private String code;
+
+	/**
+	 * 权限名称
+	 */
+	@Column(unique = false, nullable = false)
+	private String name;
+
+	/**
+	 * 父权限ID
+	 */
+	private Long parentId;
+
+	/**
+	 * 组(权限分组,同一组的权限构成权限树)
+	 */
+	@Column(unique = false, nullable = false)
+	private Long groupId;
+
+	/**
+	 * 描述
+	 */
+	@Column(unique = false, nullable = true)
+	private String description;
+
+	/**
+	 * 权重(越大越靠前)
+	 */
+	@Column(unique = false, nullable = false)
+	private Long weight = 0L;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext1;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext2;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext3;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext4;
+
+	/**
+	 * 扩展属性
+	 */
+	@Column(unique = false, nullable = true)
+	private String ext5;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	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 Long getParentId() {
+		return parentId;
+	}
+
+	public void setParentId(Long parentId) {
+		this.parentId = parentId;
+	}
+
+	public Long getGroupId() {
+		return groupId;
+	}
+
+	public void setGroupId(Long groupId) {
+		this.groupId = groupId;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public Long getWeight() {
+		return weight;
+	}
+
+	public void setWeight(Long weight) {
+		this.weight = weight;
+	}
+
+	public String getExt1() {
+		return ext1;
+	}
+
+	public void setExt1(String ext1) {
+		this.ext1 = ext1;
+	}
+
+	public String getExt2() {
+		return ext2;
+	}
+
+	public void setExt2(String ext2) {
+		this.ext2 = ext2;
+	}
+
+	public String getExt3() {
+		return ext3;
+	}
+
+	public void setExt3(String ext3) {
+		this.ext3 = ext3;
+	}
+
+	public String getExt4() {
+		return ext4;
+	}
+
+	public void setExt4(String ext4) {
+		this.ext4 = ext4;
+	}
+
+	public String getExt5() {
+		return ext5;
+	}
+
+	public void setExt5(String ext5) {
+		this.ext5 = ext5;
+	}
+
+	@Override
+	public String getNodeId() {
+		if (null == this.id) {
+			return null;
+		}
+		return String.valueOf(this.id);
+	}
+
+	@Override
+	public void setNodeId(String nodeId) {
+		if (null == nodeId) {
+			this.id = null;
+		}
+		this.id = Long.parseLong(nodeId);
+	}
+
+	@Override
+	public String getNodeName() {
+		if (null == this.name) {
+			return null;
+		}
+		return String.valueOf(this.name);
+	}
+
+	@Override
+	public void setNodeName(String nodeName) {
+		this.name = nodeName;
+	}
+
+	@Override
+	public String getParentNodeId() {
+		if (null == this.parentId) {
+			return null;
+		}
+		return String.valueOf(this.parentId);
+	}
+
+	@Override
+	public void setParentNodeId(String parentNodeId) {
+		if (null == parentNodeId) {
+			this.parentId = null;
+		}
+		this.parentId = Long.parseLong(parentNodeId);
+	}
+
+	@Override
+	public String getNodeCode() {
+		return this.code;
+	}
+
+	@Override
+	public void setNodeCode(String code) {
+		this.code = code;
+	}
+
+}

+ 81 - 81
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/PrivilegeGroupEntity.java

@@ -1,81 +1,81 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 权限组
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_PRIVILEGE_GROUP")
-public class PrivilegeGroupEntity extends JpaEntity {
-
-	private static final long serialVersionUID = -3654724059677675683L;
-
-	/**
-	 * 权限组ID
-	 */
-	@Id
-	@GeneratedValue
-	private Long id;
-
-	/**
-	 * 权限组名称
-	 */
-	@Column(unique = true, nullable = false)
-	private String name;
-
-	/**
-	 * 权限组编码
-	 */
-	@Column(unique = true, nullable = false)
-	private String code;
-
-	/**
-	 * 应用
-	 */
-	@Column(unique = false, nullable = false)
-	private Long appId;
-
-	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 String getCode() {
-		return code;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-	public Long getAppId() {
-		return appId;
-	}
-
-	public void setAppId(Long appId) {
-		this.appId = appId;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 权限组
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_PRIVILEGE_GROUP")
+public class PrivilegeGroupEntity extends JpaEntity {
+
+	private static final long serialVersionUID = -3654724059677675683L;
+
+	/**
+	 * 权限组ID
+	 */
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	/**
+	 * 权限组名称
+	 */
+	@Column(unique = true, nullable = false)
+	private String name;
+
+	/**
+	 * 权限组编码
+	 */
+	@Column(unique = true, nullable = false)
+	private String code;
+
+	/**
+	 * 应用
+	 */
+	@Column(unique = false, nullable = false)
+	private Long appId;
+
+	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 String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public Long getAppId() {
+		return appId;
+	}
+
+	public void setAppId(Long appId) {
+		this.appId = appId;
+	}
+
+}

+ 84 - 84
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/RoleEntity.java

@@ -1,84 +1,84 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 角色
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_ROLE", indexes = {
-		@Index(name = "IDX_B_R_010001", columnList = "rootOrgId,code", unique = true),
-		@Index(name = "IDX_B_R_010002", columnList = "rootOrgId,name", unique = true)})
-public class RoleEntity extends JpaEntity {
-
-	private static final long serialVersionUID = -2167420238674588632L;
-
-	/**
-	 * 角色ID
-	 */
-	@Id
-	@GeneratedValue
-	private Long id;
-
-	/**
-	 * 角色码(全局唯一)
-	 */
-	@Column(unique = true, nullable = false)
-	private String code;
-
-	/**
-	 * 角色名称
-	 */
-	@Column(unique = false, nullable = false)
-	private String name;
-
-	/**
-	 * 顶级机构.为null时,为全局角色
-	 */
-	@Column(nullable = true)
-	private Long rootOrgId;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	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 Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 角色
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_ROLE", indexes = {
+		@Index(name = "IDX_B_R_010001", columnList = "rootOrgId,code", unique = true),
+		@Index(name = "IDX_B_R_010002", columnList = "rootOrgId,name", unique = true)})
+public class RoleEntity extends JpaEntity {
+
+	private static final long serialVersionUID = -2167420238674588632L;
+
+	/**
+	 * 角色ID
+	 */
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	/**
+	 * 角色码(全局唯一)
+	 */
+	@Column(unique = true, nullable = false)
+	private String code;
+
+	/**
+	 * 角色名称
+	 */
+	@Column(unique = false, nullable = false)
+	private String name;
+
+	/**
+	 * 顶级机构.为null时,为全局角色
+	 */
+	@Column(nullable = true)
+	private Long rootOrgId;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	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 Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+}

+ 57 - 57
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/RolePrivilegeRelationEntity.java

@@ -1,57 +1,57 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 角色权限关联
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_ROLE_PRIV_RELATION")
-@IdClass(RolePrivilegeRelationPK.class)
-public class RolePrivilegeRelationEntity extends JpaEntity {
-
-	private static final long serialVersionUID = 8849214483955278647L;
-
-	@Id
-	private Long roleId;
-
-	@Id
-	private Long privilegeId;
-
-	@Id
-	private Long rootOrgId;
-
-	public Long getRoleId() {
-		return roleId;
-	}
-
-	public void setRoleId(Long roleId) {
-		this.roleId = roleId;
-	}
-
-	public Long getPrivilegeId() {
-		return privilegeId;
-	}
-
-	public void setPrivilegeId(Long privilegeId) {
-		this.privilegeId = privilegeId;
-	}
-
-	public Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 角色权限关联
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_ROLE_PRIV_RELATION")
+@IdClass(RolePrivilegeRelationPK.class)
+public class RolePrivilegeRelationEntity extends JpaEntity {
+
+	private static final long serialVersionUID = 8849214483955278647L;
+
+	@Id
+	private Long roleId;
+
+	@Id
+	private Long privilegeId;
+
+	@Id
+	private Long rootOrgId;
+
+	public Long getRoleId() {
+		return roleId;
+	}
+
+	public void setRoleId(Long roleId) {
+		this.roleId = roleId;
+	}
+
+	public Long getPrivilegeId() {
+		return privilegeId;
+	}
+
+	public void setPrivilegeId(Long privilegeId) {
+		this.privilegeId = privilegeId;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/SpecialtyEntity.java

@@ -7,7 +7,7 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * @Description: 专业

+ 168 - 168
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/StudentEntity.java

@@ -1,168 +1,168 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Index;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年8月22日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_STUDENT", indexes = {
-		@Index(name = "IDX_B_S_002001", columnList = "rootOrgId,identityNumber", unique = true),
-		@Index(name = "IDX_B_S_002002", columnList = "rootOrgId,studentCode", unique = true) })
-public class StudentEntity extends JpaEntity {
-
-	private static final long serialVersionUID = 757531976286006550L;
-
-	@Id
-	@GeneratedValue
-	private Long id;
-
-	@Column(nullable = false)
-	private String name;
-
-	@Column(nullable = false)
-	private String password;
-
-	private String studentCode;
-
-	@Column(nullable = false)
-	private String identityNumber;
-
-	private String photoPath;
-
-	private String remark;
-
-	@Column(nullable = false)
-	private Boolean enable;
-
-	private Long orgId;
-
-	@Column(nullable = false)
-	private Long rootOrgId;
-
-	/**
-	 * 手机号码
-	 */
-	private String phoneNumber;
-
-	/**
-	 * 安全手机号码(用于登录)
-	 */
-	@Column(unique = true, nullable = true)
-	private String securityPhone;
-
-	public StudentEntity() {
-	}
-
-	public StudentEntity(Long studentId) {
-		this.id = studentId;
-	}
-
-	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 String getPassword() {
-		return password;
-	}
-
-	public void setPassword(String password) {
-		this.password = password;
-	}
-
-	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 getPhotoPath() {
-		return photoPath;
-	}
-
-	public void setPhotoPath(String photoPath) {
-		this.photoPath = photoPath;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-	public Boolean getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Boolean enable) {
-		this.enable = enable;
-	}
-
-	public Long getOrgId() {
-		return orgId;
-	}
-
-	public void setOrgId(Long orgId) {
-		this.orgId = orgId;
-	}
-
-	public Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public String getPhoneNumber() {
-		return phoneNumber;
-	}
-
-	public void setPhoneNumber(String phoneNumber) {
-		this.phoneNumber = phoneNumber;
-	}
-
-	public String getSecurityPhone() {
-		return securityPhone;
-	}
-
-	public void setSecurityPhone(String securityPhone) {
-		this.securityPhone = securityPhone;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+import javax.persistence.Index;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年8月22日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_STUDENT", indexes = {
+		@Index(name = "IDX_B_S_002001", columnList = "rootOrgId,identityNumber", unique = true),
+		@Index(name = "IDX_B_S_002002", columnList = "rootOrgId,studentCode", unique = true) })
+public class StudentEntity extends JpaEntity {
+
+	private static final long serialVersionUID = 757531976286006550L;
+
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	@Column(nullable = false)
+	private String name;
+
+	@Column(nullable = false)
+	private String password;
+
+	private String studentCode;
+
+	@Column(nullable = false)
+	private String identityNumber;
+
+	private String photoPath;
+
+	private String remark;
+
+	@Column(nullable = false)
+	private Boolean enable;
+
+	private Long orgId;
+
+	@Column(nullable = false)
+	private Long rootOrgId;
+
+	/**
+	 * 手机号码
+	 */
+	private String phoneNumber;
+
+	/**
+	 * 安全手机号码(用于登录)
+	 */
+	@Column(unique = true, nullable = true)
+	private String securityPhone;
+
+	public StudentEntity() {
+	}
+
+	public StudentEntity(Long studentId) {
+		this.id = studentId;
+	}
+
+	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 String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	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 getPhotoPath() {
+		return photoPath;
+	}
+
+	public void setPhotoPath(String photoPath) {
+		this.photoPath = photoPath;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public Boolean getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Boolean enable) {
+		this.enable = enable;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public String getPhoneNumber() {
+		return phoneNumber;
+	}
+
+	public void setPhoneNumber(String phoneNumber) {
+		this.phoneNumber = phoneNumber;
+	}
+
+	public String getSecurityPhone() {
+		return securityPhone;
+	}
+
+	public void setSecurityPhone(String securityPhone) {
+		this.securityPhone = securityPhone;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/StudentFaceEntity.java

@@ -4,7 +4,7 @@ import javax.persistence.Entity;
 import javax.persistence.Id;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * 学生人脸识别信息

+ 71 - 71
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/SysConfigEntity.java

@@ -1,71 +1,71 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.Id;
-import javax.persistence.Lob;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.base.helpers.DataType;
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 系统配置
- *
- * @author WANGWEI
- * @date 2018年12月3日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_SYS_CONF")
-public class SysConfigEntity extends JpaEntity {
-
-	private static final long serialVersionUID = -3688247462533274177L;
-
-	@Id
-	private String propertyKey;
-
-	private String description;
-
-	@Enumerated(EnumType.STRING)
-	@Column(nullable = false)
-	private DataType dataType;
-
-	@Lob
-	private String value;
-
-	public String getPropertyKey() {
-		return propertyKey;
-	}
-
-	public void setPropertyKey(String propertyKey) {
-		this.propertyKey = propertyKey;
-	}
-
-	public String getDescription() {
-		return description;
-	}
-
-	public void setDescription(String description) {
-		this.description = description;
-	}
-
-	public DataType getDataType() {
-		return dataType;
-	}
-
-	public void setDataType(DataType dataType) {
-		this.dataType = dataType;
-	}
-
-	public String getValue() {
-		return value;
-	}
-
-	public void setValue(String value) {
-		this.value = value;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.commons.helpers.DataType;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 系统配置
+ *
+ * @author WANGWEI
+ * @date 2018年12月3日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_SYS_CONF")
+public class SysConfigEntity extends JpaEntity {
+
+	private static final long serialVersionUID = -3688247462533274177L;
+
+	@Id
+	private String propertyKey;
+
+	private String description;
+
+	@Enumerated(EnumType.STRING)
+	@Column(nullable = false)
+	private DataType dataType;
+
+	@Lob
+	private String value;
+
+	public String getPropertyKey() {
+		return propertyKey;
+	}
+
+	public void setPropertyKey(String propertyKey) {
+		this.propertyKey = propertyKey;
+	}
+
+	public String getDescription() {
+		return description;
+	}
+
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	public DataType getDataType() {
+		return dataType;
+	}
+
+	public void setDataType(DataType dataType) {
+		this.dataType = dataType;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/ThirdPartyAccessEntity.java

@@ -5,7 +5,7 @@ import javax.persistence.Id;
 import javax.persistence.IdClass;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * 第三方接入信息

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/UserEntity.java

@@ -9,8 +9,8 @@ import javax.persistence.Id;
 import javax.persistence.Index;
 import javax.persistence.Table;
 
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
 import cn.com.qmth.examcloud.core.basic.dao.enums.Gender;
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
 
 /**
  * Created by songyue on 17/1/13.

+ 57 - 57
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/UserPrivilegeRelationEntity.java

@@ -1,57 +1,57 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 权限
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_USER_PRIV_RELATION")
-@IdClass(UserPrivilegeRelationPK.class)
-public class UserPrivilegeRelationEntity extends JpaEntity {
-
-	private static final long serialVersionUID = -2673489395106849624L;
-
-	@Id
-	private String userType;
-
-	@Id
-	private Long userId;
-
-	@Id
-	private Long privilegeId;
-
-	public String getUserType() {
-		return userType;
-	}
-
-	public void setUserType(String userType) {
-		this.userType = userType;
-	}
-
-	public Long getUserId() {
-		return userId;
-	}
-
-	public void setUserId(Long userId) {
-		this.userId = userId;
-	}
-
-	public Long getPrivilegeId() {
-		return privilegeId;
-	}
-
-	public void setPrivilegeId(Long privilegeId) {
-		this.privilegeId = privilegeId;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 权限
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_USER_PRIV_RELATION")
+@IdClass(UserPrivilegeRelationPK.class)
+public class UserPrivilegeRelationEntity extends JpaEntity {
+
+	private static final long serialVersionUID = -2673489395106849624L;
+
+	@Id
+	private String userType;
+
+	@Id
+	private Long userId;
+
+	@Id
+	private Long privilegeId;
+
+	public String getUserType() {
+		return userType;
+	}
+
+	public void setUserType(String userType) {
+		this.userType = userType;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+
+	public Long getPrivilegeId() {
+		return privilegeId;
+	}
+
+	public void setPrivilegeId(Long privilegeId) {
+		this.privilegeId = privilegeId;
+	}
+
+}

+ 66 - 66
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/UserRoleRelationEntity.java

@@ -1,66 +1,66 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.IdClass;
-import javax.persistence.Table;
-
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-
-/**
- * 角色
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Entity
-@Table(name = "EC_B_USER_ROLE_RELATION")
-@IdClass(UserRoleRelationPK.class)
-public class UserRoleRelationEntity extends JpaEntity {
-
-	private static final long serialVersionUID = 5623631699393069659L;
-
-	@Id
-	private Long userId;
-
-	@Id
-	private Long roleId;
-
-	/**
-	 * 构造函数
-	 *
-	 */
-	public UserRoleRelationEntity() {
-		super();
-	}
-
-	/**
-	 * 构造函数
-	 *
-	 * @param userId
-	 * @param roleId
-	 */
-	public UserRoleRelationEntity(Long userId, Long roleId) {
-		super();
-		this.userId = userId;
-		this.roleId = roleId;
-	}
-
-	public Long getUserId() {
-		return userId;
-	}
-
-	public void setUserId(Long userId) {
-		this.userId = userId;
-	}
-
-	public Long getRoleId() {
-		return roleId;
-	}
-
-	public void setRoleId(Long roleId) {
-		this.roleId = roleId;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.dao.entity;
+
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.web.jpa.JpaEntity;
+
+/**
+ * 角色
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_USER_ROLE_RELATION")
+@IdClass(UserRoleRelationPK.class)
+public class UserRoleRelationEntity extends JpaEntity {
+
+	private static final long serialVersionUID = 5623631699393069659L;
+
+	@Id
+	private Long userId;
+
+	@Id
+	private Long roleId;
+
+	/**
+	 * 构造函数
+	 *
+	 */
+	public UserRoleRelationEntity() {
+		super();
+	}
+
+	/**
+	 * 构造函数
+	 *
+	 * @param userId
+	 * @param roleId
+	 */
+	public UserRoleRelationEntity(Long userId, Long roleId) {
+		super();
+		this.userId = userId;
+		this.roleId = roleId;
+	}
+
+	public Long getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Long userId) {
+		this.userId = userId;
+	}
+
+	public Long getRoleId() {
+		return roleId;
+	}
+
+	public void setRoleId(Long roleId) {
+		this.roleId = roleId;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/enums/CourseLevel.java

@@ -1,6 +1,6 @@
 package cn.com.qmth.examcloud.core.basic.dao.enums;
 
-import cn.com.qmth.examcloud.commons.base.exception.ExamCloudRuntimeException;
+import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
 
 /**
  * 重新定义

+ 34 - 34
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/enums/OrgProperty.java

@@ -1,34 +1,34 @@
-package cn.com.qmth.examcloud.core.basic.dao.enums;
-
-import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnumManager;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年8月22日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class OrgProperty {
-
-	private static DynamicEnumManager manager;
-
-	/**
-	 * 启动初始化
-	 *
-	 * @author WANGWEI
-	 */
-	public static void init() {
-		manager = DynamicEnumManager.newInstance("org-properties.xml");
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @return
-	 */
-	public static DynamicEnumManager getDynamicEnumManager() {
-		return manager;
-	}
-}
+package cn.com.qmth.examcloud.core.basic.dao.enums;
+
+import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年8月22日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class OrgProperty {
+
+	private static DynamicEnumManager manager;
+
+	/**
+	 * 启动初始化
+	 *
+	 * @author WANGWEI
+	 */
+	public static void init() {
+		manager = DynamicEnumManager.newInstance("org-properties.xml");
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @return
+	 */
+	public static DynamicEnumManager getDynamicEnumManager() {
+		return manager;
+	}
+}

+ 59 - 59
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/AuthService.java

@@ -1,59 +1,59 @@
-package cn.com.qmth.examcloud.core.basic.service;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
-
-/**
- * 鉴权
- *
- * @author WANGWEI
- * @date 2018年5月25日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public interface AuthService {
-
-	/**
-	 * 登录
-	 *
-	 * @author WANGWEI
-	 * @param loginInfo
-	 * @return
-	 */
-	User login(LoginInfo loginInfo);
-
-	/**
-	 * 登出
-	 *
-	 * @author WANGWEI
-	 * @param user
-	 */
-	void logout(User user);
-
-	/**
-	 * 获取登录用户
-	 *
-	 * @author WANGWEI
-	 * @param key
-	 * @param token
-	 * @return
-	 */
-	User getLoginUser(String key, String token);
-
-	/**
-	 * 第三方登陆名接入
-	 *
-	 * @author WANGWEI
-	 * @param rootOrgId
-	 * @param loginName
-	 * @param appId
-	 * @param timestamp
-	 * @param token
-	 * @param clientIp
-	 * @return
-	 * @throws StatusException
-	 */
-	User thirdPartyAccess(Long rootOrgId, String loginName, String appId, String timestamp, String token,
-			String clientIp) throws StatusException;
-
-}
+package cn.com.qmth.examcloud.core.basic.service;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
+import cn.com.qmth.examcloud.web.security.bean.User;
+
+/**
+ * 鉴权
+ *
+ * @author WANGWEI
+ * @date 2018年5月25日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public interface AuthService {
+
+	/**
+	 * 登录
+	 *
+	 * @author WANGWEI
+	 * @param loginInfo
+	 * @return
+	 */
+	User login(LoginInfo loginInfo);
+
+	/**
+	 * 登出
+	 *
+	 * @author WANGWEI
+	 * @param user
+	 */
+	void logout(User user);
+
+	/**
+	 * 获取登录用户
+	 *
+	 * @author WANGWEI
+	 * @param key
+	 * @param token
+	 * @return
+	 */
+	User getLoginUser(String key, String token);
+
+	/**
+	 * 第三方登陆名接入
+	 *
+	 * @author WANGWEI
+	 * @param rootOrgId
+	 * @param loginName
+	 * @param appId
+	 * @param timestamp
+	 * @param token
+	 * @param clientIp
+	 * @return
+	 * @throws StatusException
+	 */
+	User thirdPartyAccess(Long rootOrgId, String loginName, String appId, String timestamp, String token,
+			String clientIp) throws StatusException;
+
+}

+ 1 - 1
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/CourseInfo.java

@@ -1,7 +1,7 @@
 package cn.com.qmth.examcloud.core.basic.service.bean;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
 import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 /**
  * 类注释

+ 115 - 115
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/ExamSiteInfo.java

@@ -1,115 +1,115 @@
-package cn.com.qmth.examcloud.core.basic.service.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年8月31日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class ExamSiteInfo implements JsonSerializable {
-
-	private static final long serialVersionUID = 1353662143659247163L;
-
-	private Long id;
-
-	private Long rootOrgId;
-
-	private Long orgId;
-
-	private String code;
-
-	private String name;
-
-	private Boolean enable;
-
-	/**
-	 * 联系电话
-	 */
-	private String telephone;
-
-	/**
-	 * 联系人
-	 */
-	private String contacts;
-
-	/**
-	 * 备注
-	 */
-	private String remark;
-
-	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 Long getOrgId() {
-		return orgId;
-	}
-
-	public void setOrgId(Long orgId) {
-		this.orgId = orgId;
-	}
-
-	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 Boolean getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Boolean enable) {
-		this.enable = enable;
-	}
-
-	public String getTelephone() {
-		return telephone;
-	}
-
-	public void setTelephone(String telephone) {
-		this.telephone = telephone;
-	}
-
-	public String getContacts() {
-		return contacts;
-	}
-
-	public void setContacts(String contacts) {
-		this.contacts = contacts;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年8月31日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class ExamSiteInfo implements JsonSerializable {
+
+	private static final long serialVersionUID = 1353662143659247163L;
+
+	private Long id;
+
+	private Long rootOrgId;
+
+	private Long orgId;
+
+	private String code;
+
+	private String name;
+
+	private Boolean enable;
+
+	/**
+	 * 联系电话
+	 */
+	private String telephone;
+
+	/**
+	 * 联系人
+	 */
+	private String contacts;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	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 Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	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 Boolean getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Boolean enable) {
+		this.enable = enable;
+	}
+
+	public String getTelephone() {
+		return telephone;
+	}
+
+	public void setTelephone(String telephone) {
+		this.telephone = telephone;
+	}
+
+	public String getContacts() {
+		return contacts;
+	}
+
+	public void setContacts(String contacts) {
+		this.contacts = contacts;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+}

+ 145 - 145
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/LoginInfo.java

@@ -1,145 +1,145 @@
-package cn.com.qmth.examcloud.core.basic.service.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 登陆信息
- * 
- * @author WANGWEI
- *
- */
-public class LoginInfo implements JsonSerializable {
-
-	private static final long serialVersionUID = 1305354276321732681L;
-
-	/**
-	 * 会话ID
-	 */
-	private String sessionId;
-
-	/**
-	 * 顶级机构ID
-	 */
-	private Long rootOrgId;
-
-	/**
-	 * 域名
-	 */
-	private String domain;
-
-	/**
-	 * 登陆账号类型
-	 */
-	private String accountType;
-
-	/**
-	 * 登陆账号值
-	 */
-	private String accountValue;
-
-	/**
-	 * 密码
-	 */
-	private String password;
-
-	/**
-	 * 短信验证码
-	 */
-	private String smsCode;
-
-	/**
-	 * 图片验证码
-	 */
-	private String imgCode;
-
-	/**
-	 * 客户端IP
-	 */
-	private String clientIp;
-
-	/**
-	 * 响应码总是200
-	 */
-	private Boolean alwaysOK;
-
-	public String getSessionId() {
-		return sessionId;
-	}
-
-	public void setSessionId(String sessionId) {
-		this.sessionId = sessionId;
-	}
-
-	public Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public String getDomain() {
-		return domain;
-	}
-
-	public void setDomain(String domain) {
-		this.domain = domain;
-	}
-
-	public String getAccountType() {
-		return accountType;
-	}
-
-	public void setAccountType(String accountType) {
-		this.accountType = accountType;
-	}
-
-	public String getAccountValue() {
-		return accountValue;
-	}
-
-	public void setAccountValue(String accountValue) {
-		this.accountValue = accountValue;
-	}
-
-	public String getPassword() {
-		return password;
-	}
-
-	public void setPassword(String password) {
-		this.password = password;
-	}
-
-	public String getClientIp() {
-		return clientIp;
-	}
-
-	public void setClientIp(String clientIp) {
-		this.clientIp = clientIp;
-	}
-
-	public Boolean getAlwaysOK() {
-		return alwaysOK;
-	}
-
-	public void setAlwaysOK(Boolean alwaysOK) {
-		this.alwaysOK = alwaysOK;
-	}
-
-	public String getSmsCode() {
-		return smsCode;
-	}
-
-	public void setSmsCode(String smsCode) {
-		this.smsCode = smsCode;
-	}
-
-	public String getImgCode() {
-		return imgCode;
-	}
-
-	public void setImgCode(String imgCode) {
-		this.imgCode = imgCode;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 登陆信息
+ * 
+ * @author WANGWEI
+ *
+ */
+public class LoginInfo implements JsonSerializable {
+
+	private static final long serialVersionUID = 1305354276321732681L;
+
+	/**
+	 * 会话ID
+	 */
+	private String sessionId;
+
+	/**
+	 * 顶级机构ID
+	 */
+	private Long rootOrgId;
+
+	/**
+	 * 域名
+	 */
+	private String domain;
+
+	/**
+	 * 登陆账号类型
+	 */
+	private String accountType;
+
+	/**
+	 * 登陆账号值
+	 */
+	private String accountValue;
+
+	/**
+	 * 密码
+	 */
+	private String password;
+
+	/**
+	 * 短信验证码
+	 */
+	private String smsCode;
+
+	/**
+	 * 图片验证码
+	 */
+	private String imgCode;
+
+	/**
+	 * 客户端IP
+	 */
+	private String clientIp;
+
+	/**
+	 * 响应码总是200
+	 */
+	private Boolean alwaysOK;
+
+	public String getSessionId() {
+		return sessionId;
+	}
+
+	public void setSessionId(String sessionId) {
+		this.sessionId = sessionId;
+	}
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public String getDomain() {
+		return domain;
+	}
+
+	public void setDomain(String domain) {
+		this.domain = domain;
+	}
+
+	public String getAccountType() {
+		return accountType;
+	}
+
+	public void setAccountType(String accountType) {
+		this.accountType = accountType;
+	}
+
+	public String getAccountValue() {
+		return accountValue;
+	}
+
+	public void setAccountValue(String accountValue) {
+		this.accountValue = accountValue;
+	}
+
+	public String getPassword() {
+		return password;
+	}
+
+	public void setPassword(String password) {
+		this.password = password;
+	}
+
+	public String getClientIp() {
+		return clientIp;
+	}
+
+	public void setClientIp(String clientIp) {
+		this.clientIp = clientIp;
+	}
+
+	public Boolean getAlwaysOK() {
+		return alwaysOK;
+	}
+
+	public void setAlwaysOK(Boolean alwaysOK) {
+		this.alwaysOK = alwaysOK;
+	}
+
+	public String getSmsCode() {
+		return smsCode;
+	}
+
+	public void setSmsCode(String smsCode) {
+		this.smsCode = smsCode;
+	}
+
+	public String getImgCode() {
+		return imgCode;
+	}
+
+	public void setImgCode(String imgCode) {
+		this.imgCode = imgCode;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/OrgInfo.java

@@ -2,7 +2,7 @@ package cn.com.qmth.examcloud.core.basic.service.bean;
 
 import java.util.Map;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 /**
  * 类注释

+ 68 - 68
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/RoleInfo.java

@@ -1,68 +1,68 @@
-package cn.com.qmth.examcloud.core.basic.service.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 角色
- *
- * @author WANGWEI
- * @date 2018年5月23日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class RoleInfo implements JsonSerializable {
-
-	private static final long serialVersionUID = -2167420238674588632L;
-
-	/**
-	 * 角色ID
-	 */
-	private Long id;
-
-	/**
-	 * 角色码
-	 */
-	private String code;
-
-	/**
-	 * 角色名称
-	 */
-	private String name;
-
-	/**
-	 * 顶级机构.为null时,为全局角色
-	 */
-	private Long rootOrgId;
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	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 Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 角色
+ *
+ * @author WANGWEI
+ * @date 2018年5月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class RoleInfo implements JsonSerializable {
+
+	private static final long serialVersionUID = -2167420238674588632L;
+
+	/**
+	 * 角色ID
+	 */
+	private Long id;
+
+	/**
+	 * 角色码
+	 */
+	private String code;
+
+	/**
+	 * 角色名称
+	 */
+	private String name;
+
+	/**
+	 * 顶级机构.为null时,为全局角色
+	 */
+	private Long rootOrgId;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	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 Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+}

+ 1 - 1
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/SpecialtyInfo.java

@@ -1,6 +1,6 @@
 package cn.com.qmth.examcloud.core.basic.service.bean;
 
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
 
 public class SpecialtyInfo implements JsonSerializable {
 

+ 86 - 86
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/StudentFaceInfo.java

@@ -1,86 +1,86 @@
-package cn.com.qmth.examcloud.core.basic.service.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年9月3日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class StudentFaceInfo implements JsonSerializable {
-
-	private static final long serialVersionUID = -4210571202590959124L;
-
-	private Long rootOrgId;
-
-	private Long studentId;
-
-	private String faceToken;
-
-	private String facesetToken;
-
-	private String photoName;
-
-	private String operator;
-
-	private Long faceCount;
-
-	public Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public Long getStudentId() {
-		return studentId;
-	}
-
-	public void setStudentId(Long studentId) {
-		this.studentId = studentId;
-	}
-
-	public String getFaceToken() {
-		return faceToken;
-	}
-
-	public void setFaceToken(String faceToken) {
-		this.faceToken = faceToken;
-	}
-
-	public String getFacesetToken() {
-		return facesetToken;
-	}
-
-	public void setFacesetToken(String facesetToken) {
-		this.facesetToken = facesetToken;
-	}
-
-	public String getPhotoName() {
-		return photoName;
-	}
-
-	public void setPhotoName(String photoName) {
-		this.photoName = photoName;
-	}
-
-	public String getOperator() {
-		return operator;
-	}
-
-	public void setOperator(String operator) {
-		this.operator = operator;
-	}
-
-	public Long getFaceCount() {
-		return faceCount;
-	}
-
-	public void setFaceCount(Long faceCount) {
-		this.faceCount = faceCount;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年9月3日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class StudentFaceInfo implements JsonSerializable {
+
+	private static final long serialVersionUID = -4210571202590959124L;
+
+	private Long rootOrgId;
+
+	private Long studentId;
+
+	private String faceToken;
+
+	private String facesetToken;
+
+	private String photoName;
+
+	private String operator;
+
+	private Long faceCount;
+
+	public Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public Long getStudentId() {
+		return studentId;
+	}
+
+	public void setStudentId(Long studentId) {
+		this.studentId = studentId;
+	}
+
+	public String getFaceToken() {
+		return faceToken;
+	}
+
+	public void setFaceToken(String faceToken) {
+		this.faceToken = faceToken;
+	}
+
+	public String getFacesetToken() {
+		return facesetToken;
+	}
+
+	public void setFacesetToken(String facesetToken) {
+		this.facesetToken = facesetToken;
+	}
+
+	public String getPhotoName() {
+		return photoName;
+	}
+
+	public void setPhotoName(String photoName) {
+		this.photoName = photoName;
+	}
+
+	public String getOperator() {
+		return operator;
+	}
+
+	public void setOperator(String operator) {
+		this.operator = operator;
+	}
+
+	public Long getFaceCount() {
+		return faceCount;
+	}
+
+	public void setFaceCount(Long faceCount) {
+		this.faceCount = faceCount;
+	}
+
+}

+ 198 - 198
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/bean/StudentInfo.java

@@ -1,198 +1,198 @@
-package cn.com.qmth.examcloud.core.basic.service.bean;
-
-import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年6月29日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-public class StudentInfo implements JsonSerializable {
-
-	private static final long serialVersionUID = 5341258253620314306L;
-
-	/**
-	 * 学生ID
-	 */
-	private Long id;
-
-	/**
-	 * 学生姓名
-	 */
-	private String name;
-
-	/**
-	 * 顶级机构ID
-	 */
-	private Long rootOrgId;
-
-	/**
-	 * 顶级机构名称
-	 */
-	private String rootOrgName;
-
-	/**
-	 * 机构ID
-	 */
-	private Long orgId;
-
-	/**
-	 * 学习中心编码
-	 */
-	private String orgCode;
-
-	/**
-	 * 学习中心名称
-	 */
-	private String orgName;
-
-	/**
-	 * 学生code
-	 */
-	private String studentCode;
-
-	/**
-	 * 身份证号码
-	 */
-	private String identityNumber;
-
-	/**
-	 * 备注
-	 */
-	private String remark;
-
-	/**
-	 * 图片地址
-	 */
-	private String photoPath;
-
-	/**
-	 * 手机号码
-	 */
-	private String phoneNumber;
-
-	/**
-	 * 是否可用
-	 */
-	private Boolean enable;
-
-	/**
-	 * 安全手机号码(用于登录)
-	 */
-	private String securityPhone;
-
-	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 Long getRootOrgId() {
-		return rootOrgId;
-	}
-
-	public void setRootOrgId(Long rootOrgId) {
-		this.rootOrgId = rootOrgId;
-	}
-
-	public String getRootOrgName() {
-		return rootOrgName;
-	}
-
-	public void setRootOrgName(String rootOrgName) {
-		this.rootOrgName = rootOrgName;
-	}
-
-	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 getOrgName() {
-		return orgName;
-	}
-
-	public void setOrgName(String orgName) {
-		this.orgName = orgName;
-	}
-
-	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 getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-	public String getPhotoPath() {
-		return photoPath;
-	}
-
-	public void setPhotoPath(String photoPath) {
-		this.photoPath = photoPath;
-	}
-
-	public String getPhoneNumber() {
-		return phoneNumber;
-	}
-
-	public void setPhoneNumber(String phoneNumber) {
-		this.phoneNumber = phoneNumber;
-	}
-
-	public Boolean getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Boolean enable) {
-		this.enable = enable;
-	}
-
-	public String getSecurityPhone() {
-		return securityPhone;
-	}
-
-	public void setSecurityPhone(String securityPhone) {
-		this.securityPhone = securityPhone;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.bean;
+
+import cn.com.qmth.examcloud.web.cloud.api.JsonSerializable;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年6月29日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public class StudentInfo implements JsonSerializable {
+
+	private static final long serialVersionUID = 5341258253620314306L;
+
+	/**
+	 * 学生ID
+	 */
+	private Long id;
+
+	/**
+	 * 学生姓名
+	 */
+	private String name;
+
+	/**
+	 * 顶级机构ID
+	 */
+	private Long rootOrgId;
+
+	/**
+	 * 顶级机构名称
+	 */
+	private String rootOrgName;
+
+	/**
+	 * 机构ID
+	 */
+	private Long orgId;
+
+	/**
+	 * 学习中心编码
+	 */
+	private String orgCode;
+
+	/**
+	 * 学习中心名称
+	 */
+	private String orgName;
+
+	/**
+	 * 学生code
+	 */
+	private String studentCode;
+
+	/**
+	 * 身份证号码
+	 */
+	private String identityNumber;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	/**
+	 * 图片地址
+	 */
+	private String photoPath;
+
+	/**
+	 * 手机号码
+	 */
+	private String phoneNumber;
+
+	/**
+	 * 是否可用
+	 */
+	private Boolean enable;
+
+	/**
+	 * 安全手机号码(用于登录)
+	 */
+	private String securityPhone;
+
+	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 Long getRootOrgId() {
+		return rootOrgId;
+	}
+
+	public void setRootOrgId(Long rootOrgId) {
+		this.rootOrgId = rootOrgId;
+	}
+
+	public String getRootOrgName() {
+		return rootOrgName;
+	}
+
+	public void setRootOrgName(String rootOrgName) {
+		this.rootOrgName = rootOrgName;
+	}
+
+	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 getOrgName() {
+		return orgName;
+	}
+
+	public void setOrgName(String orgName) {
+		this.orgName = orgName;
+	}
+
+	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 getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public String getPhotoPath() {
+		return photoPath;
+	}
+
+	public void setPhotoPath(String photoPath) {
+		this.photoPath = photoPath;
+	}
+
+	public String getPhoneNumber() {
+		return phoneNumber;
+	}
+
+	public void setPhoneNumber(String phoneNumber) {
+		this.phoneNumber = phoneNumber;
+	}
+
+	public Boolean getEnable() {
+		return enable;
+	}
+
+	public void setEnable(Boolean enable) {
+		this.enable = enable;
+	}
+
+	public String getSecurityPhone() {
+		return securityPhone;
+	}
+
+	public void setSecurityPhone(String securityPhone) {
+		this.securityPhone = securityPhone;
+	}
+
+}

+ 625 - 625
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/AuthServiceImpl.java

@@ -1,625 +1,625 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Sets;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.util.ByteUtil;
-import cn.com.qmth.examcloud.commons.base.util.JsonUtil;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.commons.base.util.SHA256;
-import cn.com.qmth.examcloud.commons.base.util.StringUtil;
-import cn.com.qmth.examcloud.commons.base.util.UUID;
-import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
-import cn.com.qmth.examcloud.commons.web.security.bean.Role;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.security.bean.UserType;
-import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
-import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
-import cn.com.qmth.examcloud.core.basic.base.enums.AccountType;
-import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
-import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
-import cn.com.qmth.examcloud.core.basic.dao.RolePrivilegeRelationRepo;
-import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
-import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
-import cn.com.qmth.examcloud.core.basic.dao.ThirdPartyAccessRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserRoleRelationRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessPK;
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserRoleRelationEntity;
-import cn.com.qmth.examcloud.core.basic.service.AuthService;
-import cn.com.qmth.examcloud.core.basic.service.SmsCodeService;
-import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
-import cn.com.qmth.examcloud.core.basic.service.UserService;
-import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年5月25日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Service
-public class AuthServiceImpl implements AuthService {
-
-	@Autowired
-	RedisClient redisClient;
-
-	@Autowired
-	UserService userService;
-
-	@Autowired
-	UserRepo userRepo;
-
-	@Autowired
-	OrgRepo orgRepo;
-
-	@Autowired
-	RoleRepo roleRepo;
-
-	@Autowired
-	StudentRepo studentRepo;
-
-	@Autowired
-	ThirdPartyAccessRepo thirdPartyAccessRepo;
-
-	@Autowired
-	UserRoleRelationRepo userRoleRelationRepo;
-
-	@Autowired
-	RolePrivilegeRelationRepo rolePrivilegeRelationRepo;
-
-	@Autowired
-	PrivilegeRepo privilegeRepo;
-
-	@Autowired
-	SysConfigService sysConfigService;
-
-	@Autowired
-	SmsCodeService smsCodeService;
-
-	@Override
-	public User login(LoginInfo loginInfo) {
-
-		String accountType = loginInfo.getAccountType();
-		String accountValue = loginInfo.getAccountValue();
-		String password = loginInfo.getPassword();
-		String clientIp = loginInfo.getClientIp();
-		String smsCode = loginInfo.getSmsCode();
-		String sessionId = loginInfo.getSessionId();
-		String imgCode = loginInfo.getImgCode();
-
-		if (StringUtils.isBlank(accountType)) {
-			throw new StatusException("B-001201", "accountType is null");
-		}
-		if (StringUtils.isBlank(accountValue)) {
-			throw new StatusException("B-001202", "accountValue is null");
-		}
-
-		AccountType accountTypeEnum = null;
-		try {
-			accountTypeEnum = AccountType.valueOf(accountType);
-		} catch (Exception e) {
-			throw new StatusException("B-001204", "accountType is wrong");
-		}
-
-		// 系统级别登陆限制
-		if (AccountType.STUDENT_PHONE.equals(accountTypeEnum)
-				|| AccountType.STUDENT_IDENTITY_NUMBER.equals(accountTypeEnum)
-				|| AccountType.STUDENT_CODE.equals(accountTypeEnum)) {
-			Boolean stuClientLoginLimit = (Boolean) sysConfigService.get("STU_CLIENT_LOGIN_LIMIT");
-			if (stuClientLoginLimit) {
-				throw new StatusException("B-001505", "系统维护中... ...");
-			}
-		} else if (AccountType.COMMON_LOGIN_NAME.equals(accountTypeEnum)) {
-			Boolean commonLoginLimit = (Boolean) sysConfigService.get("COMMON_LOGIN_LIMIT");
-			if (commonLoginLimit) {
-				throw new StatusException("B-001506", "系统维护中... ...");
-			}
-		}
-
-		Integer errorTimes = getLoginErrorTimes(accountTypeEnum, accountValue, clientIp);
-		if (StringUtils.isNotBlank(sessionId) && StringUtils.isNotBlank(imgCode)) {
-			String rightImgCode = redisClient.get("$_IMG_" + sessionId, String.class);
-			if (null == rightImgCode || !rightImgCode.equalsIgnoreCase(imgCode)) {
-				throw new StatusException("B-002303", "验证码错误");
-			}
-		} else if (5 < errorTimes) {
-			throw new StatusException("B-001205", "登陆失败次数已达到上限,请5分钟后重试");
-		}
-
-		StudentEntity student = null;
-
-		if (AccountType.STUDENT_PHONE.equals(accountTypeEnum)) {
-			student = studentRepo.findBySecurityPhone(accountValue);
-			if (null == student) {
-				throw new StatusException("B-001110", "学生不存在");
-			}
-			loginInfo.setRootOrgId(student.getRootOrgId());
-		}
-
-		Long rootOrgId = loginInfo.getRootOrgId();
-		OrgEntity rootOrg = null;
-		if (null == rootOrgId) {
-			if (StringUtils.isBlank(loginInfo.getDomain())) {
-				throw new StatusException("B-001001", "domain,rootOrgId 必须有一个不为空");
-			}
-
-			try {
-				rootOrg = orgRepo.findByParentIdIsNullAndDomainName(loginInfo.getDomain());
-				rootOrgId = rootOrg.getId();
-			} catch (Exception e) {
-				throw new StatusException("B-001002", "机构不存在", e);
-			}
-
-		} else {
-			rootOrg = orgRepo.findOne(Long.valueOf(rootOrgId));
-			if (null == rootOrg) {
-				throw new StatusException("B-001002", "机构不存在");
-			}
-		}
-
-		String accessibleRootOrgIds = (String) sysConfigService.get("ACCESSIBLE_ROOT_ORG_LIST");
-		if (StringUtils.isNotBlank(accessibleRootOrgIds)) {
-			accessibleRootOrgIds = "," + accessibleRootOrgIds + ",";
-			if (!accessibleRootOrgIds.contains("," + rootOrg.getId() + ",")) {
-				throw new StatusException("B-001101", "系统维护中... ...");
-			}
-		}
-
-		User user = new User();
-		user.setRootOrgId(rootOrg.getId());
-		user.setRootOrgName(rootOrg.getName());
-		Long orgId = null;
-
-		// 常规账户登录
-		if (AccountType.COMMON_LOGIN_NAME.equals(accountTypeEnum)) {
-			UserEntity userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, accountValue);
-			if (null == userEntity) {
-				throw new StatusException("B-001004", "账号或密码错误");
-			}
-			if (null != userEntity.getEnable() && !userEntity.getEnable()) {
-				throw new StatusException("B-001005", "账号被禁用");
-			}
-			if (StringUtils.isBlank(password)) {
-				throw new StatusException("B-001203", "账号或密码错误");
-			}
-
-			user.setUserId(userEntity.getId());
-			user.setUserType(UserType.COMMON);
-			user.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
-			orgId = userEntity.getOrgId();
-
-			List<Role> roleList = getUserRoles(userEntity.getId());
-			user.setRoleList(roleList);
-
-			if (isSuperAdmin(user)) {
-				byte[] bytes = SHA256.encode(userEntity.getLoginName() + password);
-				String encodePassword = ByteUtil.toHexAscii(bytes);
-				if (!encodePassword.equals(userEntity.getPassword())) {
-					whenLoginError(accountTypeEnum, accountValue, clientIp);
-					throw new StatusException("B-001003", "账号或密码错误");
-				}
-			} else {
-				if (!password.equals(userEntity.getPassword())) {
-					whenLoginError(accountTypeEnum, accountValue, clientIp);
-					throw new StatusException("B-001003", "账号或密码错误");
-				}
-			}
-
-		} else {
-			// 学生学号登录
-			if (AccountType.STUDENT_CODE.equals(accountTypeEnum)) {
-				student = studentRepo.findByStudentCodeAndRootOrgId(accountValue, rootOrg.getId());
-			}
-			// 学生身份证号登录
-			else if (AccountType.STUDENT_IDENTITY_NUMBER.equals(accountTypeEnum)) {
-				student = studentRepo.findByIdentityNumberAndRootOrgId(accountValue,
-						rootOrg.getId());
-			}
-
-			if (null == student) {
-				throw new StatusException("B-001110", "账号或密码错误");
-			}
-			if (null != student.getEnable() && !student.getEnable()) {
-				throw new StatusException("B-001005", "账户被禁用");
-			}
-
-			// 验证码登录
-			if (AccountType.STUDENT_PHONE.equals(accountTypeEnum)
-					&& StringUtils.isNotBlank(smsCode)) {
-				try {
-					smsCodeService.checkSmsCode(accountValue, smsCode);
-				} catch (Exception e) {
-					whenLoginError(accountTypeEnum, accountValue, clientIp);
-					throw e;
-				}
-			}
-			// 密码登录
-			else {
-				if (StringUtils.isBlank(password)) {
-					throw new StatusException("B-001203", "账号或密码错误");
-				}
-				String rightPassword = student.getPassword();
-				if (!rightPassword.equals(password)) {
-					whenLoginError(accountTypeEnum, accountValue, clientIp);
-					throw new StatusException("B-001003", "账号或密码错误");
-				}
-			}
-
-			user.setUserId(student.getId());
-			user.setUserType(UserType.STUDENT);
-			user.setDisplayName(student.getName());
-			orgId = student.getOrgId();
-
-			List<Role> roleList = Lists.newArrayList();
-			user.setRoleList(roleList);
-		}
-
-		Boolean smsCodeEnable = PropertiesUtil.getBoolean("$login.admin.smsCode.enable", true);
-		if (smsCodeEnable) {
-			// 超级管理员短信验证
-			if (isSuperAdmin(user)) {
-				String phone = PropertiesUtil.getString("$login.admin.smsCode.phone");
-				// 验证码不为空时,校验验证码
-				if (StringUtils.isNotBlank(smsCode)) {
-					try {
-						smsCodeService.checkSmsCode(phone, smsCode);
-					} catch (Exception e) {
-						whenLoginError(accountTypeEnum, accountValue, clientIp);
-						throw e;
-					}
-				}
-				// 验证码为空时,发送验证码
-				else {
-					smsCodeService.sendSmsCode(phone);
-					throw new StatusException("B-001100", "请输入短信验证码");
-				}
-			}
-		}
-
-		user.setClientIp(loginInfo.getClientIp());
-
-		OrgEntity org = null;
-		if (null != orgId) {
-			org = orgRepo.findOne(orgId);
-		}
-
-		boolean isLcUser = isLcUser(user);
-
-		// 学习中心禁用时,学习中心用户禁止登录
-		if (1 == user.getRoleList().size() && isLcUser) {
-			if (null != org && !org.getEnable()) {
-				throw new StatusException("B-001008", "学习中心被禁用");
-			}
-		}
-
-		setSession(user);
-		setRolePrivilegesCache(user);
-
-		if (isLcUser) {
-			setSecurityIp(user, orgId);
-		}
-
-		return user;
-	}
-
-	/**
-	 * 登陆限制
-	 *
-	 * @author WANGWEI
-	 * @param accountType
-	 * @param accountValue
-	 * @param ip
-	 */
-	private void whenLoginError(AccountType accountType, String accountValue, String ip) {
-		String key = new StringBuilder("$_LOGIN_ERR_").append(accountType.getCode()).append("_")
-				.append(accountValue).append("_").append(ip).toString();
-
-		Integer times = redisClient.get(key, Integer.class);
-		if (null != times) {
-			times++;
-		} else {
-			times = 1;
-		}
-
-		redisClient.set(key, times, 300);
-	}
-
-	/**
-	 * 获取登陆错误次数
-	 *
-	 * @author WANGWEI
-	 * @param accountType
-	 * @param accountValue
-	 * @param ip
-	 * @return
-	 */
-	private Integer getLoginErrorTimes(AccountType accountType, String accountValue, String ip) {
-		String key = new StringBuilder("$_LOGIN_ERR_").append(accountType.getCode()).append("_")
-				.append(accountValue).append("_").append(ip).toString();
-
-		Integer times = redisClient.get(key, Integer.class);
-
-		if (null == times) {
-			times = 0;
-		}
-
-		return times;
-	}
-
-	/**
-	 * 设置角色权限缓存
-	 *
-	 * @author WANGWEI
-	 * @param user
-	 */
-	private void setRolePrivilegesCache(User user) {
-
-		if (!user.getUserType().equals(UserType.COMMON)) {
-			return;
-		}
-		List<Role> roleList = user.getRoleList();
-		Long rootOrgId = user.getRootOrgId();
-		for (Role role : roleList) {
-			Long roleId = role.getRoleId();
-			List<RolePrivilegeRelationEntity> relationList = rolePrivilegeRelationRepo
-					.findAllByRoleIdAndRootOrgId(roleId, rootOrgId);
-
-			StringBuilder sb = new StringBuilder();
-			boolean first = true;
-			for (RolePrivilegeRelationEntity cur : relationList) {
-
-				PrivilegeEntity privilegeEntity = privilegeRepo.findOne(cur.getPrivilegeId());
-				if (first) {
-					sb.append(privilegeEntity.getCode());
-					first = false;
-				} else {
-					sb.append(",").append(privilegeEntity.getCode());
-				}
-			}
-
-			String key = "$_P_" + rootOrgId + "_" + roleId;
-			redisClient.set(key, sb.toString());
-		}
-	}
-
-	/**
-	 * 设置机构安全IP
-	 *
-	 * @author WANGWEI
-	 * @param user
-	 * @param orgId
-	 */
-	private void setSecurityIp(User user, Long orgId) {
-		if (null == orgId) {
-			return;
-		}
-		String key = "IP_" + orgId;
-
-		String clientIp = user.getClientIp();
-		if (StringUtils.isBlank(clientIp)) {
-			return;
-		}
-
-		String value = redisClient.get(key, String.class);
-		Set<String> userKeySet = null;
-		if (null == value) {
-			userKeySet = Sets.newHashSet();
-		} else {
-			@SuppressWarnings("unchecked")
-			Set<String> v = JsonUtil.fromJson(value, Set.class);
-			userKeySet = v;
-		}
-
-		// 数据清洗
-		Set<String> newUserKeySet = Sets.newHashSet();
-		if (10 < userKeySet.size()) {
-			for (String cur : userKeySet) {
-				User curUser = redisClient.get(cur, User.class);
-				if (null != curUser) {
-					newUserKeySet.add(cur);
-				}
-			}
-		}
-
-		newUserKeySet.add(user.getKey());
-		redisClient.set(key, JsonUtil.toJson(newUserKeySet), 3600 * 12);
-	}
-
-	/**
-	 * 是否是学习中心角色
-	 *
-	 * @author WANGWEI
-	 * @param user
-	 * @return
-	 */
-	private boolean isLcUser(User user) {
-		List<Role> roleList = user.getRoleList();
-
-		for (Role role : roleList) {
-			if (role.getRoleCode().equals(RoleMeta.LC_USER.name())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	private boolean isSuperAdmin(User user) {
-		List<Role> roleList = user.getRoleList();
-
-		for (Role role : roleList) {
-			if (role.getRoleCode().equals(RoleMeta.SUPER_ADMIN.name())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	/**
-	 * 构建key
-	 *
-	 * @author WANGWEI
-	 * @param user
-	 * @return
-	 */
-	private String buildUserKey(User user) {
-		Long rootOrgId = user.getRootOrgId();
-		UserType userType = user.getUserType();
-		String key = StringUtil.join("U_", userType.getCode(), "_", rootOrgId, "_",
-				user.getUserId());
-		return key;
-	}
-
-	@Override
-	public void logout(User user) {
-		if (StringUtils.isNotBlank(user.getKey())) {
-			redisClient.delete(user.getKey());
-		} else {
-			String key = buildUserKey(user);
-			redisClient.delete(key);
-		}
-	}
-
-	@Override
-	public User getLoginUser(String key, String token) {
-		int sessionTimeout = PropertiesUtil.getInt(PropKeys.SESSION_TIMEOUT, 3600);
-		User user = redisClient.get(key, User.class, sessionTimeout);
-		if (null == user) {
-			throw new StatusException("B-001012", "未登录");
-		}
-
-		if (!user.getToken().equals(token)) {
-			throw new StatusException("B-001012", "token错误");
-		}
-
-		return user;
-	}
-
-	@Override
-	public User thirdPartyAccess(Long rootOrgId, String loginName, String appId, String timestamp,
-			String token, String clientIp) throws StatusException {
-
-		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
-		if (null == rootOrg) {
-			throw new StatusException("B-001002", "机构不存在");
-		}
-
-		ThirdPartyAccessEntity thirdPartyAccess = thirdPartyAccessRepo
-				.findOne(new ThirdPartyAccessPK(rootOrgId, appId));
-
-		if (null == thirdPartyAccess) {
-			throw new StatusException("B-001201", "第三方系统接入信息未配置");
-		}
-
-		long timestampLong = 0L;
-		try {
-			timestampLong = Long.parseLong(timestamp);
-		} catch (Exception e) {
-			throw new StatusException("B-001202", "timestamp错误");
-		}
-
-		long currentTimeMillis = System.currentTimeMillis();
-		if (Math.abs(currentTimeMillis - timestampLong) > thirdPartyAccess.getTimeRange()) {
-			throw new StatusException("B-001203", "timestamp超出时间差范围");
-		}
-
-		String secretKey = thirdPartyAccess.getSecretKey();
-		String joinStr = StringUtil.join(loginName, rootOrgId, appId, timestamp, secretKey);
-		byte[] bytes = SHA256.encode(joinStr);
-		String hexAscii = ByteUtil.toHexAscii(bytes);
-
-		if (!hexAscii.equalsIgnoreCase(token)) {
-			throw new StatusException("B-001204", "token校验失败");
-		}
-
-		UserEntity userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
-		if (userEntity == null) {
-			throw new StatusException("B-001205", "用户不存在");
-		}
-
-		User user = new User();
-		user.setUserType(UserType.COMMON);
-		user.setUserId(userEntity.getId());
-		user.setDisplayName(userEntity.getLoginName());
-		user.setRootOrgId(userEntity.getRootOrgId());
-
-		List<Role> roleList = getUserRoles(userEntity.getId());
-		user.setRoleList(roleList);
-
-		user.setClientIp(clientIp);
-		setSession(user);
-
-		boolean isLcUser = isLcUser(user);
-
-		if (isLcUser) {
-			setSecurityIp(user, userEntity.getOrgId());
-		}
-
-		return user;
-	}
-
-	/**
-	 * 设置session
-	 *
-	 * @author WANGWEI
-	 * @param user
-	 */
-	private void setSession(User user) {
-		user.setTokenCreationTime(new Date());
-		user.setToken(UUID.randomUUID());
-		String key = buildUserKey(user);
-		user.setKey(key);
-
-		int sessionTimeout = PropertiesUtil.getInt(PropKeys.SESSION_TIMEOUT, 3600);
-		Integer sessionTimeoutCache = redisClient.get("$_SESSION_TIMEOUT", Integer.class);
-		if (null == sessionTimeoutCache || (int) sessionTimeoutCache != sessionTimeout) {
-			redisClient.set("$_SESSION_TIMEOUT", sessionTimeout);
-		}
-
-		redisClient.set(key, user, sessionTimeout);
-	}
-
-	/**
-	 * 获取角色集合
-	 *
-	 * @author WANGWEI
-	 * @param userId
-	 * @return
-	 */
-	private List<Role> getUserRoles(Long userId) {
-		List<UserRoleRelationEntity> relationList = userRoleRelationRepo.findAllByUserId(userId);
-		List<Role> roleList = Lists.newArrayList();
-		if (CollectionUtils.isNotEmpty(relationList)) {
-			for (UserRoleRelationEntity cur : relationList) {
-				Long roleId = cur.getRoleId();
-				RoleEntity roleEntity = roleRepo.findOne(roleId);
-				if (null == roleEntity) {
-					throw new StatusException("B-002002", "roleId is wrong. roleId=" + roleId);
-				}
-				Role role = new Role(roleEntity.getId(), roleEntity.getCode(),
-						roleEntity.getName());
-				roleList.add(role);
-			}
-		}
-		return roleList;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Sets;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.ByteUtil;
+import cn.com.qmth.examcloud.commons.util.JsonUtil;
+import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
+import cn.com.qmth.examcloud.commons.util.SHA256;
+import cn.com.qmth.examcloud.commons.util.StringUtil;
+import cn.com.qmth.examcloud.commons.util.UUID;
+import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
+import cn.com.qmth.examcloud.core.basic.base.enums.AccountType;
+import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
+import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
+import cn.com.qmth.examcloud.core.basic.dao.RolePrivilegeRelationRepo;
+import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
+import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
+import cn.com.qmth.examcloud.core.basic.dao.ThirdPartyAccessRepo;
+import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
+import cn.com.qmth.examcloud.core.basic.dao.UserRoleRelationRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessPK;
+import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.UserRoleRelationEntity;
+import cn.com.qmth.examcloud.core.basic.service.AuthService;
+import cn.com.qmth.examcloud.core.basic.service.SmsCodeService;
+import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
+import cn.com.qmth.examcloud.core.basic.service.UserService;
+import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
+import cn.com.qmth.examcloud.web.redis.RedisClient;
+import cn.com.qmth.examcloud.web.security.bean.Role;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.security.bean.UserType;
+import cn.com.qmth.examcloud.web.security.enums.RoleMeta;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年5月25日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Service
+public class AuthServiceImpl implements AuthService {
+
+	@Autowired
+	RedisClient redisClient;
+
+	@Autowired
+	UserService userService;
+
+	@Autowired
+	UserRepo userRepo;
+
+	@Autowired
+	OrgRepo orgRepo;
+
+	@Autowired
+	RoleRepo roleRepo;
+
+	@Autowired
+	StudentRepo studentRepo;
+
+	@Autowired
+	ThirdPartyAccessRepo thirdPartyAccessRepo;
+
+	@Autowired
+	UserRoleRelationRepo userRoleRelationRepo;
+
+	@Autowired
+	RolePrivilegeRelationRepo rolePrivilegeRelationRepo;
+
+	@Autowired
+	PrivilegeRepo privilegeRepo;
+
+	@Autowired
+	SysConfigService sysConfigService;
+
+	@Autowired
+	SmsCodeService smsCodeService;
+
+	@Override
+	public User login(LoginInfo loginInfo) {
+
+		String accountType = loginInfo.getAccountType();
+		String accountValue = loginInfo.getAccountValue();
+		String password = loginInfo.getPassword();
+		String clientIp = loginInfo.getClientIp();
+		String smsCode = loginInfo.getSmsCode();
+		String sessionId = loginInfo.getSessionId();
+		String imgCode = loginInfo.getImgCode();
+
+		if (StringUtils.isBlank(accountType)) {
+			throw new StatusException("B-001201", "accountType is null");
+		}
+		if (StringUtils.isBlank(accountValue)) {
+			throw new StatusException("B-001202", "accountValue is null");
+		}
+
+		AccountType accountTypeEnum = null;
+		try {
+			accountTypeEnum = AccountType.valueOf(accountType);
+		} catch (Exception e) {
+			throw new StatusException("B-001204", "accountType is wrong");
+		}
+
+		// 系统级别登陆限制
+		if (AccountType.STUDENT_PHONE.equals(accountTypeEnum)
+				|| AccountType.STUDENT_IDENTITY_NUMBER.equals(accountTypeEnum)
+				|| AccountType.STUDENT_CODE.equals(accountTypeEnum)) {
+			Boolean stuClientLoginLimit = (Boolean) sysConfigService.get("STU_CLIENT_LOGIN_LIMIT");
+			if (stuClientLoginLimit) {
+				throw new StatusException("B-001505", "系统维护中... ...");
+			}
+		} else if (AccountType.COMMON_LOGIN_NAME.equals(accountTypeEnum)) {
+			Boolean commonLoginLimit = (Boolean) sysConfigService.get("COMMON_LOGIN_LIMIT");
+			if (commonLoginLimit) {
+				throw new StatusException("B-001506", "系统维护中... ...");
+			}
+		}
+
+		Integer errorTimes = getLoginErrorTimes(accountTypeEnum, accountValue, clientIp);
+		if (StringUtils.isNotBlank(sessionId) && StringUtils.isNotBlank(imgCode)) {
+			String rightImgCode = redisClient.get("$_IMG_" + sessionId, String.class);
+			if (null == rightImgCode || !rightImgCode.equalsIgnoreCase(imgCode)) {
+				throw new StatusException("B-002303", "验证码错误");
+			}
+		} else if (5 < errorTimes) {
+			throw new StatusException("B-001205", "登陆失败次数已达到上限,请5分钟后重试");
+		}
+
+		StudentEntity student = null;
+
+		if (AccountType.STUDENT_PHONE.equals(accountTypeEnum)) {
+			student = studentRepo.findBySecurityPhone(accountValue);
+			if (null == student) {
+				throw new StatusException("B-001110", "学生不存在");
+			}
+			loginInfo.setRootOrgId(student.getRootOrgId());
+		}
+
+		Long rootOrgId = loginInfo.getRootOrgId();
+		OrgEntity rootOrg = null;
+		if (null == rootOrgId) {
+			if (StringUtils.isBlank(loginInfo.getDomain())) {
+				throw new StatusException("B-001001", "domain,rootOrgId 必须有一个不为空");
+			}
+
+			try {
+				rootOrg = orgRepo.findByParentIdIsNullAndDomainName(loginInfo.getDomain());
+				rootOrgId = rootOrg.getId();
+			} catch (Exception e) {
+				throw new StatusException("B-001002", "机构不存在", e);
+			}
+
+		} else {
+			rootOrg = orgRepo.findOne(Long.valueOf(rootOrgId));
+			if (null == rootOrg) {
+				throw new StatusException("B-001002", "机构不存在");
+			}
+		}
+
+		String accessibleRootOrgIds = (String) sysConfigService.get("ACCESSIBLE_ROOT_ORG_LIST");
+		if (StringUtils.isNotBlank(accessibleRootOrgIds)) {
+			accessibleRootOrgIds = "," + accessibleRootOrgIds + ",";
+			if (!accessibleRootOrgIds.contains("," + rootOrg.getId() + ",")) {
+				throw new StatusException("B-001101", "系统维护中... ...");
+			}
+		}
+
+		User user = new User();
+		user.setRootOrgId(rootOrg.getId());
+		user.setRootOrgName(rootOrg.getName());
+		Long orgId = null;
+
+		// 常规账户登录
+		if (AccountType.COMMON_LOGIN_NAME.equals(accountTypeEnum)) {
+			UserEntity userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, accountValue);
+			if (null == userEntity) {
+				throw new StatusException("B-001004", "账号或密码错误");
+			}
+			if (null != userEntity.getEnable() && !userEntity.getEnable()) {
+				throw new StatusException("B-001005", "账号被禁用");
+			}
+			if (StringUtils.isBlank(password)) {
+				throw new StatusException("B-001203", "账号或密码错误");
+			}
+
+			user.setUserId(userEntity.getId());
+			user.setUserType(UserType.COMMON);
+			user.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
+			orgId = userEntity.getOrgId();
+
+			List<Role> roleList = getUserRoles(userEntity.getId());
+			user.setRoleList(roleList);
+
+			if (isSuperAdmin(user)) {
+				byte[] bytes = SHA256.encode(userEntity.getLoginName() + password);
+				String encodePassword = ByteUtil.toHexAscii(bytes);
+				if (!encodePassword.equals(userEntity.getPassword())) {
+					whenLoginError(accountTypeEnum, accountValue, clientIp);
+					throw new StatusException("B-001003", "账号或密码错误");
+				}
+			} else {
+				if (!password.equals(userEntity.getPassword())) {
+					whenLoginError(accountTypeEnum, accountValue, clientIp);
+					throw new StatusException("B-001003", "账号或密码错误");
+				}
+			}
+
+		} else {
+			// 学生学号登录
+			if (AccountType.STUDENT_CODE.equals(accountTypeEnum)) {
+				student = studentRepo.findByStudentCodeAndRootOrgId(accountValue, rootOrg.getId());
+			}
+			// 学生身份证号登录
+			else if (AccountType.STUDENT_IDENTITY_NUMBER.equals(accountTypeEnum)) {
+				student = studentRepo.findByIdentityNumberAndRootOrgId(accountValue,
+						rootOrg.getId());
+			}
+
+			if (null == student) {
+				throw new StatusException("B-001110", "账号或密码错误");
+			}
+			if (null != student.getEnable() && !student.getEnable()) {
+				throw new StatusException("B-001005", "账户被禁用");
+			}
+
+			// 验证码登录
+			if (AccountType.STUDENT_PHONE.equals(accountTypeEnum)
+					&& StringUtils.isNotBlank(smsCode)) {
+				try {
+					smsCodeService.checkSmsCode(accountValue, smsCode);
+				} catch (Exception e) {
+					whenLoginError(accountTypeEnum, accountValue, clientIp);
+					throw e;
+				}
+			}
+			// 密码登录
+			else {
+				if (StringUtils.isBlank(password)) {
+					throw new StatusException("B-001203", "账号或密码错误");
+				}
+				String rightPassword = student.getPassword();
+				if (!rightPassword.equals(password)) {
+					whenLoginError(accountTypeEnum, accountValue, clientIp);
+					throw new StatusException("B-001003", "账号或密码错误");
+				}
+			}
+
+			user.setUserId(student.getId());
+			user.setUserType(UserType.STUDENT);
+			user.setDisplayName(student.getName());
+			orgId = student.getOrgId();
+
+			List<Role> roleList = Lists.newArrayList();
+			user.setRoleList(roleList);
+		}
+
+		Boolean smsCodeEnable = PropertiesUtil.getBoolean("$login.admin.smsCode.enable", true);
+		if (smsCodeEnable) {
+			// 超级管理员短信验证
+			if (isSuperAdmin(user)) {
+				String phone = PropertiesUtil.getString("$login.admin.smsCode.phone");
+				// 验证码不为空时,校验验证码
+				if (StringUtils.isNotBlank(smsCode)) {
+					try {
+						smsCodeService.checkSmsCode(phone, smsCode);
+					} catch (Exception e) {
+						whenLoginError(accountTypeEnum, accountValue, clientIp);
+						throw e;
+					}
+				}
+				// 验证码为空时,发送验证码
+				else {
+					smsCodeService.sendSmsCode(phone);
+					throw new StatusException("B-001100", "请输入短信验证码");
+				}
+			}
+		}
+
+		user.setClientIp(loginInfo.getClientIp());
+
+		OrgEntity org = null;
+		if (null != orgId) {
+			org = orgRepo.findOne(orgId);
+		}
+
+		boolean isLcUser = isLcUser(user);
+
+		// 学习中心禁用时,学习中心用户禁止登录
+		if (1 == user.getRoleList().size() && isLcUser) {
+			if (null != org && !org.getEnable()) {
+				throw new StatusException("B-001008", "学习中心被禁用");
+			}
+		}
+
+		setSession(user);
+		setRolePrivilegesCache(user);
+
+		if (isLcUser) {
+			setSecurityIp(user, orgId);
+		}
+
+		return user;
+	}
+
+	/**
+	 * 登陆限制
+	 *
+	 * @author WANGWEI
+	 * @param accountType
+	 * @param accountValue
+	 * @param ip
+	 */
+	private void whenLoginError(AccountType accountType, String accountValue, String ip) {
+		String key = new StringBuilder("$_LOGIN_ERR_").append(accountType.getCode()).append("_")
+				.append(accountValue).append("_").append(ip).toString();
+
+		Integer times = redisClient.get(key, Integer.class);
+		if (null != times) {
+			times++;
+		} else {
+			times = 1;
+		}
+
+		redisClient.set(key, times, 300);
+	}
+
+	/**
+	 * 获取登陆错误次数
+	 *
+	 * @author WANGWEI
+	 * @param accountType
+	 * @param accountValue
+	 * @param ip
+	 * @return
+	 */
+	private Integer getLoginErrorTimes(AccountType accountType, String accountValue, String ip) {
+		String key = new StringBuilder("$_LOGIN_ERR_").append(accountType.getCode()).append("_")
+				.append(accountValue).append("_").append(ip).toString();
+
+		Integer times = redisClient.get(key, Integer.class);
+
+		if (null == times) {
+			times = 0;
+		}
+
+		return times;
+	}
+
+	/**
+	 * 设置角色权限缓存
+	 *
+	 * @author WANGWEI
+	 * @param user
+	 */
+	private void setRolePrivilegesCache(User user) {
+
+		if (!user.getUserType().equals(UserType.COMMON)) {
+			return;
+		}
+		List<Role> roleList = user.getRoleList();
+		Long rootOrgId = user.getRootOrgId();
+		for (Role role : roleList) {
+			Long roleId = role.getRoleId();
+			List<RolePrivilegeRelationEntity> relationList = rolePrivilegeRelationRepo
+					.findAllByRoleIdAndRootOrgId(roleId, rootOrgId);
+
+			StringBuilder sb = new StringBuilder();
+			boolean first = true;
+			for (RolePrivilegeRelationEntity cur : relationList) {
+
+				PrivilegeEntity privilegeEntity = privilegeRepo.findOne(cur.getPrivilegeId());
+				if (first) {
+					sb.append(privilegeEntity.getCode());
+					first = false;
+				} else {
+					sb.append(",").append(privilegeEntity.getCode());
+				}
+			}
+
+			String key = "$_P_" + rootOrgId + "_" + roleId;
+			redisClient.set(key, sb.toString());
+		}
+	}
+
+	/**
+	 * 设置机构安全IP
+	 *
+	 * @author WANGWEI
+	 * @param user
+	 * @param orgId
+	 */
+	private void setSecurityIp(User user, Long orgId) {
+		if (null == orgId) {
+			return;
+		}
+		String key = "IP_" + orgId;
+
+		String clientIp = user.getClientIp();
+		if (StringUtils.isBlank(clientIp)) {
+			return;
+		}
+
+		String value = redisClient.get(key, String.class);
+		Set<String> userKeySet = null;
+		if (null == value) {
+			userKeySet = Sets.newHashSet();
+		} else {
+			@SuppressWarnings("unchecked")
+			Set<String> v = JsonUtil.fromJson(value, Set.class);
+			userKeySet = v;
+		}
+
+		// 数据清洗
+		Set<String> newUserKeySet = Sets.newHashSet();
+		if (10 < userKeySet.size()) {
+			for (String cur : userKeySet) {
+				User curUser = redisClient.get(cur, User.class);
+				if (null != curUser) {
+					newUserKeySet.add(cur);
+				}
+			}
+		}
+
+		newUserKeySet.add(user.getKey());
+		redisClient.set(key, JsonUtil.toJson(newUserKeySet), 3600 * 12);
+	}
+
+	/**
+	 * 是否是学习中心角色
+	 *
+	 * @author WANGWEI
+	 * @param user
+	 * @return
+	 */
+	private boolean isLcUser(User user) {
+		List<Role> roleList = user.getRoleList();
+
+		for (Role role : roleList) {
+			if (role.getRoleCode().equals(RoleMeta.LC_USER.name())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	private boolean isSuperAdmin(User user) {
+		List<Role> roleList = user.getRoleList();
+
+		for (Role role : roleList) {
+			if (role.getRoleCode().equals(RoleMeta.SUPER_ADMIN.name())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	/**
+	 * 构建key
+	 *
+	 * @author WANGWEI
+	 * @param user
+	 * @return
+	 */
+	private String buildUserKey(User user) {
+		Long rootOrgId = user.getRootOrgId();
+		UserType userType = user.getUserType();
+		String key = StringUtil.join("U_", userType.getCode(), "_", rootOrgId, "_",
+				user.getUserId());
+		return key;
+	}
+
+	@Override
+	public void logout(User user) {
+		if (StringUtils.isNotBlank(user.getKey())) {
+			redisClient.delete(user.getKey());
+		} else {
+			String key = buildUserKey(user);
+			redisClient.delete(key);
+		}
+	}
+
+	@Override
+	public User getLoginUser(String key, String token) {
+		int sessionTimeout = PropertiesUtil.getInt(PropKeys.SESSION_TIMEOUT, 3600);
+		User user = redisClient.get(key, User.class, sessionTimeout);
+		if (null == user) {
+			throw new StatusException("B-001012", "未登录");
+		}
+
+		if (!user.getToken().equals(token)) {
+			throw new StatusException("B-001012", "token错误");
+		}
+
+		return user;
+	}
+
+	@Override
+	public User thirdPartyAccess(Long rootOrgId, String loginName, String appId, String timestamp,
+			String token, String clientIp) throws StatusException {
+
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
+		if (null == rootOrg) {
+			throw new StatusException("B-001002", "机构不存在");
+		}
+
+		ThirdPartyAccessEntity thirdPartyAccess = thirdPartyAccessRepo
+				.findOne(new ThirdPartyAccessPK(rootOrgId, appId));
+
+		if (null == thirdPartyAccess) {
+			throw new StatusException("B-001201", "第三方系统接入信息未配置");
+		}
+
+		long timestampLong = 0L;
+		try {
+			timestampLong = Long.parseLong(timestamp);
+		} catch (Exception e) {
+			throw new StatusException("B-001202", "timestamp错误");
+		}
+
+		long currentTimeMillis = System.currentTimeMillis();
+		if (Math.abs(currentTimeMillis - timestampLong) > thirdPartyAccess.getTimeRange()) {
+			throw new StatusException("B-001203", "timestamp超出时间差范围");
+		}
+
+		String secretKey = thirdPartyAccess.getSecretKey();
+		String joinStr = StringUtil.join(loginName, rootOrgId, appId, timestamp, secretKey);
+		byte[] bytes = SHA256.encode(joinStr);
+		String hexAscii = ByteUtil.toHexAscii(bytes);
+
+		if (!hexAscii.equalsIgnoreCase(token)) {
+			throw new StatusException("B-001204", "token校验失败");
+		}
+
+		UserEntity userEntity = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
+		if (userEntity == null) {
+			throw new StatusException("B-001205", "用户不存在");
+		}
+
+		User user = new User();
+		user.setUserType(UserType.COMMON);
+		user.setUserId(userEntity.getId());
+		user.setDisplayName(userEntity.getLoginName());
+		user.setRootOrgId(userEntity.getRootOrgId());
+
+		List<Role> roleList = getUserRoles(userEntity.getId());
+		user.setRoleList(roleList);
+
+		user.setClientIp(clientIp);
+		setSession(user);
+
+		boolean isLcUser = isLcUser(user);
+
+		if (isLcUser) {
+			setSecurityIp(user, userEntity.getOrgId());
+		}
+
+		return user;
+	}
+
+	/**
+	 * 设置session
+	 *
+	 * @author WANGWEI
+	 * @param user
+	 */
+	private void setSession(User user) {
+		user.setTokenCreationTime(new Date());
+		user.setToken(UUID.randomUUID());
+		String key = buildUserKey(user);
+		user.setKey(key);
+
+		int sessionTimeout = PropertiesUtil.getInt(PropKeys.SESSION_TIMEOUT, 3600);
+		Integer sessionTimeoutCache = redisClient.get("$_SESSION_TIMEOUT", Integer.class);
+		if (null == sessionTimeoutCache || (int) sessionTimeoutCache != sessionTimeout) {
+			redisClient.set("$_SESSION_TIMEOUT", sessionTimeout);
+		}
+
+		redisClient.set(key, user, sessionTimeout);
+	}
+
+	/**
+	 * 获取角色集合
+	 *
+	 * @author WANGWEI
+	 * @param userId
+	 * @return
+	 */
+	private List<Role> getUserRoles(Long userId) {
+		List<UserRoleRelationEntity> relationList = userRoleRelationRepo.findAllByUserId(userId);
+		List<Role> roleList = Lists.newArrayList();
+		if (CollectionUtils.isNotEmpty(relationList)) {
+			for (UserRoleRelationEntity cur : relationList) {
+				Long roleId = cur.getRoleId();
+				RoleEntity roleEntity = roleRepo.findOne(roleId);
+				if (null == roleEntity) {
+					throw new StatusException("B-002002", "roleId is wrong. roleId=" + roleId);
+				}
+				Role role = new Role(roleEntity.getId(), roleEntity.getCode(),
+						roleEntity.getName());
+				roleList.add(role);
+			}
+		}
+		return roleList;
+	}
+
+}

+ 281 - 281
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/CourseServiceImpl.java

@@ -1,281 +1,281 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.poi.ExcelReader;
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
-import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.CourseEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
-import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
-import cn.com.qmth.examcloud.core.basic.service.CourseService;
-import cn.com.qmth.examcloud.core.basic.service.bean.CourseInfo;
-import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
-import cn.com.qmth.examcloud.task.api.request.SyncCourseReq;
-
-@Service
-public class CourseServiceImpl implements CourseService {
-
-	@Autowired
-	CourseRepo courseRepo;
-
-	@Autowired
-	OrgRepo orgRepo;
-
-	@Autowired
-	DataSyncCloudService dataSyncCloudService;
-
-	private static final String[] EXCEL_HEADER = new String[]{"课程名称", "课程代码", "层次(ZSB,GQZ,ALL)"};
-
-	/*
-	 * 实现
-	 *
-	 * @author WANGWEI
-	 * 
-	 * @see
-	 * cn.com.qmth.examcloud.core.basic.service.CourseService#saveCourse(cn.com.
-	 * qmth.examcloud.core.basic.service.bean.CourseInfo)
-	 */
-	@Override
-	public CourseEntity saveCourse(CourseInfo courseInfo) {
-		Long rootOrgId = courseInfo.getRootOrgId();
-		Long courseId = courseInfo.getId();
-		String courseCode = courseInfo.getCode();
-		CourseLevel level = courseInfo.getLevel();
-		Boolean enable = courseInfo.getEnable();
-		String name = courseInfo.getName();
-
-		if (null == rootOrgId) {
-			throw new StatusException("B-160000", "rootOrgId is null");
-		}
-		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
-		if (null == rootOrg) {
-			throw new StatusException("B-160001", "机构不存在");
-		}
-		if (null != rootOrg.getParentId()) {
-			throw new StatusException("B-160002", "机构错误");
-		}
-
-		CourseEntity course = null;
-
-		if (null != courseId) {
-			course = courseRepo.findOne(courseId);
-
-			if (null == course) {
-				throw new StatusException("B-160006", "课程ID错误");
-			}
-
-			if (!rootOrgId.equals(course.getRootOrgId())) {
-				throw new StatusException("B-160006", "课程机构错误");
-			}
-
-		} else if (StringUtils.isNotBlank(courseCode)) {
-
-			course = courseRepo.findByRootOrgIdAndCode(rootOrgId, courseCode);
-
-			if (null != course) {
-				if (null == course.getEnable()) {
-					course.setEnable(true);
-				}
-				if (null == course.getLevel()) {
-					course.setLevel(CourseLevel.ALL);
-				}
-			} else {
-				if (StringUtils.isBlank(name)) {
-					throw new StatusException("B-160003", "courseName is null");
-				}
-
-				course = new CourseEntity();
-				course.setRootOrgId(rootOrgId);
-				course.setCode(courseCode);
-				course.setEnable(true);
-				course.setLevel(CourseLevel.ALL);
-			}
-
-		} else {
-			throw new StatusException("B-160004", "courseId,courseCode can not be all null");
-		}
-
-		if (null != enable) {
-			course.setEnable(enable);
-		}
-
-		if (StringUtils.isNotBlank(name)) {
-			course.setName(name);
-		}
-
-		if (null != level) {
-			course.setLevel(level);
-		}
-
-		long updateTime = 0L;
-		if (null != course.getUpdateTime()) {
-			updateTime = course.getUpdateTime().getTime();
-		}
-
-		CourseEntity saved = courseRepo.saveAndFlush(course);
-
-		// 同步操作
-		if (updateTime != saved.getUpdateTime().getTime()) {
-			SyncCourseReq req = new SyncCourseReq();
-			req.setCode(saved.getCode());
-			req.setEnable(saved.getEnable());
-			req.setId(saved.getId());
-			req.setLevel(saved.getLevel().name());
-			req.setName(saved.getName());
-			req.setRootOrgId(saved.getRootOrgId());
-			req.setSyncType("update");
-			dataSyncCloudService.syncCourse(req);
-		}
-		return saved;
-	}
-
-	@Override
-	public List<Map<String, Object>> importCourse(Long rootOrgId, File file) {
-
-		List<String[]> lineList = null;
-		try {
-			lineList = ExcelReader.readSheetBySax(PathUtil.getCanonicalPath(file), 1, 3);
-		} catch (Exception e) {
-			throw new StatusException("B-100110", "Excel 解析失败");
-		}
-
-		if (CollectionUtils.isEmpty(lineList)) {
-			throw new StatusException("B-100111", "Excel无内容");
-		}
-
-		if (10001 < lineList.size()) {
-			throw new StatusException("B-100112", "数据行数不能超过10000");
-		}
-
-		List<Map<String, Object>> failRecords = Collections
-				.synchronizedList(new ArrayList<Map<String, Object>>());
-
-		List<CourseEntity> courseList = Lists.newArrayList();
-
-		for (int i = 0; i < lineList.size(); i++) {
-			String[] line = lineList.get(i);
-			if (0 == i) {
-				if (headerError(line)) {
-					throw new StatusException("B-100111", "Excel表头错误");
-				}
-				continue;
-			}
-
-			boolean hasError = false;
-			StringBuilder msg = new StringBuilder();
-
-			CourseEntity couse = new CourseEntity();
-			couse.setRootOrgId(rootOrgId);
-			couse.setEnable(true);
-
-			String name = trimAndNullIfBlank(line[0]);
-			if (StringUtils.isBlank(name)) {
-				msg.append("  课程名称不能为空");
-				hasError = true;
-			} else if (name.length() > 30) {
-				msg.append("  课程名称不能超过30个字符");
-				hasError = true;
-			}
-			couse.setName(name);
-
-			String code = trimAndNullIfBlank(line[1]);
-			if (StringUtils.isBlank(code)) {
-				msg.append("  课程代码不能为空");
-				hasError = true;
-			} else if (code.length() > 30) {
-				msg.append("  课程代码不能超过30个字符");
-				hasError = true;
-			}
-
-			couse.setCode(code);
-
-			String level = trimAndNullIfBlank(line[2]);
-			if (StringUtils.isBlank(level)) {
-				msg.append("  课程层次不能为空");
-				hasError = true;
-			} else {
-				try {
-					CourseLevel cl = CourseLevel.getCourseLevel(level);
-					couse.setLevel(cl);
-				} catch (Exception e) {
-					msg.append("  课程层次错误");
-					hasError = true;
-				}
-			}
-
-			if (hasError) {
-				failRecords.add(newError(i + 1, msg.toString()));
-			} else {
-				courseList.add(couse);
-			}
-
-		}
-
-		if (CollectionUtils.isNotEmpty(failRecords)) {
-			return failRecords;
-		}
-
-		for (CourseEntity cur : courseList) {
-			CourseEntity query = courseRepo.findByRootOrgIdAndCode(cur.getRootOrgId(),
-					cur.getCode());
-
-			if (null != query) {
-				query.setName(cur.getName());
-				query.setLevel(cur.getLevel());
-				courseRepo.save(query);
-			} else {
-				courseRepo.save(cur);
-			}
-		}
-
-		return failRecords;
-	}
-
-	private Map<String, Object> newError(int lineNum, String msg) {
-		Map<String, Object> map = Maps.newHashMap();
-		map.put("lineNum", lineNum);
-		map.put("msg", msg);
-		return map;
-	}
-
-	private String trimAndNullIfBlank(String s) {
-		if (StringUtils.isBlank(s)) {
-			return null;
-		}
-		return s.trim();
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param header
-	 */
-	private boolean headerError(String[] header) {
-		for (int i = 0; i < EXCEL_HEADER.length; i++) {
-			if (null == header[i]) {
-				return true;
-			}
-			if (!EXCEL_HEADER[i].equals(header[i].trim())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.poi.ExcelReader;
+import cn.com.qmth.examcloud.commons.util.PathUtil;
+import cn.com.qmth.examcloud.core.basic.dao.CourseRepo;
+import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.CourseEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
+import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
+import cn.com.qmth.examcloud.core.basic.service.CourseService;
+import cn.com.qmth.examcloud.core.basic.service.bean.CourseInfo;
+import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
+import cn.com.qmth.examcloud.task.api.request.SyncCourseReq;
+
+@Service
+public class CourseServiceImpl implements CourseService {
+
+	@Autowired
+	CourseRepo courseRepo;
+
+	@Autowired
+	OrgRepo orgRepo;
+
+	@Autowired
+	DataSyncCloudService dataSyncCloudService;
+
+	private static final String[] EXCEL_HEADER = new String[]{"课程名称", "课程代码", "层次(ZSB,GQZ,ALL)"};
+
+	/*
+	 * 实现
+	 *
+	 * @author WANGWEI
+	 * 
+	 * @see
+	 * cn.com.qmth.examcloud.core.basic.service.CourseService#saveCourse(cn.com.
+	 * qmth.examcloud.core.basic.service.bean.CourseInfo)
+	 */
+	@Override
+	public CourseEntity saveCourse(CourseInfo courseInfo) {
+		Long rootOrgId = courseInfo.getRootOrgId();
+		Long courseId = courseInfo.getId();
+		String courseCode = courseInfo.getCode();
+		CourseLevel level = courseInfo.getLevel();
+		Boolean enable = courseInfo.getEnable();
+		String name = courseInfo.getName();
+
+		if (null == rootOrgId) {
+			throw new StatusException("B-160000", "rootOrgId is null");
+		}
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
+		if (null == rootOrg) {
+			throw new StatusException("B-160001", "机构不存在");
+		}
+		if (null != rootOrg.getParentId()) {
+			throw new StatusException("B-160002", "机构错误");
+		}
+
+		CourseEntity course = null;
+
+		if (null != courseId) {
+			course = courseRepo.findOne(courseId);
+
+			if (null == course) {
+				throw new StatusException("B-160006", "课程ID错误");
+			}
+
+			if (!rootOrgId.equals(course.getRootOrgId())) {
+				throw new StatusException("B-160006", "课程机构错误");
+			}
+
+		} else if (StringUtils.isNotBlank(courseCode)) {
+
+			course = courseRepo.findByRootOrgIdAndCode(rootOrgId, courseCode);
+
+			if (null != course) {
+				if (null == course.getEnable()) {
+					course.setEnable(true);
+				}
+				if (null == course.getLevel()) {
+					course.setLevel(CourseLevel.ALL);
+				}
+			} else {
+				if (StringUtils.isBlank(name)) {
+					throw new StatusException("B-160003", "courseName is null");
+				}
+
+				course = new CourseEntity();
+				course.setRootOrgId(rootOrgId);
+				course.setCode(courseCode);
+				course.setEnable(true);
+				course.setLevel(CourseLevel.ALL);
+			}
+
+		} else {
+			throw new StatusException("B-160004", "courseId,courseCode can not be all null");
+		}
+
+		if (null != enable) {
+			course.setEnable(enable);
+		}
+
+		if (StringUtils.isNotBlank(name)) {
+			course.setName(name);
+		}
+
+		if (null != level) {
+			course.setLevel(level);
+		}
+
+		long updateTime = 0L;
+		if (null != course.getUpdateTime()) {
+			updateTime = course.getUpdateTime().getTime();
+		}
+
+		CourseEntity saved = courseRepo.saveAndFlush(course);
+
+		// 同步操作
+		if (updateTime != saved.getUpdateTime().getTime()) {
+			SyncCourseReq req = new SyncCourseReq();
+			req.setCode(saved.getCode());
+			req.setEnable(saved.getEnable());
+			req.setId(saved.getId());
+			req.setLevel(saved.getLevel().name());
+			req.setName(saved.getName());
+			req.setRootOrgId(saved.getRootOrgId());
+			req.setSyncType("update");
+			dataSyncCloudService.syncCourse(req);
+		}
+		return saved;
+	}
+
+	@Override
+	public List<Map<String, Object>> importCourse(Long rootOrgId, File file) {
+
+		List<String[]> lineList = null;
+		try {
+			lineList = ExcelReader.readSheetBySax(PathUtil.getCanonicalPath(file), 1, 3);
+		} catch (Exception e) {
+			throw new StatusException("B-100110", "Excel 解析失败");
+		}
+
+		if (CollectionUtils.isEmpty(lineList)) {
+			throw new StatusException("B-100111", "Excel无内容");
+		}
+
+		if (10001 < lineList.size()) {
+			throw new StatusException("B-100112", "数据行数不能超过10000");
+		}
+
+		List<Map<String, Object>> failRecords = Collections
+				.synchronizedList(new ArrayList<Map<String, Object>>());
+
+		List<CourseEntity> courseList = Lists.newArrayList();
+
+		for (int i = 0; i < lineList.size(); i++) {
+			String[] line = lineList.get(i);
+			if (0 == i) {
+				if (headerError(line)) {
+					throw new StatusException("B-100111", "Excel表头错误");
+				}
+				continue;
+			}
+
+			boolean hasError = false;
+			StringBuilder msg = new StringBuilder();
+
+			CourseEntity couse = new CourseEntity();
+			couse.setRootOrgId(rootOrgId);
+			couse.setEnable(true);
+
+			String name = trimAndNullIfBlank(line[0]);
+			if (StringUtils.isBlank(name)) {
+				msg.append("  课程名称不能为空");
+				hasError = true;
+			} else if (name.length() > 30) {
+				msg.append("  课程名称不能超过30个字符");
+				hasError = true;
+			}
+			couse.setName(name);
+
+			String code = trimAndNullIfBlank(line[1]);
+			if (StringUtils.isBlank(code)) {
+				msg.append("  课程代码不能为空");
+				hasError = true;
+			} else if (code.length() > 30) {
+				msg.append("  课程代码不能超过30个字符");
+				hasError = true;
+			}
+
+			couse.setCode(code);
+
+			String level = trimAndNullIfBlank(line[2]);
+			if (StringUtils.isBlank(level)) {
+				msg.append("  课程层次不能为空");
+				hasError = true;
+			} else {
+				try {
+					CourseLevel cl = CourseLevel.getCourseLevel(level);
+					couse.setLevel(cl);
+				} catch (Exception e) {
+					msg.append("  课程层次错误");
+					hasError = true;
+				}
+			}
+
+			if (hasError) {
+				failRecords.add(newError(i + 1, msg.toString()));
+			} else {
+				courseList.add(couse);
+			}
+
+		}
+
+		if (CollectionUtils.isNotEmpty(failRecords)) {
+			return failRecords;
+		}
+
+		for (CourseEntity cur : courseList) {
+			CourseEntity query = courseRepo.findByRootOrgIdAndCode(cur.getRootOrgId(),
+					cur.getCode());
+
+			if (null != query) {
+				query.setName(cur.getName());
+				query.setLevel(cur.getLevel());
+				courseRepo.save(query);
+			} else {
+				courseRepo.save(cur);
+			}
+		}
+
+		return failRecords;
+	}
+
+	private Map<String, Object> newError(int lineNum, String msg) {
+		Map<String, Object> map = Maps.newHashMap();
+		map.put("lineNum", lineNum);
+		map.put("msg", msg);
+		return map;
+	}
+
+	private String trimAndNullIfBlank(String s) {
+		if (StringUtils.isBlank(s)) {
+			return null;
+		}
+		return s.trim();
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param header
+	 */
+	private boolean headerError(String[] header) {
+		for (int i = 0; i < EXCEL_HEADER.length; i++) {
+			if (null == header[i]) {
+				return true;
+			}
+			if (!EXCEL_HEADER[i].equals(header[i].trim())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+}

+ 132 - 132
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/ExamSiteServiceImpl.java

@@ -1,132 +1,132 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.core.basic.dao.ExamSiteRepo;
-import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.ExamSiteEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
-import cn.com.qmth.examcloud.core.basic.service.ExamSiteService;
-import cn.com.qmth.examcloud.core.basic.service.bean.ExamSiteInfo;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年8月31日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Service
-public class ExamSiteServiceImpl implements ExamSiteService {
-
-	@Autowired
-	ExamSiteRepo examSiteRepo;
-
-	@Autowired
-	OrgRepo orgRepo;
-
-	@Override
-	public ExamSiteEntity saveExamSite(ExamSiteInfo info) {
-		Long rootOrgId = info.getRootOrgId();
-		Long orgId = info.getOrgId();
-		Long id = info.getId();
-		String code = info.getCode();
-		Boolean enable = info.getEnable();
-		String name = info.getName();
-		String remark = info.getRemark();
-		String contacts = info.getContacts();
-		String telephone = info.getTelephone();
-
-		if (null == rootOrgId) {
-			throw new StatusException("B-160000", "rootOrgId is null");
-		}
-		if (null == orgId) {
-			throw new StatusException("B-160001", "rootOrgId is null");
-		}
-		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
-		if (null == rootOrg) {
-			throw new StatusException("B-160002", "顶级机构不存在");
-		}
-		if (null != rootOrg.getParentId()) {
-			throw new StatusException("B-160003", "顶级机构错误");
-		}
-
-		OrgEntity org = orgRepo.findOne(orgId);
-		if (null == org) {
-			throw new StatusException("B-160004", "机构不存在");
-		}
-		if (!org.getParentId().equals(rootOrgId)) {
-			throw new StatusException("B-160005", "rootOrgId and orgId is not matched");
-		}
-
-		ExamSiteEntity entity = null;
-
-		if (null != id) {
-			entity = examSiteRepo.findOne(id);
-
-			if (null == entity) {
-				throw new StatusException("B-160006", "考点ID错误");
-			}
-
-			if (!rootOrgId.equals(entity.getRootOrgId())) {
-				throw new StatusException("B-160007", "顶级机构错误");
-			}
-
-		} else if (StringUtils.isNotBlank(code)) {
-
-			entity = examSiteRepo.findByOrgIdAndCode(orgId, code);
-
-			if (null != entity) {
-				if (null == entity.getEnable()) {
-					entity.setEnable(true);
-				}
-			} else {
-				entity = new ExamSiteEntity();
-				entity.setRootOrgId(rootOrgId);
-				entity.setOrgId(orgId);
-				entity.setCode(code);
-				entity.setEnable(true);
-
-				if (StringUtils.isBlank(name)) {
-					throw new StatusException("B-160008", "name is blank");
-				}
-			}
-
-		} else {
-			throw new StatusException("B-160009", "id,code can not be all null");
-		}
-
-		if (null != enable) {
-			entity.setEnable(enable);
-		}
-
-		if (null != name) {
-			if (StringUtils.isBlank(name)) {
-				throw new StatusException("B-160008", "name is blank");
-			} else {
-				entity.setName(name);
-			}
-
-		}
-
-		if (null != telephone) {
-			entity.setTelephone(telephone);
-		}
-
-		if (null != contacts) {
-			entity.setContacts(contacts);
-		}
-
-		if (null != remark) {
-			entity.setRemark(remark);
-		}
-
-		ExamSiteEntity saved = examSiteRepo.saveAndFlush(entity);
-
-		return saved;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.dao.ExamSiteRepo;
+import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.ExamSiteEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
+import cn.com.qmth.examcloud.core.basic.service.ExamSiteService;
+import cn.com.qmth.examcloud.core.basic.service.bean.ExamSiteInfo;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年8月31日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Service
+public class ExamSiteServiceImpl implements ExamSiteService {
+
+	@Autowired
+	ExamSiteRepo examSiteRepo;
+
+	@Autowired
+	OrgRepo orgRepo;
+
+	@Override
+	public ExamSiteEntity saveExamSite(ExamSiteInfo info) {
+		Long rootOrgId = info.getRootOrgId();
+		Long orgId = info.getOrgId();
+		Long id = info.getId();
+		String code = info.getCode();
+		Boolean enable = info.getEnable();
+		String name = info.getName();
+		String remark = info.getRemark();
+		String contacts = info.getContacts();
+		String telephone = info.getTelephone();
+
+		if (null == rootOrgId) {
+			throw new StatusException("B-160000", "rootOrgId is null");
+		}
+		if (null == orgId) {
+			throw new StatusException("B-160001", "rootOrgId is null");
+		}
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
+		if (null == rootOrg) {
+			throw new StatusException("B-160002", "顶级机构不存在");
+		}
+		if (null != rootOrg.getParentId()) {
+			throw new StatusException("B-160003", "顶级机构错误");
+		}
+
+		OrgEntity org = orgRepo.findOne(orgId);
+		if (null == org) {
+			throw new StatusException("B-160004", "机构不存在");
+		}
+		if (!org.getParentId().equals(rootOrgId)) {
+			throw new StatusException("B-160005", "rootOrgId and orgId is not matched");
+		}
+
+		ExamSiteEntity entity = null;
+
+		if (null != id) {
+			entity = examSiteRepo.findOne(id);
+
+			if (null == entity) {
+				throw new StatusException("B-160006", "考点ID错误");
+			}
+
+			if (!rootOrgId.equals(entity.getRootOrgId())) {
+				throw new StatusException("B-160007", "顶级机构错误");
+			}
+
+		} else if (StringUtils.isNotBlank(code)) {
+
+			entity = examSiteRepo.findByOrgIdAndCode(orgId, code);
+
+			if (null != entity) {
+				if (null == entity.getEnable()) {
+					entity.setEnable(true);
+				}
+			} else {
+				entity = new ExamSiteEntity();
+				entity.setRootOrgId(rootOrgId);
+				entity.setOrgId(orgId);
+				entity.setCode(code);
+				entity.setEnable(true);
+
+				if (StringUtils.isBlank(name)) {
+					throw new StatusException("B-160008", "name is blank");
+				}
+			}
+
+		} else {
+			throw new StatusException("B-160009", "id,code can not be all null");
+		}
+
+		if (null != enable) {
+			entity.setEnable(enable);
+		}
+
+		if (null != name) {
+			if (StringUtils.isBlank(name)) {
+				throw new StatusException("B-160008", "name is blank");
+			} else {
+				entity.setName(name);
+			}
+
+		}
+
+		if (null != telephone) {
+			entity.setTelephone(telephone);
+		}
+
+		if (null != contacts) {
+			entity.setContacts(contacts);
+		}
+
+		if (null != remark) {
+			entity.setRemark(remark);
+		}
+
+		ExamSiteEntity saved = examSiteRepo.saveAndFlush(entity);
+
+		return saved;
+	}
+
+}

+ 154 - 154
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/FaceServiceImpl.java

@@ -1,154 +1,154 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.persistence.criteria.Predicate;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageRequest;
-import org.springframework.data.domain.Sort;
-import org.springframework.data.domain.Sort.Direction;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.stereotype.Service;
-
-import com.google.common.collect.Lists;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.core.basic.dao.FacesetRepo;
-import cn.com.qmth.examcloud.core.basic.dao.StudentFaceRepo;
-import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.FacesetEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceEntity;
-import cn.com.qmth.examcloud.core.basic.service.FaceService;
-import cn.com.qmth.examcloud.core.basic.service.bean.StudentFaceInfo;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年9月3日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Service
-public class FaceServiceImpl implements FaceService {
-
-	@Autowired
-	StudentFaceRepo studentFaceRepo;
-
-	@Autowired
-	FacesetRepo facesetRepo;
-
-	@Autowired
-	StudentRepo studentRepo;
-
-	@Override
-	public StudentFaceEntity saveStudentFace(StudentFaceInfo info) {
-		String facesetToken = info.getFacesetToken();
-		String faceToken = info.getFaceToken();
-		String operator = info.getOperator();
-		String photoName = info.getPhotoName();
-		Long rootOrgId = info.getRootOrgId();
-		Long studentId = info.getStudentId();
-		Long faceCount = info.getFaceCount();
-
-		if (null == studentId) {
-			throw new StatusException("B-680001", "studentId is null");
-		}
-		if (null == rootOrgId) {
-			throw new StatusException("B-680002", "rootOrgId is null");
-		}
-		if (StringUtils.isBlank(facesetToken)) {
-			throw new StatusException("B-680003", "facesetToken is null");
-		}
-		if (StringUtils.isBlank(faceToken)) {
-			throw new StatusException("B-680004", "faceToken is null");
-		}
-		if (StringUtils.isBlank(operator)) {
-			throw new StatusException("B-680005", "operator is null");
-		}
-		if (StringUtils.isBlank(photoName)) {
-			throw new StatusException("B-680006", "photoName is null");
-		}
-		if (!photoName.matches("\\w+\\.\\w+")) {
-			throw new StatusException("B-680006", "photoName is wrong");
-		}
-
-		if (null == faceCount) {
-			throw new StatusException("B-680008", "faceCount is null");
-		}
-		if (1 > faceCount) {
-			throw new StatusException("B-680013", "faceCount is less than 1");
-		}
-
-		StudentEntity studentEntity = studentRepo.findOne(studentId);
-
-		if (null == studentEntity) {
-			throw new StatusException("B-680009", "studentEntity is null");
-		}
-
-		if (!studentEntity.getRootOrgId().equals(rootOrgId)) {
-			throw new StatusException("B-680010", "studentId,rootOrgId is not matched");
-		}
-
-		FacesetEntity facesetEntity = facesetRepo.findByFacesetToken(facesetToken);
-		if (null == facesetEntity) {
-			throw new StatusException("B-680011", "facesetEntity is null");
-		}
-
-		String photoPath = rootOrgId + "/" + studentId + "/" + photoName;
-		studentEntity.setPhotoPath(photoPath);
-
-		StudentFaceEntity studentFaceEntity = studentFaceRepo.findOne(studentId);
-		if (null == studentFaceEntity) {
-			studentFaceEntity = new StudentFaceEntity();
-			studentFaceEntity.setStudentId(studentId);
-			studentFaceEntity.setCreator(operator);
-		}
-
-		studentFaceEntity.setFacesetId(facesetEntity.getId());
-		studentFaceEntity.setFaceToken(faceToken);
-		studentFaceEntity.setModifiedBy(operator);
-
-		if (null == facesetEntity.getFaceCount() || facesetEntity.getFaceCount() < faceCount) {
-			facesetEntity.setFaceCount(faceCount);
-		}
-
-		facesetRepo.save(facesetEntity);
-		studentRepo.save(studentEntity);
-		StudentFaceEntity saved = studentFaceRepo.save(studentFaceEntity);
-
-		return saved;
-	}
-
-	@Override
-	public List<FacesetEntity> getUsableFacesetList() {
-
-		Specification<FacesetEntity> specification = (root, query, cb) -> {
-			List<Predicate> predicates = new ArrayList<>();
-			predicates.add(cb.lessThan(root.get("faceCount"), 8000));
-			predicates.add(cb.equal(root.get("enable"), true));
-
-			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-
-		PageRequest pageRequest = new PageRequest(0, 10, new Sort(Direction.DESC, "updateTime"));
-
-		Page<FacesetEntity> studentList = facesetRepo.findAll(specification, pageRequest);
-
-		Iterator<FacesetEntity> iterator = studentList.iterator();
-
-		List<FacesetEntity> list = Lists.newArrayList();
-
-		while (iterator.hasNext()) {
-			list.add(iterator.next());
-		}
-
-		return list;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.persistence.criteria.Predicate;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.domain.Page;
+import org.springframework.data.domain.PageRequest;
+import org.springframework.data.domain.Sort;
+import org.springframework.data.domain.Sort.Direction;
+import org.springframework.data.jpa.domain.Specification;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.dao.FacesetRepo;
+import cn.com.qmth.examcloud.core.basic.dao.StudentFaceRepo;
+import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.FacesetEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceEntity;
+import cn.com.qmth.examcloud.core.basic.service.FaceService;
+import cn.com.qmth.examcloud.core.basic.service.bean.StudentFaceInfo;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年9月3日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Service
+public class FaceServiceImpl implements FaceService {
+
+	@Autowired
+	StudentFaceRepo studentFaceRepo;
+
+	@Autowired
+	FacesetRepo facesetRepo;
+
+	@Autowired
+	StudentRepo studentRepo;
+
+	@Override
+	public StudentFaceEntity saveStudentFace(StudentFaceInfo info) {
+		String facesetToken = info.getFacesetToken();
+		String faceToken = info.getFaceToken();
+		String operator = info.getOperator();
+		String photoName = info.getPhotoName();
+		Long rootOrgId = info.getRootOrgId();
+		Long studentId = info.getStudentId();
+		Long faceCount = info.getFaceCount();
+
+		if (null == studentId) {
+			throw new StatusException("B-680001", "studentId is null");
+		}
+		if (null == rootOrgId) {
+			throw new StatusException("B-680002", "rootOrgId is null");
+		}
+		if (StringUtils.isBlank(facesetToken)) {
+			throw new StatusException("B-680003", "facesetToken is null");
+		}
+		if (StringUtils.isBlank(faceToken)) {
+			throw new StatusException("B-680004", "faceToken is null");
+		}
+		if (StringUtils.isBlank(operator)) {
+			throw new StatusException("B-680005", "operator is null");
+		}
+		if (StringUtils.isBlank(photoName)) {
+			throw new StatusException("B-680006", "photoName is null");
+		}
+		if (!photoName.matches("\\w+\\.\\w+")) {
+			throw new StatusException("B-680006", "photoName is wrong");
+		}
+
+		if (null == faceCount) {
+			throw new StatusException("B-680008", "faceCount is null");
+		}
+		if (1 > faceCount) {
+			throw new StatusException("B-680013", "faceCount is less than 1");
+		}
+
+		StudentEntity studentEntity = studentRepo.findOne(studentId);
+
+		if (null == studentEntity) {
+			throw new StatusException("B-680009", "studentEntity is null");
+		}
+
+		if (!studentEntity.getRootOrgId().equals(rootOrgId)) {
+			throw new StatusException("B-680010", "studentId,rootOrgId is not matched");
+		}
+
+		FacesetEntity facesetEntity = facesetRepo.findByFacesetToken(facesetToken);
+		if (null == facesetEntity) {
+			throw new StatusException("B-680011", "facesetEntity is null");
+		}
+
+		String photoPath = rootOrgId + "/" + studentId + "/" + photoName;
+		studentEntity.setPhotoPath(photoPath);
+
+		StudentFaceEntity studentFaceEntity = studentFaceRepo.findOne(studentId);
+		if (null == studentFaceEntity) {
+			studentFaceEntity = new StudentFaceEntity();
+			studentFaceEntity.setStudentId(studentId);
+			studentFaceEntity.setCreator(operator);
+		}
+
+		studentFaceEntity.setFacesetId(facesetEntity.getId());
+		studentFaceEntity.setFaceToken(faceToken);
+		studentFaceEntity.setModifiedBy(operator);
+
+		if (null == facesetEntity.getFaceCount() || facesetEntity.getFaceCount() < faceCount) {
+			facesetEntity.setFaceCount(faceCount);
+		}
+
+		facesetRepo.save(facesetEntity);
+		studentRepo.save(studentEntity);
+		StudentFaceEntity saved = studentFaceRepo.save(studentFaceEntity);
+
+		return saved;
+	}
+
+	@Override
+	public List<FacesetEntity> getUsableFacesetList() {
+
+		Specification<FacesetEntity> specification = (root, query, cb) -> {
+			List<Predicate> predicates = new ArrayList<>();
+			predicates.add(cb.lessThan(root.get("faceCount"), 8000));
+			predicates.add(cb.equal(root.get("enable"), true));
+
+			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
+		};
+
+		PageRequest pageRequest = new PageRequest(0, 10, new Sort(Direction.DESC, "updateTime"));
+
+		Page<FacesetEntity> studentList = facesetRepo.findAll(specification, pageRequest);
+
+		Iterator<FacesetEntity> iterator = studentList.iterator();
+
+		List<FacesetEntity> list = Lists.newArrayList();
+
+		while (iterator.hasNext()) {
+			list.add(iterator.next());
+		}
+
+		return list;
+	}
+
+}

+ 45 - 45
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/ImgCodeServiceImpl.java

@@ -1,45 +1,45 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.io.OutputStream;
-
-import javax.imageio.ImageIO;
-
-import org.apache.poi.util.IOUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.google.code.kaptcha.impl.DefaultKaptcha;
-
-import cn.com.qmth.examcloud.commons.base.exception.ExamCloudRuntimeException;
-import cn.com.qmth.examcloud.core.basic.service.ImgCodeService;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年12月26日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Service
-public class ImgCodeServiceImpl implements ImgCodeService {
-
-	@Autowired
-	DefaultKaptcha defaultKaptcha;
-
-	@Override
-	public String generate(OutputStream out) {
-		try {
-			String createText = defaultKaptcha.createText();
-			BufferedImage challenge = defaultKaptcha.createImage(createText);
-			ImageIO.write(challenge, "jpg", out);
-			return createText;
-		} catch (IOException e) {
-			throw new ExamCloudRuntimeException(e);
-		} finally {
-			IOUtils.closeQuietly(out);
-		}
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.imageio.ImageIO;
+
+import org.apache.poi.util.IOUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.code.kaptcha.impl.DefaultKaptcha;
+
+import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
+import cn.com.qmth.examcloud.core.basic.service.ImgCodeService;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年12月26日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Service
+public class ImgCodeServiceImpl implements ImgCodeService {
+
+	@Autowired
+	DefaultKaptcha defaultKaptcha;
+
+	@Override
+	public String generate(OutputStream out) {
+		try {
+			String createText = defaultKaptcha.createText();
+			BufferedImage challenge = defaultKaptcha.createImage(createText);
+			ImageIO.write(challenge, "jpg", out);
+			return createText;
+		} catch (IOException e) {
+			throw new ExamCloudRuntimeException(e);
+		} finally {
+			IOUtils.closeQuietly(out);
+		}
+	}
+
+}

+ 6 - 6
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/OrgServiceImpl.java

@@ -15,12 +15,11 @@ import org.springframework.stereotype.Service;
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnum;
-import cn.com.qmth.examcloud.commons.base.helpers.DynamicEnumManager;
-import cn.com.qmth.examcloud.commons.base.helpers.poi.ExcelReader;
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.DynamicEnum;
+import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
+import cn.com.qmth.examcloud.commons.helpers.poi.ExcelReader;
+import cn.com.qmth.examcloud.commons.util.PathUtil;
 import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
 import cn.com.qmth.examcloud.core.basic.dao.ExamSiteRepo;
 import cn.com.qmth.examcloud.core.basic.dao.OrgPropertyRepo;
@@ -39,6 +38,7 @@ import cn.com.qmth.examcloud.core.basic.service.OrgService;
 import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
 import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
 import cn.com.qmth.examcloud.task.api.request.SyncOrgReq;
+import cn.com.qmth.examcloud.web.security.enums.RoleMeta;
 
 @Service
 public class OrgServiceImpl implements OrgService {

+ 157 - 157
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/RolePrivilegeServiceImpl.java

@@ -1,157 +1,157 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.google.common.collect.Lists;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
-import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
-import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
-import cn.com.qmth.examcloud.core.basic.dao.RolePrivilegeRelationRepo;
-import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserRoleRelationRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationPK;
-import cn.com.qmth.examcloud.core.basic.service.RolePrivilegeService;
-import cn.com.qmth.examcloud.core.basic.service.bean.RoleInfo;
-
-/**
- * 类注释
- *
- * @author WANGWEI
- * @date 2018年6月14日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Service
-public class RolePrivilegeServiceImpl implements RolePrivilegeService {
-
-	@Autowired
-	PrivilegeRepo privilegeRepo;
-
-	@Autowired
-	OrgRepo orgRepo;
-
-	@Autowired
-	RoleRepo roleRepo;
-
-	@Autowired
-	RolePrivilegeRelationRepo rolePrivilegeRelationRepo;
-
-	@Autowired
-	PrivilegeGroupRepo privilegeGroupRepo;
-
-	@Autowired
-	UserRoleRelationRepo userRoleRelationRepo;
-
-	@Override
-	public void updateRolePrivilegeRelations(Long rootOrgId, Long roleId, Long privilegeGroupId,
-			Set<Long> privilegeIdSet) {
-
-		List<PrivilegeEntity> privilegeList = privilegeRepo
-				.findAllByGroupIdOrderByWeightDesc(privilegeGroupId);
-
-		List<RolePrivilegeRelationEntity> list = Lists.newArrayList();
-
-		for (PrivilegeEntity cur : privilegeList) {
-			Long id = cur.getId();
-			if (privilegeIdSet.contains(id)) {
-				RolePrivilegeRelationEntity bean = new RolePrivilegeRelationEntity();
-				bean.setRoleId(roleId);
-				bean.setRootOrgId(rootOrgId);
-				bean.setPrivilegeId(id);
-				list.add(bean);
-			}
-
-			RolePrivilegeRelationPK pk = new RolePrivilegeRelationPK(roleId, id, rootOrgId);
-			if (rolePrivilegeRelationRepo.exists(pk)) {
-				rolePrivilegeRelationRepo
-						.delete(new RolePrivilegeRelationPK(roleId, id, rootOrgId));
-			}
-		}
-
-		rolePrivilegeRelationRepo.save(list);
-	}
-
-	@Override
-	public RoleEntity saveRole(RoleInfo info) {
-		String code = info.getCode();
-		String name = info.getName();
-		Long rootOrgId = info.getRootOrgId();
-
-		if (StringUtils.isBlank(code)) {
-			throw new StatusException("B-620001", "code is blank");
-		}
-
-		if (StringUtils.isBlank(name)) {
-			throw new StatusException("B-620002", "name is blank");
-		}
-
-		if (null == rootOrgId) {
-			throw new StatusException("B-620003", "rootOrgId is null");
-		}
-
-		RoleEntity roleEntity = roleRepo.findByCodeAndRootOrgId(code, rootOrgId);
-
-		if (null == roleEntity) {
-			roleEntity = new RoleEntity();
-			roleEntity.setCode(code);
-			roleEntity.setName(name);
-			roleEntity.setRootOrgId(rootOrgId);
-		}
-
-		RoleEntity saved = roleRepo.save(roleEntity);
-
-		return saved;
-	}
-
-	@Override
-	public RoleEntity deleteRole(RoleInfo info, boolean cascade) {
-		Long id = info.getId();
-		String code = info.getCode();
-		Long rootOrgId = info.getRootOrgId();
-
-		if (null == rootOrgId) {
-			throw new StatusException("B-620001", "name is blank");
-		}
-
-		RoleEntity roleEntity = null;
-		if (null != id) {
-			roleEntity = roleRepo.findOne(id);
-		} else if (StringUtils.isNotBlank(code)) {
-			roleEntity = roleRepo.findByCodeAndRootOrgId(code, rootOrgId);
-		} else {
-			throw new StatusException("B-620002", "id,code can not be all null");
-		}
-
-		if (null == roleEntity) {
-			throw new StatusException("B-620003", "roleEntity is null");
-		}
-
-		if (!cascade) {
-			if (0 < rolePrivilegeRelationRepo.countByRoleIdAndRootOrgId(roleEntity.getId(),
-					rootOrgId)) {
-				throw new StatusException("B-620004", "角色已关联权限");
-			}
-
-			if (0 < userRoleRelationRepo.countByRoleId(roleEntity.getId())) {
-				throw new StatusException("B-620004", "角色已关联用户");
-			}
-		}
-
-		roleRepo.delete(roleEntity);
-
-		rolePrivilegeRelationRepo.deleteByRoleIdAndRootOrgId(roleEntity.getId(), rootOrgId);
-		userRoleRelationRepo.deleteByRoleId(roleEntity.getId());
-
-		return roleEntity;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
+import cn.com.qmth.examcloud.core.basic.dao.PrivilegeGroupRepo;
+import cn.com.qmth.examcloud.core.basic.dao.PrivilegeRepo;
+import cn.com.qmth.examcloud.core.basic.dao.RolePrivilegeRelationRepo;
+import cn.com.qmth.examcloud.core.basic.dao.RoleRepo;
+import cn.com.qmth.examcloud.core.basic.dao.UserRoleRelationRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.PrivilegeEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RoleEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.RolePrivilegeRelationPK;
+import cn.com.qmth.examcloud.core.basic.service.RolePrivilegeService;
+import cn.com.qmth.examcloud.core.basic.service.bean.RoleInfo;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年6月14日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Service
+public class RolePrivilegeServiceImpl implements RolePrivilegeService {
+
+	@Autowired
+	PrivilegeRepo privilegeRepo;
+
+	@Autowired
+	OrgRepo orgRepo;
+
+	@Autowired
+	RoleRepo roleRepo;
+
+	@Autowired
+	RolePrivilegeRelationRepo rolePrivilegeRelationRepo;
+
+	@Autowired
+	PrivilegeGroupRepo privilegeGroupRepo;
+
+	@Autowired
+	UserRoleRelationRepo userRoleRelationRepo;
+
+	@Override
+	public void updateRolePrivilegeRelations(Long rootOrgId, Long roleId, Long privilegeGroupId,
+			Set<Long> privilegeIdSet) {
+
+		List<PrivilegeEntity> privilegeList = privilegeRepo
+				.findAllByGroupIdOrderByWeightDesc(privilegeGroupId);
+
+		List<RolePrivilegeRelationEntity> list = Lists.newArrayList();
+
+		for (PrivilegeEntity cur : privilegeList) {
+			Long id = cur.getId();
+			if (privilegeIdSet.contains(id)) {
+				RolePrivilegeRelationEntity bean = new RolePrivilegeRelationEntity();
+				bean.setRoleId(roleId);
+				bean.setRootOrgId(rootOrgId);
+				bean.setPrivilegeId(id);
+				list.add(bean);
+			}
+
+			RolePrivilegeRelationPK pk = new RolePrivilegeRelationPK(roleId, id, rootOrgId);
+			if (rolePrivilegeRelationRepo.exists(pk)) {
+				rolePrivilegeRelationRepo
+						.delete(new RolePrivilegeRelationPK(roleId, id, rootOrgId));
+			}
+		}
+
+		rolePrivilegeRelationRepo.save(list);
+	}
+
+	@Override
+	public RoleEntity saveRole(RoleInfo info) {
+		String code = info.getCode();
+		String name = info.getName();
+		Long rootOrgId = info.getRootOrgId();
+
+		if (StringUtils.isBlank(code)) {
+			throw new StatusException("B-620001", "code is blank");
+		}
+
+		if (StringUtils.isBlank(name)) {
+			throw new StatusException("B-620002", "name is blank");
+		}
+
+		if (null == rootOrgId) {
+			throw new StatusException("B-620003", "rootOrgId is null");
+		}
+
+		RoleEntity roleEntity = roleRepo.findByCodeAndRootOrgId(code, rootOrgId);
+
+		if (null == roleEntity) {
+			roleEntity = new RoleEntity();
+			roleEntity.setCode(code);
+			roleEntity.setName(name);
+			roleEntity.setRootOrgId(rootOrgId);
+		}
+
+		RoleEntity saved = roleRepo.save(roleEntity);
+
+		return saved;
+	}
+
+	@Override
+	public RoleEntity deleteRole(RoleInfo info, boolean cascade) {
+		Long id = info.getId();
+		String code = info.getCode();
+		Long rootOrgId = info.getRootOrgId();
+
+		if (null == rootOrgId) {
+			throw new StatusException("B-620001", "name is blank");
+		}
+
+		RoleEntity roleEntity = null;
+		if (null != id) {
+			roleEntity = roleRepo.findOne(id);
+		} else if (StringUtils.isNotBlank(code)) {
+			roleEntity = roleRepo.findByCodeAndRootOrgId(code, rootOrgId);
+		} else {
+			throw new StatusException("B-620002", "id,code can not be all null");
+		}
+
+		if (null == roleEntity) {
+			throw new StatusException("B-620003", "roleEntity is null");
+		}
+
+		if (!cascade) {
+			if (0 < rolePrivilegeRelationRepo.countByRoleIdAndRootOrgId(roleEntity.getId(),
+					rootOrgId)) {
+				throw new StatusException("B-620004", "角色已关联权限");
+			}
+
+			if (0 < userRoleRelationRepo.countByRoleId(roleEntity.getId())) {
+				throw new StatusException("B-620004", "角色已关联用户");
+			}
+		}
+
+		roleRepo.delete(roleEntity);
+
+		rolePrivilegeRelationRepo.deleteByRoleIdAndRootOrgId(roleEntity.getId(), rootOrgId);
+		userRoleRelationRepo.deleteByRoleId(roleEntity.getId());
+
+		return roleEntity;
+	}
+
+}

+ 65 - 65
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/SmsCodeServiceImpl.java

@@ -1,65 +1,65 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import org.apache.commons.lang3.RandomUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
-import cn.com.qmth.examcloud.core.basic.service.SmsCodeService;
-import cn.com.qmth.examcloud.exchange.inner.api.SendSmsCloudService;
-import cn.com.qmth.examcloud.exchange.inner.api.request.CheckSmsCodeReq;
-import cn.com.qmth.examcloud.exchange.inner.api.request.SendSmsReq;
-import cn.com.qmth.examcloud.exchange.inner.api.response.CheckIdentifyingCodeResp;
-
-@Service
-public class SmsCodeServiceImpl implements SmsCodeService {
-
-	@Autowired
-	SendSmsCloudService sendSmsCloudService;
-
-	@Override
-	public void sendSmsCode(String phone) {
-		SendSmsReq req = new SendSmsReq();
-		req.setPhone(phone);
-		int code = 1000 + RandomUtils.nextInt(1, 8999);
-		req.setCode(String.valueOf(code));
-
-		int smsEffectivetime = PropertiesUtil.getInt(PropKeys.SEND_VERIFICATION_CODE_EFFECTIVE_TIME,
-				120);
-		int smsIntervalSeconds = PropertiesUtil
-				.getInt(PropKeys.SEND_VERIFICATION_CODE_INTERVAL_SECONDS, 60);
-
-		String smsSign = PropertiesUtil.getString(PropKeys.SEND_VERIFICATION_CODE_SIGN);
-		String smsTemplatecode = PropertiesUtil
-				.getString(PropKeys.SEND_VERIFICATION_CODE_TEMPLATE_CODE);
-
-		if (StringUtils.isBlank(smsSign)) {
-			throw new StatusException("B-001060", "签名未配置");
-		}
-		if (StringUtils.isBlank(smsTemplatecode)) {
-			throw new StatusException("B-001061", "模板未配置");
-		}
-
-		req.setEffectiveTime(smsEffectivetime);
-		req.setIntervalSeconds(smsIntervalSeconds);
-		req.setSign(smsSign);
-		req.setTemplateCode(smsTemplatecode);
-		sendSmsCloudService.sendIdentifyingCode(req);
-	}
-
-	@Override
-	public void checkSmsCode(String phone, String smsCode) {
-
-		CheckSmsCodeReq req = new CheckSmsCodeReq();
-		req.setCode(smsCode);
-		req.setPhone(phone);
-		CheckIdentifyingCodeResp resp = sendSmsCloudService.checkIdentifyingCode(req);
-		if (!resp.getSuccess()) {
-			throw new StatusException("B-001050", "验证码错误");
-		}
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import org.apache.commons.lang3.RandomUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
+import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
+import cn.com.qmth.examcloud.core.basic.service.SmsCodeService;
+import cn.com.qmth.examcloud.exchange.inner.api.SendSmsCloudService;
+import cn.com.qmth.examcloud.exchange.inner.api.request.CheckSmsCodeReq;
+import cn.com.qmth.examcloud.exchange.inner.api.request.SendSmsReq;
+import cn.com.qmth.examcloud.exchange.inner.api.response.CheckIdentifyingCodeResp;
+
+@Service
+public class SmsCodeServiceImpl implements SmsCodeService {
+
+	@Autowired
+	SendSmsCloudService sendSmsCloudService;
+
+	@Override
+	public void sendSmsCode(String phone) {
+		SendSmsReq req = new SendSmsReq();
+		req.setPhone(phone);
+		int code = 1000 + RandomUtils.nextInt(1, 8999);
+		req.setCode(String.valueOf(code));
+
+		int smsEffectivetime = PropertiesUtil.getInt(PropKeys.SEND_VERIFICATION_CODE_EFFECTIVE_TIME,
+				120);
+		int smsIntervalSeconds = PropertiesUtil
+				.getInt(PropKeys.SEND_VERIFICATION_CODE_INTERVAL_SECONDS, 60);
+
+		String smsSign = PropertiesUtil.getString(PropKeys.SEND_VERIFICATION_CODE_SIGN);
+		String smsTemplatecode = PropertiesUtil
+				.getString(PropKeys.SEND_VERIFICATION_CODE_TEMPLATE_CODE);
+
+		if (StringUtils.isBlank(smsSign)) {
+			throw new StatusException("B-001060", "签名未配置");
+		}
+		if (StringUtils.isBlank(smsTemplatecode)) {
+			throw new StatusException("B-001061", "模板未配置");
+		}
+
+		req.setEffectiveTime(smsEffectivetime);
+		req.setIntervalSeconds(smsIntervalSeconds);
+		req.setSign(smsSign);
+		req.setTemplateCode(smsTemplatecode);
+		sendSmsCloudService.sendIdentifyingCode(req);
+	}
+
+	@Override
+	public void checkSmsCode(String phone, String smsCode) {
+
+		CheckSmsCodeReq req = new CheckSmsCodeReq();
+		req.setCode(smsCode);
+		req.setPhone(phone);
+		CheckIdentifyingCodeResp resp = sendSmsCloudService.checkIdentifyingCode(req);
+		if (!resp.getSuccess()) {
+			throw new StatusException("B-001050", "验证码错误");
+		}
+	}
+
+}

+ 200 - 200
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/SpecialtyServiceImpl.java

@@ -1,200 +1,200 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.google.common.collect.Lists;
-import com.google.common.collect.Maps;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.poi.ExcelReader;
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.core.basic.dao.SpecialtyRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.SpecialtyEntity;
-import cn.com.qmth.examcloud.core.basic.service.SpecialtyService;
-import cn.com.qmth.examcloud.core.basic.service.bean.SpecialtyInfo;
-
-@Service
-public class SpecialtyServiceImpl implements SpecialtyService {
-
-	@Autowired
-	SpecialtyRepo specialtyRepo;
-
-	private static final String[] EXCEL_HEADER = new String[]{"专业名称", "专业代码"};
-
-	@Override
-	public SpecialtyEntity saveSpecialty(SpecialtyInfo info) {
-		Long id = info.getId();
-		String code = info.getCode();
-		Boolean enable = info.getEnable();
-		Long rootOrgId = info.getRootOrgId();
-		String name = info.getName();
-
-		if (null == rootOrgId) {
-			throw new StatusException("B-620001", "rootOrgId is null");
-		}
-		SpecialtyEntity entity = null;
-
-		if (null != id) {
-			entity = specialtyRepo.findOne(id);
-			if (null == entity) {
-				throw new StatusException("B-620001", "id is wrong");
-			}
-			if (!entity.getRootOrgId().equals(rootOrgId)) {
-				throw new StatusException("B-620001", "rootOrgId or id is worng");
-			}
-		} else if (StringUtils.isNotBlank(code)) {
-			entity = specialtyRepo.findByRootOrgIdAndCode(rootOrgId, code);
-			if (null == entity) {
-				if (StringUtils.isBlank(name)) {
-					throw new StatusException("B-620001", "name is blank");
-				}
-				entity = new SpecialtyEntity();
-				entity.setCode(code);
-				entity.setName(name);
-				entity.setRootOrgId(rootOrgId);
-				entity.setEnable(true);
-			}
-		} else {
-			throw new StatusException("B-620001", "id and code can not be all null");
-		}
-
-		if (null != enable) {
-			entity.setEnable(enable);
-		}
-		if (StringUtils.isNotBlank(name)) {
-			entity.setName(name);
-		}
-
-		SpecialtyEntity saved = specialtyRepo.save(entity);
-
-		return saved;
-	}
-
-	@Override
-	public List<Map<String, Object>> importSpecialty(Long rootOrgId, File file) {
-		List<String[]> lineList = null;
-		try {
-			lineList = ExcelReader.readSheetBySax(PathUtil.getCanonicalPath(file), 1, 2);
-		} catch (Exception e) {
-			throw new StatusException("B-100110", "Excel 解析失败");
-		}
-
-		if (CollectionUtils.isEmpty(lineList)) {
-			throw new StatusException("B-100111", "Excel无内容");
-		}
-
-		if (10001 < lineList.size()) {
-			throw new StatusException("B-100112", "数据行数不能超过10000");
-		}
-
-		List<Map<String, Object>> failRecords = Collections
-				.synchronizedList(new ArrayList<Map<String, Object>>());
-
-		List<SpecialtyEntity> courseList = Lists.newArrayList();
-
-		for (int i = 0; i < lineList.size(); i++) {
-			String[] line = lineList.get(i);
-			if (0 == i) {
-				if (headerError(line)) {
-					throw new StatusException("B-100111", "Excel表头错误");
-				}
-				continue;
-			}
-
-			boolean hasError = false;
-			StringBuilder msg = new StringBuilder();
-
-			SpecialtyEntity specialty = new SpecialtyEntity();
-			specialty.setRootOrgId(rootOrgId);
-			specialty.setEnable(true);
-
-			String name = trimAndNullIfBlank(line[0]);
-			if (StringUtils.isBlank(name)) {
-				msg.append("  专业名称不能为空");
-				hasError = true;
-			} else if (name.length() > 30) {
-				msg.append("  专业名称不能超过30个字符");
-				hasError = true;
-			}
-			specialty.setName(name);
-
-			String code = trimAndNullIfBlank(line[1]);
-			if (StringUtils.isBlank(code)) {
-				msg.append("  专业代码不能为空");
-				hasError = true;
-			} else if (code.length() > 30) {
-				msg.append("  专业代码不能超过30个字符");
-				hasError = true;
-			}
-
-			specialty.setCode(code);
-
-			if (hasError) {
-				failRecords.add(newError(i + 1, msg.toString()));
-			} else {
-				courseList.add(specialty);
-			}
-
-		}
-
-		if (CollectionUtils.isNotEmpty(failRecords)) {
-			return failRecords;
-		}
-
-		for (SpecialtyEntity cur : courseList) {
-			SpecialtyEntity query = specialtyRepo.findByRootOrgIdAndCode(cur.getRootOrgId(),
-					cur.getCode());
-
-			if (null != query) {
-				query.setName(cur.getName());
-				specialtyRepo.save(query);
-			} else {
-				specialtyRepo.save(cur);
-			}
-		}
-
-		return failRecords;
-	}
-
-	private Map<String, Object> newError(int lineNum, String msg) {
-		Map<String, Object> map = Maps.newHashMap();
-		map.put("lineNum", lineNum);
-		map.put("msg", msg);
-		return map;
-	}
-
-	private String trimAndNullIfBlank(String s) {
-		if (StringUtils.isBlank(s)) {
-			return null;
-		}
-		return s.trim();
-	}
-
-	/**
-	 * 方法注释
-	 *
-	 * @author WANGWEI
-	 * @param header
-	 */
-	private boolean headerError(String[] header) {
-		for (int i = 0; i < EXCEL_HEADER.length; i++) {
-			if (null == header[i]) {
-				return true;
-			}
-			if (!EXCEL_HEADER[i].equals(header[i].trim())) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.poi.ExcelReader;
+import cn.com.qmth.examcloud.commons.util.PathUtil;
+import cn.com.qmth.examcloud.core.basic.dao.SpecialtyRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.SpecialtyEntity;
+import cn.com.qmth.examcloud.core.basic.service.SpecialtyService;
+import cn.com.qmth.examcloud.core.basic.service.bean.SpecialtyInfo;
+
+@Service
+public class SpecialtyServiceImpl implements SpecialtyService {
+
+	@Autowired
+	SpecialtyRepo specialtyRepo;
+
+	private static final String[] EXCEL_HEADER = new String[]{"专业名称", "专业代码"};
+
+	@Override
+	public SpecialtyEntity saveSpecialty(SpecialtyInfo info) {
+		Long id = info.getId();
+		String code = info.getCode();
+		Boolean enable = info.getEnable();
+		Long rootOrgId = info.getRootOrgId();
+		String name = info.getName();
+
+		if (null == rootOrgId) {
+			throw new StatusException("B-620001", "rootOrgId is null");
+		}
+		SpecialtyEntity entity = null;
+
+		if (null != id) {
+			entity = specialtyRepo.findOne(id);
+			if (null == entity) {
+				throw new StatusException("B-620001", "id is wrong");
+			}
+			if (!entity.getRootOrgId().equals(rootOrgId)) {
+				throw new StatusException("B-620001", "rootOrgId or id is worng");
+			}
+		} else if (StringUtils.isNotBlank(code)) {
+			entity = specialtyRepo.findByRootOrgIdAndCode(rootOrgId, code);
+			if (null == entity) {
+				if (StringUtils.isBlank(name)) {
+					throw new StatusException("B-620001", "name is blank");
+				}
+				entity = new SpecialtyEntity();
+				entity.setCode(code);
+				entity.setName(name);
+				entity.setRootOrgId(rootOrgId);
+				entity.setEnable(true);
+			}
+		} else {
+			throw new StatusException("B-620001", "id and code can not be all null");
+		}
+
+		if (null != enable) {
+			entity.setEnable(enable);
+		}
+		if (StringUtils.isNotBlank(name)) {
+			entity.setName(name);
+		}
+
+		SpecialtyEntity saved = specialtyRepo.save(entity);
+
+		return saved;
+	}
+
+	@Override
+	public List<Map<String, Object>> importSpecialty(Long rootOrgId, File file) {
+		List<String[]> lineList = null;
+		try {
+			lineList = ExcelReader.readSheetBySax(PathUtil.getCanonicalPath(file), 1, 2);
+		} catch (Exception e) {
+			throw new StatusException("B-100110", "Excel 解析失败");
+		}
+
+		if (CollectionUtils.isEmpty(lineList)) {
+			throw new StatusException("B-100111", "Excel无内容");
+		}
+
+		if (10001 < lineList.size()) {
+			throw new StatusException("B-100112", "数据行数不能超过10000");
+		}
+
+		List<Map<String, Object>> failRecords = Collections
+				.synchronizedList(new ArrayList<Map<String, Object>>());
+
+		List<SpecialtyEntity> courseList = Lists.newArrayList();
+
+		for (int i = 0; i < lineList.size(); i++) {
+			String[] line = lineList.get(i);
+			if (0 == i) {
+				if (headerError(line)) {
+					throw new StatusException("B-100111", "Excel表头错误");
+				}
+				continue;
+			}
+
+			boolean hasError = false;
+			StringBuilder msg = new StringBuilder();
+
+			SpecialtyEntity specialty = new SpecialtyEntity();
+			specialty.setRootOrgId(rootOrgId);
+			specialty.setEnable(true);
+
+			String name = trimAndNullIfBlank(line[0]);
+			if (StringUtils.isBlank(name)) {
+				msg.append("  专业名称不能为空");
+				hasError = true;
+			} else if (name.length() > 30) {
+				msg.append("  专业名称不能超过30个字符");
+				hasError = true;
+			}
+			specialty.setName(name);
+
+			String code = trimAndNullIfBlank(line[1]);
+			if (StringUtils.isBlank(code)) {
+				msg.append("  专业代码不能为空");
+				hasError = true;
+			} else if (code.length() > 30) {
+				msg.append("  专业代码不能超过30个字符");
+				hasError = true;
+			}
+
+			specialty.setCode(code);
+
+			if (hasError) {
+				failRecords.add(newError(i + 1, msg.toString()));
+			} else {
+				courseList.add(specialty);
+			}
+
+		}
+
+		if (CollectionUtils.isNotEmpty(failRecords)) {
+			return failRecords;
+		}
+
+		for (SpecialtyEntity cur : courseList) {
+			SpecialtyEntity query = specialtyRepo.findByRootOrgIdAndCode(cur.getRootOrgId(),
+					cur.getCode());
+
+			if (null != query) {
+				query.setName(cur.getName());
+				specialtyRepo.save(query);
+			} else {
+				specialtyRepo.save(cur);
+			}
+		}
+
+		return failRecords;
+	}
+
+	private Map<String, Object> newError(int lineNum, String msg) {
+		Map<String, Object> map = Maps.newHashMap();
+		map.put("lineNum", lineNum);
+		map.put("msg", msg);
+		return map;
+	}
+
+	private String trimAndNullIfBlank(String s) {
+		if (StringUtils.isBlank(s)) {
+			return null;
+		}
+		return s.trim();
+	}
+
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param header
+	 */
+	private boolean headerError(String[] header) {
+		for (int i = 0; i < EXCEL_HEADER.length; i++) {
+			if (null == header[i]) {
+				return true;
+			}
+			if (!EXCEL_HEADER[i].equals(header[i].trim())) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+}

+ 341 - 341
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/StudentServiceImpl.java

@@ -1,341 +1,341 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import java.util.List;
-
-import javax.transaction.Transactional;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.google.common.collect.Lists;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.commons.base.util.UrlUtil;
-import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
-import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
-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.OrgEntity;
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
-import cn.com.qmth.examcloud.core.basic.service.StudentService;
-import cn.com.qmth.examcloud.core.basic.service.UserService;
-import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
-import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
-import cn.com.qmth.examcloud.task.api.request.SyncStudentReq;
-
-/**
- * 学生服务类 Created by songyue on 17/1/14.
- */
-@Service
-public class StudentServiceImpl implements StudentService {
-
-	@Autowired
-	StudentRepo studentRepo;
-
-	@Autowired
-	UserRepo userRepo;
-
-	@Autowired
-	UserService userService;
-
-	@Autowired
-	OrgRepo orgRepo;
-
-	@Autowired
-	OrgServiceImpl orgService;
-
-	@Autowired
-	DataSyncCloudService dataSyncCloudService;
-
-	/*
-	 * 实现
-	 *
-	 * @author WANGWEI
-	 * 
-	 * @see cn.com.qmth.examcloud.core.basic.service.StudentService#
-	 * insertOrUpdateStudent(cn.com.qmth.examcloud.core.basic.service.bean.
-	 * StudentInfo)
-	 */
-	@Override
-	@Transactional
-	public StudentEntity saveStudent(StudentInfo studentInfo) {
-		Long rootOrgId = studentInfo.getRootOrgId();
-		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
-
-		if (null == rootOrg || null != rootOrg.getParentId()) {
-			throw new StatusException("B-160001", "顶级机构错误");
-		}
-
-		OrgEntity org = null;
-		if (null != studentInfo.getOrgId()) {
-			org = orgRepo.findOne(studentInfo.getOrgId());
-			if (null == org) {
-				throw new StatusException("B-160050", "orgId is wrong");
-			}
-			if (!org.getRootId().equals(rootOrgId)) {
-				throw new StatusException("B-160051", "orgId is wrong");
-			}
-			if (null == org.getParentId()) {
-				throw new StatusException("B-160052", "orgId is wrong");
-			}
-			if (!org.getParentId().equals(rootOrgId)) {
-				throw new StatusException("B-160053", "orgId is wrong");
-			}
-		} else if (StringUtils.isNotBlank(studentInfo.getOrgCode())) {
-			org = orgRepo.findByRootIdAndCode(rootOrgId, studentInfo.getOrgCode());
-			if (null == org) {
-				String orgName = studentInfo.getOrgName();
-				if (StringUtils.isBlank(orgName)) {
-					throw new StatusException("B-160003", "orgName is blank");
-				}
-				org = new OrgEntity();
-				org.setParentId(rootOrgId);
-				org.setCode(studentInfo.getOrgCode());
-				org.setName(orgName);
-				org.setEnable(true);
-				org.setRootId(rootOrgId);
-				org = orgRepo.save(org);
-			}
-		} else {
-			throw new StatusException("B-160082", "orgId,orgCode can not be all null");
-		}
-
-		String identityNumber = studentInfo.getIdentityNumber();
-		if (StringUtils.isBlank(identityNumber)) {
-			throw new StatusException("B-160012", "身份证号不能为空");
-		}
-
-		StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
-				rootOrgId);
-
-		String studentCode = studentInfo.getStudentCode();
-		if (StringUtils.isNotBlank(studentCode)) {
-			StudentEntity studentByCode = studentRepo.findByStudentCodeAndRootOrgId(studentCode,
-					rootOrgId);
-			if (null != studentByCode
-					&& (!studentByCode.getIdentityNumber().equalsIgnoreCase(identityNumber))) {
-				throw new StatusException("B-160008", "学号被占用. 学号: " + studentCode);
-			}
-
-			if (null != student && null != student.getStudentCode()
-					&& (!studentCode.equalsIgnoreCase(student.getStudentCode()))) {
-				throw new StatusException("B-160005", "身份证号已关联学号");
-			}
-		}
-		long updateTime = 0L;
-		if (null != student) {
-			if (null != student.getUpdateTime()) {
-				updateTime = student.getUpdateTime().getTime();
-			}
-			if (null == student.getEnable()) {
-				student.setEnable(true);
-			}
-		} else {
-			student = new StudentEntity();
-			student.setEnable(true);
-			if (identityNumber.matches("[0-9a-zA-Z]{6,}")) {
-				student.setPassword(
-						StringUtils.substring(identityNumber, -6, identityNumber.length()));
-			} else {
-				student.setPassword(BasicConsts.DEFAULT_PASSWORD);
-			}
-		}
-
-		student.setRootOrgId(rootOrgId);
-		student.setIdentityNumber(identityNumber);
-		student.setOrgId(org.getId());
-		if (StringUtils.isNotBlank(studentCode)) {
-			student.setStudentCode(studentCode);
-		}
-		if (null != studentInfo.getName()) {
-			if (StringUtils.isBlank(studentInfo.getName())) {
-				throw new StatusException("B-160006", "姓名不能为空");
-			}
-			student.setName(studentInfo.getName());
-		}
-		if (null != studentInfo.getPhotoPath()) {
-			student.setPhotoPath(studentInfo.getPhotoPath());
-		}
-		if (null != studentInfo.getPhoneNumber()) {
-			student.setPhoneNumber(studentInfo.getPhoneNumber());
-		}
-		if (null != studentInfo.getRemark()) {
-			student.setRemark(studentInfo.getRemark());
-		}
-		if (null != studentInfo.getEnable()) {
-			student.setEnable(studentInfo.getEnable());
-		}
-		StudentEntity saved = studentRepo.saveAndFlush(student);
-
-		// 同步操作
-		if (updateTime != saved.getUpdateTime().getTime()) {
-			SyncStudentReq req = new SyncStudentReq();
-			req.setEnable(saved.getEnable());
-			req.setId(saved.getId());
-			req.setIdentityNumber(saved.getIdentityNumber());
-			req.setName(saved.getName());
-			req.setOrgCode(org.getCode());
-			req.setOrgId(org.getId());
-			req.setOrgName(org.getName());
-			req.setPhoneNumber(saved.getPhoneNumber());
-			req.setPhotoPath(saved.getPhotoPath());
-			req.setRootOrgId(saved.getRootOrgId());
-			req.setSecurityPhone(saved.getSecurityPhone());
-			req.setStudentCode(saved.getStudentCode());
-
-			req.setSyncType("update");
-
-			dataSyncCloudService.syncStudent(req);
-		}
-
-		return saved;
-	}
-
-	/*
-	 * 实现
-	 *
-	 * @author WANGWEI
-	 * 
-	 * @see
-	 * cn.com.qmth.examcloud.core.basic.service.StudentService#getStudentInfo(
-	 * java.lang.Long, java.lang.String, java.lang.String, java.lang.String)
-	 */
-	@Override
-	public StudentInfo getStudentInfo(Long rootOrgId, Long studentId, String identityNumber,
-			String studentCode, String securityPhone) {
-
-		if (null == rootOrgId) {
-			throw new StatusException("B-160250", "rootOrgId is null");
-		}
-
-		StudentEntity s = null;
-		int count = 0;
-		if (null != studentId) {
-			count++;
-			s = studentRepo.findOne(studentId);
-		}
-		if (StringUtils.isNotBlank(identityNumber)) {
-			count++;
-			s = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
-		}
-		if (StringUtils.isNotBlank(studentCode)) {
-			count++;
-			s = studentRepo.findByStudentCodeAndRootOrgId(studentCode, rootOrgId);
-		}
-		if (StringUtils.isNotBlank(securityPhone)) {
-			count++;
-			s = studentRepo.findBySecurityPhoneAndRootOrgId(securityPhone, rootOrgId);
-		}
-
-		if (count > 1) {
-			throw new StatusException("B-160210",
-					"参数过多,只需要[studentId,identityNumber,studentCode,securityPhone]中的一个");
-		}
-
-		if (null == s) {
-			throw new StatusException("B-160211", "学生不存在");
-		}
-
-		StudentInfo info = new StudentInfo();
-		info.setId(s.getId());
-		info.setEnable(s.getEnable());
-		info.setIdentityNumber(s.getIdentityNumber());
-		info.setName(s.getName());
-		info.setOrgId(s.getOrgId());
-		if (null != s.getOrgId()) {
-			OrgEntity org = orgRepo.findOne(s.getOrgId());
-			if (null != org) {
-				info.setOrgCode(org.getCode());
-				info.setOrgName(org.getName());
-			}
-		}
-		info.setPhoneNumber(s.getPhoneNumber());
-
-		if (StringUtils.isNotBlank(s.getPhotoPath())) {
-			String basePath = PropertiesUtil.getString(PropKeys.STUDENT_PHOTO_URL_PREFIX);
-			if (StringUtils.isBlank(basePath)) {
-				throw new StatusException("B-160212", "照片根路径未配置");
-			}
-			String path = UrlUtil.joinUrl(basePath, s.getPhotoPath());
-			info.setPhotoPath(path);
-		}
-
-		info.setRemark(s.getRemark());
-		info.setRootOrgId(s.getRootOrgId());
-		OrgEntity rootOrg = orgRepo.findOne(s.getRootOrgId());
-		info.setRootOrgName(rootOrg.getName());
-		info.setSecurityPhone(s.getSecurityPhone());
-		info.setStudentCode(s.getStudentCode());
-
-		return info;
-	}
-
-	@Override
-	public List<Long> unbindStudentCode(Long rootOrgId, String studentCode, String identityNumber) {
-
-		if (null == rootOrgId) {
-			throw new StatusException("B-120001", "rootOrgId is null");
-		}
-
-		List<StudentEntity> studentList = Lists.newArrayList();
-
-		StudentEntity s1 = null;
-		StudentEntity s2 = null;
-		if (null != studentCode) {
-			s1 = studentRepo.findByStudentCodeAndRootOrgId(studentCode, rootOrgId);
-			if (null != s1) {
-				studentList.add(s1);
-			}
-		}
-		if (null != identityNumber) {
-			s2 = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
-			if (null != s2) {
-				if (null == s1 || !s1.getId().equals(s2.getId())) {
-					studentList.add(s2);
-				}
-			}
-		}
-
-		List<Long> studentIdList = Lists.newArrayList();
-
-		for (StudentEntity cur : studentList) {
-			cur.setStudentCode(null);
-			StudentEntity saved = studentRepo.save(cur);
-			studentIdList.add(saved.getId());
-
-			SyncStudentReq req = new SyncStudentReq();
-			req.setEnable(saved.getEnable());
-			req.setId(saved.getId());
-			req.setIdentityNumber(saved.getIdentityNumber());
-			req.setName(saved.getName());
-
-			req.setOrgId(saved.getOrgId());
-			OrgEntity org = orgRepo.findOne(saved.getOrgId());
-			req.setOrgCode(org.getCode());
-			req.setOrgName(org.getName());
-
-			req.setPhoneNumber(saved.getPhoneNumber());
-			req.setPhotoPath(saved.getPhotoPath());
-			req.setRootOrgId(saved.getRootOrgId());
-			req.setSecurityPhone(saved.getSecurityPhone());
-			req.setStudentCode(saved.getStudentCode());
-
-			req.setSyncType("update");
-
-			dataSyncCloudService.syncStudent(req);
-		}
-
-		return studentIdList;
-	}
-
-	@Override
-	public Boolean hasBeBound(String securityPhone) {
-
-		StudentEntity s = studentRepo.findBySecurityPhone(securityPhone);
-		return null != s;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import java.util.List;
+
+import javax.transaction.Transactional;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.google.common.collect.Lists;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
+import cn.com.qmth.examcloud.commons.util.UrlUtil;
+import cn.com.qmth.examcloud.core.basic.base.constants.BasicConsts;
+import cn.com.qmth.examcloud.core.basic.base.constants.PropKeys;
+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.OrgEntity;
+import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
+import cn.com.qmth.examcloud.core.basic.service.StudentService;
+import cn.com.qmth.examcloud.core.basic.service.UserService;
+import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
+import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
+import cn.com.qmth.examcloud.task.api.request.SyncStudentReq;
+
+/**
+ * 学生服务类 Created by songyue on 17/1/14.
+ */
+@Service
+public class StudentServiceImpl implements StudentService {
+
+	@Autowired
+	StudentRepo studentRepo;
+
+	@Autowired
+	UserRepo userRepo;
+
+	@Autowired
+	UserService userService;
+
+	@Autowired
+	OrgRepo orgRepo;
+
+	@Autowired
+	OrgServiceImpl orgService;
+
+	@Autowired
+	DataSyncCloudService dataSyncCloudService;
+
+	/*
+	 * 实现
+	 *
+	 * @author WANGWEI
+	 * 
+	 * @see cn.com.qmth.examcloud.core.basic.service.StudentService#
+	 * insertOrUpdateStudent(cn.com.qmth.examcloud.core.basic.service.bean.
+	 * StudentInfo)
+	 */
+	@Override
+	@Transactional
+	public StudentEntity saveStudent(StudentInfo studentInfo) {
+		Long rootOrgId = studentInfo.getRootOrgId();
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
+
+		if (null == rootOrg || null != rootOrg.getParentId()) {
+			throw new StatusException("B-160001", "顶级机构错误");
+		}
+
+		OrgEntity org = null;
+		if (null != studentInfo.getOrgId()) {
+			org = orgRepo.findOne(studentInfo.getOrgId());
+			if (null == org) {
+				throw new StatusException("B-160050", "orgId is wrong");
+			}
+			if (!org.getRootId().equals(rootOrgId)) {
+				throw new StatusException("B-160051", "orgId is wrong");
+			}
+			if (null == org.getParentId()) {
+				throw new StatusException("B-160052", "orgId is wrong");
+			}
+			if (!org.getParentId().equals(rootOrgId)) {
+				throw new StatusException("B-160053", "orgId is wrong");
+			}
+		} else if (StringUtils.isNotBlank(studentInfo.getOrgCode())) {
+			org = orgRepo.findByRootIdAndCode(rootOrgId, studentInfo.getOrgCode());
+			if (null == org) {
+				String orgName = studentInfo.getOrgName();
+				if (StringUtils.isBlank(orgName)) {
+					throw new StatusException("B-160003", "orgName is blank");
+				}
+				org = new OrgEntity();
+				org.setParentId(rootOrgId);
+				org.setCode(studentInfo.getOrgCode());
+				org.setName(orgName);
+				org.setEnable(true);
+				org.setRootId(rootOrgId);
+				org = orgRepo.save(org);
+			}
+		} else {
+			throw new StatusException("B-160082", "orgId,orgCode can not be all null");
+		}
+
+		String identityNumber = studentInfo.getIdentityNumber();
+		if (StringUtils.isBlank(identityNumber)) {
+			throw new StatusException("B-160012", "身份证号不能为空");
+		}
+
+		StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
+				rootOrgId);
+
+		String studentCode = studentInfo.getStudentCode();
+		if (StringUtils.isNotBlank(studentCode)) {
+			StudentEntity studentByCode = studentRepo.findByStudentCodeAndRootOrgId(studentCode,
+					rootOrgId);
+			if (null != studentByCode
+					&& (!studentByCode.getIdentityNumber().equalsIgnoreCase(identityNumber))) {
+				throw new StatusException("B-160008", "学号被占用. 学号: " + studentCode);
+			}
+
+			if (null != student && null != student.getStudentCode()
+					&& (!studentCode.equalsIgnoreCase(student.getStudentCode()))) {
+				throw new StatusException("B-160005", "身份证号已关联学号");
+			}
+		}
+		long updateTime = 0L;
+		if (null != student) {
+			if (null != student.getUpdateTime()) {
+				updateTime = student.getUpdateTime().getTime();
+			}
+			if (null == student.getEnable()) {
+				student.setEnable(true);
+			}
+		} else {
+			student = new StudentEntity();
+			student.setEnable(true);
+			if (identityNumber.matches("[0-9a-zA-Z]{6,}")) {
+				student.setPassword(
+						StringUtils.substring(identityNumber, -6, identityNumber.length()));
+			} else {
+				student.setPassword(BasicConsts.DEFAULT_PASSWORD);
+			}
+		}
+
+		student.setRootOrgId(rootOrgId);
+		student.setIdentityNumber(identityNumber);
+		student.setOrgId(org.getId());
+		if (StringUtils.isNotBlank(studentCode)) {
+			student.setStudentCode(studentCode);
+		}
+		if (null != studentInfo.getName()) {
+			if (StringUtils.isBlank(studentInfo.getName())) {
+				throw new StatusException("B-160006", "姓名不能为空");
+			}
+			student.setName(studentInfo.getName());
+		}
+		if (null != studentInfo.getPhotoPath()) {
+			student.setPhotoPath(studentInfo.getPhotoPath());
+		}
+		if (null != studentInfo.getPhoneNumber()) {
+			student.setPhoneNumber(studentInfo.getPhoneNumber());
+		}
+		if (null != studentInfo.getRemark()) {
+			student.setRemark(studentInfo.getRemark());
+		}
+		if (null != studentInfo.getEnable()) {
+			student.setEnable(studentInfo.getEnable());
+		}
+		StudentEntity saved = studentRepo.saveAndFlush(student);
+
+		// 同步操作
+		if (updateTime != saved.getUpdateTime().getTime()) {
+			SyncStudentReq req = new SyncStudentReq();
+			req.setEnable(saved.getEnable());
+			req.setId(saved.getId());
+			req.setIdentityNumber(saved.getIdentityNumber());
+			req.setName(saved.getName());
+			req.setOrgCode(org.getCode());
+			req.setOrgId(org.getId());
+			req.setOrgName(org.getName());
+			req.setPhoneNumber(saved.getPhoneNumber());
+			req.setPhotoPath(saved.getPhotoPath());
+			req.setRootOrgId(saved.getRootOrgId());
+			req.setSecurityPhone(saved.getSecurityPhone());
+			req.setStudentCode(saved.getStudentCode());
+
+			req.setSyncType("update");
+
+			dataSyncCloudService.syncStudent(req);
+		}
+
+		return saved;
+	}
+
+	/*
+	 * 实现
+	 *
+	 * @author WANGWEI
+	 * 
+	 * @see
+	 * cn.com.qmth.examcloud.core.basic.service.StudentService#getStudentInfo(
+	 * java.lang.Long, java.lang.String, java.lang.String, java.lang.String)
+	 */
+	@Override
+	public StudentInfo getStudentInfo(Long rootOrgId, Long studentId, String identityNumber,
+			String studentCode, String securityPhone) {
+
+		if (null == rootOrgId) {
+			throw new StatusException("B-160250", "rootOrgId is null");
+		}
+
+		StudentEntity s = null;
+		int count = 0;
+		if (null != studentId) {
+			count++;
+			s = studentRepo.findOne(studentId);
+		}
+		if (StringUtils.isNotBlank(identityNumber)) {
+			count++;
+			s = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
+		}
+		if (StringUtils.isNotBlank(studentCode)) {
+			count++;
+			s = studentRepo.findByStudentCodeAndRootOrgId(studentCode, rootOrgId);
+		}
+		if (StringUtils.isNotBlank(securityPhone)) {
+			count++;
+			s = studentRepo.findBySecurityPhoneAndRootOrgId(securityPhone, rootOrgId);
+		}
+
+		if (count > 1) {
+			throw new StatusException("B-160210",
+					"参数过多,只需要[studentId,identityNumber,studentCode,securityPhone]中的一个");
+		}
+
+		if (null == s) {
+			throw new StatusException("B-160211", "学生不存在");
+		}
+
+		StudentInfo info = new StudentInfo();
+		info.setId(s.getId());
+		info.setEnable(s.getEnable());
+		info.setIdentityNumber(s.getIdentityNumber());
+		info.setName(s.getName());
+		info.setOrgId(s.getOrgId());
+		if (null != s.getOrgId()) {
+			OrgEntity org = orgRepo.findOne(s.getOrgId());
+			if (null != org) {
+				info.setOrgCode(org.getCode());
+				info.setOrgName(org.getName());
+			}
+		}
+		info.setPhoneNumber(s.getPhoneNumber());
+
+		if (StringUtils.isNotBlank(s.getPhotoPath())) {
+			String basePath = PropertiesUtil.getString(PropKeys.STUDENT_PHOTO_URL_PREFIX);
+			if (StringUtils.isBlank(basePath)) {
+				throw new StatusException("B-160212", "照片根路径未配置");
+			}
+			String path = UrlUtil.joinUrl(basePath, s.getPhotoPath());
+			info.setPhotoPath(path);
+		}
+
+		info.setRemark(s.getRemark());
+		info.setRootOrgId(s.getRootOrgId());
+		OrgEntity rootOrg = orgRepo.findOne(s.getRootOrgId());
+		info.setRootOrgName(rootOrg.getName());
+		info.setSecurityPhone(s.getSecurityPhone());
+		info.setStudentCode(s.getStudentCode());
+
+		return info;
+	}
+
+	@Override
+	public List<Long> unbindStudentCode(Long rootOrgId, String studentCode, String identityNumber) {
+
+		if (null == rootOrgId) {
+			throw new StatusException("B-120001", "rootOrgId is null");
+		}
+
+		List<StudentEntity> studentList = Lists.newArrayList();
+
+		StudentEntity s1 = null;
+		StudentEntity s2 = null;
+		if (null != studentCode) {
+			s1 = studentRepo.findByStudentCodeAndRootOrgId(studentCode, rootOrgId);
+			if (null != s1) {
+				studentList.add(s1);
+			}
+		}
+		if (null != identityNumber) {
+			s2 = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
+			if (null != s2) {
+				if (null == s1 || !s1.getId().equals(s2.getId())) {
+					studentList.add(s2);
+				}
+			}
+		}
+
+		List<Long> studentIdList = Lists.newArrayList();
+
+		for (StudentEntity cur : studentList) {
+			cur.setStudentCode(null);
+			StudentEntity saved = studentRepo.save(cur);
+			studentIdList.add(saved.getId());
+
+			SyncStudentReq req = new SyncStudentReq();
+			req.setEnable(saved.getEnable());
+			req.setId(saved.getId());
+			req.setIdentityNumber(saved.getIdentityNumber());
+			req.setName(saved.getName());
+
+			req.setOrgId(saved.getOrgId());
+			OrgEntity org = orgRepo.findOne(saved.getOrgId());
+			req.setOrgCode(org.getCode());
+			req.setOrgName(org.getName());
+
+			req.setPhoneNumber(saved.getPhoneNumber());
+			req.setPhotoPath(saved.getPhotoPath());
+			req.setRootOrgId(saved.getRootOrgId());
+			req.setSecurityPhone(saved.getSecurityPhone());
+			req.setStudentCode(saved.getStudentCode());
+
+			req.setSyncType("update");
+
+			dataSyncCloudService.syncStudent(req);
+		}
+
+		return studentIdList;
+	}
+
+	@Override
+	public Boolean hasBeBound(String securityPhone) {
+
+		StudentEntity s = studentRepo.findBySecurityPhone(securityPhone);
+		return null != s;
+	}
+
+}

+ 124 - 124
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/SysConfigServiceImpl.java

@@ -1,124 +1,124 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.commons.base.helpers.DataType;
-import cn.com.qmth.examcloud.commons.base.util.DateUtil;
-import cn.com.qmth.examcloud.commons.base.util.DateUtil.DatePatterns;
-import cn.com.qmth.examcloud.core.basic.dao.SysConfigRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.SysConfigEntity;
-import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
-
-/**
- * 系统配置服务
- *
- * @author WANGWEI
- * @date 2018年12月3日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Service
-public class SysConfigServiceImpl implements SysConfigService {
-
-	@Autowired
-	SysConfigRepo sysConfigRepo;
-
-	@Override
-	public void set(String key, String value) {
-		if (StringUtils.isBlank(key)) {
-			throw new StatusException("B-350001", "key is blank");
-		}
-
-		SysConfigEntity sysConf = sysConfigRepo.getOne(key);
-		if (null == sysConf) {
-			throw new StatusException("B-350002", "key is wrong");
-		}
-		DataType dataType = sysConf.getDataType();
-
-		if (StringUtils.isBlank(value)) {
-			sysConf.setValue(null);
-		} else if (dataType.equals(DataType.STRING)) {
-			sysConf.setValue(value);
-		} else if (dataType.equals(DataType.LONG)) {
-			try {
-				sysConf.setValue(String.valueOf(Long.parseLong(value)));
-			} catch (NumberFormatException e) {
-				throw new StatusException("B-350002", "value is wrong");
-			}
-		} else if (dataType.equals(DataType.INTEGER)) {
-			try {
-				sysConf.setValue(String.valueOf(Integer.parseInt(value)));
-			} catch (NumberFormatException e) {
-				throw new StatusException("B-350002", "value is wrong");
-			}
-		} else if (dataType.equals(DataType.DATE)) {
-			try {
-				sysConf.setValue(
-						DateUtil.format(DateUtil.parse(value, DatePatterns.ISO), DatePatterns.ISO));
-			} catch (Exception e) {
-				throw new StatusException("B-350002", "value is wrong");
-			}
-		} else if (dataType.equals(DataType.BOOLEAN)) {
-			if ("true".equals(value)) {
-				sysConf.setValue(value);
-			} else if ("false".equals(value)) {
-				sysConf.setValue(value);
-			} else {
-				throw new StatusException("B-350002", "value is wrong");
-			}
-		}
-
-	}
-
-	@Override
-	public Object get(String key) {
-		if (StringUtils.isBlank(key)) {
-			throw new StatusException("B-350001", "key is blank");
-		}
-
-		SysConfigEntity sysConf = sysConfigRepo.getOne(key);
-		if (null == sysConf) {
-			throw new StatusException("B-350002", "key is wrong");
-		}
-
-		String value = sysConf.getValue();
-		DataType dataType = sysConf.getDataType();
-
-		if (StringUtils.isBlank(value)) {
-			return null;
-		} else if (dataType.equals(DataType.STRING)) {
-			return value;
-		} else if (dataType.equals(DataType.LONG)) {
-			try {
-				return Long.parseLong(value);
-			} catch (NumberFormatException e) {
-				throw new StatusException("B-350002", "value is wrong");
-			}
-		} else if (dataType.equals(DataType.INTEGER)) {
-			try {
-				return Integer.parseInt(value);
-			} catch (NumberFormatException e) {
-				throw new StatusException("B-350002", "value is wrong");
-			}
-		} else if (dataType.equals(DataType.DATE)) {
-			try {
-				return DateUtil.parse(value, DatePatterns.ISO);
-			} catch (Exception e) {
-				throw new StatusException("B-350002", "value is wrong");
-			}
-		} else if (dataType.equals(DataType.BOOLEAN)) {
-			if ("true".equals(value)) {
-				return true;
-			} else if ("false".equals(value)) {
-				return false;
-			} else {
-				throw new StatusException("B-350002", "value is wrong. value=" + value);
-			}
-		} else {
-			throw new StatusException("B-350003", "dataType is undefined");
-		}
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.helpers.DataType;
+import cn.com.qmth.examcloud.commons.util.DateUtil;
+import cn.com.qmth.examcloud.commons.util.DateUtil.DatePatterns;
+import cn.com.qmth.examcloud.core.basic.dao.SysConfigRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.SysConfigEntity;
+import cn.com.qmth.examcloud.core.basic.service.SysConfigService;
+
+/**
+ * 系统配置服务
+ *
+ * @author WANGWEI
+ * @date 2018年12月3日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Service
+public class SysConfigServiceImpl implements SysConfigService {
+
+	@Autowired
+	SysConfigRepo sysConfigRepo;
+
+	@Override
+	public void set(String key, String value) {
+		if (StringUtils.isBlank(key)) {
+			throw new StatusException("B-350001", "key is blank");
+		}
+
+		SysConfigEntity sysConf = sysConfigRepo.getOne(key);
+		if (null == sysConf) {
+			throw new StatusException("B-350002", "key is wrong");
+		}
+		DataType dataType = sysConf.getDataType();
+
+		if (StringUtils.isBlank(value)) {
+			sysConf.setValue(null);
+		} else if (dataType.equals(DataType.STRING)) {
+			sysConf.setValue(value);
+		} else if (dataType.equals(DataType.LONG)) {
+			try {
+				sysConf.setValue(String.valueOf(Long.parseLong(value)));
+			} catch (NumberFormatException e) {
+				throw new StatusException("B-350002", "value is wrong");
+			}
+		} else if (dataType.equals(DataType.INTEGER)) {
+			try {
+				sysConf.setValue(String.valueOf(Integer.parseInt(value)));
+			} catch (NumberFormatException e) {
+				throw new StatusException("B-350002", "value is wrong");
+			}
+		} else if (dataType.equals(DataType.DATE)) {
+			try {
+				sysConf.setValue(
+						DateUtil.format(DateUtil.parse(value, DatePatterns.ISO), DatePatterns.ISO));
+			} catch (Exception e) {
+				throw new StatusException("B-350002", "value is wrong");
+			}
+		} else if (dataType.equals(DataType.BOOLEAN)) {
+			if ("true".equals(value)) {
+				sysConf.setValue(value);
+			} else if ("false".equals(value)) {
+				sysConf.setValue(value);
+			} else {
+				throw new StatusException("B-350002", "value is wrong");
+			}
+		}
+
+	}
+
+	@Override
+	public Object get(String key) {
+		if (StringUtils.isBlank(key)) {
+			throw new StatusException("B-350001", "key is blank");
+		}
+
+		SysConfigEntity sysConf = sysConfigRepo.getOne(key);
+		if (null == sysConf) {
+			throw new StatusException("B-350002", "key is wrong");
+		}
+
+		String value = sysConf.getValue();
+		DataType dataType = sysConf.getDataType();
+
+		if (StringUtils.isBlank(value)) {
+			return null;
+		} else if (dataType.equals(DataType.STRING)) {
+			return value;
+		} else if (dataType.equals(DataType.LONG)) {
+			try {
+				return Long.parseLong(value);
+			} catch (NumberFormatException e) {
+				throw new StatusException("B-350002", "value is wrong");
+			}
+		} else if (dataType.equals(DataType.INTEGER)) {
+			try {
+				return Integer.parseInt(value);
+			} catch (NumberFormatException e) {
+				throw new StatusException("B-350002", "value is wrong");
+			}
+		} else if (dataType.equals(DataType.DATE)) {
+			try {
+				return DateUtil.parse(value, DatePatterns.ISO);
+			} catch (Exception e) {
+				throw new StatusException("B-350002", "value is wrong");
+			}
+		} else if (dataType.equals(DataType.BOOLEAN)) {
+			if ("true".equals(value)) {
+				return true;
+			} else if ("false".equals(value)) {
+				return false;
+			} else {
+				throw new StatusException("B-350002", "value is wrong. value=" + value);
+			}
+		} else {
+			throw new StatusException("B-350003", "dataType is undefined");
+		}
+	}
+
+}

+ 56 - 56
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/UserServiceImpl.java

@@ -1,56 +1,56 @@
-package cn.com.qmth.examcloud.core.basic.service.impl;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import cn.com.qmth.examcloud.commons.base.exception.StatusException;
-import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
-import cn.com.qmth.examcloud.core.basic.service.UserService;
-import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
-import cn.com.qmth.examcloud.task.api.request.SyncUserReq;
-
-/**
- * 用户服务类 Created by songyue on 17/1/13.
- */
-@Service
-public class UserServiceImpl implements UserService {
-
-	@Autowired
-	UserRepo userRepo;
-
-	@Autowired
-	DataSyncCloudService dataSyncCloudService;
-
-	public UserEntity save(UserEntity user) {
-		UserEntity one = userRepo.findByRootOrgIdAndLoginName(user.getRootOrgId(),
-				user.getLoginName());
-		if (one != null && (!one.getId().equals(user.getId()))) {
-			throw new StatusException("B-150002", "登录名已存在");
-		}
-
-		long updateTime = 0L;
-		if (null != one && null != one.getUpdateTime()) {
-			updateTime = one.getUpdateTime().getTime();
-		}
-
-		UserEntity saved = userRepo.save(user);
-
-		if (updateTime != saved.getUpdateTime().getTime()) {
-			SyncUserReq r = new SyncUserReq();
-			r.setEnable(saved.getEnable());
-			r.setId(saved.getId());
-			r.setLoginName(saved.getLoginName());
-			r.setName(saved.getName());
-			r.setOrgId(saved.getOrgId());
-			r.setPhoneNumber(saved.getPhoneNumber());
-			r.setRootOrgId(saved.getRootOrgId());
-			r.setSyncType("update");
-
-			dataSyncCloudService.syncUser(r);
-		}
-
-		return saved;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.service.impl;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
+import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
+import cn.com.qmth.examcloud.core.basic.service.UserService;
+import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
+import cn.com.qmth.examcloud.task.api.request.SyncUserReq;
+
+/**
+ * 用户服务类 Created by songyue on 17/1/13.
+ */
+@Service
+public class UserServiceImpl implements UserService {
+
+	@Autowired
+	UserRepo userRepo;
+
+	@Autowired
+	DataSyncCloudService dataSyncCloudService;
+
+	public UserEntity save(UserEntity user) {
+		UserEntity one = userRepo.findByRootOrgIdAndLoginName(user.getRootOrgId(),
+				user.getLoginName());
+		if (one != null && (!one.getId().equals(user.getId()))) {
+			throw new StatusException("B-150002", "登录名已存在");
+		}
+
+		long updateTime = 0L;
+		if (null != one && null != one.getUpdateTime()) {
+			updateTime = one.getUpdateTime().getTime();
+		}
+
+		UserEntity saved = userRepo.save(user);
+
+		if (updateTime != saved.getUpdateTime().getTime()) {
+			SyncUserReq r = new SyncUserReq();
+			r.setEnable(saved.getEnable());
+			r.setId(saved.getId());
+			r.setLoginName(saved.getLoginName());
+			r.setName(saved.getName());
+			r.setOrgId(saved.getOrgId());
+			r.setPhoneNumber(saved.getPhoneNumber());
+			r.setRootOrgId(saved.getRootOrgId());
+			r.setSyncType("update");
+
+			dataSyncCloudService.syncUser(r);
+		}
+
+		return saved;
+	}
+
+}

+ 131 - 131
examcloud-core-basic-starter/src/main/java/cn/com/qmth/examcloud/core/basic/starter/CoreBasicApp.java

@@ -1,131 +1,131 @@
-package cn.com.qmth.examcloud.core.basic.starter;
-
-import java.util.Properties;
-
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.autoconfigure.domain.EntityScan;
-import org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration;
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.cloud.client.loadbalancer.LoadBalanced;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
-import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
-import org.springframework.data.redis.serializer.StringRedisSerializer;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-import org.springframework.web.client.RestTemplate;
-import org.springframework.web.multipart.MultipartResolver;
-import org.springframework.web.multipart.commons.CommonsMultipartResolver;
-
-import com.fasterxml.jackson.annotation.JsonAutoDetect;
-import com.fasterxml.jackson.annotation.PropertyAccessor;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.google.code.kaptcha.impl.DefaultKaptcha;
-import com.google.code.kaptcha.util.Config;
-
-import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
-import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
-import cn.com.qmth.examcloud.commons.base.logging.SLF4JImpl;
-import cn.com.qmth.examcloud.commons.web.boot.ExamCloudApp;
-import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
-import cn.com.qmth.examcloud.commons.web.redis.RedisClientImpl;
-import cn.com.qmth.examcloud.commons.web.support.CustomResponseErrorHandler;
-import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
-
-@ComponentScan(basePackages = {"cn.com.qmth"})
-@EntityScan(basePackages = {"cn.com.qmth"})
-@EnableJpaRepositories(basePackages = {"cn.com.qmth"})
-@EnableJpaAuditing
-@EnableTransactionManagement
-@SpringBootApplication
-@EnableEurekaClient
-@EnableDiscoveryClient
-@EnableAutoConfiguration(exclude = {MultipartAutoConfiguration.class})
-public class CoreBasicApp {
-
-	private static final ExamCloudLog LOG = ExamCloudLogFactory.getLog(CoreBasicApp.class);
-
-	/**
-	 * main
-	 *
-	 * @author WANGWEI
-	 * @param args
-	 * @throws Exception
-	 */
-	public static void main(String[] args) throws Exception {
-
-		if (LOG instanceof SLF4JImpl) {
-			MDC.put("TRACE_ID", Thread.currentThread().getName());
-		}
-
-		OrgProperty.init();
-
-		ExamCloudApp.run(CoreBasicApp.class, "basic", args);
-	}
-
-	@Bean
-	@LoadBalanced
-	public RestTemplate restTemplate() {
-		RestTemplate restTemplate = new RestTemplate();
-		restTemplate.setErrorHandler(new CustomResponseErrorHandler());
-		return restTemplate;
-	}
-
-	@Bean
-	public RedisTemplate<String, Object> redisTemplate(
-			RedisConnectionFactory redisConnectionFactory) {
-		RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
-		redisTemplate.setConnectionFactory(redisConnectionFactory);
-		Jackson2JsonRedisSerializer<?> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(
-				Object.class);
-		ObjectMapper objectMapper = new ObjectMapper();
-		objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
-		objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
-		jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
-		redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
-		redisTemplate.setKeySerializer(new StringRedisSerializer());
-		redisTemplate.afterPropertiesSet();
-		return redisTemplate;
-	}
-
-	@Bean
-	@Autowired
-	public RedisClient redisClient(RedisTemplate<String, Object> redisTemplate) {
-		return new RedisClientImpl(redisTemplate);
-	}
-
-	@Bean(name = "multipartResolver")
-	public MultipartResolver multipartResolver() {
-		CommonsMultipartResolver resolver = new CommonsMultipartResolver();
-		resolver.setDefaultEncoding("UTF-8");
-		resolver.setResolveLazily(true);
-		resolver.setMaxInMemorySize(2);
-		resolver.setMaxUploadSize(200 * 1024 * 1024);
-		return resolver;
-	}
-
-	@Bean
-	public DefaultKaptcha getDefaultKaptcha() {
-		DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
-		Properties properties = new Properties();
-		properties.setProperty("kaptcha.border", "no");
-		properties.setProperty("kaptcha.border.color", "105,179,90");
-		properties.setProperty("kaptcha.textproducer.font.color", "blue");
-		properties.setProperty("kaptcha.image.width", "120");
-		properties.setProperty("kaptcha.image.height", "50");
-		properties.setProperty("kaptcha.textproducer.char.length", "4");
-		properties.setProperty("kaptcha.textproducer.font.names", "Microsoft Yahei");
-		Config config = new Config(properties);
-		defaultKaptcha.setConfig(config);
-
-		return defaultKaptcha;
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.starter;
+
+import java.util.Properties;
+
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.boot.autoconfigure.web.MultipartAutoConfiguration;
+import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
+import org.springframework.cloud.client.loadbalancer.LoadBalanced;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.client.RestTemplate;
+import org.springframework.web.multipart.MultipartResolver;
+import org.springframework.web.multipart.commons.CommonsMultipartResolver;
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.code.kaptcha.impl.DefaultKaptcha;
+import com.google.code.kaptcha.util.Config;
+
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
+import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
+import cn.com.qmth.examcloud.commons.logging.SLF4JImpl;
+import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
+import cn.com.qmth.examcloud.web.boot.ExamCloudApp;
+import cn.com.qmth.examcloud.web.redis.RedisClient;
+import cn.com.qmth.examcloud.web.redis.RedisClientImpl;
+import cn.com.qmth.examcloud.web.support.CustomResponseErrorHandler;
+
+@ComponentScan(basePackages = {"cn.com.qmth"})
+@EntityScan(basePackages = {"cn.com.qmth"})
+@EnableJpaRepositories(basePackages = {"cn.com.qmth"})
+@EnableJpaAuditing
+@EnableTransactionManagement
+@SpringBootApplication
+@EnableEurekaClient
+@EnableDiscoveryClient
+@EnableAutoConfiguration(exclude = {MultipartAutoConfiguration.class})
+public class CoreBasicApp {
+
+	private static final ExamCloudLog LOG = ExamCloudLogFactory.getLog(CoreBasicApp.class);
+
+	/**
+	 * main
+	 *
+	 * @author WANGWEI
+	 * @param args
+	 * @throws Exception
+	 */
+	public static void main(String[] args) throws Exception {
+
+		if (LOG instanceof SLF4JImpl) {
+			MDC.put("TRACE_ID", Thread.currentThread().getName());
+		}
+
+		OrgProperty.init();
+
+		ExamCloudApp.run(CoreBasicApp.class, "basic", args);
+	}
+
+	@Bean
+	@LoadBalanced
+	public RestTemplate restTemplate() {
+		RestTemplate restTemplate = new RestTemplate();
+		restTemplate.setErrorHandler(new CustomResponseErrorHandler());
+		return restTemplate;
+	}
+
+	@Bean
+	public RedisTemplate<String, Object> redisTemplate(
+			RedisConnectionFactory redisConnectionFactory) {
+		RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+		redisTemplate.setConnectionFactory(redisConnectionFactory);
+		Jackson2JsonRedisSerializer<?> jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer<>(
+				Object.class);
+		ObjectMapper objectMapper = new ObjectMapper();
+		objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+		objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
+		jackson2JsonRedisSerializer.setObjectMapper(objectMapper);
+		redisTemplate.setValueSerializer(jackson2JsonRedisSerializer);
+		redisTemplate.setKeySerializer(new StringRedisSerializer());
+		redisTemplate.afterPropertiesSet();
+		return redisTemplate;
+	}
+
+	@Bean
+	@Autowired
+	public RedisClient redisClient(RedisTemplate<String, Object> redisTemplate) {
+		return new RedisClientImpl(redisTemplate);
+	}
+
+	@Bean(name = "multipartResolver")
+	public MultipartResolver multipartResolver() {
+		CommonsMultipartResolver resolver = new CommonsMultipartResolver();
+		resolver.setDefaultEncoding("UTF-8");
+		resolver.setResolveLazily(true);
+		resolver.setMaxInMemorySize(2);
+		resolver.setMaxUploadSize(200 * 1024 * 1024);
+		return resolver;
+	}
+
+	@Bean
+	public DefaultKaptcha getDefaultKaptcha() {
+		DefaultKaptcha defaultKaptcha = new DefaultKaptcha();
+		Properties properties = new Properties();
+		properties.setProperty("kaptcha.border", "no");
+		properties.setProperty("kaptcha.border.color", "105,179,90");
+		properties.setProperty("kaptcha.textproducer.font.color", "blue");
+		properties.setProperty("kaptcha.image.width", "120");
+		properties.setProperty("kaptcha.image.height", "50");
+		properties.setProperty("kaptcha.textproducer.char.length", "4");
+		properties.setProperty("kaptcha.textproducer.font.names", "Microsoft Yahei");
+		Config config = new Config(properties);
+		defaultKaptcha.setConfig(config);
+
+		return defaultKaptcha;
+	}
+
+}

+ 39 - 39
examcloud-core-basic-starter/src/main/java/cn/com/qmth/examcloud/core/basic/starter/config/AppSelfInspection.java

@@ -1,39 +1,39 @@
-package cn.com.qmth.examcloud.core.basic.starter.config;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.ApplicationArguments;
-import org.springframework.boot.ApplicationRunner;
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Component;
-
-import cn.com.qmth.examcloud.commons.web.support.RemoteProcedureCallTester;
-
-/**
- * 应用自检
- *
- * @author WANGWEI
- * @date 2018年6月21日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Component
-@Order(1)
-public class AppSelfInspection implements ApplicationRunner {
-
-	@Autowired
-	RemoteProcedureCallTester remoteCallTester;
-
-	/**
-	 * 自检
-	 *
-	 * @author WANGWEI
-	 */
-	private void inspect() {
-		// remoteCallTester.testRestTemplate("XXXXX");
-	}
-
-	@Override
-	public void run(ApplicationArguments args) throws Exception {
-		inspect();
-	}
-
-}
+package cn.com.qmth.examcloud.core.basic.starter.config;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import cn.com.qmth.examcloud.web.support.RemoteProcedureCallTester;
+
+/**
+ * 应用自检
+ *
+ * @author WANGWEI
+ * @date 2018年6月21日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Component
+@Order(1)
+public class AppSelfInspection implements ApplicationRunner {
+
+	@Autowired
+	RemoteProcedureCallTester remoteCallTester;
+
+	/**
+	 * 自检
+	 *
+	 * @author WANGWEI
+	 */
+	private void inspect() {
+		// remoteCallTester.testRestTemplate("XXXXX");
+	}
+
+	@Override
+	public void run(ApplicationArguments args) throws Exception {
+		inspect();
+	}
+
+}

+ 126 - 126
examcloud-core-basic-starter/src/main/java/cn/com/qmth/examcloud/core/basic/starter/config/DefaultWebMvcConfigurerAdapter.java

@@ -1,126 +1,126 @@
-package cn.com.qmth.examcloud.core.basic.starter.config;
-
-import java.util.List;
-import java.util.Set;
-
-import org.apache.commons.collections.CollectionUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
-
-import com.google.common.collect.Sets;
-
-import cn.com.qmth.examcloud.commons.base.util.PathUtil;
-import cn.com.qmth.examcloud.commons.base.util.PropertiesUtil;
-import cn.com.qmth.examcloud.commons.base.util.RegExpUtil;
-import cn.com.qmth.examcloud.commons.web.interceptor.FirstInterceptor;
-import cn.com.qmth.examcloud.commons.web.interceptor.SeqlockInterceptor;
-import cn.com.qmth.examcloud.commons.web.redis.RedisClient;
-import cn.com.qmth.examcloud.commons.web.security.RequestPermissionInterceptor;
-import cn.com.qmth.examcloud.commons.web.security.SpringCloudInterceptor;
-import cn.com.qmth.examcloud.commons.web.security.bean.Role;
-import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.security.bean.UserType;
-import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
-
-/**
- * 默认WebMvcConfigurer
- *
- * @author WANGWEI
- * @date 2018年5月22日
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
- */
-@Configuration
-public class DefaultWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
-
-	@Autowired
-	RedisClient redisClient;
-
-	static {
-		PropertiesUtil.configure(PathUtil.getResoucePath("security-mapping.properties"));
-	}
-
-	@Override
-	public void addInterceptors(InterceptorRegistry registry) {
-		registry.addInterceptor(new FirstInterceptor()).addPathPatterns("/**");
-
-		SpringCloudInterceptor springCloudInterceptor = new SpringCloudInterceptor();
-		springCloudInterceptor.setRedisClient(redisClient);
-		registry.addInterceptor(springCloudInterceptor).addPathPatterns("/**");
-
-		RequestPermissionInterceptor requestPermissionInterceptor = getRequestPermissionInterceptor();
-		requestPermissionInterceptor.configure("security-exclusions.conf");
-		registry.addInterceptor(requestPermissionInterceptor).addPathPatterns("/**");
-
-		registry.addInterceptor(new SeqlockInterceptor(redisClient)).addPathPatterns("/**");
-
-		super.addInterceptors(registry);
-	}
-
-	@Bean
-	public RequestPermissionInterceptor getRequestPermissionInterceptor() {
-		return new RequestPermissionInterceptor(redisClient) {
-
-			@Override
-			public boolean hasPermission(String mappingPath, User user) {
-
-				// 学生鉴权
-				if (user.getUserType().equals(UserType.STUDENT)) {
-					String key = "[s]" + mappingPath;
-					return PropertiesUtil.getBoolean(key, false);
-				}
-
-				List<Role> roleList = user.getRoleList();
-
-				if (CollectionUtils.isEmpty(roleList)) {
-					return false;
-				}
-
-				for (Role role : roleList) {
-					if (role.getRoleCode().equals(RoleMeta.SUPER_ADMIN.name())) {
-						return true;
-					}
-				}
-
-				// 权限组集合
-				String privilegeGroups = PropertiesUtil.getString(mappingPath);
-				if (StringUtils.isBlank(privilegeGroups)) {
-					return true;
-				}
-
-				// 用户权限集合
-				Set<String> rolePrivilegeList = Sets.newHashSet();
-				Long rootOrgId = user.getRootOrgId();
-				for (Role role : roleList) {
-					String key = "$_P_" + rootOrgId + "_" + role.getRoleId();
-					String rolePrivileges = redisClient.get(key, String.class);
-
-					List<String> rpList = RegExpUtil.findAll(rolePrivileges, "\\w+");
-					rolePrivilegeList.addAll(rpList);
-				}
-
-				List<String> privilegeGroupList = RegExpUtil.findAll(privilegeGroups, "[^\\;]+");
-
-				for (String pg : privilegeGroupList) {
-					pg = pg.trim();
-					if (StringUtils.isBlank(pg)) {
-						continue;
-					}
-
-					List<String> pList = RegExpUtil.findAll(pg, "[^\\,]+");
-					if (rolePrivilegeList.containsAll(pList)) {
-						return true;
-					} else {
-						continue;
-					}
-				}
-
-				return false;
-			}
-
-		};
-	}
-}
+package cn.com.qmth.examcloud.core.basic.starter.config;
+
+import java.util.List;
+import java.util.Set;
+
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+import com.google.common.collect.Sets;
+
+import cn.com.qmth.examcloud.commons.util.PathUtil;
+import cn.com.qmth.examcloud.commons.util.PropertiesUtil;
+import cn.com.qmth.examcloud.commons.util.RegExpUtil;
+import cn.com.qmth.examcloud.web.interceptor.FirstInterceptor;
+import cn.com.qmth.examcloud.web.interceptor.SeqlockInterceptor;
+import cn.com.qmth.examcloud.web.redis.RedisClient;
+import cn.com.qmth.examcloud.web.security.RequestPermissionInterceptor;
+import cn.com.qmth.examcloud.web.security.SpringCloudInterceptor;
+import cn.com.qmth.examcloud.web.security.bean.Role;
+import cn.com.qmth.examcloud.web.security.bean.User;
+import cn.com.qmth.examcloud.web.security.bean.UserType;
+import cn.com.qmth.examcloud.web.security.enums.RoleMeta;
+
+/**
+ * 默认WebMvcConfigurer
+ *
+ * @author WANGWEI
+ * @date 2018年5月22日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Configuration
+public class DefaultWebMvcConfigurerAdapter extends WebMvcConfigurerAdapter {
+
+	@Autowired
+	RedisClient redisClient;
+
+	static {
+		PropertiesUtil.configure(PathUtil.getResoucePath("security-mapping.properties"));
+	}
+
+	@Override
+	public void addInterceptors(InterceptorRegistry registry) {
+		registry.addInterceptor(new FirstInterceptor()).addPathPatterns("/**");
+
+		SpringCloudInterceptor springCloudInterceptor = new SpringCloudInterceptor();
+		springCloudInterceptor.setRedisClient(redisClient);
+		registry.addInterceptor(springCloudInterceptor).addPathPatterns("/**");
+
+		RequestPermissionInterceptor requestPermissionInterceptor = getRequestPermissionInterceptor();
+		requestPermissionInterceptor.configure("security-exclusions.conf");
+		registry.addInterceptor(requestPermissionInterceptor).addPathPatterns("/**");
+
+		registry.addInterceptor(new SeqlockInterceptor(redisClient)).addPathPatterns("/**");
+
+		super.addInterceptors(registry);
+	}
+
+	@Bean
+	public RequestPermissionInterceptor getRequestPermissionInterceptor() {
+		return new RequestPermissionInterceptor(redisClient) {
+
+			@Override
+			public boolean hasPermission(String mappingPath, User user) {
+
+				// 学生鉴权
+				if (user.getUserType().equals(UserType.STUDENT)) {
+					String key = "[s]" + mappingPath;
+					return PropertiesUtil.getBoolean(key, false);
+				}
+
+				List<Role> roleList = user.getRoleList();
+
+				if (CollectionUtils.isEmpty(roleList)) {
+					return false;
+				}
+
+				for (Role role : roleList) {
+					if (role.getRoleCode().equals(RoleMeta.SUPER_ADMIN.name())) {
+						return true;
+					}
+				}
+
+				// 权限组集合
+				String privilegeGroups = PropertiesUtil.getString(mappingPath);
+				if (StringUtils.isBlank(privilegeGroups)) {
+					return true;
+				}
+
+				// 用户权限集合
+				Set<String> rolePrivilegeList = Sets.newHashSet();
+				Long rootOrgId = user.getRootOrgId();
+				for (Role role : roleList) {
+					String key = "$_P_" + rootOrgId + "_" + role.getRoleId();
+					String rolePrivileges = redisClient.get(key, String.class);
+
+					List<String> rpList = RegExpUtil.findAll(rolePrivileges, "\\w+");
+					rolePrivilegeList.addAll(rpList);
+				}
+
+				List<String> privilegeGroupList = RegExpUtil.findAll(privilegeGroups, "[^\\;]+");
+
+				for (String pg : privilegeGroupList) {
+					pg = pg.trim();
+					if (StringUtils.isBlank(pg)) {
+						continue;
+					}
+
+					List<String> pList = RegExpUtil.findAll(pg, "[^\\,]+");
+					if (rolePrivilegeList.containsAll(pList)) {
+						return true;
+					} else {
+						continue;
+					}
+				}
+
+				return false;
+			}
+
+		};
+	}
+}