Commit 2e4248d8d91ac335ce5017bcdad1eca52353c86f
1 parent
a6c70e60
fix: fix job and jobLog add checkPermissions. fix generate records bug
Showing
3 changed files
with
5 additions
and
1 deletions
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation; | @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation; | ||
5 | import lombok.RequiredArgsConstructor; | 5 | import lombok.RequiredArgsConstructor; |
6 | import org.apache.commons.lang3.StringUtils; | 6 | import org.apache.commons.lang3.StringUtils; |
7 | import org.quartz.SchedulerException; | 7 | import org.quartz.SchedulerException; |
8 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
8 | import org.springframework.validation.annotation.Validated; | 9 | import org.springframework.validation.annotation.Validated; |
9 | import org.springframework.web.bind.annotation.*; | 10 | import org.springframework.web.bind.annotation.*; |
10 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 11 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
@@ -34,6 +35,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -34,6 +35,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
34 | @RequestMapping("api/yt/monitor/job") | 35 | @RequestMapping("api/yt/monitor/job") |
35 | @RequiredArgsConstructor | 36 | @RequiredArgsConstructor |
36 | @Api(tags = {"定时任务"}) | 37 | @Api(tags = {"定时任务"}) |
38 | +@PreAuthorize("@check.checkPermissions({'SYS_ADMIN','PLATFORM_ADMIN'},{})") | ||
37 | public class SysJobController extends BaseController { | 39 | public class SysJobController extends BaseController { |
38 | private final YtSysJobService jobService; | 40 | private final YtSysJobService jobService; |
39 | 41 |
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation; | @@ -5,6 +5,7 @@ import io.swagger.annotations.ApiOperation; | ||
5 | import lombok.RequiredArgsConstructor; | 5 | import lombok.RequiredArgsConstructor; |
6 | import org.apache.commons.lang3.StringUtils; | 6 | import org.apache.commons.lang3.StringUtils; |
7 | import org.quartz.SchedulerException; | 7 | import org.quartz.SchedulerException; |
8 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
8 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
9 | import org.thingsboard.server.common.data.exception.ThingsboardException; | 10 | import org.thingsboard.server.common.data.exception.ThingsboardException; |
10 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; | 11 | import org.thingsboard.server.common.data.yunteng.dto.DeleteDTO; |
@@ -28,6 +29,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | @@ -28,6 +29,7 @@ import static org.thingsboard.server.common.data.yunteng.constant.QueryConstant. | ||
28 | @RequestMapping("api/yt/monitor/job_log") | 29 | @RequestMapping("api/yt/monitor/job_log") |
29 | @RequiredArgsConstructor | 30 | @RequiredArgsConstructor |
30 | @Api(tags = {"定时任务执行日志"}) | 31 | @Api(tags = {"定时任务执行日志"}) |
32 | +@PreAuthorize("@check.checkPermissions({'SYS_ADMIN','PLATFORM_ADMIN'},{})") | ||
31 | public class SysJobLogController extends BaseController { | 33 | public class SysJobLogController extends BaseController { |
32 | 34 | ||
33 | private final YtSysJobLogService ytSysJobLogService; | 35 | private final YtSysJobLogService ytSysJobLogService; |
@@ -115,7 +115,7 @@ public class YtReportGenerateRecordServiceImpl | @@ -115,7 +115,7 @@ public class YtReportGenerateRecordServiceImpl | ||
115 | } else { | 115 | } else { |
116 | ReportGenerateRecord record = baseMapper.selectById(recordDTO.getId()); | 116 | ReportGenerateRecord record = baseMapper.selectById(recordDTO.getId()); |
117 | Optional.ofNullable(record) | 117 | Optional.ofNullable(record) |
118 | - .map(obj -> baseMapper.updateById(obj)) | 118 | + .map(obj -> baseMapper.updateById(recordDTO.getEntity(ReportGenerateRecord.class))) |
119 | .orElseThrow( | 119 | .orElseThrow( |
120 | () -> { | 120 | () -> { |
121 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); | 121 | throw new YtDataValidationException(ErrorMessage.INVALID_PARAMETER.getMessage()); |