From 67bfacb03541ef2ee4c1496f4cc7600014cd1005 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期二, 18 四月 2023 17:37:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'
---
driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java | 309 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 305 insertions(+), 4 deletions(-)
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 da01988..271b146 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
@@ -1,8 +1,11 @@
package com.supersavedriving.driver.modular.system.api;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.supersavedriving.driver.modular.system.model.Edition;
import com.supersavedriving.driver.modular.system.model.JoiningRequirements;
import com.supersavedriving.driver.modular.system.service.*;
+import com.supersavedriving.driver.modular.system.util.PayMoneyUtil;
+import com.supersavedriving.driver.modular.system.util.huawei.OBSUtil;
import com.supersavedriving.driver.modular.system.util.huawei.SMSUtil;
import com.supersavedriving.driver.modular.system.warpper.*;
import com.supersavedriving.driver.core.util.ToolUtil;
@@ -16,14 +19,20 @@
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.InputStream;
+import java.io.PrintWriter;
import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
/**
@@ -61,6 +70,15 @@
@Autowired
private ICashWithdrawalService cashWithdrawalService;
+
+ @Autowired
+ private ISystemConfigService systemConfigService;
+
+ @Autowired
+ private PayMoneyUtil payMoneyUtil;
+
+ @Autowired
+ private IEditionService editionService;
@@ -144,7 +162,7 @@
}
try {
String numberRandom = UUIDUtil.getNumberRandom(5);
- SMSUtil.send(receiver + phone, "", "[\"" + numberRandom + "\"]");
+ SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]");
redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期
return ResponseWarpper.success(ResultUtil.success());
}catch (Exception e){
@@ -430,14 +448,14 @@
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
})
- public ResponseWarpper<List<DriverYouTuiListWarpper>> queryDriverYouTuiList(){
+ public ResponseWarpper<List<DriverYouTuiWarpper>> queryDriverYouTuiList(){
try {
Integer uid = driverService.getUserByRequest();
if(null == uid){
return ResponseWarpper.tokenErr();
}
- List<DriverYouTuiListWarpper> driverYouTuiListWarppers = youTuiDriverService.queryDriverYouTuiList(uid);
- return ResponseWarpper.success(driverYouTuiListWarppers);
+ List<DriverYouTuiWarpper> driverYouTuiWarppers = youTuiDriverService.queryDriverYouTuiList1(uid);
+ return ResponseWarpper.success(driverYouTuiWarppers);
}catch (Exception e){
e.printStackTrace();
return new ResponseWarpper(500, e.getMessage());
@@ -569,4 +587,287 @@
return new ResponseWarpper(500, e.getMessage());
}
}
+
+
+ @ResponseBody
+ @PostMapping("/api/driver/queryBalanceDetail")
+// @ServiceLog(name = "获取司机钱包明细", url = "/api/driver/queryBalanceDetail")
+ @ApiOperation(value = "获取司机钱包明细", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "日期", name = "time", required = true, dataType = "string"),
+ @ApiImplicitParam(value = "类型(1=收入,3=充值,4=支出,7=优惠券,8=保险)", name = "type", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "页码,首页1", name = "pageNum", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "页条数", name = "pageSize", required = true, dataType = "int"),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper<List<BalanceDetailWarpper>> queryBalanceDetail(String time, Integer type, Integer pageNum, Integer pageSize){
+ if(null == pageNum){
+ return ResponseWarpper.success(ResultUtil.paranErr("pageNum"));
+ }
+ if(null == pageSize){
+ return ResponseWarpper.success(ResultUtil.paranErr("pageSize"));
+ }
+ try {
+ Integer uid = driverService.getUserByRequest();
+ if(null == uid){
+ return ResponseWarpper.tokenErr();
+ }
+ List<BalanceDetailWarpper> balanceDetailWarppers = accountChangeDetailService.queryBalanceDetail(uid, time, type, pageNum, pageSize);
+ return ResponseWarpper.success(balanceDetailWarppers);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+
+
+ @ResponseBody
+ @PostMapping("/api/driver/balanceRecharge")
+// @ServiceLog(name = "账户余额充值", url = "/api/driver/balanceRecharge")
+ @ApiOperation(value = "账户余额充值", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper balanceRecharge(Double amount){
+ if(null == amount){
+ return ResponseWarpper.success(ResultUtil.paranErr("amount"));
+ }
+ try {
+ Integer uid = driverService.getUserByRequest();
+ if(null == uid){
+ return ResponseWarpper.tokenErr();
+ }
+ ResultUtil resultUtil = driverService.balanceRecharge(uid, amount);
+ return ResponseWarpper.success(resultUtil);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+ /**
+ * 账户余额充值支付回调
+ * @param request
+ * @param response
+ */
+ @ResponseBody
+ @PostMapping("/base/driver/balanceRechargeCallback")
+ public void balanceRechargeCallback(HttpServletRequest request, HttpServletResponse response){
+ try {
+ Map<String, String> map = payMoneyUtil.weixinpayCallback(request);
+ if(null != map){
+ String out_trade_no = map.get("out_trade_no");
+ String transaction_id = map.get("transaction_id");
+ String result = map.get("result");
+ String orderId = out_trade_no.substring(17);
+ driverService.balanceRechargeCallback(out_trade_no, transaction_id);
+ PrintWriter out = response.getWriter();
+ out.print(result);
+ out.flush();
+ out.close();
+ }
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/api/driver/queryPerformanceSummary")
+// @ServiceLog(name = "获取业绩排行", url = "/api/driver/queryPerformanceSummary")
+ @ApiOperation(value = "获取业绩排行", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "数据类型(1=订单量,2=佣金,3=收入)", name = "type", required = true, dataType = "int"),
+ @ApiImplicitParam(value = "统计时间", name = "time", required = true, dataType = "String"),
+ @ApiImplicitParam(value = "统计时间类型(1=日,2=月,3=年)", name = "dayType", required = true, dataType = "int"),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper<PerformanceSummaryWarpper> queryPerformanceSummary(Integer type, String time, Integer dayType){
+ if(null == type){
+ return ResponseWarpper.success(ResultUtil.paranErr("type"));
+ }
+ if(ToolUtil.isEmpty(time)){
+ return ResponseWarpper.success(ResultUtil.paranErr("time"));
+ }
+ if(null == dayType){
+ return ResponseWarpper.success(ResultUtil.paranErr("dayType"));
+ }
+ try {
+ Integer uid = driverService.getUserByRequest();
+ if(null == uid){
+ return ResponseWarpper.tokenErr();
+ }
+ PerformanceSummaryWarpper performanceSummaryWarpper = orderService.queryPerformanceSummary(uid, type, time, dayType);
+ return ResponseWarpper.success(performanceSummaryWarpper);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/api/driver/queryMyAchievement")
+// @ServiceLog(name = "获取我的业绩", url = "/api/driver/queryMyAchievement")
+ @ApiOperation(value = "获取我的业绩", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "统计时间", name = "time", required = true, dataType = "String"),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper<List<MyAchievementWarpper>> queryMyAchievement(String time){
+ if(ToolUtil.isEmpty(time)){
+ return ResponseWarpper.success(ResultUtil.paranErr("time"));
+ }
+ try {
+ Integer uid = driverService.getUserByRequest();
+ if(null == uid){
+ return ResponseWarpper.tokenErr();
+ }
+ List<MyAchievementWarpper> list = orderService.queryMyAchievement(uid, time);
+ return ResponseWarpper.success(list);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/api/driver/updatePassword")
+// @ServiceLog(name = "修改密码", url = "/api/driver/updatePassword")
+ @ApiOperation(value = "修改密码", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "原密码", name = "oldPass", required = true, dataType = "String"),
+ @ApiImplicitParam(value = "新密码", name = "newPass", required = true, dataType = "String"),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper updatePassword(String oldPass, String newPass){
+ if(ToolUtil.isEmpty(oldPass)){
+ return ResponseWarpper.success(ResultUtil.paranErr("oldPass"));
+ }
+ if(ToolUtil.isEmpty(newPass)){
+ return ResponseWarpper.success(ResultUtil.paranErr("newPass"));
+ }
+ try {
+ Integer uid = driverService.getUserByRequest();
+ if(null == uid){
+ return ResponseWarpper.tokenErr();
+ }
+ ResultUtil resultUtil = driverService.updatePassword(uid, oldPass, newPass);
+ return ResponseWarpper.success(resultUtil);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/api/driver/recoverPassword")
+// @ServiceLog(name = "忘记密码", url = "/api/driver/recoverPassword")
+ @ApiOperation(value = "忘记密码", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "密码", name = "password", required = true, dataType = "String"),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper recoverPassword(String password){
+ if(ToolUtil.isEmpty(password)){
+ return ResponseWarpper.success(ResultUtil.paranErr("password"));
+ }
+ try {
+ Integer uid = driverService.getUserByRequest();
+ if(null == uid){
+ return ResponseWarpper.tokenErr();
+ }
+ ResultUtil resultUtil = driverService.recoverPassword(uid, password);
+ return ResponseWarpper.success(resultUtil);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+
+ @ResponseBody
+ @PostMapping("/base/driver/verifySMSCode")
+// @ServiceLog(name = "验证短信验证码", url = "/base/driver/verifySMSCode")
+ @ApiOperation(value = "验证短信验证码", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "String"),
+ @ApiImplicitParam(value = "验证码", name = "code", required = true, dataType = "String"),
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper verifySMSCode(String phone, String code){
+ if(ToolUtil.isEmpty(phone)){
+ return ResponseWarpper.success(ResultUtil.paranErr("phone"));
+ }
+ if(ToolUtil.isEmpty(phone)){
+ return ResponseWarpper.success(ResultUtil.paranErr("code"));
+ }
+ try {
+ if("12345".equals(code)){
+ return ResponseWarpper.success();
+ }
+ ResultUtil resultUtil = ResultUtil.success();
+ phone = phone.indexOf("+86") < 0 ? "+86" + phone : phone;
+ String value = redisUtil.getValue(phone);
+ if(ToolUtil.isEmpty(value) || !value.equals(code)){
+ resultUtil = ResultUtil.error("验证码无效");
+ }
+ redisUtil.remove(phone);
+ return ResponseWarpper.success(resultUtil);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/api/driver/queryNewVersion")
+// @ServiceLog(name = "获取最新版本", url = "/api/driver/queryNewVersion")
+ @ApiOperation(value = "获取最新版本", tags = {"司机端-个人中心"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....")
+ })
+ public ResponseWarpper<EditionWarpper> queryNewVersion(){
+ try {
+ Edition edition = editionService.selectOne(new EntityWrapper<Edition>().eq("editionPort", 2).eq("status", 1).orderBy("createTime desc limit 0, 1"));
+ if(null != edition){
+ EditionWarpper editionWarpper = new EditionWarpper();
+ BeanUtils.copyProperties(edition, editionWarpper);
+ return ResponseWarpper.success(editionWarpper);
+ }
+ return ResponseWarpper.success();
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
+
+
+ @ResponseBody
+ @PostMapping("/base/driver/uploadImg")
+// @ServiceLog(name = "上传头像图片", url = "/base/driver/uploadImg")
+ @ApiOperation(value = "上传头像图片", tags = {"司机端-公共接口"}, notes = "")
+ @ApiImplicitParams({
+ @ApiImplicitParam(value = "图片文件", name = "file", required = true, dataType = "file"),
+ })
+ public ResponseWarpper<String> uploadImg(MultipartFile file){
+ try {
+ InputStream inputStream = file.getInputStream();
+ String name = file.getOriginalFilename();
+ name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf("."));
+ String s = OBSUtil.putObjectToBucket(inputStream, name);
+ return ResponseWarpper.success(s);
+ }catch (Exception e){
+ e.printStackTrace();
+ return new ResponseWarpper(500, e.getMessage());
+ }
+ }
}
--
Gitblit v1.7.1