|
|
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.io.File;
|
|
|
import java.io.IOException;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -47,8 +48,22 @@ public class DistinctionServiceImpl extends BaseServiceImpl<DistinctionMapper, D
|
|
|
@Override
|
|
|
public DistinctionDTO checkImg(MultipartFile file, Long orderId, List<String> uidList) throws IOException {
|
|
|
DistinctionDTO dto = new DistinctionDTO();
|
|
|
- MultipartFile newFile = ossUtils.videoConvertImg(file);
|
|
|
- String uid = ImageUtils.readImagePix(newFile.getInputStream());
|
|
|
+ Integer pos = file.getOriginalFilename().lastIndexOf('.');
|
|
|
+ String suffix = "";
|
|
|
+ String uid;
|
|
|
+ if (pos != -1) {
|
|
|
+ suffix = file.getOriginalFilename().substring(pos);
|
|
|
+ }
|
|
|
+ if(suffix.indexOf("mp4") != -1){
|
|
|
+ File tempFile = File.createTempFile("temp_", ".mp4");
|
|
|
+ file.transferTo(tempFile);
|
|
|
+ File outFile = ossUtils.generateCover(tempFile);
|
|
|
+ uid = ImageUtils.readImagePix(outFile);
|
|
|
+ tempFile.delete();
|
|
|
+ outFile.delete();
|
|
|
+ }else{
|
|
|
+ uid = ImageUtils.readImagePix(file.getInputStream());
|
|
|
+ }
|
|
|
dto.setUid(uid);
|
|
|
if("0".equals(orderCacheVal(CgpTool.CACHE_ORDER_PHOTO_CHECK))){
|
|
|
return dto;
|