| | |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.stylefeng.guns.modular.system.dao.CarBrandMapper; |
| | | import com.stylefeng.guns.modular.system.dao.CarMapper; |
| | | import com.stylefeng.guns.modular.system.dao.CarModelMapper; |
| | | import com.stylefeng.guns.modular.system.dao.CompanyMapper; |
| | | import com.stylefeng.guns.modular.system.dao.*; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.ICarService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.*; |
| | | |
| | | |
| | |
| | | @Autowired |
| | | private IDriverService driverService; |
| | | |
| | | @Autowired |
| | | private DriverWorkMapper driverWorkMapper; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | |
| | | Integer carId = driver.getCarId(); |
| | | map.put("car", ""); |
| | | map.put("id", carId); |
| | | if(carId!=null){ |
| | | Car car = carMapper.selectById(carId); |
| | | if(car.getCarLicensePlate()!=null){ |
| | |
| | | } |
| | | |
| | | List<Map<String, Object>> list = carMapper.queryIdleDataFromId(driver.getId()); |
| | | // List<Map<String, Object>> list = carMapper.queryIdleData(driver.getFranchiseeId() != null && driver.getFranchiseeId() != 0 ? driver.getFranchiseeId() : ( |
| | | // driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); |
| | | for (Map<String, Object> stringObjectMap : list) { |
| | | // 1使用中 2空闲中 |
| | | if(stringObjectMap.get("useDriverId")!=null && stringObjectMap.get("useDriverId").toString().equals(uid.toString())){ |
| | | map.put("useState", 1); |
| | | }else { |
| | | map.put("useState", 0); |
| | | if(null == stringObjectMap.get("useDriverId")){ |
| | | stringObjectMap.put("useState", 2); |
| | | }else{ |
| | | Integer driverId = Integer.valueOf(stringObjectMap.get("useDriverId").toString()); |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(driverId, null, 1); |
| | | if(null == driverWork){ |
| | | stringObjectMap.put("useState", 2); |
| | | }else{ |
| | | stringObjectMap.put("useState", 1); |
| | | } |
| | | } |
| | | } |
| | | map.put("list", list); |
| | |
| | | |
| | | @Override |
| | | public boolean useState(Integer carId, Integer uid) { |
| | | Car car = carMapper.selectById(carId); |
| | | if(car.getUseDriverId()!=null || !car.getUseDriverId().equals(uid)){ |
| | | return false; |
| | | List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("carId", carId) |
| | | .eq("authState", 2).ne("flag", 3)); |
| | | for (Driver driver : drivers) { |
| | | DriverWork driverWork = driverWorkMapper.queryNewWork(driver.getId(), null, 1); |
| | | if(null != driverWork){ |
| | | return true; |
| | | } |
| | | } |
| | | return true; |
| | | |
| | | |
| | | return false; |
| | | } |
| | | |
| | | @Override |