From c0f0b2825ed3dbef86b381c2490277164446dc10 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期六, 18 三月 2023 17:28:01 +0800 Subject: [PATCH] 新增加司机端接口 --- driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java | 54 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiWarpper.java | 32 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/IntegralIncomeAndExpensesWarpper.java | 20 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/YouTuiController.java | 126 ++++ driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java | 25 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java | 42 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/SMSUtil.java | 48 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderStatusWarpper.java | 16 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/ICashWithdrawalService.java | 23 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/CashWithdrawalMapper.java | 11 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTui.java | 74 ++ driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java | 208 ++++++ driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/HallOrderList.java | 2 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/DriverMapper.xml | 1 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/CashWithdrawalServiceImpl.java | 56 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/RevenueServiceImpl.java | 69 ++ driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/CashWithdrawalMapper.xml | 16 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java | 31 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionListWarpper.java | 20 driver/guns-admin/pom.xml | 8 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/OrderMapper.java | 26 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailWarpper.java | 22 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiService.java | 11 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiDriverMapper.java | 42 + driver/guns-admin/src/main/java/com/supersavedriving/driver/core/common/exception/BizExceptionEnum.java | 4 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderInfoWarpper.java | 2 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java | 36 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/InviteListWarpper.java | 20 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiListWarpper.java | 20 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml | 48 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiDriverServiceImpl.java | 128 ++++ driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverOrderListWarpper.java | 28 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiServiceImpl.java | 16 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailListWarpper.java | 20 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/AccountChangeDetailMapper.java | 37 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IDriverService.java | 7 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml | 56 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/CashWithdrawal.java | 59 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/AccountChangeDetail.java | 5 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IRevenueService.java | 14 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTuiDriver.java | 20 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/OBSUtil.java | 43 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiMapper.xml | 19 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiDriverService.java | 45 + driver/pom.xml | 6 driver/guns-admin/src/main/java/com/supersavedriving/driver/core/intercept/RestApiInteceptor.java | 7 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Driver.java | 5 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Revenue.java | 5 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java | 41 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfo.java | 4 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IAccountChangeDetailService.java | 27 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiDriverMapper.xml | 51 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml | 1 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfoWarpper.java | 6 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiMapper.java | 11 55 files changed, 1,717 insertions(+), 57 deletions(-) diff --git a/driver/guns-admin/pom.xml b/driver/guns-admin/pom.xml index ce7f133..ee0e663 100644 --- a/driver/guns-admin/pom.xml +++ b/driver/guns-admin/pom.xml @@ -154,11 +154,11 @@ <artifactId>alipay-sdk-java</artifactId> <version>4.8.10.ALL</version> </dependency> - <!-- oos对象存储 --> + <!-- obs对象存储 --> <dependency> - <groupId>com.aliyun.oss</groupId> - <artifactId>aliyun-sdk-oss</artifactId> - <version>3.8.0</version> + <groupId>com.huaweicloud</groupId> + <artifactId>esdk-obs-java-bundle</artifactId> + <version>[3.21.11,)</version> </dependency> <!-- https://mvnrepository.com/artifact/com.aliyun/aliyun-java-sdk-core --> <dependency> diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/common/exception/BizExceptionEnum.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/common/exception/BizExceptionEnum.java index b27a586..3b4d2ec 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/common/exception/BizExceptionEnum.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/common/exception/BizExceptionEnum.java @@ -58,8 +58,8 @@ /** * token异常 */ - TOKEN_EXPIRED(10030, "token过期"), - TOKEN_ERROR(10030, "token验证失败"), + TOKEN_EXPIRED(600, "token过期"), + TOKEN_ERROR(600, "token验证失败"), /** * 签名异常 diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/intercept/RestApiInteceptor.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/intercept/RestApiInteceptor.java index 29198c4..cad2ec8 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/intercept/RestApiInteceptor.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/core/intercept/RestApiInteceptor.java @@ -5,6 +5,7 @@ import com.supersavedriving.driver.core.util.JwtTokenUtil; import com.supersavedriving.driver.core.base.tips.ErrorTip; import com.supersavedriving.driver.core.util.RenderUtil; +import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; import io.jsonwebtoken.JwtException; import org.springframework.web.method.HandlerMethod; import org.springframework.web.servlet.handler.HandlerInterceptorAdapter; @@ -48,12 +49,14 @@ } } catch (JwtException e) { //有异常就是token解析失败 - RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); +// RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); + RenderUtil.renderJson(response, ResponseWarpper.tokenErr()); return false; } } else { //header没有带Bearer字段 - RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); +// RenderUtil.renderJson(response, new ErrorTip(BizExceptionEnum.TOKEN_ERROR.getCode(), BizExceptionEnum.TOKEN_ERROR.getMessage())); + RenderUtil.renderJson(response, ResponseWarpper.tokenErr()); return false; } return true; diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java index b6ad26a..da01988 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java @@ -2,17 +2,13 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; 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.huawei.SMSUtil; 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; @@ -50,6 +46,21 @@ @Autowired private IJoiningRequirementsService joiningRequirementsService; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; + + @Autowired + private IYouTuiDriverService youTuiDriverService; + + @Autowired + private IRevenueService revenueService; + + @Autowired + private IOrderService orderService; + + @Autowired + private ICashWithdrawalService cashWithdrawalService; @@ -132,8 +143,8 @@ return ResponseWarpper.success(ResultUtil.paranErr("phone")); } try { - String numberRandom = UUIDUtil.getNumberRandom(6); - SMSUtil.send_huawei_sms("", receiver + phone, "[\"" + numberRandom + "\"]"); + String numberRandom = UUIDUtil.getNumberRandom(5); + SMSUtil.send(receiver + phone, "", "[\"" + numberRandom + "\"]"); redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 return ResponseWarpper.success(ResultUtil.success()); }catch (Exception e){ @@ -377,4 +388,185 @@ 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<DriverYouTuiListWarpper>> queryDriverYouTuiList(){ + try { + Integer uid = driverService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.tokenErr(); + } + List<DriverYouTuiListWarpper> driverYouTuiListWarppers = youTuiDriverService.queryDriverYouTuiList(uid); + return ResponseWarpper.success(driverYouTuiListWarppers); + }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(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){ + 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); + 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 = "司机提现操作", tags = {"司机端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "类型(1=余额提现,2=佣金提现)", name = "type", 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, Double money){ + if(null == type){ + return ResponseWarpper.success(ResultUtil.paranErr("type")); + } + 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, money); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java index 812cc72..bcc54e8 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java @@ -1,5 +1,6 @@ package com.supersavedriving.driver.modular.system.api; +import com.supersavedriving.driver.modular.system.model.Order; import com.supersavedriving.driver.modular.system.warpper.*; import com.supersavedriving.driver.core.common.annotion.ServiceLog; import com.supersavedriving.driver.core.util.ToolUtil; @@ -285,7 +286,7 @@ @ResponseBody @PostMapping("/api/order/cancelTransferOrder") // @ServiceLog(name = "司机取消转单操作", url = "/api/order/cancelTransferOrder") - @ApiOperation(value = "司机取消转单操作", tags = {"司机端-我的订单"}, notes = "") + @ApiOperation(value = "司机取消转单操作", tags = {"司机端-个人中心"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") @@ -394,4 +395,37 @@ return new ResponseWarpper(500, e.getMessage()); } } + + + + + @ResponseBody + @PostMapping("/api/order/queryDriverOrderList") +// @ServiceLog(name = "获取司机订单列表", url = "/api/order/queryDriverOrderList") + @ApiOperation(value = "获取司机订单列表", tags = {"司机端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单状态(107=未支付,109=已完成,301=已取消)", name = "state", 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<DriverOrderListWarpper>> queryDriverOrderList(Integer state, 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<DriverOrderListWarpper> driverOrderListWarppers = orderService.queryDriverOrderList(uid, state, pageNum, pageSize); + return ResponseWarpper.success(driverOrderListWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/YouTuiController.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/YouTuiController.java new file mode 100644 index 0000000..add8421 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/YouTuiController.java @@ -0,0 +1,126 @@ +package com.supersavedriving.driver.modular.system.api; + +import com.supersavedriving.driver.core.util.ToolUtil; +import com.supersavedriving.driver.modular.system.service.IDriverService; +import com.supersavedriving.driver.modular.system.service.IYouTuiDriverService; +import com.supersavedriving.driver.modular.system.util.ResultUtil; +import com.supersavedriving.driver.modular.system.warpper.DriverYouTuiWarpper; +import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +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 java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/15 17:50 + */ +@RestController +@RequestMapping("") +public class YouTuiController { + + @Autowired + private IYouTuiDriverService youTuiDriverService; + + @Autowired + private IDriverService driverService; + + + + + + + + @ResponseBody + @PostMapping("/api/youtui/queryDriverYouTui") +// @ServiceLog(name = "获取司机优推数据", url = "/api/youtui/queryDriverYouTui") + @ApiOperation(value = "获取司机优推数据", tags = {"司机端-个人中心"}, notes = "") + @ApiImplicitParams({ + @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<DriverYouTuiWarpper>> queryDriverYouTui(Integer pageNum, Integer pageSize){ + if(ToolUtil.isEmpty(pageNum)){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(ToolUtil.isEmpty(pageSize)){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = driverService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.tokenErr(); + } + List<DriverYouTuiWarpper> driverYouTuiWarppers = youTuiDriverService.queryDriverYouTui(uid, pageNum, pageSize); + return ResponseWarpper.success(driverYouTuiWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/youtui/queryAllYouTui") +// @ServiceLog(name = "获取兑换权益列表", url = "/api/youtui/queryAllYouTui") + @ApiOperation(value = "获取兑换权益列表", tags = {"司机端-个人中心"}, notes = "") + @ApiImplicitParams({ + @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<DriverYouTuiWarpper>> queryAllYouTui(Integer pageNum, Integer pageSize){ + if(ToolUtil.isEmpty(pageNum)){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(ToolUtil.isEmpty(pageSize)){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = driverService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.tokenErr(); + } + List<DriverYouTuiWarpper> driverYouTuiWarppers = youTuiDriverService.queryAllYouTui(pageNum, pageSize); + return ResponseWarpper.success(driverYouTuiWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/youtui/redeemBenefits") +// @ServiceLog(name = "司机兑换优推", url = "/api/youtui/redeemBenefits") + @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 redeemBenefits(Integer id){ + if(ToolUtil.isEmpty(id)){ + return ResponseWarpper.success(ResultUtil.paranErr("id")); + } + try { + Integer uid = driverService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.tokenErr(); + } + ResultUtil resultUtil = youTuiDriverService.redeemBenefits(uid, id); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/AccountChangeDetailMapper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/AccountChangeDetailMapper.java index 32183a7..034c191 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/AccountChangeDetailMapper.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/AccountChangeDetailMapper.java @@ -2,10 +2,47 @@ import com.baomidou.mybatisplus.mapper.BaseMapper; import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; +import com.supersavedriving.driver.modular.system.warpper.CommissionDetailWarpper; +import com.supersavedriving.driver.modular.system.warpper.IntegralIncomeAndExpensesWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * @author zhibing.pu * @date 2023/3/4 11:33 */ public interface AccountChangeDetailMapper extends BaseMapper<AccountChangeDetail> { + + + /** + * 获取积分收支明细 + * @param driverId + * @param pageNum + * @param pageSize + * @return + */ + List<IntegralIncomeAndExpensesWarpper> queryDriverIntegralIncomeAndExpenses(@Param("driverId") Integer driverId, @Param("type") Integer type, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); + + + /** + * 获取佣金收入明细列表 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + */ + List<CommissionDetailWarpper> queryCommissionDetail(@Param("driverId") Integer driverId, @Param("time") String time, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); + + + /** + * 获取总佣金 + * @param driverId + * @param time + * @return + */ + Double queryCommissionDetailTotal(@Param("driverId") Integer driverId, @Param("time") String time); } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/CashWithdrawalMapper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/CashWithdrawalMapper.java new file mode 100644 index 0000000..fe73a91 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/CashWithdrawalMapper.java @@ -0,0 +1,11 @@ +package com.supersavedriving.driver.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.supersavedriving.driver.modular.system.model.CashWithdrawal; + +/** + * @author zhibing.pu + * @date 2023/3/18 17:02 + */ +public interface CashWithdrawalMapper extends BaseMapper<CashWithdrawal> { +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/OrderMapper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/OrderMapper.java index fa96117..6321473 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/OrderMapper.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/OrderMapper.java @@ -1,8 +1,10 @@ package com.supersavedriving.driver.modular.system.dao; import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.supersavedriving.driver.modular.system.warpper.DriverOrderListWarpper; import com.supersavedriving.driver.modular.system.warpper.HallOrderList; import com.supersavedriving.driver.modular.system.model.Order; +import com.supersavedriving.driver.modular.system.warpper.InviteListWarpper; import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; import org.apache.ibatis.annotations.Param; @@ -26,4 +28,28 @@ * @return */ OrderInfoWarpper queryOrderInfo(@Param("orderId") Long orderId); + + + /** + * 获取司机订单列表 + * @param driverId + * @param state + * @param pageNum + * @param pageSize + * @return + */ + List<DriverOrderListWarpper> queryDriverOrderList(@Param("driverId") Integer driverId, @Param("state") Integer state, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); + + + /** + * 获取司机邀请列表 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + */ + List<InviteListWarpper> queryInviteList(@Param("driverId") Integer driverId, @Param("time") String time, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiDriverMapper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiDriverMapper.java index 9eb731b..61a54d8 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiDriverMapper.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiDriverMapper.java @@ -2,6 +2,48 @@ import com.baomidou.mybatisplus.mapper.BaseMapper; import com.supersavedriving.driver.modular.system.model.YouTuiDriver; +import com.supersavedriving.driver.modular.system.warpper.DriverYouTuiWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; public interface YouTuiDriverMapper extends BaseMapper<YouTuiDriver> { + + + /** + * 获取司机优推兑换月数据 + * @param driverId + * @return + */ + List<Map<String, String>> queryRedemptionDate(@Param("driverId") Integer driverId); + + + /** + * 获取日期内的记录 + * @param driverId + * @param createTime + * @return + */ + List<DriverYouTuiWarpper> queryYouTuiDriverList(@Param("driverId") Integer driverId, @Param("createTime") String createTime); + + + /** + * 获取司机优推数据 + * @param driverId + * @param pageNum + * @param pageSize + * @return + */ + List<DriverYouTuiWarpper> queryDriverYouTui(@Param("driverId") Integer driverId, @Param("pageNum") Integer pageNum, + @Param("pageSize") Integer pageSize); + + + /** + * 获取优推数据 + * @param pageNum + * @param pageSize + * @return + */ + List<DriverYouTuiWarpper> queryAllYouTui(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiMapper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiMapper.java new file mode 100644 index 0000000..7244d24 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/YouTuiMapper.java @@ -0,0 +1,11 @@ +package com.supersavedriving.driver.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.supersavedriving.driver.modular.system.model.YouTui; + +/** + * @author zhibing.pu + * @date 2023/3/18 9:59 + */ +public interface YouTuiMapper extends BaseMapper<YouTui> { +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml index 0a5c190..80b1519 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml @@ -8,9 +8,57 @@ <result column="userType" property="userType"/> <result column="userId" property="userId"/> <result column="type" property="type"/> + <result column="changeType" property="changeType"/> <result column="oldData" property="oldData"/> <result column="newData" property="newData"/> <result column="explain" property="explain"/> <result column="createTime" property="createTime"/> </resultMap> + + + + <select id="queryDriverIntegralIncomeAndExpenses" resultType="com.supersavedriving.driver.modular.system.warpper.IntegralIncomeAndExpensesWarpper"> + select * from ( + select + explain as description, + UNIX_TIMESTAMP(createTime) * 1000 as createTime, + (newData - oldData) as integral + from t_account_change_detail where `type` = 2 and userType = 2 and userId = #{driverId} + ) as aa where 1 = 1 + <if test="null != type and 1 == type"> + and aa.integral > 0 + </if> + <if test="null != type and 2 == type"> + and aa.integral < 0 + </if> + order by aa.createTime desc limit #{pageNum}, #{pageSize} + </select> + + + <select id="queryCommissionDetail" resultType="com.supersavedriving.driver.modular.system.warpper.CommissionDetailWarpper"> + select + `explain`, + UNIX_TIMESTAMP(createTime) * 1000 as createTime, + (newData - oldData) as money, + newData as balance + from t_account_change_detail where userType = 2 and userId = #{driverId} + <if test="null != time and '' != time"> + and DATE_FORMAT(createTime, '%Y年%m月') = #{time} + </if> + order by createTime desc limit #{pageNum}, #{pageSize} + </select> + + + <select id="queryCommissionDetailTotal" resultType="double"> + select + sum(money) as money + from ( + select + (newData - oldData) as money + from t_account_change_detail where userType = 2 and userId = #{driverId} + <if test="null != time and '' != time"> + and DATE_FORMAT(createTime, '%Y年%m月') = #{time} + </if> + ) as aa where aa.money > 0 + </select> </mapper> \ No newline at end of file diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/CashWithdrawalMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/CashWithdrawalMapper.xml new file mode 100644 index 0000000..f657f17 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/CashWithdrawalMapper.xml @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.supersavedriving.driver.modular.system.dao.CashWithdrawalMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.CashWithdrawal"> + <id column="id" property="id"/> + <result column="type" property="type"/> + <result column="userDriverId" property="userDriverId"/> + <result column="code" property="code"/> + <result column="businessType" property="businessType"/> + <result column="amount" property="amount"/> + <result column="state" property="state"/> + <result column="createTime" property="createTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/DriverMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/DriverMapper.xml index a9dd67f..4b3d231 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/DriverMapper.xml +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/DriverMapper.xml @@ -26,6 +26,7 @@ <result column="branchOfficeId" property="branchOfficeId"/> <result column="balance" property="balance"/> <result column="backgroundBalance" property="backgroundBalance"/> + <result column="couponBalance" property="couponBalance"/> <result column="approvalStatus" property="approvalStatus"/> <result column="approvalNotes" property="approvalNotes"/> <result column="approvalUserId" property="approvalUserId"/> diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml index f465499..719eb48 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml @@ -116,4 +116,60 @@ left join t_app_user b on (a.userId = b.id) where a.id = #{orderId} </select> + + + <select id="queryDriverOrderList" resultType="com.supersavedriving.driver.modular.system.warpper.DriverOrderListWarpper"> + select + id, + '超省新代驾订单' as title, + UNIX_TIMESTAMP(createTime) * 1000 as createTime, + startAddress, + endAddress, + state, + source + from t_order where status = 1 and driverId = #{driverId} + <if test="null != state and 107 == state"> + and state = #{state} + </if> + <if test="null != state and 109 == state"> + and state in (108, 109) + </if> + <if test="null != state and 301 == state"> + and state = #{state} + </if> + order by createTime desc limit #{pageNum}, #{pageSize} + </select> + + + <select id="queryInviteList" resultType="com.supersavedriving.driver.modular.system.warpper.InviteListWarpper"> + select * from ( + select + a.id, + a.nickname, + min(UNIX_TIMESTAMP(b.createTime) * 1000) as time, + 1 as type + from t_app_user a + left join t_order b on (a.id = b.userId) + where a.`status` = 1 and a.inviterType = 2 and a.inviterId = #{driverId} + <if test="null != time and '' != time"> + and DATE_FORMAT(b.createTime, '%Y年%m月') = #{time} + </if> + group by a.id, a.nickname + + union all + + select + a.id, + a.`name`, + min(UNIX_TIMESTAMP(b.createTime) * 1000) as time, + 2 as type + from t_driver a + left join t_order b on (a.id = b.driverId) + where a.`status` = 1 and a.approvalStatus = 2 and a.inviterType = 2 and a.inviterId = #{driverId} + <if test="null != time and '' != time"> + and DATE_FORMAT(b.createTime, '%Y年%m月') = #{time} + </if> + group by a.id, a.`name` + ) as aa where aa.time is not null order by aa.time desc limit #{pageNum}, #{pageSize} + </select> </mapper> \ No newline at end of file diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml index 79eed9b..724f335 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/RevenueMapper.xml @@ -10,6 +10,7 @@ <result column="userId" property="userId" /> <result column="orderId" property="orderId" /> <result column="amount" property="amount" /> + <result column="balance" property="balance"/> <result column="createTime" property="createTime" /> </resultMap> diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiDriverMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiDriverMapper.xml index d923f0d..db94344 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiDriverMapper.xml +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiDriverMapper.xml @@ -8,7 +8,58 @@ <result column="driverId" property="driverId" /> <result column="youTuiId" property="youTuiId" /> <result column="integral" property="integral" /> + <result column="type" property="type"/> + <result column="surplusQuantity" property="surplusQuantity"/> + <result column="endTime" property="endTime"/> + <result column="state" property="state"/> <result column="failureTime" property="failureTime" /> <result column="createTime" property="createTime" /> </resultMap> + + + <select id="queryRedemptionDate" resultType="map"> + select DATE_FORMAT(aa.createTime, '%Y年%m月') as createTime from (select createTime from t_you_tui_driver where driverId = #{driverId} order by createTime desc) as aa group by DATE_FORMAT(aa.createTime, '%Y年%m月') + </select> + + + <select id="queryYouTuiDriverList" resultType="com.supersavedriving.driver.modular.system.warpper.DriverYouTuiWarpper"> + select + b.`name`, + b.integral, + UNIX_TIMESTAMP(a.createTime) * 1000 as createTime + from t_you_tui_driver a + left join t_you_tui b on (a.youTuiId = b.id) + where a.driverId = #{driverId} and DATE_FORMAT(a.createTime, '%Y年%m月') = #{createTime} order by a.createTime desc + </select> + + + <select id="queryDriverYouTui" resultType="com.supersavedriving.driver.modular.system.warpper.DriverYouTuiWarpper"> + select + a.id, + b.`name`, + b.type, + b.number, + b.img, + b.integral, + b.content, + UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, + a.state + from t_you_tui_driver a + left join t_you_tui b on (a.youTuiId = b.id) + where a.driverId = #{driverId} order by a.createTime desc limit #{pageNum}, #{pageSize} + </select> + + + + <select id="queryAllYouTui" resultType="com.supersavedriving.driver.modular.system.warpper.DriverYouTuiWarpper"> + select + id, + `name`, + type, + number, + img, + integral, + content + from t_you_tui where status = 1 order by createTime desc limit #{pageNum}, #{pageSize} + </select> </mapper> \ No newline at end of file diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiMapper.xml new file mode 100644 index 0000000..36aaba5 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiMapper.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> +<mapper namespace="com.supersavedriving.driver.modular.system.dao.YouTuiMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.supersavedriving.driver.modular.system.model.YouTui"> + <id column="id" property="id" /> + <result column="name" property="name" /> + <result column="type" property="type" /> + <result column="img" property="img" /> + <result column="number" property="number"/> + <result column="integral" property="integral"/> + <result column="effectiveTime" property="effectiveTime"/> + <result column="content" property="content"/> + <result column="status" property="status" /> + <result column="createTime" property="createTime" /> + <result column="distance" property="distance" /> + </resultMap> +</mapper> \ No newline at end of file diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/AccountChangeDetail.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/AccountChangeDetail.java index 74a7e2c..b96a1f8 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/AccountChangeDetail.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/AccountChangeDetail.java @@ -38,6 +38,11 @@ @TableField("type") private Integer type; /** + * 变动类型(1=订单收入,2=订单支出,3=充值,4=提现,5=佣金收入,6=佣金提现,7=优惠券收入,8=保险支付) + */ + @TableField("changeType") + private Integer changeType; + /** * 历史数据 */ @TableField("oldData") diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/CashWithdrawal.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/CashWithdrawal.java new file mode 100644 index 0000000..a935b1a --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/CashWithdrawal.java @@ -0,0 +1,59 @@ +package com.supersavedriving.driver.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/18 16:58 + */ +@Data +@TableName("t_cash_withdrawal") +public class CashWithdrawal { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 类型(1=用户,2=司机) + */ + @TableField("type") + private Integer type; + /** + * 用户司机id + */ + @TableField("userDriverId") + private Integer userDriverId; + /** + * 提现编号 + */ + @TableField("code") + private String code; + /** + * 交易类型 11佣金提现 12余额提现 + */ + @TableField("businessType") + private Integer businessType; + /** + * 提现金额 + */ + @TableField("amount") + private Double amount; + /** + * 提现状态 1未成功 2成功 + */ + @TableField("state") + private Integer state; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Driver.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Driver.java index a1ff618..61aabb7 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Driver.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Driver.java @@ -128,6 +128,11 @@ @TableField("backgroundBalance") private Double backgroundBalance; /** + * 优惠券余额(订单优惠券支付的金额) + */ + @TableField("couponBalance") + private Double couponBalance; + /** * 审核状态(1=待审核,2=已同意,3=已拒绝) */ @TableField("approvalStatus") diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Revenue.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Revenue.java index c7893b8..d89a208 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Revenue.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Revenue.java @@ -48,6 +48,11 @@ @TableField("amount") private Double amount; /** + * 余额 + */ + @TableField("balance") + private Double balance; + /** * 添加时间 */ @TableField("createTime") diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTui.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTui.java new file mode 100644 index 0000000..4af28d7 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTui.java @@ -0,0 +1,74 @@ +package com.supersavedriving.driver.modular.system.model; + +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/18 9:55 + */ +@Data +@TableName("t_you_tui") +public class YouTui { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 名称 + */ + @TableField("name") + private String name; + /** + * 优推类型(1=次数,2=小时) + */ + @TableField("type") + private Integer type; + /** + * 图片地址 + */ + @TableField("img") + private String img; + /** + * 优推值 + */ + @TableField("number") + private Integer number; + /** + * 兑换所需积分 + */ + @TableField("integral") + private Integer integral; + /** + * 有效天数 + */ + @TableField("effectiveTime") + private Integer effectiveTime; + /** + * 服务内容 + */ + @TableField("content") + private String content; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 优推距离 + */ + @TableField("distance") + private Double distance; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTuiDriver.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTuiDriver.java index eea4efa..d08c8d9 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTuiDriver.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/YouTuiDriver.java @@ -38,6 +38,26 @@ @TableField("integral") private Integer integral; /** + * 优推类型(1=次数,2=小时) + */ + @TableField("type") + private Integer type; + /** + * 优推剩余数量 + */ + @TableField("surplusQuantity") + private Integer surplusQuantity; + /** + * 优推结束时间 + */ + @TableField("endTime") + private Date endTime; + /** + * 状态(1=未使用,2=使用中,3=已结束) + */ + @TableField("state") + private Integer state; + /** * 失效时间 */ @TableField("failureTime") diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IAccountChangeDetailService.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IAccountChangeDetailService.java index 5c375a5..b96eaf9 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IAccountChangeDetailService.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IAccountChangeDetailService.java @@ -2,6 +2,10 @@ import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; +import com.supersavedriving.driver.modular.system.warpper.CommissionDetailListWarpper; +import com.supersavedriving.driver.modular.system.warpper.IntegralIncomeAndExpensesWarpper; + +import java.util.List; /** * @author zhibing.pu @@ -16,4 +20,27 @@ * @throws Exception */ void saveData(AccountChangeDetail accountChangeDetail) throws Exception; + + + /** + * 获取积分收支明细 + * @param driverId + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<IntegralIncomeAndExpensesWarpper> queryDriverIntegralIncomeAndExpenses(Integer driverId, Integer type, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 获取佣金明细列表 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + CommissionDetailListWarpper queryCommissionDetail(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception; } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/ICashWithdrawalService.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/ICashWithdrawalService.java new file mode 100644 index 0000000..7b635bf --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/ICashWithdrawalService.java @@ -0,0 +1,23 @@ +package com.supersavedriving.driver.modular.system.service; + +import com.baomidou.mybatisplus.service.IService; +import com.supersavedriving.driver.modular.system.model.CashWithdrawal; +import com.supersavedriving.driver.modular.system.util.ResultUtil; + + +/** + * @author zhibing.pu + * @date 2023/3/18 17:03 + */ +public interface ICashWithdrawalService extends IService<CashWithdrawal> { + + + /** + * 司机提现申请 + * @param type + * @param money + * @return + * @throws Exception + */ + ResultUtil withdrawCash(Integer driverId, Integer type, Double money) throws Exception; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IDriverService.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IDriverService.java index de7a610..4ef24cb 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IDriverService.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IDriverService.java @@ -5,7 +5,6 @@ import com.supersavedriving.driver.modular.system.util.ResultUtil; import com.supersavedriving.driver.modular.system.warpper.*; -import javax.servlet.http.HttpServletRequest; import java.util.List; /** @@ -114,4 +113,10 @@ * @throws Exception */ ResultUtil saveDriverInfo(Integer uid, DriverInfo driverInfo) throws Exception; + + + /** + * 清空司机积分 + */ + void emptyIntegral(); } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java index 14109cb..b6d90b1 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java @@ -153,4 +153,29 @@ * @throws Exception */ ResultUtil setOrderStatus(Integer uid, Long orderId, Integer state) throws Exception; + + + /** + * 获取司机的订单列表 + * @param driverId + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<DriverOrderListWarpper> queryDriverOrderList(Integer driverId, Integer state, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 司机邀请列表 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<InviteListWarpper> queryInviteList(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception; + } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IRevenueService.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IRevenueService.java index d44122a..eae1d09 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IRevenueService.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IRevenueService.java @@ -2,6 +2,20 @@ import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.driver.modular.system.model.Revenue; +import com.supersavedriving.driver.modular.system.warpper.CommissionListWarpper; + +import java.util.List; public interface IRevenueService extends IService<Revenue> { + + + /** + * 获取司机佣金记录 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + */ + List<CommissionListWarpper> queryCommissionList(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception; } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiDriverService.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiDriverService.java index 7b688cc..abc565a 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiDriverService.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiDriverService.java @@ -2,6 +2,51 @@ import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.driver.modular.system.model.YouTuiDriver; +import com.supersavedriving.driver.modular.system.util.ResultUtil; +import com.supersavedriving.driver.modular.system.warpper.DriverYouTuiListWarpper; +import com.supersavedriving.driver.modular.system.warpper.DriverYouTuiWarpper; + +import java.util.List; public interface IYouTuiDriverService extends IService<YouTuiDriver> { + + + /** + * 获取司机兑换优推记录 + * @param driverId + * @return + * @throws Exception + */ + List<DriverYouTuiListWarpper> queryDriverYouTuiList(Integer driverId) throws Exception; + + + /** + * 获取司机优推列表 + * @param driverId + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<DriverYouTuiWarpper> queryDriverYouTui(Integer driverId, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 获取优推数据 + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<DriverYouTuiWarpper> queryAllYouTui(Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 司机兑换优推数据 + * @param driverId + * @param id + * @return + * @throws Exception + */ + ResultUtil redeemBenefits(Integer driverId, Integer id) throws Exception; } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiService.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiService.java new file mode 100644 index 0000000..7e797c6 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiService.java @@ -0,0 +1,11 @@ +package com.supersavedriving.driver.modular.system.service; + +import com.baomidou.mybatisplus.service.IService; +import com.supersavedriving.driver.modular.system.model.YouTui; + +/** + * @author zhibing.pu + * @date 2023/3/18 10:01 + */ +public interface IYouTuiService extends IService<YouTui> { +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java index acdb51d..cbadf6d 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/AccountChangeDetailServiceImpl.java @@ -4,9 +4,13 @@ import com.supersavedriving.driver.modular.system.dao.AccountChangeDetailMapper; import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; +import com.supersavedriving.driver.modular.system.warpper.CommissionDetailListWarpper; +import com.supersavedriving.driver.modular.system.warpper.CommissionDetailWarpper; +import com.supersavedriving.driver.modular.system.warpper.IntegralIncomeAndExpensesWarpper; import org.springframework.stereotype.Service; import java.util.Date; +import java.util.List; /** * 账户变动 @@ -27,4 +31,41 @@ accountChangeDetail.setCreateTime(new Date()); this.baseMapper.insert(accountChangeDetail); } + + + /** + * 获取积分收支明细 + * @param driverId + * @param type + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<IntegralIncomeAndExpensesWarpper> queryDriverIntegralIncomeAndExpenses(Integer driverId, Integer type, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryDriverIntegralIncomeAndExpenses(driverId, type, pageNum, pageSize); + } + + + /** + * 获取佣金明细列表 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public CommissionDetailListWarpper queryCommissionDetail(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + List<CommissionDetailWarpper> commissionDetailWarppers = this.baseMapper.queryCommissionDetail(driverId, time, pageNum, pageSize); + Double aDouble = this.baseMapper.queryCommissionDetailTotal(driverId, time); + CommissionDetailListWarpper commissionDetailListWarpper = new CommissionDetailListWarpper(); + commissionDetailListWarpper.setList(commissionDetailWarppers); + commissionDetailListWarpper.setTotal(aDouble); + return commissionDetailListWarpper; + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/CashWithdrawalServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/CashWithdrawalServiceImpl.java new file mode 100644 index 0000000..abf2e47 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/CashWithdrawalServiceImpl.java @@ -0,0 +1,56 @@ +package com.supersavedriving.driver.modular.system.service.impl; + +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.supersavedriving.driver.modular.system.dao.CashWithdrawalMapper; +import com.supersavedriving.driver.modular.system.model.CashWithdrawal; +import com.supersavedriving.driver.modular.system.model.Driver; +import com.supersavedriving.driver.modular.system.service.ICashWithdrawalService; +import com.supersavedriving.driver.modular.system.service.IDriverService; +import com.supersavedriving.driver.modular.system.util.ResultUtil; +import com.supersavedriving.driver.modular.system.util.UUIDUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/18 17:03 + */ +@Service +public class CashWithdrawalServiceImpl extends ServiceImpl<CashWithdrawalMapper, CashWithdrawal> implements ICashWithdrawalService { + + @Autowired + private IDriverService driverService; + + + + @Override + public ResultUtil withdrawCash(Integer driverId, Integer type, Double money) throws Exception { + Driver driver = driverService.selectById(driverId); + if(type == 1 && (null == driver.getBalance() || driver.getBalance() < money)){ + return ResultUtil.error("账户余额不足"); + } + if(type == 2 && (null == driver.getCommission() || driver.getCommission() < money)){ + return ResultUtil.error("佣金余额不足"); + } + + CashWithdrawal cashWithdrawal = new CashWithdrawal(); + cashWithdrawal.setType(2); + cashWithdrawal.setUserDriverId(driverId); + cashWithdrawal.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + cashWithdrawal.setBusinessType(type == 1 ? 12 : 11); + cashWithdrawal.setAmount(money); + cashWithdrawal.setState(1); + cashWithdrawal.setCreateTime(new Date()); + this.insert(cashWithdrawal); + if(type == 1){ + driver.setBalance(driver.getBalance() - money); + } + if(type == 2){ + driver.setCommission(driver.getCommission() - money); + } + driverService.updateById(driver); + return ResultUtil.success(); + } +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java index f601368..4a71c4b 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java @@ -510,6 +510,8 @@ Driver driver = this.selectById(uid); DriverInfoWarpper driverInfo = new DriverInfoWarpper(); BeanUtils.copyProperties(driver, driverInfo); + driverInfo.setBalance(driver.getBalance() + driver.getBackgroundBalance() + driver.getCouponBalance() + driver.getCommission()); + YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid).last(" and failureTime > now() order by failureTime limit 0, 1")); if(null != youTuiDriver){ driverInfo.setYouTuiStart(youTuiDriver.getCreateTime().getTime()); @@ -550,6 +552,12 @@ if(ToolUtil.isNotEmpty(driverInfo.getEmergencyPhone())){ driver.setEmergencyPhone(driverInfo.getEmergencyPhone()); } + if(ToolUtil.isNotEmpty(driverInfo.getWxCollectionCode())){ + driver.setWxCollectionCode(driverInfo.getWxCollectionCode()); + } + if(ToolUtil.isNotEmpty(driverInfo.getZfbCollectionCode())){ + driver.setZfbCollectionCode(driverInfo.getZfbCollectionCode()); + } if(ToolUtil.isNotEmpty(driverInfo.getPhone()) && ToolUtil.isNotEmpty(driverInfo.getCode())){ String value = redisUtil.getValue(driverInfo.getPhone()); if(ToolUtil.isEmpty(value)){ @@ -563,4 +571,27 @@ this.updateById(driver); return ResultUtil.success(); } + + @Override + public void emptyIntegral() { + List<Driver> drivers = this.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("status", 1)); + List<AccountChangeDetail> list = new ArrayList<>(); + for (Driver driver : drivers) { + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); + accountChangeDetail.setType(2); + accountChangeDetail.setExplain("定时清空积分"); + driver.setIntegral(0); + accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); + list.add(accountChangeDetail); + } + if(drivers.size() > 0){ + this.updateBatchById(drivers); + accountChangeDetailService.insertBatch(list); + } + + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java index 7838115..dcb3bf1 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java @@ -184,7 +184,7 @@ pushUtil.pushOrderStatus(uid, 2, order.getId(), order.getStatus()); }else{ //开始推单 -// pushOrder(order); + pushOrder(order); } return ResultUtil.success(); } @@ -393,7 +393,7 @@ //1 //找到中心点 - GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLat), Double.valueOf(startLng)); + GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(startLng), Double.valueOf(startLat)); Double num = num3 / 1000;//范围公里 //构造半径 Distance distanceR = new Distance(num, Metrics.KILOMETERS); @@ -404,8 +404,10 @@ List<Location> locations = mongoTemplate.find(query, Location.class); List<Integer> driverIds = locations.stream().map(Location::getDriverId).collect(Collectors.toList()); Integer driver = null; + YouTuiDriver youTuiDriver1 = null; if(driverIds.size() > 0){ - List<YouTuiDriver> youTuiDrivers = youTuiDriverService.selectList(new EntityWrapper<YouTuiDriver>().in("driverId", driverIds).last(" and now() < failureTime")); + List<YouTuiDriver> youTuiDrivers = youTuiDriverService.selectList(new EntityWrapper<YouTuiDriver>().in("driverId", driverIds) + .eq("state", 2).last(" and (surplusQuantity > 0 or now() < endTime) and now() < failureTime")); Double d = null; for (YouTuiDriver youTuiDriver : youTuiDrivers) { String value = redisUtil.getValue("DRIVER" + youTuiDriver.getDriverId()); @@ -417,10 +419,15 @@ if(d == null || d.compareTo(wgs84) > 0){ d = wgs84; driver = youTuiDriver.getDriverId(); + youTuiDriver1 = youTuiDriver; } } } + if(null != youTuiDriver1 && youTuiDriver1.getType() == 1){ + youTuiDriver1.setSurplusQuantity(youTuiDriver1.getSurplusQuantity() - 1); + youTuiDriverService.updateById(youTuiDriver1); + } //开始范围查找 if(null == driver){ @@ -674,10 +681,15 @@ @Override public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception { OrderInfoWarpper orderInfoWarpper = this.baseMapper.queryOrderInfo(orderId); + AppUser appUser = appUserService.selectById(uid); + orderInfoWarpper.setBalance(appUser.getAccountBalance()); + orderInfoWarpper.setCurrentDistance(0D); String value = redisUtil.getValue("DRIVER" + uid); - Map<String, Double> distance = GeodesyUtil.getDistance(orderInfoWarpper.getStartLng() + "," + orderInfoWarpper.getStartLat(), value); - Double wgs84 = distance.get("WGS84"); - orderInfoWarpper.setCurrentDistance(wgs84); + if(ToolUtil.isNotEmpty(value)){ + Map<String, Double> distance = GeodesyUtil.getDistance(orderInfoWarpper.getStartLng() + "," + orderInfoWarpper.getStartLat(), value); + Double wgs84 = distance.get("WGS84"); + orderInfoWarpper.setCurrentDistance(wgs84); + } return orderInfoWarpper; } @@ -1062,4 +1074,34 @@ public void saveRevenue(Order order){ } + + /** + * 获取司机的订单列表 + * @param driverId + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<DriverOrderListWarpper> queryDriverOrderList(Integer driverId, Integer state, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryDriverOrderList(driverId, state, pageNum, pageSize); + } + + /** + * 司机邀请列表 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<InviteListWarpper> queryInviteList(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryInviteList(driverId, time, pageNum, pageSize); + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/RevenueServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/RevenueServiceImpl.java index 3590285..3911b70 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/RevenueServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/RevenueServiceImpl.java @@ -1,10 +1,24 @@ package com.supersavedriving.driver.modular.system.service.impl; +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.supersavedriving.driver.core.util.ToolUtil; import com.supersavedriving.driver.modular.system.dao.RevenueMapper; +import com.supersavedriving.driver.modular.system.model.AppUser; +import com.supersavedriving.driver.modular.system.model.Driver; +import com.supersavedriving.driver.modular.system.model.Order; import com.supersavedriving.driver.modular.system.model.Revenue; +import com.supersavedriving.driver.modular.system.service.IAppUserService; +import com.supersavedriving.driver.modular.system.service.IDriverService; +import com.supersavedriving.driver.modular.system.service.IOrderService; import com.supersavedriving.driver.modular.system.service.IRevenueService; +import com.supersavedriving.driver.modular.system.warpper.CommissionListWarpper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; /** * 收入记录 @@ -13,4 +27,59 @@ */ @Service public class RevenueServiceImpl extends ServiceImpl<RevenueMapper, Revenue> implements IRevenueService { + + @Autowired + private IOrderService orderService; + + @Autowired + private IAppUserService appUserService; + + @Autowired + private IDriverService driverService; + + + + + + + /** + * 获取司机佣金记录 + * @param driverId + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<CommissionListWarpper> queryCommissionList(Integer driverId, String time, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + Wrapper<Revenue> wrapper = new EntityWrapper<Revenue>().eq("type", 2).eq("userType", 2) + .eq("userId", driverId); + if(ToolUtil.isNotEmpty(time)){ + wrapper.eq("DATE_FORMAT(createTime, '%Y年%m月')", time); + } + List<Revenue> revenues = this.selectList(wrapper.last(" order by createTime desc limit " + pageNum + ", " + pageSize)); + List<CommissionListWarpper> list = new ArrayList<>(); + for (Revenue revenue : revenues) { + CommissionListWarpper commissionListWarpper = new CommissionListWarpper(); + commissionListWarpper.setCreateTime(revenue.getCreateTime().getTime()); + commissionListWarpper.setAmount(revenue.getAmount()); + Order order = orderService.selectById(revenue.getOrderId()); + if(null != order.getUserId()){ + AppUser appUser = appUserService.selectById(order.getUserId()); + if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && appUser.getInviterId().compareTo(driverId) == 0){ + commissionListWarpper.setUserType(1); + } + } + if(null == commissionListWarpper.getUserType()){ + Driver driver = driverService.selectById(order.getDriverId()); + if(null != driver.getInviterType() && driver.getInviterType() == 2 && driver.getInviterId().compareTo(driverId) == 0){ + commissionListWarpper.setUserType(2); + } + } + list.add(commissionListWarpper); + } + return list; + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiDriverServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiDriverServiceImpl.java index 5a5fdb5..606a689 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiDriverServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiDriverServiceImpl.java @@ -1,10 +1,25 @@ package com.supersavedriving.driver.modular.system.service.impl; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; +import com.supersavedriving.driver.modular.system.model.Driver; +import com.supersavedriving.driver.modular.system.model.YouTui; import com.supersavedriving.driver.modular.system.model.YouTuiDriver; import com.supersavedriving.driver.modular.system.dao.YouTuiDriverMapper; +import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; +import com.supersavedriving.driver.modular.system.service.IDriverService; import com.supersavedriving.driver.modular.system.service.IYouTuiDriverService; +import com.supersavedriving.driver.modular.system.service.IYouTuiService; +import com.supersavedriving.driver.modular.system.util.ResultUtil; +import com.supersavedriving.driver.modular.system.warpper.DriverYouTuiListWarpper; +import com.supersavedriving.driver.modular.system.warpper.DriverYouTuiWarpper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Map; /** * 用户优推数据 @@ -13,4 +28,117 @@ */ @Service public class YouTuiDriverServiceImpl extends ServiceImpl<YouTuiDriverMapper, YouTuiDriver> implements IYouTuiDriverService { + + @Autowired + private IYouTuiService youTuiService; + + @Autowired + private IDriverService driverService; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; + + + + + + + /** + * 获取司机兑换优推记录 + * @param driverId + * @return + * @throws Exception + */ + @Override + public List<DriverYouTuiListWarpper> queryDriverYouTuiList(Integer driverId) throws Exception { + List<Map<String, String>> list = this.baseMapper.queryRedemptionDate(driverId); + List<DriverYouTuiListWarpper> driverYouTuiListWarppers = new ArrayList<>(); + for (Map<String, String> map : list) { + String createTime = map.get("createTime"); + List<DriverYouTuiWarpper> driverYouTuiWarppers = this.baseMapper.queryYouTuiDriverList(driverId, createTime); + DriverYouTuiListWarpper driverYouTuiListWarpper = new DriverYouTuiListWarpper(); + driverYouTuiListWarpper.setMonth(createTime); + driverYouTuiListWarpper.setList(driverYouTuiWarppers); + driverYouTuiListWarppers.add(driverYouTuiListWarpper); + } + return driverYouTuiListWarppers; + } + + + /** + * 获取司机优推数据 + * @param driverId + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<DriverYouTuiWarpper> queryDriverYouTui(Integer driverId, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryDriverYouTui(driverId, pageNum, pageSize); + } + + + /** + * 获取待兑换的优推数据 + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<DriverYouTuiWarpper> queryAllYouTui(Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryAllYouTui(pageNum, pageSize); + } + + + /** + * 司机兑换优推数据 + * @param driverId + * @param id + * @return + * @throws Exception + */ + @Override + public ResultUtil redeemBenefits(Integer driverId, Integer id) throws Exception { + YouTui youTui = youTuiService.selectById(id); + if(youTui.getStatus() != 1){ + return ResultUtil.error("优推已下架"); + } + Driver driver = driverService.selectById(driverId); + if(null == driver.getIntegral() || youTui.getIntegral() > driver.getIntegral()){ + return ResultUtil.error("积分不足"); + } + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driverId); + accountChangeDetail.setType(2); + accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); + accountChangeDetail.setExplain("兑换优推"); + accountChangeDetail.setCreateTime(new Date()); + driver.setIntegral(driver.getIntegral() - youTui.getIntegral()); + accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); + driverService.updateById(driver); + accountChangeDetailService.insert(accountChangeDetail); + + YouTuiDriver youTuiDriver = new YouTuiDriver(); + youTuiDriver.setDriverId(driverId); + youTuiDriver.setYouTuiId(id); + youTuiDriver.setIntegral(youTui.getIntegral()); + youTuiDriver.setType(youTui.getType()); + if(youTui.getType() == 1){//次数 + youTuiDriver.setSurplusQuantity(youTui.getNumber()); + } + if(youTui.getType() == 2){//小时 + youTuiDriver.setEndTime(new Date(System.currentTimeMillis() + (youTui.getNumber() * 60 * 60 * 1000))); + } + youTuiDriver.setState(1); + youTuiDriver.setFailureTime(new Date(System.currentTimeMillis() + (youTui.getEffectiveTime() * 24 * 60 * 60 * 1000))); + youTuiDriver.setCreateTime(new Date()); + this.insert(youTuiDriver); + return ResultUtil.success(); + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiServiceImpl.java new file mode 100644 index 0000000..3ceca8d --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/YouTuiServiceImpl.java @@ -0,0 +1,16 @@ +package com.supersavedriving.driver.modular.system.service.impl; + +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.supersavedriving.driver.modular.system.dao.YouTuiMapper; +import com.supersavedriving.driver.modular.system.model.YouTui; +import com.supersavedriving.driver.modular.system.service.IYouTuiService; +import org.springframework.stereotype.Service; + +/** + * 优推数据 + * @author zhibing.pu + * @date 2023/3/18 10:01 + */ +@Service +public class YouTuiServiceImpl extends ServiceImpl<YouTuiMapper, YouTui> implements IYouTuiService { +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java index 33d0cfe..032a781 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java @@ -1,6 +1,8 @@ package com.supersavedriving.driver.modular.system.util; +import com.supersavedriving.driver.modular.system.service.IDriverService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -10,6 +12,9 @@ */ @Component public class TaskUtil { + + @Autowired + private IDriverService driverService; @@ -39,16 +44,29 @@ // } -// -// /** -// * 每月第一天的1点执行的任务 -// */ -// @Scheduled(cron = "0 0 1 1 * *") -// public void taskMonth(){ -// try { -// -// }catch (Exception e){ -// e.printStackTrace(); -// } -// } + + /** + * 每月1日凌晨执行的任务 + */ + @Scheduled(cron = "0 0 0 1 * *") + public void taskMonth1(){ + try { + driverService.emptyIntegral(); + }catch (Exception e){ + e.printStackTrace(); + } + } + + + /** + * 每月16日凌晨执行的任务 + */ + @Scheduled(cron = "0 0 0 16 * *") + public void taskMonth16(){ + try { + driverService.emptyIntegral(); + }catch (Exception e){ + e.printStackTrace(); + } + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/OBSUtil.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/OBSUtil.java new file mode 100644 index 0000000..1ee85aa --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/OBSUtil.java @@ -0,0 +1,43 @@ +package com.supersavedriving.driver.modular.system.util.huawei; + +import com.obs.services.ObsClient; +import com.obs.services.model.PutObjectRequest; +import com.obs.services.model.PutObjectResult; + +import java.io.InputStream; + +/** + * 对象存储上传 + * @author zhibing.pu + * @date 2023/3/15 11:32 + */ +public class OBSUtil { + + public static String endPoint = "https://obs.cn-south-1.myhuaweicloud.com"; + public static String ak = "N52IGR6DHOC3JAZFHZIW"; + public static String sk = "jq7Q7jnFS4Gxamwh3naN2sbNKwQQ7cZISPVumGBS"; + public static String bucketname = "csxdj"; + + /** + * 上传文件 + * @param inputStream + * @param objectKey + * @return + */ + public static String putObjectToBucket(InputStream inputStream, String objectKey) { + try { + // 创建ObsClient实例 + ObsClient obsClient = new ObsClient(ak, sk, endPoint); + // 待上传的本地文件路径,需要指定到具体的文件名 + PutObjectRequest request = new PutObjectRequest(); + request.setBucketName(bucketname); + request.setObjectKey(objectKey); + request.setInput(inputStream); + PutObjectResult putObjectResult = obsClient.putObject(request); + return putObjectResult.getObjectUrl(); + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/SMSUtil.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/SMSUtil.java similarity index 78% rename from driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/SMSUtil.java rename to driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/SMSUtil.java index 4ff7a9b..b903d38 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/SMSUtil.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/huawei/SMSUtil.java @@ -1,5 +1,4 @@ -package com.supersavedriving.driver.modular.system.util; - +package com.supersavedriving.driver.modular.system.util.huawei; import javax.net.ssl.*; import java.io.*; @@ -12,38 +11,53 @@ import java.text.SimpleDateFormat; import java.util.*; +/** + * 短信工具类 + * @author zhibing.pu + * @date 2023/3/15 11:23 + */ public class SMSUtil { - //无需修改,用于格式化鉴权头域,给"X-WSSE"参数赋值 private static final String WSSE_HEADER_FORMAT = "UsernameToken Username=\"%s\",PasswordDigest=\"%s\",Nonce=\"%s\",Created=\"%s\""; //无需修改,用于格式化鉴权头域,给"Authorization"参数赋值 private static final String AUTH_HEADER_VALUE = "WSSE realm=\"SDP\",profile=\"UsernameToken\",type=\"Appkey\""; /** - * 发送短信(华为云) - * @param templateId 模板id - * @param receiver 必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 - * @param templateParas 选填,使用无变量模板时请赋空值 String templateParas = "",双变量模板示例:模板内容为"您有${1}件快递请到${2}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]" - * 模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569) + * 发送短信 + * @param phones //必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 + * @param templateId //模板ID + * @param templateParas //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。 * @throws Exception */ - public static void send_huawei_sms(String templateId, String receiver, String templateParas) throws Exception { - + public static void send(String phones, String templateId, String templateParas) throws Exception { //必填,请参考"开发准备"获取如下数据,替换为实际值 - String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI - String appKey = "g3DW0G5Fbp3110UiGl5fkWcn799s"; //APP_Key - String appSecret = "LaT1NYvQKNkHO5KikniEueN8iTaz"; //APP_Secret - String sender = "ismsapp0000000103"; //国内短信签名通道号或国际/港澳台短信通道号 + String url = "https://smsapi.cn-south-1.myhuaweicloud.com:443/sms/batchSendSms/v1"; //APP接入地址(在控制台"应用管理"页面获取)+接口访问URI + String appKey = "9I0xrhdGXthf1fv9nn8G3glZ6Zng"; //APP_Key + String appSecret = "U7WxwX2LVk2YD6KAHxjc9tdnXoM9"; //APP_Secret + String sender = "8823031523874"; //国内短信签名通道号或国际/港澳台短信通道号 +// String templateId = "8ff55eac1d0b478ab3c06c3c6a492300"; //模板ID //条件必填,国内短信关注,当templateId指定的模板类型为通用模板时生效且必填,必须是已审核通过的,与模板类型一致的签名名称 //国际/港澳台短信不用关注该参数 - String signature = "IGO"; //签名名称 + String signature = "超省新代驾"; //签名名称 + + //必填,全局号码格式(包含国家码),示例:+8615123456789,多个号码之间用英文逗号分隔 +// String receiver = "+86151****6789,+86152****7890"; //短信接收人号码 //选填,短信状态报告接收地址,推荐使用域名,为空或者不填表示不接收状态报告 String statusCallBack = ""; + /** + * 选填,使用无变量模板时请赋空值 String templateParas = ""; + * 单变量模板示例:模板内容为"您的验证码是${1}"时,templateParas可填写为"[\"369751\"]" + * 双变量模板示例:模板内容为"您有${1}件快递请到${2}领取"时,templateParas可填写为"[\"3\",\"人民公园正门\"]" + * 模板中的每个变量都必须赋值,且取值不能为空 + * 查看更多模板和变量规范:产品介绍>模板和变量规范 + */ +// String templateParas = "[\"369751\"]"; //模板变量,此处以单变量验证码短信为例,请客户自行生成6位验证码,并定义为字符串类型,以杜绝首位0丢失的问题(例如:002569变成了2569)。 + //请求Body,不携带签名名称时,signature请填null - String body = buildRequestBody(sender, receiver, templateId, templateParas, statusCallBack, signature); + String body = buildRequestBody(sender, phones, templateId, templateParas, statusCallBack, signature); if (null == body || body.isEmpty()) { System.out.println("body is null."); return; @@ -62,9 +76,7 @@ HttpsURLConnection connection = null; InputStream is = null; - HostnameVerifier hv = new HostnameVerifier() { - @Override public boolean verify(String hostname, SSLSession session) { return true; diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailListWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailListWarpper.java new file mode 100644 index 0000000..06b5fe6 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailListWarpper.java @@ -0,0 +1,20 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/18 16:14 + */ +@Data +@ApiModel +public class CommissionDetailListWarpper { + @ApiModelProperty("总计") + private Double total; + @ApiModelProperty("列表数据") + private List<CommissionDetailWarpper> list; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailWarpper.java new file mode 100644 index 0000000..a2f1bcb --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionDetailWarpper.java @@ -0,0 +1,22 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/18 16:16 + */ +@Data +@ApiModel +public class CommissionDetailWarpper { + @ApiModelProperty("说明") + private String explain; + @ApiModelProperty("时间") + private Long createTime; + @ApiModelProperty("变动金额") + private Double money; + @ApiModelProperty("余额") + private Double balance; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionListWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionListWarpper.java new file mode 100644 index 0000000..a488b41 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/CommissionListWarpper.java @@ -0,0 +1,20 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/18 11:34 + */ +@Data +@ApiModel +public class CommissionListWarpper { + @ApiModelProperty("日期") + private Long createTime; + @ApiModelProperty("推广类型(1=用户,2=司机)") + private Integer userType; + @ApiModelProperty("获取佣金") + private Double amount; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfo.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfo.java index 785b5ca..43d5d33 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfo.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfo.java @@ -21,4 +21,8 @@ private String code; @ApiModelProperty(value = "新手机号码", required = false, dataType = "String") private String phone; + @ApiModelProperty(value = "收款码", required = false, dataType = "String") + private String wxCollectionCode; + @ApiModelProperty(value = "收款码", required = false, dataType = "String") + private String zfbCollectionCode; } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfoWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfoWarpper.java index 4d02dbd..8c64512 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfoWarpper.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfoWarpper.java @@ -23,6 +23,8 @@ private Long youTuiStart; @ApiModelProperty("账户余额") private Double balance; + @ApiModelProperty("佣金余额") + private Double commission; @ApiModelProperty("积分") private Integer integral; @ApiModelProperty("今日接单") @@ -37,4 +39,8 @@ private String emergencyContact; @ApiModelProperty("紧急联系人电话") private String emergencyPhone; + @ApiModelProperty("微信收款码") + private String wxCollectionCode; + @ApiModelProperty("支付宝收款码") + private String zfbCollectionCode; } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverOrderListWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverOrderListWarpper.java new file mode 100644 index 0000000..6925ec7 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverOrderListWarpper.java @@ -0,0 +1,28 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/18 10:22 + */ +@Data +@ApiModel +public class DriverOrderListWarpper { + @ApiModelProperty("订单id") + private Integer id; + @ApiModelProperty("标题") + private String title; + @ApiModelProperty("订单时间") + private Long createTime; + @ApiModelProperty("起点地址") + private String startAddress; + @ApiModelProperty("终点地址") + private String endAddress; + @ApiModelProperty("订单状态") + private Integer state; + @ApiModelProperty("订单来源(1=乘客,2=司机)") + private Integer source; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiListWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiListWarpper.java new file mode 100644 index 0000000..4bcb74e --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiListWarpper.java @@ -0,0 +1,20 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/15 16:20 + */ +@Data +@ApiModel +public class DriverYouTuiListWarpper { + @ApiModelProperty("日期") + private String month; + @ApiModelProperty("优推记录") + private List<DriverYouTuiWarpper> list; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiWarpper.java new file mode 100644 index 0000000..3c11323 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverYouTuiWarpper.java @@ -0,0 +1,32 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/15 16:21 + */ +@Data +@ApiModel +public class DriverYouTuiWarpper { + @ApiModelProperty("id") + private Integer id; + @ApiModelProperty("名称") + private String name; + @ApiModelProperty("优推类型(1=次数,2=小时)") + private Integer type; + @ApiModelProperty("优推值") + private Integer number; + @ApiModelProperty("图片") + private String img; + @ApiModelProperty("积分") + private Integer integral; + @ApiModelProperty("说明") + private String content; + @ApiModelProperty("兑换时间") + private Long createTime; + @ApiModelProperty("状态(1=待使用,2=使用中,3=已结束)") + private Integer state; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/HallOrderList.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/HallOrderList.java index 5a52299..3d373ff 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/HallOrderList.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/HallOrderList.java @@ -44,6 +44,8 @@ private String endLng; @ApiModelProperty("预估里程") private Double estimatedMileage; + @ApiModelProperty("预估费") + private Double estimatedPrice; @ApiModelProperty("起步价") private Double startPrice; } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/IntegralIncomeAndExpensesWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/IntegralIncomeAndExpensesWarpper.java new file mode 100644 index 0000000..5cd18f6 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/IntegralIncomeAndExpensesWarpper.java @@ -0,0 +1,20 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/15 14:58 + */ +@Data +@ApiModel +public class IntegralIncomeAndExpensesWarpper { + @ApiModelProperty("说明") + private String description; + @ApiModelProperty("时间") + private Long createTime; + @ApiModelProperty("积分") + private Integer integral; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/InviteListWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/InviteListWarpper.java new file mode 100644 index 0000000..b5fd849 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/InviteListWarpper.java @@ -0,0 +1,20 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/18 15:18 + */ +@Data +@ApiModel +public class InviteListWarpper { + @ApiModelProperty("用户昵称") + private String nickname; + @ApiModelProperty("时间") + private Long time; + @ApiModelProperty("类型(1=邀请下单,2=注册司机)") + private Integer type; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderInfoWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderInfoWarpper.java index 1825292..714b667 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderInfoWarpper.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderInfoWarpper.java @@ -15,6 +15,8 @@ private String userName; @ApiModelProperty("用户电话") private String userPhone; + @ApiModelProperty("用户余额") + private Double balance; @ApiModelProperty("下单次数") private Integer orderTimes; @ApiModelProperty("取消次数") diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderStatusWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderStatusWarpper.java new file mode 100644 index 0000000..55f1222 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderStatusWarpper.java @@ -0,0 +1,16 @@ +package com.supersavedriving.driver.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("订单状态") +public class OrderStatusWarpper { + @ApiModelProperty("订单id") + private Long orderId; + @ApiModelProperty("订单类型") + private Integer orderType; + @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)") + private Integer state; +} diff --git a/driver/pom.xml b/driver/pom.xml index 3766e59..104bdfa 100644 --- a/driver/pom.xml +++ b/driver/pom.xml @@ -1,7 +1,7 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> - <groupId>com.stylefeng</groupId> + <groupId>com.supersavedriving</groupId> <artifactId>guns-parent</artifactId> <version>1.0.0</version> @@ -54,12 +54,12 @@ <scope>import</scope> </dependency> <dependency> - <groupId>com.stylefeng</groupId> + <groupId>com.supersavedriving</groupId> <artifactId>guns-generator</artifactId> <version>${guns.version}</version> </dependency> <dependency> - <groupId>com.stylefeng</groupId> + <groupId>com.supersavedriving</groupId> <artifactId>guns-core</artifactId> <version>${guns.version}</version> </dependency> -- Gitblit v1.7.1