|
|
@@ -1,8 +1,13 @@
|
|
|
package com.aoyang.tms.controller;
|
|
|
|
|
|
|
|
|
+import com.aoyang.tms.common.ErrCodeEnum;
|
|
|
import com.aoyang.tms.entity.Truck;
|
|
|
+import com.aoyang.tms.entity.TruckEscort;
|
|
|
+import com.aoyang.tms.service.TruckEscortService;
|
|
|
import com.aoyang.tms.service.TruckService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
@@ -31,11 +36,13 @@ import com.aoyang.common.param.PageParam;
|
|
|
@RestController
|
|
|
@Slf4j
|
|
|
@Api(value = "truckCRUD接口")
|
|
|
-@RequestMapping("/strategy/truck")
|
|
|
+@RequestMapping("/tms/truck")
|
|
|
public class TruckController {
|
|
|
|
|
|
@Resource
|
|
|
private TruckService truckService;
|
|
|
+ @Resource
|
|
|
+ private TruckEscortService truckEscortService;
|
|
|
|
|
|
@ApiOperation(value = "获取truck列表",notes="")
|
|
|
@PostMapping("/list")
|
|
|
@@ -58,4 +65,17 @@ public class TruckController {
|
|
|
Boolean flag = truckService.save(truck);
|
|
|
return new Result<>(flag);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "取车牌号", notes = "取车牌号")
|
|
|
+ @PostMapping("/get_car_number")
|
|
|
+ public Result<Truck> getCarNumber(@RequestHeader(value = "userId", required = true) String userId) {
|
|
|
+ log.info("truck/get_car_number : userId:{}", userId);
|
|
|
+ TruckEscort truckEscort = truckEscortService.getOne(new QueryWrapper<TruckEscort>().eq("escort_id", userId));
|
|
|
+ if (truckEscort == null) {
|
|
|
+ return new Result(ErrCodeEnum.NOT_BINDING_ERROR.getCode(), ErrCodeEnum.NOT_BINDING_ERROR.getMessage());
|
|
|
+ }
|
|
|
+ Truck truck = truckService.getById(truckEscort.getTruckId());
|
|
|
+ return new Result<>(truck);
|
|
|
+ }
|
|
|
+
|
|
|
}
|