From 9f436e8aa6b692e5d719008e1e0ea1acfe66844e Mon Sep 17 00:00:00 2001 From: wj <1285151836@qq.com> Date: Mon, 8 May 2023 18:19:54 +0800 Subject: [PATCH] =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=90=8C=E6=AD=A5=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sync/SpsSyncDownloadController.java | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) 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()); }