Преглед изворни кода

feat: ysy生成处方签名

xdd пре 3 недеља
родитељ
комит
170c26d201

+ 22 - 0
fs-service/src/main/java/com/fs/his/service/impl/PrescriptionTaskRecordServiceImpl.java

@@ -29,11 +29,22 @@ public class PrescriptionTaskRecordServiceImpl implements PrescriptionTaskRecord
      */
     @Override
     public void generatePrescript() {
+        long startTime = System.currentTimeMillis();
+        log.info("处方生成定时任务开始执行");
+
         List<PrescriptionTaskRecord> prescriptionTaskRecords = prescriptionTaskRecordMapper.selectPendingData();
+        log.info("查询到待处理的处方任务记录数量: {}", prescriptionTaskRecords.size());
+
+        int successCount = 0;
+        int failCount = 0;
+
         for (PrescriptionTaskRecord record : prescriptionTaskRecords) {
+            log.info("开始处理处方任务,处方ID: {}", record.getPrescribeId());
+
             try{
                 FsPrescribe fsPrescribe = fsPrescribeService.selectFsPrescribeByPrescribeId(record.getPrescribeId());
                 if(fsPrescribe == null) {
+                    log.warn("处方不存在,处方ID: {}", record.getPrescribeId());
                     throw new IllegalArgumentException(String.format("处方 %d 没有找到!",record.getPrescribeId()));
                 }
                 String prescribeImgUrl = fsPrescribeService.PrescribeImgYsy(record.getPrescribeId());
@@ -42,15 +53,26 @@ public class PrescriptionTaskRecordServiceImpl implements PrescriptionTaskRecord
 
                 record.setPrescribeUrl(prescribeImgUrl);
                 record.setExecuteStatus(2);
+                log.info("处方任务处理成功,处方ID: {}", record.getPrescribeId());
+                successCount++;
+
             }catch (Exception e) {
                 log.error("生成处方 {} 失败!",record.getPrescribeId(),e);
                 record.setExecuteStatus(3);
                 record.setRetryCount(record.getRetryCount()+1);
                 record.setUpdateTime(LocalDateTime.now());
                 record.setErrorMessage(ExceptionUtils.getFullStackTrace(e));
+                failCount++;
+
             }finally {
                 prescriptionTaskRecordMapper.updateById(record);
+                log.info("处方任务记录更新完成,处方ID: {}, 执行状态: {}",
+                        record.getPrescribeId(), record.getExecuteStatus());
             }
         }
+        long endTime = System.currentTimeMillis();
+        long costTime = endTime - startTime;
+        log.info("处方生成定时任务执行完成,总处理: {}条,成功: {}条,失败: {}条,耗时: {}毫秒",
+                prescriptionTaskRecords.size(), successCount, failCount, costTime);
     }
 }