use of com.jun.plugin.system.common.aop.annotation.LogAnnotation in project jun_springboot_api_service by wujun728.
the class DeptController method getDeptAll.
@GetMapping("/depts")
@ApiOperation(value = "获取机构列表接口")
@LogAnnotation(title = "机构管理", action = "获取所有组织机构")
@RequiresPermissions("sys:dept:list")
public DataResult getDeptAll() {
List<SysDept> deptList = deptService.list();
deptList.parallelStream().forEach(entity -> {
SysDept parentDept = deptService.getById(entity.getPid());
if (parentDept != null) {
entity.setPidName(parentDept.getName());
}
});
return DataResult.success(deptList);
}
use of com.jun.plugin.system.common.aop.annotation.LogAnnotation in project jun_springboot_api_service by wujun728.
the class SysJobController method update.
@ApiOperation(value = "更新")
@PutMapping("/update")
@RequiresPermissions("sysJob:update")
@LogAnnotation(title = "更新")
public DataResult update(@RequestBody SysJobEntity sysJob) {
if (isValidExpression(sysJob.getCronExpression())) {
return DataResult.fail("cron表达式有误");
}
DataResult dataResult = ScheduleJob.judgeBean(sysJob.getBeanName());
if (BaseResponseCode.SUCCESS.getCode() != dataResult.getCode()) {
return dataResult;
}
sysJobService.updateJobById(sysJob);
return DataResult.success();
}
use of com.jun.plugin.system.common.aop.annotation.LogAnnotation in project jun_springboot_api_service by wujun728.
the class SysJobController method getRecentTriggerTime.
@ApiOperation(value = "获取运行时间")
@LogAnnotation(title = "获取运行时间")
@PostMapping("/getRecentTriggerTime")
@RequiresPermissions("sysJob:add")
public DataResult getRecentTriggerTime(String cron) {
List<String> list = new ArrayList<>();
try {
CronTriggerImpl cronTriggerImpl = new CronTriggerImpl();
cronTriggerImpl.setCronExpression(cron);
// 这个是重点,一行代码搞定
List<Date> dates = TriggerUtils.computeFireTimes(cronTriggerImpl, null, 5);
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
for (Date date : dates) {
list.add(dateFormat.format(date));
}
} catch (ParseException e) {
e.printStackTrace();
}
return DataResult.success(list);
}
use of com.jun.plugin.system.common.aop.annotation.LogAnnotation in project jun_springboot_api_service by wujun728.
the class UserController method setUserOwnRole.
@PutMapping("/user/roles/{userId}")
@ApiOperation(value = "赋予角色-用户赋予角色接口")
@LogAnnotation(title = "用户管理", action = "赋予角色-用户赋予角色接口")
@RequiresPermissions("sys:user:update:role")
public DataResult setUserOwnRole(@PathVariable("userId") String userId, @RequestBody List<String> roleIds) {
LambdaQueryWrapper<SysUserRole> queryWrapper = Wrappers.lambdaQuery();
queryWrapper.eq(SysUserRole::getUserId, userId);
userRoleService.remove(queryWrapper);
if (!CollectionUtils.isEmpty(roleIds)) {
UserRoleOperationReqVO reqVO = new UserRoleOperationReqVO();
reqVO.setUserId(userId);
reqVO.setRoleIds(roleIds);
userRoleService.addUserRoleInfo(reqVO);
}
// 刷新权限
httpSessionService.refreshUerId(userId);
return DataResult.success();
}
use of com.jun.plugin.system.common.aop.annotation.LogAnnotation in project jun_springboot_api_service by wujun728.
the class UserController method getUserOwnRole.
@GetMapping("/user/roles/{userId}")
@ApiOperation(value = "赋予角色-获取所有角色接口")
@LogAnnotation(title = "用户管理", action = "赋予角色-获取所有角色接口")
@RequiresPermissions("sys:user:role:detail")
public DataResult getUserOwnRole(@PathVariable("userId") String userId) {
DataResult result = DataResult.success();
result.setData(userService.getUserOwnRole(userId));
return result;
}
Aggregations