替换旧代码
This commit is contained in:
parent
e7af80b564
commit
59a9e524f5
@ -75,8 +75,6 @@ public class JwtLoginFilter extends AbstractAuthenticationProcessingFilter {
|
||||
WebApplicationContext webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
|
||||
sysUserService = webApplicationContext.getBean(SysUserService.class);
|
||||
}
|
||||
//更新用户登录信息
|
||||
sysUserService.updateSysUserLogin(auth.getName(), IpUtil.getIpAddr(req));
|
||||
SysUserEntity userByUserName = sysUserService.getUserByUserName(auth.getName());
|
||||
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||
response.setHeader("Access-Control-Allow-Credentials", "false");
|
||||
|
@ -2,7 +2,6 @@ package com.xkrs.controller;
|
||||
|
||||
import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import com.xkrs.utils.TokenUtil;
|
||||
import com.xkrs.model.qo.SysUserQo;
|
||||
import com.xkrs.model.qo.SysUserReceiveSmsQo;
|
||||
import com.xkrs.model.qo.SysUserRemarkQo;
|
||||
@ -17,6 +16,7 @@ import com.xkrs.straw.service.SysUserService;
|
||||
import com.xkrs.utils.AliYunSmsUtils;
|
||||
import com.xkrs.utils.ListUtils;
|
||||
import com.xkrs.utils.RandomUtil;
|
||||
import com.xkrs.utils.TokenUtil;
|
||||
import org.apache.hc.core5.util.TextUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.data.domain.Sort;
|
||||
@ -57,14 +57,6 @@ public class SysUserController {
|
||||
@Resource
|
||||
private SMSHelper smsHelper;
|
||||
|
||||
/**
|
||||
* 查询Vip用户
|
||||
*/
|
||||
@GetMapping("/selectVipUser")
|
||||
public String selectVipUser() {
|
||||
return sysUserService.selectVipUser();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新(批量)系统用户信息
|
||||
*
|
||||
|
@ -40,13 +40,6 @@ public interface SysUserDao extends JpaRepository<SysUserEntity, Long>, JpaSpeci
|
||||
*/
|
||||
SysUserEntity findByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 更新用户登录信息
|
||||
*/
|
||||
@Modifying
|
||||
@Query(value = "UPDATE sys_user SET last_entry_time = now(), last_entry_ip = :ipAddress " + "WHERE user_name = :userName ;", nativeQuery = true)
|
||||
int updateSysUserLogin(@Param("userName") String userName, @Param("ipAddress") String ipAddress);
|
||||
|
||||
/**
|
||||
* 软删除系统用户根据id
|
||||
*/
|
||||
|
@ -11,13 +11,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface SysUserService {
|
||||
|
||||
/**
|
||||
* 查询Vip用户
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String selectVipUser();
|
||||
|
||||
/**
|
||||
* 检查用户名
|
||||
*
|
||||
@ -50,15 +43,6 @@ public interface SysUserService {
|
||||
*/
|
||||
SysUserEntity getSysUserByUserName(String userName);
|
||||
|
||||
/**
|
||||
* 用户登录更新
|
||||
*
|
||||
* @param userName
|
||||
* @param ipAddress
|
||||
* @return
|
||||
*/
|
||||
int updateSysUserLogin(String userName, String ipAddress);
|
||||
|
||||
/**
|
||||
* 系统用户更新
|
||||
*
|
||||
|
@ -61,31 +61,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
|
||||
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.getActiveFlag() != 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查用户名是否存在
|
||||
*
|
||||
@ -223,12 +198,6 @@ public class SysUserServiceImpl implements SysUserService {
|
||||
return sysUserDao.selectByUserName(userName);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public int updateSysUserLogin(String userName, String ipAddress) {
|
||||
return sysUserDao.updateSysUserLogin(userName, ipAddress);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user