|
@@ -28,7 +28,6 @@ import com.qmth.themis.common.exception.BusinessException;
|
|
import com.qmth.themis.common.util.FileUtil;
|
|
import com.qmth.themis.common.util.FileUtil;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.Result;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
import com.qmth.themis.common.util.ResultUtil;
|
|
-import org.apache.commons.codec.binary.Base64;
|
|
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.apache.commons.lang3.RandomStringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
@@ -37,7 +36,10 @@ import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
-import java.io.*;
|
|
|
|
|
|
+import java.io.ByteArrayOutputStream;
|
|
|
|
+import java.io.File;
|
|
|
|
+import java.io.FilenameFilter;
|
|
|
|
+import java.io.IOException;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -549,13 +551,13 @@ public class TaskExamPaperImportTemplete implements TaskImportTemplete {
|
|
if (("image".equals(type) || "audio".equals(type)) && StringUtils.isNotBlank(value) && !value.toLowerCase()
|
|
if (("image".equals(type) || "audio".equals(type)) && StringUtils.isNotBlank(value) && !value.toLowerCase()
|
|
.startsWith("https://") && !value.toLowerCase().startsWith("http://")) {
|
|
.startsWith("https://") && !value.toLowerCase().startsWith("http://")) {
|
|
if ("image".equals(type) && value.contains("data:image")) {
|
|
if ("image".equals(type) && value.contains("data:image")) {
|
|
- String suff = value.substring(11, value.indexOf(";"));
|
|
|
|
- byte[] bytes = Base64.decodeBase64(value.substring(value.indexOf(",") + 1));
|
|
|
|
- String filePath =
|
|
|
|
- "upload" + File.separator + DateUtil.format(new Date(), Constants.DATE_PATTERN) + File.separator + SystemConstant.getNanoId() + "." + suff;
|
|
|
|
- String md5 = BinaryUtil.toBase64String(BinaryUtil.calculateMd5(bytes));
|
|
|
|
- ossUtil.upload(true, filePath, new ByteArrayInputStream(bytes), md5);
|
|
|
|
- blockInfo.put("value", ossUtil.getAliYunOssPublicDomain().getPublicUrl() + "/" + filePath);
|
|
|
|
|
|
+// String suff = value.substring(11, value.indexOf(";"));
|
|
|
|
+// byte[] bytes = Base64.decodeBase64(value.substring(value.indexOf(",") + 1));
|
|
|
|
+// String filePath =
|
|
|
|
+// "upload" + File.separator + DateUtil.format(new Date(), Constants.DATE_PATTERN) + File.separator + SystemConstant.getNanoId() + "." + suff;
|
|
|
|
+// String md5 = BinaryUtil.toBase64String(BinaryUtil.calculateMd5(bytes));
|
|
|
|
+// ossUtil.upload(true, filePath, new ByteArrayInputStream(bytes), md5);
|
|
|
|
+ blockInfo.put("value", value);
|
|
} else {
|
|
} else {
|
|
String suff = value.substring(value.indexOf("."));
|
|
String suff = value.substring(value.indexOf("."));
|
|
String filePath =
|
|
String filePath =
|