ClosedParkingLotChannelQueryServiceImpl.java 2.25 KB
package com.zteits.park.biz.closecarpark;

import com.zteits.clouds.api.apibase.bean.BizResult;
import com.zteits.clouds.api.dto.park.dto.ChannelInfoDTO;
import com.zteits.clouds.api.dto.park.dto.closecarpark.ParkingLotChannelRelationDTO;
import com.zteits.clouds.api.dto.park.param.closecarpark.ParkChannelRelationRequest;
import com.zteits.clouds.api.service.park.closecarpark.ClosedParkingLotChannelQueryService;
import com.zteits.park.dao.ChannelDao;
import com.zteits.park.domain.ParkingLotChannel;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 * Copyright: Copyright (c) 2017  zteits
 *
 * @ClassName: ClosedParkingLotChannelQueryServiceImpl.java
 * @Description:
 * @version: v1.0.0
 * @author: zengqc
 * @date: 2021/6/15 10:26
 * Modification History:
 * Date             Author          Version            Description
 * ---------------------------------------------------------*
 * 2021/6/15 10:26      zengqc              v1.0.0               创建
 */
@Service("com.zteits.park.biz.closecarpark.ClosedParkingLotChannelQueryServiceImpl")
public class ClosedParkingLotChannelQueryServiceImpl implements ClosedParkingLotChannelQueryService {

    @Autowired
    private ChannelDao channelDao;

    /**
     * 根据停车场编号,获取对应的通道信息
     */
    @Override
    public BizResult<List<ParkingLotChannelRelationDTO>> queryChannelList(ParkChannelRelationRequest request) {
        ParkingLotChannel parkingLotChannel = new ParkingLotChannel();
        parkingLotChannel.setPlNo(request.getPlNo());
        // 根据停车场编号获取通道信息
        List<ChannelInfoDTO> dtoList = channelDao.tideChannelChoice(parkingLotChannel);

        List<ParkingLotChannelRelationDTO> list = new ArrayList<>();
        dtoList.forEach(dto -> {
            ParkingLotChannelRelationDTO relationDTO = new ParkingLotChannelRelationDTO();
            relationDTO.setChannelId(dto.getId());
            relationDTO.setChannelName(dto.getChannelName());
            relationDTO.setChannelNumber(dto.getChannelNumber());
            relationDTO.setPlNo(dto.getPlNo());

            list.add(relationDTO);
        });

        return new BizResult<>(list);
    }
}