|
@@ -142,12 +142,12 @@ public class CollectApi {
|
|
|
* @param fileName
|
|
|
* @param request
|
|
|
* @param response
|
|
|
- * @throws IOException
|
|
|
+ * @throws Exception
|
|
|
*/
|
|
|
@RequestMapping(value = "file/ms-slice/{workId}/{subjectId}/{fileName}", method = { RequestMethod.PUT, RequestMethod.POST })
|
|
|
public void upload(@PathVariable Long workId,@PathVariable Integer subjectId,
|
|
|
@PathVariable String fileName,
|
|
|
- HttpServletRequest request,HttpServletResponse response) throws IOException{
|
|
|
+ HttpServletRequest request,HttpServletResponse response) throws Exception{
|
|
|
InputStream inputStream = request.getInputStream();
|
|
|
Student student = studentRepo.findByWorkIdAndExamNumber(workId,fileName);
|
|
|
Subject subject = Subject.values()[subjectId-1];
|
|
@@ -171,7 +171,7 @@ public class CollectApi {
|
|
|
FileInputStream in = new FileInputStream(outFile);
|
|
|
String sliceMD5 = DigestUtils.md5Hex(in);
|
|
|
if(!md5.equalsIgnoreCase(sliceMD5)){
|
|
|
- throw new RuntimeException("图片md5值不一致");
|
|
|
+ throw new Exception("图片md5值不一致");
|
|
|
}
|
|
|
in.close();
|
|
|
// ImageCompression.imageThumbnail(outFile,new File(thumbFileName),compressionConfig);
|
|
@@ -200,7 +200,7 @@ public class CollectApi {
|
|
|
@RequestMapping(value = "file/ms-sheet/{workId}/{subjectId}/{fileName}", method = { RequestMethod.PUT, RequestMethod.POST })
|
|
|
public void uploadsheet(@PathVariable Long workId,@PathVariable Integer subjectId,
|
|
|
@PathVariable String fileName,
|
|
|
- HttpServletRequest request,HttpServletResponse response) throws IOException{
|
|
|
+ HttpServletRequest request,HttpServletResponse response) throws Exception{
|
|
|
Student student = studentRepo.findByWorkIdAndExamNumber(workId,fileName);
|
|
|
Subject subject = Subject.values()[subjectId-1];
|
|
|
InputStream inputStream = request.getInputStream();
|
|
@@ -213,7 +213,7 @@ public class CollectApi {
|
|
|
FileInputStream in = new FileInputStream(outFile);
|
|
|
String sheetMD5 = DigestUtils.md5Hex(in);
|
|
|
if(!md5.equalsIgnoreCase(sheetMD5)){
|
|
|
- throw new RuntimeException("图片md5值不一致");
|
|
|
+ throw new Exception("图片md5值不一致");
|
|
|
}
|
|
|
in.close();
|
|
|
}
|