From 003513b047fcae16e2125ff7a59e6d46ad048ce4 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 16 十月 2025 18:03:36 +0800
Subject: [PATCH] 代码提交
---
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java | 46 +++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 41 insertions(+), 5 deletions(-)
diff --git a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
index b3b8870..d48bf41 100644
--- a/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
+++ b/jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
@@ -94,6 +94,11 @@
}
@Override
+ public List<QueueSequenceDO> selectGivenCheckTypeTimeslot(Integer checkType) {
+ return queueSequenceMapper.selectTimeslotByCheckType( checkType );
+ }
+
+ @Override
public PageResult<QueueSequenceDO> getQueueSequencePage(QueueSequencePageReqVO pageReqVO) {
return queueSequenceMapper.selectPage(pageReqVO);
}
@@ -133,12 +138,27 @@
public Integer distributeSeqNo(Integer checkType, Integer timeslot) {
Integer curSeqNo = queueSequenceMapper.selectQueueNoForUpdate(checkType, timeslot);
if (null == curSeqNo) {
- throw exception(QUEUE_SEQUENCE_TIMESLOT_FULL);
- }
+ // 浠庝笅涓�涓椂娈� 鑾峰彇搴忓彿銆傚師鍥犵郴缁熺敤30鍒嗛挓鐨勯棿闅斿垝鍒嗛绾︽椂闂存锛孒IS鐨勯绾︽椂闂存鍙兘鏄�30鍒嗛挓鎴�60鍒嗛挓
+ Integer nextTimeslot = getNextTimeSlot(timeslot, checkType);
+ if (null == nextTimeslot) {
+ throw exception(QUEUE_SEQUENCE_TIMESLOT_FULL);
+ }
- Integer updateRowNum = queueSequenceMapper.updateGivenCheckTypeTimeslotSeqNo(checkType, timeslot, curSeqNo);
- if (null == updateRowNum || updateRowNum == 0) {
- throw exception(QUEUE_SEQUENCE_TIMESLOT_EXCEPTION);
+ curSeqNo = queueSequenceMapper.selectQueueNoForUpdate(checkType, nextTimeslot);
+ if (null == curSeqNo) {
+ throw exception(QUEUE_SEQUENCE_TIMESLOT_FULL);
+ }
+
+ Integer updateRowNum = queueSequenceMapper.updateGivenCheckTypeTimeslotSeqNo(checkType, nextTimeslot, curSeqNo);
+ if (null == updateRowNum || updateRowNum == 0) {
+ throw exception(QUEUE_SEQUENCE_TIMESLOT_EXCEPTION);
+ }
+
+ } else {
+ Integer updateRowNum = queueSequenceMapper.updateGivenCheckTypeTimeslotSeqNo(checkType, timeslot, curSeqNo);
+ if (null == updateRowNum || updateRowNum == 0) {
+ throw exception(QUEUE_SEQUENCE_TIMESLOT_EXCEPTION);
+ }
}
return curSeqNo + 1;
@@ -160,5 +180,21 @@
return curVipSeqNo + 1;
}
+ private Integer getNextTimeSlot(Integer timeslot, Integer checkType) {
+ List<DictDataRespDTO> dictBookTimeslotList = dictDataApi.getDictDataList(ECG_BOOK_TIMESLOT);
+ Optional<Integer> index = dictBookTimeslotList.stream()
+ .filter(e -> e.getValue().equals(String.valueOf(timeslot)))
+ .findFirst()
+ .map(dictBookTimeslotList::indexOf);
+ if (!index.isPresent())
+ return null;
+
+ if (dictBookTimeslotList.size() <= (index.get() + 1))
+ return null;
+
+ DictDataRespDTO dictDataRespDTO = dictBookTimeslotList.get(index.get() + 1);
+ return Integer.valueOf(dictDataRespDTO.getValue());
+ }
+
}
--
Gitblit v1.9.3