From 049e8125cd972b564c20dcdc153dfec55b6ae810 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期三, 28 十二月 2022 15:54:57 +0800 Subject: [PATCH] 12.28 --- src/main/java/com/lf/server/controller/show/PipelineController.java | 85 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 85 insertions(+), 0 deletions(-) diff --git a/src/main/java/com/lf/server/controller/show/PipelineController.java b/src/main/java/com/lf/server/controller/show/PipelineController.java new file mode 100644 index 0000000..51aa1ff --- /dev/null +++ b/src/main/java/com/lf/server/controller/show/PipelineController.java @@ -0,0 +1,85 @@ +package com.lf.server.controller.show; + +import com.lf.server.annotation.SysLog; +import com.lf.server.controller.all.BaseController; +import com.lf.server.entity.all.ResponseMsg; +import com.lf.server.entity.all.StaticData; +import com.lf.server.entity.show.PipelineEntity; +import com.lf.server.service.show.PipelineService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.*; + +/** + * 绠¢亾鍒嗘瀽 + * @author WWW + */ +@Api(tags = "缁煎悎灞曠ず\\绠¢亾鍒嗘瀽") +@RestController +@RequestMapping("/pipeline") +public class PipelineController extends BaseController { + @Autowired + PipelineService pipelineService; + + @SysLog() + @ApiOperation(value = "鏌ヨ绠℃") + @GetMapping(value = "/selectSegNames") + public ResponseMsg<Object> selectSegNames() { + try { + List<PipelineEntity> rs = pipelineService.selectSegNames(); + + return success(rs); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + @SysLog() + @ApiOperation(value = "鏌ヨ绠$嚎鍒嗘瀽") + @ApiImplicitParams({ + @ApiImplicitParam(name = "pe", value = "绠¢亾鍒嗘瀽瀹炰綋绫�", dataType = "PipelineEntity", paramType = "body") + }) + @ResponseBody + @PostMapping(value = "/selectPipeAnalysis") + public ResponseMsg<Object> selectPipeAnalysis(@RequestBody PipelineEntity pe) { + try { + if (null == pe.getGid() || pe.getGid() < 1) { + return fail("璇疯緭鍏ョ娈礗D"); + } + if (null == pe.getTabs() || 0 == pe.getTabs().size()) { + return fail("璇疯緭鍏ヨ〃鍚�"); + } + if (!checkTabs(pe.getTabs())) { + return fail("瀛樺湪闈炴硶琛ㄥ悕"); + } + + Map<String, Object> map = new HashMap<>(); + for (String tab : pe.getTabs()) { + List<PipelineEntity> rs = pipelineService.selectPipeAnalysis(tab, pe.getGid()); + map.put(tab, rs); + } + + return success(map); + } catch (Exception ex) { + return fail(ex.getMessage(), null); + } + } + + /** + * 妫�鏌ヨ〃鍚� + */ + private boolean checkTabs(List<String> tabs) { + for (String tab : tabs) { + if (!StaticData.PIPE_ANALYSIS_TABS.contains(tab)) { + return false; + } + } + + return true; + } +} -- Gitblit v1.9.3