解决分析项库故障修复
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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