From 1d53dd8f501a98ddcce8146443b51b357ef5f9b1 Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期四, 29 十二月 2022 16:55:46 +0800 Subject: [PATCH] 1 --- src/main/java/com/lf/server/controller/show/PipelineController.java | 84 ++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 80 insertions(+), 4 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 index b4c3ffe..51aa1ff 100644 --- a/src/main/java/com/lf/server/controller/show/PipelineController.java +++ b/src/main/java/com/lf/server/controller/show/PipelineController.java @@ -1,9 +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 sws - * @date 2022-09-22 + * 绠¢亾鍒嗘瀽 + * @author WWW */ -public class PipelineController { +@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