重构用户角色类
This commit is contained in:
parent
85e6dbf06f
commit
f3bff41275
@ -2,7 +2,7 @@ package com.xkrs.common.account;
|
||||
|
||||
import com.xkrs.common.encapsulation.OutputEncapsulation;
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.service.SysUserService;
|
||||
import com.xkrs.utils.IpUtil;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
|
@ -2,7 +2,7 @@ package com.xkrs.common.account;
|
||||
|
||||
import com.xkrs.common.encapsulation.OutputEncapsulation;
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.vo.SysUserVo;
|
||||
import io.jsonwebtoken.Claims;
|
||||
import io.jsonwebtoken.Jwts;
|
||||
import io.jsonwebtoken.security.Keys;
|
||||
|
@ -10,7 +10,7 @@ import com.xkrs.model.qo.SysUserRemarkQo;
|
||||
import com.xkrs.model.qo.SysUserVipLevelQo;
|
||||
import com.xkrs.model.validation.SysUserQoInsert;
|
||||
import com.xkrs.model.validation.SysUserQoUpdate;
|
||||
import com.xkrs.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.vo.SysUserVo;
|
||||
import com.xkrs.service.RedisService;
|
||||
import com.xkrs.sms.SMSHelper;
|
||||
import com.xkrs.straw.dao.SysUserDao;
|
||||
@ -380,15 +380,15 @@ public class SysUserController {
|
||||
*/
|
||||
@GetMapping("/verificationCodeUpdate")
|
||||
public String verificationCodeUpdate(@RequestParam("phone") String phone) throws Exception {
|
||||
SysUserVo sysUserVo = sysUserDao.selectUserByUserName(phone);
|
||||
if (sysUserVo == null) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "手机号错误,请使用您注册的手机号", locale);
|
||||
}
|
||||
List<AgentOrgEntity> agentOrgList = agentOrgDao.findAll();
|
||||
String targetAgentOrgName = FirePointCodeUtils.getTargetAgentOrgName(sysUserVo.getAgentOrgId(), agentOrgList);
|
||||
String optCode = String.valueOf(RandomUtil.returnCode());
|
||||
redisService.set(phone, optCode, 10, TimeUnit.MINUTES);
|
||||
smsHelper.dispatchSMSCode(targetAgentOrgName, phone, optCode);
|
||||
// SysUserVo sysUserVo = sysUserDao.selectUserByUserName(phone);
|
||||
// if (sysUserVo == null) {
|
||||
// return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "手机号错误,请使用您注册的手机号", locale);
|
||||
// }
|
||||
// List<AgentOrgEntity> agentOrgList = agentOrgDao.findAll();
|
||||
// String targetAgentOrgName = FirePointCodeUtils.getTargetAgentOrgName(sysUserVo.getAgentOrgId(), agentOrgList);
|
||||
// String optCode = String.valueOf(RandomUtil.returnCode());
|
||||
// redisService.set(phone, optCode, 10, TimeUnit.MINUTES);
|
||||
// smsHelper.dispatchSMSCode(targetAgentOrgName, phone, optCode);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "", locale);
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,11 @@ 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.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface RelRoleAuthorityDao extends JpaRepository<RelRoleAuthorityEntity, Long>, JpaSpecificationExecutor<RelRoleAuthorityEntity> {
|
||||
|
||||
/**
|
||||
|
@ -3,7 +3,9 @@ package com.xkrs.straw.dao;
|
||||
import com.xkrs.straw.model.entity.RelUserRoleEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public interface RelUserRoleDao extends JpaRepository<RelUserRoleEntity, Long>, JpaSpecificationExecutor<RelUserRoleEntity> {
|
||||
|
||||
}
|
||||
|
@ -5,9 +5,11 @@ 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.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface SysAuthorityDao extends JpaRepository<SysAuthorityEntity, Long>, JpaSpecificationExecutor<SysAuthorityEntity> {
|
||||
|
||||
/**
|
||||
|
@ -1,15 +1,17 @@
|
||||
package com.xkrs.straw.dao;
|
||||
|
||||
import com.xkrs.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.entity.SysUserEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Modifying;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public interface SysUserDao extends JpaRepository<SysUserEntity, Long>, JpaSpecificationExecutor<SysUserEntity> {
|
||||
|
||||
@Modifying(clearAutomatically = true)
|
||||
@ -62,17 +64,17 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Long>, JpaSpeci
|
||||
@Query(value = "DELETE FROM sys_user WHERE user_name = :userName ;", nativeQuery = true)
|
||||
int deleteSysUser(@Param("userName") String userName);
|
||||
|
||||
/**
|
||||
* 查询用户信息
|
||||
*/
|
||||
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark,agentOrgId) from SysUserEntity")
|
||||
List<SysUserVo> selectAll();
|
||||
|
||||
/**
|
||||
* 根据用户名查询实体信息
|
||||
*/
|
||||
@Query(value = "select new com.xkrs.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark,agentOrgId) from SysUserEntity where userName = :userName")
|
||||
SysUserVo selectUserByUserName(String userName);
|
||||
// /**
|
||||
// * 查询用户信息
|
||||
// */
|
||||
// @Query(value = "select new com.xkrs.straw.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark,agentOrgId) from SysUserEntity")
|
||||
// List<SysUserVo> selectAll();
|
||||
//
|
||||
// /**
|
||||
// * 根据用户名查询实体信息
|
||||
// */
|
||||
// @Query(value = "select new com.xkrs.straw.model.vo.SysUserVo (id,reallyName,telephone,countyCode,activeFlag,addTime,overTime,dayNum,accountType,countyName,lastEntryIp,loginNum,loginLastTime,vipLevel,receiveSms,remark,agentOrgId) from SysUserEntity where userName = :userName")
|
||||
// SysUserVo selectUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 启用
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.xkrs.model.vo;
|
||||
package com.xkrs.straw.model.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.xkrs.straw.service;
|
||||
|
||||
import com.xkrs.model.qo.SysUserQo;
|
||||
import com.xkrs.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.entity.SysUserEntity;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -4,7 +4,7 @@ import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.dao.StreetDao;
|
||||
import com.xkrs.model.entity.StreetEntity;
|
||||
import com.xkrs.model.qo.SysUserQo;
|
||||
import com.xkrs.model.vo.SysUserVo;
|
||||
import com.xkrs.straw.model.vo.SysUserVo;
|
||||
import com.xkrs.service.RedisService;
|
||||
import com.xkrs.straw.dao.RelRoleAuthorityDao;
|
||||
import com.xkrs.straw.dao.RelUserRoleDao;
|
||||
@ -202,11 +202,11 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
|
||||
RelUserRoleEntity relUserRoleEntity = new RelUserRoleEntity();
|
||||
relUserRoleEntity.setUserId(sysUserEntity.getId());
|
||||
relUserRoleEntity.setRoleId(2);
|
||||
relUserRoleEntity.setRoleId(2L);
|
||||
|
||||
RelRoleAuthorityEntity relRoleAuthorityEntity = new RelRoleAuthorityEntity();
|
||||
relRoleAuthorityEntity.setRoleId(2);
|
||||
relRoleAuthorityEntity.setAuthorityId(2);
|
||||
relRoleAuthorityEntity.setRoleId(2L);
|
||||
relRoleAuthorityEntity.setAuthorityId(2L);
|
||||
relRoleAuthorityEntity.setUserId(sysUserEntity.getId());
|
||||
relUserRoleDao.save(relUserRoleEntity);
|
||||
|
||||
@ -280,7 +280,8 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
*/
|
||||
@Override
|
||||
public List<SysUserVo> selectAllUser() {
|
||||
return sysUserDao.selectAll();
|
||||
// return sysUserDao.selectAll();
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -351,7 +352,8 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
|
||||
@Override
|
||||
public SysUserVo getUserByUserName(String userName) {
|
||||
return sysUserDao.selectUserByUserName(userName);
|
||||
// return sysUserDao.selectUserByUserName(userName);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user