dongdingding
杜函宇 1 year ago
parent af77bf73bb
commit 36067a43ee

@ -33,6 +33,9 @@ public class ApprovalDeclarationRecordsQueryDto implements Serializable {
@ApiModelProperty(value = "申报单位") @ApiModelProperty(value = "申报单位")
private String enterpriseName; private String enterpriseName;
@ApiModelProperty(value = "申报单位ID")
private Long enterpriseId;
@ApiModelProperty(value = "扶持方式") @ApiModelProperty(value = "扶持方式")
private Integer supportMethods; private Integer supportMethods;

@ -37,6 +37,9 @@ public class ApprovalDeclarationRecordsQueryVo implements Serializable {
@ApiModelProperty(value = "申报单位") @ApiModelProperty(value = "申报单位")
private String enterpriseName; private String enterpriseName;
@ApiModelProperty(value = "申报单位Id")
private Long enterpriseId;
@ApiModelProperty(value = "扶持方式") @ApiModelProperty(value = "扶持方式")
private Integer supportMethods; private Integer supportMethods;

@ -6,33 +6,15 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.context.SecurityContextHolder; import com.ruoyi.common.context.SecurityContextHolder;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.jjh.declaration.entity.BmsApprovalInfo; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.jjh.declaration.entity.BmsDeclarationRecords; import com.ruoyi.jjh.declaration.entity.*;
import com.ruoyi.jjh.declaration.entity.BmsEnterpriseBasicInfo; import com.ruoyi.jjh.declaration.entity.dto.*;
import com.ruoyi.jjh.declaration.entity.BmsFieldInfo;
import com.ruoyi.jjh.declaration.entity.BmsFileInfo;
import com.ruoyi.jjh.declaration.entity.BmsProcessInfo;
import com.ruoyi.jjh.declaration.entity.dto.ApprovalDeclarationRecordsQueryDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsApprovalInfoUpdateDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsAddDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsDeclarationRecordsDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsFieldInfoAddDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsFileInfoAddDto;
import com.ruoyi.jjh.declaration.entity.dto.BmsMunicipalBureauReviewQueryDto;
import com.ruoyi.jjh.declaration.entity.dto.MunicipalReviewDto;
import com.ruoyi.jjh.declaration.entity.dto.MunicipalReviewInfoDto;
import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.ApprovalDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsDeclarationRecordsQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.BmsMunicipalBureauReviewQueryVo; import com.ruoyi.jjh.declaration.entity.vo.BmsMunicipalBureauReviewQueryVo;
import com.ruoyi.jjh.declaration.entity.vo.DeclarationRecordsVo; import com.ruoyi.jjh.declaration.entity.vo.DeclarationRecordsVo;
import com.ruoyi.jjh.declaration.mapper.BmsDeclarationRecordsMapper; import com.ruoyi.jjh.declaration.mapper.BmsDeclarationRecordsMapper;
import com.ruoyi.jjh.declaration.service.IBmsApprovalInfoService; import com.ruoyi.jjh.declaration.service.*;
import com.ruoyi.jjh.declaration.service.IBmsDeclarationRecordsService;
import com.ruoyi.jjh.declaration.service.IBmsEnterpriseBasicInfoService;
import com.ruoyi.jjh.declaration.service.IBmsFieldInfoService;
import com.ruoyi.jjh.declaration.service.IBmsFileInfoService;
import com.ruoyi.jjh.declaration.service.IBmsProcessInfoService;
import com.ruoyi.jjh.declaration.service.ICommonService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -134,7 +116,12 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
@Override @Override
public List<ApprovalDeclarationRecordsQueryVo> approvalList(ApprovalDeclarationRecordsQueryDto approvalDeclarationRecordsQueryDto) { public List<ApprovalDeclarationRecordsQueryVo> approvalList(ApprovalDeclarationRecordsQueryDto approvalDeclarationRecordsQueryDto) {
// approvalDeclarationRecordsQueryDto.setUserIds(iCommonService.getUserIds(SecurityContextHolder.getUserId())); // approvalDeclarationRecordsQueryDto.setUserIds(iCommonService.getUserIds(SecurityContextHolder.getUserId()));
approvalDeclarationRecordsQueryDto.setApprovalById(SecurityContextHolder.getUserId()); if (SecurityUtils.getUserId().equals(1L)) {
approvalDeclarationRecordsQueryDto.setApprovalById(null);
} else {
// todo SecurityContextHolder.getUserId()失效换成SecurityUtils.getUserId()
approvalDeclarationRecordsQueryDto.setApprovalById(SecurityUtils.getUserId());
}
return baseMapper.approvalList(approvalDeclarationRecordsQueryDto); return baseMapper.approvalList(approvalDeclarationRecordsQueryDto);
} }
@ -176,7 +163,7 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
List<BmsProcessInfo> bmsProcessInfoList = iBmsProcessInfoService.lambdaQuery().eq(BmsProcessInfo::getApprovalType, 0).list(); List<BmsProcessInfo> bmsProcessInfoList = iBmsProcessInfoService.lambdaQuery().eq(BmsProcessInfo::getApprovalType, 0).list();
BmsProcessInfo bmsProcessInfo = new BmsProcessInfo(); BmsProcessInfo bmsProcessInfo = new BmsProcessInfo();
bmsProcessInfoList.forEach(x -> { bmsProcessInfoList.forEach(x -> {
boolean flag = Arrays.asList(x.getApprovalByIds().split(",")).contains(String.valueOf(SecurityContextHolder.getUserId())); boolean flag = Arrays.asList(x.getApprovalByIds().split(",")).contains(String.valueOf(SecurityUtils.getUserId()));
if (flag) { if (flag) {
BeanUtil.copyProperties(x, bmsProcessInfo); BeanUtil.copyProperties(x, bmsProcessInfo);
} }
@ -193,7 +180,7 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
// bmsApprovalInfoUpdateDto.setSort(x.getSort()); // bmsApprovalInfoUpdateDto.setSort(x.getSort());
BeanUtil.copyProperties(bmsApprovalInfoUpdateDto, x); BeanUtil.copyProperties(bmsApprovalInfoUpdateDto, x);
x.setSort(sort); x.setSort(sort);
x.setApprovalById(SecurityContextHolder.getUserId()); x.setApprovalById(SecurityUtils.getUserId());
x.setApprovalTime(DateUtils.getNowDate()); x.setApprovalTime(DateUtils.getNowDate());
x.setIsReview(2); x.setIsReview(2);
iBmsApprovalInfoService.saveOrUpdate(x); iBmsApprovalInfoService.saveOrUpdate(x);
@ -221,7 +208,6 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
} }
// 更新记录状态 // 更新记录状态
int num = approval(bmsApprovalInfoUpdateDto, bmsProcessInfo); int num = approval(bmsApprovalInfoUpdateDto, bmsProcessInfo);
return num; return num;
} }

@ -122,6 +122,7 @@
b.project_name, b.project_name,
b.product_area, b.product_area,
c.enterprise_name, c.enterprise_name,
c.id as enterpriseId,
b.support_methods, b.support_methods,
b.start_time, b.start_time,
b.end_time, b.end_time,

@ -118,7 +118,7 @@ public class LogAspect
// 处理设置注解上的参数 // 处理设置注解上的参数
getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult); getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult);
// 设置消耗时间 // 设置消耗时间
operLog.setCostTime(System.currentTimeMillis() - TIME_THREADLOCAL.get()); // operLog.setCostTime(System.currentTimeMillis() - TIME_THREADLOCAL.get());
// 保存数据库 // 保存数据库
AsyncManager.me().execute(AsyncFactory.recordOper(operLog)); AsyncManager.me().execute(AsyncFactory.recordOper(operLog));
} }

