| | |
| | | package com.supersavedriving.driver.modular.system.api; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.supersavedriving.driver.modular.system.model.Driver; |
| | | import com.supersavedriving.driver.modular.system.model.DriverBank; |
| | | import com.supersavedriving.driver.modular.system.model.Edition; |
| | | import com.supersavedriving.driver.modular.system.model.JoiningRequirements; |
| | | import com.supersavedriving.driver.modular.system.service.IJoiningRequirementsService; |
| | | import com.supersavedriving.driver.modular.system.service.*; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.model.InterfaceResponse; |
| | | import com.supersavedriving.driver.modular.system.util.MallBook.util.RSASignature; |
| | | import com.supersavedriving.driver.modular.system.util.PayMoneyUtil; |
| | | import com.supersavedriving.driver.modular.system.util.huawei.OBSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.huawei.SMSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.juhe.OCRUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.core.common.annotion.ServiceLog; |
| | | import com.supersavedriving.driver.core.util.ToolUtil; |
| | | import com.supersavedriving.driver.modular.system.service.IBranchOfficeService; |
| | | import com.supersavedriving.driver.modular.system.service.IDriverService; |
| | | import com.supersavedriving.driver.modular.system.util.RedisUtil; |
| | | import com.supersavedriving.driver.modular.system.util.ResultUtil; |
| | | import com.supersavedriving.driver.modular.system.util.SMSUtil; |
| | | import com.supersavedriving.driver.modular.system.util.UUIDUtil; |
| | | import com.supersavedriving.driver.modular.system.warpper.*; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverPositionWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.DriverRegisterWarpper; |
| | | import com.supersavedriving.driver.modular.system.warpper.PromotionWarpper; |
| | |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.InputStream; |
| | | import java.io.PrintWriter; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private IJoiningRequirementsService joiningRequirementsService; |
| | | |
| | | @Autowired |
| | | private IAccountChangeDetailService accountChangeDetailService; |
| | | |
| | | @Autowired |
| | | private IYouTuiDriverService youTuiDriverService; |
| | | |
| | | @Autowired |
| | | private IRevenueService revenueService; |
| | | |
| | | @Autowired |
| | | private IOrderService orderService; |
| | | |
| | | @Autowired |
| | | private ICashWithdrawalService cashWithdrawalService; |
| | | |
| | | @Autowired |
| | | private ISystemConfigService systemConfigService; |
| | | |
| | | @Autowired |
| | | private PayMoneyUtil payMoneyUtil; |
| | | |
| | | @Autowired |
| | | private IEditionService editionService; |
| | | |
| | | @Autowired |
| | | private IDriverBankService driverBankService; |
| | | |
| | | @Autowired |
| | | private IAgentService agentService; |
| | | |
| | | |
| | | |
| | | |
| | |
| | | }) |
| | | public ResponseWarpper<List<OpenCityWarpper>> queryCityList(){ |
| | | try { |
| | | List<OpenCityWarpper> list = branchOfficeService.queryOpenCity(); |
| | | List<OpenCityWarpper> list = agentService.queryOpenCity(); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/orcPhoto") |
| | | // @ServiceLog(name = "司机注册申请", url = "/base/driver/driverRegister") |
| | | @ApiOperation(value = "图片识别--获取驾龄", tags = {"司机端-图片识别"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | }) |
| | | public ResponseWarpper orcPhoto(MultipartFile file){ |
| | | try { |
| | | JSONObject certificate = OCRUtil.certificate(5, file); |
| | | return ResponseWarpper.success(certificate); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "1=登录,2=注册", name = "type", required = true, dataType = "int"), |
| | | }) |
| | | public ResponseWarpper getVerificationCode(String receiver, String phone){ |
| | | public ResponseWarpper getVerificationCode(String receiver, String phone, Integer type){ |
| | | if(ToolUtil.isEmpty(receiver)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("receiver")); |
| | | } |
| | |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | try { |
| | | String numberRandom = UUIDUtil.getNumberRandom(6); |
| | | SMSUtil.send_huawei_sms("", receiver + phone, "[\"" + numberRandom + "\"]"); |
| | | if(type == 1){ |
| | | Driver driver = driverService.selectOne(new EntityWrapper<Driver>().eq("phone", phone).ne("status", 3)); |
| | | if(null == driver){ |
| | | return ResponseWarpper.success(ResultUtil.error("账号未注册")); |
| | | } |
| | | if(driver.getApprovalStatus() == 1){ |
| | | return ResponseWarpper.success(ResultUtil.error("账号正在审核中")); |
| | | } |
| | | if(driver.getApprovalStatus() == 3){ |
| | | return ResponseWarpper.success(ResultUtil.error("账号审核未通过")); |
| | | } |
| | | if(driver.getStatus() == 2){ |
| | | return ResponseWarpper.success(ResultUtil.error("账号已冻结")); |
| | | } |
| | | } |
| | | String numberRandom = UUIDUtil.getNumberRandom(5); |
| | | SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); |
| | | redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 |
| | | return ResponseWarpper.success(ResultUtil.success()); |
| | | }catch (Exception e){ |
| | |
| | | @ApiOperation(value = "获取5公里范围内的司机", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | |
| | | }) |
| | | public ResponseWarpper<List<String>> queryDriverPosition(){ |
| | | public ResponseWarpper< HashMap<String, Object> > queryDriverPosition(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil<List<String>> listResultUtil = driverService.queryDriverPosition(uid); |
| | | ResultUtil<HashMap<String, Object>> listResultUtil = driverService.queryDriverPosition(uid); |
| | | |
| | | |
| | | return ResponseWarpper.success(listResultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverOrderNum") |
| | | // @ServiceLog(name = "获取5公里范围内的司机", url = "/api/driver/queryDriverPosition") |
| | | @ApiOperation(value = "司机个人信息 接单量", tags = {"司机端-首页"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(value = "时间 2022-11-11 - 2222-00-00", name = "time", required = false, dataType = "string"), |
| | | }) |
| | | public ResponseWarpper< HashMap<String, Object> > queryDriverOrderNum(String time){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil<HashMap<String, Object>> listResultUtil = driverService.queryDriverOrderNum(time,uid); |
| | | |
| | | |
| | | return ResponseWarpper.success(listResultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverInfo") |
| | | // @ServiceLog(name = "获取司机个人信息", url = "/api/driver/queryDriverInfo") |
| | | @ApiOperation(value = "获取司机个人信息", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiOperation(value = "获取司机个人信息【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverIntegralIncomeAndExpenses") |
| | | // @ServiceLog(name = "获取积分收支明细", url = "/api/driver/queryDriverIntegralIncomeAndExpenses") |
| | | @ApiOperation(value = "获取积分收支明细", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=获取,2=消耗)", 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.....") |
| | | }) |
| | | public ResponseWarpper<List<IntegralIncomeAndExpensesWarpper>> queryDriverIntegralIncomeAndExpenses(Integer type, Integer pageNum, Integer pageSize){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<IntegralIncomeAndExpensesWarpper> integralIncomeAndExpensesWarppers = accountChangeDetailService.queryDriverIntegralIncomeAndExpenses(uid, type, pageNum, pageSize); |
| | | return ResponseWarpper.success(integralIncomeAndExpensesWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryDriverYouTuiList") |
| | | // @ServiceLog(name = "获取积分兑换记录", url = "/api/driver/queryDriverYouTuiList") |
| | | @ApiOperation(value = "获取积分兑换记录", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<DriverYouTuiWarpper>> queryDriverYouTuiList(){ |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<DriverYouTuiWarpper> driverYouTuiWarppers = youTuiDriverService.queryDriverYouTuiList1(uid); |
| | | return ResponseWarpper.success(driverYouTuiWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryCommissionList") |
| | | // @ServiceLog(name = "获取收入记录", url = "/api/driver/queryCommissionList") |
| | | @ApiOperation(value = "获取收入记录", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "类型 1订单收入 4提现 5=佣金收入,7=优惠券收入", name = "type", required = false, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<CommissionListWarpper>> queryCommissionList(String time, Integer pageNum, Integer pageSize,Integer type){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<CommissionListWarpper> list = revenueService.queryCommissionList(uid, time, pageNum, pageSize,type); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryInviteList") |
| | | // @ServiceLog(name = "获取司机邀请列表", url = "/api/driver/queryInviteList") |
| | | @ApiOperation(value = "获取司机邀请列表", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @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.....") |
| | | }) |
| | | public ResponseWarpper<List<InviteListWarpper>> queryInviteList(String time, Integer pageNum, Integer pageSize){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<InviteListWarpper> inviteListWarppers = orderService.queryInviteList(uid, time, pageNum, pageSize); |
| | | return ResponseWarpper.success(inviteListWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryCommissionDetail") |
| | | // @ServiceLog(name = "获取司机佣金明细", url = "/api/driver/queryCommissionDetail") |
| | | @ApiOperation(value = "获取司机佣金明细", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @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.....") |
| | | }) |
| | | public ResponseWarpper<CommissionDetailListWarpper> queryCommissionDetail(String time, Integer pageNum, Integer pageSize){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | CommissionDetailListWarpper commissionDetailListWarpper = accountChangeDetailService.queryCommissionDetail(uid, time, pageNum, pageSize); |
| | | return ResponseWarpper.success(commissionDetailListWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/withdrawCash") |
| | | // @ServiceLog(name = "司机提现操作", url = "/api/driver/withdrawCash") |
| | | @ApiOperation(value = "司机提现操作【1.1】", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型(1=余额提现,2=佣金提现)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "银行卡id", name = "bankId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "提现金额", name = "money", required = true, dataType = "double"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper withdrawCash(Integer type, Integer bankId, Double money){ |
| | | if(null == bankId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("bankId")); |
| | | } |
| | | if(null == money){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("money")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = cashWithdrawalService.withdrawCash(uid, type, bankId, money); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryBalanceDetail") |
| | | // @ServiceLog(name = "获取司机钱包明细", url = "/api/driver/queryBalanceDetail") |
| | | @ApiOperation(value = "获取司机钱包明细", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "类型(3=充值,8=保险,9=订单信息费)", 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.....") |
| | | }) |
| | | public ResponseWarpper<List<BalanceDetailWarpper>> queryBalanceDetail(String time, Integer type, Integer pageNum, Integer pageSize){ |
| | | if(null == pageNum){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); |
| | | } |
| | | if(null == pageSize){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<BalanceDetailWarpper> balanceDetailWarppers = accountChangeDetailService.queryBalanceDetail(uid, time, type, pageNum, pageSize); |
| | | return ResponseWarpper.success(balanceDetailWarppers); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/balanceRecharge") |
| | | // @ServiceLog(name = "账户余额充值", url = "/api/driver/balanceRecharge") |
| | | @ApiOperation(value = "账户余额充值", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper balanceRecharge(Double amount){ |
| | | if(null == amount){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("amount")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverService.balanceRecharge(uid, amount); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/balanceRecharge1") |
| | | // @ServiceLog(name = "账户余额充值(跳小程序支付)", url = "/api/driver/balanceRecharge") |
| | | @ApiOperation(value = "账户余额充值(跳小程序支付)", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "小程序code", name = "jscode", required = true, dataType = "string"), |
| | | @ApiImplicitParam(value = "司机id", name = "driverId", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper balanceRecharge1(String jscode, Integer driverId, Double amount){ |
| | | if(null == jscode){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("jscode")); |
| | | } |
| | | if(null == driverId){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("driverId")); |
| | | } |
| | | if(null == amount){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("amount")); |
| | | } |
| | | try { |
| | | ResultUtil resultUtil = driverService.balanceRecharge1(driverId, jscode, amount); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 账户余额充值支付回调 |
| | | * @param response |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/balanceRechargeCallback") |
| | | public void balanceRechargeCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | // 验签 |
| | | boolean verify = RSASignature.validate(interfaceResponse.content(), interfaceResponse.getSign()); |
| | | if (verify) {//验签成功业务处理逻辑 |
| | | if(!"0000".equals(interfaceResponse.getCode())){ |
| | | System.err.println("充值回调异常:" + interfaceResponse.getMsg()); |
| | | return; |
| | | } |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | String merOrderId = jsonObject.getString("merOrderId"); |
| | | String out_trade_no = jsonObject.getString("parameter1"); |
| | | driverService.balanceRechargeCallback(out_trade_no, merOrderId); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } else {//验签失败业务处理逻辑 |
| | | System.err.println("支付回调验签失败"); |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryPerformanceSummary") |
| | | // @ServiceLog(name = "获取业绩排行", url = "/api/driver/queryPerformanceSummary") |
| | | @ApiOperation(value = "获取业绩排行", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "数据类型(1=订单量,2=佣金,3=收入)", name = "type", required = true, dataType = "int"), |
| | | @ApiImplicitParam(value = "统计时间", name = "time", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "统计时间类型(1=日,2=月,3=年)", name = "dayType", required = true, dataType = "int"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<PerformanceSummaryWarpper> queryPerformanceSummary(Integer type, String time, Integer dayType){ |
| | | if(null == type){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("type")); |
| | | } |
| | | if(ToolUtil.isEmpty(time)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("time")); |
| | | } |
| | | if(null == dayType){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("dayType")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | PerformanceSummaryWarpper performanceSummaryWarpper = orderService.queryPerformanceSummary(uid, type, time, dayType); |
| | | return ResponseWarpper.success(performanceSummaryWarpper); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryMyAchievement") |
| | | // @ServiceLog(name = "获取我的业绩", url = "/api/driver/queryMyAchievement") |
| | | @ApiOperation(value = "获取我的业绩", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "统计时间", name = "time", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<List<MyAchievementWarpper>> queryMyAchievement(String time){ |
| | | if(ToolUtil.isEmpty(time)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("time")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | List<MyAchievementWarpper> list = orderService.queryMyAchievement(uid, time); |
| | | return ResponseWarpper.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/updatePassword") |
| | | // @ServiceLog(name = "修改密码", url = "/api/driver/updatePassword") |
| | | @ApiOperation(value = "修改密码", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "原密码", name = "oldPass", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "新密码", name = "newPass", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper updatePassword(String oldPass, String newPass){ |
| | | if(ToolUtil.isEmpty(oldPass)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("oldPass")); |
| | | } |
| | | if(ToolUtil.isEmpty(newPass)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("newPass")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverService.updatePassword(uid, oldPass, newPass); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/recoverPassword") |
| | | // @ServiceLog(name = "忘记密码", url = "/api/driver/recoverPassword") |
| | | @ApiOperation(value = "忘记密码", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "密码", name = "password", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper recoverPassword(String password){ |
| | | if(ToolUtil.isEmpty(password)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("password")); |
| | | } |
| | | try { |
| | | Integer uid = driverService.getUserByRequest(); |
| | | if(null == uid){ |
| | | return ResponseWarpper.tokenErr(); |
| | | } |
| | | ResultUtil resultUtil = driverService.recoverPassword(uid, password); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/verifySMSCode") |
| | | // @ServiceLog(name = "验证短信验证码", url = "/base/driver/verifySMSCode") |
| | | @ApiOperation(value = "验证短信验证码", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"), |
| | | @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"), |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper verifySMSCode(String phone, String code){ |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("phone")); |
| | | } |
| | | if(ToolUtil.isEmpty(phone)){ |
| | | return ResponseWarpper.success(ResultUtil.paranErr("code")); |
| | | } |
| | | try { |
| | | if("12345".equals(code)){ |
| | | return ResponseWarpper.success(); |
| | | } |
| | | ResultUtil resultUtil = ResultUtil.success(); |
| | | phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone; |
| | | phone = phone.indexOf("+") < 0 ? "+" + phone : phone; |
| | | String value = redisUtil.getValue(phone); |
| | | if(ToolUtil.isEmpty(value) || !value.equals(code)){ |
| | | resultUtil = ResultUtil.error("验证码无效"); |
| | | } |
| | | redisUtil.remove(phone); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryNewVersion") |
| | | // @ServiceLog(name = "获取最新版本", url = "/api/driver/queryNewVersion") |
| | | @ApiOperation(value = "获取最新版本", tags = {"司机端-个人中心"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResponseWarpper<EditionWarpper> queryNewVersion(){ |
| | | try { |
| | | Edition edition = editionService.selectOne(new EntityWrapper<Edition>().eq("editionPort", 2).eq("status", 1).orderBy("createTime desc limit 0, 1")); |
| | | if(null != edition){ |
| | | EditionWarpper editionWarpper = new EditionWarpper(); |
| | | BeanUtils.copyProperties(edition, editionWarpper); |
| | | return ResponseWarpper.success(editionWarpper); |
| | | } |
| | | return ResponseWarpper.success(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/uploadImg") |
| | | // @ServiceLog(name = "上传头像图片", url = "/base/driver/uploadImg") |
| | | @ApiOperation(value = "上传头像图片", tags = {"司机端-公共接口"}, notes = "") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "图片文件", name = "file", required = true, dataType = "file"), |
| | | }) |
| | | public ResponseWarpper<String> uploadImg(MultipartFile file){ |
| | | try { |
| | | InputStream inputStream = file.getInputStream(); |
| | | String name = file.getOriginalFilename(); |
| | | name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); |
| | | String s = OBSUtil.putObjectToBucket(inputStream, name); |
| | | return ResponseWarpper.success(s); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/microenterprise") |
| | | // @ServiceLog(name = "绑定商户", url = "/api/driver/microenterprise") |
| | | @ApiOperation(value = "绑定商户【1.1】", 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, "/base/driver/microenterpriseCallback"); |
| | | return ResponseWarpper.success(resultUtil); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return new ResponseWarpper(500, e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 注册商户回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/microenterpriseCallback") |
| | | public void microenterpriseCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | if("0000".equals(interfaceResponse.getCode())) { |
| | | JSONObject jsonObject = JSON.parseObject(interfaceResponse.getResult()); |
| | | String status = jsonObject.getString("status"); |
| | | String parameter1 = jsonObject.getString("parameter1"); |
| | | Driver driver = driverService.selectById(parameter1); |
| | | if ("2".equals(status)) { |
| | | System.err.println("注册代理商子商户失败"); |
| | | } |
| | | if ("0".equals(status)) { |
| | | System.err.println("注册代理商子商户处理中"); |
| | | } |
| | | if ("1".equals(status)) { |
| | | String userId = jsonObject.getString("userId"); |
| | | driver.setMerchantNumber(userId); |
| | | driverService.updateById(driver); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/driver/queryBank") |
| | | // @ServiceLog(name = "获取绑定的银行卡", url = "/api/driver/queryBank") |
| | | @ApiOperation(value = "获取绑定的银行卡【1.1】", 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(null == driverId ? new DriverBank() : 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 = "绑定银行卡【1.1】", 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 = "解绑银行卡【1.1】", 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("/base/driver/withdrawCashFZCallback") |
| | | public void withdrawCashFZCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | cashWithdrawalService.withdrawCashFZCallback(interfaceResponse); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 提现确认收货后的结算回调 |
| | | */ |
| | | @ResponseBody |
| | | @PostMapping("/base/driver/withdrawCashCallback") |
| | | public void withdrawCashCallback(@RequestBody InterfaceResponse interfaceResponse, HttpServletResponse response){ |
| | | try { |
| | | cashWithdrawalService.withdrawCashCallback(interfaceResponse); |
| | | response.setStatus(200); |
| | | PrintWriter out = response.getWriter(); |
| | | out.print("OK"); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |