Merge pull request #10482 from dataease/pr@dev@fixExportdata

fix: 修复存在未完成的视图导出 Excel 任务会导致de 无法启动
This commit is contained in:
taojinlong 2024-06-25 10:15:26 +08:00 committed by GitHub
commit e69e0322cd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@ package io.dataease.service.exportCenter;
import com.google.gson.Gson;
import io.dataease.auth.api.dto.CurrentUserDto;
import io.dataease.auth.service.AuthUserService;
import io.dataease.auth.service.ProxyAuthService;
import io.dataease.commons.constants.ParamConstants;
import io.dataease.commons.constants.SysLogConstants;
import io.dataease.commons.utils.*;
@ -126,7 +127,7 @@ public class ExportCenterService {
private int keepAliveSeconds = 600;
private Map<String, Future> Running_Task = new HashMap<>();
@Resource
private AuthUserService authUserService;
private ProxyAuthService proxyAuthService;
@Autowired
private WsService wsService;
@ -399,9 +400,9 @@ public class ExportCenterService {
String dataPath = exportData_path + exportTask.getId();
File directory = new File(dataPath);
boolean isCreated = directory.mkdir();
CurrentUserDto currentUserDto = (CurrentUserDto) authUserService.getUserById(exportTask.getUserId());
CurrentUserDto user = proxyAuthService.queryCacheUserDto(exportTask.getUserId());
Future future = scheduledThreadPoolExecutor.submit(() -> {
AuthUtils.setUser(currentUserDto);
AuthUtils.setUser(user);
try {
exportTask.setExportStatus("IN_PROGRESS");
exportTaskMapper.updateByPrimaryKey(exportTask);
@ -555,7 +556,7 @@ public class ExportCenterService {
}
wb.close();
if (ObjectUtils.isNotEmpty(currentUserDto)) {
if (ObjectUtils.isNotEmpty(user)) {
String viewId = request.getViewId();
ChartViewWithBLOBs chartViewWithBLOBs = chartViewService.get(viewId);
String pid = chartViewWithBLOBs.getSceneId();
@ -598,7 +599,8 @@ public class ExportCenterService {
String dataPath = exportData_path + exportTask.getId();
File directory = new File(dataPath);
boolean isCreated = directory.mkdir();
CurrentUserDto user = (CurrentUserDto) authUserService.getUserById(exportTask.getUserId());
CurrentUserDto user = proxyAuthService.queryCacheUserDto(exportTask.getUserId());
Future future = scheduledThreadPoolExecutor.submit(() -> {
AuthUtils.setUser(user);
try {