13 changed files with 188 additions and 49 deletions
@ -0,0 +1,18 @@ |
|||
package com.userinformation.backend.handler; |
|||
|
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.web.bind.annotation.ControllerAdvice; |
|||
import org.springframework.web.bind.annotation.ExceptionHandler; |
|||
import org.springframework.web.bind.annotation.ResponseBody; |
|||
import com.userinformation.backend.util.RequestResult; |
|||
|
|||
@ControllerAdvice |
|||
@Slf4j |
|||
public class GlobalDefaultExceptionHandler { |
|||
@ExceptionHandler(Exception.class) |
|||
@ResponseBody |
|||
public RequestResult defaultExceptionHandler(Exception e) { |
|||
log.error("An error has occurred", e); |
|||
return RequestResult.fail(e.getMessage()); |
|||
} |
|||
} |
@ -0,0 +1,20 @@ |
|||
package com.userinformation.backend.model.vo; |
|||
|
|||
import java.util.List; |
|||
|
|||
import lombok.Data; |
|||
|
|||
/** |
|||
* @describe: 图片接收类 |
|||
* @author: xiaowuler |
|||
* @createTime: 2021-12-05 19:23 |
|||
*/ |
|||
@Data |
|||
public class ImageVO { |
|||
private String model; |
|||
private String station; |
|||
private String elementCode; |
|||
private String type; |
|||
private String time; |
|||
private List<String> urls; |
|||
} |
@ -0,0 +1,19 @@ |
|||
package com.userinformation.backend.util; |
|||
|
|||
import java.io.File; |
|||
|
|||
/** |
|||
* @describe: 文件工具类 |
|||
* @author: xiaowuler |
|||
* @createTime: 2021-12-05 19:36 |
|||
*/ |
|||
public class FileUtil { |
|||
public static void createFolder(String saveFilepath){ |
|||
File file = new File(saveFilepath); |
|||
File parentFile = file.getParentFile(); |
|||
if (parentFile.exists()){ |
|||
return; |
|||
} |
|||
parentFile.mkdirs(); |
|||
} |
|||
} |
Loading…
Reference in new issue