|
|
@ -19,10 +19,12 @@ import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
|
|
import com.glxp.api.dao.idc.DbDao;
|
|
|
|
import com.glxp.api.dao.idc.DbDao;
|
|
|
|
import com.glxp.api.idc.service.FileService;
|
|
|
|
import com.glxp.api.idc.service.FileService;
|
|
|
|
|
|
|
|
import com.glxp.api.idc.service.IdcService;
|
|
|
|
import com.glxp.api.idc.utils.IDCUtils;
|
|
|
|
import com.glxp.api.idc.utils.IDCUtils;
|
|
|
|
import com.glxp.api.util.FileUtils;
|
|
|
|
import com.glxp.api.util.FileUtils;
|
|
|
|
|
|
|
|
|
|
|
@ -47,6 +49,8 @@ public class FileServiceImpl implements FileService {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private DbDao dbDao;
|
|
|
|
private DbDao dbDao;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private IdcService idcService;
|
|
|
|
private String imagePath = "register/file/image2/";
|
|
|
|
private String imagePath = "register/file/image2/";
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public BaseResponse fileUpload(HttpServletRequest request,Map<String,Object> params) {
|
|
|
|
public BaseResponse fileUpload(HttpServletRequest request,Map<String,Object> params) {
|
|
|
@ -94,6 +98,19 @@ public class FileServiceImpl implements FileService {
|
|
|
|
return ResultVOUtils.error(9999,"失败");
|
|
|
|
return ResultVOUtils.error(9999,"失败");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public BaseResponse fileDownload(HttpServletRequest request,Map<String,Object> params) {
|
|
|
|
|
|
|
|
Map<String, Object> map = dbDao.get("select * from sync_data_set limit 1");
|
|
|
|
|
|
|
|
if(map!=null&&map.get("syncIp")!=null) {
|
|
|
|
|
|
|
|
String result = IDCUtils.post(map.get("syncIp").toString()+"/spssync/file/downloadFile", params);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return ResultVOUtils.error(9999,"中继服务地址未配置,请至同步设置中进行配置");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ResultVOUtils.success(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public BaseResponse receiveFile(HttpServletRequest request,String content,MultipartFile[] files) {
|
|
|
|
public BaseResponse receiveFile(HttpServletRequest request,String content,MultipartFile[] files) {
|
|
|
|
boolean isRelay = false;
|
|
|
|
boolean isRelay = false;
|
|
|
@ -198,4 +215,34 @@ public class FileServiceImpl implements FileService {
|
|
|
|
return result;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public BaseResponse downloadFile(HttpServletRequest request,Map<String,Object> params) {
|
|
|
|
|
|
|
|
String host = "";
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
Map<String,Object> config =dbDao.get("select paramValue from system_param_config where paramKey='upper_server_ip'");
|
|
|
|
|
|
|
|
if(config!=null&&config.get("paramValue")!=null)
|
|
|
|
|
|
|
|
host = config.get("paramValue").toString();
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!StringUtils.isEmpty(host)) {
|
|
|
|
|
|
|
|
String result = IDCUtils.post(host+"/spssync/file/downloadFile", params);
|
|
|
|
|
|
|
|
JSONObject object = JSON.parseObject(result);
|
|
|
|
|
|
|
|
boolean success = false;
|
|
|
|
|
|
|
|
if(object.getInteger("code")==20000) {
|
|
|
|
|
|
|
|
String[] files = params.get("fileName").toString().split(",");
|
|
|
|
|
|
|
|
success = true;
|
|
|
|
|
|
|
|
for(String str:files) {
|
|
|
|
|
|
|
|
if(!idcService.signleDownloadFile(host, str))
|
|
|
|
|
|
|
|
success = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!success)
|
|
|
|
|
|
|
|
ResultVOUtils.error(9999,"失败");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ResultVOUtils.success(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|