Kaynağa Gözat

[manager] 监控参数接口修改,jar启动修复

tomsun28 4 yıl önce
ebeveyn
işleme
fad9367f81

+ 18 - 1
manager/pom.xml

@@ -8,8 +8,8 @@
         <version>1.0-SNAPSHOT</version>
     </parent>
     <modelVersion>4.0.0</modelVersion>
-
     <artifactId>manager</artifactId>
+    <packaging>jar</packaging>
 
     <properties>
         <mysql.version>8.0.16</mysql.version>
@@ -94,4 +94,21 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.4.13</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

+ 1 - 1
manager/src/main/java/com/usthe/manager/controller/AppController.java

@@ -34,7 +34,7 @@ public class AppController {
     @ApiOperation(value = "查询监控类型的参数结构", notes = "根据app查询指定监控类型的需要输入参数的结构")
     public ResponseEntity<Message<List<ParamDefine>>> queryAppParamDefines(
             @ApiParam(value = "监控类型名称", example = "api") @PathVariable("app") String app) {
-        List<ParamDefine> paramDefines = appService.getAppParamDefines(app);
+        List<ParamDefine> paramDefines = appService.getAppParamDefines(app.toLowerCase());
         return ResponseEntity.ok(new Message<>(paramDefines));
     }
 

+ 2 - 2
manager/src/main/java/com/usthe/manager/service/impl/AppServiceImpl.java

@@ -72,7 +72,7 @@ public class AppServiceImpl implements AppService, CommandLineRunner {
             if (appFile.exists()) {
                 try (FileInputStream fileInputStream = new FileInputStream(appFile)) {
                     Job app = yaml.loadAs(fileInputStream, Job.class);
-                    appDefines.put(app.getApp(), app);
+                    appDefines.put(app.getApp().toLowerCase(), app);
                 } catch (IOException e) {
                     log.error(e.getMessage(), e);
                     throw new IOException(e);
@@ -91,7 +91,7 @@ public class AppServiceImpl implements AppService, CommandLineRunner {
             if (appFile.exists()) {
                 try (FileInputStream fileInputStream = new FileInputStream(appFile)) {
                     ParamDefineDto paramDefine = yaml.loadAs(fileInputStream, ParamDefineDto.class);
-                    paramDefines.put(paramDefine.getApp(), paramDefine.getParam());
+                    paramDefines.put(paramDefine.getApp().toLowerCase(), paramDefine.getParam());
                 } catch (IOException e) {
                     log.error(e.getMessage(), e);
                     throw new IOException(e);

+ 0 - 2
manager/src/main/java/com/usthe/manager/support/GlobalExceptionHandler.java

@@ -18,8 +18,6 @@ import org.springframework.web.bind.annotation.ExceptionHandler;
 import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestControllerAdvice;
 
-import javax.validation.ConstraintViolationException;
-import javax.validation.ValidationException;
 import java.lang.reflect.Field;
 
 import static com.usthe.common.util.CommonConstants.DETECT_FAILED;

+ 2 - 1
manager/src/main/resources/define/param/A-example.yml

@@ -28,7 +28,8 @@ param:
     required: false
   - field: ssl
     name: 启动SSL
-    type: radio
+    type: boolean
     required: false
+    # 当type为boolean时,前端用switch展示开关
     # 当type为radio单选框,checkbox复选框时,option表示可选项值列表
     option: Yes,No