| | |
| | | import com.agentdriving.driver.modular.system.warpper.*; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.agentdriving.driver.modular.system.model.Driver; |
| | | import com.agentdriving.driver.modular.system.model.DriverBank; |
| | | import com.agentdriving.driver.modular.system.model.Edition; |
| | | import com.agentdriving.driver.modular.system.model.JoiningRequirements; |
| | | import com.agentdriving.driver.modular.system.service.*; |
| | | import com.agentdriving.driver.modular.system.util.PayMoneyUtil; |
| | | import com.agentdriving.driver.modular.system.util.huawei.OBSUtil; |
| | | import com.agentdriving.driver.modular.system.util.huawei.SMSUtil; |
| | | import com.agentdriving.driver.modular.system.warpper.*; |
| | | import com.agentdriving.driver.modular.system.util.RedisUtil; |
| | | import com.agentdriving.driver.modular.system.util.ResultUtil; |
| | | import com.agentdriving.driver.modular.system.util.UUIDUtil; |
| | |
| | | } |
| | | } |
| | | String numberRandom = UUIDUtil.getNumberRandom(5); |
| | | SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); |
| | | SMSUtil.send(phone, "4d18e74a95ca400d802755fe0f903589", "[\"" + numberRandom + "\"]"); |
| | | redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 |
| | | return ResponseWarpper.success(ResultUtil.success()); |
| | | }catch (Exception e){ |
| | |
| | | @ApiOperation(value = "获取司机钱包明细", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "类型(1=收入,3=充值,4=支出,7=优惠券,8=保险)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "类型(1=收入,3=充值,4=支出,7=优惠券,8=保险,9=信息费,10=平台充值)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | |
| | | @ApiOperation(value = "账户余额充值", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"), |
| | | @ApiImplicitParam(value = "支付方式(1=微信,2=支付宝)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper balanceRecharge(Double amount){ |
| | | public ResponseWarpper balanceRecharge(Integer type, Double amount){ |
| | | if(null == amount){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("amount")); |
| | | } |
| | | if(null == type){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverService.balanceRecharge(uid, amount); |
| | | ResultUtil resultUtil = driverService.balanceRecharge(uid, type, amount); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | driverService.balanceRechargeCallback(out_trade_no, transaction_id); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 账户余额充值支付回调 |
| | | * @param request |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/balanceRechargeCallbackAli") |
| | | public void balanceRechargeCallbackAli(HttpServletRequest request, HttpServletResponse response){ |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.alipayCallback(request); |
| | | if(null != map){ |
| | | String out_trade_no = map.get("out_trade_no"); |
| | | String transaction_id = map.get("trade_no"); |
| | | String orderId = out_trade_no.substring(17); |
| | | driverService.balanceRechargeCallback(out_trade_no, transaction_id); |
| | | response.setContentType("text/html;charset=UTF-8"); |
| | | PrintWriter out; |
| | | out = response.getWriter(); |
| | | out.println("success"); // 请不要修改或删除 |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | |
| | | return ResponseWarpper.success(); |
| | | } |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone; |
| | | phone = "+86" + phone; |
| | | String value = redisUtil.getValue(phone); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(code)){ |
| | | resultUtil = ResultUtil.error("验证码无效"); |
| | |
| | | }) |
| | | public ResponseWarpper<String> uploadImg(MultipartFile file){ |
| | | try { |
| | | if(null == file){ |
| | | return ResponseWarpper.success(ResultUtil.error("请上传有效的图片")); |
| | | } |
| | | InputStream inputStream = file.getInputStream(); |
| | | String name = file.getOriginalFilename(); |
| | | name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/microenterprise") |
| | | // @ServiceLog(name = "绑定商户", url = "/api/driver/microenterprise") |
| | | @ApiOperation(value = "绑定商户", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "身份证号码", name = "IDCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "手机号", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper microenterprise(String name, String IDCode, String phone){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverService.microenterprise(uid, name, IDCode, phone); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | // |
| | | // @ResponseBody |
| | | // @PostMapping("/api/driver/microenterprise") |
| | | //// @ServiceLog(name = "绑定商户", url = "/api/driver/microenterprise") |
| | | // @ApiOperation(value = "绑定商户", tags = {"司机端-个人中心"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "String"), |
| | | // @ApiImplicitParam(value = "身份证号码", name = "IDCode", required = true, dataType = "String"), |
| | | // @ApiImplicitParam(value = "手机号", name = "phone", required = true, dataType = "String"), |
| | | // @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | // public ResponseWarpper microenterprise(String name, String IDCode, String phone){ |
| | | // try { |
| | | // Integer uid = driverService.getUserByRequest(); |
| | | // if(null == uid){ |
| | | // return ResponseWarpper.tokenErr(); |
| | | // } |
| | | // ResultUtil resultUtil = driverService.microenterprise(uid, name, IDCode, phone); |
| | | // return ResponseWarpper.success(resultUtil); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return new ResponseWarpper(500, e.getMessage()); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryBank") |
| | | // @ServiceLog(name = "获取绑定的银行卡", url = "/api/driver/queryBank") |
| | | @ApiOperation(value = "获取绑定的银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<DriverBank> queryBank(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | DriverBank driverId = driverBankService.selectOne(new EntityWrapper<DriverBank>().eq("driverId", uid)); |
| | | return ResponseWarpper.success(driverId); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | // @ResponseBody |
| | | // @PostMapping("/api/driver/queryBank") |
| | | //// @ServiceLog(name = "获取绑定的银行卡", url = "/api/driver/queryBank") |
| | | // @ApiOperation(value = "获取绑定的银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | // public ResponseWarpper<DriverBank> queryBank(){ |
| | | // try { |
| | | // Integer uid = driverService.getUserByRequest(); |
| | | // if(null == uid){ |
| | | // return ResponseWarpper.tokenErr(); |
| | | // } |
| | | // DriverBank driverId = driverBankService.selectOne(new EntityWrapper<DriverBank>().eq("driverId", uid)); |
| | | // return ResponseWarpper.success(driverId); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return new ResponseWarpper(500, e.getMessage()); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/addDriverBank") |
| | | // @ServiceLog(name = "绑定银行卡", url = "/api/driver/addDriverBank") |
| | | @ApiOperation(value = "绑定银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "身份证号码", name = "IDCode", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "手机号", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "银行卡号", name = "bankNumber", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper addDriverBank(String name, String phone, String IDCode, String bankNumber){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverBankService.addDriverBank(uid, name, phone, IDCode, bankNumber); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/delDriverBank") |
| | | // @ServiceLog(name = "解绑银行卡", url = "/api/driver/delDriverBank") |
| | | @ApiOperation(value = "解绑银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "银行卡id", name = "id", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper delDriverBank(Integer id){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverBankService.delDriverBank(uid, id); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | // @ResponseBody |
| | | // @PostMapping("/api/driver/addDriverBank") |
| | | //// @ServiceLog(name = "绑定银行卡", url = "/api/driver/addDriverBank") |
| | | // @ApiOperation(value = "绑定银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(value = "姓名", name = "name", required = true, dataType = "String"), |
| | | // @ApiImplicitParam(value = "身份证号码", name = "IDCode", required = true, dataType = "String"), |
| | | // @ApiImplicitParam(value = "手机号", name = "phone", required = true, dataType = "String"), |
| | | // @ApiImplicitParam(value = "银行卡号", name = "bankNumber", required = true, dataType = "String"), |
| | | // @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | // public ResponseWarpper addDriverBank(String name, String phone, String IDCode, String bankNumber){ |
| | | // try { |
| | | // Integer uid = driverService.getUserByRequest(); |
| | | // if(null == uid){ |
| | | // return ResponseWarpper.tokenErr(); |
| | | // } |
| | | // ResultUtil resultUtil = driverBankService.addDriverBank(uid, name, phone, IDCode, bankNumber); |
| | | // return ResponseWarpper.success(resultUtil); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return new ResponseWarpper(500, e.getMessage()); |
| | | // } |
| | | // } |
| | | // |
| | | // |
| | | // @ResponseBody |
| | | // @PostMapping("/api/driver/delDriverBank") |
| | | //// @ServiceLog(name = "解绑银行卡", url = "/api/driver/delDriverBank") |
| | | // @ApiOperation(value = "解绑银行卡", tags = {"司机端-个人中心"}, notes = "") |
| | | // @ApiImplicitParams({ |
| | | // @ApiImplicitParam(value = "银行卡id", name = "id", required = true, dataType = "int"), |
| | | // @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | // }) |
| | | // public ResponseWarpper delDriverBank(Integer id){ |
| | | // try { |
| | | // Integer uid = driverService.getUserByRequest(); |
| | | // if(null == uid){ |
| | | // return ResponseWarpper.tokenErr(); |
| | | // } |
| | | // ResultUtil resultUtil = driverBankService.delDriverBank(uid, id); |
| | | // return ResponseWarpper.success(resultUtil); |
| | | // }catch (Exception e){ |
| | | // e.printStackTrace(); |
| | | // return new ResponseWarpper(500, e.getMessage()); |
| | | // } |
| | | // } |
| | | } |