附件上传,按照日期存放

master
bmpandlcm 12 months ago
parent 68d8235def
commit 6c42ab9656

@ -57,7 +57,6 @@ public class FileController {
filePath.mkdir();
}
JSONArray from = JSONObject.parseArray(jsonArray);
LogUtil.WriteLog_Info("附件上传接口====jsonArray====" + jsonArray, "FileController");
if (from.size() > 0) {
for (int k = 0; k < from.size(); k++) {
JSONObject map = (JSONObject) from.get(k);

@ -92,7 +92,7 @@ public class HttpClientUtil {
}else{
resultString = "http请求失败";
}
LogUtil.WriteLog_Info("远程接口请求返回code=========" + response.getStatusLine().getStatusCode(), "FileController");
} catch (Exception e) {
e.printStackTrace();
LogUtil.WriteLog_Info("远程接口请求报错HttpClientUtil=========" + e.getMessage(), "FileController");

@ -158,9 +158,13 @@ public class ImageUtils {
mapParam.put("imageBase64", retStr);
jsonA.add(mapParam);
map.put("jsonArray", jsonA.toJSONString());
String s = HttpClientUtil.doPost(fileUploadUrl, map);
LogUtil.WriteLog_Info("ImageUtils====附件上传结果显示END=====" + s, "FileController");
String[] split = fileUploadUrl.split(",");
if (split.length > 0) {
for (String strPath : split) {
String s = HttpClientUtil.doPost(strPath, map);
LogUtil.WriteLog_Info("ImageUtils====附件上传结果显示END==" + strPath + "===" + s, "FileController");
}
}
return retStr;
} catch (Exception e) {
e.printStackTrace();
@ -187,13 +191,14 @@ public class ImageUtils {
return (length % 2 == 0) ? length / 2 : length / 2 + 1;
}
public static int delFile(String fileName, boolean isXunhuan) {
public static int delFile(String fileNameParam, boolean isXunhuan) {
Properties props = System.getProperties();
String os = props.getProperty("os.name").toLowerCase();
String fileAddressLocal = "";
String pathAfter = "";
if (fileName.contains("/")) {
String[] split = fileName.split("/");
String fileName = "";
if (fileNameParam.contains("/")) {
String[] split = fileNameParam.split("/");
if (split.length > 1) {
pathAfter = split[0];
fileName = split[1];
@ -210,9 +215,7 @@ public class ImageUtils {
} else {
// fileAddressLocal = PropertiesUtil.getValue("fileAddressLinux");
}
LogUtil.WriteLog_Info("ImageUtils本地文件地址=====fileAddressLocal====" + fileAddressLocal, "FileController");
File file = new File(fileAddressLocal, fileName); // 指定上传位置
if (file.exists()) {
file.delete();
@ -221,10 +224,15 @@ public class ImageUtils {
String fileDelAddress = PropertiesUtil.getValue("fileDelUrl");
LogUtil.WriteLog_Info("ImageUtil远程删除文件地址=====fileAddressLocal====" + fileDelAddress, "FileController");
Map<String, String> map = new HashMap<String, String>();
map.put("fileName", fileName);
map.put("fileName", fileNameParam);
map.put("canDel", "N");
String s = HttpClientUtil.doPost(fileDelAddress, map);
LogUtil.WriteLog_Info("ImageUtil远程删除文件地址=====执行结果====" + s, "FileController");
String[] split = fileDelAddress.split(",");
if (split.length > 0) {
for (String strPath : split) {
String s = HttpClientUtil.doPost(strPath, map);
LogUtil.WriteLog_Info("ImageUtil远程删除文件地址==" + strPath + "===执行结果====" + s, "FileController");
}
}
}
return 1;
}

Loading…
Cancel
Save