新增接口:查询Vip用户

This commit is contained in:
liuchengqian 2023-01-30 13:57:46 +08:00
parent d0db039487
commit 431d8aac0d
4 changed files with 50 additions and 12 deletions

View File

@ -42,11 +42,8 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET, "/selectGlobalConfig").permitAll() .antMatchers(HttpMethod.GET, "/selectGlobalConfig").permitAll()
.antMatchers(HttpMethod.POST, "/globalConfig").permitAll() .antMatchers(HttpMethod.POST, "/globalConfig").permitAll()
.antMatchers(HttpMethod.POST, "/globalConfigDict").permitAll() .antMatchers(HttpMethod.POST, "/globalConfigDict").permitAll()
// 所有 /user/add 用户注册 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/user/add").permitAll() .antMatchers(HttpMethod.POST, "/api/user/add").permitAll()
// 所有 /user/check/duplicate 检查用户名是否重复 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/user/check/duplicate").permitAll() .antMatchers(HttpMethod.POST, "/api/user/check/duplicate").permitAll()
// 所有 /login 用户登录 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/login").permitAll() .antMatchers(HttpMethod.POST, "/api/login").permitAll()
// 所有 app 用户注册 的POST请求 都放行 // 所有 app 用户注册 的POST请求 都放行
.antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll() .antMatchers(HttpMethod.POST, "/api/person-investigator/add").permitAll()
@ -80,6 +77,7 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
.antMatchers(HttpMethod.GET, "/api/adm/getStreetList").permitAll()//根据区县编号获取街道列表 .antMatchers(HttpMethod.GET, "/api/adm/getStreetList").permitAll()//根据区县编号获取街道列表
.antMatchers(HttpMethod.GET, "/updateFirePointStreetCode").permitAll() .antMatchers(HttpMethod.GET, "/updateFirePointStreetCode").permitAll()
.antMatchers(HttpMethod.GET, "/selectTodayFirePoint").permitAll() .antMatchers(HttpMethod.GET, "/selectTodayFirePoint").permitAll()
.antMatchers(HttpMethod.GET, "/api/user/selectVipUser").permitAll()
// 所有其它请求需要身份认证 // 所有其它请求需要身份认证
.anyRequest().authenticated() .anyRequest().authenticated()
.and() .and()

View File

