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


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.TranCarInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.TranProcessInfo;
import com.yh.saas.plugin.yiliangyiyun.entity.TranTaskInfo;
import com.yh.saas.plugin.yiliangyiyun.service.ITranProcessInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 记录调度 前端控制器
 * </p>
 *
 * @author Gongdc
 * @since 2021-05-31
 */
@RestController
@RequestMapping("/tranProcessInfo")
public class TranProcessInfoController {
    @Autowired
    private ITranProcessInfoService tranProcessInfoService;

    /**
     * 汽运调度分页列表查询
     *
     * @param tranProcessInfo
     * @return
     */
    @GetMapping("/selectTranProcessInfo")
    public Page<TranProcessInfo> selectTranProcessInfo(TranProcessInfo tranProcessInfo) {
        return tranProcessInfoService.selectTranProcessInfo(tranProcessInfo);
    }

    /**
     * 更改状态
     */
    @PostMapping("/editStatus")
    public String editStatus(@RequestBody TranProcessInfo tranProcessInfo) {
        return tranProcessInfoService.editStatus(tranProcessInfo.getId());
    }
    /**
     * 查看运输调度
     * @param id
     * @return
     */
    @GetMapping("/getTranProcess")
    public TranProcessInfo getTranProcess (String id){
        return tranProcessInfoService.getTranProcess(id);
    }
    /**
     * 派车
     */
    @PostMapping("/api/insertTranCar")
    public String insertTranCar(@RequestBody TranProcessInfo tranProcessInfo){
        return tranProcessInfoService.insertTranCar(tranProcessInfo);
    }

    /**
     * 更改发货反馈状态
     */
    @PostMapping("/api/editFeedbackStatus")
    public String editFeedbackStatus(@RequestBody TranProcessInfo tranProcessInfo){
        return tranProcessInfoService.editFeedbackStatus(tranProcessInfo.getId());
    }
    /**
     * 更改收货反馈状态
     */
    @PostMapping("/api/editReceivingStatus")
    public String editReceivingStatus(@RequestBody TranProcessInfo tranProcessInfo){
        return tranProcessInfoService.editReceivingStatus(tranProcessInfo);
    }


    /**
     * 删除运输阶段
     * @param example
     */
    @PostMapping("/api/deleteTranProcess")
    public void deleteTranProcess(@RequestBody TranProcessInfo example) {
        tranProcessInfoService.deleteTranProcess(example.getId());
    }
    /**
     * 设置运输金额
     */
    @PostMapping("/api/setUpTranPrice")
    public String setUpTranPrice(@RequestBody TranProcessInfo tranProcessInfo){
        return tranProcessInfoService.setUpTranPrice(tranProcessInfo);
    }
    /**
     * 设置运输金额(按车)
     */
    @PostMapping("/api/setUpTranPriceCar")
    public String setUpTranPriceCar(@RequestBody TranProcessInfo tranProcessInfo){
        return tranProcessInfoService.setUpTranPriceCar(tranProcessInfo);
    }

    /**
     * 他运反馈
     */
    @PostMapping("/api/addTranCar")
    public String addTranCar(@RequestBody TranProcessInfo tranProcessInfo){
        return tranProcessInfoService.addTranCar(tranProcessInfo);
    }

    /**
     * 查看他运反馈
     * @param id
     * @return
     */
    @GetMapping("/getThreeTranProcess")
    public TranProcessInfo getThreeTranProcess (String id){
        return tranProcessInfoService.getThreeTranProcess(id);
    }
}

