package com.xunhong.erp.turbo.infra.app.executor.query;

import com.alibaba.cola.exception.Assert;
import com.xunhong.erp.turbo.api.infra.dto.qry.ChannelShowQry;
import com.xunhong.erp.turbo.api.infra.dto.vo.ChannelVO;
import com.xunhong.erp.turbo.infra.app.assembler.ChannelAssembler;
import com.xunhong.erp.turbo.infra.domain.entity.Channel;
import com.xunhong.erp.turbo.infra.domain.gateway.ChannelGateway;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class ChannelShowQryExe {
	private final ChannelGateway channelGateway;
	private final ChannelAssembler channelAssembler;
//    private final WxMpGateway wxMpGateway;

	public ChannelVO execute(ChannelShowQry channelShowQry) {
		Channel channel = channelGateway.show(channelShowQry);
		Assert.notNull(channel, "渠道不存在");
//        WxMp wxMp = wxMpGateway.selectByChannelId(channel.getChannelId());
		ChannelVO channelVO = channelAssembler.toChannelVO(channel);
//        channelVO.setWxMpId(wxMp.getWxMpId());
//        channelVO.setWxOpenId(wxMp.getWxOpenId());
		return channelVO;
	}
}
