From 1c889b1c1828c2e82386d202301e2b281071c65c Mon Sep 17 00:00:00 2001 From: anthonyywj2 <353682448@qq.com> Date: Mon, 14 Mar 2022 09:25:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=A4=87=E4=BB=BD=EF=BC=8C?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E5=AF=BC=E5=85=A5=E5=AF=BC=E5=87=BA=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/UdiInfoExportLogController.java | 5 ++- .../admin/thread/BasicGenExcelService.java | 15 +++++++++ .../api/admin/thread/BasicGenJsonService.java | 32 +++++++++++-------- .../admin/thread/BasicUnitImportService.java | 2 ++ 4 files changed, 39 insertions(+), 15 deletions(-) diff --git a/api-admin/src/main/java/com/glxp/api/admin/controller/basic/UdiInfoExportLogController.java b/api-admin/src/main/java/com/glxp/api/admin/controller/basic/UdiInfoExportLogController.java index 384a5455..7ecc98c7 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/controller/basic/UdiInfoExportLogController.java +++ b/api-admin/src/main/java/com/glxp/api/admin/controller/basic/UdiInfoExportLogController.java @@ -8,6 +8,7 @@ import com.glxp.api.admin.req.basic.FilterUdiInfoRequest; import com.glxp.api.admin.req.basic.UdiInfoExportRequest; import com.glxp.api.admin.req.inout.DeleteRequest; import com.glxp.api.admin.res.PageSimpleResponse; +import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse; import com.glxp.api.admin.res.basic.UdiRelevanceResponse; import com.glxp.api.admin.res.basic.UdiRlDlResponse; import com.glxp.api.admin.service.basic.UdiInfoExportLogService; @@ -145,7 +146,9 @@ public class UdiInfoExportLogController { udiInfoExportLogEntity.setType(BasicProcessStatus.EXPORT_SMP); udiInfoExportLogEntity.setDlCount(0); udiInfoExportLogService.insertUdiInfoExportLog(udiInfoExportLogEntity); - basicGenExcelService.uploadProductsSmp(genKey, udiInfoExportRequest); + UdiRelevanceExportJsonResponse exportData = basicGenJsonService.paresDataJson(udiInfoExportRequest); + basicGenExcelService.uploadProductsSmpJson(genKey, exportData); +// basicGenExcelService.uploadProductsSmp(genKey, udiInfoExportRequest); return ResultVOUtils.success("后台正在上传,请稍后刷新查看!"); } diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenExcelService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenExcelService.java index 7e2b58e3..6092249e 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenExcelService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenExcelService.java @@ -7,6 +7,7 @@ import com.glxp.api.admin.constant.ConstantStatus; import com.glxp.api.admin.entity.basic.*; import com.glxp.api.admin.entity.info.SystemParamConfigEntity; import com.glxp.api.admin.req.basic.*; +import com.glxp.api.admin.res.basic.UdiRelevanceExportJsonResponse; import com.glxp.api.admin.res.basic.UdiRelevanceResponse; import com.glxp.api.admin.service.basic.BasicUnitMaintainService; import com.glxp.api.admin.service.basic.CorpExportLogService; @@ -222,6 +223,20 @@ public class BasicGenExcelService { udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity); } + @Async + public void uploadProductsSmpJson(String genKey, UdiRelevanceExportJsonResponse exportData) { + UdiInfoExportLogEntity udiInfoExportLogEntity = udiInfoExportLogService.selectByGenKey(genKey); + String response = HttpClient.uCloudPost(spsSyncUrl + "/udiwms/basic/products/upload", exportData); + BaseResponse baseResponse = JSONObject.parseObject(response, new TypeReference() { + }); + if (baseResponse.getCode() == 20000) { + udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); + } else { + udiInfoExportLogEntity.setRemark(baseResponse.getMessage()); + udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_FAIL); + } + udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity); + } @Async public void uploadProductsSmp(String genKey, UdiInfoExportRequest udiInfoExportRequest) { diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenJsonService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenJsonService.java index 85eb46bb..8f252223 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenJsonService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/BasicGenJsonService.java @@ -80,6 +80,23 @@ public class BasicGenJsonService { @Async public void exportUdiInfoJson(String genKey, UdiInfoExportRequest udiInfoExportRequest) { UdiInfoExportLogEntity udiInfoExportLogEntity = udiInfoExportLogService.selectByGenKey(genKey); + UdiRelevanceExportJsonResponse exportData = paresDataJson(udiInfoExportRequest); + File file = new File(udiInfoExportLogEntity.getFilePath()); + if (!file.exists()) { + try { + file.createNewFile(); + } catch (Exception e) { + log.error("导出医疗器械信息异常", e); + } + } + FileWriter writer = new FileWriter(file); + writer.write(JSONUtil.toJsonStr(exportData)); + udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); + udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity); + } + + + public UdiRelevanceExportJsonResponse paresDataJson(UdiInfoExportRequest udiInfoExportRequest) { UdiRelevanceExportJsonResponse exportData = new UdiRelevanceExportJsonResponse(); //选中导出 if (CollUtil.isNotEmpty(udiInfoExportRequest.getUuids())) { @@ -102,22 +119,9 @@ public class BasicGenJsonService { parseUdiRelevanceResponses(exportData, data); } } - - File file = new File(udiInfoExportLogEntity.getFilePath()); - if (!file.exists()) { - try { - file.createNewFile(); - } catch (Exception e) { - log.error("导出医疗器械信息异常", e); - } - } - FileWriter writer = new FileWriter(file); - writer.write(JSONUtil.toJsonStr(exportData)); - udiInfoExportLogEntity.setStatus(BasicProcessStatus.UDIINFO_IMPORT_SUCCESS); - udiInfoExportLogService.updateUdiInfoExportLog(udiInfoExportLogEntity); + return exportData; } - /** * 解析医疗器械信息查询结果,封装完整数据 * diff --git a/api-admin/src/main/java/com/glxp/api/admin/thread/BasicUnitImportService.java b/api-admin/src/main/java/com/glxp/api/admin/thread/BasicUnitImportService.java index f86358a0..e748b750 100644 --- a/api-admin/src/main/java/com/glxp/api/admin/thread/BasicUnitImportService.java +++ b/api-admin/src/main/java/com/glxp/api/admin/thread/BasicUnitImportService.java @@ -1,6 +1,7 @@ package com.glxp.api.admin.thread; import cn.hutool.extra.pinyin.PinyinUtil; +import com.glxp.api.admin.constant.ConstantStatus; import com.glxp.api.admin.entity.basic.BasicThirdSysDetailEntity; import com.glxp.api.admin.entity.basic.BasicUnitMaintainEntity; import com.glxp.api.admin.entity.thrsys.ThrCorpEntity; @@ -101,6 +102,7 @@ public class BasicUnitImportService { } basicUnitMaintainEntity.setAddr(erpUnitsResponse.getAddr()); basicUnitMaintainEntity.setCreditNo(erpUnitsResponse.getCreditNo()); + basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SP); basicUnitMaintainEntity.setContact(erpUnitsResponse.getContact()); basicUnitMaintainEntity.setMobile(erpUnitsResponse.getMobile()); basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);