@ -0,0 +1,44 @@
package com.ruoyi.framework.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.utils.SecurityUtils;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;
import java.time.LocalDateTime;
import java.util.Objects;
/**
*
*
* @author wu
* @since 2023/5/4 10:16
*/
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
// 获取当前登录用户
LoginUser loginUser = SecurityUtils.getLoginUser();
String userName = loginUser.getUsername();
if (!Objects.equals(userName, "")) {
this.strictInsertFill(metaObject, "createBy", String.class, userName);
}
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
}
@Override
public void updateFill(MetaObject metaObject) {
// 获取当前登录用户
LoginUser loginUser = SecurityUtils.getLoginUser();
String userName = loginUser.getUsername();
if (!Objects.equals(userName, "")) {
this.strictInsertFill(metaObject, "createBy", String.class, userName);
}
this.strictInsertFill(metaObject, "createTime", LocalDateTime.class, LocalDateTime.now());
}
}

@ -1,39 +1,37 @@
package com.ruoyi.framework.web.service; package com.ruoyi.framework.web.service;
import javax.annotation.Resource;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.utils.*;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysLogininforService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.constant.Constants; import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.UserStatus;
import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.exception.user.BlackListException;
import com.ruoyi.common.exception.user.CaptchaException; import com.ruoyi.common.exception.user.CaptchaException;
import com.ruoyi.common.exception.user.CaptchaExpireException; import com.ruoyi.common.exception.user.CaptchaExpireException;
import com.ruoyi.common.exception.user.UserNotExistsException;
import com.ruoyi.common.exception.user.UserPasswordNotMatchException; import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.MessageUtils;
import com.ruoyi.common.utils.ServletUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.ip.IpUtils; import com.ruoyi.common.utils.ip.IpUtils;
import com.ruoyi.framework.manager.AsyncManager; import com.ruoyi.framework.manager.AsyncManager;
import com.ruoyi.framework.manager.factory.AsyncFactory; import com.ruoyi.framework.manager.factory.AsyncFactory;
import com.ruoyi.framework.security.context.AuthenticationContextHolder; import com.ruoyi.framework.security.context.AuthenticationContextHolder;
import com.ruoyi.system.domain.SysLogininfor;
import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.service.ISysLogininforService;
import com.ruoyi.system.service.ISysUserService; import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* *
@ -41,8 +39,7 @@ import java.util.Set;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class SysLoginService public class SysLoginService {
{
@Autowired @Autowired
private TokenService tokenService; private TokenService tokenService;
@ -67,6 +64,7 @@ public class SysLoginService
@Autowired @Autowired
private SysPasswordService sysPasswordService; private SysPasswordService sysPasswordService;
/** /**
* *
* *
@ -76,36 +74,27 @@ public class SysLoginService
* @param uuid * @param uuid
* @return * @return
*/ */
public Map<String, Object> login(String username, String password, String code, String uuid,String userType) public Map<String, Object> login(String username, String password, String code, String uuid, String userType) {
{
// 验证码校验 // 验证码校验
validateCaptcha(username, code, uuid); validateCaptcha(username, code, uuid);
// 登录前置校验 // 登录前置校验
loginPreCheck(username, password); loginPreCheck(username, password);
// 用户验证 // 用户验证
Authentication authentication = null; Authentication authentication = null;
try try {
{
UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password); UsernamePasswordAuthenticationToken authenticationToken = new UsernamePasswordAuthenticationToken(username, password);
AuthenticationContextHolder.setContext(authenticationToken); AuthenticationContextHolder.setContext(authenticationToken);
// 该方法会去调用UserDetailsServiceImpl.loadUserByUsername // 该方法会去调用UserDetailsServiceImpl.loadUserByUsername
authentication = authenticationManager.authenticate(authenticationToken); authentication = authenticationManager.authenticate(authenticationToken);
} } catch (Exception e) {
catch (Exception e) if (e instanceof BadCredentialsException) {
{
if (e instanceof BadCredentialsException)
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match"))); AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.password.not.match")));
throw new UserPasswordNotMatchException(); throw new UserPasswordNotMatchException();
} } else {
else
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage())); AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, e.getMessage()));
throw new ServiceException(e.getMessage()); throw new ServiceException(e.getMessage());
} }
} } finally {
finally
{
AuthenticationContextHolder.clearContext(); AuthenticationContextHolder.clearContext();
} }
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success"))); AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")));
@ -132,7 +121,7 @@ public class SysLoginService
addRecord(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员"); addRecord(username, Constants.LOGIN_FAIL, "用户已停用,请联系管理员");
throw new ServiceException("对不起,您的账号:" + username + " 已停用"); throw new ServiceException("对不起,您的账号:" + username + " 已停用");
} }
sysPasswordService.validate(user); // sysPasswordService.validate(user);
addRecord(username, Constants.LOGIN_SUCCESS, "登录成功"); addRecord(username, Constants.LOGIN_SUCCESS, "登录成功");
// 生成token // 生成token
return tokenService.createToken(loginUser); return tokenService.createToken(loginUser);
@ -146,21 +135,17 @@ public class SysLoginService
* @param uuid * @param uuid
* @return * @return
*/ */
public void validateCaptcha(String username, String code, String uuid) public void validateCaptcha(String username, String code, String uuid) {
{
boolean captchaEnabled = configService.selectCaptchaEnabled(); boolean captchaEnabled = configService.selectCaptchaEnabled();
if (captchaEnabled) if (captchaEnabled) {
{
String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, ""); String verifyKey = CacheConstants.CAPTCHA_CODE_KEY + StringUtils.nvl(uuid, "");
String captcha = redisCache.getCacheObject(verifyKey); String captcha = redisCache.getCacheObject(verifyKey);
redisCache.deleteObject(verifyKey); redisCache.deleteObject(verifyKey);
if (captcha == null) if (captcha == null) {
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire"))); AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.expire")));
throw new CaptchaExpireException(); throw new CaptchaExpireException();
} }
if (!code.equalsIgnoreCase(captcha)) if (!code.equalsIgnoreCase(captcha)) {
{
AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error"))); AsyncManager.me().execute(AsyncFactory.recordLogininfor(username, Constants.LOGIN_FAIL, MessageUtils.message("user.jcaptcha.error")));
throw new CaptchaException(); throw new CaptchaException();
} }
@ -169,11 +154,11 @@ public class SysLoginService
/** /**
* *
*
* @param username * @param username
* @param password * @param password
*/ */
public void loginPreCheck(String username, String password) public void loginPreCheck(String username, String password) {
{
// 用户名或密码为空 错误 // 用户名或密码为空 错误
if (StringUtils.isAnyBlank(username, password)) { if (StringUtils.isAnyBlank(username, password)) {
this.addRecord(username, Constants.LOGIN_FAIL, "用户/密码必须填写"); this.addRecord(username, Constants.LOGIN_FAIL, "用户/密码必须填写");
@ -206,8 +191,7 @@ public class SysLoginService
* *
* @param userId ID * @param userId ID
*/ */
public void recordLoginInfo(Long userId) public void recordLoginInfo(Long userId) {
{
SysUser sysUser = new SysUser(); SysUser sysUser = new SysUser();
sysUser.setUserId(userId); sysUser.setUserId(userId);
sysUser.setLoginIp(IpUtils.getIpAddr()); sysUser.setLoginIp(IpUtils.getIpAddr());

@ -1,10 +1,5 @@
package com.ruoyi.framework.web.service; package com.ruoyi.framework.web.service;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import com.ruoyi.common.constant.CacheConstants; import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.core.redis.RedisCache;
@ -12,6 +7,12 @@ import com.ruoyi.common.exception.user.UserPasswordNotMatchException;
import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException; import com.ruoyi.common.exception.user.UserPasswordRetryLimitExceedException;
import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.framework.security.context.AuthenticationContextHolder; import com.ruoyi.framework.security.context.AuthenticationContextHolder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.stereotype.Component;
import java.util.concurrent.TimeUnit;
/** /**
* *
@ -19,8 +20,7 @@ import com.ruoyi.framework.security.context.AuthenticationContextHolder;
* @author ruoyi * @author ruoyi
*/ */
@Component @Component
public class SysPasswordService public class SysPasswordService {
{
@Autowired @Autowired
private RedisCache redisCache; private RedisCache redisCache;
@ -36,50 +36,40 @@ public class SysPasswordService
* @param username * @param username
* @return key * @return key
*/ */
private String getCacheKey(String username) private String getCacheKey(String username) {
{
return CacheConstants.PWD_ERR_CNT_KEY + username; return CacheConstants.PWD_ERR_CNT_KEY + username;
} }
public void validate(SysUser user) public void validate(SysUser user) {
{
Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext(); Authentication usernamePasswordAuthenticationToken = AuthenticationContextHolder.getContext();
String username = usernamePasswordAuthenticationToken.getName(); String username = usernamePasswordAuthenticationToken.getName();
String password = usernamePasswordAuthenticationToken.getCredentials().toString(); String password = usernamePasswordAuthenticationToken.getCredentials().toString();
Integer retryCount = redisCache.getCacheObject(getCacheKey(username)); Integer retryCount = redisCache.getCacheObject(getCacheKey(username));
if (retryCount == null) if (retryCount == null) {
{
retryCount = 0; retryCount = 0;
} }
if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) if (retryCount >= Integer.valueOf(maxRetryCount).intValue()) {
{
throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime); throw new UserPasswordRetryLimitExceedException(maxRetryCount, lockTime);
} }
if (!matches(user, password)) if (!matches(user, password)) {
{
retryCount = retryCount + 1; retryCount = retryCount + 1;
redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES); redisCache.setCacheObject(getCacheKey(username), retryCount, lockTime, TimeUnit.MINUTES);
throw new UserPasswordNotMatchException(); throw new UserPasswordNotMatchException();
} } else {
else
{
clearLoginRecordCache(username); clearLoginRecordCache(username);
} }
} }
public boolean matches(SysUser user, String rawPassword) public boolean matches(SysUser user, String rawPassword) {
{
return SecurityUtils.matchesPassword(rawPassword, user.getPassword()); return SecurityUtils.matchesPassword(rawPassword, user.getPassword());
} }
public void clearLoginRecordCache(String loginName) public void clearLoginRecordCache(String loginName) {
{ if (redisCache.hasKey(getCacheKey(loginName))) {
if (redisCache.hasKey(getCacheKey(loginName)))
{
redisCache.deleteObject(getCacheKey(loginName)); redisCache.deleteObject(getCacheKey(loginName));
} }
} }

@ -83,9 +83,9 @@ public class SysOperLog extends BaseEntity
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") @Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date operTime; private Date operTime;
/** 消耗时间 */ // /** 消耗时间 */
@Excel(name = "消耗时间", suffix = "毫秒") // @Excel(name = "消耗时间", suffix = "毫秒")
private Long costTime; // private Long costTime;
public Long getOperId() public Long getOperId()
{ {
@ -257,13 +257,13 @@ public class SysOperLog extends BaseEntity
this.operTime = operTime; this.operTime = operTime;
} }
public Long getCostTime() // public Long getCostTime()
{ // {
return costTime; // return costTime;
} // }
public void setCostTime(Long costTime) // public void setCostTime(Long costTime)
{ // {
this.costTime = costTime; // this.costTime = costTime;
} // }
} }

@ -21,7 +21,7 @@
<result property="status" column="status"/> <result property="status" column="status"/>
<result property="errorMsg" column="error_msg"/> <result property="errorMsg" column="error_msg"/>
<result property="operTime" column="oper_time"/> <result property="operTime" column="oper_time"/>
<result property="costTime" column="cost_time"/> <!-- <result property="costTime" column="cost_time"/>-->
</resultMap> </resultMap>
<sql id="selectOperLogVo"> <sql id="selectOperLogVo">
@ -40,18 +40,17 @@
json_result, json_result,
status, status,
error_msg, error_msg,
oper_time, oper_time
cost_time
from sys_oper_log from sys_oper_log
</sql> </sql>
<insert id="insertOperlog" parameterType="com.ruoyi.system.domain.SysOperLog"> <insert id="insertOperlog" parameterType="com.ruoyi.system.domain.SysOperLog">
insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name, insert into sys_oper_log(title, business_type, method, request_method, operator_type, oper_name, dept_name,
oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg,
cost_time, oper_time) oper_time)
values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName}, values (#{title}, #{businessType}, #{method}, #{requestMethod}, #{operatorType}, #{operName}, #{deptName},
#{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg}, #{operUrl}, #{operIp}, #{operLocation}, #{operParam}, #{jsonResult}, #{status}, #{errorMsg},
#{costTime}, sysdate()) sysdate())
</insert> </insert>
<select id="selectOperLogList" parameterType="com.ruoyi.system.domain.SysOperLog" resultMap="SysOperLogResult"> <select id="selectOperLogList" parameterType="com.ruoyi.system.domain.SysOperLog" resultMap="SysOperLogResult">

Loading…
Cancel
Save