package com.friday.executor.common;

import com.friday.base.common.annotation.MethodLog;
import com.friday.base.common.response.DubboResult;
import com.friday.blank.api.dto.common.BlankNotifyDto;
import com.friday.blank.api.service.external.IExternalNotifyService;
import com.friday.operation.api.executor.service.IBlankNotifyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
@Slf4j
public class BlankNotifyHelper implements IBlankNotifyService {
    @Autowired(required = false)
    private IExternalNotifyService notifyService;

    @Override
    @MethodLog
    public DubboResult doNotify(BlankNotifyDto notifyDto){
        try {
            return notifyService.doNotify(notifyDto);
        } catch (Exception e){
            log.error("调用BLANK通知接口异常", e);
            return DubboResult.newFailure(DubboResult.SERVER_EXCEPTION, "调用BLANK通知接口异常:" + e.getMessage());
        }
    }
}
