| | |
| | | import cn.exrick.xboot.core.common.utils.ResultUtil; |
| | | import cn.exrick.xboot.core.common.vo.PageVo; |
| | | import cn.exrick.xboot.core.common.vo.Result; |
| | | import cn.exrick.xboot.your.entity.AddOil; |
| | | import cn.exrick.xboot.your.entity.Car; |
| | | import cn.exrick.xboot.your.entity.DrivingRecord; |
| | | import cn.exrick.xboot.your.entity.Suggest; |
| | | import cn.exrick.xboot.your.entity.*; |
| | | import cn.exrick.xboot.your.service.IAddOilService; |
| | | import cn.exrick.xboot.your.service.ICarService; |
| | | import cn.exrick.xboot.your.service.IDrivingRecordService; |
| | | import cn.exrick.xboot.your.service.IOrderTaskService; |
| | | import cn.exrick.xboot.your.vo.CarVo; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.Wrapper; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhangzeli |
| | |
| | | private IAddOilService iAddOilService; |
| | | @Autowired |
| | | private IDrivingRecordService iDrivingRecordService; |
| | | @Autowired |
| | | private IOrderTaskService iOrderTaskService; |
| | | |
| | | |
| | | @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) |
| | | @ApiOperation(value = "通过id获取") |
| | |
| | | |
| | | @RequestMapping(value = "/getAll", method = RequestMethod.GET) |
| | | @ApiOperation(value = "获取全部数据") |
| | | public Result<List<CarVo>> getAll(String beginTime,String endTime) { |
| | | public Result<List<CarVo>> getAll(String beginTime,String endTime,PageVo page) { |
| | | List<CarVo> carVos = new ArrayList<>(); |
| | | List<Car> list = iCarService.getAll2(); |
| | | for (Car car:list){ |
| | | |
| | | IPage<Car> list = iCarService.getAll2(PageUtil.initMpPage(page)); |
| | | for (Car car:list.getRecords()){ |
| | | CarVo carVo = new CarVo(); |
| | | //加油信息 |
| | | QueryWrapper<AddOil> queryWrapper = new QueryWrapper<>(); |
| | |
| | | wrapper.le(endTime!=null && endTime!="","in_time",endTime); |
| | | queryWrapper.le(endTime!=null && endTime!="","add_date",beginTime); |
| | | |
| | | QueryWrapper<OrderTask> wrapper1 = new QueryWrapper<>(); |
| | | |
| | | |
| | | wrapper1.eq("car_id",car.getId()); |
| | | wrapper1.ge(beginTime!=null && beginTime!="","send_date",beginTime); |
| | | wrapper1.le(endTime!=null && endTime!="","send_date",endTime); |
| | | |
| | | OrderTask orderTask = iOrderTaskService.getOne(wrapper1); |
| | | |
| | | DrivingRecord drivingRecord = iDrivingRecordService.getOne(wrapper); |
| | | |
| | | AddOil addOil = iAddOilService.getOne(queryWrapper); |
| | | |
| | | |
| | | |
| | | if (addOil!=null){ |
| | | carVo.setMoney(addOil.getMoney()); |
| | |
| | | |
| | | carVo.setCar(car); |
| | | carVos.add(carVo); |
| | | carVo.setTotal(list.getTotal()); |
| | | } |
| | | return new ResultUtil<List<CarVo>>().setData(carVos); |
| | | } |
| | | @RequestMapping(value = "/getInfo", method = RequestMethod.GET) |
| | | @ApiOperation(value = "通过车辆id获取") |
| | | public Result<List<Car>> getInfo(String beginTime,String endTime) { |
| | | QueryWrapper<Car> wrapper = new QueryWrapper<>(); |
| | | wrapper.ge(beginTime!=null && beginTime!="","a.add_date",beginTime); |
| | | wrapper.le(endTime!=null && endTime!="","a.add_date",endTime); |
| | | wrapper.groupBy("car_no"); |
| | | List<Car> list2 = iCarService.getCarInfo2(wrapper); |
| | | List<Car> list = iCarService.getCarInfo(); |
| | | for (Car car:list2){ |
| | | for (Car car1:list){ |
| | | if (car.getId().equals(car1.getId())){ |
| | | car1.setAmount(car.getAmount()); |
| | | car1.setMileage(car.getMileage()); |
| | | car1.setMoney(car.getMoney()); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | return new ResultUtil<List<Car>>().setData(list); |
| | | } |
| | | |
| | | @RequestMapping(value = "/getByPage", method = RequestMethod.GET) |
| | | @ApiOperation(value = "分页获取") |