|
@@ -53,6 +53,7 @@ import java.lang.reflect.Field;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.net.URL;
|
|
import java.net.URL;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
+import java.time.LocalDateTime;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.concurrent.CompletableFuture;
|
|
import java.util.concurrent.CompletableFuture;
|
|
@@ -976,6 +977,9 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
|
|
log.info("IM消息发送完成,问诊单号: {}", orderId);
|
|
log.info("IM消息发送完成,问诊单号: {}", orderId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private PrescriptionRetryRecordMapper prescriptionRetryRecordMapper;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void generatePrescribeImg(){
|
|
public void generatePrescribeImg(){
|
|
log.info("处方图片生成定时任务(生成已支付)开始执行");
|
|
log.info("处方图片生成定时任务(生成已支付)开始执行");
|
|
@@ -983,18 +987,13 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
|
|
|
|
|
|
IFsPrescribeService fsPrescribeService = (IFsPrescribeService) AopContext.currentProxy();
|
|
IFsPrescribeService fsPrescribeService = (IFsPrescribeService) AopContext.currentProxy();
|
|
|
|
|
|
- List<FsPrescribe> fsPrescribes = fsPrescribeDrugMapper.selectPenddingPrescribeImgData();
|
|
|
|
- log.info("待生成处方图片的数据量: {}", fsPrescribes.size());
|
|
|
|
-
|
|
|
|
- for (FsPrescribe fsPrescribe : fsPrescribes) {
|
|
|
|
|
|
+ List<PrescriptionRetryRecord> recordList = prescriptionRetryRecordMapper.selectPendingData();
|
|
|
|
+ for (PrescriptionRetryRecord record : recordList) {
|
|
|
|
+ FsPrescribe fsPrescribe = fsPrescribeMapper.selectFsPrescribeByPrescribeId(record.getPrescriptionId());
|
|
Long prescribeId = fsPrescribe.getPrescribeId();
|
|
Long prescribeId = fsPrescribe.getPrescribeId();
|
|
log.info("开始处理处方单号: {}", prescribeId);
|
|
log.info("开始处理处方单号: {}", prescribeId);
|
|
try {
|
|
try {
|
|
fsPrescribeService.PrescribeImg(prescribeId);
|
|
fsPrescribeService.PrescribeImg(prescribeId);
|
|
-
|
|
|
|
- // 已生成
|
|
|
|
- fsPrescribe.setStoreOrderPaid(2);
|
|
|
|
- fsPrescribeMapper.updateFsPrescribe(fsPrescribe);
|
|
|
|
log.info("处方单号: {} 图片生成成功", prescribeId);
|
|
log.info("处方单号: {} 图片生成成功", prescribeId);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
log.error("处方单号: {} 图片生成失败, 错误信息: {}", prescribeId, e.getMessage(), e);
|
|
log.error("处方单号: {} 图片生成失败, 错误信息: {}", prescribeId, e.getMessage(), e);
|
|
@@ -1002,8 +1001,7 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
|
|
}
|
|
}
|
|
|
|
|
|
long endTime = System.currentTimeMillis();
|
|
long endTime = System.currentTimeMillis();
|
|
- log.info("处方图片生成定时(生成已支付)任务结束,共处理{}条数据,总耗时: {}毫秒", fsPrescribes.size(), (endTime - startTime));
|
|
|
|
-
|
|
|
|
|
|
+ log.info("处方图片生成定时(生成已支付)任务结束,共处理{}条数据,总耗时: {}毫秒", recordList.size(), (endTime - startTime));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -1039,7 +1037,15 @@ public class FsPrescribeServiceImpl implements IFsPrescribeService
|
|
fsPrescribeService.PrescribeImg(param.getPrescribeId());
|
|
fsPrescribeService.PrescribeImg(param.getPrescribeId());
|
|
log.info("异步生成处方单图片成功,处方单ID: {}", param.getPrescribeId());
|
|
log.info("异步生成处方单图片成功,处方单ID: {}", param.getPrescribeId());
|
|
} catch (Throwable e) {
|
|
} catch (Throwable e) {
|
|
- log.error("异步生成处方单图片 发生异常 处方单ID: {}, 参数: {}", param.getPrescribeId(), param, e);
|
|
|
|
|
|
+ log.error("异步生成处方单图片 发生异常 处方单ID: {}, 参数: {},已插入队列再次尝试生成", param.getPrescribeId(), param, e);
|
|
|
|
+ PrescriptionRetryRecord record = new PrescriptionRetryRecord();
|
|
|
|
+ record.setUpdateTime(LocalDateTime.now());
|
|
|
|
+ record.setCreateTime(LocalDateTime.now());
|
|
|
|
+ record.setPrescriptionId(param.getPrescribeId());
|
|
|
|
+ record.setRetryCount(1);
|
|
|
|
+ record.setStatus(3);
|
|
|
|
+ record.setErrorReason(JSON.toJSONString(param));
|
|
|
|
+ prescriptionRetryRecordMapper.insert(record);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
|
|
|