|
@@ -5,13 +5,18 @@ import com.om.entity.po.App;
|
|
import com.om.entity.vo.AppVO;
|
|
import com.om.entity.vo.AppVO;
|
|
import com.om.entity.vo.DignosisPageVO;
|
|
import com.om.entity.vo.DignosisPageVO;
|
|
import com.om.service.IAppService;
|
|
import com.om.service.IAppService;
|
|
|
|
+import com.om.utils.HuaweiObsUtil;
|
|
import com.om.utils.Result;
|
|
import com.om.utils.Result;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
+import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import java.io.IOException;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -30,6 +35,9 @@ public class AppController {
|
|
@Resource
|
|
@Resource
|
|
private IAppService appService;
|
|
private IAppService appService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ HuaweiObsUtil huaweiObsUtil;
|
|
|
|
+
|
|
@PostMapping("/add")
|
|
@PostMapping("/add")
|
|
@ApiOperation("新增应用软件")
|
|
@ApiOperation("新增应用软件")
|
|
Result add(@RequestBody AppVO app){
|
|
Result add(@RequestBody AppVO app){
|
|
@@ -37,6 +45,24 @@ public class AppController {
|
|
return appService.add(app);
|
|
return appService.add(app);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation("视频上传接口")
|
|
|
|
+ @PostMapping(value = "/upload",headers="content-type=multipart/form-data")
|
|
|
|
+ public Result video(@RequestParam("file") MultipartFile file,
|
|
|
|
+ HttpServletRequest request,
|
|
|
|
+ @RequestParam("prefix") String prefix) throws IOException {
|
|
|
|
+ MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
|
|
|
|
+ MultipartFile headerImage = multipartRequest.getFile("file");
|
|
|
|
+ String originalFilename = headerImage.getOriginalFilename();
|
|
|
|
+ int lastIndexOf = originalFilename.lastIndexOf(".");
|
|
|
|
+ if (headerImage != null) {
|
|
|
|
+ String fileUrl = huaweiObsUtil.uploadApp(headerImage, prefix +"/"+originalFilename.substring(0,lastIndexOf));
|
|
|
|
+ if (fileUrl == null) return Result.fail("上传失败!");
|
|
|
|
+ else return Result.succ(fileUrl);
|
|
|
|
+ } else {
|
|
|
|
+ return Result.fail("文件不正确!");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
@ApiOperation("删除应用软件")
|
|
@ApiOperation("删除应用软件")
|
|
@DeleteMapping("/delete/{id}")
|
|
@DeleteMapping("/delete/{id}")
|
|
public Result delete(@PathVariable(name = "id") Integer id){
|
|
public Result delete(@PathVariable(name = "id") Integer id){
|