From 0ed7565f58212628bf89b4666455344be363ae75 Mon Sep 17 00:00:00 2001 From: anthonywj Date: Thu, 27 Apr 2023 14:33:23 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/constant/BasicExportTypeEnum.java | 2 +- .../admin/constant/BasicProcessStatus.java | 2 +- .../sale/admin/res/sync/BaseSyncResponse.java | 2 +- .../sale/admin/thread/DlAllDataService.java | 23 +++++++++++++------ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicExportTypeEnum.java b/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicExportTypeEnum.java index e8d5651..779b8f5 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicExportTypeEnum.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicExportTypeEnum.java @@ -15,7 +15,7 @@ public enum BasicExportTypeEnum { /** * 国家库DI数据 */ - COUNTRY_DI_DATA("country_di_data", "国家库DI数据"), +// COUNTRY_DI_DATA("country_di_data", "国家库DI数据"), /** * 单据类型 diff --git a/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicProcessStatus.java b/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicProcessStatus.java index f2a6e54..e1c8de1 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicProcessStatus.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/constant/BasicProcessStatus.java @@ -33,7 +33,7 @@ public class BasicProcessStatus { public static final String NEW_ALL_DATA = "7"; public static final String NEW_ALL_BUS = "8"; public static final String NEW_ALL_ORDER = "出入库扫码单据"; - public static final String NEW_ALL_UDIS = "10"; + public static final String NEW_ALL_UDIS = "国家库数据"; public static final String ALL_BUS_ORDER = "业务单据"; diff --git a/api-admin/src/main/java/com/glxp/sale/admin/res/sync/BaseSyncResponse.java b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/BaseSyncResponse.java index 6e97157..7029aec 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/res/sync/BaseSyncResponse.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/res/sync/BaseSyncResponse.java @@ -8,7 +8,7 @@ import java.util.List; public class BaseSyncResponse { private String taskId; - private List files; + private List syncFiles; private List uploadFiles; private String updateTime; private String type; diff --git a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java index d9509fd..e06fbde 100644 --- a/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java +++ b/api-admin/src/main/java/com/glxp/sale/admin/thread/DlAllDataService.java @@ -31,12 +31,16 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; +import java.awt.*; import java.io.File; import java.io.FileWriter; import java.io.IOException; +import java.util.ArrayList; import java.util.Date; import java.util.List; +import static com.glxp.sale.admin.constant.BasicProcessStatus.NEW_ALL_UDIS; + @Slf4j @Service public class DlAllDataService { @@ -168,7 +172,6 @@ public class DlAllDataService { if (systemParamConfigEntity.getParamValue().equals("1")) { SystemParamConfigEntity downstream = systemParamConfigService.selectByParamKey("sync_downstream_enable"); for (BasicExportStatusEntity basicExportStatusEntity : basicExportStatusEntities) { - BaseResponse baseResponse = null; SpsSyncDataRequest spsSyncDataRequest = new SpsSyncDataRequest(); if (basicExportStatusEntity.getFromType() == 0) { @@ -257,6 +260,12 @@ public class DlAllDataService { String dataStr = obj.getStr("data"); if (StrUtil.isNotBlank(dataStr)) { RelaySyncDto bean = JSONUtil.toBean(dataStr, RelaySyncDto.class); + JSONObject jsonObject = JSONObject.parseObject(bean.getFileContent()); + JSONArray jsonArray = jsonObject.getJSONArray("syncFiles"); + if (jsonArray != null) { + List list = JSONArray.parseArray(jsonArray.toJSONString(), String.class); + idcService.batchDownloadFile(spGetHttp.getSpmsUrl(), list.toArray(new String[list.size()])); + } if (StrUtil.isNotBlank(bean.getTaskId())) { // 将数据写入文件 try { @@ -335,7 +344,7 @@ public class DlAllDataService { BasicExportStatusRequest basicExportStatusRequest = new BasicExportStatusRequest(); basicExportStatusRequest.setIdDatas(ConstantStatus.SYNC_DI_PRODUCTS); basicExportStatusRequest.setStatus(BasicExportStatusEnum.WAIT_BUILT.getCode()); - basicExportStatusRequest.setType(BasicExportTypeEnum.COUNTRY_DI_DATA.getRemark()); + basicExportStatusRequest.setType(NEW_ALL_UDIS); basicExportStatusRequest.setScheduleType(BasicProcessStatus.SCHEDULE_NORMAL); BaseResponse> basicStatuss = spGetHttp.getBasicStatus(basicExportStatusRequest); if (CollUtil.isNotEmpty(basicStatuss.getData())) { @@ -365,14 +374,14 @@ public class DlAllDataService { myEntity.setStatus(0); myEntity.setIdDatas(ConstantStatus.SYNC_DI_PRODUCTS); myEntity.setUpdateTime(new Date()); - myEntity.setType(BasicExportTypeEnum.COUNTRY_DI_DATA.getRemark()); + myEntity.setType(NEW_ALL_UDIS); myEntity.setStartTime(DateUtil.getDateTime()); myEntity.setRemark("国家库DI信息:" + spSyncUdiResponse.getProductInfoEntityList().size() + " 条"); basicExportService.insertExportStatus(myEntity); if (downstream.getParamValue().equals("1")) { // String datas = JSON.toJSON(spSyncUdiResponse).toString(); // redisUtil.set(key, datas); - String fileName = filePath + "upload/" + BasicExportTypeEnum.COUNTRY_DI_DATA.getRemark() + "-" + key + ".udi"; + String fileName = filePath + "upload/" + NEW_ALL_UDIS + "-" + key + ".udi"; String datas = JSON.toJSON(spSyncUdiResponse).toString(); FileUtils.SaveFileAs(datas, fileName); @@ -422,7 +431,7 @@ public class DlAllDataService { myEntity.setTaskId(basicExportStatusEntity.getId()); myEntity.setStatus(0); myEntity.setUpdateTime(new Date()); - myEntity.setType(BasicProcessStatus.NEW_ALL_UDIS); + myEntity.setType(NEW_ALL_UDIS); myEntity.setStartTime(DateUtil.getDateTime()); myEntity.setUpdateTime(new Date()); myEntity.setIdDatas(ConstantStatus.SYNC_DI_PRODUCTS); @@ -431,7 +440,7 @@ public class DlAllDataService { if (downstream.getParamValue().equals("1")) { // String datas = JSON.toJSON(spSyncUdiResponse).toString(); // redisUtil.set(key, datas); - String fileName = filePath + "upload/" + BasicProcessStatus.NEW_ALL_UDIS + "-" + key + ".udi"; + String fileName = filePath + "upload/" + NEW_ALL_UDIS + "-" + key + ".udi"; String datas = JSON.toJSON(spSyncUdiResponse).toString(); FileUtils.SaveFileAs(datas, fileName); myEntity.setStatus(Constant.SYNC_STATUS_WAIT_DL); @@ -479,7 +488,7 @@ public class DlAllDataService { myEntity.setStartTime(DateUtil.getDateTime()); myEntity.setIdDatas(ConstantStatus.SYNC_DI_PRODUCTS); myEntity.setTransportType(BasicProcessStatus.INTERFACE_TYPE); - myEntity.setType(BasicProcessStatus.NEW_ALL_UDIS); + myEntity.setType(NEW_ALL_UDIS); myEntity.setRemark("国家库DI信息:" + spSyncUdiResponse.getUdiCompanyEntities().size() + " 条\n" + "医疗器械注册人信息:" + spSyncUdiResponse.getUdiCompanyEntities().size() + "条\n"); basicExportService.insertExportStatus(myEntity);