jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/Constants.java
@@ -1,6 +1,11 @@ package cn.lihu.jh.module.ecg; public interface Constants { /** * é 置项 */ static final String ECG_OPENING_TIME_KEY = "ecg.openingtime"; static final String ECG_ROOM_RESET_TIME_KEY = "ecg.room.reset.time"; static final String ECG_SCREEN_PANE_WAITING_KEY = "ecg.screen.pane.waiting"; @@ -8,5 +13,11 @@ static final String DEV_CODE_CHOICE = "dev.code.choice"; static final String BOOK_TIMESLOT_LENGTH = "book.timeslot.length"; static final String BOOK_TIMESLOT_LIST = "book.timeslot.list"; //static final String BOOK_TIMESLOT_LIST = "book.timeslot.list"; /** * åå ¸é¡¹ */ static final String ECG_BOOK_TIMESLOT = "ecg_book_timeslot"; } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/config/ECGConfigController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,49 @@ package cn.lihu.jh.module.ecg.controller.admin.config; import cn.lihu.jh.framework.common.pojo.CommonResult; import cn.lihu.jh.module.ecg.controller.admin.config.vo.TimeslotVO; import cn.lihu.jh.module.ecg.controller.admin.queuesequence.vo.QueueSequenceSaveReqVO; import cn.lihu.jh.module.ecg.service.config.EcgConfigService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.annotation.security.PermitAll; import javax.validation.Valid; import java.time.LocalTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.List; import static cn.lihu.jh.framework.common.pojo.CommonResult.success; @Tag(name = "管çåå° - ä¸å¡é ç½®") @RestController @RequestMapping("/ecg/biz-config") @Validated public class ECGConfigController { @Resource private EcgConfigService ecgConfigService; @GetMapping("/list-timeslot") @Operation(summary = "é¢çº¦æ¶é´æ®µå表") @PermitAll public CommonResult<List<LocalTime>> listTimeslot(@Valid @RequestBody QueueSequenceSaveReqVO createReqVO) { List<LocalTime> localTimeList = ecgConfigService.listTimeslot(); List<TimeslotVO> timeslotVOList = new ArrayList<>(); localTimeList.forEach( localTime -> { TimeslotVO timeslotVO = new TimeslotVO(); DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm"); timeslotVO.setLabel( localTime.format(dateTimeFormatter)); timeslotVO.setValue( localTime.getHour()*100 + localTime.getMinute() ); timeslotVOList.add( timeslotVO ); }); return success(ecgConfigService.listTimeslot()); } } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/config/vo/TimeslotVO.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,10 @@ package cn.lihu.jh.module.ecg.controller.admin.config.vo; import lombok.Data; @Data public class TimeslotVO { private String label; private Integer value; } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigService.java
@@ -1,5 +1,10 @@ package cn.lihu.jh.module.ecg.service.config; import java.time.LocalTime; import java.util.List; public interface EcgConfigService { void resetScheduler(); void readTimeSlotConfig(); List<LocalTime> listTimeslot(); } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/config/EcgConfigServiceImpl.java
@@ -2,6 +2,7 @@ import cn.lihu.jh.module.ecg.Utils; import cn.lihu.jh.module.ecg.config.DynamicSchedulingConfig; import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO; import cn.lihu.jh.module.ecg.dal.mysql.queuesequence.QueueSequenceMapper; import cn.lihu.jh.module.ecg.service.queue.QueueService; import cn.lihu.jh.module.ecg.service.queuesequence.QueueSequenceService; @@ -18,11 +19,7 @@ import javax.annotation.Resource; import java.time.LocalTime; import java.util.List; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; import static cn.lihu.jh.module.ecg.Constants.ECG_OPENING_TIME_KEY; import static cn.lihu.jh.module.ecg.Constants.ECG_ROOM_RESET_TIME_KEY; import static cn.lihu.jh.module.ecg.Constants.*; @Service @Validated @@ -40,6 +37,8 @@ @Resource private QueueSequenceService queueSequenceService; List<LocalTime> timeslotList = null; ScheduledTask startBizTask = null; ScheduledTask closeBizTask = null; @@ -83,4 +82,16 @@ taskRegistrar.afterPropertiesSet(); } @Override public void readTimeSlotConfig() { String strBookTimeslotLength = configApi.getConfigValueByKey(BOOK_TIMESLOT_LENGTH); //String strBookTimeslotList = configApi.getConfigValueByKey(BOOK_TIMESLOT_LIST); //timeslotList = Utils.parseTimeSlotList(strBookTimeslotList, Integer.valueOf(strBookTimeslotLength)); } @Override public List<LocalTime> listTimeslot() { return timeslotList; } } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceImpl.java
@@ -268,7 +268,6 @@ queueServiceTxFunctions.resetRoom(needCloseBed); queueServiceTxFunctions.bedReload(); queueServiceTxFunctions.monitorInfo(); queueServiceTxFunctions.resetQueueSequenceTable(); }); } jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queue/QueueServiceTxFunctions.java
@@ -459,13 +459,6 @@ log.info(" opening " + openingFlag.get() + " " + monitorInfoVO.getQueueNum() + " " + monitorInfoVO.getActiveQueueNum() + " " + monitorInfoVO.getCheckTypeBedInfo().toString() ); } public void resetQueueSequenceTable() { String strBookTimeslotLength = configApi.getConfigValueByKey(BOOK_TIMESLOT_LENGTH); String strBookTimeslotList = configApi.getConfigValueByKey(BOOK_TIMESLOT_LIST); } private Integer getBedReadyMax(Long roomId, String bedNo) { RoomDO roomDO = roomMapper.getRoom(roomId, bedNo); Integer[] checkTypes = roomDO.getCheckTypes(); jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/queuesequence/QueueSequenceServiceImpl.java
@@ -4,6 +4,8 @@ import cn.lihu.jh.module.ecg.dal.dataobject.checktype.CheckTypeDO; import cn.lihu.jh.module.ecg.dal.mysql.checktype.CheckTypeMapper; import cn.lihu.jh.module.infra.api.config.ConfigApi; import cn.lihu.jh.module.system.api.dict.DictDataApi; import cn.lihu.jh.module.system.api.dict.dto.DictDataRespDTO; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import org.springframework.transaction.annotation.Transactional; @@ -35,6 +37,9 @@ @Resource private ConfigApi configApi; @Resource private DictDataApi dictDataApi; @Resource private QueueSequenceMapper queueSequenceMapper; @@ -90,17 +95,21 @@ // è¯»åæ¶æ®µé ç½® String strBookTimeslotLength = configApi.getConfigValueByKey(BOOK_TIMESLOT_LENGTH); String strBookTimeslotList = configApi.getConfigValueByKey(BOOK_TIMESLOT_LIST); // æ¹æ¡1ï¼é ç½®ä¸å 7:30,8:30,9:30,10:30,11:30,12:30,13:30,14:30,15:30 //String strBookTimeslotList = configApi.getConfigValueByKey(BOOK_TIMESLOT_LIST); //List<LocalTime> timeslotList = Utils.parseTimeSlotList(strBookTimeslotList, Integer.valueOf(strBookTimeslotLength)); List<DictDataRespDTO> dictBookTimeslotList = dictDataApi.getDictDataList(ECG_BOOK_TIMESLOT); // è¯»åææçæ£æ¥ç±»å List<CheckTypeDO> checkTypeDOList = checkTypeMapper.simpleCheckTypeList(); checkTypeDOList.forEach( checkTypeDO -> { List<LocalTime> timeslotList = Utils.parseTimeSlotList(strBookTimeslotList, Integer.valueOf(strBookTimeslotLength)); for (int i=0; i < timeslotList.size(); i++) { LocalTime timeslot = timeslotList.get(i); for (int i=0; i < dictBookTimeslotList.size(); i++) { QueueSequenceDO queueSequenceDO = new QueueSequenceDO(); queueSequenceDO.setCheckType( checkTypeDO.getValue() ); queueSequenceDO.setTimeSlot( timeslot.getHour()*100 + timeslot.getMinute() ); queueSequenceDO.setTimeSlot( Integer.valueOf(dictBookTimeslotList.get(i).getValue()) ); queueSequenceDO.setQueueNo( i * checkTypeDO.getTimeslotBookNum() + checkTypeDO.getTimeslotReservedNum()); queueSequenceDO.setQueueVipNo( i * checkTypeDO.getTimeslotBookNum()); queueSequenceDO.setQueueFull( i * checkTypeDO.getTimeslotBookNum() + checkTypeDO.getTimeslotBookNum());