新增接口:查询Vip用户
This commit is contained in:
parent
d0db039487
commit
431d8aac0d
@ -42,11 +42,8 @@ class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers(HttpMethod.GET, "/selectGlobalConfig").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/globalConfig").permitAll()
|
||||
.antMatchers(HttpMethod.POST, "/globalConfigDict").permitAll()
|
||||
// 所有 /user/add 用户注册 的POST请求 都放行
|
||||
.antMatchers(HttpMethod.POST, "/api/user/add").permitAll()
|
||||
// 所有 /user/check/duplicate 检查用户名是否重复 的POST请求 都放行
|
||||
.antMatchers(HttpMethod.POST, "/api/user/check/duplicate").permitAll()
|
||||
// 所有 /login 用户登录 的POST请求 都放行
|
||||
.antMatchers(HttpMethod.POST, "/api/login").permitAll()
|
||||
// 所有 app 用户注册 的POST请求 都放行
|
||||
.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, "/updateFirePointStreetCode").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/selectTodayFirePoint").permitAll()
|
||||
.antMatchers(HttpMethod.GET, "/api/user/selectVipUser").permitAll()
|
||||
// 所有其它请求需要身份认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
@ -60,6 +60,14 @@ public class SysUserController {
|
||||
@Resource
|
||||
private SMSHelper smsHelper;
|
||||
|
||||
/**
|
||||
* 查询Vip用户
|
||||
*/
|
||||
@GetMapping("/selectVipUser")
|
||||
public String selectVipUser() {
|
||||
return sysUserService.selectVipUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新(批量)系统用户信息
|
||||
*
|
||||
|
@ -14,6 +14,13 @@ import java.util.List;
|
||||
*/
|
||||
public interface SysUserService {
|
||||
|
||||
/**
|
||||
* 查询Vip用户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String selectVipUser();
|
||||
|
||||
/**
|
||||
* 检查用户名
|
||||
*
|
||||
|
@ -17,6 +17,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
@ -50,6 +51,39 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Resource
|
||||
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
|
||||
public String addUser(SysUserQo sysUserQo, HttpServletRequest servletRequest) {
|
||||
// 获取区域信息
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String salt = KeyGenerators.string().generateKey();
|
||||
SysUserEntity sysUserEntity = new SysUserEntity();
|
||||
sysUserEntity.setUserName(sysUserQo.getUserName());
|
||||
@ -179,7 +212,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String deleteSysUser(String userName) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
int deleteCount = sysUserDao.deleteSysUser(userName);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "删除" + deleteCount + "个账户", locale);
|
||||
}
|
||||
@ -289,7 +321,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String updatePassword(String oldPassword, String newPassword, String confirmPassword, SysUserEntity sysUserEntity) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
String oldFrontPassword = encry256(oldPassword + sysUserEntity.getSalt());
|
||||
if (!oldFrontPassword.equals(sysUserEntity.getPassword())) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "旧密码输入错误", locale);
|
||||
@ -313,7 +344,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String adminUpdatePassword(Integer userId, String newPassword, String confirmPassword) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
if (!newPassword.equals(confirmPassword)) {
|
||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL, "两次密码输入不一致", locale);
|
||||
}
|
||||
@ -338,7 +368,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String updateExpireDateDay(Integer userId, Integer dayNum) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
long l = dayNum.longValue();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
|
||||
@ -366,7 +395,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String updateExpireDateMonth(Integer userId, Integer dayNum) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
long l = dayNum.longValue();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
|
||||
@ -394,7 +422,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String updateExpireDateYear(Integer userId, Integer dayNum) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
long l = dayNum.longValue();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
|
||||
@ -421,7 +448,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String updatePermanent(Integer userId) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
sysUserDao.updateDayNum(userId);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
|
||||
}
|
||||
@ -436,7 +462,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public String updateOverTime(Integer userId, String overTime) {
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
sysUserDao.updateOverTime(userId, overTime);
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功", locale);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user