|
@@ -4,7 +4,14 @@ package com.aoyang.tms.controller;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.aoyang.tms.common.ErrCodeEnum;
|
|
import com.aoyang.tms.common.ErrCodeEnum;
|
|
|
import com.aoyang.tms.controller.param.WorkOrderPageParam;
|
|
import com.aoyang.tms.controller.param.WorkOrderPageParam;
|
|
|
|
|
+import com.aoyang.tms.controller.vo.LocationVO;
|
|
|
import com.aoyang.tms.controller.vo.WorkOrderVO;
|
|
import com.aoyang.tms.controller.vo.WorkOrderVO;
|
|
|
|
|
+import com.aoyang.tms.entity.Truck;
|
|
|
|
|
+import com.aoyang.tms.entity.WorkOrderReadinfo;
|
|
|
|
|
+import com.aoyang.tms.entity.WorkSpot;
|
|
|
|
|
+import com.aoyang.tms.service.*;
|
|
|
|
|
+import com.aoyang.tms.util.DateUtils;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
@@ -19,7 +26,6 @@ import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
-import com.aoyang.tms.service.WorkOrderService;
|
|
|
|
|
import com.aoyang.tms.entity.WorkOrder;
|
|
import com.aoyang.tms.entity.WorkOrder;
|
|
|
import com.aoyang.common.result.Result;
|
|
import com.aoyang.common.result.Result;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -44,6 +50,14 @@ public class WorkOrderController {
|
|
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
|
private WorkOrderService workOrderService;
|
|
private WorkOrderService workOrderService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private WorkSpotService workSpotService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private WorkOrderReadinfoService workOrderReadinfoService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private TruckService truckService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private CommonService commonService;
|
|
|
|
|
|
|
|
@ApiOperation(value = "运单详情", notes = "获取司机或押运员的运单详情")
|
|
@ApiOperation(value = "运单详情", notes = "获取司机或押运员的运单详情")
|
|
|
@PostMapping("/find_work_order_info")
|
|
@PostMapping("/find_work_order_info")
|
|
@@ -53,10 +67,30 @@ public class WorkOrderController {
|
|
|
if (workOrder == null || workOrder.getId() == null) {
|
|
if (workOrder == null || workOrder.getId() == null) {
|
|
|
return new Result(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
return new Result(ErrCodeEnum.BAD_PARAM.getCode(), ErrCodeEnum.BAD_PARAM.getMessage());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
WorkOrder workOrder1 = workOrderService.getById(workOrder.getId());
|
|
WorkOrder workOrder1 = workOrderService.getById(workOrder.getId());
|
|
|
WorkOrderVO vo = new WorkOrderVO();
|
|
WorkOrderVO vo = new WorkOrderVO();
|
|
|
BeanUtils.copyProperties(workOrder1, vo);
|
|
BeanUtils.copyProperties(workOrder1, vo);
|
|
|
|
|
+ WorkSpot workSpot = workSpotService.getById(workOrder1.getSpotId());
|
|
|
|
|
+ vo.setXiecheContactName(workSpot.getContactName());
|
|
|
|
|
+ vo.setXiecheContactPhone(workSpot.getContactPhone());
|
|
|
|
|
+ vo.setSpotAddress(workSpot.getAddress());
|
|
|
|
|
+ Truck truck = truckService.getById(workOrder1.getTruckId());
|
|
|
|
|
+ vo.setTruckStatus(truck.getTmsStatus());
|
|
|
|
|
+ WorkOrderReadinfo readinfo = workOrderReadinfoService.getOne(
|
|
|
|
|
+ new QueryWrapper<WorkOrderReadinfo>().eq("truck_id", workOrder1.getTruckId()).eq("user_id", userId));
|
|
|
|
|
+ vo.setReadFlag(readinfo == null ? 0 : 1);
|
|
|
|
|
+ List<String> routeGps = commonService.getLocationtrip(workOrder.getTruckId(), workOrder.getGotoSpotTime(), LocalDateTime.now());
|
|
|
|
|
+ vo.setRouteGps(routeGps);
|
|
|
|
|
+ LocationVO locationVO = commonService.getLocationByDate(workOrder.getTruckId(), workOrder.getExecuteTime());
|
|
|
|
|
+ if (locationVO != null) {
|
|
|
|
|
+ vo.setTime(DateUtils.betweenTime(locationVO.getDate(), LocalDateTime.now()));
|
|
|
|
|
+ vo.setLatitude(locationVO.getLatitude());
|
|
|
|
|
+ vo.setLongitude(locationVO.getLongitude());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ if (workOrder.getExecuteTime() != null) {
|
|
|
|
|
+ vo.setTime(DateUtils.betweenTime(workOrder.getExecuteTime(), LocalDateTime.now()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return new Result<>(vo);
|
|
return new Result<>(vo);
|
|
|
}
|
|
}
|
|
|
|
|
|