package com.iformall.utils;

import com.iformall.domain.po.WxRentContract;
import com.iformall.domain.vo.RentEventInfo;
import com.iformall.enums.EnumRentContractStatus;
import com.iformall.service.WxRentContractService;
import com.iformall.service.invest.event.InvestEvent;
import lombok.extern.slf4j.Slf4j;


@Slf4j
public class EventUtil {

	public static void publistRentEvent(WxRentContractService rentContractService, WxRentContract rentContract) {
		try {
			RentEventInfo rentEventInfo = RentEventInfo
					.of(rentContract.getId(), rentContractService.getShopIds(rentContract), EnumRentContractStatus.getEnum(rentContract.getStatus()));
			InvestEvent event = new InvestEvent(rentEventInfo);
			SpringContextUtils.pulish(event);
		} catch (Exception e) {
			log.error("publistRentEvent error", e);
		}
	}
}
