|
@ -149,7 +149,7 @@ public class CommonUtil {
|
|
|
}
|
|
|
return fileUrls;
|
|
|
} else {
|
|
|
String fileUrls = toNeiWang(voices);
|
|
|
String fileUrls = toNeiWang(voices,null);
|
|
|
return fileUrls;
|
|
|
}
|
|
|
}
|
|
@ -217,9 +217,9 @@ public class CommonUtil {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public String copyTempImage(String files) throws Exception {
|
|
|
String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
|
|
|
if (isneiwang) {
|
|
|
// 文件保存的临时路径
|
|
|
String tempPath = SystemConf.getInstance().getTempPath() + File.separator;
|
|
|
String[] fileArray = files.split(",");
|
|
|
FastDFSUtil fastDFSUtil = new FastDFSUtil();
|
|
|
String fileUrls = "";
|
|
@ -246,7 +246,7 @@ public class CommonUtil {
|
|
|
|
|
|
return fileUrls;
|
|
|
} else {
|
|
|
String fileUrls = toNeiWang(files);
|
|
|
String fileUrls = toNeiWang(files,tempPath);
|
|
|
return fileUrls;
|
|
|
}
|
|
|
}
|
|
@ -452,28 +452,30 @@ public class CommonUtil {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
public String toNeiWang(String files) throws FileNotFoundException {
|
|
|
public String toNeiWang(String files,String tempPath) throws FileNotFoundException {
|
|
|
logger.info(" toNeiWang start files :"+tempPath+files);
|
|
|
//转发到内网服务器
|
|
|
String[] fileArray = files.split(",");
|
|
|
String fileUrls = "";
|
|
|
for (String file : fileArray) {
|
|
|
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
|
|
|
File f = new File(file);
|
|
|
File f = new File(tempPath+file);
|
|
|
logger.info(" toNeiWang File exists :"+f.exists());
|
|
|
if (f.exists()) {
|
|
|
String fileName = f.getName();
|
|
|
InputStream in = new FileInputStream(f);
|
|
|
JSONObject result=JSONObject.fromObject(request(request, in, fileName));
|
|
|
String returnStr=request(request, in, fileName);
|
|
|
logger.info("returnStr :"+returnStr);
|
|
|
logger.info("fileName :"+fileName);
|
|
|
logger.info("result :"+result.toString());
|
|
|
if (result != null) {
|
|
|
logger.info("result :"+returnStr.toString());
|
|
|
if (returnStr != null) {
|
|
|
//1.3.7去掉前缀
|
|
|
fileUrls += (StringUtils.isEmpty(fileUrls) ? "" : ",")
|
|
|
+ result.get("groupName").toString().replaceAll("\"", "") + "/"
|
|
|
+ result.get("remoteFileName").toString().replaceAll("\"", "");
|
|
|
fileUrls += returnStr;
|
|
|
f.delete();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
logger.info(" toNeiWang end files :"+fileUrls);
|
|
|
return fileUrls;
|
|
|
}
|
|
|
|
|
@ -511,7 +513,7 @@ public class CommonUtil {
|
|
|
|
|
|
|
|
|
public String request(HttpServletRequest request, InputStream in, String fileName) {
|
|
|
String url = neiwangWlyy + request.getRequestURI();//uri请求路径 http://172.19.103.88/wlyy/upload/chat
|
|
|
String url = neiwangWlyy + "/wlyy/upload/commonUpload";//uri请求路径 http://172.19.103.88/wlyy/upload/chat
|
|
|
|
|
|
CloseableHttpClient httpClient = HttpClientBuilder.create().build();
|
|
|
String result = "";
|