|
@@ -8,7 +8,6 @@ import com.example.opc_common.util.ConstantStr;
|
|
|
import com.example.opc_common.util.Result;
|
|
|
import com.example.opc_da.dao.DictDao;
|
|
|
import com.example.opc_da.dao.ReportTableDao;
|
|
|
-import com.example.opc_da.dao.UserGroupDao;
|
|
|
import com.example.opc_da.dynamicSchedule.CronTaskRegister;
|
|
|
import com.example.opc_da.dynamicSchedule.SchedulingRunnable;
|
|
|
import com.example.opc_da.service.ReportTableService;
|
|
@@ -92,7 +91,11 @@ public class ReportTableServiceImpl implements ReportTableService {
|
|
|
String userId = userUtil.getCurrentUserId();
|
|
|
ReportTable isExistReportTable = reportTableDao.getReportTableByName(userId, reportTable.getReportTableName());
|
|
|
reportTable.setUserId(userId);
|
|
|
- reportTable.setIsAutoReport(ConstantStr.MANUAL_REPORT);
|
|
|
+ if (!reportTable.getIsAutoReport().equals(ConstantStr.MANUAL_REPORT) &&
|
|
|
+ !reportTable.getIsAutoReport().equals(ConstantStr.AUTOMATIC_REPORT) &&
|
|
|
+ !reportTable.getIsAutoReport().equals(ConstantStr.EVENT_DRIVEN_REPORT)) {
|
|
|
+ return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表类型不正确,请选择其他报表类型");
|
|
|
+ }
|
|
|
reportTable.setVersion(ConstantStr.DEFAULT_VERSION);
|
|
|
if (Blank.isNotEmpty(isExistReportTable)) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "已经存在此名称的报表了,请更改名称");
|
|
@@ -196,9 +199,9 @@ public class ReportTableServiceImpl implements ReportTableService {
|
|
|
}
|
|
|
cronTaskRegister.addCronTask(task, cronId, cron);
|
|
|
return Result.ok(reportTableDao.tableExchangeAutoById(id, isAutoReport, cronId, cron));
|
|
|
- } else if (isAutoReport == ConstantStr.MANUAL_REPORT) {
|
|
|
- if (Blank.isEmpty(reportTable, reportTable.getCronId())) {
|
|
|
- return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表不存在,或相应的定时器已被移除");
|
|
|
+ } else if (isAutoReport == ConstantStr.MANUAL_REPORT || isAutoReport == ConstantStr.EVENT_DRIVEN_REPORT) {
|
|
|
+ if (Blank.isEmpty(reportTable)) {
|
|
|
+ return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "报表不存在");
|
|
|
}
|
|
|
if (Blank.isEmpty(reportTable.getIsAutoReport())) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "未知报表类型,请刷新重试");
|
|
@@ -206,6 +209,9 @@ public class ReportTableServiceImpl implements ReportTableService {
|
|
|
if (reportTable.getIsAutoReport() == ConstantStr.MANUAL_REPORT) {
|
|
|
return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "此报表已经是手动报表了");
|
|
|
}
|
|
|
+ if (reportTable.getIsAutoReport() == ConstantStr.EVENT_DRIVEN_REPORT) {
|
|
|
+ return Result.no(ResultEnum.REQUEST_WRONGPARAMS.getRespCode(), "此报表已经是事件驱动报表了");
|
|
|
+ }
|
|
|
//移除相应的定时器
|
|
|
cronTaskRegister.removeCronTask(reportTable.getCronId());
|
|
|
return Result.ok(reportTableDao.tableExchangeTypeById(id, isAutoReport));
|