Browse Source

feature: 接口增加/rest/diagnosis前缀

Feick 2 years ago
parent
commit
e72452bb9e
34 changed files with 44 additions and 38 deletions
  1. 3 5
      pom.xml
  2. 3 0
      src/main/java/com/yaoxiang/diagnosis/config/MinioConfig.java
  3. 4 3
      src/main/java/com/yaoxiang/diagnosis/config/MvcConfig.java
  4. 1 1
      src/main/java/com/yaoxiang/diagnosis/config/WebSecurityConfig.java
  5. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/ExcelController.java
  6. 2 2
      src/main/java/com/yaoxiang/diagnosis/controller/FileController.java
  7. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/IssueChapterController.java
  8. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/IssueController.java
  9. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/IssuePaperController.java
  10. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/IssueParseController.java
  11. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/LearnPlanController.java
  12. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/LearnRecordController.java
  13. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/LearnTagController.java
  14. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/OpenController.java
  15. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/OptionController.java
  16. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/PaperCommitController.java
  17. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/PaperController.java
  18. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/PaperResultController.java
  19. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/PaperTypeController.java
  20. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/QuestionController.java
  21. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/RemarkTemplateController.java
  22. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/ReportController.java
  23. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/RoleController.java
  24. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/SpecialDiagnosisController.java
  25. 1 0
      src/main/java/com/yaoxiang/diagnosis/controller/SpecialExportController.java
  26. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/SpecialReportController.java
  27. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/SubjectController.java
  28. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/UserInfoController.java
  29. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/UserManagerController.java
  30. 1 1
      src/main/java/com/yaoxiang/diagnosis/controller/WebsocketController.java
  31. 2 0
      src/main/java/com/yaoxiang/diagnosis/file/MinioFileService.java
  32. 1 0
      src/main/java/com/yaoxiang/diagnosis/service/UserService.java
  33. 2 2
      src/main/resources/application.properties
  34. 1 1
      src/main/resources/static/login.html

+ 3 - 5
pom.xml

@@ -18,7 +18,7 @@
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>2.5.6</version>
+        <version>2.5.12</version>
         <relativePath/>
     </parent>
 
@@ -73,7 +73,6 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>4.13</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -83,12 +82,11 @@
         <dependency>
             <groupId>com.google.code.gson</groupId>
             <artifactId>gson</artifactId>
-            <version>2.8.5</version>
+            <version>2.9.0</version>
         </dependency>
         <dependency>
             <groupId>org.apache.commons</groupId>
             <artifactId>commons-lang3</artifactId>
-            <version>3.7</version>
         </dependency>
         <dependency>
             <groupId>org.apache.poi</groupId>
@@ -112,7 +110,7 @@
         <dependency>
             <groupId>com.alibaba</groupId>
             <artifactId>druid</artifactId>
-            <version>1.1.21</version>
+            <version>1.2.8</version>
         </dependency>
         <dependency>
             <groupId>org.projectlombok</groupId>

+ 3 - 0
src/main/java/com/yaoxiang/diagnosis/config/MinioConfig.java

@@ -19,6 +19,9 @@ import java.security.SecureRandom;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
 
