浏览代码

http请求方式修改

wangliang 4 年之前
父节点
当前提交
694e34bf65

+ 0 - 5
pom.xml

@@ -101,11 +101,6 @@
                 <artifactId>swagger-bootstrap-ui</artifactId>
                 <version>${swagger2-bootstrap.version}</version>
             </dependency>
-            <dependency>
-                <groupId>io.springfox</groupId>
-                <artifactId>springfox-swagger-ui</artifactId>
-                <version>${swagger2.version}</version>
-            </dependency>
             <dependency>
                 <groupId>com.alibaba</groupId>
                 <artifactId>druid</artifactId>

+ 6 - 5
themis-backend/src/main/java/com/qmth/themis/backend/api/SysController.java

@@ -8,6 +8,7 @@ import com.qmth.themis.business.constant.SystemConstant;
 import com.qmth.themis.business.entity.*;
 import com.qmth.themis.business.enums.DownloadFileEnum;
 import com.qmth.themis.business.enums.RoleEnum;
+import com.qmth.themis.business.enums.UploadFileEnum;
 import com.qmth.themis.business.service.*;
 import com.qmth.themis.business.util.EhcacheUtil;
 import com.qmth.themis.business.util.ServletUtil;
@@ -97,11 +98,11 @@ public class SysController {
     @RequestMapping(value = "/file/upload", method = RequestMethod.POST)
     @Transactional
     @ApiResponses({@ApiResponse(code = 200, message = "{\"id\":0}", response = Result.class)})
-    public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "上传文件类型", required = true) @RequestParam Integer type) throws IOException {
+    public Result fileUpload(@ApiParam(value = "上传文件", required = true) @RequestParam MultipartFile file, @ApiParam(value = "上传文件类型", required = true) @RequestParam UploadFileEnum type) throws IOException {
         if (Objects.isNull(file) || Objects.equals(file, "")) {
             throw new BusinessException(ExceptionResultEnum.ATTACHMENT_IS_NULL);
         }
-        Map<String, Object> mapParameter = systemConfig.getOssEnv(type);
+        Map<String, Object> mapParameter = systemConfig.getOssEnv(type.getId());
         TBUser tbUser = (TBUser) ServletUtil.getRequestAccount();
         TBAttachment tbAttachment = tbAttachmentService.saveAttachment(file, ServletUtil.getRequestMd5(), ServletUtil.getRequestPath(), mapParameter, tbUser.getOrgId(), tbUser.getId());
         if (Objects.isNull(tbAttachment)) {
@@ -117,14 +118,14 @@ public class SysController {
     @ApiOperation(value = "文件下载接口")
     @RequestMapping(value = "/file/download", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"url\":string}", response = Result.class)})
-    public Result fileDownload(@ApiParam(value = "任务id", required = true) @RequestParam Long id, @ApiParam(value = "下载文件类型", required = true) @RequestParam Integer type) {
+    public Result fileDownload(@ApiParam(value = "任务id", required = true) @RequestParam Long id, @ApiParam(value = "下载文件类型", required = true) @RequestParam DownloadFileEnum type) {
         if (Objects.isNull(id) || Objects.equals(id, "")) {
             throw new BusinessException(ExceptionResultEnum.TASK_ID_IS_NULL);
         }
         if (Objects.isNull(type) || Objects.equals(type, "")) {
             throw new BusinessException(ExceptionResultEnum.DOWNLOAD_FILE_TYPE_IS_NULL);
         }
-        if (Objects.isNull(DownloadFileEnum.convertToName(type))) {
+        if (Objects.isNull(DownloadFileEnum.convertToName(type.getId()))) {
             throw new BusinessException(ExceptionResultEnum.DOWNLOAD_FILE_TYPE_ERROR);
         }
         TBTaskHistory tbTaskHistory = tbTaskHistoryService.getById(id);
@@ -133,7 +134,7 @@ public class SysController {
         }
         boolean oss = dictionaryConfig.sysDomain().isOss();
         JSONObject jsonObject = null;
-        switch (type) {
+        switch (type.getId()) {
             case 0:
                 jsonObject = JSONObject.parseObject(tbTaskHistory.getImportFilePath());
                 break;

+ 1 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TBUserController.java

@@ -667,7 +667,7 @@ public class TBUserController {
     @RequestMapping(value = "/updatePwd", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     @Transactional
-    public Result updatePwd(@ApiJsonObject(name = "userUpdatePwd", value = {
+    public Result userUpdatePwd(@ApiJsonObject(name = "userUpdatePwd", value = {
             @ApiJsonProperty(key = "id", type = "long", example = "1", description = "用户ID"),
             @ApiJsonProperty(key = "password", description = "新密码")
     }) @ApiParam(value = "用户信息", required = true) @RequestBody Map<String, Object> mapParameter) {

+ 1 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamController.java

@@ -178,7 +178,7 @@ public class TEExamController {
     @RequestMapping(value = "/toggle", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     @Transactional
-    public Result toggle(
+    public Result examToggle(
             @ApiJsonObject(name = "examToggle", value = {
                     @ApiJsonProperty(key = "id", type = "long", example = "1", description = "考试批次ID"),
                     @ApiJsonProperty(key = "enable", type = "int", example = "1", description = "是否启用")

+ 1 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TEExamStudentController.java

@@ -91,7 +91,7 @@ public class TEExamStudentController {
     @RequestMapping(value = "/toggle", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     @Transactional
-    public Result toggle(@ApiJsonObject(name = "examStudentToggle", value = {
+    public Result examStudentToggle(@ApiJsonObject(name = "examStudentToggle", value = {
             @ApiJsonProperty(key = "id", type = "long", example = "1", description = "考生ID"),
             @ApiJsonProperty(key = "enable", type = "int", example = "1", description = "是否启用")
     }) @ApiParam(value = "考生信息", required = true) @RequestBody List<Map<String, Object>> mapParameter) {

+ 1 - 1
themis-backend/src/main/java/com/qmth/themis/backend/api/TEStudentController.java

@@ -55,7 +55,7 @@ public class TEStudentController {
     @RequestMapping(value = "/toggle", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "{\"success\":true}", response = Result.class)})
     @Transactional
-    public Result toggle(@ApiJsonObject(name = "studentToggle", value = {
+    public Result studentToggle(@ApiJsonObject(name = "studentToggle", value = {
             @ApiJsonProperty(key = "id", type = "long", example = "1", description = "学生ID"),
             @ApiJsonProperty(key = "enable", type = "long", example = "1", description = "是否启用")
     }) @ApiParam(value = "学生信息", required = true) @RequestBody Map<String, Object> mapParameter) {

+ 0 - 4
themis-business/pom.xml

@@ -80,10 +80,6 @@
 			<groupId>com.github.xiaoymin</groupId>
 			<artifactId>swagger-bootstrap-ui</artifactId>
 		</dependency>
-		<dependency>
-			<groupId>io.springfox</groupId>
-			<artifactId>springfox-swagger-ui</artifactId>
-		</dependency>
 		<dependency>
 			<groupId>com.alibaba</groupId>
 			<artifactId>druid</artifactId>

+ 0 - 16
themis-business/src/main/java/com/qmth/themis/business/enums/DownloadFileEnum.java

@@ -35,22 +35,6 @@ public enum DownloadFileEnum {
         return id;
     }
 
-    /**
-     * 状态转换 toId
-     *
-     * @param value
-     * @return
-     */
-    public static int convertToId(String value) {
-        if (Objects.equals(value.trim(), IMPORTFILE.name())) {
-            return IMPORTFILE.getId();
-        } else if (Objects.equals(value.trim(), ERROR.name())) {
-            return ERROR.getId();
-        } else {
-            return RESULT.getId();
-        }
-    }
-
     /**
      * 状态转换 toName
      *