Merge branch 'main' of http://www.carsafe-caem.com/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -48,22 +48,23 @@ public class DataStorageAnalysisController {
|
||||
@Parameter(description = "查询时间间隔(月)") @RequestParam(value = "intervalMonths", required = false) Integer intervalMonths,
|
||||
@Parameter(description = "增量查询指定的月:2025-06") @RequestParam(value = "targetYm", required = false) String targetYm
|
||||
) {
|
||||
try {
|
||||
if (ObjectUtils.isEmpty(queryNodeType) || ObjectUtils.isEmpty(uuids)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
List<List<JSONObject>> result = new ArrayList<>();
|
||||
for (String uuid : uuids) {
|
||||
|
||||
if (ObjectUtils.isEmpty(queryNodeType) || ObjectUtils.isEmpty(uuids)) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
List<List<JSONObject>> result = new ArrayList<>();
|
||||
for (String uuid : uuids) {
|
||||
try {
|
||||
SdmResponse<List<JSONObject>> sdmResponse = dataStorageAnalysis.getNodeSizeByNodeType(queryNodeType, uuid, intervalMonths, targetYm);
|
||||
if (sdmResponse.getData() != null) {
|
||||
result.add(sdmResponse.getData());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取文件空间占用失败", e);
|
||||
}
|
||||
return SdmResponse.success(result);
|
||||
} catch (Exception e) {
|
||||
log.error("获取文件空间占用失败", e);
|
||||
return SdmResponse.failed("获取文件空间占用失败");
|
||||
}
|
||||
return SdmResponse.success(result);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -69,7 +69,8 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> response = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(uuid, queryNodeType);
|
||||
Long tenantId = ThreadLocalContext.getTenantId();
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("获取节点信息失败");
|
||||
log.error("获取节点信息失败");
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
List<AllNodeByProjectIdAndTypeResp> nodeLists = response.getData();
|
||||
@@ -92,7 +93,8 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
.eq(FileMetadataInfo::getTenantId, tenantId)
|
||||
.list().stream().collect(Collectors.toMap(FileMetadataInfo::getRelatedResourceUuid, FileMetadataInfo::getId));
|
||||
if (CollectionUtils.isEmpty(uuidToDirIdMap)) {
|
||||
return SdmResponse.failed("获取节点信息失败");
|
||||
log.error("获取节点信息失败");
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
// fileMetadIds: uuid对应的fileid结合
|
||||
@@ -136,8 +138,6 @@ public class DataStorageAnalysisImpl implements DataStorageAnalysis {
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
return SdmResponse.success(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -1011,6 +1011,7 @@ package com.sdm.flowable.delegate.handler;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.flowable.executeConfig.ExportWordScriptExecuteConfig;
|
||||
import com.sdm.common.entity.req.data.GetFileBaseInfoReq;
|
||||
import com.sdm.common.entity.req.data.UploadFilesReq;
|
||||
@@ -1070,8 +1071,14 @@ public class ExportWordScriptHandler implements ExecutionHandler<Map<String, Obj
|
||||
|
||||
// 获取当前流程实例参数
|
||||
String runId = (String) execution.getVariable("runId");
|
||||
Long userId = (Long) execution.getVariable("userId");
|
||||
String userName = (String) execution.getVariable("userName");
|
||||
Long tenantId = (Long) execution.getVariable("tenantId");
|
||||
ThreadLocalContext.setUserId(userId);
|
||||
ThreadLocalContext.setUserName(userName);
|
||||
ThreadLocalContext.setTenantId(tenantId);
|
||||
String processDefinitionId = execution.getProcessDefinitionId();
|
||||
log.info("ExportWordScriptHandler 开始执行 runId:{},processDefinitionId:{}, beforeNodeId:{}, currentNodeId:{},fileRegularStr:{}", runId,processDefinitionId, beforeNodeId, currentNodeId,fileRegularStr);
|
||||
log.info("ExportWordScriptHandler 开始执行 runId:{},userId:{},userName:{},tenantId:{},processDefinitionId:{}, beforeNodeId:{}, currentNodeId:{},fileRegularStr:{}", runId,userId,userName,tenantId,processDefinitionId, beforeNodeId, currentNodeId,fileRegularStr);
|
||||
|
||||
ProjecInfoReq projecInfoReq = buildprojectInfoReq(params);
|
||||
log.info("ExportWordScriptHandler的请求参数 projectInfoReq:{}", projecInfoReq);
|
||||
@@ -1196,7 +1203,11 @@ public class ExportWordScriptHandler implements ExecutionHandler<Map<String, Obj
|
||||
log.info("上传文件参数:{}", req);
|
||||
// 调用上传文件的方法
|
||||
// 注意:这里应该处理返回值
|
||||
dataFeignClient.uploadFiles(req);
|
||||
SdmResponse sdmResponse = dataFeignClient.uploadFiles(req);
|
||||
if (!sdmResponse.isSuccess()) {
|
||||
log.error("上传文件失败: {}", sdmResponse.getMessage());
|
||||
throw new RuntimeException("上传文件失败:");
|
||||
}
|
||||
log.info("结果文件已上传到MinIO: {}", resultFilePath);
|
||||
} catch (Exception e) {
|
||||
log.error("上传结果文件到MinIO失败: {}", resultFilePath, e);
|
||||
|
||||
@@ -97,6 +97,11 @@ public class YAModelController {
|
||||
int fileId = (int)data.get("fileId");
|
||||
rsp.getWorkRequest().add(String.valueOf(fileId));
|
||||
}
|
||||
else
|
||||
{
|
||||
rsp.setCode("-200");
|
||||
rsp.setMessage(uploadRespond.getMessage());
|
||||
}
|
||||
return rsp;
|
||||
}
|
||||
|
||||
@@ -138,6 +143,11 @@ public class YAModelController {
|
||||
int fileId = (int)data.get("fileId");
|
||||
rsp.getWorkRequest().add(String.valueOf(fileId));
|
||||
}
|
||||
else
|
||||
{
|
||||
rsp.setCode("-200");
|
||||
rsp.setMessage(uploadRespond.getMessage());
|
||||
}
|
||||
return rsp;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import org.springframework.stereotype.Service;
|
||||
@Slf4j
|
||||
public class SimulationExternalServiceImpl implements ISimulationExternalService {
|
||||
|
||||
@Value("${thirdparty.api.freeLinkUrl}")
|
||||
@Value("${thirdparty.api.freeLinkUrl:}")
|
||||
private String freeLinkUrl;
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -245,7 +245,7 @@ public interface SimulationPoolMapper {
|
||||
@Select("SELECT * FROM simulation_taskpool_flowtemplate_relate WHERE poolName=#{poolName}")
|
||||
List<SimulatePoolTaskFlowTemplateRelate> queryTaskFlowRelateByTaskPool(@Param("poolName") String poolName);
|
||||
|
||||
@Insert("INSERT INTO simulation_taskpool_flowtemplate_relate(poolName,flowCode,taskUuid,`version`) SELECT poolName,flowCode,taskUuid,${newVersion} WHERE poolName=#{poolName} AND `version`=#{oldVersion}")
|
||||
@Insert("INSERT INTO simulation_taskpool_flowtemplate_relate(poolName,flowCode,taskUuid,`version`) SELECT poolName,flowCode,taskUuid,${newVersion} FROM simulation_taskpool_flowtemplate_relate WHERE poolName=#{poolName} AND `version`=#{oldVersion}")
|
||||
int copyTaskRelateToNewVersion(@Param("poolName")String poolName,@Param("oldVersion")String oldVersion,@Param("newVersion")String newVersion);
|
||||
|
||||
@Select("SELECT * FROM simulation_taskpool_flowtemplate_relate WHERE poolName=#{poolName} AND version=#{version}")
|
||||
|
||||
@@ -37,6 +37,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@@ -124,6 +125,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
*/
|
||||
private void addTaskRelationCheckRepeat(String poolName,String version,List<TaskPoolItem> taskPoolItemList,int poolId)
|
||||
{
|
||||
//为新增及更新的task重新绑定流程模版
|
||||
for(TaskPoolItem taskPoolItem:taskPoolItemList) {
|
||||
String flowTemplate = taskPoolItem.flowTemplate;
|
||||
if (flowTemplate == null || flowTemplate.isEmpty()) {
|
||||
@@ -131,7 +133,6 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
}
|
||||
String[] flowTemplates = flowTemplate.split(";");
|
||||
for (String template : flowTemplates) {
|
||||
SimulatePoolTaskFlowTemplateRelate relate = new SimulatePoolTaskFlowTemplateRelate();
|
||||
if(mapper.queryTaskFlowRelate(template,poolName,version,taskPoolItem.uuid).isEmpty())
|
||||
{
|
||||
SimulatePoolTaskFlowTemplateRelate templateRelate = new SimulatePoolTaskFlowTemplateRelate();
|
||||
@@ -144,6 +145,34 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
}
|
||||
}
|
||||
}
|
||||
//为新增及更新task绑定知识库
|
||||
List<SaveFileSimulationMappingReq> saveFileSimulationMappingReq = new ArrayList<>();
|
||||
for(TaskPoolItem taskPoolItem:taskPoolItemList) {
|
||||
String standard = taskPoolItem.standard;
|
||||
if(standard == null || standard.isEmpty())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String[] standardItems = standard.split(";");
|
||||
List<Long> fileIdList = new ArrayList<>();
|
||||
for(String item: standardItems)
|
||||
{
|
||||
String[] standardIds = item.split(",");
|
||||
if(standardIds.length == 2)
|
||||
{
|
||||
String fileId = standardIds[1].trim();
|
||||
fileIdList.add(Long.valueOf(fileId));
|
||||
}
|
||||
|
||||
}
|
||||
SaveFileSimulationMappingReq req = new SaveFileSimulationMappingReq();
|
||||
req.setSimulationPoolTaskId(taskPoolItem.uuid);
|
||||
req.setSimulationPoolVersion(version);
|
||||
req.setSimulationPoolId(poolId);
|
||||
req.setFileIds(fileIdList);
|
||||
saveFileSimulationMappingReq.add(req);
|
||||
}
|
||||
simulationMappingFeignClient.batchSaveFileSimulationMapping(saveFileSimulationMappingReq);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -151,7 +180,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
* @param updateBean
|
||||
* @param currentBrief
|
||||
*/
|
||||
private void handleUpdateTaskBindRelation(TaskPoolUpdateBean updateBean,TaskPoolBrief currentBrief)
|
||||
private void handleUpdateTaskBindRelation(TaskPoolUpdateBean updateBean,TaskPoolBrief currentBrief,int oldPoolId)
|
||||
{
|
||||
String currentVersion = currentBrief.currentVersion;
|
||||
String poolName = currentBrief.poolName;
|
||||
@@ -163,7 +192,37 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
// 2.升版更新
|
||||
if(updateBean.bNewVersion)
|
||||
{
|
||||
mapper.copyTaskRelateToNewVersion(poolName,currentBrief.parentVersion,currentVersion);
|
||||
//拷贝上个版本的流程模版绑定
|
||||
String constantVersion = "'"+currentVersion+"'";
|
||||
mapper.copyTaskRelateToNewVersion(poolName,currentBrief.parentVersion,constantVersion);
|
||||
//拷贝上个版本的知识库绑定
|
||||
GetFileSimulationMappingReq mappingReq = new GetFileSimulationMappingReq();
|
||||
mappingReq.setSimulationPoolId(oldPoolId);
|
||||
mappingReq.setSimulationPoolVersion(currentBrief.parentVersion);
|
||||
SdmResponse<Map<String, List<FileMetadataInfoResp>>> fileMetaRsp = simulationMappingFeignClient.batchGetFileSimulationMappingBySimulationPoolIdAndVersion(mappingReq);
|
||||
if(fileMetaRsp.isSuccess())
|
||||
{
|
||||
Map<String, List<FileMetadataInfoResp>> fileMetaMap = fileMetaRsp.getData();
|
||||
List<SaveFileSimulationMappingReq> saveFileSimulationMappingReq = new ArrayList<>();
|
||||
for(String taskUuid : fileMetaMap.keySet())
|
||||
{
|
||||
List<FileMetadataInfoResp> fileMetadataInfoRespList = fileMetaMap.get(taskUuid);
|
||||
List<Long> fileIdList = new ArrayList<>();
|
||||
for(FileMetadataInfoResp fileMetadataInfoResp : fileMetadataInfoRespList)
|
||||
{
|
||||
fileIdList.add(fileMetadataInfoResp.getId());
|
||||
}
|
||||
SaveFileSimulationMappingReq req = new SaveFileSimulationMappingReq();
|
||||
req.setSimulationPoolId(currentBrief.id);
|
||||
req.setSimulationPoolVersion(currentBrief.currentVersion);
|
||||
req.setSimulationPoolTaskId(taskUuid);
|
||||
req.setFileIds(fileIdList);
|
||||
saveFileSimulationMappingReq.add(req);
|
||||
}
|
||||
if(!saveFileSimulationMappingReq.isEmpty()) {
|
||||
simulationMappingFeignClient.batchSaveFileSimulationMapping(saveFileSimulationMappingReq);
|
||||
}
|
||||
}
|
||||
}
|
||||
for(TaskPoolItem taskPoolItem:updateTasks) //删除更新分析项的关联关系
|
||||
{
|
||||
@@ -1385,7 +1444,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
response = SdmResponse.failed("分析项库不存在");
|
||||
return response;
|
||||
}
|
||||
|
||||
int oldPoolId = oldPoolBrief.id;
|
||||
if(updateBean.bNewVersion)
|
||||
{
|
||||
//在当前分析项库活动版本记录中生成新版本
|
||||
@@ -1406,8 +1465,8 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
mapper.deleteTaskPoolBrief(currPoolBrief.poolName);
|
||||
currPoolBrief.parentVersion = currPoolBrief.currentVersion;
|
||||
currPoolBrief.currentVersion = poolVersion.poolVersion;
|
||||
poolVersion.poolId = mapper.addTaskPoolBreif(currPoolBrief);
|
||||
currPoolBrief.id = poolVersion.poolId;
|
||||
mapper.addTaskPoolBreif(currPoolBrief);
|
||||
poolVersion.poolId = currPoolBrief.id;
|
||||
TaskPoolTree poolTree = (TaskPoolTree) treeRespond.getData();
|
||||
poolVersion.versionContents = JSONObject.toJSONString(poolTree);
|
||||
mapper.addTaskPoolVersion(poolVersion);
|
||||
@@ -1448,7 +1507,7 @@ public class SimulationTaskPoolServiceImpl extends BaseService implements ISimul
|
||||
}
|
||||
if(response.isSuccess())
|
||||
{
|
||||
handleUpdateTaskBindRelation(updateBean,currPoolBrief);
|
||||
handleUpdateTaskBindRelation(updateBean,currPoolBrief,oldPoolId);
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user