xuhy
2023-12-12 9e09fbcbd57a2b2258ba3a783231f1c86ca699ba
DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/service/impl/CarServiceImpl.java
@@ -126,34 +126,30 @@
     * @throws Exception
     */
    @Override
    public ResultUtil addCar(Integer modelId, String color, String licensePlate, Date time, String drivingLicensePhoto, String drivingLicenseEndTime,
                             String carPhoto, String insurancePhoto, String commercialInsuranceTime, Integer uid,Integer id) throws Exception {
    public ResultUtil addCar(Integer modelId, String color, String licensePlate, Date time, String drivingLicenseNumber, String drivingLicensePhoto, String drivingLicenseEndTime,
                             String carPhoto, String insurancePhoto, String commercialInsuranceTime, Integer uid,Integer id, String peopleAndCarsPhone, Integer language) throws Exception {
        Car query = carMapper.query(licensePlate);
        if(id==null){
            if(null != query){
                return ResultUtil.error("车牌号已经使用");
                return ResultUtil.error(language == 1 ? "车牌号已经使用" : language == 2 ? "Plate number is already in use" : "Le numéro de plaque est déjà utilisé");
            }
        }else{
            if(null != query && !id.equals(query.getId())){
                return ResultUtil.error("车牌号已经使用");
                return ResultUtil.error(language == 1 ? "车牌号已经使用" : language == 2 ? "Plate number is already in use" : "Le numéro de plaque est déjà utilisé");
            }
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Car car = new Car();
        car.setDriverId(uid);
        car = carMapper.selectOne(car);
        if(car==null){
            car = new Car();
            car.setId(id);
        }
        car.setPeopleAndCarsPhone(peopleAndCarsPhone);
        car.setCarModelId(modelId);
        CarModel carModel = carModelMapper.selectById(modelId);
        car.setCarBrandId(carModel.getBrandId());
        car.setCarColor(color);
        car.setCarLicensePlate(licensePlate);
        car.setAnnualInspectionTime(time);
        car.setDrivingLicenseNumber(drivingLicenseNumber);
        car.setDrivingLicensePhoto(drivingLicensePhoto);
        if(ToolUtil.isNotEmpty(drivingLicenseEndTime)){
            car.setDrivingLicenseEndTime(sdf.parse(drivingLicenseEndTime));