Bläddra i källkod

更新

master
牧羊人 4 år sedan
förälder
incheckning
1080ddc410
2 ändrade filer med 27 tillägg och 22 borttagningar
  1. +1
    -1
      src/main/java/com/taauav/front/dto/inspectquestion/InspectQuestionDealwithDto.java
  2. +26
    -21
      src/main/java/com/taauav/front/service/impl/UserInspectQuestionServiceImpl.java

+ 1
- 1
src/main/java/com/taauav/front/dto/inspectquestion/InspectQuestionDealwithDto.java Visa fil

@@ -16,7 +16,7 @@ public class InspectQuestionDealwithDto {
/**
* 处理图片
*/
private String handlerImage;
private String[] handlerImage;

/**
* 处理结果

+ 26
- 21
src/main/java/com/taauav/front/service/impl/UserInspectQuestionServiceImpl.java Visa fil

@@ -30,6 +30,7 @@ import org.springframework.util.StringUtils;

import java.io.File;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;

@@ -182,29 +183,33 @@ public class UserInspectQuestionServiceImpl extends BaseServiceImpl<UserInspectQ
entity.setStatus(3);

// 如果上传了文件则对文件进行处理
String file = inspectQuestionDealwithDto.getHandlerImage();
if (file.contains("temp")) {
file = file.replace(uploadUrl, uploadFolder);
File oldFile = new File(file);
if (!oldFile.exists()) {
return response.failure("文件不存在");
}
//把文件移动到正式目录下
Calendar date = Calendar.getInstance();
String year = String.valueOf(date.get(Calendar.YEAR));
String month = String.valueOf(date.get(Calendar.MONTH) + 1);
String day = String.valueOf(date.get(Calendar.DATE));
String destFile = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/";
boolean flag = FileUtil.cutGeneralFile(file, destFile);
if (flag) {
// 文件名
String fileName = oldFile.getName();
destFile = destFile.replace(uploadFolder, "");
entity.setHandlerImage(destFile + fileName);
} else {
return response.failure("文件保存失败了");
String[] strings = inspectQuestionDealwithDto.getHandlerImage();
List<String> stringList = new ArrayList<>();
for (String string : strings) {
if (string.contains("temp")) {
String file = string.replace(uploadUrl, uploadFolder);
File oldFile = new File(file);
if (!oldFile.exists()) {
return response.failure("文件不存在");
}
//把文件移动到正式目录下
Calendar date = Calendar.getInstance();
String year = String.valueOf(date.get(Calendar.YEAR));
String month = String.valueOf(date.get(Calendar.MONTH) + 1);
String day = String.valueOf(date.get(Calendar.DATE));
String destFile = uploadFolder + "file/file/" + year + "/" + month + "/" + day + "/";
boolean flag = FileUtil.cutGeneralFile(file, destFile);
if (flag) {
// 文件名
String fileName = oldFile.getName();
destFile = destFile.replace(uploadFolder, "");
stringList.add(destFile + fileName);
} else {
return response.failure("文件保存失败了");
}
}
}
entity.setHandlerImage(org.apache.commons.lang3.StringUtils.join(stringList, ","));
boolean result = editData(entity);
if (!result) {
return response.failure("问题处理失败");

Laddar…
Avbryt
Spara