Merge branch 'refs/heads/dev'
# Conflicts: # bonus-auth/src/main/java/com/bonus/auth/service/SysPasswordService.java
This commit is contained in:
commit
7addd31f7a
|
|
@ -59,7 +59,7 @@ public interface RemoteConfigService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改成功影响的行数或错误码和错误消息
|
||||
*/
|
||||
@PutMapping
|
||||
@PostMapping(value = "/config/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -68,6 +68,6 @@ public interface RemoteConfigService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 成功或出错信息
|
||||
*/
|
||||
@DeleteMapping("/{configIds}")
|
||||
@PostMapping("/delete/{configIds}")
|
||||
public AjaxResult remove(@PathVariable("configIds") Long[] configIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public interface RemoteDeptService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改成功影响的行数或错误码和错误消息
|
||||
*/
|
||||
@PutMapping("/dept")
|
||||
@PostMapping("/dept/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);
|
||||
|
||||
/**
|
||||
|
|
@ -57,6 +57,6 @@ public interface RemoteDeptService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 成功或出错信息
|
||||
*/
|
||||
@DeleteMapping("/dept/{deptId}")
|
||||
@PostMapping("/dept/delete/{deptId}")
|
||||
public AjaxResult remove(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE)String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ public interface RemoteDictDataService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改成功影响的行数或错误码和错误消息
|
||||
*/
|
||||
@PutMapping(value = "/dict/data")
|
||||
@PostMapping(value = "/dict/data/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -66,6 +66,6 @@ public interface RemoteDictDataService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 成功或出错信息
|
||||
*/
|
||||
@DeleteMapping("/dict/data/{dictCodes}")
|
||||
@PostMapping("/dict/data/delete/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable("dictCodes") Long[] dictCodes, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public interface RemoteDictTypeService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改成功影响的行数或错误码和错误消息
|
||||
*/
|
||||
@PutMapping(value = "/dict/type")
|
||||
@PostMapping(value = "/dict/type/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +59,7 @@ public interface RemoteDictTypeService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 成功或出错信息
|
||||
*/
|
||||
@DeleteMapping("/dict/type/{dictIds}")
|
||||
@PostMapping("/dict/type/delete/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable("dictIds") Long[] dictIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -43,6 +43,6 @@ public interface RemoteFileService
|
|||
* @param objectKey * @param objectKey,除mongodb 存fileid之外,其他均存上传文件的网络路径
|
||||
* @return 成功或失败信息
|
||||
*/
|
||||
@DeleteMapping("/deleteFile")
|
||||
@PostMapping("/deleteFile")
|
||||
public AjaxResult deleteFile(@RequestParam("objectKey") String objectKey);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ public interface RemoteLogService
|
|||
//
|
||||
|
||||
/**
|
||||
* 保存系统日志
|
||||
* 保存日志
|
||||
*
|
||||
* @param sysLogsVo 日志实体
|
||||
* @param source 请求来源
|
||||
|
|
@ -56,7 +56,7 @@ public interface RemoteLogService
|
|||
@PostMapping("/operlog/getLogsModule")
|
||||
public Map<String,String> getLogsModule(@RequestBody SysLogsVo sysLogsVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source) throws Exception;
|
||||
/**
|
||||
* 保存访问记录
|
||||
* 保存登录日志
|
||||
*
|
||||
* @param sysLogininfor 访问实体
|
||||
* @param source 请求来源
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public interface RemoteMenuService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改成功影响的行数或错误码和错误消息
|
||||
*/
|
||||
@PutMapping("/menu")
|
||||
@PostMapping("/menu/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public interface RemoteNoticeService {
|
|||
* @param source 内部请求的请求头标志,使用SecurityConstants.INNER
|
||||
* @return 修改公告影响行数或错误信息
|
||||
*/
|
||||
@PutMapping(value = "/notice")
|
||||
@PostMapping(value = "/notice/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -57,6 +57,6 @@ public interface RemoteNoticeService {
|
|||
* @param source 内部请求的请求头标志,使用SecurityConstants.INNER
|
||||
* @return 删除公告影响行数或错误信息
|
||||
*/
|
||||
@DeleteMapping("/notice/{noticeIds}")
|
||||
@PostMapping("/notice/delete/{noticeIds}")
|
||||
public AjaxResult remove(@PathVariable("noticeIds") Long[] noticeIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public interface RemotePostService {
|
|||
* @param source 内部请求标志,使用SecurityConstants.INNER
|
||||
* @return 修改岗位影响的行数或错误信息
|
||||
*/
|
||||
@PutMapping("/post")
|
||||
@PostMapping("/post/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -57,7 +57,7 @@ public interface RemotePostService {
|
|||
* @param source 内部请求标志,使用SecurityConstants.INNER
|
||||
* @return 删除岗位影响的行数或错误信息
|
||||
*/
|
||||
@DeleteMapping("/post/{postIds}")
|
||||
@PostMapping("/post/delete/{postIds}")
|
||||
public AjaxResult remove(@PathVariable("postIds") Long[] postIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,10 +6,7 @@ import com.bonus.common.core.web.domain.AjaxResult;
|
|||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.factory.RemoteRoleFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @author wangvivi
|
||||
|
|
@ -31,6 +28,6 @@ public interface RemoteProfileService {
|
|||
* @param source 内部请求标志,使用SecurityConstants.INNER
|
||||
* @return 岗位列表
|
||||
*/
|
||||
@PutMapping
|
||||
@PostMapping("/user/profile/edit")
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public interface RemoteRoleService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改角色影响的行数或错误信息
|
||||
*/
|
||||
@PutMapping("/role")
|
||||
@PostMapping("/role/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -59,7 +59,7 @@ public interface RemoteRoleService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改角色影响的行数或错误信息
|
||||
*/
|
||||
@PutMapping("/role/dataScope")
|
||||
@PostMapping("/role/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -68,7 +68,7 @@ public interface RemoteRoleService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 修改角色状态影响的行数或错误信息
|
||||
*/
|
||||
@PutMapping("/role/changeStatus")
|
||||
@PostMapping("/role/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -77,7 +77,7 @@ public interface RemoteRoleService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 删除角色影响的行数或错误信息
|
||||
*/
|
||||
@DeleteMapping("/role/{roleIds}")
|
||||
@PostMapping("/role/delete/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable("roleIds") Long[] roleIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -112,7 +112,7 @@ public interface RemoteRoleService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 取消用户的行数或错误信息
|
||||
*/
|
||||
@PutMapping("/role/authUser/cancel")
|
||||
@PostMapping("/role/authUser/cancel")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -122,7 +122,7 @@ public interface RemoteRoleService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 成功或失败消息
|
||||
*/
|
||||
@PutMapping("/role/authUser/cancelAll")
|
||||
@PostMapping("/role/authUser/cancelAll")
|
||||
public AjaxResult cancelAuthUserAll(@PathVariable("roleId")Long roleId, @PathVariable("userIds")Long[] userIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -132,7 +132,7 @@ public interface RemoteRoleService {
|
|||
* @param source 请求来源,使用SecurityConstants.INNER
|
||||
* @return 成功或失败消息
|
||||
*/
|
||||
@PutMapping("/role/authUser/selectAll")
|
||||
@PostMapping("/role/authUser/selectAll")
|
||||
public AjaxResult selectAuthUserAll(@PathVariable("roleId")Long roleId, @PathVariable("userIds")Long[] userIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public interface RemoteUserService {
|
|||
* @param source 请求来源
|
||||
* @return 修改用户影响的行数或错误信息
|
||||
*/
|
||||
@PutMapping("/user/")
|
||||
@PostMapping("/user/edit")
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -125,7 +125,7 @@ public interface RemoteUserService {
|
|||
* @param source 请求来源
|
||||
* @return 删除用户影响的行数或错误信息
|
||||
*/
|
||||
@DeleteMapping("/user/{userIds}")
|
||||
@PostMapping("/user/delete/{userIds}")
|
||||
public AjaxResult remove(@PathVariable("userIds") Long[] userIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -135,7 +135,7 @@ public interface RemoteUserService {
|
|||
* @param source 请求来源
|
||||
* @return 修改用户状态的影响的行数或错误信息
|
||||
*/
|
||||
@PutMapping("/user/changeStatus")
|
||||
@PostMapping("/user/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
@ -156,7 +156,7 @@ public interface RemoteUserService {
|
|||
* @param source 请求来源
|
||||
* @return 成功授权消息或失败消息,
|
||||
*/
|
||||
@PutMapping("/user/authRole")
|
||||
@PostMapping("/user/authRole/edit")
|
||||
public AjaxResult insertAuthRole(@PathVariable("userId") Long userId, @PathVariable("roleIds") Long[] roleIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,10 +4,7 @@ import com.bonus.auth.config.LoginType;
|
|||
import com.bonus.auth.factory.LoginStrategyFactory;
|
||||
import com.bonus.auth.form.LoginBody;
|
||||
import com.bonus.auth.form.RegisterBody;
|
||||
import com.bonus.auth.service.LoginStrategy;
|
||||
import com.bonus.auth.service.PasswordValidatorService;
|
||||
import com.bonus.auth.service.SysLoginService;
|
||||
import com.bonus.auth.service.SysPasswordService;
|
||||
import com.bonus.auth.service.*;
|
||||
import com.bonus.common.core.constant.SecurityConstants;
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.core.utils.JwtUtils;
|
||||
|
|
@ -16,6 +13,7 @@ import com.bonus.common.security.auth.AuthUtil;
|
|||
import com.bonus.common.security.service.TokenService;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.config.SystemConfig;
|
||||
import com.bonus.system.api.RemoteLogService;
|
||||
import com.bonus.system.api.RemoteUserService;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import com.bonus.system.api.model.LoginUser;
|
||||
|
|
@ -59,6 +57,9 @@ public class TokenController {
|
|||
@Autowired
|
||||
private PasswordValidatorService passwordValidatorService;
|
||||
|
||||
@Autowired
|
||||
private SysRecordLogService logService;
|
||||
|
||||
@PostMapping("isAdmin")
|
||||
public R<?> isAdmin(@RequestBody LoginBody form) {
|
||||
if (!config.isAdmin()) {
|
||||
|
|
@ -109,6 +110,7 @@ public class TokenController {
|
|||
form.setPassword(form.getVerificationCode());
|
||||
}
|
||||
LoginUser login = strategy.login(form.getUsername(), form.getPassword());
|
||||
logService.saveLogin(form.getUsername(), "登录", "登录成功", null, "成功");
|
||||
return R.ok(tokenService.createToken(login));
|
||||
|
||||
}
|
||||
|
|
@ -130,7 +132,7 @@ public class TokenController {
|
|||
* @param request HTTP 请求
|
||||
* @return 登出结果
|
||||
*/
|
||||
@DeleteMapping("logout")
|
||||
@PostMapping("logout")
|
||||
public R<?> logout(HttpServletRequest request) {
|
||||
try {
|
||||
String token = SecurityUtils.getToken(request);
|
||||
|
|
@ -143,6 +145,7 @@ public class TokenController {
|
|||
AuthUtil.logoutByToken(token);
|
||||
tokenService.delExistingToken(Long.valueOf(userId));
|
||||
sysLoginService.logout(username, userId);
|
||||
logService.saveLogout(username, "退出登录", "退出成功", userId, "成功");
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
|
@ -181,7 +184,8 @@ public class TokenController {
|
|||
*/
|
||||
@PostMapping("register")
|
||||
public R<?> register(@RequestBody RegisterBody registerBody) {
|
||||
sysLoginService.register(registerBody);
|
||||
return R.ok();
|
||||
sysLoginService.register(registerBody);
|
||||
logService.saveRegister(registerBody.getUsername(), "注册", "注册成功", null, "成功");
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public class SysPasswordService {
|
|||
if (!matches(user, password)) {
|
||||
retryCount = retryCount + 1;
|
||||
recordLogService.saveLogs(username, startTime, "密码输入错误", "用户不存在/密码错误", null, null);
|
||||
redisService.setCacheObject(getCacheKey(username), retryCount, (long)lockTime, TimeUnit.MINUTES);
|
||||
redisService.setCacheObject(getCacheKey(username), retryCount, dynamicLockTime, TimeUnit.MINUTES);
|
||||
throw new ServiceException("用户不存在/密码错误");
|
||||
} else {
|
||||
clearLoginRecordCache(username);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import com.alibaba.nacos.common.utils.UuidUtils;
|
|||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.utils.global.SystemGlobal;
|
||||
import com.bonus.common.log.enums.OperaResult;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import com.bonus.system.api.domain.SysLogsVo;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -70,13 +71,13 @@ public class SysRecordLogService
|
|||
sysLogsVo.setLogId(uuid);
|
||||
sysLogsVo.setOperaUserName(username);
|
||||
sysLogsVo.setIp(IpUtils.getIpAddr());
|
||||
sysLogsVo.setModel("系统登录");
|
||||
sysLogsVo.setModel("系统认证模块");
|
||||
sysLogsVo.setOperTime(DateUtils.getTime());
|
||||
sysLogsVo.setMethodType(SystemGlobal.POST);
|
||||
sysLogsVo.setMethod("login()");
|
||||
sysLogsVo.setParams("{\"username\":\""+username+"\"}");
|
||||
sysLogsVo.setOperateDetail("用户登录系统");
|
||||
sysLogsVo.setOperType("登录");
|
||||
sysLogsVo.setOperType(OperaType.LOGIN);
|
||||
sysLogsVo.setOperUri("/login");
|
||||
sysLogsVo.setLogType(0);
|
||||
if (StringUtils.isNotEmpty(result)){
|
||||
|
|
@ -120,7 +121,7 @@ public class SysRecordLogService
|
|||
}
|
||||
sysLogsVo.setResultData("用户登录成功");
|
||||
sysLogsVo.setTitle("系统登录");
|
||||
sysLogsVo.setModel("系统登录");
|
||||
sysLogsVo.setModel("系统认证模块");
|
||||
sysLogsVo.setOperTime(DateUtils.getTime());
|
||||
sysLogsVo.setMethodType(SystemGlobal.POST);
|
||||
sysLogsVo.setMethod("login()");
|
||||
|
|
@ -139,7 +140,7 @@ public class SysRecordLogService
|
|||
}
|
||||
}
|
||||
/**
|
||||
* 记录登录信息
|
||||
* 记录登出信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param
|
||||
|
|
@ -152,7 +153,7 @@ public class SysRecordLogService
|
|||
sysLogsVo.setLogId(uuid);
|
||||
sysLogsVo.setOperaUserName(username);
|
||||
sysLogsVo.setIp(IpUtils.getIpAddr());
|
||||
sysLogsVo.setModel("退出登录");
|
||||
sysLogsVo.setModel("系统认证模块");
|
||||
sysLogsVo.setLogType(0);
|
||||
if (StringUtils.isNotEmpty(userId)){
|
||||
sysLogsVo.setUserId(userId);
|
||||
|
|
@ -178,4 +179,78 @@ public class SysRecordLogService
|
|||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录登录信息
|
||||
*
|
||||
* @param username 用户名
|
||||
* @param
|
||||
* @param message 消息内容
|
||||
* @return
|
||||
*/
|
||||
public void saveLogin(String username, String message,String resultData,String userId,String result) {
|
||||
SysLogsVo sysLogsVo = new SysLogsVo();
|
||||
String uuid= UUID.randomUUID().toString().replace("-","").toUpperCase();
|
||||
sysLogsVo.setLogId(uuid);
|
||||
sysLogsVo.setOperaUserName(username);
|
||||
sysLogsVo.setIp(IpUtils.getIpAddr());
|
||||
sysLogsVo.setModel("系统认证模块");
|
||||
sysLogsVo.setLogType(0);
|
||||
if (StringUtils.isNotEmpty(userId)){
|
||||
sysLogsVo.setUserId(userId);
|
||||
}
|
||||
sysLogsVo.setOperTime(DateUtils.getTime());
|
||||
sysLogsVo.setMethodType(SystemGlobal.POST);
|
||||
sysLogsVo.setMethod("login()");
|
||||
sysLogsVo.setParams("{\"username\":\""+username+"\"}");
|
||||
sysLogsVo.setOperateDetail("用户登录");
|
||||
sysLogsVo.setOperType(OperaType.LOGIN);
|
||||
sysLogsVo.setOperUri("/login");
|
||||
if (StringUtils.isNotEmpty(result)){
|
||||
sysLogsVo.setResult(result);
|
||||
}else{
|
||||
sysLogsVo.setResult(OperaResult.SUCCESS);
|
||||
}
|
||||
sysLogsVo.setFailureReason(message);
|
||||
sysLogsVo.setTitle("登录");
|
||||
sysLogsVo.setResultData(resultData);
|
||||
try{
|
||||
remoteLogService.addLogs(sysLogsVo, SecurityConstants.INNER);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
|
||||
public void saveRegister(String username, String message,String resultData,String userId,String result) {
|
||||
SysLogsVo sysLogsVo = new SysLogsVo();
|
||||
String uuid= UUID.randomUUID().toString().replace("-","").toUpperCase();
|
||||
sysLogsVo.setLogId(uuid);
|
||||
sysLogsVo.setOperaUserName(username);
|
||||
sysLogsVo.setIp(IpUtils.getIpAddr());
|
||||
sysLogsVo.setModel("系统认证模块");
|
||||
sysLogsVo.setLogType(0);
|
||||
if (StringUtils.isNotEmpty(userId)){
|
||||
sysLogsVo.setUserId(userId);
|
||||
}
|
||||
sysLogsVo.setOperTime(DateUtils.getTime());
|
||||
sysLogsVo.setMethodType(SystemGlobal.POST);
|
||||
sysLogsVo.setMethod("register()");
|
||||
sysLogsVo.setParams("{\"username\":\""+username+"\"}");
|
||||
sysLogsVo.setOperateDetail("用户注册");
|
||||
sysLogsVo.setOperType(OperaType.REGISTER);
|
||||
sysLogsVo.setOperUri("/register");
|
||||
if (StringUtils.isNotEmpty(result)){
|
||||
sysLogsVo.setResult(result);
|
||||
}else{
|
||||
sysLogsVo.setResult(OperaResult.SUCCESS);
|
||||
}
|
||||
sysLogsVo.setFailureReason(message);
|
||||
sysLogsVo.setTitle("注册");
|
||||
sysLogsVo.setResultData(resultData);
|
||||
try{
|
||||
remoteLogService.addLogs(sysLogsVo, SecurityConstants.INNER);
|
||||
}catch (Exception e){
|
||||
log.error(e.toString(),e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ public class StringUtilsTest {
|
|||
public void testSplit() {
|
||||
assertArrayEquals(new String[0], StringUtils.split(null, ","));
|
||||
assertArrayEquals(new String[]{"a", "b", "c"}, StringUtils.split("a,b,c", ","));
|
||||
assertArrayEquals(new String[]{"a", "b", "c"}, StringUtils.split("a.b.c", "\\."));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#Thu Sep 19 15:42:27 CST 2024
|
||||
#Wed Nov 06 11:32:35 CST 2024
|
||||
anotherKey=anotherValue
|
||||
key=value
|
||||
anotherKey1=anotherValue1
|
||||
|
|
|
|||
|
|
@ -52,4 +52,11 @@ public class OperaType {
|
|||
* 其他
|
||||
*/
|
||||
public final static String FLASH="刷新";
|
||||
|
||||
public final static String LOGIN="登录";
|
||||
|
||||
public final static String LOGOUT="登出";
|
||||
|
||||
public final static String REGISTER="注册";
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ import static org.springframework.http.MediaType.MULTIPART_FORM_DATA_VALUE;
|
|||
public class ParamSecureHandler implements AsyncHandlerInterceptor {
|
||||
|
||||
private static final String [] WHITE_URL = {
|
||||
"/login", "/isAdmin", "/isLogin", "/register","/operlog/addLogs","/job"};
|
||||
"/login", "/isAdmin", "/isLogin" ,"/register","/user/register","/operlog/addLogs","/job/edit","/user/resetPwd","/user/profile/updatePwd'"};
|
||||
private String rnd = null;
|
||||
|
||||
public static String ur = "/";
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class SysFileController
|
|||
* 从各个存储平台删除文件
|
||||
* @param objectKey * @param objectKey,除mongodb 存fileid之外,其他均存上传文件的网络路径
|
||||
*/
|
||||
@DeleteMapping("/deleteFile")
|
||||
@PostMapping("/deleteFile")
|
||||
public AjaxResult deleteFile(@RequestParam("objectKey") String objectKey) {
|
||||
try {
|
||||
String fileUrl = Base64Utils.decodeUrl(URLDecoder.decode(objectKey));
|
||||
|
|
@ -159,7 +159,7 @@ public class SysFileController
|
|||
* @param folderName 文件夹名,默认为根目录
|
||||
* @return 文件夹网络路径
|
||||
*/
|
||||
@DeleteMapping("/deleteFolder")
|
||||
@PostMapping("/deleteFolder")
|
||||
public AjaxResult deleteFolder(@RequestParam("folderName") String folderName) {
|
||||
return AjaxResult.success("文件夹删除成功");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class GenController extends BaseController
|
|||
* 修改保存代码生成业务
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:edit")
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "代码生成", businessType = OperaType.UPDATE,logType = 0,module = "系统工具->代码生成",details = "修改保存代码生成业务")
|
||||
public AjaxResult editSave(@Validated @RequestBody GenTable genTable)
|
||||
{
|
||||
|
|
@ -131,7 +131,7 @@ public class GenController extends BaseController
|
|||
* 删除代码生成
|
||||
*/
|
||||
@RequiresPermissions("tool:gen:remove")
|
||||
@DeleteMapping("/{tableIds}")
|
||||
@PostMapping("/delete/{tableIds}")
|
||||
@SysLog(title = "代码生成", businessType = OperaType.DELETE,logType = 0,module = "系统工具->代码生成",details = "删除代码生成")
|
||||
public AjaxResult remove(@PathVariable Long[] tableIds)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class ${ClassName}Controller extends BaseController
|
|||
* 删除${functionName}
|
||||
*/
|
||||
@RequiresPermissions("${permissionPrefix}:remove")
|
||||
@DeleteMapping("/{${pkColumn.javaField}s}")
|
||||
@PostMapping("/delete/{${pkColumn.javaField}s}")
|
||||
@SysLog(title = "${functionName}", businessType = OperaType.DELETE,logType = 0,module = "${functionName}",details = "导出${functionName}列表")
|
||||
public AjaxResult remove(@PathVariable ${pkColumn.javaType}[] ${pkColumn.javaField}s)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ public class SysJobController extends BaseController
|
|||
* 修改定时任务
|
||||
*/
|
||||
@RequiresPermissions("monitor:job:edit")
|
||||
@PutMapping
|
||||
@PostMapping("edit")
|
||||
@SysLog(title = "定时任务", businessType = OperaType.UPDATE,logType = 0,module = "系统监控->定时任务",details = "修改定时任务")
|
||||
public AjaxResult edit(@RequestBody SysJob job) throws SchedulerException, TaskException
|
||||
{
|
||||
|
|
@ -152,7 +152,7 @@ public class SysJobController extends BaseController
|
|||
* 定时任务状态修改
|
||||
*/
|
||||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PutMapping("/changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
@SysLog(title = "定时任务", businessType = OperaType.UPDATE,logType = 0,module = "系统监控->定时任务",details = "定时任务状态修改")
|
||||
public AjaxResult changeStatus(@RequestBody SysJob job) throws SchedulerException
|
||||
{
|
||||
|
|
@ -165,7 +165,7 @@ public class SysJobController extends BaseController
|
|||
* 定时任务立即执行一次
|
||||
*/
|
||||
@RequiresPermissions("monitor:job:changeStatus")
|
||||
@PutMapping("/run")
|
||||
@PostMapping("/run")
|
||||
@SysLog(title = "定时任务", businessType = OperaType.UPDATE,logType = 0,module = "系统监控->定时任务",details = "定时任务立即执行一次")
|
||||
public AjaxResult run(@RequestBody SysJob job) throws SchedulerException
|
||||
{
|
||||
|
|
@ -177,7 +177,7 @@ public class SysJobController extends BaseController
|
|||
* 删除定时任务
|
||||
*/
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@DeleteMapping("/{jobIds}")
|
||||
@PostMapping("/delete/{jobIds}")
|
||||
@SysLog(title = "定时任务", businessType = OperaType.DELETE,logType = 0,module = "系统监控->定时任务",details = "删除定时任务")
|
||||
public AjaxResult remove(@PathVariable Long[] jobIds) throws SchedulerException, TaskException
|
||||
{
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class SysJobLogController extends BaseController
|
|||
* 删除定时任务调度日志
|
||||
*/
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@DeleteMapping("/{jobLogIds}")
|
||||
@PostMapping("/delete/{jobLogIds}")
|
||||
@SysLog(title = "定时任务", businessType = OperaType.DELETE,logType = 0,module = "系统监控->定时任务->调度日志",details = "删除定时任务调度日志")
|
||||
public AjaxResult remove(@PathVariable Long[] jobLogIds)
|
||||
{
|
||||
|
|
@ -83,7 +83,7 @@ public class SysJobLogController extends BaseController
|
|||
* 清空定时任务调度日志
|
||||
*/
|
||||
@RequiresPermissions("monitor:job:remove")
|
||||
@DeleteMapping("/clean")
|
||||
@PostMapping("/clean")
|
||||
@SysLog(title = "定时任务", businessType = OperaType.DELETE,logType = 0,module = "系统监控->定时任务->调度日志",details = "清空定时任务调度日志")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class ScheduleUtils
|
|||
{
|
||||
return StringUtils.containsAnyIgnoreCase(invokeTarget, Constants.JOB_WHITELIST_STR);
|
||||
}
|
||||
Object obj = SpringUtils.getBean(StringUtils.split(invokeTarget, ".")[0]);
|
||||
Object obj = SpringUtils.getBean(StringUtils.split(invokeTarget, "\\.")[0]);
|
||||
String beanPackageName = obj.getClass().getPackage().getName();
|
||||
return StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_WHITELIST_STR)
|
||||
&& !StringUtils.containsAnyIgnoreCase(beanPackageName, Constants.JOB_ERROR_STR);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public class SysConfigController extends BaseController {
|
|||
* 修改参数配置
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:config:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "参数配置", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->参数配置")
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config) {
|
||||
try{
|
||||
|
|
@ -140,7 +140,7 @@ public class SysConfigController extends BaseController {
|
|||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:config:remove"))
|
||||
@SysLog(title = "参数配置", businessType = OperaType.DELETE,logType = 0,module = "系统管理->参数配置")
|
||||
@DeleteMapping("/{configIds}")
|
||||
@PostMapping("/delete/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds) {
|
||||
try{
|
||||
configService.deleteConfigByIds(configIds);
|
||||
|
|
@ -155,7 +155,7 @@ public class SysConfigController extends BaseController {
|
|||
* 刷新参数缓存
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:config:remove"))
|
||||
@DeleteMapping("/refreshCache")
|
||||
@PostMapping("/refreshCache")
|
||||
@SysLog(title = "参数配置", businessType = OperaType.FLASH,logType = 0,module = "系统管理->参数配置",details = "刷新参数缓存")
|
||||
public AjaxResult refreshCache() {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class SysDeptController extends BaseController
|
|||
* 修改部门
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:dept:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "部门管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->部门管理")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept) {
|
||||
try{
|
||||
|
|
@ -138,7 +138,7 @@ public class SysDeptController extends BaseController
|
|||
*/
|
||||
@RequiresRoles("admin")
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:dept:remove"))
|
||||
@DeleteMapping("/{deptId}")
|
||||
@PostMapping("/delete/{deptId}")
|
||||
@SysLog(title = "部门管理", businessType = OperaType.DELETE,logType = 0,module = "系统管理->部门管理")
|
||||
public AjaxResult remove(@PathVariable Long deptId) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ public class SysDictDataController extends BaseController
|
|||
* 修改保存字典数据
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:dict:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "字典管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->字典管理")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict) {
|
||||
try{
|
||||
|
|
@ -141,7 +141,7 @@ public class SysDictDataController extends BaseController
|
|||
* 删除字典数据
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:dict:remove"))
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
@PostMapping("/delete/{dictCodes}")
|
||||
@SysLog(title = "字典管理", businessType = OperaType.DELETE,logType = 0,module = "系统管理->字典管理")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public class SysDictTypeController extends BaseController
|
|||
* 修改字典类型
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:dict:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "字典管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->字典管理")
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict) {
|
||||
try{
|
||||
|
|
@ -125,7 +125,7 @@ public class SysDictTypeController extends BaseController
|
|||
* 删除字典类型
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:dict:remove"))
|
||||
@DeleteMapping("/{dictIds}")
|
||||
@PostMapping("/delete/{dictIds}")
|
||||
@SysLog(title = "字典管理", businessType = OperaType.DELETE,logType = 0,module = "系统管理->字典管理")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds) {
|
||||
try{
|
||||
|
|
@ -143,7 +143,7 @@ public class SysDictTypeController extends BaseController
|
|||
* 刷新字典缓存
|
||||
*/
|
||||
@RequiresPermissions("system:dict:remove")
|
||||
@DeleteMapping("/refreshCache")
|
||||
@PostMapping("/refreshCache")
|
||||
@SysLog(title = "字典管理", businessType = OperaType.FLASH,logType = 0,module = "系统管理->字典管理",details = "刷新字典缓存")
|
||||
public AjaxResult refreshCache() {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -53,12 +53,21 @@ public class SysLogController extends BaseController {
|
|||
// @Value("${sql.filePath}")
|
||||
// private String filePath;
|
||||
|
||||
/**
|
||||
* 保存系统日志,业务日志和其他日常日志
|
||||
* @param sysLog 日志对象
|
||||
*/
|
||||
@ApiOperation(value = "保存系统日志")
|
||||
@PostMapping("saveLogs")
|
||||
public AjaxResult saveLogs(@RequestBody SysLogsVo sysLog) {
|
||||
return service.saveLogs(sysLog);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存越权日志
|
||||
* @param sysLog
|
||||
* @param request
|
||||
*/
|
||||
@PostMapping("addLogs")
|
||||
public void addLogs(@RequestBody SysLogsVo sysLog,HttpServletRequest request) {
|
||||
service.saveLogs(sysLog,request);
|
||||
|
|
@ -84,7 +93,7 @@ public class SysLogController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "查询业务日志")
|
||||
@GetMapping("getYwLogs")
|
||||
@SysLog(title = "审计日志", module = "审计日志->业务日志", businessType = OperaType.QUERY, details = "查询业务日志列表", type = "系统日志")
|
||||
@SysLog(title = "审计日志", module = "审计日志->业务日志", businessType = OperaType.QUERY, details = "查询业务日志列表", type = "系统日志",logType = 0)
|
||||
public TableDataInfo getYwLogs(SysLogsVo dto) {
|
||||
try{
|
||||
dto.setLogType(1);
|
||||
|
|
@ -99,7 +108,7 @@ public class SysLogController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "查询异常日志")
|
||||
@GetMapping("getErrLogs")
|
||||
@SysLog(title = "审计日志", module = "审计日志->异常日志", businessType = OperaType.QUERY, details = "查询系统异常日志", type = "系统日志")
|
||||
@SysLog(title = "审计日志", module = "审计日志->异常日志", businessType = OperaType.QUERY ,logType = 0,details = "查询系统异常日志", type = "系统日志")
|
||||
public TableDataInfo getErrLogs(SysLogsVo dto) {
|
||||
try{
|
||||
dto.setLogType(2);
|
||||
|
|
@ -113,7 +122,7 @@ public class SysLogController extends BaseController {
|
|||
}
|
||||
@ApiOperation(value = "日志备份")
|
||||
@GetMapping("downloadErrLogs")
|
||||
@SysLog(title = "审计日志", module = "审计日志->异常日志", businessType = OperaType.COPY_LOG, details = "异常日志备份", type = "系统日志")
|
||||
@SysLog(title = "审计日志", module = "审计日志->异常日志", businessType = OperaType.COPY_LOG, logType = 0, details = "异常日志备份", type = "系统日志")
|
||||
public void downloadErrLogs(HttpServletRequest request, HttpServletResponse response) {
|
||||
// try {
|
||||
// String dateTimeNow=exportSqlService.export("2");
|
||||
|
|
@ -126,7 +135,7 @@ public class SysLogController extends BaseController {
|
|||
|
||||
@ApiOperation(value = "日志备份")
|
||||
@GetMapping("downloadYwLogs")
|
||||
@SysLog(title = "审计日志", module = "审计日志-->业务日志", businessType = OperaType.COPY_LOG, details = "业务日志备份", type = "系统日志")
|
||||
@SysLog(title = "审计日志", module = "审计日志-->业务日志", businessType = OperaType.COPY_LOG,logType = 0, details = "业务日志备份", type = "系统日志")
|
||||
public void downloadYwLogs(HttpServletRequest request, HttpServletResponse response) {
|
||||
// try {
|
||||
// String dateTimeNow=exportSqlService.export("1");
|
||||
|
|
|
|||
|
|
@ -56,14 +56,14 @@ public class SysLogininforController extends BaseController
|
|||
}
|
||||
|
||||
@RequiresPermissions("system:logininfor:remove")
|
||||
@DeleteMapping("/{infoIds}")
|
||||
@PostMapping("/delete/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:logininfor:remove")
|
||||
@DeleteMapping("/clean")
|
||||
@PostMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ public class SysMenuController extends BaseController
|
|||
* 修改菜单
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:menu:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "菜单管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->菜单管理")
|
||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu) {
|
||||
try{
|
||||
|
|
@ -157,7 +157,7 @@ public class SysMenuController extends BaseController
|
|||
* 删除菜单
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:menu:remove"))
|
||||
@DeleteMapping("/{menuId}")
|
||||
@PostMapping("/delete/{menuId}")
|
||||
@SysLog(title = "菜单管理", businessType = OperaType.DELETE,logType = 0,module = "系统管理->菜单管理")
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ public class SysNoticeController extends BaseController
|
|||
* 修改通知公告
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:notice:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "通知公告", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->通知公告")
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice) {
|
||||
try{
|
||||
|
|
@ -110,7 +110,7 @@ public class SysNoticeController extends BaseController
|
|||
* 删除通知公告
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:notice:remove"))
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
@PostMapping("/delete/{noticeIds}")
|
||||
@SysLog(title = "通知公告", businessType = OperaType.DELETE,logType = 0,module = "系统管理->通知公告")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -53,14 +53,14 @@ public class SysOperlogController extends BaseController
|
|||
}
|
||||
|
||||
@RequiresPermissions("system:operlog:remove")
|
||||
@DeleteMapping("/{operIds}")
|
||||
@PostMapping("/delete/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@RequiresPermissions("system:operlog:remove")
|
||||
@DeleteMapping("/clean")
|
||||
@PostMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ public class SysPostController extends BaseController {
|
|||
* 修改岗位
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:post:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "岗位管理", businessType = OperaType.UPDATE, logType = 0, module = "系统管理->岗位管理")
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post) {
|
||||
try {
|
||||
|
|
@ -130,7 +130,7 @@ public class SysPostController extends BaseController {
|
|||
* 删除岗位
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:post:remove"))
|
||||
@DeleteMapping("/{postIds}")
|
||||
@PostMapping("/delete/{postIds}")
|
||||
@SysLog(title = "岗位管理", businessType = OperaType.DELETE, logType = 0, module = "系统管理->岗位管理")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ public class SysProfileController extends BaseController {
|
|||
/**
|
||||
* 修改当前登录用户的个人信息
|
||||
*/
|
||||
@PutMapping
|
||||
@SysLog(title = "个人中心", businessType = OperaType.UPDATE, logType = 0, module = "首页->个人中心")
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user) {
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "个人中心", businessType = OperaType.UPDATE, logType = 0, module = "首页->个人中心")
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user) {
|
||||
try {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
SysUser currentUser = loginUser.getSysUser();
|
||||
|
|
@ -97,7 +97,7 @@ public class SysProfileController extends BaseController {
|
|||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@PutMapping("/updatePwd")
|
||||
@PostMapping("/updatePwd")
|
||||
@SysLog(title = "个人中心", businessType = OperaType.UPDATE, logType = 0, module = "首页->个人中心", details = "修改密码")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ public class SysRoleController extends BaseController
|
|||
* 修改保存角色
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "角色管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->角色管理",details = "修改角色")
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role) {
|
||||
try{
|
||||
|
|
@ -143,7 +143,7 @@ public class SysRoleController extends BaseController
|
|||
* 修改保存数据权限
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:edit"))
|
||||
@PutMapping("/dataScope")
|
||||
@PostMapping("/dataScope/edit")
|
||||
@SysLog(title = "角色管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->角色管理",details = "修改权限")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role) {
|
||||
try{
|
||||
|
|
@ -160,7 +160,7 @@ public class SysRoleController extends BaseController
|
|||
* 状态修改
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:edit"))
|
||||
@PutMapping("/changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
@SysLog(title = "角色管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->角色管理",details = "修改角色状态")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role) {
|
||||
try{
|
||||
|
|
@ -180,7 +180,7 @@ public class SysRoleController extends BaseController
|
|||
* 删除角色
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:remove"))
|
||||
@DeleteMapping("/{roleIds}")
|
||||
@PostMapping("/delete/{roleIds}")
|
||||
@SysLog(title = "角色管理", businessType = OperaType.DELETE,logType = 0,module = "系统管理->角色管理",details = "删除角色信息")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds) {
|
||||
try{
|
||||
|
|
@ -246,7 +246,7 @@ public class SysRoleController extends BaseController
|
|||
* 取消授权用户
|
||||
*/
|
||||
@RequiresPermissions("system:role:edit")
|
||||
@PutMapping("/authUser/cancel")
|
||||
@PostMapping("/authUser/cancel")
|
||||
@SysLog(title = "角色管理", businessType = OperaType.UPDATE,logType = 0,module = "系统管理->角色管理->分配用户",details = "取消授权用户")
|
||||
public AjaxResult cancelAuthUser(@RequestBody SysUserRole userRole) {
|
||||
try{
|
||||
|
|
@ -262,7 +262,7 @@ public class SysRoleController extends BaseController
|
|||
* 批量取消授权用户
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:edit"))
|
||||
@PutMapping("/authUser/cancelAll")
|
||||
@PostMapping("/authUser/cancelAll")
|
||||
@SysLog(title = "角色管理", businessType = OperaType.GRANT,logType = 0,module = "系统管理->角色管理->分配用户",details = "取消授权用户")
|
||||
public AjaxResult cancelAuthUserAll(Long roleId, Long[] userIds) {
|
||||
try{
|
||||
|
|
@ -278,7 +278,7 @@ public class SysRoleController extends BaseController
|
|||
* 批量选择用户授权
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:role:edit"))
|
||||
@PutMapping("/authUser/selectAll")
|
||||
@PostMapping("/authUser/selectAll")
|
||||
@SysLog(title = "角色管理", businessType = OperaType.GRANT,logType = 0,module = "系统管理->角色管理->分配用户",details = "授权用户")
|
||||
public AjaxResult selectAuthUserAll(Long roleId, Long[] userIds) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ public class SysUserController extends BaseController {
|
|||
* 修改用户
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:edit"))
|
||||
@PutMapping
|
||||
@PostMapping("/edit")
|
||||
@SysLog(title = "用户管理", businessType = OperaType.UPDATE, logType = 0, module = "系统管理->用户管理", details = "修改用户信息")
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user) {
|
||||
try {
|
||||
|
|
@ -341,7 +341,7 @@ public class SysUserController extends BaseController {
|
|||
* 删除用户
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:remove"))
|
||||
@DeleteMapping("/{userIds}")
|
||||
@PostMapping("/delete/{userIds}")
|
||||
@SysLog(title = "用户管理", businessType = OperaType.DELETE, logType = 0, module = "系统管理->用户管理", details = "删除用户信息")
|
||||
public AjaxResult remove(@PathVariable("userIds") Long[] userIds) {
|
||||
try {
|
||||
|
|
@ -359,7 +359,7 @@ public class SysUserController extends BaseController {
|
|||
* 重置密码
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:edit"))
|
||||
@PutMapping("/resetPwd")
|
||||
@PostMapping("/resetPwd")
|
||||
@SysLog(title = "用户管理", businessType = OperaType.UPDATE, logType = 0, module = "系统管理->用户管理", details = "重置用户密码")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user) {
|
||||
try {
|
||||
|
|
@ -389,7 +389,7 @@ public class SysUserController extends BaseController {
|
|||
* 状态修改
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:edit"))
|
||||
@PutMapping("/changeStatus")
|
||||
@PostMapping("/changeStatus")
|
||||
@SysLog(title = "用户管理", businessType = OperaType.UPDATE, logType = 0, module = "系统管理->用户管理", details = "修改用户状态")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user) {
|
||||
try {
|
||||
|
|
@ -426,7 +426,7 @@ public class SysUserController extends BaseController {
|
|||
* 用户授权角色
|
||||
*/
|
||||
@RequiresPermissionsOrInnerAuth(innerAuth = @InnerAuth, requiresPermissions = @RequiresPermissions("system:user:edit"))
|
||||
@PutMapping("/authRole")
|
||||
@PostMapping("/authRole/edit")
|
||||
@SysLog(title = "用户管理", businessType = OperaType.GRANT, logType = 0, module = "系统管理->用户管理", details = "用户授权角色")
|
||||
public AjaxResult insertAuthRole(Long userId, Long[] roleIds) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -8,11 +8,7 @@ import java.util.List;
|
|||
import com.bonus.common.log.annotation.SysLog;
|
||||
import com.bonus.common.log.enums.OperaType;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.bonus.common.core.constant.CacheConstants;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
|
|
@ -72,7 +68,7 @@ public class SysUserOnlineController extends BaseController
|
|||
* 强退用户
|
||||
*/
|
||||
@RequiresPermissions("monitor:online:forceLogout")
|
||||
@DeleteMapping("/{tokenId}")
|
||||
@PostMapping("/delete/{tokenId}")
|
||||
@SysLog(title = "在线用户", businessType = OperaType.UPDATE,logType = 0,module = "系统监控->在线用户",details = "在线用户退出")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId) {
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.system.interceptor;
|
||||
|
||||
import com.bonus.common.core.utils.encryption.Sm4Utils;
|
||||
import com.bonus.system.api.domain.SysDept;
|
||||
import com.bonus.system.api.domain.SysUser;
|
||||
import org.apache.ibatis.executor.parameter.ParameterHandler;
|
||||
import org.apache.ibatis.executor.resultset.ResultSetHandler;
|
||||
|
|
@ -17,7 +18,7 @@ import java.util.Properties;
|
|||
import java.sql.Statement;
|
||||
/**
|
||||
* mybatis 拦截器
|
||||
* 对用户邮箱和电话号码进行加密存库,并从库里查询后解密
|
||||
* 对用户和部门实体里的邮箱和电话号码进行加密存库,并从库里查询后解密
|
||||
* @author weiweiwang
|
||||
*/
|
||||
@Intercepts({
|
||||
|
|
@ -26,6 +27,8 @@ import java.sql.Statement;
|
|||
})
|
||||
public class DataEnDecryptInterceptor implements Interceptor {
|
||||
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
final static String USER_MAPPER_ID = "com.bonus.system.mapper.SysUserMapper";
|
||||
final static String DEPT_MAPPER_ID = "com.bonus.system.mapper.SysDeptMapper";
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
try {
|
||||
|
|
@ -36,10 +39,12 @@ public class DataEnDecryptInterceptor implements Interceptor {
|
|||
PreparedStatement preparedStatement = (PreparedStatement) invocation.getArgs()[0];
|
||||
Object parameterObject = parameterHandler.getParameterObject();
|
||||
String sqlId = mappedStatement.getId();
|
||||
if (!sqlId.contains("com.bonus.system.mapper.SysUserMapper"))
|
||||
return invocation.proceed();
|
||||
|
||||
encryptObject (parameterObject);
|
||||
if (sqlId.contains(USER_MAPPER_ID)){
|
||||
encryptUserObject(parameterObject);
|
||||
} else if (sqlId.contains(DEPT_MAPPER_ID)){
|
||||
encryptDeptObject(parameterObject);
|
||||
}
|
||||
return invocation.proceed();
|
||||
|
||||
} else if (invocation.getTarget() instanceof ResultSetHandler) {
|
||||
// Handle decryption after result set is obtained
|
||||
|
|
@ -49,10 +54,12 @@ public class DataEnDecryptInterceptor implements Interceptor {
|
|||
Object result = invocation.proceed();
|
||||
|
||||
String sqlId = mappedStatement.getId();
|
||||
if (!sqlId.contains("com.bonus.system.mapper.SysUserMapper"))
|
||||
return result;
|
||||
|
||||
decryObject (result);
|
||||
if (sqlId.contains(USER_MAPPER_ID))
|
||||
{
|
||||
decryUserObject(result);
|
||||
} else if (sqlId.contains(DEPT_MAPPER_ID)){
|
||||
decryDeptObject(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -73,7 +80,7 @@ public class DataEnDecryptInterceptor implements Interceptor {
|
|||
public void setProperties(Properties properties) {
|
||||
}
|
||||
|
||||
private void encryptObject(Object parameterObject){
|
||||
private void encryptUserObject(Object parameterObject){
|
||||
if (parameterObject instanceof SysUser) {
|
||||
SysUser user = (SysUser) parameterObject;
|
||||
// 加密敏感字段
|
||||
|
|
@ -86,7 +93,21 @@ public class DataEnDecryptInterceptor implements Interceptor {
|
|||
}
|
||||
}
|
||||
|
||||
private void decryObject(Object result){
|
||||
private void encryptDeptObject(Object parameterObject) {
|
||||
if (parameterObject instanceof SysDept) {
|
||||
SysDept dept = (SysDept) parameterObject;
|
||||
// 加密敏感字段
|
||||
if (dept.getEmail() != null) {
|
||||
dept.setEmail(Sm4Utils.encrypt(dept.getEmail()));
|
||||
}
|
||||
if (dept.getPhone() != null) {
|
||||
dept.setPhone(Sm4Utils.encrypt(dept.getPhone()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void decryUserObject(Object result){
|
||||
try {
|
||||
if (result instanceof ArrayList) {
|
||||
List<?> list = (List<?>) result;
|
||||
|
|
@ -110,6 +131,31 @@ public class DataEnDecryptInterceptor implements Interceptor {
|
|||
}
|
||||
}
|
||||
|
||||
private void decryDeptObject(Object result){
|
||||
try {
|
||||
if (result instanceof ArrayList) {
|
||||
List<?> list = (List<?>) result;
|
||||
for (Object obj : list) {
|
||||
if (obj instanceof SysDept) {
|
||||
decryptDept ((SysDept) obj);
|
||||
}
|
||||
}
|
||||
} else if (result instanceof SysDept) {
|
||||
decryptDept ((SysDept) result);
|
||||
}
|
||||
} catch (Exception ingore) {
|
||||
}
|
||||
}
|
||||
|
||||
private void decryptDept(SysDept dept) {
|
||||
if (dept.getEmail() != null) {
|
||||
dept.setEmail(Sm4Utils.decrypt(dept.getEmail()));
|
||||
}
|
||||
if (dept.getPhone() != null) {
|
||||
dept.setPhone(Sm4Utils.decrypt(dept.getPhone()));
|
||||
}
|
||||
}
|
||||
|
||||
private MappedStatement getMappedStatement(ParameterHandler parameterHandler) {
|
||||
try {
|
||||
// Use reflection to access the private field `mappedStatement` (or appropriate field)
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ create table sys_dept (
|
|||
dept_name varchar(30) default '' comment '部门名称',
|
||||
order_num int(4) default 0 comment '显示顺序',
|
||||
leader varchar(20) default null comment '负责人',
|
||||
phone varchar(11) default null comment '联系电话',
|
||||
email varchar(50) default null comment '邮箱',
|
||||
phone varchar(255) default null comment '联系电话',
|
||||
email varchar(255) default null comment '邮箱',
|
||||
status char(1) default '0' comment '部门状态(0正常 1停用)',
|
||||
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
|
|
@ -71,8 +71,8 @@ create table sys_user (
|
|||
-- ----------------------------
|
||||
-- 初始化-用户信息表数据
|
||||
-- ----------------------------
|
||||
insert into sys_user values(1, 103, 'bonus', '博诺思', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null,sysdate(), '系统管理员','0','1','1');
|
||||
insert into sys_user values(2, 103, 'audit', '博诺思', '00', 'ry@163.com', '15888888889', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null,sysdate(),'审计管理员','0','1','1');
|
||||
insert into sys_user values(1, 103, 'bonus', '博诺思', '00', '38fb2b6be1e8b9024b0140fc673f0ed245b6b82ae6464387bbe806dc68e66fa8', '4eb762402e0ce5ef9d0028e2d622c53bc8ea1d7680ea4416975e4cc23b4ef7f0', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null,sysdate(), '系统管理员','0','1','1');
|
||||
insert into sys_user values(2, 103, 'audit', '博诺思', '00', '38fb2b6be1e8b9024b0140fc673f0ed245b6b82ae6464387bbe806dc68e66fa8', '4eb762402e0ce5ef9d0028e2d622c53bc8ea1d7680ea4416975e4cc23b4ef7f0', '1', '', '$2a$10$5azz92OgGRyRUETz/ZJeZu1exkggPYUDRssvreywTjKk.0Pmn2Q16', '0', '0', '127.0.0.1', sysdate(), 'admin', sysdate(), '', null,sysdate(),'审计管理员','0','1','1');
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
|
|
|
|||
Loading…
Reference in New Issue