diff --git a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java index 7b714423..48c7b085 100644 --- a/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java +++ b/src/main/java/com/glxp/api/controller/sync/SpsSyncDownloadController.java @@ -117,19 +117,25 @@ public class SpsSyncDownloadController { @AuthRuleAnnotation("") @GetMapping("sps/sync/order") public BaseResponse getOrder(SpsSyncDataRequest spsSyncDataRequest) { - BaseResponse baseResponse = spsSyncDownloadService.findOrder(spsSyncDataRequest); BasicExportStatusEntity basicExportStatusEntity = basicExportService.findByData(ConstantStatus.SYNC_SCAN_ORDER, 3); String logs = ""; - if (basicExportStatusEntity != null&&StrUtil.isBlank(basicExportStatusEntity.getCacheFilePath())) { - String fileFullPath = null; - try { - fileFullPath = writeFile(filePrefix, BasicProcessStatus.NEW_ALL_BUS_ORDER, JSONUtil.toJsonStr(baseResponse.getData())); - } catch (IOException e) { - e.printStackTrace(); + BaseResponse baseResponse = new BaseResponse<>(); + if (basicExportStatusEntity != null) { + if (StrUtil.isBlank(basicExportStatusEntity.getCacheFilePath())) { + baseResponse = spsSyncDownloadService.findOrder(spsSyncDataRequest); + String fileFullPath = null; + try { + fileFullPath = writeFile(filePrefix, BasicProcessStatus.NEW_ALL_BUS_ORDER, JSONUtil.toJsonStr(baseResponse.getData())); + } catch (IOException e) { + e.printStackTrace(); + } + basicExportStatusEntity.setCacheFilePath(fileFullPath); + basicExportStatusEntity.setRemark(baseResponse.getData().getSyncRemark()); + basicExportService.updateExportStatus(basicExportStatusEntity); + } else { + String content = readDataFile(basicExportStatusEntity.getCacheFilePath()); + baseResponse.setData(JSONUtil.toBean(content, SpsSyncOrderResponse.class)); } - basicExportStatusEntity.setCacheFilePath(fileFullPath); - basicExportStatusEntity.setRemark(baseResponse.getData().getSyncRemark()); - basicExportService.updateExportStatus(basicExportStatusEntity); SpsSyncOrderResponse spsSyncOrderResponse = baseResponse.getData(); spsSyncOrderResponse.setTaskId(basicExportStatusEntity.getId()); baseResponse.setData(spsSyncOrderResponse); @@ -378,7 +384,7 @@ public class SpsSyncDownloadController { basicDownloadService.insertDownloadStatus(downloadStatus); return ResultVOUtils.success(); } catch (Exception e) { - log.error("",e); + log.error("", e); e.printStackTrace(); return ResultVOUtils.error(ResultEnum.NOT_NETWORK, e.getMessage()); }