package com.xunhong.erp.turbo.facade.app.executor.cmd;

import com.xunhong.erp.turbo.api.facade.dto.cmd.WxCpNotifyCmd;
import com.xunhong.erp.turbo.facade.app.executor.common.WxCmdExe;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.cp.api.WxCpGroupRobotService;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class WxMaNotifyCmdExe extends WxCmdExe {

	@SneakyThrows
	public void execute(WxCpNotifyCmd wxCpNotifyCmd) {
		WxCpGroupRobotService wxCpGroupRobotService = getWxCpGroupRobotService(wxCpNotifyCmd.getWebhookKey());
		wxCpGroupRobotService.sendMarkdown(wxCpNotifyCmd.getContent());
	}
}
