| | |
| | | @RequestMapping(value = "/updateMileage", method = RequestMethod.POST) |
| | | @ApiOperation(value = "添加行车记录") |
| | | public Result<DrivingRecord> updateMileage(String carId,int mileage,String userId,String inDate) { |
| | | if(StrUtil.isEmpty(userId)){ |
| | | return ResultUtil.error("参数不完整"); |
| | | } |
| | | if(StrUtil.isEmpty(carId)){ |
| | | return ResultUtil.error("参数不完整"); |
| | | } |
| | | String format = DateUtil.format(new Date(), "yyyy-MM-dd"); |
| | | QueryWrapper<DrivingRecord> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("driving_date",format); |
| | |
| | | DrivingRecord drivingRecord = iDrivingRecordService.getOne(wrapper); |
| | | if(drivingRecord==null){ |
| | | drivingRecord = new DrivingRecord(); |
| | | drivingRecord.setCarId(carId); |
| | | } |
| | | drivingRecord.setMileage(mileage); |
| | | drivingRecord.setInTime(DateUtil.parseDate(inDate)); |