From f3bff41275b29d2f2b961b85e1a15ee1641fcf6c Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 6 Feb 2023 10:30:57 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E6=9E=84=E7=94=A8=E6=88=B7=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/common/account/JwtLoginFilter.java | 2 +- .../account/TokenAuthenticationService.java | 2 +- .../xkrs/controller/SysUserController.java | 20 +++++++------- .../xkrs/straw/dao/RelRoleAuthorityDao.java | 2 ++ .../com/xkrs/straw/dao/RelUserRoleDao.java | 2 ++ .../com/xkrs/straw/dao/SysAuthorityDao.java | 2 ++ .../java/com/xkrs/straw/dao/SysUserDao.java | 26 ++++++++++--------- .../xkrs/{ => straw}/model/vo/SysUserVo.java | 2 +- .../xkrs/straw/service/SysUserService.java | 2 +- .../service/impl/SysUserServiceImpl.java | 14 +++++----- 10 files changed, 42 insertions(+), 32 deletions(-) rename src/main/java/com/xkrs/{ => straw}/model/vo/SysUserVo.java (99%) diff --git a/src/main/java/com/xkrs/common/account/JwtLoginFilter.java b/src/main/java/com/xkrs/common/account/JwtLoginFilter.java index 8aa7b5c..f2bb93e 100644 --- a/src/main/java/com/xkrs/common/account/JwtLoginFilter.java +++ b/src/main/java/com/xkrs/common/account/JwtLoginFilter.java @@ -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; diff --git a/src/main/java/com/xkrs/common/account/TokenAuthenticationService.java b/src/main/java/com/xkrs/common/account/TokenAuthenticationService.java index 2ef9370..fd3995d 100644 --- a/src/main/java/com/xkrs/common/account/TokenAuthenticationService.java +++ b/src/main/java/com/xkrs/common/account/TokenAuthenticationService.java @@ -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; diff --git a/src/main/java/com/xkrs/controller/SysUserController.java b/src/main/java/com/xkrs/controller/SysUserController.java index 7587844..464d93c 100644 --- a/src/main/java/com/xkrs/controller/SysUserController.java +++ b/src/main/java/com/xkrs/controller/SysUserController.java @@ -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 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 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); } diff --git a/src/main/java/com/xkrs/straw/dao/RelRoleAuthorityDao.java b/src/main/java/com/xkrs/straw/dao/RelRoleAuthorityDao.java index ed2bd71..ca88274 100644 --- a/src/main/java/com/xkrs/straw/dao/RelRoleAuthorityDao.java +++ b/src/main/java/com/xkrs/straw/dao/RelRoleAuthorityDao.java @@ -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, JpaSpecificationExecutor { /** diff --git a/src/main/java/com/xkrs/straw/dao/RelUserRoleDao.java b/src/main/java/com/xkrs/straw/dao/RelUserRoleDao.java index 7d753c9..0f679e6 100644 --- a/src/main/java/com/xkrs/straw/dao/RelUserRoleDao.java +++ b/src/main/java/com/xkrs/straw/dao/RelUserRoleDao.java @@ -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, JpaSpecificationExecutor { } diff --git a/src/main/java/com/xkrs/straw/dao/SysAuthorityDao.java b/src/main/java/com/xkrs/straw/dao/SysAuthorityDao.java index fdf67f1..ec25ff2 100644 --- a/src/main/java/com/xkrs/straw/dao/SysAuthorityDao.java +++ b/src/main/java/com/xkrs/straw/dao/SysAuthorityDao.java @@ -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, JpaSpecificationExecutor { /** diff --git a/src/main/java/com/xkrs/straw/dao/SysUserDao.java b/src/main/java/com/xkrs/straw/dao/SysUserDao.java index 9d105ee..ea758d0 100644 --- a/src/main/java/com/xkrs/straw/dao/SysUserDao.java +++ b/src/main/java/com/xkrs/straw/dao/SysUserDao.java @@ -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, JpaSpecificationExecutor { @Modifying(clearAutomatically = true) @@ -62,17 +64,17 @@ public interface SysUserDao extends JpaRepository, 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 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 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); /** * 启用 diff --git a/src/main/java/com/xkrs/model/vo/SysUserVo.java b/src/main/java/com/xkrs/straw/model/vo/SysUserVo.java similarity index 99% rename from src/main/java/com/xkrs/model/vo/SysUserVo.java rename to src/main/java/com/xkrs/straw/model/vo/SysUserVo.java index 0f92bf5..a3e3e1a 100644 --- a/src/main/java/com/xkrs/model/vo/SysUserVo.java +++ b/src/main/java/com/xkrs/straw/model/vo/SysUserVo.java @@ -1,4 +1,4 @@ -package com.xkrs.model.vo; +package com.xkrs.straw.model.vo; import java.io.Serializable; diff --git a/src/main/java/com/xkrs/straw/service/SysUserService.java b/src/main/java/com/xkrs/straw/service/SysUserService.java index 8b7f904..67b5062 100644 --- a/src/main/java/com/xkrs/straw/service/SysUserService.java +++ b/src/main/java/com/xkrs/straw/service/SysUserService.java @@ -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; diff --git a/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java b/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java index f5fe1ef..ba43ae4 100644 --- a/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java +++ b/src/main/java/com/xkrs/straw/service/impl/SysUserServiceImpl.java @@ -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 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; } /**