+/**
+ * @author Feick
+ */
 @Configuration
 public class MinioConfig {
 

+ 4 - 3
src/main/java/com/yaoxiang/diagnosis/config/MvcConfig.java

@@ -1,6 +1,7 @@
 package com.yaoxiang.diagnosis.config;
 
 
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
@@ -9,8 +10,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
 @Configuration
 public class MvcConfig {
 
-    //    @Resource
-    private UploadProperties uploadProperties;
+    @Value("${web.loginPage:/login}")
+    private String loginPage;
 
     @Bean
     WebMvcConfigurer webMvcConfigurer() {
@@ -20,7 +21,7 @@ public class MvcConfig {
 //                registry.addViewController("/").setViewName("index");
 //                registry.addViewController("/app").setViewName("app");
 
-                registry.addViewController("/login").setViewName("login");
+                registry.addViewController(loginPage).setViewName("login");
 //                registry.addViewController("/hello").setViewName("hello");
             }
 

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/config/WebSecurityConfig.java

@@ -152,7 +152,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
                 "/**/*.jpg", "/**/*.woff", "/**/*.ttf", "/*.ico");
         web.ignoring().antMatchers(permitUrls);
         web.ignoring().antMatchers("/doc.html");
-        web.ignoring().antMatchers("/open/**");
+        web.ignoring().antMatchers("/rest/diagnosis/open/**");
 //        web.ignoring().antMatchers(uploadProperties.getUploadPattern());
 //        web.ignoring().antMatchers("/v2/api-docs",//swagger api json
 //                "/swagger-resources/configuration/ui",//用来获取支持的动作

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/ExcelController.java

@@ -17,7 +17,7 @@ import java.util.List;
 
 @Api(tags = "上传报告能力、知识点、问题、分数段数据")
 @RestController
-@RequestMapping("/excel")
+@RequestMapping("/rest/diagnosis/excel")
 public class ExcelController {
 
     @Resource

+ 2 - 2
src/main/java/com/yaoxiang/diagnosis/controller/FileController.java

@@ -19,7 +19,7 @@ import java.io.IOException;
  * @DESCRIPTION:
  */
 @RestController
-@RequestMapping("/file")
+@RequestMapping("/rest/diagnosis/file")
 @Api(tags = "文件管理")
 //@PreAuthorize("hasRole('ROLE_ADMIN')")
 public class FileController {
@@ -69,7 +69,7 @@ public class FileController {
 //    }
 
     @GetMapping("/download/{bucketName}/{filename}")
-    @ApiOperation("使用方式 curl localhost:8085/file/download/prod/xx.docx")
+    @ApiOperation("使用方式 curl localhost:8085/rest/diagnosis/file/download/prod/xx.docx")
     public ResponseEntity<byte[]> download(@PathVariable String bucketName, @PathVariable String filename) throws IOException {
         return fileService.download("/" + bucketName + "/" + filename);
     }

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/IssueChapterController.java

@@ -17,7 +17,7 @@ import java.util.stream.Collectors;
 
 @Api(tags = "组合卷章节")
 @RestController
-@RequestMapping("issueChapter")
+@RequestMapping("/rest/diagnosis/issueChapter")
 public class IssueChapterController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/IssueController.java

@@ -13,7 +13,7 @@ import java.util.List;
 @Slf4j
 @Api(tags = "组合卷题目")
 @RestController
-@RequestMapping("issue")
+@RequestMapping("/rest/diagnosis/issue")
 public class IssueController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/IssuePaperController.java

@@ -12,7 +12,7 @@ import javax.annotation.Resource;
 import java.util.List;
 
 @Api(tags = "组合卷")
-@RequestMapping("issuePaper")
+@RequestMapping("/rest/diagnosis/issuePaper")
 @RestController
 public class IssuePaperController {
 

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/IssueParseController.java

@@ -19,7 +19,7 @@ import java.io.IOException;
 
 @Api(tags = "组合卷解析")
 @RestController
-@RequestMapping("issueParse")
+@RequestMapping("/rest/diagnosis/issueParse")
 public class IssueParseController {
 
     private static final Logger logger = LoggerFactory.getLogger(IssueParseController.class);

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/LearnPlanController.java

@@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.RestController;
 import javax.annotation.Resource;
 
 @RestController
-@RequestMapping("learnPlan")
+@RequestMapping("/rest/diagnosis/learnPlan")
 public class LearnPlanController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/LearnRecordController.java

@@ -16,7 +16,7 @@ import java.util.Map;
 
 @Api(tags = "学习记录")
 @RestController
-@RequestMapping("learn")
+@RequestMapping("/rest/diagnosis/learn")
 public class LearnRecordController {
 
     @Autowired

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/LearnTagController.java

@@ -12,7 +12,7 @@ import java.util.List;
 
 @Api(tags = "学习标签")
 @RestController
-@RequestMapping("learnTag")
+@RequestMapping("/rest/diagnosis/learnTag")
 public class LearnTagController {
 
     @Autowired

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/OpenController.java

@@ -12,7 +12,7 @@ import javax.annotation.Resource;
 
 @Api(tags = "开放接口")
 @RestController
-@RequestMapping("/open")
+@RequestMapping("/rest/diagnosis//open")
 public class OpenController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/OptionController.java

@@ -18,7 +18,7 @@ import java.util.List;
  * Created by 千里明月 on 2018/7/15.
  */
 @RestController
-@RequestMapping("/option")
+@RequestMapping("/rest/diagnosis//option")
 @Api(tags = "选项管理")
 @PreAuthorize("hasRole('ROLE_ADMIN')")
 public class OptionController {

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/PaperCommitController.java

@@ -15,7 +15,7 @@ import java.util.List;
 
 @Api(tags = "试卷提交管理")
 @RestController
-@RequestMapping("paper")
+@RequestMapping("/rest/diagnosis/paper")
 public class PaperCommitController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/PaperController.java

@@ -29,7 +29,7 @@ import java.util.List;
  * @DESCRIPTION:
  */
 @RestController
-@RequestMapping("/paper")
+@RequestMapping("/rest/diagnosis/paper")
 @Api(tags = "试卷管理")
 public class PaperController {
 

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/PaperResultController.java

@@ -21,7 +21,7 @@ import java.util.List;
 
 @Api(tags = "试卷提交后结果生成")
 @RestController
-@RequestMapping("paperResult")
+@RequestMapping("/rest/diagnosis/paperResult")
 public class PaperResultController {
 
     private static final Logger logger = LoggerFactory.getLogger(PaperResultController.class);

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/PaperTypeController.java

@@ -13,7 +13,7 @@ import java.util.List;
 
 @Api("试卷类型")
 @RestController
-@RequestMapping("paperType")
+@RequestMapping("/rest/diagnosis/paperType")
 public class PaperTypeController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/QuestionController.java

@@ -18,7 +18,7 @@ import java.util.concurrent.ExecutorService;
  * Created by 千里明月 on 2018/7/15.
  */
 @RestController
-@RequestMapping("/question")
+@RequestMapping("/rest/diagnosis/question")
 @Api(tags = "题目管理")
 //@Secured("ROLE_ADMIN")
 public class QuestionController {

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/RemarkTemplateController.java

@@ -14,7 +14,7 @@ import java.util.List;
 
 @Api(tags = "试卷说明模板")
 @RestController
-@RequestMapping("/remarkTemplate")
+@RequestMapping("/rest/diagnosis/remarkTemplate")
 public class RemarkTemplateController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/ReportController.java

@@ -23,7 +23,7 @@ import java.util.Map;
 
 @Api(tags = "报告管理")
 @RestController
-@RequestMapping("/report")
+@RequestMapping("/rest/diagnosis/report")
 public class ReportController {
 
     private static final Logger logger = LoggerFactory.getLogger(ReportController.class);

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/RoleController.java

@@ -12,7 +12,7 @@ import javax.annotation.Resource;
 
 //@AuthCheck(authority = "role")
 @Api(tags = "角色管理")
-@RestController("role")
+@RestController("/rest/diagnosis/role")
 public class RoleController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/SpecialDiagnosisController.java

@@ -13,7 +13,7 @@ import java.util.List;
 
 @Api(tags = "专项诊断")
 @RestController
-@RequestMapping("special")
+@RequestMapping("/rest/diagnosis/special")
 public class SpecialDiagnosisController {
 
     @Resource

+ 1 - 0
src/main/java/com/yaoxiang/diagnosis/controller/SpecialExportController.java

@@ -37,6 +37,7 @@ import java.util.*;
  */
 @Api(tags = "专项诊断导出")
 @RestController
+@RequestMapping("/rest/diagnosis/specialExport")
 public class SpecialExportController {
     private static final Logger logger = LoggerFactory.getLogger(SpecialExportController.class);
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/SpecialReportController.java

@@ -15,7 +15,7 @@ import java.util.List;
 
 @Api(tags = "专项诊断报告")
 @RestController
-@RequestMapping("/specialReport")
+@RequestMapping("/rest/diagnosis/specialReport")
 public class SpecialReportController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/SubjectController.java

@@ -12,7 +12,7 @@ import java.util.List;
 
 @Api(tags = "科目管理")
 @RestController
-@RequestMapping("subject")
+@RequestMapping("/rest/diagnosis/subject")
 public class SubjectController {
 
     @Resource

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/UserInfoController.java

@@ -19,7 +19,7 @@ import java.util.List;
 
 @Api(tags = "用户信息")
 @RestController
-@RequestMapping("self")
+@RequestMapping("/rest/diagnosis/self")
 public class UserInfoController {
 
     @Autowired

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/UserManagerController.java

@@ -23,7 +23,7 @@ import java.util.Map;
  */
 @Api(tags = "用户管理")
 @RestController
-@RequestMapping("/user")
+@RequestMapping("/rest/diagnosis//user")
 public class UserManagerController {
     @Resource
     private UserService userService;

+ 1 - 1
src/main/java/com/yaoxiang/diagnosis/controller/WebsocketController.java

@@ -9,7 +9,7 @@ import org.springframework.web.util.HtmlUtils;
 public class WebsocketController {
 
     @MessageMapping("/hello")
-    @SendTo("/topic/greetings")
+    @SendTo("/rest/diagnosis/topic/greetings")
     public String greeting(String message) throws Exception {
         Thread.sleep(1000); // simulated delay
         return "Hello, " + HtmlUtils.htmlEscape(message) + "!";

+ 2 - 0
src/main/java/com/yaoxiang/diagnosis/file/MinioFileService.java

@@ -56,6 +56,7 @@ public class MinioFileService implements FileService {
         return url;
     }
 
+    @Override
     public String upload(byte[] data, String filename) {
         try {
             return upload(data, filename, properties.getDefaultBucket());
@@ -79,6 +80,7 @@ public class MinioFileService implements FileService {
         return properties.getPrefix() + bucket + "/" + filename;
     }
 
+    @Override
     public ResponseEntity<byte[]> download(String url) throws IOException {
         int index = url.lastIndexOf('/') + 1;
         String uuidName = url.substring(index);

+ 1 - 0
src/main/java/com/yaoxiang/diagnosis/service/UserService.java

@@ -79,6 +79,7 @@ public class UserService {
     public UserInfo findByUsername(String username) {
         UserInfo userInfo = userRepo.findByUsername(username);
         if (userInfo == null) {
+            logger.error("user {} not found", username);
             return null;
         }
         //初始化userType

+ 2 - 2
src/main/resources/application.properties

@@ -35,6 +35,6 @@ spring.data.redis.repositories.enabled=false
 #server.tomcat.accesslog.suffix=.log
 
 #swagger
-web.loginPage=/login
-web.logoutUrl=/logout
+web.loginPage=/rest/diagnosis/login
+web.logoutUrl=/rest/diagnosis/logout
 web.defaultPassword=YaoXiang@2020

+ 1 - 1
src/main/resources/static/login.html

@@ -6,7 +6,7 @@
 </head>
 <body>
 <h2>Login</h2>
-<form action="/login" method="post">
+<form action="/rest/diagnosis/login" method="post">
     <input type="text" name="username" value=""/><br/>
     <input type="password" name="password" value=""/><br/>
     <input type="text" name="loginFrom" value="admin"><br/>