| | |
| | | package com.stylefeng.guns.modular.system.controller; |
| | | |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.enums.FacilityCodeEnum; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.utils.TerminalInterfaceAcquisitionUtil; |
| | | import com.stylefeng.guns.modular.system.utils.PortUtil.FortyNineUtil; |
| | | import com.stylefeng.guns.modular.system.utils.PortUtil.SCACEnum; |
| | | import com.stylefeng.guns.modular.system.utils.PortUtil.TerminalInterfaceAcquisitionUtil; |
| | | import com.stylefeng.guns.modular.system.utils.tips.ErrorTip; |
| | | import com.stylefeng.guns.modular.system.utils.tips.SuccessTip; |
| | | import com.stylefeng.guns.modular.system.warpper.TerminaleDataWarpper; |
| | |
| | | return new SuccessTip(); |
| | | } |
| | | |
| | | @ApiOperation(value = "获取订单司机位置",notes="获取订单司机位置") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "orderId", value = "orderId", required = true, dataType = "Long"), |
| | | @ApiImplicitParam(name = "lon", value = "lon", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "lat", value = "lat", required = true, dataType = "String"), |
| | | }) |
| | | @GetMapping(value = "/getLonLat") |
| | | @ResponseBody |
| | | public Object getLonLat(Long orderId){ |
| | | // 通过司机id获取订单 |
| | | List<Map<String,Object>> orders = orderService.getLonLat(orderId); |
| | | return new SuccessTip(orders); |
| | | } |
| | | |
| | | |
| | | @Resource |
| | | private TTransportationService tTransportationService; |
| | | |
| | |
| | | ArrayList<OrderDriverInfo> orderDriverInfos = new ArrayList<>(); |
| | | ArrayList<Integer> driverIds = new ArrayList<>(); |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | TPort tPort = portService.selectById(tOrder.getPort()); |
| | | |
| | | // 第一个开始司机id |
| | | Integer sDriverid = tOrder.getsDriverid(); |
| | | if(sDriverid!=null){ |
| | |
| | | driverIds.add(driverIdOne); |
| | | } |
| | | TGoods tGoods = goodsService.selectOne(new EntityWrapper<TGoods>().eq("order_id", tOrder.getId())); |
| | | List<TTransportation> tTransportations = tTransportationService.selectList(new EntityWrapper<TTransportation>().eq("order_id", orderId).in("driver_id", driverIds)); |
| | | List<TTransportation> tTransportations = tTransportationService.selectList(new EntityWrapper<TTransportation>().eq("order_id", orderId).in("driver_id", driverIds).orderBy("type")); |
| | | TerminaleDataWarpper terminalStatus =new TerminaleDataWarpper(); |
| | | try { |
| | | terminalStatus = TerminalInterfaceAcquisitionUtil.getTerminalStatus(tGoods.getContainerNumber(), FacilityCodeEnum.USLAX.getMsg()); |
| | | if("LBCT".equals(tPort.getName()) || "APM".equals(tPort.getName())){ |
| | | terminalStatus = TerminalInterfaceAcquisitionUtil.getTerminalStatus(tPort.getName(),tGoods.getContainerNumber(), FacilityCodeEnum.USLAX.getMsg()); |
| | | }else { |
| | | // 去查是否存了containerid |
| | | if(ToolUtil.isNotEmpty(tGoods.getShipmentId()) && !"0".equals(tGoods.getShipmentId())){ |
| | | terminalStatus = FortyNineUtil.getContainerNo(tGoods.getShipmentId(), tGoods.getContainerNumber()); |
| | | }else { |
| | | |
| | | String shippingLine = tGoods.getShippingLine(); |
| | | SCACEnum scacEnum = SCACEnum.fromCode(shippingLine); |
| | | String s; |
| | | if(ToolUtil.isEmpty(tGoods.getTrackingId()) || "0".equals(tGoods.getTrackingId())){ |
| | | s = FortyNineUtil.trackingRequest(tGoods.getBillNumber(), scacEnum.getDesc()); |
| | | if(ToolUtil.isEmpty(s)){ |
| | | s = FortyNineUtil.trackingList(tGoods.getBillNumber()); |
| | | } |
| | | tGoods.setTrackingId(s); |
| | | goodsService.updateById(tGoods); |
| | | }else { |
| | | s = tGoods.getTrackingId(); |
| | | } |
| | | String shipmentId = FortyNineUtil.getShipmentId(s); |
| | | if(ToolUtil.isNotEmpty(shipmentId)){ |
| | | tGoods.setShipmentId(shipmentId); |
| | | goodsService.updateById(tGoods); |
| | | }else { |
| | | tGoods.setShipmentId("0"); |
| | | tGoods.setTrackingId("0"); |
| | | goodsService.updateById(tGoods); |
| | | } |
| | | terminalStatus = FortyNineUtil.getContainerNo(shipmentId, tGoods.getContainerNumber()); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | terminalStatus =new TerminaleDataWarpper(); |
| | |
| | | OrderDriverInfo orderDriverInfo = new OrderDriverInfo(); |
| | | orderDriverInfo.setId(tDriver.getId()); |
| | | orderDriverInfo.setDriverId(tDriver.getDriverId()); |
| | | if(tDriver.getId().equals(sDriverIdOne)&&tDriver.getType()==2){ |
| | | if(tDriver.getDriverId().equals(sDriverIdOne)&&tDriver.getType()==1){ |
| | | orderDriverInfo.setPickUp(tDriver.getPickDate()); |
| | | } |
| | | if(tDriver.getId().equals(driverid) &&tDriver.getType()==3){ |
| | | if(tDriver.getDriverId().equals(sDriverIdOne)&&tDriver.getType()==2){ |
| | | orderDriverInfo.setPickUp(tDriver.getPickDate()); |
| | | } |
| | | if(tDriver.getDriverId().equals(driverid) &&tDriver.getType()==3){ |
| | | orderDriverInfo.setEmptyDate(tDriver.getEmptyDate()); |
| | | } |
| | | if(tDriver.getId().equals(driverIdOne) &&tDriver.getType()==4){ |
| | | if(tDriver.getDriverId().equals(driverIdOne) &&tDriver.getType()==4){ |
| | | orderDriverInfo.setReturnDate(tDriver.getReturnDate()); |
| | | } |
| | | orderDriverInfo.setContactEmail(tDriver.getEmail()); |
| | |
| | | transportInfo.setCTF(terminalStatus.getCtf()); |
| | | transportInfo.setClosedArea(terminalStatus.getClosedArea()); |
| | | transportInfo.setLFD(terminalStatus.getLfd()); |
| | | transportInfo.setAvailable(terminalStatus.getAvailability()); |
| | | |
| | | transportInfo.setList(orderDriverInfos); |
| | | Integer examSite = tOrder.getExamSite(); |
| | |
| | | TOrder tOrder = orderService.selectById(orderId); |
| | | TTransportation list = companySelectDriverSingleDto.getList(); |
| | | list.setOrderId(companySelectDriverSingleDto.getOrderId()); |
| | | Integer type = companySelectDriverSingleDto.getType(); |
| | | Integer type = companySelectDriverSingleDto.getList().getType(); |
| | | if(type==1){ |
| | | tTransportationService.delete(new EntityWrapper<TTransportation>().eq("order_id",orderId).eq("driver_id",tOrder.getsDriverid()).eq("type",1)); |
| | | tOrder.setsDriverid(list.getDriverId()); |
| | |
| | | tTransportationService.delete(new EntityWrapper<TTransportation>().eq("order_id",orderId).eq("driver_id",tOrder.geteDriverIdOne()).eq("type",4)); |
| | | tOrder.seteDriverIdOne(list.getDriverId()); |
| | | } |
| | | tTransportationService.insert(list); |
| | | tTransportationService.insert(list); |
| | | // 删除原来的司机信息 |
| | | // 更改订单信息 |
| | | orderService.updateById(tOrder); |