From a067fdbf6b1374a1402096c722257575916eab99 Mon Sep 17 00:00:00 2001 From: wjli <591616088@qq.com> Date: 星期四, 11 五月 2023 16:21:14 +0800 Subject: [PATCH] 1.首页分段显示 2.配送订单页可根据分段显示 3.后端配送率统计 --- xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/DrivingRecordController.java | 83 ++++++++++++++++++++++++++++++++++++++++- 1 files changed, 80 insertions(+), 3 deletions(-) diff --git a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/DrivingRecordController.java b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/DrivingRecordController.java index d58b1e4..fba72ed 100644 --- a/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/DrivingRecordController.java +++ b/xboot-modules/xboot-your/src/main/java/cn/exrick/xboot/your/controller/DrivingRecordController.java @@ -5,7 +5,9 @@ import cn.exrick.xboot.core.common.vo.PageVo; import cn.exrick.xboot.core.common.vo.Result; import cn.exrick.xboot.your.entity.DrivingRecord; +import cn.exrick.xboot.your.entity.OrderTask; import cn.exrick.xboot.your.service.IDrivingRecordService; +import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; @@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.*; import org.springframework.transaction.annotation.Transactional; +import java.util.Date; import java.util.List; /** @@ -30,6 +33,78 @@ @Autowired private IDrivingRecordService iDrivingRecordService; + + @RequestMapping(value = "/orderConfirm", method = RequestMethod.POST) + @ApiOperation(value = "璁㈠崟纭") + public Result<DrivingRecord> orderConfirm(DrivingRecord record) { + if(StrUtil.isEmpty(record.getCarId())){ + return ResultUtil.error("杞﹁締id涓嶈兘涓虹┖"); + } + + String format = DateUtil.format(new Date(), "yyyy-MM-dd"); + QueryWrapper<DrivingRecord> wrapper = new QueryWrapper<>(); + wrapper.eq("driving_date",format); + wrapper.eq("car_id",record.getCarId()); + int count = iDrivingRecordService.count(wrapper); + if(count>0){ + return ResultUtil.error("浠婃棩宸叉牳瀵癸紝璇峰嬁閲嶅鎻愪氦"); + } + + record.setDrivingDate(DateUtil.parse(format)); + + int flag=0; + if(record.getSanZheng()!=0){ + flag++; + }else if(record.getSanLiang()!=0){ + flag++; + }else if(record.getAnQuan()!=0){ + flag++; + }else if(record.getHouShiJing()!=0){ + flag++; + }else if(record.getLaBa()!=0){ + flag++; + }else if(record.getLunTai()!=0){ + flag++; + }else if(record.getQiTa()!=0){ + flag++; + }else if(record.getSiDeng()!=0){ + flag++; + }else if(record.getYiBiao()!=0){ + flag++; + }else if(record.getYuShuaQi()!=0){ + flag++; + } + if(flag>0){ + record.setYinHuan(1); + } + iDrivingRecordService.saveOrUpdate(record); + return ResultUtil.success("鎿嶄綔鎴愬姛"); + } + + @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); + wrapper.eq("car_id",carId); + DrivingRecord drivingRecord = iDrivingRecordService.getOne(wrapper); + if(drivingRecord==null){ + drivingRecord = new DrivingRecord(); + drivingRecord.setCarId(carId); + } + drivingRecord.setMileage(mileage); + drivingRecord.setInTime(DateUtil.parseDate(inDate)); + drivingRecord.setUserId(userId); + iDrivingRecordService.saveOrUpdate(drivingRecord); + return new ResultUtil<DrivingRecord>().setSuccessMsg("娣诲姞鎴愬姛"); + } @RequestMapping(value = "/get/{id}", method = RequestMethod.GET) @ApiOperation(value = "閫氳繃id鑾峰彇") @@ -49,9 +124,11 @@ @RequestMapping(value = "/getByPage", method = RequestMethod.GET) @ApiOperation(value = "鍒嗛〉鑾峰彇") - public Result<IPage<DrivingRecord>> getByPage(PageVo page) { - - IPage<DrivingRecord> data = iDrivingRecordService.page(PageUtil.initMpPage(page)); + public Result<IPage<DrivingRecord>> getByPage(PageVo page,String carNo) { + QueryWrapper<DrivingRecord> wrapper = new QueryWrapper<>(); + if(!StrUtil.isEmpty(carNo)) + wrapper.like("b.car_no","%"+carNo+"%"); + IPage<DrivingRecord> data = iDrivingRecordService.page2(PageUtil.initMpPage(page),wrapper); return new ResultUtil<IPage<DrivingRecord>>().setData(data); } -- Gitblit v1.9.1