Commit 2e4248d8d91ac335ce5017bcdad1eca52353c86f

Authored by 黄 x
1 parent a6c70e60

fix: fix job and jobLog add checkPermissions. fix generate records bug

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