package com.yh.saas.plugin.yiliangyiyun.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.DriverViewInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.FreightReceivingDispatching;
import com.yh.saas.plugin.yiliangyiyun.entity.FreightReceivingDispatchingCar;
import com.yh.saas.plugin.yiliangyiyun.entity.ReceivingUser;
import com.yh.saas.plugin.yiliangyiyun.service.IDriverViewInfoService;
import com.yh.saas.plugin.yiliangyiyun.service.IFreightReceivingDispatchingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 货运收发信息 前端控制器
 * </p>
 *
 * @author Gongdc
 * @since 2021-08-19
 */
@RestController
@RequestMapping("/freightReceivingDispatching")
public class FreightReceivingDispatchingController {

    @Autowired
    private IFreightReceivingDispatchingService freightReceivingDispatchingService;

    /**
     * 页面列表
     *
     * @param freightReceivingDispatching
     * @return
     */
    @GetMapping("/selectFreightReceivingDispatchingPage")
    public Page<FreightReceivingDispatching> selectFreightReceivingDispatchingPage(FreightReceivingDispatching freightReceivingDispatching) {
        return freightReceivingDispatchingService.selectFreightReceivingDispatchingPage(freightReceivingDispatching);
    }

    /**
     * 删除信息
     *
     * @param freightReceivingDispatching
     */
    @PostMapping("/api/deleteFreightReceivingDispatching")
    public void deleteFreightReceivingDispatching(@RequestBody FreightReceivingDispatching freightReceivingDispatching) {
        freightReceivingDispatchingService.deleteFreightReceivingDispatching(freightReceivingDispatching.getId());
    }

    /**
     * 添加信息
     *
     * @param freightReceivingDispatching
     */
    @PostMapping("/api/insertFreightReceivingDispatching")
    public String insertFreightReceivingDispatching(@RequestBody FreightReceivingDispatching freightReceivingDispatching) {
        return freightReceivingDispatchingService.insertFreightReceivingDispatching(freightReceivingDispatching);
    }
    /**
     * 查看详情
     *
     * @param id
     * @return
     */
    @GetMapping("/getFreightReceivingDispatching")
    public FreightReceivingDispatching getFreightReceivingDispatching(String id) {
        return freightReceivingDispatchingService.getFreightReceivingDispatching(id);
    }

    /**
     * 添加发车信息
     *
     * @param freightReceivingDispatchingCar
     */
    @PostMapping("/api/insertFreightReceivingDispatchingCar")
    public String insertFreightReceivingDispatchingCar(@RequestBody FreightReceivingDispatchingCar freightReceivingDispatchingCar) {
        return freightReceivingDispatchingService.insertFreightReceivingDispatchingCar(freightReceivingDispatchingCar);
    }

    /**
     * 付扣运费款
     *
     * @param freightReceivingDispatchingCar
     */
    @PostMapping("/api/paymentAndDeductionfreight")
    public String paymentAndDeductionfreight(@RequestBody FreightReceivingDispatchingCar freightReceivingDispatchingCar) {
        return freightReceivingDispatchingService.paymentAndDeductionfreight(freightReceivingDispatchingCar);
    }

    /**
     * 付扣货款
     *
     * @param freightReceivingDispatchingCar
     */
    @PostMapping("/api/PaymentDeduction")
    public String PaymentDeduction(@RequestBody FreightReceivingDispatchingCar freightReceivingDispatchingCar) {
        return freightReceivingDispatchingService.PaymentDeduction(freightReceivingDispatchingCar);
    }

    /**
     * 确认收货
     *
     * @param freightReceivingDispatchingCar
     */
    @PostMapping("/api/confirmFreightReceivingDispatchingCar")
    public String confirmFreightReceivingDispatchingCar(@RequestBody FreightReceivingDispatchingCar freightReceivingDispatchingCar) {
        return freightReceivingDispatchingService.confirmFreightReceivingDispatchingCar(freightReceivingDispatchingCar);
    }

    /**
     * 添加收货人
     *
     * @param receivingUser
     */
    @PostMapping("/api/insertReceivingUser")
    public String insertReceivingUser(@RequestBody ReceivingUser receivingUser) {
        return freightReceivingDispatchingService.insertReceivingUser(receivingUser);
    }
}

