|
|
@@ -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("问题处理失败"); |