文件下载问题

pro
wj 2 years ago
parent bd8bd6820d
commit 7a3e8b72cb

@ -39,4 +39,6 @@ public interface IdcService {
BaseResponse onceSync(String tableName,boolean isUpload);
boolean signleDownloadFile(String syncIp, String fileName);
boolean batchDownloadFile(String syncIp, String[] files);
}

@ -1145,7 +1145,7 @@ public class IdcServiceImpl implements IdcService {
}
/*下载文件*/
private boolean batchDownloadFile(String syncIp, String[] files) {
public boolean batchDownloadFile(String syncIp, String[] files) {
boolean success = true;
for (String fileName : files) {
if (!StringUtils.isEmpty(fileName)) {

@ -20,4 +20,5 @@ public class SpsSyncBasicDataResponse extends BaseSyncResponse {
List<SupCompanyEntity> supCompanyList;
List<SupManufacturerEntity> supManufacturerList;
List<SupProductEntity> supProductList;
List<String> syncFiles;
}

@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
@ -30,6 +31,7 @@ import com.glxp.api.entity.system.*;
import com.glxp.api.entity.thrsys.*;
import com.glxp.api.http.sync.SpGetHttpClient;
import com.glxp.api.idc.service.FileService;
import com.glxp.api.idc.service.IdcService;
import com.glxp.api.req.sync.SpsSyncDataRequest;
import com.glxp.api.res.sync.*;
import com.glxp.api.service.auth.*;
@ -241,14 +243,14 @@ public class HeartService {
String taskId = CustomUtil.getId();
switch (exportType) {
case BASIC_DATA:
if (needExec(info.getBasicProducts(), info.getBasicCorp(), info.getSupCert())) {
uploadData(exportType, taskId, x -> x.getBasicData(info, taskId, now, syncTime));
}
// if (needExec(info.getBasicProducts(), info.getBasicCorp(), info.getSupCert())) {
// uploadData(exportType, taskId, x -> x.getBasicData(info, taskId, now, syncTime));
// }
break;
case OTHER_DATA:
if (needExec(info.getUdiCodeLost(), info.getUdiCodeRel())) {
uploadData(exportType, taskId, x -> x.getOtherData(info, taskId, now, syncTime));
}
// if (needExec(info.getUdiCodeLost(), info.getUdiCodeRel())) {
// uploadData(exportType, taskId, x -> x.getOtherData(info, taskId, now, syncTime));
// }
break;
case DOCUMENT_TYPE_DATA:
if (needExec(info.getTypeBus(), info.getTypeScan(), info.getTypeThird())) {
@ -1370,6 +1372,8 @@ public class HeartService {
});
if (response.getCode() == 20000 && response.getData() != null) {
JSONArray fileJson = JSONUtil.parseObj(response.getData()).getJSONArray("files");
SpsSyncOrderResponse syncDataResponse = JSONObject.parseObject(response.getData(), new TypeReference<SpsSyncOrderResponse>() {
});
BasicDownloadStatusEntity basicDownloadStatusEntity = new BasicDownloadStatusEntity();
@ -1404,7 +1408,12 @@ public class HeartService {
}
}
}
if (fileJson != null&&fileJson.size()>0) {
List<String> syncFiles = fileJson.toList(String.class);
if (CollUtil.isNotEmpty(syncFiles)) {
idcService.batchDownloadFile(spGetHttp.getIpUrl(), syncFiles.toArray(new String[syncFiles.size()]));
}
}
} catch (Exception e) {
e.printStackTrace();
}
@ -1638,13 +1647,14 @@ public class HeartService {
supProductDao.replaceBatch(supProductList);
}
if (CollUtil.isNotEmpty(syncFiles)) {
fileService.download(syncFiles);
// fileService.download(syncFiles);
idcService.batchDownloadFile(spGetHttp.getIpUrl(), syncFiles.toArray(new String[syncFiles.size()]));
}
}
@Resource
FileService fileService;
private final IdcService idcService;
private final IoCodeLostMapper ioCodeLostMapper;
private final IoCodeRelMapper ioCodeRelMapper;

Loading…
Cancel
Save