package com.hzs.system.base.provider;

import cn.hutool.core.bean.BeanUtil;
import com.hzs.common.core.domain.R;
import com.hzs.system.base.INoticeMemberServiceApi;
import com.hzs.system.base.dto.NoticeMemberDTO;
import com.hzs.system.base.service.IBdNoticeService;
import com.hzs.system.base.vo.BdNoticeVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 会员站内信服务
 *
 * @Description:
 * @Author: ljc
 * @Time: 2023/12/8 16:47
 * @Classname: NoticeMemberProvider
 * @Package_name: com.hzs.system.base.provider
 */

@Slf4j
@DubboService
public class NoticeMemberProvider implements INoticeMemberServiceApi {

    @Autowired
    IBdNoticeService bdNoticeService;

    @Override
    public R saveMemberNotice(NoticeMemberDTO noticeMemberDTO) {
        try {
            BdNoticeVO noticeVO = BeanUtil.copyProperties(noticeMemberDTO, BdNoticeVO.class);
            Boolean result = bdNoticeService.saveMemberNotice(noticeVO);
            return result ? R.ok() : R.fail();
        } catch (Exception e) {
            log.error("会员站内信插入出错", e);
            return R.fail("会员站内信插入出错！");
        }


    }

}
