wangwei 7 年之前
父节点
当前提交
03db0da3cf

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

@@ -17,17 +17,13 @@ import org.apache.commons.lang.StringEscapeUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Page;
-import org.springframework.data.domain.PageImpl;
 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.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
 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.ModelAttribute;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -40,16 +36,13 @@ 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.util.ErrorMsg;
 import cn.com.qmth.examcloud.commons.web.helpers.page.PageInfo;
-import cn.com.qmth.examcloud.commons.web.security.annotation.Uac;
 import cn.com.qmth.examcloud.commons.web.security.bean.User;
-import cn.com.qmth.examcloud.commons.web.security.entity.AccessUser;
 import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
-import cn.com.qmth.examcloud.commons.web.security.enums.UacPolicy;
 import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.FullUserInfo;
 import cn.com.qmth.examcloud.core.basic.api.controller.bean.UserForm;
+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.RoleRepo;
 import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
@@ -59,7 +52,8 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
 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.bean.UserInfo;
+import cn.com.qmth.examcloud.core.basic.service.AuthService;
+import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
 import cn.com.qmth.examcloud.core.basic.service.impl.UserServiceImpl;
 import io.swagger.annotations.ApiOperation;
 
@@ -83,6 +77,9 @@ public class UserController extends ControllerSupport {
 	@Autowired
 	RoleRepo roleRepo;
 
+	@Autowired
+	AuthService authService;
+
 	@Autowired
 	UserRoleRelationRepo userRoleRelationRepo;
 
@@ -106,7 +103,8 @@ public class UserController extends ControllerSupport {
 			@PathVariable Integer pageSize, @RequestParam Long rootOrgId,
 			@RequestParam String loginName, @RequestParam String name,
 			@RequestParam(required = false) Boolean enable,
-			@RequestParam(required = false) Long roleId) {
+			@RequestParam(required = false) Long roleId,
+			@RequestParam(required = false) String roleCode) {
 
 		User accessUser = getAccessUser();
 		if ((!isSuperAdmin()) && (!rootOrgId.equals(accessUser.getRootOrgId()))) {
@@ -126,8 +124,16 @@ public class UserController extends ControllerSupport {
 			if (null == roleEntity) {
 				throw new StatusException("B-150002", "角色不存在");
 			}
+		} else if (StringUtils.isNotBlank(roleCode)) {
+			RoleEntity roleEntity = roleRepo.findByCode(roleCode.trim());
+			if (null == roleEntity) {
+				throw new StatusException("B-150002", "角色不存在");
+			}
+			roleId = roleEntity.getId();
 		}
 
+		final Long finalRoleId = roleId;
+
 		Specification<UserEntity> specification = (root, query, cb) -> {
 			List<Predicate> predicates = new ArrayList<>();
 			predicates.add(cb.equal(root.get("rootOrgId"), rootOrgId));
@@ -138,12 +144,12 @@ public class UserController extends ControllerSupport {
 			if (StringUtils.isNotBlank(name)) {
 				predicates.add(cb.like(root.get("name"), toSqlSearchPattern(name)));
 			}
-			if (null != roleId) {
+			if (null != finalRoleId) {
 				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"), roleId);
+				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));
@@ -204,12 +210,27 @@ public class UserController extends ControllerSupport {
 		return ret;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param id
+	 * @return
+	 */
 	@ApiOperation(value = "按id查询用户", notes = "id查询")
 	@GetMapping("/{id}")
-	public ResponseEntity getUserById(@PathVariable long id) {
-		return new ResponseEntity(userRepo.findOne(id), HttpStatus.OK);
+	public UserEntity getUserById(@PathVariable long id) {
+		UserEntity user = userRepo.findOne(id);
+		return user;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param orgId
+	 * @return
+	 */
 	@ApiOperation(value = "按orgId查询用户", notes = "机构id查询机构用户")
 	@GetMapping("/org/{orgId}")
 	public List<UserEntity> getUserByOrgId(@PathVariable long orgId) {
@@ -217,6 +238,13 @@ public class UserController extends ControllerSupport {
 		return userList;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param rootOrgId
+	 * @return
+	 */
 	@ApiOperation(value = "按rootOrgId查询用户", notes = "根机构id查询机构用户")
 	@GetMapping("/rootOrg/{rootOrgId}")
 	public List<UserEntity> getUserByRootOrgId(@PathVariable long rootOrgId) {
@@ -370,99 +398,115 @@ public class UserController extends ControllerSupport {
 		return ret;
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param userId
+	 * @param password
+	 */
 	@ApiOperation(value = "修改用户密码", notes = "修改密码")
 	@PutMapping("/password")
-	public ResponseEntity updatePass(@RequestParam long userId, @RequestParam String password) {
+	public void updatePass(@RequestParam long userId, @RequestParam String password) {
 		String realPassword = StringEscapeUtils.unescapeJavaScript(password);
 		userRepo.updatePasswordById(userId, realPassword);
-		return new ResponseEntity(HttpStatus.OK);
 	}
 
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param ids
+	 */
 	@ApiOperation(value = "按id删除用户", notes = "删除")
 	@DeleteMapping("/{ids}")
-	@Uac(roles = {RoleMeta.SUPER_ADMIN}, policy = UacPolicy.IN)
-	public ResponseEntity deleteUser(@PathVariable String ids) {
+	public void deleteUser(@PathVariable String ids) {
 		List<Long> userIds = Stream.of(ids.split(",")).map(s -> Long.parseLong(s.trim()))
 				.collect(Collectors.toList());
 		for (Long userId : userIds) {
 			userRepo.delete(userId);
 		}
-		return new ResponseEntity(HttpStatus.OK);
 	}
 
 	@ApiOperation(value = "一般登录", notes = "登录")
 	@PostMapping("/login")
-	@Deprecated
-	public ResponseEntity login(@RequestParam String loginName, @RequestParam String password) {
-		try {
-			UserInfo userInfo = userService.login(loginName, password);
-			return new ResponseEntity(userInfo, HttpStatus.OK);
-		} catch (Exception e) {
-			return new ResponseEntity(new ErrorMsg(e.getMessage()),
-					HttpStatus.INTERNAL_SERVER_ERROR);
+	public Map<String, Object> login(@RequestParam String loginName,
+			@RequestParam String password) {
+		UserEntity user = userRepo.findByLoginName(loginName);
+		if (user == null) {
+			throw new RuntimeException("该用户不存在");
+		} else if (!user.getEnable()) {
+			throw new RuntimeException("该用户被禁用");
 		}
+
+		LoginInfo loginInfo = new LoginInfo();
+		loginInfo.setAccountType(AccountType.COMMON_LOGIN_NAME.getCode());
+		loginInfo.setAccountValue(user.getLoginName());
+		loginInfo.setPassword(user.getPassword());
+		loginInfo.setRootOrgId(String.valueOf(user.getRootOrgId()));
+		User loginUser = authService.login(loginInfo);
+
+		Map<String, Object> ret = Maps.newHashMap();
+		ret.put("userId", loginUser.getUserId());
+		ret.put("token", loginUser.getUserToken());
+		return ret;
 	}
 
 	@ApiOperation(value = "二级登录", notes = "二级登录")
-	@PostMapping("/login/{orgId}")
-	@Deprecated
-	public ResponseEntity login(@PathVariable long orgId, @RequestParam String loginName,
+	@PostMapping("/login/{rootOrgId}")
+	public Map<String, Object> login(@PathVariable long rootOrgId, @RequestParam String loginName,
 			@RequestParam String password) {
-		try {
-			UserInfo userInfo = userService.login(orgId, loginName, password);
-			return new ResponseEntity(userInfo, HttpStatus.OK);
-		} catch (Exception e) {
-			return new ResponseEntity(new ErrorMsg(e.getMessage()),
-					HttpStatus.INTERNAL_SERVER_ERROR);
+		UserEntity user = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
+		if (user == null) {
+			throw new RuntimeException("该用户不存在");
+		} else if (!user.getEnable()) {
+			throw new RuntimeException("该用户被禁用");
 		}
-	}
 
-	@ApiOperation(value = "第三方机构接入", notes = "第三方机构接入")
-	@PostMapping("/thirdPartyAccess/{orgId}")
-	@Deprecated
-	public ResponseEntity thirdPartyAccess(@PathVariable long orgId, @RequestParam String userid,
-			@RequestParam String appid, @RequestParam String timestamp,
-			@RequestParam String token) {
-		try {
-			UserInfo userInfo = userService.thirdPartyAccess(orgId, userid, appid, timestamp,
-					token);
-			return new ResponseEntity(userInfo, HttpStatus.OK);
-		} catch (Exception e) {
-			return new ResponseEntity(new ErrorMsg(e.getMessage()),
-					HttpStatus.INTERNAL_SERVER_ERROR);
-		}
-	}
+		LoginInfo loginInfo = new LoginInfo();
+		loginInfo.setAccountType(AccountType.COMMON_LOGIN_NAME.getCode());
+		loginInfo.setAccountValue(user.getLoginName());
+		loginInfo.setPassword(user.getPassword());
+		loginInfo.setRootOrgId(String.valueOf(user.getRootOrgId()));
+		User loginUser = authService.login(loginInfo);
 
-	@ApiOperation(value = "登出", notes = "登出")
-	@PostMapping("/logout")
-	@Deprecated
-	public ResponseEntity logout(HttpServletRequest request) {
-		AccessUser accessUser = null;
-		userService.logout(accessUser);
-		return new ResponseEntity(HttpStatus.OK);
+		Map<String, Object> ret = Maps.newHashMap();
+		ret.put("userId", loginUser.getUserId());
+		ret.put("token", loginUser.getUserToken());
+		return ret;
 	}
 
-	@ApiOperation(value = "查询评卷员", notes = "查询")
-	@GetMapping("/marker")
-	public ResponseEntity getMarker(HttpServletRequest request) {
-		cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
-		return new ResponseEntity(userService.getMarker(accessUser.getRootOrgId()), HttpStatus.OK);
-	}
+	/**
+	 * 方法注释
+	 *
+	 * @author WANGWEI
+	 * @param request
+	 * @return
+	 */
+	@ApiOperation(value = "查询所有评卷员(不分页)", notes = "查询")
+	@GetMapping("/getMarkerListNoPageable")
+	public List<UserEntity> getMarkerListNoPageable(HttpServletRequest request) {
 
-	@ApiOperation(value = "查询评卷员带分页", notes = "查询评卷员带分页")
-	@GetMapping("/all/marker/{curPage}/{pageSize}")
-	public ResponseEntity getAllMark(@ModelAttribute UserEntity user, @PathVariable Integer curPage,
-			@PathVariable Integer pageSize, HttpServletRequest request) {
-		cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
-		if (accessUser != null) {
-			user.setRootOrgId(accessUser.getRootOrgId());
-			return new ResponseEntity(
-					userService.getAllMaker(user, new PageRequest(curPage - 1, pageSize)),
-					HttpStatus.OK);
-		} else {
-			return new ResponseEntity(new PageImpl<UserEntity>(new ArrayList<UserEntity>()),
-					HttpStatus.OK);
-		}
+		RoleEntity role = roleRepo.findByCode(RoleMeta.MARKER.name());
+
+		Specification<UserEntity> specification = (root, query, cb) -> {
+			List<Predicate> predicates = new ArrayList<>();
+			predicates.add(cb.equal(root.get("rootOrgId"), getRootOrgId()));
+
+			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"), role.getId());
+			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()]));
+		};
+
+		List<UserEntity> userList = userRepo.findAll(specification);
+		return userList;
 	}
 
 }

+ 0 - 23
examcloud-core-basic-dao/src/main/java/cn/com/qmth/examcloud/core/basic/dao/UserRepo.java

@@ -2,8 +2,6 @@ package cn.com.qmth.examcloud.core.basic.dao;
 
 import java.util.List;
 
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
 import org.springframework.data.jpa.repository.JpaRepository;
 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
 import org.springframework.data.jpa.repository.Modifying;
@@ -38,25 +36,4 @@ public interface UserRepo
 
 	List<UserEntity> findByRootOrgId(Long rootOrgId);
 
-	@Query(nativeQuery = true, value = "SELECT DISTINCT * FROM ecs_core_user us, ecs_core_user_role ur WHERE us.id = ur.user_id And us.root_org_id = ? And ur.role_code = 'MARKER' And us.enable = 1")
-	List<UserEntity> findMarkerByRootOrgId(Long rootOrgId);
-
-	@Query(value = "SELECT  * FROM ecs_core_user X, ecs_core_user_role Y WHERE X.id = Y.user_id "
-			+ "And X.root_org_id = :rootOrgId And X.name like :name And x.login_name like :loginName And type = :type "
-			+ "And Y.role_code = :roleCode ORDER BY ?#{#pageable} ", countQuery = ""
-					+ "SELECT count(*) FROM ecs_core_user X, ecs_core_user_role Y WHERE X.id = Y.user_id "
-					+ "And X.root_org_id = :rootOrgId And X.name like :name And x.login_name like :loginName And type = :type "
-					+ "And Y.role_code = :roleCode ", nativeQuery = true)
-	Page<UserEntity> findAll(@Param("rootOrgId") Long rootOrgId, @Param("name") String name,
-			@Param("loginName") String loginName, @Param("type") String type,
-			@Param("roleCode") String roleCode, Pageable pageable);
-
-	@Query(value = "SELECT  * FROM ecs_core_user X  WHERE "
-			+ " X.root_org_id = :rootOrgId And X.name like :name And x.login_name like :loginName And type = :type "
-			+ " ORDER BY ?#{#pageable} ", countQuery = ""
-					+ "SELECT count(*) FROM ecs_core_user  X WHERE "
-					+ " X.root_org_id = :rootOrgId And X.name like :name And x.login_name like :loginName And type = :type ", nativeQuery = true)
-	Page<UserEntity> findAll(@Param("rootOrgId") Long rootOrgId, @Param("name") String name,
-			@Param("loginName") String loginName, @Param("type") String type, Pageable pageable);
-
 }

+ 0 - 13
examcloud-core-basic-service/src/main/java/cn/com/qmth/examcloud/core/basic/service/UserService.java

@@ -1,7 +1,5 @@
 package cn.com.qmth.examcloud.core.basic.service;
 
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
-
 /**
  * 用户服务
  * 
@@ -10,15 +8,4 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.UserEntity;
  */
 public interface UserService {
 
-	/**
-	 * 查询用户
-	 *
-	 * @author WANGWEI
-	 * @param rootOrgId
-	 * @param loginName
-	 * @return
-	 */
-	UserEntity getUser(Long rootOrgId, String loginName);
-	
-
 }

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

@@ -111,7 +111,8 @@ public class AuthServiceImpl implements AuthService {
 
 		// 常规账户登录
 		if (AccountType.COMMON_LOGIN_NAME.getCode().equals(accountType)) {
-			UserEntity userEntity = userService.getUser(Long.parseLong(rootOrgId), accountValue);
+			UserEntity userEntity = userRepo.findByRootOrgIdAndLoginName(Long.parseLong(rootOrgId),
+					accountValue);
 			if (null == userEntity) {
 				throw new StatusException("B-001004", "用户不存在");
 			}

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

@@ -1,49 +1,12 @@
 package cn.com.qmth.examcloud.core.basic.service.impl;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.stream.Collectors;
-
-import javax.persistence.criteria.Join;
-import javax.persistence.criteria.Predicate;
-
-import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.domain.Pageable;
-import org.springframework.data.jpa.domain.Specification;
-import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 
 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.SHA256;
-import cn.com.qmth.examcloud.commons.base.util.StringUtil;
-import cn.com.qmth.examcloud.commons.web.security.AccessUserOps;
-import cn.com.qmth.examcloud.commons.web.security.AccessUserOpsForRedis;
-import cn.com.qmth.examcloud.commons.web.security.entity.AccessUser;
-import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
-import cn.com.qmth.examcloud.core.basic.base.enums.AccountType;
-import cn.com.qmth.examcloud.core.basic.base.enums.UserType;
-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.ThirdPartyAccessRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserLoginRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserOpsLogRepo;
 import cn.com.qmth.examcloud.core.basic.dao.UserRepo;
-import cn.com.qmth.examcloud.core.basic.dao.UserRoleRepo;
-import cn.com.qmth.examcloud.core.basic.dao.entity.Org;
-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.UserLogin;
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserOpsLog;
-import cn.com.qmth.examcloud.core.basic.dao.entity.UserRole;
-import cn.com.qmth.examcloud.core.basic.service.AuthService;
 import cn.com.qmth.examcloud.core.basic.service.UserService;
-import cn.com.qmth.examcloud.core.basic.service.bean.LoginInfo;
-import cn.com.qmth.examcloud.core.basic.service.bean.UserInfo;
 
 /**
  * 用户服务类 Created by songyue on 17/1/13.
@@ -54,276 +17,6 @@ public class UserServiceImpl implements UserService {
 	@Autowired
 	UserRepo userRepo;
 
-	@Autowired
-	StudentRepo studentRepo;
-
-	@Autowired
-	OrgRepo orgRepo;
-
-	@Autowired
-	OrgService orgService;
-
-	@Autowired
-	UserRoleRepo userRoleRepo;
-
-	@Autowired
-	UserLoginRepo userLoginRepo;
-
-	@Autowired
-	UserOpsLogRepo userOpsLogRepo;
-
-	@Autowired
-	ThirdPartyAccessRepo thirdPartyAccessDao;
-
-	RedisTemplate redisTemplate;
-
-	@Autowired
-	AuthService authService;
-
-	AccessUserOps accessUserOps;
-
-	@Autowired
-	public UserServiceImpl(RedisTemplate redisTemplate) {
-		this.redisTemplate = redisTemplate;
-		this.accessUserOps = new AccessUserOpsForRedis(redisTemplate);
-	}
-
-	/**
-	 * 一般登录
-	 * 
-	 * @param loginName
-	 * @param password
-	 * @return
-	 */
-	public UserInfo login(String loginName, String password) throws Exception {
-		UserEntity user = userRepo.findByLoginName(loginName);
-		if (user == null) {
-			throw new RuntimeException("该用户不存在");
-		} else if (!user.getEnable()) {
-			throw new RuntimeException("该用户被禁用");
-		}
-		return loginProcess(user);
-
-	}
-
-	/**
-	 * 二级登录
-	 * 
-	 * @param orgId
-	 * @param loginName
-	 * @param password
-	 * @return
-	 */
-	public UserInfo login(long orgId, String loginName, String password) throws Exception {
-		UserEntity user = userRepo.findByRootOrgIdAndLoginName(orgId, loginName);
-		if (user == null) {
-			throw new RuntimeException("该用户不存在");
-		} else if (!user.getEnable()) {
-			throw new RuntimeException("该用户被禁用");
-		}
-		return loginProcess(user);
-	}
-
-	/**
-	 * 登录处理 重新定义 by wangwei
-	 * 
-	 * @param user
-	 * @return
-	 */
-	public UserInfo loginProcess(UserEntity user) throws Exception {
-		LoginInfo loginInfo = new LoginInfo();
-		loginInfo.setAccountType(AccountType.COMMON_LOGIN_NAME.getCode());
-		loginInfo.setAccountValue(user.getLoginName());
-		loginInfo.setPassword(user.getPassword());
-		loginInfo.setRootOrgId(String.valueOf(user.getRootOrgId()));
-		cn.com.qmth.examcloud.commons.web.security.bean.User loginUser = authService
-				.login(loginInfo);
-		String userToken = loginUser.getUserToken();
-		return getUserInfo(user, userToken);
-	}
-
-	/**
-	 * 第三方接入
-	 *
-	 * @author WANGWEI
-	 * @param orgId
-	 * @param userid
-	 * @param appid
-	 * @param timestamp
-	 * @param token
-	 * @return
-	 * @throws Exception
-	 */
-	@Deprecated
-	public UserInfo thirdPartyAccess(long orgId, String userid, String appid, String timestamp,
-			String token) throws Exception {
-		ThirdPartyAccessEntity thirdPartyAccess = thirdPartyAccessDao
-				.findOne(new ThirdPartyAccessPK(orgId, appid));
-
-		if (null == thirdPartyAccess) {
-			throw new RuntimeException("第三方系统接入信息未配置!");
-		}
-
-		long timestampLong = 0L;
-		try {
-			timestampLong = Long.parseLong(timestamp);
-		} catch (Exception e) {
-			throw new RuntimeException("timestamp错误");
-		}
-
-		if (Math.abs(System.currentTimeMillis() - timestampLong) > thirdPartyAccess
-				.getTimeRange()) {
-			throw new RuntimeException("第三方系统接入鉴权失败: timestamp超出时间差范围!");
-		}
-
-		String secretKey = thirdPartyAccess.getSecretKey();
-		String joinStr = StringUtil.join(userid, orgId, appid, timestamp, secretKey);
-		byte[] bytes = SHA256.encode(joinStr);
-		String hexAscii = ByteUtil.toHexAscii(bytes);
-
-		if (!hexAscii.equals(token)) {
-			throw new RuntimeException("第三方系统接入鉴权失败: token校验失败!");
-		}
-
-		UserEntity user = userRepo.findByRootOrgIdAndLoginName(orgId, userid);
-		if (user == null) {
-			throw new RuntimeException("该用户不存在!");
-		}
-
-		return loginProcess(user);
-	}
-
-	/**
-	 * 初始化用户登录
-	 * 
-	 * @param user
-	 */
-	@Deprecated
-	public void initUserLogin(UserEntity user) {
-		// 判断是否已登录,若已登录则强制已登录用户退出
-		UserLogin userLogin = userLoginRepo.findFirstByUserId(user.getId());
-		if (userLogin != null) {
-			accessUserOps.delete(userLogin.getToken());
-			userLoginRepo.deleteByUserId(userLogin.getUserId());
-		}
-	}
-
-	/**
-	 * 创建用户操作日志
-	 * 
-	 * @param user
-	 * @param action
-	 */
-	public void createUserOpsLog(UserEntity user, String action) {
-		UserOpsLog userOpsLog = new UserOpsLog(action, user.getId(), user.getName(), new Date());
-		userOpsLogRepo.save(userOpsLog);
-	}
-
-	/**
-	 * 创建用户登录记录
-	 * 
-	 * @param token
-	 * @param user
-	 */
-	@Deprecated
-	public void createUserLogin(String token, UserEntity user) {
-		UserLogin userLogin = new UserLogin();
-		userLogin.setLoginTime(new Date());
-		userLogin.setUserId(user.getId());
-		userLogin.setToken(token);
-		userLoginRepo.save(userLogin);
-	}
-
-	/**
-	 * 获取用户信息DTO
-	 * 
-	 * @param user
-	 * @param token
-	 * @return
-	 */
-	public UserInfo getUserInfo(UserEntity user, String token) throws Exception {
-		UserInfo userInfo = new UserInfo();
-		Org org = orgService.findOne(user.getOrgId());
-		Org rootOrg = orgService.findOne(user.getRootOrgId());
-		userInfo.setUserId(user.getId());
-		userInfo.setOrgId(user.getOrgId());
-		userInfo.setRootOrgId(user.getRootOrgId());
-		userInfo.setName(user.getName());
-		userInfo.setAvatar(user.getAvatar());
-		userInfo.setLoginName(user.getLoginName());
-		if (org != null) {
-			userInfo.setOrgName(org.getName());
-		}
-		if (rootOrg != null) {
-			userInfo.setRootOrgLogo(rootOrg.getLogo());
-			userInfo.setRootOrgName(rootOrg.getName());
-		}
-		userInfo.setToken(token);
-		return userInfo;
-	}
-
-	/**
-	 * 获取角色名称
-	 * 
-	 * @param userRoles
-	 * @return
-	 */
-	public List<String> getRoleNames(List<UserRole> userRoles) {
-
-		List<String> roleNameList = userRoles.stream()
-				.map(userRole -> RoleMeta.valueOf(userRole.getRoleCode()).getName())
-				.collect(Collectors.toList());
-		return roleNameList;
-
-	}
-
-	/**
-	 * 登出
-	 * 
-	 * @param accessUser
-	 */
-	public void logout(AccessUser accessUser) {
-		accessUserOps.delete(accessUser.getToken());
-		userLoginRepo.deleteByUserId(accessUser.getUserId());
-	}
-
-	public List<UserEntity> getMarker(Long rootOrgId) {
-		return userRepo.findMarkerByRootOrgId(rootOrgId);
-	}
-
-	/**
-	 * 查询评卷员带分页
-	 * 
-	 * @param user
-	 * @param pageable
-	 * @return
-	 */
-	public Page<UserEntity> getAllMaker(UserEntity user, Pageable pageable) {
-		Specification<UserEntity> specification = getSpecification(user);
-		return userRepo.findAll(specification, pageable);
-	}
-
-	public Specification<UserEntity> getSpecification(UserEntity user) {
-		Specification<UserEntity> specification = (root, query, cb) -> {
-			List<Predicate> predicates = new ArrayList<>();
-			predicates.add(cb.equal(root.get("type"), UserType.COMMON));
-			predicates.add(cb.equal(root.get("rootOrgId"), user.getRootOrgId()));
-			Join join = root.join("userRoles");
-			predicates.add(cb.equal(join.get("roleCode"), RoleMeta.MARKER.name()));
-			if (StringUtils.isNotEmpty(user.getLoginName())) {
-				predicates.add(cb.like(root.get("loginName"), "%" + user.getLoginName() + "%"));
-			}
-			if (StringUtils.isNotEmpty(user.getName())) {
-				predicates.add(cb.like(root.get("name"), "%" + user.getName() + "%"));
-			}
-			if (user.getEnable() != null) {
-				predicates.add(cb.equal(root.get("enable"), user.getEnable()));
-			}
-			return cb.and(predicates.toArray(new Predicate[predicates.size()]));
-		};
-		return specification;
-	}
-
 	public UserEntity save(UserEntity user) {
 		UserEntity one = userRepo.findByRootOrgIdAndLoginName(user.getRootOrgId(),
 				user.getLoginName());
@@ -333,10 +26,4 @@ public class UserServiceImpl implements UserService {
 		return userRepo.save(user);
 	}
 
-	@Override
-	public UserEntity getUser(Long rootOrgId, String loginName) {
-		UserEntity user = userRepo.findByRootOrgIdAndLoginName(rootOrgId, loginName);
-		return user;
-	}
-
 }