wangwei 6 năm trước cách đây
mục cha
commit
00ffd2a2cd
17 tập tin đã thay đổi với 433 bổ sung404 xóa
  1. 63 43
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/OrgController.java
  2. 4 4
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/UserController.java
  3. 2 2
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/CourseCloudServiceProvider.java
  4. 7 7
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/OrgCloudServiceProvider.java
  5. 4 4
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/StudentCloudServiceProvider.java
  6. 3 3
      examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/provider/UserCloudServiceProvider.java
  7. 28 0
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/OrgPropertyRepo.java
  8. 14 15
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/OrgRepo.java
  9. 0 251
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/Org.java
  10. 141 0
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/OrgEntity.java
  11. 72 0
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/OrgPropertyEntity.java
  12. 34 0
      examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/enums/OrgProperty.java
  13. 5 5
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/AuthServiceImpl.java
  14. 22 58
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/OrgService.java
  15. 10 12
      examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/StudentServiceImpl.java
  16. 11 0
      examcloud-core-basic-starter/src/main/java/cn/com/qmth/examcloud/core/basic/starter/CoreBasicApp.java
  17. 13 0
      examcloud-core-basic-starter/src/main/resources/org-properties.xml

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

@@ -22,7 +22,6 @@ 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.jdbc.core.JdbcTemplate;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -38,13 +37,18 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
 import com.google.common.collect.Lists;
 
 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.PropertiesUtil;
 import cn.com.qmth.examcloud.commons.base.util.excel.ExcelError;
 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.base.constants.PropKeys;
+import cn.com.qmth.examcloud.core.basic.dao.OrgPropertyRepo;
 import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
+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.OrgDto;
 import cn.com.qmth.examcloud.core.basic.service.impl.ExportService;
 import cn.com.qmth.examcloud.core.basic.service.impl.OrgService;
