package com.red.circle.order.infra.database.rds.service.order.impl;

import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl;
import com.red.circle.order.infra.database.rds.dao.order.OrderUserPurchasePayNoticeDAO;
import com.red.circle.order.infra.database.rds.entity.order.OrderUserPurchasePayNotice;
import com.red.circle.order.infra.database.rds.service.order.OrderUserPurchasePayNoticeService;
import com.red.circle.tool.core.json.JacksonUtils;
import java.util.Objects;
import org.springframework.stereotype.Service;

/**
 * Web支付通知明细服务实现.
 */
@Service
public class OrderUserPurchasePayNoticeServiceImpl
    extends BaseServiceImpl<OrderUserPurchasePayNoticeDAO, OrderUserPurchasePayNotice>
    implements OrderUserPurchasePayNoticeService {

  @Override
  public void addNotice(Long purchasePayId, String eventId, String noticeType, Object noticeData,
      Long operationUserId) {
    OrderUserPurchasePayNotice notice = new OrderUserPurchasePayNotice()
        .setPurchasePayId(purchasePayId)
        .setEventId(Objects.toString(eventId, ""))
        .setNoticeType(Objects.toString(noticeType, ""))
        .setNoticeData(JacksonUtils.toJson(noticeData));
    notice.setCreateUser(operationUserId);
    notice.setUpdateUser(operationUserId);
    save(notice);
  }
}
