|  |  |  | 
|---|
|  |  |  | package cn.lihu.jh.module.ecg.service.call; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.lihu.jh.module.ecg.dal.dataobject.queue.QueueDO; | 
|---|
|  |  |  | import cn.lihu.jh.module.ecg.dal.dataobject.room.RoomDO; | 
|---|
|  |  |  | import cn.lihu.jh.module.ecg.dal.mysql.room.RoomMapper; | 
|---|
|  |  |  | import org.springframework.stereotype.Service; | 
|---|
|  |  |  | import org.springframework.util.StringUtils; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import cn.lihu.jh.module.ecg.controller.admin.call.vo.*; | 
|---|
|  |  |  | 
|---|
|  |  |  | import cn.lihu.jh.module.ecg.dal.mysql.call.CallMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.annotation.Resource; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.ArrayList; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | import java.util.Optional; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; | 
|---|
|  |  |  | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.*; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private CallMapper callMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Resource | 
|---|
|  |  |  | private RoomMapper roomMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public Integer createCall(CallSaveReqVO createReqVO) { | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public CallDO getNextCall() { | 
|---|
|  |  |  | CallDO callDO = callMapper.getNextCall(); | 
|---|
|  |  |  | CallDO callDO = callMapper.getNextCall(); // 大屏 | 
|---|
|  |  |  | return callDO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public CallDO getNextInstallCall(String reqIp) { | 
|---|
|  |  |  | List<RoomDO> roomDOList = roomMapper.queueByIp(reqIp); | 
|---|
|  |  |  | Optional<RoomDO> optionalQueueDO = roomDOList.stream().filter(item -> StringUtils.hasLength(item.getIp())).findFirst(); | 
|---|
|  |  |  | if (!optionalQueueDO.isPresent()) { | 
|---|
|  |  |  | return  null; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Long roomId = optionalQueueDO.get().getRoomId(); | 
|---|
|  |  |  | CallDO callDO = callMapper.getNextInstallCall( roomId ); // 诊间屏 | 
|---|
|  |  |  | return callDO; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|