zhangjinli 3 years ago
parent 8f2c65efee
commit 02bb0cc84c

@ -172,7 +172,11 @@
<artifactId>poi</artifactId>
<version>5.2.2</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-all-deps</artifactId>
<version>3.3.1</version>
</dependency>
</dependencies>
<build>

@ -28,10 +28,12 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import ws.schild.jave.MultimediaObject;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
@ -89,10 +91,11 @@ public class UtilsController {
JSONObject res = new JSONObject();
res.put("fileName", fileName);
res.put("fileUrl", "/upload/" + newFileName);
res.put("duration",new MultimediaObject(dest).getInfo().getDuration());
res.put("fileType", FileTypeUtil.getcontentType((fileName.substring(fileName.lastIndexOf(".")))));
res.put("fileTypeNum", FileTypeUtil.getcontentTypeNum((fileName.substring(fileName.lastIndexOf(".")))));
return Result.success(res, "上传完成");
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
return Result.fail(HttpStatusEnum.CUSTOM_EXCEPTION, "上传失败");
@ -134,10 +137,11 @@ public class UtilsController {
res.replace("errno", 0);
JSONObject obj = new JSONObject();
obj.put("alt", fileName);
obj.put("duration",new MultimediaObject(dest).getInfo().getDuration());
obj.put("url", cdn + "/upload/" + newFileName);
res.put("data", obj);
return res;
} catch (IOException e) {
} catch (Exception e) {
e.printStackTrace();
}
res.put("message", "上传失败");
@ -164,4 +168,5 @@ public class UtilsController {
List<RankListVo> rankUserList = qywxDepartmentUserLinkMapper.getUserRankList(queryWrapper);
return Result.success(rankUserList);
}
}

Loading…
Cancel
Save