fix(定时报告): 立即执行停止状态的任务报错

This commit is contained in:
fit2cloud-chenyw 2023-05-15 15:45:13 +08:00
parent 104512688d
commit 5cfbbdf1e4

View File

@ -18,6 +18,7 @@ import io.dataease.plugins.common.entity.XpackConditionEntity;
import io.dataease.plugins.common.entity.XpackGridRequest;
import io.dataease.plugins.config.SpringContextUtil;
import io.dataease.plugins.xpack.email.dto.request.*;
import io.dataease.plugins.xpack.email.dto.response.XpackTaskEntity;
import io.dataease.plugins.xpack.email.dto.response.XpackTaskGridDTO;
import io.dataease.plugins.xpack.email.dto.response.XpackTaskInstanceDTO;
import io.dataease.plugins.xpack.email.service.EmailXpackService;
@ -35,6 +36,9 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.util.HtmlUtils;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.ArrayList;
@ -43,10 +47,6 @@ import java.util.List;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
@ApiIgnore
@RequestMapping("/plugin/task")
@RestController
@ -108,8 +108,8 @@ public class XEmailTaskServer {
@PostMapping("/fireNow/{taskId}")
public void fireNow(@PathVariable("taskId") Long taskId) throws Exception {
EmailXpackService emailXpackService = SpringContextUtil.getBean(EmailXpackService.class);
XpackEmailTaskRequest request = emailXpackService.taskForm(taskId);
GlobalTaskEntity globalTaskEntity = BeanUtils.copyBean(new GlobalTaskEntity(), request);
XpackTaskEntity xpackTaskEntity = emailXpackService.taskDetail(taskId);
GlobalTaskEntity globalTaskEntity = BeanUtils.copyBean(new GlobalTaskEntity(), xpackTaskEntity);
Boolean invalid = false;
if (CronUtils.taskExpire(globalTaskEntity.getEndTime())) {
globalTaskEntity.setEndTime(null);