@@ -65,7 +69,7 @@ public class OrgController extends ControllerSupport {
 	OrgService orgService;
 
 	@Autowired
-	private JdbcTemplate jdbcTemplate;
+	OrgPropertyRepo orgPropertyRepo;
 
 	/**
 	 * 方法注释
@@ -76,8 +80,8 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "按ID查询机构", notes = "ID查询")
 	@GetMapping("/{id}")
-	public Org getOrg(@PathVariable Long id) {
-		Org org = orgService.findOne(id);
+	public OrgEntity getOrg(@PathVariable Long id) {
+		OrgEntity org = orgService.findOne(id);
 		return org;
 	}
 
@@ -90,8 +94,8 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "查询下属机构不带分页", notes = "不分页")
 	@GetMapping("/sub/{parentId}")
-	public List<Org> getSubOrgList(@PathVariable Long parentId) {
-		List<Org> orgList = orgRepo.findByParentIdAndEnable(parentId, true);
+	public List<OrgEntity> getSubOrgList(@PathVariable Long parentId) {
+		List<OrgEntity> orgList = orgRepo.findByParentIdAndEnable(parentId, true);
 		return orgList;
 	}
 
@@ -108,7 +112,7 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "模糊查询顶级机构的子机构")
 	@GetMapping("/getSubOrgList/{curPage}/{pageSize}")
-	public Page<Org> getSubOrgListOfRootOrg(@PathVariable Integer curPage,
+	public Page<OrgEntity> getSubOrgListOfRootOrg(@PathVariable Integer curPage,
 			@PathVariable Integer pageSize, @RequestParam Long rootOrgId, @RequestParam String code,
 			@RequestParam String name) {
 
@@ -122,12 +126,12 @@ public class OrgController extends ControllerSupport {
 		Pageable pageable = new PageRequest(curPage - 1, pageSize, Sort.Direction.DESC,
 				"updateTime");
 
-		Org criteria = new Org();
+		OrgEntity criteria = new OrgEntity();
 		criteria.setParentId(rootOrgId);
 		criteria.setCode(code);
 		criteria.setName(name);
 
-		Specification<Org> specification = (root, query, cb) -> {
+		Specification<OrgEntity> specification = (root, query, cb) -> {
 			List<Predicate> predicates = new ArrayList<>();
 			if (StringUtils.isNotEmpty(criteria.getName())) {
 				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(criteria.getName())));
@@ -139,7 +143,7 @@ public class OrgController extends ControllerSupport {
 			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
 		};
 
-		Page<Org> ret = orgRepo.findAll(specification, pageable);
+		Page<OrgEntity> ret = orgRepo.findAll(specification, pageable);
 		return ret;
 	}
 
@@ -151,16 +155,16 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "查询所有顶级机构")
 	@GetMapping("/getAllRootOrgList")
-	public List<Org> getAllRootOrgList() {
+	public List<OrgEntity> getAllRootOrgList() {
 
-		Specification<Org> specification = (root, query, cb) -> {
+		Specification<OrgEntity> specification = (root, query, cb) -> {
 			List<Predicate> predicates = new ArrayList<>();
 			predicates.add(cb.isNull(root.get("parentId")));
 			predicates.add(cb.equal(root.get("enable"), true));
 			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
 		};
 
-		List<Org> ret = orgRepo.findAll(specification);
+		List<OrgEntity> ret = orgRepo.findAll(specification);
 		return ret;
 	}
 
@@ -177,17 +181,17 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "模糊查询顶级机构")
 	@GetMapping("/getRootOrgList/{curPage}/{pageSize}")
-	public Page<Org> getRootOrgList(@PathVariable Integer curPage, @PathVariable Integer pageSize,
-			@RequestParam String code, @RequestParam String name) {
+	public Page<OrgEntity> getRootOrgList(@PathVariable Integer curPage,
+			@PathVariable Integer pageSize, @RequestParam String code, @RequestParam String name) {
 
 		Pageable pageable = new PageRequest(curPage - 1, pageSize, Sort.Direction.DESC,
 				"updateTime");
 
-		Org criteria = new Org();
+		OrgEntity criteria = new OrgEntity();
 		criteria.setCode(code);
 		criteria.setName(name);
 
-		Specification<Org> specification = (root, query, cb) -> {
+		Specification<OrgEntity> specification = (root, query, cb) -> {
 			List<Predicate> predicates = new ArrayList<>();
 			if (StringUtils.isNotEmpty(criteria.getName())) {
 				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(criteria.getName())));
@@ -199,7 +203,7 @@ public class OrgController extends ControllerSupport {
 			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
 		};
 
-		Page<Org> ret = orgRepo.findAll(specification, pageable);
+		Page<OrgEntity> ret = orgRepo.findAll(specification, pageable);
 		return ret;
 	}
 
@@ -213,14 +217,14 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "新增顶级机构", notes = "新增")
 	@PostMapping("addRootOrg")
-	public Org addRootOrg(@RequestBody Org org) {
+	public OrgEntity addRootOrg(@RequestBody OrgEntity org) {
 
 		if (!isSuperAdmin()) {
 			throw new StatusException("B-140001", "非法访问");
 		}
 
 		org.setParentId(null);
-		Org saved = orgService.save(org);
+		OrgEntity saved = orgService.save(org);
 		return saved;
 	}
 
@@ -233,7 +237,7 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "更新顶级机构", notes = "更新")
 	@PutMapping("updateRootOrg")
-	public Org updateRootOrg(@RequestBody Org org) {
+	public OrgEntity updateRootOrg(@RequestBody OrgEntity org) {
 		trim(org);
 		if (!isSuperAdmin()) {
 			throw new StatusException("B-140001", "非法访问");
@@ -241,7 +245,7 @@ public class OrgController extends ControllerSupport {
 
 		org.setParentId(null);
 		org.setRootId(org.getId());
-		Org saved = orgService.save(org);
+		OrgEntity saved = orgService.save(org);
 		return saved;
 	}
 
@@ -254,17 +258,17 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "新增子机构", notes = "新增")
 	@PostMapping("addSubOrg")
-	public Org addSubOrg(@RequestBody Org org) {
+	public OrgEntity addSubOrg(@RequestBody OrgEntity org) {
 		trim(org);
 		User accessUser = getAccessUser();
 
-		Org subOrg = orgRepo.findByRootIdAndCode(accessUser.getRootOrgId(), org.getCode());
+		OrgEntity subOrg = orgRepo.findByRootIdAndCode(accessUser.getRootOrgId(), org.getCode());
 		if (null != subOrg) {
 			throw new StatusException("B-140001", "机构代码已存在");
 		}
 		org.setParentId(accessUser.getRootOrgId());
 		org.setRootId(accessUser.getRootOrgId());
-		Org saved = orgService.save(org);
+		OrgEntity saved = orgService.save(org);
 
 		// orgService.createLearnerCenterUser(saved);
 		return saved;
@@ -280,12 +284,12 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "更新子机构", notes = "更新")
 	@PutMapping("updateSubOrg")
-	public Org updateSubOrg(@RequestBody Org org) {
+	public OrgEntity updateSubOrg(@RequestBody OrgEntity org) {
 		cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
 
 		org.setParentId(accessUser.getRootOrgId());
 		org.setRootId(accessUser.getRootOrgId());
-		Org saved = orgService.save(org);
+		OrgEntity saved = orgService.save(org);
 		return saved;
 	}
 
@@ -333,20 +337,25 @@ public class OrgController extends ControllerSupport {
 		}
 	}
 
-	@ApiOperation(value = "查询logo")
+	@ApiOperation(value = "获取logo")
 	@GetMapping("/logo")
 	public void getLogo(@RequestParam("domain") String domain, HttpServletResponse response)
 			throws IOException {
-		Org org = orgRepo.findRootOrg(domain);
-		String logo = org.getLogo();
-		IOUtils.copy(new FileInputStream(logo), response.getOutputStream());
-		response.flushBuffer();
+		OrgEntity org = orgRepo.findRootOrg(domain);
+		DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
+		DynamicEnum de = manager.getByName("LOGO_PATH");
+
+		OrgPropertyEntity entity = orgPropertyRepo.findByOrgIdAndKeyId(org.getId(), de.getId());
+		if (null != entity) {
+			IOUtils.copy(new FileInputStream(entity.getValue()), response.getOutputStream());
+			response.flushBuffer();
+		}
 	}
 
 	@ApiOperation(value = "查询顶级机构")
 	@GetMapping("/getRootOrgByCode")
-	public Org getRootOrgByCode(@RequestParam("code") String code) throws IOException {
-		Org org = orgRepo.findRootOrg(code);
+	public OrgEntity getRootOrgByCode(@RequestParam("code") String code) throws IOException {
+		OrgEntity org = orgRepo.findRootOrg(code);
 		return org;
 	}
 
@@ -360,8 +369,8 @@ public class OrgController extends ControllerSupport {
 	 * @throws IOException
 	 */
 	@ApiOperation(value = "导入logo", notes = "导入logo")
-	@PostMapping("/importLogo/{id}")
-	public void importLogo(@PathVariable Long id, HttpServletRequest request,
+	@PostMapping("/importLogo/{orgId}")
+	public void importLogo(@PathVariable Long orgId, HttpServletRequest request,
 			@RequestParam CommonsMultipartFile file) throws IOException {
 		String schoolLogoPath = PropertiesUtil.getString(PropKeys.SCHOOL_LOGO_PATH);
 		if (StringUtils.isBlank(schoolLogoPath)) {
@@ -371,17 +380,28 @@ public class OrgController extends ControllerSupport {
 		String name = fileItem.getName();
 		String filePath = null;
 		if (name.endsWith(".jpg")) {
-			filePath = schoolLogoPath + "/" + id + ".jpg";
+			filePath = schoolLogoPath + "/" + orgId + ".jpg";
 		} else if (name.endsWith(".gif")) {
-			filePath = schoolLogoPath + "/" + id + ".gif";
+			filePath = schoolLogoPath + "/" + orgId + ".gif";
 		} else if (name.endsWith(".png")) {
-			filePath = schoolLogoPath + "/" + id + ".png";
+			filePath = schoolLogoPath + "/" + orgId + ".png";
 		} else {
 			throw new StatusException("B-101001", "文件格式错误");
 		}
 
 		FileUtils.copyInputStreamToFile(file.getInputStream(), new File(filePath));
-		jdbcTemplate.update("update ecs_core_org t set  t.logo=? where t.id=?", filePath, id);
+
+		DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
+		DynamicEnum de = manager.getByName("LOGO_PATH");
+
+		OrgPropertyEntity entity = orgPropertyRepo.findByOrgIdAndKeyId(orgId, de.getId());
+		if (null == entity) {
+			entity = new OrgPropertyEntity();
+			entity.setId(de.getId());
+			entity.setOrgId(orgId);
+		}
+		entity.setValue(filePath);
+		orgPropertyRepo.save(entity);
 	}
 
 	/**
@@ -394,9 +414,9 @@ public class OrgController extends ControllerSupport {
 	 */
 	@ApiOperation(value = "按机构名称模糊查询子机构列表")
 	@PostMapping("getSubOrgListByNameLike/{parentId}")
-	public List<Org> getSubOrgListByNameLike(@PathVariable Long parentId,
+	public List<OrgEntity> getSubOrgListByNameLike(@PathVariable Long parentId,
 			@RequestParam String orgName) {
-		List<Org> list = null;
+		List<OrgEntity> list = null;
 		if (StringUtils.isBlank(orgName)) {
 			list = Lists.newArrayList();
 			return list;

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

@@ -49,7 +49,7 @@ 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.Org;
+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;
@@ -112,7 +112,7 @@ public class UserController extends ControllerSupport {
 			throw new StatusException("B-150001", "非法请求");
 		}
 
-		Org rootOrg = orgRepo.findOne(rootOrgId);
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
 		if (null == rootOrg) {
 			throw new StatusException("B-150003", "机构不存在");
 		}
@@ -176,7 +176,7 @@ public class UserController extends ControllerSupport {
 			bean.setCreationTime(next.getCreationTime());
 			bean.setOrgId(next.getOrgId());
 			if (null != bean.getOrgId()) {
-				Org org = orgRepo.findOne(Long.valueOf(bean.getOrgId()));
+				OrgEntity org = orgRepo.findOne(Long.valueOf(bean.getOrgId()));
 				if (null != org) {
 					bean.setOrgName(org.getName());
 				}
@@ -307,7 +307,7 @@ public class UserController extends ControllerSupport {
 	private Map<String, Object> insertOrUpdateUser(UserFormDomain userForm) {
 		cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
 		Long rootOrgId = userForm.getRootOrgId();
-		Org rootOrg = orgRepo.findOne(rootOrgId);
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
 		if (null == rootOrg) {
 			throw new StatusException("B-150003", "机构不存在");
 		}

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

@@ -21,7 +21,7 @@ import cn.com.qmth.examcloud.core.basic.api.response.SaveCourseResp;
 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.Course;
-import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
 import cn.com.qmth.examcloud.core.basic.dao.enums.CourseLevel;
 import io.swagger.annotations.ApiOperation;
 
@@ -54,7 +54,7 @@ public class CourseCloudServiceProvider implements CourseCloudService {
 		if (null == rootOrgId) {
 			throw new StatusException("B-160000", "rootOrgId is null");
 		}
-		Org rootOrg = orgRepo.findOne(rootOrgId);
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
 		if (null == rootOrg) {
 			throw new StatusException("B-160001", "机构不存在");
 		}

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

@@ -24,7 +24,7 @@ import cn.com.qmth.examcloud.core.basic.api.response.GetOrgListByNameLikeResp;
 import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
 import cn.com.qmth.examcloud.core.basic.api.response.SaveOrgResp;
 import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
 import cn.com.qmth.examcloud.core.basic.service.impl.OrgService;
 import io.swagger.annotations.ApiOperation;
 
@@ -45,11 +45,11 @@ public class OrgCloudServiceProvider extends ControllerSupport implements OrgClo
 	@PostMapping("saveOrg")
 	@Override
 	public SaveOrgResp saveOrg(@RequestBody SaveOrgReq orgReq) {
-		Org org = orgRepo.findByRootIdAndCode(orgReq.getRootOrgId(), orgReq.getOrgCode());
+		OrgEntity org = orgRepo.findByRootIdAndCode(orgReq.getRootOrgId(), orgReq.getOrgCode());
 		if (org == null) {
-			org = new Org();
+			org = new OrgEntity();
 		}
-		org = new Org();
+		org = new OrgEntity();
 		org.setName(orgReq.getOrgName());
 		org.setCode(orgReq.getOrgCode());
 		org.setParentId(orgReq.getRootOrgId());
@@ -70,7 +70,7 @@ public class OrgCloudServiceProvider extends ControllerSupport implements OrgClo
 		String orgName = req.getOrgName();
 		String rootOrgId = req.getRootOrgId();
 
-		List<Org> list = Lists.newArrayList();
+		List<OrgEntity> list = Lists.newArrayList();
 		if (StringUtils.isNotBlank(orgName)) {
 			list = orgRepo.findByRootIdAndNameLike(Long.parseLong(rootOrgId), orgName);
 		}
@@ -80,7 +80,7 @@ public class OrgCloudServiceProvider extends ControllerSupport implements OrgClo
 		resp.setOrgList(orgList);
 
 		if (CollectionUtils.isNotEmpty(list)) {
-			for (Org curOrg : list) {
+			for (OrgEntity curOrg : list) {
 				OrgBean orgBean = new OrgBean();
 				orgBean.setId(curOrg.getId());
 				orgBean.setLevel(curOrg.getLevel());
@@ -110,7 +110,7 @@ public class OrgCloudServiceProvider extends ControllerSupport implements OrgClo
 			throw new StatusException("B-150001", "orgId,orgCode不能都不为空");
 		}
 
-		Org org = null;
+		OrgEntity org = null;
 		if (null != orgId) {
 			org = orgRepo.findOne(orgId);
 		} else if (StringUtils.isNotBlank(orgCode)) {

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

@@ -19,7 +19,7 @@ import cn.com.qmth.examcloud.core.basic.api.response.InsertOrUpdateStudentResp;
 import cn.com.qmth.examcloud.core.basic.dao.OrgRepo;
 import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
 import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
 import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
 import cn.com.qmth.examcloud.core.basic.service.impl.StudentServiceImpl;
@@ -79,7 +79,7 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
 		resp.setStudentId(student.getId());
 		resp.setRootOrgId(student.getRootOrgId());
 
-		Org org = orgRepo.findOne(student.getOrgId());
+		OrgEntity org = orgRepo.findOne(student.getOrgId());
 		resp.setOrgId(org.getId());
 		resp.setOrgName(org.getName());
 
@@ -101,7 +101,7 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
 			throw new StatusException("B-150004", "identityNumber is null");
 		}
 
-		Org rootOrg = orgRepo.findOne(rootOrgId);
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
 		if (null == rootOrg) {
 			throw new StatusException("B-150001", "机构不存在");
 		}
@@ -121,7 +121,7 @@ public class StudentCloudServiceProvider extends ControllerSupport implements St
 			throw new StatusException("B-150005", "学号错误");
 		}
 
-		Org org = orgRepo.findOne(student.getOrgId());
+		OrgEntity org = orgRepo.findOne(student.getOrgId());
 
 		StudentBean studentBean = new StudentBean();
 		studentBean.setId(student.getId());

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

@@ -28,7 +28,7 @@ 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.Org;
+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;
@@ -137,11 +137,11 @@ public class UserCloudServiceProvider extends ControllerSupport implements UserC
 		userBean.setDisplayName(userEntity.getLoginName() + " (" + userEntity.getName() + ")");
 		userBean.setOrgId(userEntity.getOrgId());
 		userBean.setRootOrgId(userEntity.getRootOrgId());
-		Org rootOrg = orgRepo.findOne(userBean.getRootOrgId());
+		OrgEntity rootOrg = orgRepo.findOne(userBean.getRootOrgId());
 		userBean.setRootOrgName(rootOrg.getName());
 
 		if (null != userBean.getOrgId()) {
-			Org org = orgRepo.findOne(userBean.getOrgId());
+			OrgEntity org = orgRepo.findOne(userBean.getOrgId());
 			userBean.setOrgName(org.getName());
 		}
 

+ 28 - 0
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/OrgPropertyRepo.java

@@ -0,0 +1,28 @@
+package cn.com.qmth.examcloud.core.basic.dao;
+
+import java.util.List;
+
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.repository.query.QueryByExampleExecutor;
+
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgPropertyEntity;
+
+/**
+ * 类注释
+ *
+ * @author WANGWEI
+ * @date 2018年8月23日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+public interface OrgPropertyRepo
+		extends
+			JpaRepository<OrgPropertyEntity, Long>,
+			QueryByExampleExecutor<OrgPropertyEntity>,
+			JpaSpecificationExecutor<OrgPropertyEntity> {
+
+	OrgPropertyEntity findByOrgIdAndKeyId(Long orgId, Long keyId);
+
+	List<OrgPropertyEntity> findByOrgId(Long orgId);
+
+}

+ 14 - 15
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/OrgRepo.java

@@ -5,36 +5,35 @@ import java.util.List;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Query;
-import org.springframework.data.repository.query.Param;
 import org.springframework.data.repository.query.QueryByExampleExecutor;
 
-import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
+import cn.com.qmth.examcloud.core.basic.dao.entity.OrgEntity;
 
 /**
  * Created by songyue on 17/1/13.
  */
 public interface OrgRepo
 		extends
-			JpaRepository<Org, Long>,
-			QueryByExampleExecutor<Org>,
-			JpaSpecificationExecutor<Org> {
+			JpaRepository<OrgEntity, Long>,
+			QueryByExampleExecutor<OrgEntity>,
+			JpaSpecificationExecutor<OrgEntity> {
 
-	List<Org> findByRootId(Long rootId);
+	List<OrgEntity> findByRootId(Long rootId);
 
-	List<Org> findByParentIdAndNameLikeAndEnable(Long parentId, String name, Boolean enable);
+	List<OrgEntity> findByParentIdAndNameLikeAndEnable(Long parentId, String name, Boolean enable);
 
-	Org findByParentIdAndCode(Long parentId, String code);
+	OrgEntity findByParentIdAndCode(Long parentId, String code);
 
-	Org findByRootIdAndCode(Long rootId, String code);
+	OrgEntity findByRootIdAndCode(Long rootId, String code);
 
-	List<Org> findByRootIdAndNameLike(Long rootId, String name);
+	List<OrgEntity> findByRootIdAndNameLike(Long rootId, String name);
 
-	List<Org> findByParentIdAndEnable(Long parentId, Boolean enable);
+	List<OrgEntity> findByParentIdAndEnable(Long parentId, Boolean enable);
 
-	@Query(nativeQuery = true, value = "select * from ecs_core_org t where t.parent_id is null and t.code=:code ")
-	Org findRootOrg(@Param("code") String code);
+	@Query(value = "select from OrgEntity where parentId is null and code=?1")
+	OrgEntity findRootOrg(String code);
 
-	@Query(nativeQuery = true, value = "select * from ecs_core_org t where t.parent_id is null and t.id =:rootOrgId ")
-	Org findRootOrg(@Param("rootOrgId") Long rootOrgId);
+	@Query(value = "select from OrgEntity where parentId is null and id =?1")
+	OrgEntity findRootOrg(Long rootOrgId);
 
 }

+ 0 - 251
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/entity/Org.java

@@ -1,251 +0,0 @@
-package cn.com.qmth.examcloud.core.basic.dao.entity;
-
-import javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.Table;
-import javax.validation.constraints.NotNull;
-
-import cn.com.qmth.examcloud.commons.base.util.excel.ExcelProperty;
-import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
-import cn.com.qmth.examcloud.core.basic.dao.enums.OrgType;
-
-/**
- * Created by songyue on 17/1/13.
- */
-@Entity
-@Table(name = "ecs_core_org")
-public class Org extends JpaEntity {
-
-	private static final long serialVersionUID = -592353272256492483L;
-
-	@Id
-	@GeneratedValue
-	private Long id;
-
-	/**
-	 * 顶级机构ID,顶级机构的顶级ID为其自身ID
-	 */
-	@NotNull
-	private Long rootId;
-
-	/**
-	 * 父级机构ID,无上级时为null; eg.学习中心的父级为学校
-	 */
-	private Long parentId;
-
-	private Integer level;
-
-	@ExcelProperty(name = "机构名称", index = 0)
-	@NotNull
-	private String name;
-
-	/**
-	 * 学习中心代码
-	 */
-	@ExcelProperty(name = "机构代码", index = 1)
-	@NotNull
-	private String code;
-
-	private String logo;
-
-	private String address;
-
-	/**
-	 * 可使用的应用模块
-	 */
-	private String apps;
-
-	@NotNull
-	private Boolean enable;
-
-	/**
-	 * 联系电话
-	 */
-	@ExcelProperty(name = "联系电话", index = 3)
-	private String telphone;
-
-	/**
-	 * 联系人
-	 */
-	@ExcelProperty(name = "联系人", index = 2)
-	private String contacts;
-
-	/**
-	 * 机构类型:学校,启明,印刷
-	 */
-	@Enumerated(EnumType.STRING)
-	private OrgType type;
-
-	/**
-	 * 机器数量
-	 */
-	private Integer macNumber;
-
-	/**
-	 * 是否提供人员
-	 */
-	private Boolean isProvide;
-
-	/**
-	 * 备注
-	 */
-	private String remark;
-
-	/**
-	 * 网考端系统名称
-	 */
-	private String examSysName;
-
-	public static long getSerialVersionUID() {
-		return serialVersionUID;
-	}
-
-	public Long getId() {
-		return id;
-	}
-
-	public void setId(Long id) {
-		this.id = id;
-	}
-
-	public Long getRootId() {
-		return rootId;
-	}
-
-	public void setRootId(Long rootId) {
-		this.rootId = rootId;
-	}
-
-	public Long getParentId() {
-		return parentId;
-	}
-
-	public void setParentId(Long parentId) {
-		this.parentId = parentId;
-	}
-
-	public Integer getLevel() {
-		return level;
-	}
-
-	public void setLevel(Integer level) {
-		this.level = level;
-	}
-
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getLogo() {
-		return logo;
-	}
-
-	public void setLogo(String logo) {
-		this.logo = logo;
-	}
-
-	public String getAddress() {
-		return address;
-	}
-
-	public void setAddress(String address) {
-		this.address = address;
-	}
-
-	public String getApps() {
-		return apps;
-	}
-
-	public void setApps(String apps) {
-		this.apps = apps;
-	}
-
-	public Boolean getEnable() {
-		return enable;
-	}
-
-	public void setEnable(Boolean enable) {
-		this.enable = enable;
-	}
-
-	public String getCode() {
-		return code;
-	}
-
-	public void setCode(String code) {
-		this.code = code;
-	}
-
-	public String getTelphone() {
-		return telphone;
-	}
-
-	public void setTelphone(String telphone) {
-		this.telphone = telphone;
-	}
-
-	public String getContacts() {
-		return contacts;
-	}
-
-	public void setContacts(String contacts) {
-		this.contacts = contacts;
-	}
-
-	public OrgType getType() {
-		return type;
-	}
-
-	public void setType(OrgType type) {
-		this.type = type;
-	}
-
-	public Integer getMacNumber() {
-		return macNumber;
-	}
-
-	public void setMacNumber(Integer macNumber) {
-		this.macNumber = macNumber;
-	}
-
-	public Boolean getIsProvide() {
-		return isProvide;
-	}
-
-	public void setIsProvide(Boolean isProvide) {
-		this.isProvide = isProvide;
-	}
-
-	public String getRemark() {
-		return remark;
-	}
-
-	public void setRemark(String remark) {
-		this.remark = remark;
-	}
-
-	public String getExamSysName() {
-		return examSysName;
-	}
-
-	public void setExamSysName(String examSysName) {
-		this.examSysName = examSysName;
-	}
-
-	public Org(String name, String code, String contacts, String telphone) {
-		this.name = name;
-		this.code = code;
-		this.telphone = telphone;
-		this.contacts = contacts;
-	}
-
-	public Org() {
-	}
-}

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

@@ -0,0 +1,141 @@
+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.base.util.excel.ExcelProperty;
+import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+
+/**
+ * Created by songyue on 17/1/13.
+ */
+@Entity
+@Table(name = "EC_B_ORG")
+public class OrgEntity extends JpaEntity {
+
+	private static final long serialVersionUID = -592353272256492483L;
+
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	@Column(nullable = false)
+	private Long rootId;
+
+	@Column(nullable = false)
+	private Long parentId;
+
+	private Integer level;
+
+	@ExcelProperty(name = "机构名称", index = 0)
+	@Column(nullable = false)
+	private String name;
+
+	@ExcelProperty(name = "机构代码", index = 1)
+	@Column(nullable = false)
+	private String code;
+
+	@Column(nullable = false)
+	private Boolean enable;
+
+	/**
+	 * 联系电话
+	 */
+	@ExcelProperty(name = "联系电话", index = 3)
+	private String telephone;
+
+	/**
+	 * 联系人
+	 */
+	@ExcelProperty(name = "联系人", index = 2)
+	private String contacts;
+
+	/**
+	 * 备注
+	 */
+	private String remark;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getRootId() {
+		return rootId;
+	}
+
+	public void setRootId(Long rootId) {
+		this.rootId = rootId;
+	}
+
+	public Long getParentId() {
+		return parentId;
+	}
+
+	public void setParentId(Long parentId) {
+		this.parentId = parentId;
+	}
+
+	public Integer getLevel() {
+		return level;
+	}
+
+	public void setLevel(Integer level) {
+		this.level = level;
+	}
+
+	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 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;
+	}
+
+}

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

@@ -0,0 +1,72 @@
+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.Lob;
+import javax.persistence.Table;
+
+import cn.com.qmth.examcloud.commons.web.jpa.JpaEntity;
+
+/**
+ * 机构属性配置
+ *
+ * @author WANGWEI
+ * @date 2018年8月6日
+ * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
+ */
+@Entity
+@Table(name = "EC_B_ORG_PROP", indexes = {
+		@Index(name = "IDX_B_ORG_P_002001", columnList = "orgId,keyId", unique = true)})
+public class OrgPropertyEntity extends JpaEntity {
+
+	private static final long serialVersionUID = 4009839764353162256L;
+
+	@Id
+	@GeneratedValue
+	private Long id;
+
+	@Column(nullable = false)
+	private Long orgId;
+
+	@Column(nullable = false)
+	private Long keyId;
+
+	@Lob
+	private String value;
+
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+
+	public Long getOrgId() {
+		return orgId;
+	}
+
+	public void setOrgId(Long orgId) {
+		this.orgId = orgId;
+	}
+
+	public Long getKeyId() {
+		return keyId;
+	}
+
+	public void setKeyId(Long keyId) {
+		this.keyId = keyId;
+	}
+
+	public String getValue() {
+		return value;
+	}
+
+	public void setValue(String value) {
+		this.value = value;
+	}
+
+}

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

@@ -0,0 +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;
+	}
+}

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

@@ -33,7 +33,7 @@ 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.Org;
+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.StudentEntity;
 import cn.com.qmth.examcloud.core.basic.dao.entity.ThirdPartyAccessEntity;
@@ -96,7 +96,7 @@ public class AuthServiceImpl implements AuthService {
 		}
 
 		Long rootOrgId = loginInfo.getRootOrgId();
-		Org rootOrg = null;
+		OrgEntity rootOrg = null;
 		if (null == rootOrgId) {
 			if (StringUtils.isBlank(loginInfo.getDomain())) {
 				throw new StatusException("B-001001", "domain,rootOrgId 必须有一个不为空");
@@ -179,7 +179,7 @@ public class AuthServiceImpl implements AuthService {
 
 		user.setClientIp(loginInfo.getClientIp());
 
-		Org org = null;
+		OrgEntity org = null;
 		if (null != user.getOrgId()) {
 			org = orgRepo.findOne(user.getOrgId());
 			user.setOrgName(org.getName());
@@ -308,7 +308,7 @@ public class AuthServiceImpl implements AuthService {
 	public User thirdPartyAccess(Long rootOrgId, String loginName, String appId, String timestamp,
 			String token) throws StatusException {
 
-		Org rootOrg = orgRepo.findOne(rootOrgId);
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
 		if (null == rootOrg) {
 			throw new StatusException("B-001002", "机构不存在");
 		}
@@ -354,7 +354,7 @@ public class AuthServiceImpl implements AuthService {
 		user.setRootOrgName(rootOrg.getName());
 		user.setOrgId(userEntity.getOrgId());
 		if (null != user.getOrgId()) {
-			Org org = orgRepo.findOne(user.getOrgId());
+			OrgEntity org = orgRepo.findOne(user.getOrgId());
 			user.setOrgName(org.getName());
 		}
 

+ 22 - 58
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/impl/OrgService.java

@@ -3,18 +3,12 @@ package cn.com.qmth.examcloud.core.basic.service.impl;
 import static org.springframework.data.domain.ExampleMatcher.GenericPropertyMatchers.contains;
 
 import java.io.InputStream;
-import java.util.ArrayList;
 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.Example;
 import org.springframework.data.domain.ExampleMatcher;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -32,11 +26,10 @@ 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.ExamSite;
-import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
+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.dao.enums.OrgType;
 import cn.com.qmth.examcloud.core.basic.service.bean.OrgDto;
 
 @Service
@@ -82,16 +75,16 @@ public class OrgService {
 	 * @param orgDto
 	 */
 	private void saveOrgAndExamSite(OrgDto orgDto) {
-		Org org = orgRepo.findByParentIdAndCode(orgDto.getParentId(), orgDto.getCode());
+		OrgEntity org = orgRepo.findByParentIdAndCode(orgDto.getParentId(), orgDto.getCode());
 		if (org == null) {
-			Org tempOrg = orgRepo.save(orgAssembler(orgDto));
+			OrgEntity tempOrg = orgRepo.save(orgAssembler(orgDto));
 			orgDto.setId(tempOrg.getId());
 			examSiteRepo.save(examSiteAssembler(orgDto));
 			createLearnerCenterUser(tempOrg);
 		} else {
 			org.setName(orgDto.getName());
 			org.setContacts(orgDto.getContacts());
-			org.setTelphone(orgDto.getTelphone());
+			org.setTelephone(orgDto.getTelphone());
 			orgRepo.save(org);
 
 			orgDto.setId(org.getId());
@@ -112,7 +105,7 @@ public class OrgService {
 	 * 
 	 * @param org
 	 */
-	public void createLearnerCenterUser(Org org) {
+	public void createLearnerCenterUser(OrgEntity org) {
 		UserEntity user = userRepo.findByLoginName(org.getCode());
 		if (null != user) {
 			return;
@@ -122,7 +115,7 @@ public class OrgService {
 		user.setOrgId(org.getId());
 		user.setLoginName(org.getCode());
 		user.setName(org.getContacts());
-		user.setPhoneNumber(org.getTelphone());
+		user.setPhoneNumber(org.getTelephone());
 		user.setEnable(true);
 		user.setPassword(BasicConsts.DEFAULT_PASSWORD);
 		UserEntity saved = userRepo.save(user);
@@ -134,17 +127,15 @@ public class OrgService {
 		userRoleRelationRepo.save(userRoles);
 	}
 
-	private Org orgAssembler(OrgDto orgDto) {
-		Org org = new Org();
+	private OrgEntity orgAssembler(OrgDto orgDto) {
+		OrgEntity org = new OrgEntity();
 		org.setRootId(orgDto.getRootId());
 		org.setParentId(orgDto.getParentId());
 		org.setCode(orgDto.getCode());
 		org.setName(orgDto.getName());
 		org.setContacts(orgDto.getContacts());
-		org.setTelphone(orgDto.getTelphone());
+		org.setTelephone(orgDto.getTelphone());
 		org.setEnable(true);
-		// 添加机构类型
-		org.setType(OrgType.SCHOOL);
 		return org;
 	}
 
@@ -187,44 +178,17 @@ public class OrgService {
 	 * @return
 	 */
 	@Transactional
-	public Org enableSchool(Long id, boolean enable) {
-		Org org = orgRepo.findOne(id);
+	public OrgEntity enableSchool(Long id, boolean enable) {
+		OrgEntity org = orgRepo.findOne(id);
 		org.setEnable(enable);
 		orgRepo.save(org);
 		return org;
 	}
 
-	public Page<Org> findAll(Org orgCriteria, Pageable pageable) {
-		if (orgCriteria.getType() == null) {
-			Specification<Org> specification = getSpecification(orgCriteria);
-			return orgRepo.findAll(specification, pageable);
-		}
-		ExampleMatcher exampleMatcher = ExampleMatcher.matching().withMatcher("name", contains())
-				.withMatcher("code", contains());
-		Example<Org> examExamStudentple = Example.of(orgCriteria, exampleMatcher);
-		return orgRepo.findAll(examExamStudentple, pageable);
-	}
-
-	private Specification<Org> getSpecification(Org orgCriteria) {
-		Specification<Org> specification = (root, query, cb) -> {
-			List<Predicate> predicates = new ArrayList<>();
-			if (!StringUtils.isEmpty(orgCriteria.getName())) {
-				predicates.add(cb.equal(root.get("name"), orgCriteria.getName()));
-			}
-			if (!StringUtils.isEmpty(orgCriteria.getCode())) {
-				predicates.add(cb.equal(root.get("code"), orgCriteria.getCode()));
-			}
-			predicates.add(cb.notEqual(root.get("type"), OrgType.SCHOOL));
-			predicates.add(cb.equal(root.get("parentId"), orgCriteria.getParentId()));
-			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-		return specification;
-	}
-
-	public List<Org> findAll(Org orgCriteria) {
+	public List<OrgEntity> findAll(OrgEntity orgCriteria) {
 		ExampleMatcher exampleMatcher = ExampleMatcher.matching().withMatcher("name", contains())
 				.withMatcher("code", contains());
-		Example<Org> examExample = Example.of(orgCriteria, exampleMatcher);
+		Example<OrgEntity> examExample = Example.of(orgCriteria, exampleMatcher);
 		return orgRepo.findAll(examExample);
 	}
 
@@ -235,7 +199,7 @@ public class OrgService {
 	 * @param org
 	 * @return
 	 */
-	public Org save(Org org) {
+	public OrgEntity save(OrgEntity org) {
 
 		String code = org.getCode();
 		if (StringUtils.isBlank(code)) {
@@ -246,7 +210,7 @@ public class OrgService {
 		if (null == org.getParentId()) {
 
 			// 校验顶级机构编码已存在
-			Org rootOrg = orgRepo.findRootOrg(code);
+			OrgEntity rootOrg = orgRepo.findRootOrg(code);
 			if (null != rootOrg) {
 				if (!(null != org.getId() && org.getId().equals(rootOrg.getId()))) {
 					throw new StatusException("B-150001", "顶级机构编码已存在");
@@ -256,7 +220,7 @@ public class OrgService {
 			// 新增
 			if (null == org.getId()) {
 				org.setRootId(-1L);
-				Org saved = orgRepo.save(org);
+				OrgEntity saved = orgRepo.save(org);
 				org.setId(saved.getId());
 				org.setRootId(saved.getId());
 			}
@@ -267,18 +231,18 @@ public class OrgService {
 			if (null == rootId) {
 				throw new StatusException("B-150002", "rootId is null");
 			}
-			Org rootOrg = orgRepo.findOne(rootId);
+			OrgEntity rootOrg = orgRepo.findOne(rootId);
 			if (null == rootOrg || null != rootOrg.getParentId()) {
 				throw new StatusException("B-150003", "rootId is wrong");
 			}
 			Long parentId = org.getParentId();
 
-			Org parentOrg = orgRepo.findOne(parentId);
+			OrgEntity parentOrg = orgRepo.findOne(parentId);
 			if (!parentOrg.getRootId().equals(rootId)) {
 				throw new StatusException("B-150004", "parentId is wrong");
 			}
 
-			Org subOrg = orgRepo.findByRootIdAndCode(rootId, code);
+			OrgEntity subOrg = orgRepo.findByRootIdAndCode(rootId, code);
 			if (null != subOrg) {
 				if (!(null != org.getId() && org.getId().equals(subOrg.getId()))) {
 					throw new StatusException("B-150005", "机构编码已存在");
@@ -287,12 +251,12 @@ public class OrgService {
 
 		}
 
-		Org saved = orgRepo.save(org);
+		OrgEntity saved = orgRepo.save(org);
 		return saved;
 	}
 
-	public Org findOne(Long id) {
-		Org org = orgRepo.findOne(id);
+	public OrgEntity findOne(Long id) {
+		OrgEntity org = orgRepo.findOne(id);
 		return org;
 	}
 

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

@@ -21,9 +21,8 @@ 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.Org;
+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.dao.enums.OrgType;
 import cn.com.qmth.examcloud.core.basic.service.StudentService;
 import cn.com.qmth.examcloud.core.basic.service.bean.StudentInfo;
 
@@ -88,7 +87,7 @@ public class StudentServiceImpl implements StudentService {
 	@Transactional
 	public StudentEntity insertOrUpdateStudent(StudentInfo studentInfo) {
 		Long rootOrgId = studentInfo.getRootOrgId();
-		Org rootOrg = orgRepo.findOne(rootOrgId);
+		OrgEntity rootOrg = orgRepo.findOne(rootOrgId);
 
 		if (null == rootOrg || null != rootOrg.getParentId()) {
 			throw new StatusException("B-160001", "顶级机构错误");
@@ -99,7 +98,7 @@ public class StudentServiceImpl implements StudentService {
 		String orgName = studentInfo.getOrgName();
 
 		if (null != orgId) {
-			Org org = orgRepo.findOne(orgId);
+			OrgEntity org = orgRepo.findOne(orgId);
 			if (!org.getParentId().equals(rootOrgId)) {
 				throw new StatusException("B-160002", "orgId is wrong");
 			}
@@ -107,19 +106,18 @@ public class StudentServiceImpl implements StudentService {
 			if (StringUtils.isBlank(orgCode)) {
 				throw new StatusException("B-160004", "orgCode is blank");
 			}
-			Org org = orgRepo.findByRootIdAndCode(rootOrgId, orgCode);
+			OrgEntity org = orgRepo.findByRootIdAndCode(rootOrgId, orgCode);
 			if (null == org) {
 				if (StringUtils.isBlank(orgName)) {
 					throw new StatusException("B-160003", "orgName is blank");
 				}
-				org = new Org();
+				org = new OrgEntity();
 				org.setParentId(rootOrgId);
 				org.setCode(orgCode);
 				org.setName(orgName);
 				org.setEnable(true);
 				org.setRootId(rootOrgId);
-				org.setType(OrgType.SCHOOL);
-				Org saved = orgRepo.save(org);
+				OrgEntity saved = orgRepo.save(org);
 				orgId = saved.getId();
 			} else {
 				orgId = org.getId();
@@ -147,8 +145,8 @@ public class StudentServiceImpl implements StudentService {
 			}
 		}
 
-		StudentEntity studentByIdentity = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber,
-				rootOrgId);
+		StudentEntity studentByIdentity = studentRepo
+				.findByIdentityNumberAndRootOrgId(identityNumber, rootOrgId);
 
 		if (null != studentByIdentity) {
 			String curStudentCode = studentByIdentity.getStudentCode();
@@ -264,7 +262,7 @@ public class StudentServiceImpl implements StudentService {
 		info.setName(s.getName());
 		info.setOrgId(s.getOrgId());
 		if (null != s.getOrgId()) {
-			Org org = orgRepo.findOne(s.getOrgId());
+			OrgEntity org = orgRepo.findOne(s.getOrgId());
 			if (null != org) {
 				info.setOrgCode(org.getCode());
 				info.setOrgName(org.getName());
@@ -284,7 +282,7 @@ public class StudentServiceImpl implements StudentService {
 
 		info.setRemark(s.getRemark());
 		info.setRootOrgId(s.getRootOrgId());
-		Org rootOrg = orgRepo.findOne(s.getRootOrgId());
+		OrgEntity rootOrg = orgRepo.findOne(s.getRootOrgId());
 		info.setRootOrgName(rootOrg.getName());
 		info.setSecurityPhone(s.getSecurityPhone());
 		info.setStudentCode(s.getStudentCode());

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

@@ -33,6 +33,7 @@ import cn.com.qmth.examcloud.commons.base.logging.SLF4JImpl;
 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"})
@@ -47,11 +48,21 @@ 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();
+
 		SpringApplication.run(CoreBasicApp.class, args);
 	}
 

+ 13 - 0
examcloud-core-basic-starter/src/main/resources/org-properties.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<enums>
+	<enum>
+		<id>1</id>
+		<name>LOGO_PATH</name>
+		<desc>机构图标路径</desc>
+	</enum>
+	<enum>
+		<id>2</id>
+		<name>NET_EXAM_SYS_NAME</name>
+		<desc>网考端系统名称</desc>
+	</enum>
+</enums>