package com.prolog.rdc.tms.controller.intelligent;

import com.prolog.framework.common.message.RestMessage;
import com.prolog.framework.log.aop.annotation.UserLog;
import com.prolog.rdc.tms.model.dto.intelligent.BranchDTO;
import com.prolog.rdc.tms.model.dto.intelligent.ConsigneeDTO;
import com.prolog.rdc.tms.model.dto.intelligent.CustomerDTO;
import com.prolog.rdc.tms.model.dto.intelligent.VehicleDTO;
import com.prolog.rdc.tms.model.dto.intelligent.VehicleTypeDTO;
import com.prolog.rdc.tms.model.dto.intelligent.VehicleTypeVehicleDTO;
import com.prolog.rdc.tms.service.intelligent.IntelligentVehicleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author hongbo.pan
 * @date 2023/8/28
 */
@RestController
@Api(tags = "智能调度-车辆")
@RequestMapping("/intelligentVehicle")
public class IntelligentVehicleController {

    @Autowired
    private IntelligentVehicleService service;

    @UserLog("车型分组")
    @ApiOperation(value = "车型分组", notes = "车型分组")
    @PostMapping("/groupByVehicleType")
    public RestMessage<List<VehicleTypeVehicleDTO>> groupByVehicleType() {
        return RestMessage.newInstance(true, "操作成功！", service.groupByVehicleType());
    }

    @UserLog("车辆分组")
    @ApiOperation(value = "车辆分组", notes = "车辆分组")
    @PostMapping("/groupByVehicle")
    public RestMessage<List<VehicleTypeVehicleDTO>> groupByVehicle() {
        return RestMessage.newInstance(true, "操作成功！", service.groupByVehicle());
    }

    @UserLog("查询车辆信息")
    @ApiOperation(value = "查询车辆信息", notes = "查询车辆信息")
    @PostMapping("/findVehicleByPlateNumberList")
    public RestMessage<List<VehicleDTO>> findVehicleByPlateNumberList(@RequestBody List<String> plateNumberList) {
        return RestMessage.newInstance(true, "操作成功！", service.findVehicleByPlateNumberList(plateNumberList));
    }

    @UserLog("查询车辆信息")
    @ApiOperation(value = "查询车辆信息", notes = "查询车辆信息")
    @PostMapping("/findVehicleByIdList")
    public RestMessage<List<VehicleDTO>> findVehicleByIdList(@RequestBody List<Long> idList) {
        return RestMessage.newInstance(true, "操作成功！", service.findVehicleByIdList(idList));
    }

    @UserLog("查询车型信息")
    @ApiOperation(value = "查询车型信息", notes = "查询车型信息")
    @PostMapping("/findVehicleTypeByIdList")
    public RestMessage<List<VehicleTypeDTO>> findVehicleTypeByIdList(@RequestBody List<Long> idList) {
        return RestMessage.newInstance(true, "操作成功！", service.findVehicleTypeByIdList(idList));
    }

    @UserLog("查询仓库信息")
    @ApiOperation(value = "查询仓库信息", notes = "查询仓库信息")
    @PostMapping("/findBranchByIdList")
    public RestMessage<List<BranchDTO>> findBranchByIdList(@RequestBody List<Long> idList) {
        return RestMessage.newInstance(true, "操作成功！", service.findBranchByIdList(idList));
    }

    @UserLog("查询客户信息")
    @ApiOperation(value = "查询客户信息", notes = "查询客户信息")
    @PostMapping("/findCustomerByIdList")
    public RestMessage<List<CustomerDTO>> findCustomerByIdList(@RequestBody List<Long> idList) {
        return RestMessage.newInstance(true, "操作成功！", service.findCustomerByIdList(idList));
    }

    @UserLog("查询收货方信息")
    @ApiOperation(value = "查询收货方信息", notes = "查询收货方信息")
    @PostMapping("/findConsigneeByIdList")
    public RestMessage<List<ConsigneeDTO>> findConsigneeByIdList(@RequestBody List<Long> idList) {
        return RestMessage.newInstance(true, "操作成功！", service.findConsigneeByIdList(idList));
    }


}
