package com.pj.feign;


import com.pj.api.dto.OrderDto;
import com.pj.api.dto.OrdersDto;
import com.pj.api.dto.PeopleConfirmDTO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * @Author Mechrevo
 * @Date 2023 08 29 14 15
 **/
@RestController
@RequestMapping("/async/")
public class AmqpTemplateController {

    @Autowired
    private AmqpTemplateFeign amqpTemplateFeign;

    /**
     * 发送对象至航通
     * @param t
     * @param
     */
    @RequestMapping("rpc/sendLevelOneOrderDto")
    public void sendLevelOneOrderDto(@RequestBody OrderDto t, @RequestParam("dataType")String dataType){
        //发送
        amqpTemplateFeign.sendObject(t,dataType);
    }

    /**
     * 发送对象至航通
     * @param t
     * @param dataType
     */
    @RequestMapping("rpc/sendLevelTwoOrdersDto")
    public void sendLevelTwoOrdersDto(@RequestBody OrdersDto t, @RequestParam("dataType") String dataType){
        //发送
        amqpTemplateFeign.sendObject(t,dataType);
    }

    /**
     * 边民确认-->发给航通
     * @param confirmDTO
     */
    @RequestMapping("rpc/sendConfirm")
    public void sendConfirm(@RequestBody PeopleConfirmDTO confirmDTO){
        amqpTemplateFeign.sendObject(confirmDTO,"008");
    }
}
