package cn.superdesk.uniorder.common.mq.kafka.producer;


import cn.superdesk.uniorder.common.json.AnJsonUtils;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.SuperMallSupplierReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.proxyclient.ProxyClientOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.proxyclient.ProxyClientRefundOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.score.ScoreOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.score.refund.ScoreOrderRefundReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.unified.flsc.UnifiedFlscOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.unified.flsc.refund.UnifiedFlscRefundOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.unified.mix.UnifiedMixOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.unified.mix.refund.UnifiedMixRefundOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.unified.qyng.UnifiedQyngOrderReceiveParam;
import cn.superdesk.uniorder.dto.receive.consumer.superdeskmall.unified.qyng.refund.UnifiedQyngRefundOrderReceiveParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.stereotype.Service;


/**
 * @Description: Java类作用描述
 * @Author: linjinyu
 * @CreateDate: 2021/3/8 上午11:40
 * @UpdateUser: linjinyu
 * @UpdateDate: 2021/3/8 上午11:40
 * @UpdateRemark: 修改内容
 * @Version: 1.0
 */
@Slf4j
@Service
public class FakeSuperdeskMallProducerHandler {

	@Autowired
	private KafkaTemplate<String, String> kafkaTemplate;


	/****************************************** 福利商城 start ******************************************/

	@Value(value = "${superdesk.mall.kafka.topic.flsc.order}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_FLSC_ORDER;
	@Value(value = "${superdesk.mall.kafka.topic.flsc.refund}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_FLSC_REFUND;

	public void fakeProducerFlscOrder(UnifiedFlscOrderReceiveParam unifiedOrderReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_FLSC_ORDER, AnJsonUtils.toJson(unifiedOrderReceiveParam));
	}

	public void fakeProducerFlscRefundOrder(UnifiedFlscRefundOrderReceiveParam unifiedOrderRefundReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_FLSC_REFUND, AnJsonUtils.toJson(unifiedOrderRefundReceiveParam));
	}

	/****************************************** 福利商城   end ******************************************/


	/****************************************** 福利商城_侨城汇 start ******************************************/

	@Value(value = "${superdesk.mall.kafka.topic.flsc_qch.order}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_FLSC_QCH_ORDER;
	@Value(value = "${superdesk.mall.kafka.topic.flsc_qch.refund}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_FLSC_QCH_REFUND;

	public void fakeProducerMallFlscQchOrder(ScoreOrderReceiveParam scoreOrderReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_FLSC_QCH_ORDER, "order", AnJsonUtils.toJson(scoreOrderReceiveParam));
	}

	public void fakeProducerMallFlscQchRefundOrder(ScoreOrderRefundReceiveParam scoreOrderRefundReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_FLSC_QCH_REFUND, "refund", AnJsonUtils.toJson(scoreOrderRefundReceiveParam));
	}

	/****************************************** 福利商城_侨城汇   end ******************************************/

	/****************************************** 企业内购 start ******************************************/

	@Value(value = "${superdesk.mall.kafka.topic.qyng.order}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_QYNG_ORDER;
	@Value(value = "${superdesk.mall.kafka.topic.qyng.refund}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_QYNG_REFUND;

	public void fakeProducerQyngOrder(UnifiedQyngOrderReceiveParam unifiedOrderReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_QYNG_ORDER, AnJsonUtils.toJson(unifiedOrderReceiveParam));
	}

	public void fakeProducerQyngRefundOrder(UnifiedQyngRefundOrderReceiveParam unifiedOrderRefundReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_QYNG_REFUND, AnJsonUtils.toJson(unifiedOrderRefundReceiveParam));
	}

	/****************************************** 企业内购   end ******************************************/

	/****************************************** 混合商城 start ******************************************/

	@Value(value = "${superdesk.mall.kafka.topic.mix.order}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_MIX_ORDER;
	@Value(value = "${superdesk.mall.kafka.topic.mix.refund}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_MIX_REFUND;

	public void fakeProducerMixOrder(UnifiedMixOrderReceiveParam unifiedOrderReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_MIX_ORDER, AnJsonUtils.toJson(unifiedOrderReceiveParam));
	}

	public void fakeProducerMixRefundOrder(UnifiedMixRefundOrderReceiveParam unifiedOrderRefundReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_MIX_REFUND, AnJsonUtils.toJson(unifiedOrderRefundReceiveParam));
	}

	/****************************************** 混合商城   end ******************************************/


	/****************************************** 代客下单 新通道 start ******************************************/

	// proxyclient_order
	// proxyclient_order_refund
	// ProxyClientOrder
	// ProxyClientRefundOrder

	@Value(value = "${superdesk.mall.kafka.topic.proxyclient.order}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_PROXY_CLIENT_ORDER;
	@Value(value = "${superdesk.mall.kafka.topic.proxyclient.refund}")
	private String SUPERDESK_MALL_KAFKA_TOPIC_PROXY_CLIENT_REFUND;

	public void fakeProducerProxyClientOrder(ProxyClientOrderReceiveParam proxyClientOrderReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_PROXY_CLIENT_ORDER, "order", AnJsonUtils.toJson(proxyClientOrderReceiveParam));
	}

	// 没需求要实现
	public void fakeProducerProxyClientRefundOrder(ProxyClientRefundOrderReceiveParam proxyClientRefundOrderReceiveParam) {
		kafkaTemplate.send(SUPERDESK_MALL_KAFKA_TOPIC_PROXY_CLIENT_REFUND, "refund", AnJsonUtils.toJson(proxyClientRefundOrderReceiveParam));
	}

	/****************************************** 代客下单 新通道   end ******************************************/


	/****************************************** 企业采购-商户(供应商)数据 start ******************************************/

	public void fakeProducerSupplier(SuperMallSupplierReceiveParam superMallSupplierReceiveParam) {
		kafkaTemplate.send("supplierSync", "merchant", AnJsonUtils.toJson(superMallSupplierReceiveParam));
	}

	/****************************************** 企业采购-商户(供应商)数据 start ******************************************/


}
