eight
2024-10-17 e8d835496ca0a82cbd291130ec3e4cc77baf738b
大屏数据 update
已修改4个文件
101 ■■■■■ 文件已修改
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/MySpringEventListener.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/config/MySpringEventListener.java
@@ -49,6 +49,7 @@
        bigScreenConfig.setWaitingSize( waitingSize);
        bigScreenConfig.setPassedSize( passedSize);
        callingScreenService.setBigScreenConfig(bigScreenConfig);
        callingScreenService.getDisplayColInfo();
        String strOpenCloseTime = configApi.getConfigValueByKey(ECG_OPENING_TIME_KEY);
        List<LocalTime> list = Utils.parseOpeningTime(strOpenCloseTime);
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/controller/admin/callingscreen/CallingScreenController.java
@@ -13,6 +13,7 @@
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 lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
@@ -32,21 +33,39 @@
@RestController
@RequestMapping("/ecg/screen")
@Validated
@Slf4j
public class CallingScreenController {
    @Resource
    private CallingScreenService callingScreenService;
    @GetMapping("/display-col-info")
    @Operation(summary = "显示列信息")
    @PermitAll
    public CommonResult<Map<Integer, List<String>>> displayColInfo()
    {
        Map<Integer, List<String>> map = callingScreenService.getDisplayColInfo();
        return success( map );
    }
    @GetMapping("/big-screen-data")
    @Operation(summary = "大屏叫号数据")
    @PermitAll
    public CommonResult<Map<Integer, List<ScreenQueueRespVO>>> callingData()
    public CommonResult<Map<Integer, Map<Integer, List<ScreenQueueRespVO>>>> callingData()
    {
        Map<Integer, List<QueueDO>> map = callingScreenService.callingData();
        Map<Integer, Map<Integer, List<QueueDO>>> map = callingScreenService.callingData();
        Map<Integer, List<ScreenQueueRespVO>> mapVO = new HashMap<>();
        map.keySet().forEach( key -> {
            mapVO.put(key, BeanUtils.toBean(map.get(key), ScreenQueueRespVO.class));
        Map<Integer, Map<Integer, List<ScreenQueueRespVO>>> mapVO = new HashMap<>();
        map.keySet().forEach( displayCol -> {
            log.info("dispayCol: " + displayCol);
            Map<Integer, List<QueueDO>> mapSoltQueueDO = map.get(displayCol);
            Map<Integer, List<ScreenQueueRespVO>> mapSoltQueueVO = new HashMap<>();
            mapSoltQueueDO.keySet().forEach( displaySlot -> {
                log.info("displaySlot: " + displaySlot);
                mapSoltQueueVO.put(displaySlot, BeanUtils.toBean(mapSoltQueueDO.get(displaySlot), ScreenQueueRespVO.class));
            });
            mapVO.put(displayCol, mapSoltQueueVO);
        });
        return success( mapVO );
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenService.java
@@ -23,7 +23,8 @@
    void setBigScreenConfig(BigScreenConfig bigScreenConfig);
    Map<Integer, List<QueueDO>> callingData();
    Map<Integer, List<String>> getDisplayColInfo();
    Map<Integer, Map<Integer, List<QueueDO>>> callingData();
    Map<Integer, List<QueueDO>> callingData2();
    List<QueueDO> getRoomQueue(String ip, List<Integer> statusList);
jh-module-ecg/jh-module-ecg-biz/src/main/java/cn/lihu/jh/module/ecg/service/callingscreen/CallingScreenServiceImpl.java
@@ -39,9 +39,9 @@
    BigScreenConfig bigScreenConfig;
    Map<Integer, Integer> mapCheckTypeVsDisplayColumn = null;
    Map<Integer, List<CheckTypeDO>> mapDisplayColName = null;
    Map<Integer, List<QueueDO>> mapDisplaySlotVsCallingData = new HashMap<>();
    Map<Integer, Integer> mapCheckTypeVsDisplayColumn = null;
    Integer waitingFrom = 0;
    Integer passedFrom = 0;
@@ -51,13 +51,39 @@
        this.bigScreenConfig = bigScreenConfig;
    }
    @Override
    public Map<Integer, List<QueueDO>> callingData() {
        if (null == mapCheckTypeVsDisplayColumn) {
            getDisplayColumnConfig();
        } else {
            mapDisplaySlotVsCallingData.values().stream().forEach(slotQueueList -> slotQueueList.clear());
    public Map<Integer, List<String>> getDisplayColInfo() {
        if (null == mapDisplayColName) {
            CheckTypePageReqVO checkTypePageReqVO = new CheckTypePageReqVO();
            checkTypePageReqVO.setPageSize(-1);
            PageResult<CheckTypeDO> pageResult = checkTypeMapper.selectPage(checkTypePageReqVO);
            mapDisplayColName = pageResult.getList().stream().collect(Collectors.groupingBy(CheckTypeDO::getCallingColumn));
            mapCheckTypeVsDisplayColumn = pageResult.getList().stream().collect(Collectors.toMap(CheckTypeDO::getValue, item -> item.getCallingColumn()));
        }
        Map<Integer, List<String>> _map = new HashMap<>();
        mapDisplayColName.keySet().forEach(key -> {
            _map.put(key, mapDisplayColName.get(key).stream().map(item->item.getName()).toList());
        });
        return _map;
    }
    @Override
    public Map<Integer, Map<Integer, List<QueueDO>>> callingData() {
        Map<Integer, Map<Integer, List<QueueDO>>> mapDisplayColQueue = new HashMap<>();
        int displayColCnt = (int) mapCheckTypeVsDisplayColumn.values().stream().distinct().count();
        for (int dispCol=0; dispCol<displayColCnt; dispCol++) {
            Map<Integer, List<QueueDO>> mapSoltQueueData = new HashMap<>();
            mapSoltQueueData.put(0, new ArrayList<>());
            mapSoltQueueData.put(1, new ArrayList<>());
            mapSoltQueueData.put(2, new ArrayList<>());
            mapDisplayColQueue.put(dispCol, mapSoltQueueData);
        }
        mapDisplayColQueue.values().stream().forEach(mapSlotQueue -> {
            mapSlotQueue.values().stream().forEach(queueList -> queueList.clear());
        });
        List<Integer> queueStatusList = new ArrayList<>();
        queueStatusList.add(QueueStatusEnum.READY.getStatus());
@@ -67,12 +93,14 @@
        queueStatusList.add(QueueStatusEnum.PASSED.getStatus());
        List<QueueDO> queueDOList = queueMapper.getQueueByStatus( queueStatusList );
        queueDOList.stream().forEach(queueDO -> {
            List<QueueDO> listSolt = getDisplatSlotByQueue( queueDO.getBookCheckType(), queueDO.getStatus());
            listSolt.add( queueDO );
            Map<Integer, List<QueueDO>> mapSlotQueue = mapDisplayColQueue.get(mapCheckTypeVsDisplayColumn.get(queueDO.getBookCheckType()));
            List<QueueDO> soltList = mapSlotQueue.get(getDisplatSlotByQueueStatus(queueDO.getStatus()));
            soltList.add( queueDO );
        });
        mapDisplaySlotVsCallingData.values().stream().forEach(slotQueueList -> slotQueueList.sort(null));
        return mapDisplaySlotVsCallingData;
        mapDisplayColQueue.values().stream().forEach(mapSoltQueue -> mapSoltQueue.values().stream().forEach(
                slotQueueList -> slotQueueList.sort((o1, o2) -> o1.getSeqNum() - o2.getSeqNum())));
        return mapDisplayColQueue;
    }
    @Override
@@ -129,24 +157,6 @@
        Long roomId = optionalQueueDO.get().getRoomId();
        List<QueueDO> queueDOList = queueMapper.getRoomQueueByStatus(roomId, statusList);
        return queueDOList;
    }
    private void getDisplayColumnConfig() {
        CheckTypePageReqVO checkTypePageReqVO = new CheckTypePageReqVO();
        checkTypePageReqVO.setPageSize(-1);
        PageResult<CheckTypeDO> pageResult = checkTypeMapper.selectPage(checkTypePageReqVO);
        mapCheckTypeVsDisplayColumn = pageResult.getList().stream().collect(Collectors.toMap(CheckTypeDO::getValue, item -> item.getCallingColumn()));
        int displayColCnt = (int) mapCheckTypeVsDisplayColumn.values().stream().distinct().count();
        for (int i=0; i<displayColCnt; i++) {
            mapDisplaySlotVsCallingData.put(i*1000 + 0, new ArrayList<>());
            mapDisplaySlotVsCallingData.put(i*1000 + 1, new ArrayList<>());
            mapDisplaySlotVsCallingData.put(i*1000 + 2, new ArrayList<>());
        }
    }
    private List<QueueDO> getDisplatSlotByQueue( Integer checkType, Integer queueStatus ) {
        return mapDisplaySlotVsCallingData.get(mapCheckTypeVsDisplayColumn.get(checkType)*1000 + getDisplatSlotByQueueStatus(queueStatus));
    }
    private Integer getDisplatSlotByQueueStatus( Integer queueStatus ) {