VehicleFileController.java 3.79 KB
package com.objecteye.controller;

import com.objecteye.common.CommonResult;
import com.objecteye.entity.*;
import com.objecteye.service.IVehicleFileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;
import java.util.List;

/**
 * 一车一档 controller
 */
@RestController
@Api(tags = "VehicleFileController", description = "一车一档")
@RequestMapping("/vehicleFiles")
@CrossOrigin
public class VehicleFileController {
    @Autowired
    private IVehicleFileService iVehicleFileService;

    @ApiOperation("档案浏览查询(分页)")
    @RequestMapping(value = "fileQueryByPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public CommonResult fileQueryByPage(@RequestBody VehicleFileParam vehicleFileParam) {
        PageResult pageResult = iVehicleFileService.fileQueryByPage(vehicleFileParam);
        return pageResult.getRow().size() > 0 ? CommonResult.success(pageResult) : CommonResult.success(201, "没有符合要求的值", new PageResult<>());
    }

    @ApiOperation("档案浏览查询(不分页)")
    @RequestMapping(value = "fileQuery", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public CommonResult fileQuery(@RequestBody VehicleFileParam vehicleFileParam) {
        List<VvehicleFileQueryResult> resultList = iVehicleFileService.fileQuery(vehicleFileParam);
        return resultList.size() > 0 ? CommonResult.success(resultList) : CommonResult.success(201, "没有符合要求的值", new ArrayList<>());
    }

    @ApiOperation("车牌搜档(分页)")
    @RequestMapping(value = "plateNumberQueryByPage", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public CommonResult plateNumberQueryByPage(@RequestBody VehicleFilePlateNumParam vehicleFilePlateNumParam) {
        PageResult pageResult = iVehicleFileService.plateNumberQueryByPage(vehicleFilePlateNumParam);
        return pageResult.getRow().size() > 0 ? CommonResult.success(pageResult) : CommonResult.success(201, "没有符合要求的值", new PageResult<>());
    }

    @ApiOperation("车牌搜档(不分页)")
    @RequestMapping(value = "plateNumberQuery", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public CommonResult plateNumberQuery(@RequestBody VehicleFilePlateNumParam vehicleFilePlateNumParam) {
        List<VvehicleFilePlateNumberQueryResult> resultList = iVehicleFileService.plateNumberQuery(vehicleFilePlateNumParam);
        return resultList.size() > 0 ? CommonResult.success(resultList) : CommonResult.success(201, "没有符合要求的值", new ArrayList<>());
    }

    @ApiOperation("以图搜档")
    @RequestMapping(value = "picQuery", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public CommonResult picQuery(int gcxh, MultipartFile multipartFile) {
        VvehicleFilePicQueryResult picQueryResult = iVehicleFileService.picQuery(gcxh, multipartFile);
        return null == picQueryResult ? CommonResult.success(201, "没有符合要求的值", new VvehicleFilePicQueryResult()) : CommonResult.success(picQueryResult);
    }

    @ApiOperation("司机信息")
    @RequestMapping(value = "driverFiles", method = RequestMethod.POST, produces = {"application/json;charset=UTF-8"})
    public CommonResult driverFiles(@RequestBody VehicleFilePlateNumParam vehicleFilePlateNumParam) {
        PageResult pageResult = iVehicleFileService.driverFiles(vehicleFilePlateNumParam);
        return pageResult.getRow().size() > 0 ? CommonResult.success(pageResult) : CommonResult.success(201, "驾驶人信息努力获取中", new PageResult<>());
    }
}