| | |
| | | package cn.lihu.jh.module.ecg.service.queuesequence; |
| | | |
| | | import cn.lihu.jh.module.ecg.Utils; |
| | | 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; |
| | | |
| | | import java.time.LocalTime; |
| | | import java.util.*; |
| | | import cn.lihu.jh.module.ecg.controller.admin.queuesequence.vo.*; |
| | | import cn.lihu.jh.module.ecg.dal.dataobject.queuesequence.QueueSequenceDO; |
| | |
| | | import javax.annotation.Resource; |
| | | |
| | | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.lihu.jh.module.ecg.Constants.*; |
| | | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; |
| | | |
| | | /** |
| | |
| | | public class QueueSequenceServiceImpl implements QueueSequenceService { |
| | | |
| | | @Resource |
| | | private ConfigApi configApi; |
| | | |
| | | @Resource |
| | | private DictDataApi dictDataApi; |
| | | |
| | | @Resource |
| | | private QueueSequenceMapper queueSequenceMapper; |
| | | |
| | | @Resource |
| | | private CheckTypeMapper checkTypeMapper; |
| | | |
| | | @Override |
| | | public Integer createQueueSequence(QueueSequenceSaveReqVO createReqVO) { |
| | |
| | | return queueSequenceMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | } |
| | | @Override |
| | | public void resetQueueSequence() { |
| | | queueSequenceMapper.clearQueueSequenceTable(); |
| | | |
| | | // 读取时段配置 |
| | | String strBookTimeslotLength = configApi.getConfigValueByKey(BOOK_TIMESLOT_LENGTH); |
| | | |
| | | // 方案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 -> { |
| | | |
| | | for (int i=0; i < dictBookTimeslotList.size(); i++) { |
| | | QueueSequenceDO queueSequenceDO = new QueueSequenceDO(); |
| | | queueSequenceDO.setCheckType( checkTypeDO.getValue() ); |
| | | 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()); |
| | | queueSequenceDO.setQueueVipFull( i * checkTypeDO.getTimeslotBookNum() + checkTypeDO.getTimeslotReservedNum()); |
| | | queueSequenceMapper.insert( queueSequenceDO ); |
| | | }; |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |