|
|
@@ -30,12 +30,15 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.log4j.Log4j2;
|
|
|
import org.apache.commons.lang3.time.DateFormatUtils;
|
|
|
+import org.springframework.mock.web.MockMultipartFile;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.io.File;
|
|
|
+import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
@@ -209,16 +212,30 @@ public class OrderController extends BaseWebController {
|
|
|
log.info(orderId);
|
|
|
//图片检查
|
|
|
try {
|
|
|
- DistinctionDTO dto = distinctionService.checkImg(file,orderId,uidList);
|
|
|
+ DistinctionDTO dto;
|
|
|
+ Integer pos = file.getOriginalFilename().lastIndexOf('.');
|
|
|
+ String suffix = "";
|
|
|
+ if (pos != -1) {
|
|
|
+ suffix = file.getOriginalFilename().substring(pos);
|
|
|
+ }
|
|
|
+ if(suffix.indexOf("mp4") != -1){
|
|
|
+ //视频处理
|
|
|
+ File tempFile = File.createTempFile("temp_", "."+suffix);
|
|
|
+ file.transferTo(tempFile);
|
|
|
+ File imageFile = ossUtils.generateCover(tempFile);
|
|
|
+ MultipartFile tempMultipartFile = new MockMultipartFile(imageFile.getName(), new FileInputStream(imageFile));
|
|
|
+ dto = distinctionService.checkImg(tempMultipartFile,orderId,uidList);
|
|
|
+ tempFile.delete();
|
|
|
+ imageFile.delete();
|
|
|
+ }else{
|
|
|
+ //图片处理
|
|
|
+ dto = distinctionService.checkImg(file,orderId,uidList);
|
|
|
+ }
|
|
|
+
|
|
|
if(dto.getOrderId() ==null){
|
|
|
VaultsResponse<String> vaultsResponse = ossUtils.uploadOneFile(file,orderId);
|
|
|
- log.info(vaultsResponse.getData());
|
|
|
- /* if(vaultsResponse.validate()){
|
|
|
- return orderService.updateOrderUrl(list);
|
|
|
- }*/
|
|
|
dto.setUrl(vaultsResponse.getData());
|
|
|
}
|
|
|
-
|
|
|
return VaultsResponse.success(dto);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|