package cn.superdesk.uniorder.controller._test;


import cn.superdesk.uniorder.common.mq.redis.dto.ExcelImportTaskMessage;
import cn.superdesk.uniorder.common.rest.response.R;
import cn.superdesk.uniorder.common.rest.response.ResponseResultOuterUtils;
import cn.superdesk.uniorder.dubbo.consumer.redis.RedisQueueDubboConsumerService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/test/redis/queue/consumer")
public class RedisQueueDubboConsumerController {

	@Resource
	private RedisQueueDubboConsumerService redisQueueDubboConsumerService;

	@GetMapping("/send")
	public R<String> send() {
		redisQueueDubboConsumerService.sendMessage("FLSC_QCH-DZ202102040021");
		return ResponseResultOuterUtils.createSuccesResult();
	}

	@GetMapping("/send2")
	public R<String> send2() {
		redisQueueDubboConsumerService.pushMessage2CHANNEL_ACCOUNTING_UNIFIED_CUSTOMER("FLSC_QCH-DZ202102040021,FLSC_QCH-DZ202102040021,FLSC_QCH-DZ202102040021");
		return ResponseResultOuterUtils.createSuccesResult();
	}

	@GetMapping("/send3")
	public R<String> send3() {
		redisQueueDubboConsumerService.pushMessage2CHANNEL_ACCOUNTING_UNIFIED_SUPPLIER("FLSC_QCH-DZ202102040021");
		return ResponseResultOuterUtils.createSuccesResult();
	}

	@GetMapping("/send4")
	public R<String> send4() {



		redisQueueDubboConsumerService.pushMessage2CHANNEL_QUEUE_F(ExcelImportTaskMessage
				.builder()
				.topic(this.getClass().getName())
				.content("")
				.build());
		return ResponseResultOuterUtils.createSuccesResult();
	}
}
