package com.clx.performance;

import com.clx.order.feign.OrderFeign;
import com.clx.performance.component.GoodsOrderTruckRecordComponent;
import com.clx.performance.component.OrderGoodsStatusLazyComponent;
import com.clx.performance.dao.OrderGoodsDao;
import com.clx.performance.service.LargeScreenService;
import com.clx.performance.service.OrderCancelService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

@SpringBootTest
@RunWith(SpringRunner.class)
public class JobTest {

    @Autowired
    private OrderFeign orderFeign;

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Autowired
    private OrderGoodsStatusLazyComponent orderGoodsStatusLazyComponent;

    @Autowired
    private OrderGoodsDao orderGoodsDao;

    @Autowired
    private GoodsOrderTruckRecordComponent recordComponent;

    @Autowired
    private OrderCancelService orderCancelService;

    @Autowired
    private LargeScreenService largeScreenService;

    @Test
    public void test1() {
        String jsonObject = largeScreenService.receiveAddress(27);
        System.out.println(jsonObject);
//        OrderCancelMqParam mqParam = new OrderCancelMqParam();
//        mqParam.setType("2");
//        mqParam.setOrderNo("123");
//        Message message = MessageBuilder.withBody(JSONUtil.parse(mqParam).toString().getBytes()).build();
//        rabbitTemplate.send(
//                RabbitKeyConstants.ORDER_CANCEL_EXCHANGE, RabbitKeyConstants.ORDER_CANCEL_ROUTE_KEY, message
//        );

        //orderCancelService.ownerCancelOrderPre("PT2023102700473");
        //orderCancelService.ownerCancelOrder("PT2023102600466");
        recordComponent.deleteTruckRecord("123");
        System.out.println();
    }
}
