YA项目接口实现,故障修复

This commit is contained in:
daiqy88
2025-11-28 10:06:23 +08:00
parent 56aa5b14e5
commit 60c287e803
17 changed files with 385 additions and 17 deletions

1
.idea/encodings.xml generated
View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/YiAnData/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/approve/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/capability/src/main/java" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/common/src/main/java" charset="UTF-8" />

View File

@@ -12,7 +12,7 @@ public interface FlowMapper {
@Insert("INSERT INTO simulation_flow_template(uuid,templateName,templateVersion,templateContent,viewContent,parentUuid,templateStatus,templateType,approveType,comment,templateCode,tenantId,createName,creator) VALUES(#{template.uuid},#{template.templateName},#{template.templateVersion},#{template.templateContent},#{template.viewContent},#{template.parentUuid},#{template.templateStatus},#{template.templateType},#{template.approveType},#{template.comment},#{template.templateCode},#{template.tenantId},#{template.createName},#{template.creator})")
int addFlowTemplate(@Param("template") SimulationFlowTemplate template);
@Update("UPDATE simulation_flow_template SET templateContent=#{template.templateContent},viewContent=#{template.viewContent},approveType=#{template.approveType},templateType=#{template.templateType},templateStatus=#{template.templateStatus},comment=#{template.comment} WHERE uuid=#{template.uuid}")
@Update("UPDATE simulation_flow_template SET templateContent=#{template.templateContent},viewContent=#{template.viewContent},approveType=#{template.approveType},templateType=#{template.templateType},templateStatus=#{template.templateStatus},comment=#{template.comment},approveFlowId=#{template.approveFlowId} WHERE uuid=#{template.uuid}")
int updateFlowTemplate(@Param("template") SimulationFlowTemplate template);
@Delete("DELETE FROM simulation_flow_template WHERE uuid=#{uuid}")

View File

@@ -36,6 +36,9 @@ public class SimulationFlowTemplate extends BaseEntity {
@Schema(description = "模版状态")
public int templateStatus = 1;
@Schema(description = "评审流ID")
public String approveFlowId;
@Schema(description = "模版类型")
public String templateType;

View File

@@ -73,7 +73,7 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
long tenantId = ThreadLocalContext.getTenantId();
long creator = ThreadLocalContext.getUserId();
String condition = "templateName='"+templateName+"' AND tenantId="+tenantId+" ORDER BY createTime DESC LIMIT 1" ;
String createName = ThreadLocalContext.getUserName();
//String createName = ThreadLocalContext.getUserName();
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
if (templates.isEmpty()) {
flowTemplate.setTemplateVersion("V1.0");
@@ -90,7 +90,7 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
response.setData(uuid);
flowTemplate.setCreator(creator);
flowTemplate.setTenantId(tenantId);
flowTemplate.setCreateName(createName);
flowTemplate.setCreateName("");
if(flowMapper.addFlowTemplate(flowTemplate) <=0)
{
response = SdmResponse.failed("添加流程模版草稿失败");
@@ -163,12 +163,19 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
}
else //发起评审
{
if(!launchApprove(templateDraft))
SdmResponse approveRespond = launchApprove(templateDraft);
if(!approveRespond.isSuccess())
{
response = SdmResponse.failed("发起评审失败");
templateDraft.setApproveType(0);
flowMapper.updateFlowTemplate(templateDraft);
}
else
{
String approveFlowId = (String)approveRespond.getData();
templateDraft.setApproveFlowId(approveFlowId);
response.setData(approveFlowId);
}
flowMapper.updateFlowTemplate(templateDraft);
}
}
return response;
@@ -179,7 +186,7 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
* @param flowTemplate
* @return
*/
private boolean launchApprove(SimulationFlowTemplate flowTemplate) {
private SdmResponse launchApprove(SimulationFlowTemplate flowTemplate) {
LaunchApproveReq approveReq = new LaunchApproveReq();
approveReq.approveTitle = "仿真流程评审";
approveReq.approveStatus = 1;
@@ -195,8 +202,7 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
flowTemplateJson.put("flowContents", flowTemplate.templateContent);
flowTemplateJson.put("viewContents", flowTemplate.viewContent);
approveReq.approveContents = flowTemplateJson.toJSONString();
SdmResponse response = approveFeignClient.launchApproval(approveReq);
return response.isSuccess();
return approveFeignClient.launchApproval(approveReq);
}
@Override

View File

@@ -0,0 +1,85 @@
package com.sdm.project.controller;
import com.sdm.common.common.SdmResponse;
import com.sdm.common.entity.req.data.UploadFilesReq;
import com.sdm.project.model.req.YA.GetModelNodeInfoReq;
import com.sdm.project.model.req.YA.SaveModelNodeInfoReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/dataManager/tree/node")
@Tag(name = "宜安项目数据归档", description = "宜安项目模型数据关了")
public class YAModelController {
/**
* 创建文件夹
*
* @param req
* @return
*/
@PostMapping(value = "/SaveModelNodeInfo", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
@Operation(
summary = "上传模型",
description = "仿真模型归档,支持同时上传文件和附加参数",
requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody(
description = "模型文件上传请求",
required = true,
content = @Content(
mediaType = MediaType.MULTIPART_FORM_DATA_VALUE,
schema = @Schema(implementation = SaveModelNodeInfoReq.class)
)
)
)
public SdmResponse saveModelNodeInfo(@RequestBody @Validated SaveModelNodeInfoReq req)
{
UploadFilesReq fileReq = new UploadFilesReq();
fileReq.setFileName(req.getName());
fileReq.setProjectId(req.getProject());
fileReq.setFileType(1);
fileReq.setFile(req.getFile());
fileReq.setUuid(req.getScenario());
fileReq.setAnalysisDirectionId(req.getScenario());
return null;
}
@PostMapping("GetModelNodeInfoByIdAndType")
public void getModelNodeInfo(@RequestBody @Validated GetModelNodeInfoReq req)
{
}
@PostMapping("DeleteModelNodeByObjectIds")
public void DeleteModelNodeInfo(@RequestBody @Validated GetModelNodeInfoReq req)
{
}
@PostMapping("SyncProject")
public void syncCidProject()
{
}
@PostMapping("SyncCidTask")
public void syncCidTask()
{
}
}

View File

@@ -0,0 +1,20 @@
package com.sdm.project.model.req.YA;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "仿真模型删除参数")
public class DeleteModelNodeInfoReq {
@Schema(description = "数据类型名称")
private String type;
@Schema(description = "需要删除数据ObjectId")
private String objectId;
@Schema(description = "需要删除数据id")
private String id;
}

View File

@@ -0,0 +1,16 @@
package com.sdm.project.model.req.YA;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
@Schema(description = "获取仿真模型参数")
public class GetModelNodeInfoReq {
@Schema(description = "数据类型名称")
private String type;
@Schema(description = "需要删除数据ObjectId")
private String objectId;
}

View File

@@ -0,0 +1,12 @@
package com.sdm.project.model.req.YA;
import io.swagger.v3.oas.annotations.media.Schema;
public class ProjectTaskInfo {
@Schema(description = "任务名称")
private String taskName;
@Schema(description = "taskId")
private String taskId;
}

View File

@@ -0,0 +1,65 @@
package com.sdm.project.model.req.YA;
import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
@Data
@Schema(description = "仿真关键结果上传参数")
public class SaveKeyResultNodeInfoReq {
@Schema(description = "数据类型名称")
private String type;
@Schema(description = "数据名称")
private String name;
@Schema(description = "数据类型编号")
private String code;
@Schema(description = "仿真分析项")
private String scenario;
@Schema(description = "数据访问控制级别")
private String dataLevel;
@Schema(description = "所属项目ID")
private String project;
@Schema(description = "父级节点ID")
private String parent;
@Schema(description = "任务ID")
private String workRequest;
@Schema(description = "分析对象")
private String item;
@Schema(description = "轮次")
private String round;
@Schema(description = "方案Id")
private String version;
@Schema(description = "文件名称")
private String fileName;
@Schema(description = "数值")
private String value;
@Schema(description = "单位")
private String units;
@Schema(description = "状态")
private String status;
@Schema(description = "物理量")
private String quantityType;
@Schema(description = "文件传输对象")
@JSONField(serialize = false)
private MultipartFile file;
}

View File

@@ -0,0 +1,55 @@
package com.sdm.project.model.req.YA;
import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
@Data
@Schema(description = "仿真模型上传参数")
public class SaveModelNodeInfoReq {
@Schema(description = "数据类型名称")
private String type;
@Schema(description = "数据名称")
private String name;
@Schema(description = "数据类型编号")
private String code;
@Schema(description = "所属项目ID")
private String project;
@Schema(description = "父级节点ID")
private String parent;
@Schema(description = "仿真分析项")
private String scenario;
@Schema(description = "主负责人")
private String firstOwner;
@Schema(description = "从负责人")
private List<String> secondOwner;
@Schema(description = "起止日期")
private String startEndData;
@Schema(description = "学科")
private String disciplineClassification;
@Schema(description = "格式")
private String format;
@Schema(description = "分析对象")
private String item;
@Schema(description = "文件传输对象")
@JSONField(serialize = false)
private MultipartFile file;
}

View File

@@ -0,0 +1,38 @@
package com.sdm.project.model.req.YA;
import com.alibaba.fastjson2.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
@Data
@Schema(description = "仿真报告上传参数")
public class SaveReportNodeInfoReq {
@Schema(description = "数据类型名称")
private String type;
@Schema(description = "数据名称")
private String name;
@Schema(description = "描述")
private String discription;
@Schema(description = "数据类型编号")
private String code;
@Schema(description = "所属项目ID")
private String project;
@Schema(description = "父级节点ID")
private String parent;
@Schema(description = "仿真分析项")
private String scenario;
@Schema(description = "文件传输对象")
@JSONField(serialize = false)
private MultipartFile file;
}

View File

@@ -0,0 +1,14 @@
package com.sdm.project.model.req.YA;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class SyncCidProjectReq {
@Schema(description = "项目名称")
private String projectName;
@Schema(description = "项目Id")
private String projectId;
}

View File

@@ -0,0 +1,20 @@
package com.sdm.project.model.req.YA;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class SyncCidTaskReq {
@Schema(description = "项目名称")
private String projectName;
@Schema(description = "项目Id")
private String projectId;
@Schema(description = "")
private List<ProjectTaskInfo> taskInfoList = new ArrayList<>();
}

View File

@@ -0,0 +1,13 @@
package com.sdm.project.model.resp.YA;
import io.swagger.v3.oas.annotations.media.Schema;
public class BosimErrorRespond {
@Schema(description = "错误码")
private int errorCode;
@Schema(description = "错误信息")
private String errorMsg;
}

View File

@@ -0,0 +1,17 @@
package com.sdm.project.model.resp.YA;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.ArrayList;
import java.util.List;
public class BosimSaveModelNodeRsp {
@Schema(description = "返回码")
private String code;
@Schema(description = "返回信息")
private String message;
private List<String> workRequest = new ArrayList<>();
}

View File

@@ -14,14 +14,14 @@ public interface SimulationSystemMapper {
@Insert("INSERT INTO simulation_data_dictionary(uuid,dictName,dictValue,dictOrder,valueType,aliasName,dictClass,comment,tenantId,creator) VALUES (#{dict.uuid},#{dict.dictName},#{dict.dictValue},#{dict.dictOrder},#{dict.valueType},#{dict.aliasName},#{dict.dictClass},#{dict.comment},#{dict.tenantId},#{dict.creator})")
int addDataDictionary(@Param("dict") DataDictionary dict);
@Select("SELECT * FROM simulation_data_dictionary WHERE dictClass=#{dictClass} ORDER BY dictOrder ASC")
List<DataDictionary> queryDictionaryClassData(@Param("dictClass")String dictClass);
@Select("SELECT * FROM simulation_data_dictionary WHERE dictClass=#{dictClass} AND tenantId=#{tenantId} ORDER BY dictOrder ASC")
List<DataDictionary> queryDictionaryClassData(@Param("dictClass")String dictClass,@Param("tenantId") long tenantId);
@Select("SELECT * FROM simulation_data_dictionary")
List<DataDictionary> getAllDictionaryData();
@Select("SELECT * FROM simulation_data_dictionary WHERE tenantId=#{tenantId}")
List<DataDictionary> getAllDictionaryData(@Param("tenantId") long tenantId);
@Delete("DELETE FROM simulation_data_dictionary WHERE dictClass=#{dictClass}")
int deleteDictionaryClassItems(@Param("dictClass")String dictClass);
@Delete("DELETE FROM simulation_data_dictionary WHERE dictClass=#{dictClass} AND tenantId=#{tenantId}")
int deleteDictionaryClassItems(@Param("dictClass")String dictClass,@Param("tenantId") long tenantId);
@Select("SELECT * FROM simulation_data_dictionary WHERE dictName=#{dictName} AND dictClass=#{dictClass} AND tenantId=#{tenantId} LIMIT 1")
DataDictionary queryDataDictionary(@Param("dictName")String dictName,@Param("dictClass")String dictClass,@Param("tenantId")long tenantId);

View File

@@ -100,7 +100,8 @@ public class SimulationSystemConfigServiceImpl extends BaseService implements IS
public SdmResponse deleteDataDictionaryClass(String className)
{
SdmResponse response = SdmResponse.success();
if(mapper.deleteDictionaryClassItems(className) <= 0)
long tenantId = ThreadLocalContext.getTenantId();
if(mapper.deleteDictionaryClassItems(className,tenantId) <= 0)
{
response = SdmResponse.failed("删除数据字典分类下所有字典信息失败");
}
@@ -114,7 +115,8 @@ public class SimulationSystemConfigServiceImpl extends BaseService implements IS
*/
public SdmResponse<List<DataDictionary>> queryDictionaryData(String className)
{
List<DataDictionary> dictionaries = mapper.queryDictionaryClassData(className);
long tenantId = ThreadLocalContext.getTenantId();
List<DataDictionary> dictionaries = mapper.queryDictionaryClassData(className,tenantId);
return SdmResponse.success(dictionaries);
}
@@ -123,7 +125,8 @@ public class SimulationSystemConfigServiceImpl extends BaseService implements IS
* @return
*/
public SdmResponse<Map<String, List<SimuDictionaryResp>> > getAllDictionaryData() {
List<DataDictionary> dictionaries = mapper.getAllDictionaryData();
long tenantId = ThreadLocalContext.getTenantId();
List<DataDictionary> dictionaries = mapper.getAllDictionaryData(tenantId);
List<SimuDictionaryResp> newDictionaries = dictionaries.stream().filter(i -> StringUtils.isNotBlank(i.dictClass)).map(i -> new SimuDictionaryResp(i.dictValue, i.dictClass, i.dictName)).collect(Collectors.toList());
Map<String, List<SimuDictionaryResp>> dictionMap = newDictionaries.stream().collect(Collectors.groupingBy(SimuDictionaryResp::getDictClass));
return SdmResponse.success(dictionMap);