| | |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.JwtTokenUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.crossCity.dao.LinePriceMapper; |
| | | import com.stylefeng.guns.modular.crossCity.model.DriverLine; |
| | | import com.stylefeng.guns.modular.crossCity.model.LinePrice; |
| | | import com.stylefeng.guns.modular.crossCity.server.IDriverLineService; |
| | | import com.stylefeng.guns.modular.smallLogistics.model.OrderLogistics; |
| | | import com.stylefeng.guns.modular.smallLogistics.server.IOrderLogisticsService; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Service |
| | |
| | | private Map<String, Long> loginTime = new HashMap<>();//登录时间 |
| | | |
| | | private Map<String, Integer> loginFailures = new HashMap<>();//登录失败次数 |
| | | |
| | | @Autowired |
| | | private IDriverLineService driverLineService; |
| | | |
| | | @Resource |
| | | private LinePriceMapper linePriceMapper; |
| | | |
| | | |
| | | |
| | |
| | | } |
| | | boolean idle = carService.idle(carId); |
| | | if(!idle){ |
| | | return ResultUtil.error("车辆正在服务中"); |
| | | } |
| | | Integer integer1 = driverMapper.selectCount(new EntityWrapper<Driver>().eq("carId", carId).eq("authState", 2).ne("flag", 3)); |
| | | if(integer1 > 0){ |
| | | return ResultUtil.error("车辆已被绑定了"); |
| | | } |
| | | ///判断车辆车型是否与实际关联线路需要的车型匹配 |
| | | Integer integer = driverServiceMapper.selectCount(new EntityWrapper<DriverService>().eq("driverId", uid).eq("type", 3)); |
| | | if(integer > 0){ |
| | | CarService carService1 = new CarService(); |
| | | carService1.setCarId(carId); |
| | | carService1.setType(3); |
| | | CarService carService2 = carServiceMapper.selectOne(carService1); |
| | | if(null == carService2){ |
| | | return ResultUtil.error("当前车辆不能运营城际业务"); |
| | | } |
| | | Integer serverCarModelId = carService2.getServerCarModelId(); |
| | | List<DriverLine> driverLines = driverLineService.selectList(new EntityWrapper<DriverLine>().eq("driverId", uid)); |
| | | List<Integer> collect = driverLines.stream().map(DriverLine::getLineId).collect(Collectors.toList()); |
| | | if(collect.size() == 0){ |
| | | return ResultUtil.error("司机还未关联线路"); |
| | | } |
| | | List<LinePrice> linePrices = linePriceMapper.selectList(new EntityWrapper<LinePrice>().in("lineId", collect).eq("state", 1)); |
| | | for (LinePrice linePrice : linePrices) { |
| | | if(!linePrice.getServerCarModelId().equals(serverCarModelId)){ |
| | | return ResultUtil.error("当前车辆的城际业务车型与司机关联线路的车型不一致"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | driver.setCarId(carId); |
| | | this.updateById(driver); |
| | | return ResultUtil.success(); |