|
@@ -0,0 +1,52 @@
|
|
|
+package com.persagy.apm.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.persagy.apm.common.response.CommonResult;
|
|
|
+import com.persagy.apm.common.utils.ResultHelper;
|
|
|
+import com.persagy.apm.model.vo.GroupTreeVO;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.io.IOUtils;
|
|
|
+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;
|
|
|
+
|
|
|
+import java.io.File;
|
|
|
+import java.io.IOException;
|
|
|
+import java.io.InputStream;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author 易涛
|
|
|
+ * @version 1.0
|
|
|
+ * @date 2021/9/7 18:09
|
|
|
+ */
|
|
|
+@Api(tags = "分组管理")
|
|
|
+@RestController
|
|
|
+@RequestMapping("group-management")
|
|
|
+public class GroupManagementController {
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取分组树")
|
|
|
+ @PostMapping("/queryGroupTree")
|
|
|
+ public CommonResult<List<GroupTreeVO>> queryGroupTree(){
|
|
|
+ InputStream inputStream = this.getClass().getClassLoader()
|
|
|
+ .getResourceAsStream(File.separator+"json"+File.separator+"GroupTree.json");
|
|
|
+ if(inputStream==null){
|
|
|
+ return ResultHelper.single(null);
|
|
|
+ }
|
|
|
+ try{
|
|
|
+ String str = IOUtils.toString(inputStream, StandardCharsets.UTF_8);
|
|
|
+ return ResultHelper.single(JSONArray.parseArray(str,GroupTreeVO.class));
|
|
|
+ }catch (IOException ioe){
|
|
|
+ throw new RuntimeException("json文件有误",ioe);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据id获取分组详情信息")
|
|
|
+ @PostMapping("/queryTreeById")
|
|
|
+ public CommonResult<GroupTreeVO> queryTreeById(@RequestBody String id){
|
|
|
+ return ResultHelper.single(null);
|
|
|
+ }
|
|
|
+}
|