| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.modular.system.model.Company; |
| | | import com.stylefeng.guns.modular.system.model.Driver; |
| | | import com.stylefeng.guns.modular.system.model.LoginLog; |
| | | import com.stylefeng.guns.modular.system.model.TWithdrawal; |
| | | import com.stylefeng.guns.modular.system.service.ICarService; |
| | | import com.stylefeng.guns.modular.system.service.ICompanyService; |
| | | import com.stylefeng.guns.modular.system.service.IDriverService; |
| | | import com.stylefeng.guns.modular.system.service.ITWithdrawalService; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | |
| | | private IDriverService driverService; |
| | | @Autowired |
| | | private ITWithdrawalService withdrawalService; |
| | | @Autowired |
| | | private ICompanyService companyService; |
| | | /** |
| | | * 司机提现 |
| | | * @return |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil queryList(Integer pageNum,Integer size,HttpServletRequest request){ |
| | | public ResultUtil queryList(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | // Page<TWithdrawal> page = new PageFactory<TWithdrawal>().defaultPage(); |
| | | // List<Map<String, Object>> result = withdrawalService.queryList(page, uid); |
| | | // page.setRecords((List<TWithdrawal>) new LogWarpper(result).warp()); |
| | | // return super.packForBT(page); |
| | | List<TWithdrawal> list = withdrawalService.selectList(new EntityWrapper<TWithdrawal>().eq("driverId", uid)); |
| | | return ResultUtil.success(list); |
| | | Page<TWithdrawal> page = new PageFactory<TWithdrawal>().defaultPage(); |
| | | List<TWithdrawal> result = withdrawalService.queryList(page, uid); |
| | | page.setRecords(result); |
| | | return ResultUtil.success(super.packForBT(page)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 查询司机余额是否够接单 |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/driverCanTakeOrder") |
| | | @ApiOperation(value = "查询司机余额是否够接单,返回值 1=可接单 0=不可接单,余额不足", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil driverCanTakeOrder(HttpServletRequest request){ |
| | | try { |
| | | Integer uid = driverService.getUserIdFormRedis(request); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | Driver driver = driverService.selectById(uid); |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | Double driverRestriction = company.getDriverRestriction(); |
| | | if(driverRestriction>=driver.getBalance()){ |
| | | return ResultUtil.success(0); |
| | | }else { |
| | | return ResultUtil.success(1); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |