signleDownloadFile文件大于0返回成功

master
chengqf 2 years ago
parent 5653ecac41
commit 1f5141bd98

@ -40,6 +40,7 @@ import com.glxp.api.entity.system.SystemParamConfigEntity;
import com.glxp.api.idc.service.IdcService;
import com.glxp.api.idc.utils.DBAUtils;
import com.glxp.api.idc.utils.IDCUtils;
import com.glxp.api.idc.utils.TableUtils;
import com.glxp.api.req.system.ScheduledRequest;
import com.glxp.api.service.system.SystemParamConfigService;
import com.glxp.api.util.CustomUtil;
@ -1177,10 +1178,11 @@ public class IdcServiceImpl implements IdcService {
.post(body)
.addHeader("Content-Type", "application/x-www-form-urlencoded")
.build();
int total = 0;
try {
Response result = client.newCall(request).execute();
String msg = result!=null ? result.message().length()>200 ? result.message().substring(0,200) : result.message() : "";
int total = 0;
if (result!=null&&result.isSuccessful()&&MediaType.parse("application/force-download").equals(result.body().contentType())) {
try (InputStream inputStream = result.body().byteStream()) {
@ -1219,7 +1221,7 @@ public class IdcServiceImpl implements IdcService {
e.printStackTrace();
}
return true;
return (total>0);
}
/*获取转发服务地址当前值允许单向只使用参数upper_server_ip*/
@ -1293,16 +1295,7 @@ public class IdcServiceImpl implements IdcService {
return systemParamConfigEntity;
}
private void writeFile(byte[] file, String filePath, String fileName) throws Exception {
File targetFile = new File(filePath);
if (!targetFile.exists()) {
targetFile.mkdirs();
}
FileOutputStream out = new FileOutputStream(filePath + fileName);
out.write(file);
out.flush();
out.close();
}
/*把列数据转Map*/
@ -1411,6 +1404,15 @@ public class IdcServiceImpl implements IdcService {
}
}
private void writeFile(byte[] file, String filePath, String fileName) throws Exception {
File targetFile = new File(filePath);
if (!targetFile.exists()) {
targetFile.mkdirs();
}
FileOutputStream out = new FileOutputStream(filePath + fileName);
out.write(file);
out.flush();
out.close();
}
}

Loading…
Cancel
Save