@ -60,6 +60,14 @@ public class SysUserController {
@Resource @Resource
private SMSHelper smsHelper; private SMSHelper smsHelper;
/**
* 查询Vip用户
*/
@GetMapping("/selectVipUser")
public String selectVipUser() {
return sysUserService.selectVipUser();
}
/** /**
* 更新批量系统用户信息 * 更新批量系统用户信息
* *

View File

@ -14,6 +14,13 @@ import java.util.List;
*/ */
public interface SysUserService { public interface SysUserService {
/**
* 查询Vip用户
*
* @return
*/
String selectVipUser();
/** /**
* 检查用户名 * 检查用户名
* *

View File

@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Locale; import java.util.Locale;
@ -50,6 +51,39 @@ public class SysUserServiceImpl implements SysUserService {
@Resource @Resource
private StreetDao streetDao; private StreetDao streetDao;
private final Locale locale = LocaleContextHolder.getLocale();
/**
* 查询Vip用户
*
* @return
*/
@Override
public String selectVipUser() {
List<SysUserEntity> sysUserList = sysUserDao.findAll();
List<SysUserEntity> vipSysUserList = new ArrayList<>();
for (SysUserEntity sysUser : sysUserList) {
if (sysUser.getDeleteFlag() != 0) {//被删除的用户不属于Vip
continue;
}
if (sysUser.getActiveFlag() != 0) {//被禁用的用户不属于Vip
continue;
}
if (sysUser.getStatusCode() != 0) {//状态不正常的用户不属于Vip
continue;
}
if ("管理员".equals(sysUser.getAccountType())) {//管理员用户不属于Vip
continue;
}
LocalDateTime sysUserOverDateTime = DateTimeUtil.stringToDateTimeFormatter(sysUser.getOverTime(), DateTimeUtil.COMMON_FORMATTER_DATETIME);
if (sysUserOverDateTime.isBefore(LocalDateTime.now())) {//过期用户不属于Vip
continue;
}
vipSysUserList.add(sysUser);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, vipSysUserList, locale);
}
/** /**
* 检查用户名是否存在 * 检查用户名是否存在
* *
@ -71,7 +105,6 @@ public class SysUserServiceImpl implements SysUserService {
@Override @Override
public String addUser(SysUserQo sysUserQo, HttpServletRequest servletRequest) { public String addUser(SysUserQo sysUserQo, HttpServletRequest servletRequest) {
// 获取区域信息 // 获取区域信息
Locale locale = LocaleContextHolder.getLocale();
String salt = KeyGenerators.string().generateKey(); String salt = KeyGenerators.string().generateKey();
SysUserEntity sysUserEntity = new SysUserEntity(); SysUserEntity sysUserEntity = new SysUserEntity();
sysUserEntity.setUserName(sysUserQo.getUserName()); sysUserEntity.setUserName(sysUserQo.getUserName());
@ -179,7 +212,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String deleteSysUser(String userName) { public String deleteSysUser(String userName) {
Locale locale = LocaleContextHolder.getLocale();
int deleteCount = sysUserDao.deleteSysUser(userName); int deleteCount = sysUserDao.deleteSysUser(userName);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除" + deleteCount + "个账户", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除" + deleteCount + "个账户", locale);
} }
@ -289,7 +321,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String updatePassword(String oldPassword, String newPassword, String confirmPassword, SysUserEntity sysUserEntity) { public String updatePassword(String oldPassword, String newPassword, String confirmPassword, SysUserEntity sysUserEntity) {
Locale locale = LocaleContextHolder.getLocale();
String oldFrontPassword = encry256(oldPassword + sysUserEntity.getSalt()); String oldFrontPassword = encry256(oldPassword + sysUserEntity.getSalt());
if (!oldFrontPassword.equals(sysUserEntity.getPassword())) { if (!oldFrontPassword.equals(sysUserEntity.getPassword())) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "旧密码输入错误", locale); return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "旧密码输入错误", locale);
@ -313,7 +344,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String adminUpdatePassword(Integer userId, String newPassword, String confirmPassword) { public String adminUpdatePassword(Integer userId, String newPassword, String confirmPassword) {
Locale locale = LocaleContextHolder.getLocale();
if (!newPassword.equals(confirmPassword)) { if (!newPassword.equals(confirmPassword)) {
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "两次密码输入不一致", locale); return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "两次密码输入不一致", locale);
} }
@ -338,7 +368,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String updateExpireDateDay(Integer userId, Integer dayNum) { public String updateExpireDateDay(Integer userId, Integer dayNum) {
Locale locale = LocaleContextHolder.getLocale();
long l = dayNum.longValue(); long l = dayNum.longValue();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId); SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
@ -366,7 +395,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String updateExpireDateMonth(Integer userId, Integer dayNum) { public String updateExpireDateMonth(Integer userId, Integer dayNum) {
Locale locale = LocaleContextHolder.getLocale();
long l = dayNum.longValue(); long l = dayNum.longValue();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId); SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
@ -394,7 +422,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String updateExpireDateYear(Integer userId, Integer dayNum) { public String updateExpireDateYear(Integer userId, Integer dayNum) {
Locale locale = LocaleContextHolder.getLocale();
long l = dayNum.longValue(); long l = dayNum.longValue();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId); SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
@ -421,7 +448,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String updatePermanent(Integer userId) { public String updatePermanent(Integer userId) {
Locale locale = LocaleContextHolder.getLocale();
sysUserDao.updateDayNum(userId); sysUserDao.updateDayNum(userId);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
} }
@ -436,7 +462,6 @@ public class SysUserServiceImpl implements SysUserService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public String updateOverTime(Integer userId, String overTime) { public String updateOverTime(Integer userId, String overTime) {
Locale locale = LocaleContextHolder.getLocale();
sysUserDao.updateOverTime(userId, overTime); sysUserDao.updateOverTime(userId, overTime);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
} }