Merge branch 'main' of http://carsafe.uicp.cn/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/flow")
|
||||
@@ -82,6 +83,12 @@ public class FlowController implements ISimulationFlowFeignClient {
|
||||
return IFlowService.getReleaseFlowTemplateByCondition(req.templateType,req.templateName,req.approveType,req.createTime,req.creator,req.current,req.size,req.type,req.templateStatus);
|
||||
}
|
||||
|
||||
@SysLog("批量查询流程模版")
|
||||
@PostMapping("/batchQueryFlowTemplate")
|
||||
public SdmResponse<Map<String,FlowTemplateResp>> batchQueryFlowTemplate(@RequestBody @Validated List<String> templateCodes) {
|
||||
return IFlowService.getFlowTemplateByTemplateCodes(templateCodes);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询仿真流程模版版本信息
|
||||
* @param code
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.sdm.common.entity.resp.capability.FlowTemplateResp;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public interface IFlowService {
|
||||
@@ -81,6 +82,13 @@ public interface IFlowService {
|
||||
*/
|
||||
SdmResponse getFlowTemplateInfo(String uuid);
|
||||
|
||||
/**
|
||||
* 通过流程模版编号批量获取流程模版
|
||||
* @param templateCodes
|
||||
* @return
|
||||
*/
|
||||
SdmResponse<Map<String,FlowTemplateResp>> getFlowTemplateByTemplateCodes(List<String> templateCodes);
|
||||
|
||||
|
||||
/**
|
||||
* 处理评审结果
|
||||
|
||||
@@ -477,6 +477,42 @@ public class FlowServiceImpl extends BaseService implements IFlowService {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过流程模版编码批量获取流程模版信息
|
||||
* @param templateCodes
|
||||
* @return
|
||||
*/
|
||||
public SdmResponse<Map<String,FlowTemplateResp>> getFlowTemplateByTemplateCodes(List<String> templateCodes)
|
||||
{
|
||||
String condition = "templateCode IN ('"+String.join("','",templateCodes)+"'"+")";
|
||||
List<SimulationFlowTemplate> templates = flowMapper.queryFlowTemplateByCondition(condition);
|
||||
Map<String,SimulationFlowTemplate> flowTemplateMap = new HashMap<>();
|
||||
for(SimulationFlowTemplate template : templates)
|
||||
{
|
||||
SimulationFlowTemplate flowTemplate = flowTemplateMap.get(template.templateCode);
|
||||
if(flowTemplate == null)
|
||||
{
|
||||
flowTemplateMap.put(template.templateCode,template);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(flowTemplate.templateVersion.compareToIgnoreCase(template.templateVersion) < 0)
|
||||
{
|
||||
flowTemplateMap.put(template.templateCode,template);
|
||||
}
|
||||
}
|
||||
}
|
||||
Map<String,FlowTemplateResp> flowTemplateRespMap = new HashMap<>(); //适配feign接口中的公共类FlowTemplateResp
|
||||
for(String key : flowTemplateMap.keySet())
|
||||
{
|
||||
FlowTemplateResp flowTemplateResp = new FlowTemplateResp();
|
||||
SimulationFlowTemplate flowTemplate = flowTemplateMap.get(key);
|
||||
BeanUtils.copyProperties(flowTemplate,flowTemplateResp);
|
||||
flowTemplateRespMap.put(key,flowTemplateResp);
|
||||
}
|
||||
return SdmResponse.success(flowTemplateRespMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse handleApproveResult(LaunchApproveReq req)
|
||||
{
|
||||
|
||||
@@ -11,6 +11,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -140,4 +141,19 @@ public class SimulationFlowFeignClientImpl implements ISimulationFlowFeignClient
|
||||
return SdmResponse.failed("查询有效流程模板信息失败异常");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<Map<String, FlowTemplateResp>> batchQueryFlowTemplate(List<String> templateCodes) {
|
||||
SdmResponse<Map<String, FlowTemplateResp>> response;
|
||||
try {
|
||||
response = flowFeignClient.batchQueryFlowTemplate(templateCodes);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("查询有效流程模板信息失败");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("查询有效流程模板信息失败异常", e);
|
||||
return SdmResponse.failed("查询有效流程模板信息失败异常");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,14 @@ import com.sdm.common.entity.req.capability.FlowNodeDto;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
import com.sdm.common.entity.resp.capability.FlowTemplateResp;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = "capability")
|
||||
public interface ISimulationFlowFeignClient {
|
||||
@@ -39,4 +41,7 @@ public interface ISimulationFlowFeignClient {
|
||||
@GetMapping("/flow/queryValidFlowTemplate")
|
||||
SdmResponse<List<FlowTemplateResp>> queryValidFlowTemplateInfo();
|
||||
|
||||
@PostMapping("/flow/batchQueryFlowTemplate")
|
||||
SdmResponse<Map<String,FlowTemplateResp>> batchQueryFlowTemplate(@RequestBody @Validated List<String> templateCodes);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user