|
@@ -43,11 +43,18 @@ public class HotIconController {
|
|
|
}
|
|
|
|
|
|
@PostMapping("/add")
|
|
|
- public ResultData add(@RequestParam(required = false) MultipartFile file, @RequestHeader String token) throws IOException {
|
|
|
+ public ResultData add(@RequestParam(required = false) MultipartFile file,
|
|
|
+ @RequestParam(required = false) String iconTitle,
|
|
|
+ @RequestHeader String token) throws IOException {
|
|
|
+ if(file==null || StringUtils.isEmpty(iconTitle)){
|
|
|
+ throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
|
|
|
+ }
|
|
|
+
|
|
|
String iconUrl = uploadService.uploadFile(file, true, "fusion/icon/",null);
|
|
|
|
|
|
String username = JwtUtil.getUsername(token);
|
|
|
HotIcon hotIcon = new HotIcon();
|
|
|
+ hotIcon.setIconTitle(iconTitle);
|
|
|
hotIcon.setIconUrl(iconUrl);
|
|
|
hotIcon.setUserName(username);
|
|
|
if(StringUtils.isEmpty(hotIcon.getIconUrl())){
|
|
@@ -61,7 +68,7 @@ public class HotIconController {
|
|
|
hotIcon.setIconTitle(fileName.substring(0,fileName.lastIndexOf(".")));
|
|
|
}
|
|
|
hotIconService.save(hotIcon);
|
|
|
- return ResultData.ok();
|
|
|
+ return ResultData.ok(hotIcon);
|
|
|
}
|
|
|
|
|
|
@PostMapping("/delete")
|