179 lines
5.3 KiB
Java
179 lines
5.3 KiB
Java
package com.shiyi.internet.controller;
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.fate.common.core.domain.Result;
|
|
import com.fate.common.core.utils.poi.ExcelUtil;
|
|
import com.fate.common.core.web.controller.BaseController;
|
|
import com.shiyi.internet.domain.Car;
|
|
import com.shiyi.internet.domain.VehicleMessage;
|
|
import com.shiyi.internet.domain.response.ResponseCar;
|
|
import com.shiyi.internet.service.VehicleService;
|
|
import io.swagger.models.auth.In;
|
|
import lombok.extern.log4j.Log4j2;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
import java.util.List;
|
|
|
|
/**
|
|
* @ClassName : 车辆管理系统控制层
|
|
* @Description : CarController
|
|
* @Author : YHY
|
|
* @Date: 2023-11-19 21:00
|
|
*/
|
|
@Log4j2
|
|
@RestController
|
|
@RequestMapping("/car")
|
|
public class VehicleController extends BaseController {
|
|
|
|
@Autowired
|
|
private VehicleService vehicleService;
|
|
private HttpServletRequest request;
|
|
|
|
|
|
/**
|
|
* @Description:车辆管理系统
|
|
No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result<java.util.List<com.shiyi.internet.domain.response.ResponseCar>>
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/19 21:20
|
|
*/
|
|
@GetMapping("/vehicleList")
|
|
public Result<List<ResponseCar>> vehicleList(){
|
|
Result<List<ResponseCar>> result = vehicleService.vehicleList();
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* @Description:获取编号删除车辆
|
|
No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/19 21:38
|
|
*/
|
|
@PostMapping("/deletVehiclById/{carId}")
|
|
public Result deletVehiclById(@PathVariable Integer carId){
|
|
Result result = vehicleService.deletVehiclById(carId);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* @Description:添加车辆信息
|
|
No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/19 22:34
|
|
*/
|
|
@PostMapping("/addVehicl")
|
|
public Result addVehicl(@RequestBody Car car){
|
|
Result result = vehicleService.addVehicl(car);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* 精确查询车辆系统信息
|
|
* No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/20 10:20
|
|
*/
|
|
@GetMapping("/findVehiclById/{carId}")
|
|
public Result findVehiclById(@PathVariable Integer carId){
|
|
ResponseCar responseCar = vehicleService.findVehiclById(carId);
|
|
Result result = Result.success(responseCar);
|
|
return result;
|
|
}
|
|
|
|
|
|
/**
|
|
* @Description:修改车辆管理
|
|
No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/20 10:34
|
|
*/
|
|
@PostMapping("/updateVehicl")
|
|
public Result updateVehicl(@RequestBody Car car){
|
|
Result result = vehicleService.updateVehicl(car);
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* @Description: 导出车辆数据
|
|
No such property: code for class: Script1
|
|
* @return: void
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/20 13:36
|
|
*/
|
|
@PostMapping("/exportVehiclList")
|
|
public void exportVehiclList(HttpServletResponse response){
|
|
Result<List<ResponseCar>> list = vehicleService.vehicleList();
|
|
ExcelUtil<ResponseCar> carExcelUtil = new ExcelUtil<>(ResponseCar.class);
|
|
carExcelUtil.exportExcel(response,list.getData(),"车辆信息");
|
|
}
|
|
|
|
|
|
/**
|
|
* @Description:修改车辆状态(启动/停止)
|
|
No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/23 11:18
|
|
*/
|
|
@PostMapping("/updateVehicleStatus/{vin}/{status}")
|
|
public Result updateVehicleStatus(@PathVariable("vin") String vin, @PathVariable("status")Integer status){
|
|
Result result = vehicleService.updateVehicleStatus(vin,status);
|
|
return result;
|
|
}
|
|
|
|
|
|
/**
|
|
* @Description:查询所有在线车辆
|
|
No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result<java.util.List<com.shiyi.internet.domain.VehicleMessage>>
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/23 20:27
|
|
*/
|
|
@GetMapping("onlineVehicle")
|
|
public Result<List<VehicleMessage>> onlineVehicle(){
|
|
Result<List<VehicleMessage>> result = vehicleService.onlineVehicle();
|
|
return result;
|
|
}
|
|
|
|
|
|
/**
|
|
* @Description:统计数据
|
|
No such property: code for class: Script1
|
|
* @return: com.fate.common.core.domain.Result<java.lang.String>
|
|
* @Author: YHY
|
|
* @Updator: YHY
|
|
* @Date 2023/11/23 20:42
|
|
*/
|
|
@GetMapping("/countData")
|
|
public Result<String> countData(){
|
|
Result<String> result = vehicleService.countData();
|
|
return result;
|
|
}
|
|
|
|
|
|
/**
|
|
* 车辆列表
|
|
*/
|
|
@GetMapping("/vehicleList")
|
|
public Result<Car> vehicleLists(){
|
|
Result result = Result.success(vehicleService.vehicleList());
|
|
return result;
|
|
}
|
|
|
|
}
|