diff --git a/src/main/java/com/ann/job/ScheduledJob.java b/src/main/java/com/ann/job/ScheduledJob.java index 961eea4..2294c7c 100644 --- a/src/main/java/com/ann/job/ScheduledJob.java +++ b/src/main/java/com/ann/job/ScheduledJob.java @@ -12,6 +12,7 @@ import org.quartz.Scheduler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.StopWatch; import java.time.LocalTime; import java.util.List; @@ -40,8 +41,14 @@ public class ScheduledJob implements Job { try { //System.out.println("动态的定时任务1执行时间:" + LocalTime.now()); QuartzUtils.pauseScheduleJob(scheduler, "group1", "job5"); + logger.error("下载任务开始"); + long start = System.currentTimeMillis(); List all = messageSubordinateService.findAllByStatus(0); + logger.error("本次调度任务查询待下载时间:" + (System.currentTimeMillis() - start)); + logger.error("本次调度任务需要下载数量:" + all.size()); + long start1 = System.currentTimeMillis(); queueService.doSomething(all); + logger.error("处理下载任务耗时:" + (System.currentTimeMillis() - start1)); } catch (Exception e) { ExceptionPrintUtil.printException(e); // 如果报错-- 捕捉异常 继续执行 diff --git a/src/main/java/com/ann/service/impl/QueueService.java b/src/main/java/com/ann/service/impl/QueueService.java index b5959ea..850b3e7 100644 --- a/src/main/java/com/ann/service/impl/QueueService.java +++ b/src/main/java/com/ann/service/impl/QueueService.java @@ -9,15 +9,14 @@ import com.ann.entity.filing.dto.MessageDto; import com.ann.entity.interfaceEntity.ArchiveMaster; import com.ann.entity.interfaceEntity.InterfaceHisCache; import com.ann.entity.interfaceEntity.MessageLog; -import com.ann.entity.interfaceEntity.ScanningFile; import com.ann.service.*; import com.ann.utils.*; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import org.springframework.util.StopWatch; import java.io.File; import java.util.Date; @@ -49,6 +48,9 @@ public class QueueService { public void doSomething(List all) throws Exception { if (all.size() > 0) { for (MessageSubordinate messageSubordinate : all) { + //获取消息id + String messageId = messageSubordinate.getMessageId(); + logger.error("下载消息id:" + messageId); Integer status = 2; ArchiveDetail archiveDetail = null; try { @@ -65,6 +67,7 @@ public class QueueService { ArchiveMaster archiveMaster = archiveMasterService.findByInpNoAndVisitIdAndIsValid(messageDto.getInpNo(), messageDto.getVisitId()); Date date = new Date(); if (archiveMaster != null) { + long start = System.currentTimeMillis(); /**2021-1-26 等lis程序升级 去掉*/ if (Objects.equals(messageDto.getType(), AliasName.INSPECTION_REPORT) && archiveMaster.getArchiveState().equals("已归档")){ messageSubordinate.setStatus(3); @@ -105,8 +108,10 @@ public class QueueService { messageSubordinateService.save(messageSubordinate); continue; } + logger.error("各种已归档保存信息耗时:"+(System.currentTimeMillis() - start)); String address = messageDto.getReportAddress(); if (address != null && (!address.equals(""))) { + long start1 = System.currentTimeMillis(); // 如果是老数据 if (Objects.equals(messageDto.getIsOld(), "0")) { archiveDetail = new ArchiveDetail(archiveMaster.getId(), date, messageDto.getType(), messageDto.getSource(), messageDto.getApplyId(), messageDto.getDetailType(), 1); @@ -178,9 +183,11 @@ public class QueueService { } } } + logger.error("保存文件数据耗时:"+(System.currentTimeMillis() - start1)); String pdfPath = null; String tempPath = ""; Integer pageNum = 1; + long start2 = System.currentTimeMillis(); if (messageDto.getSource().equals(InterfaceName.NURSE_DATA)) { // 护理单独做处理 boolean saveFlag = false; @@ -251,6 +258,8 @@ public class QueueService { tempPath = messageDto.getDetailType() + "~" + messageDto.getCaptionDateTime() + "~"; } } + logger.error("医生或护士提交保存耗时:"+(System.currentTimeMillis() - start2)); + long start3 = System.currentTimeMillis(); File pdfFile = FileUtils.createFile("pdfs", messageDto.getInpNo(), messageDto.getVisitId(), archiveDetail.getId(), tempPath); if (pdfFile != null) { if (address.endsWith(".pdf") || address.endsWith(".PDF")) { @@ -329,6 +338,7 @@ public class QueueService { archiveDetailService.delete(archiveDetail.getId()); } } + logger.error("文件下载耗时:"+(System.currentTimeMillis() - start3)); } else { messageSubordinate.setRemark("地址为空。。。。"); } @@ -336,7 +346,6 @@ public class QueueService { messageSubordinate.setRemark("住院号为:" + messageDto.getInpNo() + "的ArchiveMaster为空。。。。"); } } - } } } catch (Exception e) { @@ -348,6 +357,7 @@ public class QueueService { archiveDetailService.delete(archiveDetail.getId()); } } + logger.error("messageId:"+messageId+"报错了:" ,e); } messageSubordinate.setStatus(status); diff --git a/src/main/java/com/ann/utils/DownloadUtils.java b/src/main/java/com/ann/utils/DownloadUtils.java index 8b4030c..54c4143 100644 --- a/src/main/java/com/ann/utils/DownloadUtils.java +++ b/src/main/java/com/ann/utils/DownloadUtils.java @@ -217,11 +217,11 @@ public class DownloadUtils { if (Objects.equals(type, AliasName.HANDNUMBNESS_REPORT)) { // 手麻 ftp://10.6.0.75/600/000360639/1/000360639600_1_麻醉_麻醉单_1_1.pdf userName = "mdsd"; - password = "mdsd"; + password = "mdsd!@#2023QWE"; } else if (Objects.equals(type, AliasName.INSPECTION_REPORT)) { // 检验报告 ftp://10.6.1.128:23/LIS/20200228/1003620200228121.pdf userName = "common"; - password = "common"; + password = "wzh@123456"; } else if (Objects.equals(type, AliasName.PETCT_REPORT)) { //petct报告 ftp:\\10.2.1.25:2121\201909\21\E19090279\E19090279_FT200_161712285.pdf userName = "view"; @@ -229,7 +229,7 @@ public class DownloadUtils { } else if (Objects.equals(type, AliasName.BLOODAPPLY_REPORT)) { // 输血 ftp://10.6.1.128/tmis/10_000526962900_9_LCFXD191021010_临床发血单.PDF userName = "common"; - password = "common"; + password = "wzh@123456"; } else if (Objects.equals(type, AliasName.ICU_REPORT)) { // icu ftp://10.6.0.241/fallSheets/徐晓峰-988874-2020-02-25 - 2020-03-21.pdf; userName = "zingicu"; @@ -241,7 +241,7 @@ public class DownloadUtils { }else if(Objects.equals(type, AliasName.OTHER_REPORT)) { // 2020-8-18 后续接入的报告 统一走ftp、固定账号密码common/common userName = "common"; - password = "common"; + password = "wzh@123456"; }else { // 电子病历 // ftp://10.6.0.155/2020-01-25/000593857900_1_000593857900_0_4_EMR06.02.04_3_5_0.pdf