From 7454b6532cd2a5c68235a45f1cc540e25f1ffaf4 Mon Sep 17 00:00:00 2001 From: xuhy <3313886187@qq.com> Date: 星期五, 07 四月 2023 18:40:45 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/NotInvoiceOrder.java | 26 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/YouTuiController.java | 40 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/huawei/SMSUtil.java | 9 zuul/src/main/java/com/sinata/zuul/controller/NettyController.java | 7 driver/guns-admin/src/main/resources/application.yml | 34 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BalanceDetailsWarpper.java | 28 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IRechargeRecordService.java | 11 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PriceRulesWarpper.java | 20 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/TaskUtil.java | 25 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/ISystemConfigService.java | 9 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/PayMoneyUtil.java | 5 eureka/pom.xml | 24 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfoWarpper.java | 2 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IComplaintService.java | 20 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java | 178 ++ driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/DriverController.java | 38 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderListWarpper.java | 231 --- eureka/src/main/java/com/sinata/eureka/EurekaApplication.java | 10 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/CloudRecordingCallback.java | 75 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverServiceImpl.java | 90 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PushOrderInfoWarpper.java | 24 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java | 18 zuul/src/main/java/com/sinata/zuul/util/echo/NettyChannelMap.java | 5 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/BillMapper.xml | 35 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/service/impl/YouTuiDriverServiceImpl.java | 11 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/ComplaintMapper.java | 11 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/RechargeRecordMapper.java | 11 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/UserToCouponMapper.java | 21 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java | 15 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/OrderMapper.xml | 2 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/AccountChangeDetail.java | 7 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/AccountChangeDetail.java | 10 zuul/src/main/java/com/sinata/zuul/util/applets/NettyWebSocketController.java | 21 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Bill.java | 94 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java | 36 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Complaint.java | 79 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/ImgController.java | 26 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/service/impl/AccountChangeDetailServiceImpl.java | 158 ++ driver/guns-admin/src/main/resources/logback-spring.xml | 4 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java | 142 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/AccountChangeDetailMapper.java | 16 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Output.java | 31 user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/OrderController.java | 129 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IBillService.java | 37 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java | 12 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/DriverInfoWarpper.java | 6 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/Invoicing.java | 30 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderServiceImpl.java | 421 +++++ driver/guns-admin/src/main/resources/redis.properties | 14 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/BillServiceImpl.java | 81 + driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IOrderService.java | 3 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/OrderMapper.java | 23 zuul/src/main/resources/redis.properties | 13 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/RechargeRecord.java | 74 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/ComplaintMapper.xml | 20 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IOrderService.java | 20 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderPriceWarpper.java | 2 user/guns-admin/src/main/resources/application.yml | 25 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/DriverMapper.xml | 1 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IUserToCouponService.java | 22 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAppUserService.java | 44 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml | 22 user/guns-admin/src/main/resources/logback-spring.xml | 4 user/guns-admin/src/main/resources/redis.properties | 13 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/BillMapper.java | 25 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/OrderController.java | 83 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/CommercialServiceImpl.java | 10 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/TravelOrder.java | 16 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml | 3 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BillWarpper.java | 26 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponsWarpper.java | 24 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/RechargeRecordMapper.xml | 19 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IDriverService.java | 17 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponWarpper.java | 2 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/TokenWarpper.java | 2 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderInfoWarpper.java | 14 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IYouTuiDriverService.java | 4 zuul/src/main/java/com/sinata/zuul/util/echo/NettyServerController.java | 62 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Order.java | 5 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverWorkServiceImpl.java | 16 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfo.java | 26 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/SystemConfigServiceImpl.java | 77 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/ComplaintServiceImpl.java | 48 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/OrderMapper.xml | 43 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/IAccountChangeDetailService.java | 6 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Config.java | 31 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/YouTuiDriverMapper.xml | 9 /dev/null | 38 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/UserToCouponServiceImpl.java | 21 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml | 43 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PayMoneyUtil.java | 17 driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/RongYunUtil.java | 307 ++++ user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Order.java | 5 user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java | 355 +++++ user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAccountChangeDetailService.java | 15 zuul/src/main/resources/application.yml | 6 98 files changed, 3,488 insertions(+), 569 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 561762b..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 @@ -5,6 +5,7 @@ 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; @@ -24,9 +25,11 @@ 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; @@ -159,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){ @@ -445,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()); @@ -626,7 +629,6 @@ @ApiOperation(value = "账户余额充值", tags = {"司机端-个人中心"}, notes = "") @ApiImplicitParams({ @ApiImplicitParam(value = "充值金额", name = "amount", required = true, dataType = "double"), - @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 balanceRecharge(Double amount){ @@ -684,7 +686,7 @@ @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 queryPerformanceSummary(Integer type, String time, Integer dayType){ + public ResponseWarpper<PerformanceSummaryWarpper> queryPerformanceSummary(Integer type, String time, Integer dayType){ if(null == type){ return ResponseWarpper.success(ResultUtil.paranErr("type")); } @@ -808,6 +810,9 @@ 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); @@ -844,4 +849,25 @@ 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()); + } + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/ImgController.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/ImgController.java index 3076392..5e864b3 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/ImgController.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/ImgController.java @@ -1,10 +1,14 @@ package com.supersavedriving.driver.modular.system.api; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.supersavedriving.driver.core.common.annotion.ServiceLog; import com.supersavedriving.driver.core.util.ToolUtil; import com.supersavedriving.driver.modular.system.model.Img; +import com.supersavedriving.driver.modular.system.model.SystemConfig; import com.supersavedriving.driver.modular.system.service.IImgService; +import com.supersavedriving.driver.modular.system.service.ISystemConfigService; import com.supersavedriving.driver.modular.system.util.ResultUtil; import com.supersavedriving.driver.modular.system.warpper.BaseWarpper; import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; @@ -24,6 +28,9 @@ @Autowired private IImgService imgService; + @Autowired + private ISystemConfigService systemConfigService; + @ResponseBody @@ -38,13 +45,20 @@ return ResponseWarpper.success(ResultUtil.paranErr("type")); } try { - List<Img> imgs = imgService.selectList(new EntityWrapper<Img>().eq("type", type)); List<BaseWarpper> list = new ArrayList<>(); - for (Img img : imgs) { - BaseWarpper baseWarpper = new BaseWarpper(); - baseWarpper.setId(img.getId().longValue()); - baseWarpper.setPath(img.getImg()); - list.add(baseWarpper); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); + if(null != systemConfig) { + JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); + Integer num2 = jsonObject1.getInteger("num2");//启动页开关 + if(1 == num2){ + List<Img> imgs = imgService.selectList(new EntityWrapper<Img>().eq("type", type)); + for (Img img : imgs) { + BaseWarpper baseWarpper = new BaseWarpper(); + baseWarpper.setId(img.getId().longValue()); + baseWarpper.setPath(img.getImg()); + list.add(baseWarpper); + } + } } return ResponseWarpper.success(list); }catch (Exception e){ 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 9e24715..8458ebb 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,7 +1,9 @@ package com.supersavedriving.driver.modular.system.api; +import com.supersavedriving.driver.modular.system.model.Driver; +import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil; +import com.supersavedriving.driver.modular.system.util.rongyun.model.CloudRecordingCallback; 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.IDriverService; import com.supersavedriving.driver.modular.system.service.IOrderService; @@ -18,7 +20,9 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletRequest; import java.util.List; +import java.util.Map; /** * 订单控制器 @@ -35,6 +39,9 @@ @Autowired private IDriverService driverService; + @Autowired + private RongYunUtil rongYunUtil; + @@ -45,14 +52,14 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResponseWarpper<Long> queryDriverServerOrder(){ + public ResponseWarpper<Map<String, Object>> queryDriverServerOrder(){ try { Integer uid = driverService.getUserByRequest(); if(null == uid){ return ResponseWarpper.tokenErr(); } - Long id = orderService.queryDriverServerOrder(uid); - return ResponseWarpper.success(id); + Map<String, Object> map = orderService.queryDriverServerOrder(uid); + return ResponseWarpper.success(map); }catch (Exception e){ e.printStackTrace(); return new ResponseWarpper(500, e.getMessage()); @@ -68,7 +75,7 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResponseWarpper driverAddOrder(AddOrderWarpper addOrderWarpper){ + public ResponseWarpper<Integer> driverAddOrder(AddOrderWarpper addOrderWarpper){ try { Integer uid = driverService.getUserByRequest(); if(null == uid){ @@ -425,4 +432,70 @@ return new ResponseWarpper(500, e.getMessage()); } } + + + /** + * 服务录音回调 + * @param request + */ + @ResponseBody + @PostMapping("/base/order/cloudRecordingCallback") + public void cloudRecordingCallback(HttpServletRequest request){ + CloudRecordingCallback cloudRecordingCallback = RongYunUtil.cloudRecordingCallback(request); + System.err.println("-------------------云端录制状态回调!-------------------"); + if(null == cloudRecordingCallback){ + System.err.println("云端录制状态回调解析出错!"); + return; + } + Integer type = cloudRecordingCallback.getType(); + if(4 == type){//文件上传 + String fileUrl = cloudRecordingCallback.getOutput().getFileUrl(); + System.err.println("文件上传完毕:" + fileUrl); + } + } + + + @ResponseBody + @PostMapping("/api/order/openOrderQRCode") +// @ServiceLog(name = "打开下单二维码操作", url = "/api/order/openOrderQRCode") + @ApiOperation(value = "打开下单二维码操作", tags = {"司机端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper openOrderQRCode(){ + try { + Integer uid = driverService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.tokenErr(); + } + ResultUtil resultUtil = driverService.openOrderQRCode(uid); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/closeOrderQRCode") +// @ServiceLog(name = "关闭下单二维码操作", url = "/api/order/closeOrderQRCode") + @ApiOperation(value = "关闭下单二维码操作", tags = {"司机端-首页"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper closeOrderQRCode(){ + try { + Integer uid = driverService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.tokenErr(); + } + ResultUtil resultUtil = driverService.closeOrderQRCode(uid); + 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/YouTuiController.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/api/YouTuiController.java index add8421..c953d6b 100644 --- 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 @@ -1,8 +1,11 @@ package com.supersavedriving.driver.modular.system.api; import com.supersavedriving.driver.core.util.ToolUtil; +import com.supersavedriving.driver.modular.system.model.YouTui; +import com.supersavedriving.driver.modular.system.model.YouTuiDriver; 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.DriverYouTuiWarpper; import com.supersavedriving.driver.modular.system.warpper.ResponseWarpper; @@ -15,6 +18,7 @@ import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; +import java.util.Date; import java.util.List; /** @@ -30,6 +34,9 @@ @Autowired private IDriverService driverService; + + @Autowired + private IYouTuiService youTuiService; @@ -123,4 +130,37 @@ return new ResponseWarpper(500, e.getMessage()); } } + + + + @ResponseBody + @PostMapping("/api/youtui/userYouTui") +// @ServiceLog(name = "司机使用优推", url = "/api/youtui/userYouTui") + @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 userYouTui(Integer id){ + if(ToolUtil.isEmpty(id)){ + return ResponseWarpper.success(ResultUtil.paranErr("id")); + } + try { + Integer uid = driverService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.tokenErr(); + } + YouTuiDriver youTuiDriver = youTuiDriverService.selectById(id); + youTuiDriver.setState(2); + if(youTuiDriver.getType() == 2){ + YouTui youTui = youTuiService.selectById(youTuiDriver.getYouTuiId()); + youTuiDriver.setEndTime(new Date(System.currentTimeMillis() + (youTui.getNumber() * 3600000))); + } + youTuiDriverService.updateById(youTuiDriver); + return ResponseWarpper.success(); + }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/mapping/AccountChangeDetailMapper.xml b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/dao/mapping/AccountChangeDetailMapper.xml index 08fdf80..68accb2 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 @@ -12,6 +12,7 @@ <result column="changeType" property="changeType"/> <result column="oldData" property="oldData"/> <result column="newData" property="newData"/> + <result column="orderId" property="orderId"/> <result column="explain" property="explain"/> <result column="createTime" property="createTime"/> </resultMap> @@ -21,7 +22,7 @@ <select id="queryDriverIntegralIncomeAndExpenses" resultType="com.supersavedriving.driver.modular.system.warpper.IntegralIncomeAndExpensesWarpper"> select * from ( select - explain as description, + `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} 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 e3662b1..5369833 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 @@ -48,5 +48,6 @@ <result column="wxCollectionCode" property="wxCollectionCode"/> <result column="zfbCollectionCode" property="zfbCollectionCode"/> <result column="openid" property="openid"/> + <result column="openOrderQRCode" property="openOrderQRCode"/> </resultMap> </mapper> 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 1e7fb1d..1f80e47 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 @@ -174,7 +174,7 @@ </select> - <select id="queryDriverrank" resultType="com.supersavedriving.driver.modular.system.warpper.PerformanceRankingWarpper"> + <select id="queryDriverRank" resultType="com.supersavedriving.driver.modular.system.warpper.PerformanceRankingWarpper"> select aa.driverId, aa.name, 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 db94344..5012313 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 @@ -26,10 +26,15 @@ select b.`name`, b.integral, - UNIX_TIMESTAMP(a.createTime) * 1000 as createTime + 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} and DATE_FORMAT(a.createTime, '%Y年%m月') = #{createTime} order by a.createTime desc + where a.driverId = #{driverId} + <if test="null != createTime and '' != createTime"> + and DATE_FORMAT(a.createTime, '%Y年%m月') = #{createTime} + </if> + order by a.createTime desc </select> 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 376c5dd..dc35c3e 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 @@ -43,7 +43,7 @@ @TableField("type") private Integer type; /** - * 变动类型(1=订单收入,2=订单支出,3=充值,4=提现,5=佣金收入,6=佣金提现,7=优惠券收入,8=保险支付) + * 变动类型(1=订单收入,2=订单支出,3=充值,4=提现,5=佣金收入,6=佣金提现,7=优惠券收入,8=保险支付,9=线下收款支付) */ @TableField("changeType") private Integer changeType; @@ -58,6 +58,11 @@ @TableField("newData") private Double newData; /** + * 订单id + */ + @TableField("orderId") + private Long orderId; + /** * 变动说明 */ @TableField("explain") 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 4509929..1296169 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 @@ -232,4 +232,9 @@ */ @TableField("openid") private String openid; + /** + * 是否打开下单二维码 + */ + @TableField("openOrderQRCode") + private Integer openOrderQRCode; } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Order.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Order.java index 843f2d0..b73e060 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Order.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/model/Order.java @@ -218,6 +218,11 @@ @TableField("estimatedMileage") private Double estimatedMileage; /** + * 预估时间 + */ + @TableField("estimatedTime") + private Integer estimatedTime; + /** * 订单金额 */ @TableField("orderMoney") 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 079a092..e987361 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 @@ -57,4 +57,10 @@ * @throws Exception */ List<BalanceDetailWarpper> queryBalanceDetail(Integer driverId, String time, Integer type, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 处理司机保险费用 + */ + void deductionInsurance(); } 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 89d7324..306bab2 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 @@ -158,4 +158,21 @@ * @throws Exception */ ResultUtil recoverPassword(Integer uid, String password) throws Exception; + + + /** + * 打开下单二维码 + * @param uid + * @return + */ + ResultUtil openOrderQRCode(Integer uid) throws Exception; + + + /** + * 关闭下单二维码 + * @param uid + * @return + * @throws Exception + */ + ResultUtil closeOrderQRCode(Integer uid) throws Exception; } 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 77e1a5a..e989838 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 @@ -10,6 +10,7 @@ import com.supersavedriving.driver.modular.system.warpper.OrderInfoWarpper; import java.util.List; +import java.util.Map; /** * 订单 @@ -25,7 +26,7 @@ * @return * @throws Exception */ - Long queryDriverServerOrder(Integer uid) throws Exception; + Map<String, Object> queryDriverServerOrder(Integer uid) 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 abc565a..6c5b828 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 @@ -20,6 +20,10 @@ List<DriverYouTuiListWarpper> queryDriverYouTuiList(Integer driverId) throws Exception; + List<DriverYouTuiWarpper> queryDriverYouTuiList1(Integer driverId) throws Exception; + + + /** * 获取司机优推列表 * @param driverId 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 527f2a5..0b1b322 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 @@ -1,13 +1,22 @@ package com.supersavedriving.driver.modular.system.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.supersavedriving.driver.modular.system.dao.AccountChangeDetailMapper; import com.supersavedriving.driver.modular.system.model.AccountChangeDetail; +import com.supersavedriving.driver.modular.system.model.Driver; +import com.supersavedriving.driver.modular.system.model.SystemConfig; import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; +import com.supersavedriving.driver.modular.system.service.IDriverService; +import com.supersavedriving.driver.modular.system.service.ISystemConfigService; +import com.supersavedriving.driver.modular.system.util.UUIDUtil; import com.supersavedriving.driver.modular.system.warpper.BalanceDetailWarpper; 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.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Date; @@ -20,6 +29,15 @@ */ @Service public class AccountChangeDetailServiceImpl extends ServiceImpl<AccountChangeDetailMapper, AccountChangeDetail> implements IAccountChangeDetailService { + + @Autowired + private IDriverService driverService; + + @Autowired + private ISystemConfigService systemConfigService; + + + /** @@ -86,4 +104,144 @@ List<BalanceDetailWarpper> balanceDetailWarppers = this.baseMapper.queryBalanceDetail(driverId, time, type, pageNum, pageSize); return balanceDetailWarppers; } + + + /** + * 处理司机保险 + */ + @Override + public void deductionInsurance() { + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); + if(null == systemConfig){ + return; + } + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + Double num1 = jsonObject.getDouble("num1"); + List<Driver> drivers = driverService.selectList(new EntityWrapper<Driver>().eq("approvalStatus", 2).eq("status", 1)); + for (Driver driver : drivers) { + Double couponBalance = driver.getCouponBalance(); + Double backgroundBalance = driver.getBackgroundBalance(); + Double balance = driver.getBalance(); + Double commission = driver.getCommission(); + double all = couponBalance + backgroundBalance + balance + commission; + if(num1 > all){ + continue; + } + + double d = num1.doubleValue(); + if(backgroundBalance < d){ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(8); + accountChangeDetail.setOldData(driver.getBackgroundBalance()); + accountChangeDetail.setNewData(0D); + accountChangeDetail.setExplain("收取保险费"); + accountChangeDetail.setCreateTime(new Date()); + this.insert(accountChangeDetail); + d -= backgroundBalance; + driver.setBackgroundBalance(0D); + }else{ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(8); + accountChangeDetail.setOldData(driver.getBackgroundBalance()); + d = 0; + driver.setBackgroundBalance(driver.getBackgroundBalance() - d); + accountChangeDetail.setNewData(driver.getBackgroundBalance()); + accountChangeDetail.setExplain("收取保险费"); + accountChangeDetail.setCreateTime(new Date()); + this.insert(accountChangeDetail); + } + + if(d > 0){ + if(couponBalance < d){ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(8); + accountChangeDetail.setOldData(driver.getCouponBalance()); + accountChangeDetail.setNewData(0D); + accountChangeDetail.setExplain("收取保险费"); + accountChangeDetail.setCreateTime(new Date()); + this.insert(accountChangeDetail); + d -= couponBalance; + driver.setCouponBalance(0D); + }else{ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(8); + accountChangeDetail.setOldData(driver.getCouponBalance()); + d = 0; + driver.setCouponBalance(driver.getCouponBalance() - d); + accountChangeDetail.setNewData(driver.getCouponBalance()); + accountChangeDetail.setExplain("收取保险费"); + accountChangeDetail.setCreateTime(new Date()); + this.insert(accountChangeDetail); + } + } + if(d > 0){ + if(commission < d){ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(8); + accountChangeDetail.setOldData(driver.getCommission()); + accountChangeDetail.setNewData(0D); + accountChangeDetail.setExplain("收取保险费"); + accountChangeDetail.setCreateTime(new Date()); + this.insert(accountChangeDetail); + d -= commission; + driver.setCommission(0D); + }else{ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(8); + accountChangeDetail.setOldData(driver.getCommission()); + d = 0; + driver.setCommission(driver.getCommission() - d); + accountChangeDetail.setNewData(driver.getCommission()); + accountChangeDetail.setExplain("收取保险费"); + accountChangeDetail.setCreateTime(new Date()); + this.insert(accountChangeDetail); + } + } + if(d > 0){ + if(balance < d){ + continue; + }else{ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(8); + accountChangeDetail.setOldData(driver.getBalance()); + d = 0; + driver.setBalance(driver.getBalance() - d); + accountChangeDetail.setNewData(driver.getBalance()); + accountChangeDetail.setExplain("收取保险费"); + accountChangeDetail.setCreateTime(new Date()); + this.insert(accountChangeDetail); + } + } + + driverService.updateById(driver); + } + } } 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 b6a8177..966a7ee 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 @@ -12,11 +12,9 @@ import com.supersavedriving.driver.modular.system.model.*; import com.supersavedriving.driver.modular.system.service.*; import com.supersavedriving.driver.modular.system.dao.DriverMapper; -import com.supersavedriving.driver.modular.system.util.PayMoneyUtil; -import com.supersavedriving.driver.modular.system.util.RedisUtil; -import com.supersavedriving.driver.modular.system.util.ResultUtil; -import com.supersavedriving.driver.modular.system.util.UUIDUtil; +import com.supersavedriving.driver.modular.system.util.*; import com.supersavedriving.driver.modular.system.util.mongodb.model.Location; +import com.supersavedriving.driver.modular.system.util.rongyun.RongYunUtil; import com.supersavedriving.driver.modular.system.warpper.*; import org.apache.shiro.authc.SimpleAuthenticationInfo; import org.apache.shiro.authc.UsernamePasswordToken; @@ -93,6 +91,9 @@ @Autowired private IAgentService agentService; + + @Autowired + private RongYunUtil rongYunUtil; @@ -217,6 +218,16 @@ tokenWarpper.setToken(token); tokenWarpper.setValidTime(7200L); tokenWarpper.setIsSetPassword(ToolUtil.isEmpty(driver.getPassword()) ? 0 : 1); + + String RYToken = rongYunUtil.getToken(driver.getId().toString(), driver.getName(), driver.getAvatar()); + if(ToolUtil.isNotEmpty(RYToken)){ + JSONObject jsonObject = JSON.parseObject(RYToken); + Integer code1 = jsonObject.getInteger("code"); + if(200 == code1){ + tokenWarpper.setRytoken(jsonObject.getString("token")); + } + } + return ResultUtil.success(tokenWarpper); } @@ -261,6 +272,14 @@ tokenWarpper.setToken(token); tokenWarpper.setValidTime(Integer.valueOf(7 * 24 * 60 * 60).longValue()); tokenWarpper.setIsSetPassword(ToolUtil.isEmpty(driver.getPassword()) ? 0 : 1); + String RYToken = rongYunUtil.getToken(driver.getId().toString(), driver.getName(), driver.getAvatar()); + if(ToolUtil.isNotEmpty(RYToken)){ + JSONObject jsonObject = JSON.parseObject(RYToken); + Integer code1 = jsonObject.getInteger("code"); + if(200 == code1){ + tokenWarpper.setRytoken(jsonObject.getString("token")); + } + } return ResultUtil.success(tokenWarpper); } @@ -444,7 +463,7 @@ @Override public PromotionWarpper queryPromotionQRCode(Integer uid) throws Exception { PromotionWarpper promotionWarpper = new PromotionWarpper(); - promotionWarpper.setUrl("http://127.0.0.1?uid=" + 2 + "utype=" + 2); + promotionWarpper.setUrl("http://121.37.15.157/share/driverShare/index.html?inviterId=" + uid); int user = appUserService.selectCount(new EntityWrapper<AppUser>().eq("inviterType", 2).eq("inviterId", uid).eq("status", 1)); int driver = this.selectCount(new EntityWrapper<Driver>().eq("inviterType", 2).eq("inviterId", uid).eq("approvalStatus", 2).eq("status", 1)); promotionWarpper.setTotal(user + driver); @@ -523,9 +542,10 @@ 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")); + YouTuiDriver youTuiDriver = youTuiDriverService.selectOne(new EntityWrapper<YouTuiDriver>().eq("driverId", uid) + .eq("state", 2).last(" and failureTime > now() order by failureTime limit 0, 1")); if(null != youTuiDriver){ - driverInfo.setYouTuiStart(youTuiDriver.getCreateTime().getTime()); + driverInfo.setYouTuiEnd(youTuiDriver.getType() == 1 ? youTuiDriver.getFailureTime().getTime() : youTuiDriver.getEndTime().getTime()); } List<Integer> state = Arrays.asList(107, 108, 109); int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", state).last(" and DATE_FORMAT('%Y-%m-%d', createTime) = DATE_FORMAT('%Y-%m-%d', now())")); @@ -574,11 +594,13 @@ } if(ToolUtil.isNotEmpty(driverInfo.getPhone()) && ToolUtil.isNotEmpty(driverInfo.getCode())){ String value = redisUtil.getValue(driverInfo.getPhone()); - if(ToolUtil.isEmpty(value)){ - return ResultUtil.error("验证码已过期"); - } - if(!value.equals(driverInfo.getPhone())){ - return ResultUtil.error("验证码无效"); + if(!"12345".equals(driverInfo.getCode())){ + if(ToolUtil.isEmpty(value)){ + return ResultUtil.error("验证码已过期"); + } + if(!value.equals(driverInfo.getCode())){ + return ResultUtil.error("验证码无效"); + } } driver.setPhone(driverInfo.getPhone()); } @@ -696,6 +718,12 @@ Thread.sleep(wait); num++; } + }else{ + Thread.sleep(wait); + num++; + } + if(10 == num){ + rechargeRecordService.deleteById(rechargeRecord1.getId()); } } }catch (Exception e){ @@ -775,4 +803,42 @@ this.updateById(driver); return ResultUtil.success(); } + + + /** + * 打开下单二维码 + * @param uid + * @return + * @throws Exception + */ + @Override + public ResultUtil openOrderQRCode(Integer uid) throws Exception { + Driver driver = this.selectById(uid); + driver.setOpenOrderQRCode(1); + this.updateById(driver); + new Timer().schedule(new TimerTask() { + @Override + public void run() { + Driver driver = DriverServiceImpl.this.selectById(uid); + driver.setOpenOrderQRCode(0); + DriverServiceImpl.this.updateById(driver); + } + }, 120000); + return ResultUtil.success(); + } + + + /** + * 关闭下单二维码 + * @param uid + * @return + * @throws Exception + */ + @Override + public ResultUtil closeOrderQRCode(Integer uid) throws Exception { + Driver driver = this.selectById(uid); + driver.setOpenOrderQRCode(0); + this.updateById(driver); + return ResultUtil.success(); + } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverWorkServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverWorkServiceImpl.java index 9b94d76..e5ac4a8 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverWorkServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/DriverWorkServiceImpl.java @@ -5,12 +5,9 @@ import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.supersavedriving.driver.core.util.ToolUtil; +import com.supersavedriving.driver.modular.system.model.*; import com.supersavedriving.driver.modular.system.service.*; import com.supersavedriving.driver.modular.system.dao.DriverWorkMapper; -import com.supersavedriving.driver.modular.system.model.Driver; -import com.supersavedriving.driver.modular.system.model.DriverWork; -import com.supersavedriving.driver.modular.system.model.OrderTransfer; -import com.supersavedriving.driver.modular.system.model.SystemConfig; import com.supersavedriving.driver.modular.system.service.*; import com.supersavedriving.driver.modular.system.util.RedisUtil; import com.supersavedriving.driver.modular.system.util.ResultUtil; @@ -18,7 +15,9 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import java.util.Arrays; import java.util.Date; +import java.util.List; /** * 司机上下班操作记录 @@ -42,7 +41,6 @@ @Autowired private RedisUtil redisUtil; - @@ -95,6 +93,11 @@ */ @Override public ResultUtil driverOffWork(Integer driverId, Long onlineTime) throws Exception { + List<Integer> state = Arrays.asList(102, 103, 104, 105, 106, 201, 401); + int count = orderService.selectCount(new EntityWrapper<Order>().eq("driverId", driverId).eq("status", 1).in("state", state)); + if(count > 0){ + return ResultUtil.error("还有未完成的订单"); + } DriverWork driverWork = this.selectOne(new EntityWrapper<DriverWork>().eq("driverId", driverId).eq("status", 1)); if(null == driverWork){ return ResultUtil.error("您还未上班"); @@ -108,6 +111,9 @@ } driverWork.setStatus(2); this.updateById(driverWork); + Driver driver = driverService.selectById(driverId); + driver.setServerStatus(1); + driverService.updateById(driver); return ResultUtil.success(); } } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java index 8184384..3fded99 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/service/impl/OrderPositionServiceImpl.java @@ -103,8 +103,16 @@ if(50 >= wgs84 && 12 <= (null == num ? 0 : num)){//1分钟(5秒上传一次数据) Integer integer = map.get(order.getId().toString()); map.put(order.getId().toString(), integer++); - order.setState(401);//进入等待状态 - order.setStartWaitTime(new Date()); + //进入等待状态 + ProcessOperationsWarpper processOperationsWarpper = new ProcessOperationsWarpper(); + processOperationsWarpper.setOrderId(order.getId()); + processOperationsWarpper.setState(401); + try { + orderService.driverProcessOperations(order.getDriverId(), processOperationsWarpper); + } catch (Exception e) { + e.printStackTrace(); + } + } if(50 >= wgs84 && 12 > (null == num ? 0 : num)){ Integer integer = map.get(order.getId().toString()); 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 646f3a3..4416d6b 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 @@ -107,12 +107,15 @@ * @throws Exception */ @Override - public Long queryDriverServerOrder(Integer uid) throws Exception { - Order order = this.selectOne(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201))); + public Map<String, Object> queryDriverServerOrder(Integer uid) throws Exception { + Order order = this.selectOne(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1) + .in("state", Arrays.asList(102, 103, 104, 105, 106, 401))); + Map<String, Object> map = new HashMap<>(); if(null != order){ - return order.getId(); + map.put("id", order.getId()); + map.put("state", order.getState()); } - return 0L; + return map; } @@ -129,14 +132,13 @@ * 司机上线且空闲,下单直接给当前司机,其余进大厅 * 司机下的订单不需要创建新用户,且只能走线下支付 */ - int count = this.selectCount(new EntityWrapper<Order>().eq("userPhone", addOrderWarpper.getPhone()).eq("status", 1).in("state", Arrays.asList(101, 102, 103, 104, 105, 106, 201))); if(count > 0){ return ResultUtil.error("该用户还有未完成的订单"); } Driver driver = driverService.selectById(uid); DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); - Order order1 = this.selectOne(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201))); + Order order1 = this.selectOne(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", Arrays.asList(102, 103, 104, 105, 201, 401))); Order order = new Order(); if(driverWork != null && null == order1){ order.setDriverId(uid); @@ -168,11 +170,13 @@ } d = Double.valueOf(distance.get("distance")) / 1000; order.setEstimatedMileage(d); + order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); } String city = ""; District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); city = null != weatherCity ? weatherCity.getId().toString() : ""; } order = getOrderPrice(1, d, 0, order, city); @@ -188,7 +192,7 @@ //开始推单 pushOrder(order); } - return ResultUtil.success(); + return ResultUtil.success(order.getState() == 102 ? order.getId() : null); } @@ -299,28 +303,36 @@ } //恶劣天气 - boolean badWeather = WeatherUtil.isBadWeather(city); - if(badWeather){ - order.setBadWeatherDistance(num5);//恶劣天气公里 - order.setBadWeatherPrice(num6);//恶劣天气费 - if(distance.compareTo(num7) > 0){ - BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); - BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); - order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 - order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 - } + systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); + if(null != systemConfig) { + JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); + Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 + if(1 == num11){ + boolean badWeather = WeatherUtil.isBadWeather(city); + if(badWeather){ + order.setBadWeatherDistance(num5);//恶劣天气公里 + order.setBadWeatherPrice(num6);//恶劣天气费 + if(distance.compareTo(num7) > 0){ + BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); + BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); + order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 + order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 + } - double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); - if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) - if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 - order.setBadWeatherPrice(num9);//恶劣天气费 - order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 - }else{ - BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); - order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 + double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); + if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) + if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 + order.setBadWeatherPrice(num9);//恶劣天气费 + order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 + }else{ + BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); + order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 + } + } } } } + //计算折扣 if(null != order.getUserId()){ @@ -434,6 +446,9 @@ //开始范围查找 if(null == driver){ for (int i = 1; i < 4; i++) { + if(null != driver){ + break; + } num = jsonObject.getDouble("num" + i) / 1000;//范围公里 //构造半径 distanceR = new Distance(num, Metrics.KILOMETERS); @@ -517,13 +532,16 @@ @Override public List<HallOrderList> queryOrderHall(Integer uid, Integer pageNum, Integer pageSize) throws Exception { pageNum = (pageNum - 1) * pageSize; + String value = redisUtil.getValue("DRIVER" + uid); List<HallOrderList> hallOrderLists = this.baseMapper.queryOrderHall(pageNum, pageSize); hallOrderLists.forEach(hallOrderList -> { hallOrderList.setCurrentDistance(0D); - if(ToolUtil.isNotEmpty(hallOrderList.getEndLng())){ - Map<String, Double> distance = GeodesyUtil.getDistance(hallOrderList.getStartLng() + "," + hallOrderList.getStartLat(), hallOrderList.getEndLng() + "," + hallOrderList.getEndLat()); + if(ToolUtil.isNotEmpty(value)){ + Map<String, Double> distance = GeodesyUtil.getDistance(hallOrderList.getStartLng() + "," + hallOrderList.getStartLat(), value); Double wgs84 = distance.get("WGS84"); hallOrderList.setCurrentDistance(wgs84); + }else{ + hallOrderList.setCurrentDistance(0D); } }); return hallOrderLists; @@ -566,8 +584,8 @@ accountChangeDetail.setUserType(2); accountChangeDetail.setUserId(order.getDriverId()); accountChangeDetail.setType(2); - accountChangeDetail.setOldData(driver.getIntegral().doubleValue()); - driver.setIntegral(driver.getIntegral() - num10); + accountChangeDetail.setOldData(null == driver.getIntegral() ? 0 : driver.getIntegral().doubleValue()); + driver.setIntegral((null == driver.getIntegral() ? 0 : driver.getIntegral()) - num10); accountChangeDetail.setNewData(driver.getIntegral().doubleValue()); accountChangeDetail.setExplain("拒绝订单扣除积分"); accountChangeDetailService.saveData(accountChangeDetail); @@ -591,6 +609,11 @@ DriverWork driverWork = driverWorkService.selectOne(new EntityWrapper<DriverWork>().eq("driverId", uid).eq("status", 1)); if(null == driverWork){ return ResultUtil.error("请先上班"); + } + List<Integer> state1 = Arrays.asList(102, 103, 104, 105, 106, 201, 401); + int count = this.selectCount(new EntityWrapper<Order>().eq("driverId", uid).eq("status", 1).in("state", state1)); + if(count > 0){ + return ResultUtil.error("还有未完成的订单"); } boolean lock = redisUtil.lock(); if(!lock){ @@ -662,6 +685,7 @@ } //推动订单数据 + pushOrderInfo(order.getId(), uid);//开始推送订单数据 //发送系统消息 systemMessageService.addSystemMessage(uid, 2, "接单成功", "您已成功接到用户订单,请尽快联系客户!"); pushUtil.pushOrderStatus(order.getDriverId(), 2, order.getId(), order.getState()); @@ -687,6 +711,9 @@ @Override public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception { OrderInfoWarpper orderInfoWarpper = this.baseMapper.queryOrderInfo(orderId); + if(orderInfoWarpper.getTravelTime() == null){ + orderInfoWarpper.setTravelTime(0); + } AppUser appUser = appUserService.selectById(uid); orderInfoWarpper.setBalance(appUser.getAccountBalance()); orderInfoWarpper.setCurrentDistance(0D); @@ -724,7 +751,6 @@ switch (processOperationsWarpper.getState()){ case 103: order.setGoToAppointmentPointTime(new Date()); - pushOrderInfo(order.getId(), uid);//开始推送订单数据 break; case 104: order.setStartWaitTime(new Date()); @@ -736,10 +762,10 @@ order.setBoardingTime(new Date()); order.setStartTime(new Date()); } - order.setStartWaitTime(null); //计算等待用户时长 Integer w = Double.valueOf((System.currentTimeMillis() - order.getStartWaitTime().getTime()) / 60000).intValue(); order.setWaitTime(order.getWaitTime() + w); + order.setStartWaitTime(null); break; case 106: order.setGetoffTime(new Date()); @@ -748,17 +774,12 @@ order.setEndLng(processOperationsWarpper.getEndLng()); order.setEndLat(processOperationsWarpper.getEndLat()); } - //停止定时任务 - Timer timer = timerMap.get(order.getId().toString()); - if(null != timer){ - timer.cancel(); - timerMap.remove(order.getId().toString()); - } //开始计算费用 String city = ""; District geocode = MapUtil.geocode(order.getEndLng(), order.getEndLat()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); city = null != weatherCity ? weatherCity.getId().toString() : ""; } order = getOrderPrice(2, Double.valueOf(order.getActualMileage() / 1000), order.getWaitTime(), order, city); @@ -836,21 +857,23 @@ return; } AppUser appUser = appUserService.selectById(order.getUserId()); - if(appUser.getInviterType() == 1){ - return; + if(null != appUser && null != appUser.getInviterType()){ + if(appUser.getInviterType() == 1){ + return; + } + Driver driver1 = driverService.selectById(appUser.getInviterId()); + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(2); + accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); + driver1.setIntegral(driver1.getIntegral() + num4); + accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); + accountChangeDetail.setExplain("推荐用户完成首单奖励"); + accountChangeDetailService.saveData(accountChangeDetail); + driverService.updateById(driver1); } - Driver driver1 = driverService.selectById(appUser.getInviterId()); - AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); - accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); - accountChangeDetail.setUserType(2); - accountChangeDetail.setUserId(driver1.getId()); - accountChangeDetail.setType(2); - accountChangeDetail.setOldData(driver1.getIntegral().doubleValue()); - driver1.setIntegral(driver1.getIntegral() + num4); - accountChangeDetail.setNewData(driver1.getIntegral().doubleValue()); - accountChangeDetail.setExplain("推荐用户完成首单奖励"); - accountChangeDetailService.saveData(accountChangeDetail); - driverService.updateById(driver1); } } @@ -870,7 +893,7 @@ public void run() { String value = redisUtil.getValue("DRIVER" + uid); Order order = OrderServiceImpl.this.selectById(orderId); - if(order.getState() == 106){ + if(order.getState() == 106 || order.getState() == 301){ Timer timer = timerMap.get(order.getId().toString()); if(null != timer){ timer.cancel(); @@ -894,8 +917,11 @@ pushOrderInfoWarpper.setTravelTime(travelTime); } pushUtil.pushOrderInfo(uid, 2, pushOrderInfoWarpper); + if(null != order.getUserId()){ + pushUtil.pushOrderInfo(order.getUserId(), 1, pushOrderInfoWarpper); + } } - },0, 5000); + },0, 10000); timerMap.put(orderId.toString(), timer); } @@ -954,10 +980,12 @@ } Double d = Double.valueOf(distance.get("distance")) / 1000; order.setEstimatedMileage(d); + order.setEstimatedTime(Integer.valueOf(distance.get("duration")) / 60); String city = ""; District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); city = null != weatherCity ? weatherCity.getId().toString() : ""; } order = getOrderPrice(1, d, 0, order, city); @@ -1022,6 +1050,11 @@ cancelOrder.setStatus(1); cancelOrder.setCreateTime(new Date()); cancelOrderService.insert(cancelOrder); + Driver driver = driverService.selectById(order.getDriverId()); + if(null != driver){ + driver.setServerStatus(1); + driverService.updateById(driver); + } return ResultUtil.success(); } @@ -1039,8 +1072,23 @@ Order order = this.selectById(orderId); OrderPriceWarpper orderPriceWarpper = new OrderPriceWarpper(); BeanUtils.copyProperties(order, orderPriceWarpper); + orderPriceWarpper.setWaitTime(orderPriceWarpper.getWaitTime() + orderPriceWarpper.getOutWaitTime()); + orderPriceWarpper.setWaitTimePrice(orderPriceWarpper.getWaitTimePrice() + orderPriceWarpper.getOutWaitTimePrice()); + orderPriceWarpper.setLongDistance(0D); + if(ToolUtil.isNotEmpty(order.getLongDistance())){ + String[] split = order.getLongDistance().split("-"); + Double longDistanc = Double.valueOf(split[1]) - Double.valueOf(split[0]) + orderPriceWarpper.getOverLongDistance(); + orderPriceWarpper.setLongDistance(longDistanc); + } + orderPriceWarpper.setLongDistancePrice(orderPriceWarpper.getLongDistancePrice() + orderPriceWarpper.getOverLongDistancePrice()); + orderPriceWarpper.setBadWeatherDistance(orderPriceWarpper.getBadWeatherDistance() + orderPriceWarpper.getOverBadWeatherDistance()); + orderPriceWarpper.setBadWeatherPrice(orderPriceWarpper.getBadWeatherPrice() + orderPriceWarpper.getOverBadWeatherPrice()); + orderPriceWarpper.setActualMileage(new BigDecimal(order.getActualMileage() / 1000).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); - orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); + orderPriceWarpper.setTravelTime(0); + if(null != order.getGetoffTime()){ + orderPriceWarpper.setTravelTime(Double.valueOf((order.getGetoffTime().getTime() - order.getStartTime().getTime()) / 60000).intValue()); + } orderPriceWarpper.setWxCollectionCode(driver.getWxCollectionCode()); orderPriceWarpper.setZfbCollectionCode(driver.getZfbCollectionCode()); return orderPriceWarpper; @@ -1058,7 +1106,7 @@ @Override public ResultUtil setOrderStatus(Integer uid, Long orderId, Integer state) throws Exception { List<Integer> s = Arrays.asList(107, 108); - if(s.contains(state)){ + if(!s.contains(state)){ return ResultUtil.error("操作失败"); } Order order = this.selectById(orderId); @@ -1074,9 +1122,12 @@ saveRevenue(order); } - pushUtil.pushOrderStatus(order.getDriverId(), 2, orderId, order.getState()); + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); if(null != order.getUserId()){ - pushUtil.pushOrderStatus(order.getUserId(), 1, orderId, order.getState()); + pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); } return ResultUtil.success(); } @@ -1086,8 +1137,256 @@ * 计算抽成和分佣 * @param order */ - public void saveRevenue(Order order){ + public void saveRevenue(Order order) throws Exception{ + //司机收入和代理商抽成(先分佣,后抽成) + //司机分佣和司机推荐用户首单奖励都在平台的抽佣中扣除,剩余的为平台抽佣。 + Driver driver = driverService.selectById(order.getDriverId()); + AppUser appUser = appUserService.selectById(order.getUserId()); + Double payMoney = order.getPayMoney(); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 3)); + Double n = 0D; + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + Double num2 = jsonObject.getDouble("num2"); + Double num3 = jsonObject.getDouble("num3"); + n = num3; + if(order.getPayMoney() >= num2){ + payMoney = payMoney - num3;//司机收入 + SystemConfig systemConfig1 = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 2)); + if(null != systemConfig1){ + JSONObject jsonObject1 = JSON.parseObject(systemConfig1.getContent()); + //司机推荐首单收入 + List<Integer> state = Arrays.asList(108, 109); + int count = this.selectCount(new EntityWrapper<Order>().eq("userId", appUser.getId()).eq("status", 1).in("state", state)); + if(null != appUser.getInviterType() && appUser.getInviterType() == 2 && count == 1){ + Double num1 = jsonObject1.getDouble("num1"); + num1 = (num3 >= num1 ? num1 : num3); + if(num1 > 0){ + Driver driver1 = driverService.selectById(appUser.getInviterId()); + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num1); + accountChangeDetail.setNewData(driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num1); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + } + num3 = (num3 >= num1 ? num3 - num1 : 0); + } + + //开始处理层级抽佣 + if(null != driver.getInviterType() && driver.getInviterType() == 2){ + Driver driver1 = driverService.selectById(driver.getInviterId());//一级司机 + if(null != driver1.getInviterType() && driver1.getInviterType() == 2){ + Driver driver2 = driverService.selectById(driver1.getInviterId());//二级司机 + if(null != driver2.getInviterType() && driver2.getInviterType() == 2){ + Driver driver3 = driverService.selectById(driver2.getInviterId());//三级级司机 + Double num5 = jsonObject1.getDouble("num5"); + Double num6 = jsonObject1.getDouble("num6"); + Double num7 = jsonObject1.getDouble("num7"); + num5 = (num3 >= num5 ? num5 : num3); + if(num5 > 0){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num5); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num5); + accountChangeDetail.setNewData(driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num5 ? num3 - num5 : 0); + } + num6 = (num3 >= num6 ? num6 : num3); + if(num6 > 0){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver2.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num6); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver2.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver2.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver2.setCommission(driver2.getCommission() + num6); + accountChangeDetail.setNewData(driver2.getCommission()); + driverService.updateById(driver2); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num6 ? num3 - num6 : 0); + } + num7 = (num3 >= num7 ? num7 : num3); + if(num7 > 0){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver3.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num7); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver3.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver3.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver3.setCommission(driver3.getCommission() + num7); + accountChangeDetail.setNewData(driver3.getCommission()); + driverService.updateById(driver3); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num7 ? num3 - num7 : 0); + } + }else{ + Double num3_ = jsonObject1.getDouble("num3"); + Double num4 = jsonObject1.getDouble("num4"); + num3_ = (num3 >= num3_ ? num3_ : num3); + if(num3_ > 0){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num3_); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num3_); + accountChangeDetail.setNewData(driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num3_ ? num3 - num3_ : 0); + } + num4 = (num3 >= num4 ? num4 : num3); + if(num4 > 0){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver2.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num4); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver2.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver2.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver2.setCommission(driver2.getCommission() + num4); + accountChangeDetail.setNewData(driver2.getCommission()); + driverService.updateById(driver2); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num4 ? num3 - num4 : 0); + } + } + }else{ + Double num2_ = jsonObject1.getDouble("num2"); + num2_ = (num3 >= num2_ ? num2_ : num3); + if(num2_ > 0){ + Revenue revenue = new Revenue(); + revenue.setType(2); + revenue.setUserType(2); + revenue.setUserId(driver1.getId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num2_); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver1.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(5); + accountChangeDetail.setOldData(driver1.getCommission()); + accountChangeDetail.setExplain("订单分佣收入"); + accountChangeDetail.setCreateTime(new Date()); + driver1.setCommission(driver1.getCommission() + num2_); + accountChangeDetail.setNewData(driver1.getCommission()); + driverService.updateById(driver1); + accountChangeDetailService.saveData(accountChangeDetail); + num3 = (num3 >= num2_ ? num3 - num2_ : 0); + } + } + } + //处理代理商抽佣 + if(num3 > 0){ + Revenue revenue = new Revenue(); + revenue.setType(1); + revenue.setUserType(3); + revenue.setUserId(driver.getAgentId()); + revenue.setOrderId(order.getId()); + revenue.setAmount(num3); + revenue.setCreateTime(new Date()); + revenueService.insert(revenue); + } + } + } + } + //司机余额扣减抽佣金额 + if(n > 0){ + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(2); + accountChangeDetail.setUserId(driver.getId()); + accountChangeDetail.setType(1); + accountChangeDetail.setChangeType(9); + accountChangeDetail.setOrderId(order.getId()); + accountChangeDetail.setOldData(driver.getBalance()); + accountChangeDetail.setExplain("线下收款服务费支出"); + accountChangeDetail.setCreateTime(new Date()); + driver.setBalance(driver.getBalance() - n); + accountChangeDetail.setNewData(driver.getBalance()); + driverService.updateById(driver); + accountChangeDetailService.saveData(accountChangeDetail); + } } /** 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 e753c0b..0ba8c4f 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 @@ -65,6 +65,17 @@ return driverYouTuiListWarppers; } + /** + * 获取司机兑换优推记录 + * @param driverId + * @return + * @throws Exception + */ + @Override + public List<DriverYouTuiWarpper> queryDriverYouTuiList1(Integer driverId) throws Exception { + return this.baseMapper.queryYouTuiDriverList(driverId, null); + } + /** * 获取司机优推数据 diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/PayMoneyUtil.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/PayMoneyUtil.java index 2be34c3..cc801eb 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/PayMoneyUtil.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/PayMoneyUtil.java @@ -77,9 +77,10 @@ @Value("${callbackPath}") private String callbackPath;//支付回调网关地址 - private String wechatPayCertificatesFromPath = "E:\\项目文档\\超省新代驾\\1636941942_20230320_cert\\apiclient_cert.p12";//微信支付证书地址 + private String wechatPayCertificatesFromPath = "/usr/local/server/app/cert/weixin/apiclient_cert.p12";//微信支付证书地址 - private String privateKeyFromPath = "E:\\项目文档\\超省新代驾\\1636941942_20230320_cert\\apiclient_cert.pem";//微信私钥证书地址 + private String privateKeyFromPath = "/usr/local/server/app/cert/weixin/apiclient_cert.pem";//微信私钥证书地址 + 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 032a781..9bf745f 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,7 @@ package com.supersavedriving.driver.modular.system.util; +import com.supersavedriving.driver.modular.system.service.IAccountChangeDetailService; import com.supersavedriving.driver.modular.system.service.IDriverService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -15,6 +16,9 @@ @Autowired private IDriverService driverService; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; @@ -32,16 +36,17 @@ } -// /** -// * 每天的凌晨执行的任务 -// */ -// @Scheduled(cron = "0 0 0 * * *") -// public void taskDay(){ -// try { -// }catch (Exception e){ -// e.printStackTrace(); -// } -// } + /** + * 每天的凌晨执行的任务 + */ + @Scheduled(cron = "0 0 0 * * *") + public void taskDay(){ + try { + accountChangeDetailService.deductionInsurance(); + }catch (Exception e){ + e.printStackTrace(); + } + } diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/RongYunUtil.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/RongYunUtil.java new file mode 100644 index 0000000..b2cbeb2 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/RongYunUtil.java @@ -0,0 +1,307 @@ +package com.supersavedriving.driver.modular.system.util.rongyun; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.supersavedriving.driver.core.util.ToolUtil; +import com.supersavedriving.driver.modular.system.util.rongyun.model.CloudRecordingCallback; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletRequest; +import java.io.*; +import java.net.*; +import java.security.MessageDigest; +import java.util.Map; + +/** + * 融云及时通讯工具类 + */ +@Component +public class RongYunUtil { + + @Value("${rongyun.app_key}") + private String app_key; + + @Value("${rongyun.app_secret}") + private String app_secret; + + + /** + * 注册获取token + * @param userId + * @param name + * @param headUrl + * @return + * @throws Exception + */ + public String getToken(String userId, String name, String headUrl) throws Exception { + String url = "http://api-cn.ronghub.com/user/getToken.json"; + String data = "userId=" + userId + "&name=" + name + "&portraitUri=" + headUrl; + String s = this.pushHttp(url, data); + return s; + } + + + /** + * 刷新用户信息 + * @param userId + * @param name + * @param headUrl + * @throws Exception + */ + public void refresh(String userId, String name, String headUrl) throws Exception { + String url = "http://api-cn.ronghub.com/user/refresh.json"; + String data = "userId=" + userId + "&name=" + name + "&portraitUri=" + headUrl; + String s = this.pushHttp(url, data); + } + + + /** + * 检查用户在线状态 + * @param userId + * @return 1:在线,0:离线 + * @throws Exception + */ + public Integer checkOnline(String userId) throws Exception { + String url = "http://api-cn.ronghub.com/user/checkOnline.json"; + String data = "userId=" + userId; + String s = this.pushHttp(url, data); + JSONObject jsonObject = JSON.parseObject(s); + if(jsonObject.getIntValue("code") == 200){ + return jsonObject.getIntValue("status"); + } + return null; + } + + + /** + * 发送普通消息 + * @param fromUserId + * @param toUserId + * @param objectName + * @param content + * @return + */ + public String sendSms(String fromUserId, String toUserId, String objectName, String content){ + try { + String url = "https://api-cn.ronghub.com/message/private/publish.json"; + String data = "fromUserId=" + URLEncoder.encode(fromUserId, "UTF-8") + "&toUserId=" + URLEncoder.encode(toUserId, "UTF-8") + "&objectName=" + + URLEncoder.encode(objectName, "UTF-8") + "&content=" + URLEncoder.encode(content, "UTF-8") + "&disablePush=0&isIncludeSender=1"; + String s = this.pushHttp(url, data); + return s; + }catch (Exception e){ + e.printStackTrace(); + } + return null; + } + + + + /** + * 创建 IM 聊天室 + * @param id 房间id长度不超过 64 字节 + * @param name 聊天室名称 + * @return + */ + public Integer ChatRoomCreate(String id, String name){ + String url = "https://api-cn.ronghub.com/chatroom/create.json"; + String data = "chatroom[" + id + "]=" + name; + String s = this.pushHttp(url, data); + JSONObject jsonObject = JSON.parseObject(s); + if(jsonObject.getIntValue("code") == 200){ + return jsonObject.getIntValue("status"); + } + return null; + } + + + /** + * 销毁聊天室 + * @param chatroomId 聊天室id + * @return + */ + public Integer ChatRoomDestroy(String chatroomId){ + String url = "https://api-cn.ronghub.com/chatroom/destroy.json"; + String data = "chatroomId=" + chatroomId; + String s = this.pushHttp(url, data); + JSONObject jsonObject = JSON.parseObject(s); + if(jsonObject.getIntValue("code") == 200){ + return jsonObject.getIntValue("status"); + } + return null; + } + + + /** + * 更新聊天室属性 + * @param chatroomId 聊天室房间id + * @param userId 更新用户id + * @param k 更新属性名 + * @param v 更新值 + * @param autoDelete 用户退出聊天室后,是否删除此 Key 值。为 1 时删除此 Key 值,为 0 时用户退出后不删除此 Key,默认为 0 + * @param type 聊天室中对属性操作后发送通知的类型,1 为设置属性内容、2 为删除属性内容。 + * @param objectName 发送消息类型 + * @param extra 发送消息附加信息 + * @return + */ + public Integer entryChatRoom(String chatroomId, String userId, String k, String v, Integer autoDelete, Integer type, String objectName, String extra){ + String url = "https://api-cn.ronghub.com/chatroom/destroy.json"; + String data = "chatroomId=" + chatroomId + "&userId=" + userId + "&key=" + k + "&value=" + v; + if(ToolUtil.isNotEmpty(objectName)){//需要发送通知消息 + JSONObject jsonObject = new JSONObject(); + jsonObject.put("type", type);//聊天室中对属性操作后发送通知的类型,1 为设置属性内容、2 为删除属性内容。 + jsonObject.put("key", k);//聊天室中属性名称,大小不超过 128 个字符。 + jsonObject.put("value", v);//属性对应的内容,大小不超过 4096 个字符。 + jsonObject.put("extra", extra);//通过消息中携带的附加信息,对应到设置属性接口中的 notificationExtra 值。 + data += "&objectName=" + objectName + "&content=" + jsonObject.toJSONString(); + } + if(null != autoDelete){ + data += "&autoDelete=" + autoDelete; + } + String s = this.pushHttp(url, data); + JSONObject jsonObject = JSON.parseObject(s); + if(jsonObject.getIntValue("code") == 200){ + return jsonObject.getIntValue("status"); + } + return null; + } + + + /** + * 聊天室发送文本消息 + * @param userId 发送用户id + * @param chatroomId 聊天室id + * @param content 消息文本内容 + * @return + */ + public Integer ChatRoomPushTxtMessage(String userId, String chatroomId, String content){ + String url = "https://api-cn.ronghub.com/chatroom/destroy.json"; + String data = "fromUserId=" + userId + "&toChatroomId=" + chatroomId + "&objectName=RC:TxtMsg&content=" + content; + String s = this.pushHttp(url, data); + JSONObject jsonObject = JSON.parseObject(s); + if(jsonObject.getIntValue("code") == 200){ + return jsonObject.getIntValue("status"); + } + return null; + } + + + + /** + * 请求接口 + * @param path + * @param json + * @return + */ + public String pushHttp(String path, String json){ + String nonce = String.valueOf(Double.valueOf(Math.random() * 1000000.0D).intValue()); + String timeMillis = String.valueOf(System.currentTimeMillis() / 1000); + String signature = getSha1(app_secret + nonce + timeMillis); + + URL url = null; + try { + url = new URL(path); + HttpURLConnection connection = (HttpURLConnection)url.openConnection(); + connection.setRequestMethod("POST"); + connection.setConnectTimeout(1000 * 30); + connection.setRequestProperty("Host", "api-cn.ronghub.com"); + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); + connection.setRequestProperty("App-Key", app_key); + connection.setRequestProperty("Nonce", nonce); + connection.setRequestProperty("Timestamp", timeMillis); + connection.setRequestProperty("Signature", signature); + connection.setDoOutput(true); + connection.setDoInput(true); + connection.setUseCaches(false); + connection.setInstanceFollowRedirects(true); + connection.connect(); + DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream()); + outputStream.write(json.getBytes("UTF-8")); + outputStream.flush(); + outputStream.close(); + + int responseCode = connection.getResponseCode(); + InputStream inputStream = null; + if(responseCode == 403){ + inputStream = connection.getErrorStream(); + } + if(responseCode == 200){ + inputStream = connection.getInputStream(); + } + DataInputStream dataInputStream = new DataInputStream(inputStream); + ByteArrayOutputStream stream = new ByteArrayOutputStream(); + int len; + byte[] bytes = new byte[1024]; + while ((len = dataInputStream.read(bytes)) != -1){ + stream.write(bytes, 0, len); + } + return stream.toString(); + } catch (MalformedURLException e) { + e.printStackTrace(); + } catch (ProtocolException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + + + public static String getSha1(String str) { + char hexDigits[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', + 'a', 'b', 'c', 'd', 'e', 'f' }; + try { + MessageDigest mdTemp = MessageDigest.getInstance("SHA1"); + mdTemp.update(str.getBytes("UTF-8")); + byte[] md = mdTemp.digest(); + int j = md.length; + char buf[] = new char[j * 2]; + int k = 0; + for (int i = 0; i < j; i++) { + byte byte0 = md[i]; + buf[k++] = hexDigits[byte0 >>> 4 & 0xf]; + buf[k++] = hexDigits[byte0 & 0xf]; + } + return new String(buf); + } catch (Exception e) { + return null; + } + } + + + /** + * 云端录制状态回调 + * @param request + * @return + */ + public static CloudRecordingCallback cloudRecordingCallback(HttpServletRequest request){ + String param = null; + try { + param = getParam(request); + } catch (IOException e) { + e.printStackTrace(); + } + if(ToolUtil.isNotEmpty(param)){ + CloudRecordingCallback cloudRecordingCallback = JSON.parseObject(param, CloudRecordingCallback.class); + return cloudRecordingCallback; + } + return null; + } + + + private static String getParam(HttpServletRequest request) throws IOException { + // 读取参数 + InputStream inputStream; + StringBuilder sb = new StringBuilder(); + inputStream = request.getInputStream(); + String s; + BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8")); + while ((s = in.readLine()) != null) { + sb.append(s); + } + in.close(); + inputStream.close(); + return sb.toString(); + } +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/CloudRecordingCallback.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/CloudRecordingCallback.java new file mode 100644 index 0000000..0bdf296 --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/CloudRecordingCallback.java @@ -0,0 +1,75 @@ +package com.supersavedriving.driver.modular.system.util.rongyun.model; + +import com.alibaba.fastjson.JSONObject; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/4/6 10:29 + */ +@Data +public class CloudRecordingCallback { + /** + * 时间戳,单位为毫秒。 + */ + private Long timestamp; + /** + *回调事件类型,如下: + * 1: 录制开始; + * 2: 录制切片; + * 3: 录制结束; + * 4: 文件上传 + */ + private Integer type; + /** + * 当前使用的 App Key + */ + private String appKey; + /** + * 录制 ID,每次录制任务的唯一标识。如果文件切片,可以通过此 ID 进行关联。 + */ + private String recordId; + /** + * 房间 ID + */ + private String roomId; + /** + * 会话 ID,每次通话的唯一标识。您可以通过融云服务端回调获取该 sessionId + */ + private String sessionId; + /** + * 用户 ID。如果录制模式为 Mix,此字段为空 + */ + private String userId; + /** + * 录制模式,如下: + * 0:音视频 single 模式; + * 1:纯视频 single 模式; + * 2:纯音频 single 模式; + * 3:音视频 mix 模式; + * 4:纯视频 mix 模式; + * 5:纯音频 mix 模式; + * 6:单人 mix 音视频模式。 + */ + private Integer mode; + /** + * 扩展字段,内容为手动录制时传入的 extra 字段的值 + */ + private String extra; + /** + * 状态码,200 为正常 + */ + private Integer code; + /** + * 错误信息。 + */ + private String errorMessage; + /** + * + */ + private Config config; + /** + * + */ + private Output output; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Config.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Config.java new file mode 100644 index 0000000..0f4553e --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Config.java @@ -0,0 +1,31 @@ +package com.supersavedriving.driver.modular.system.util.rongyun.model; + +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/4/6 10:48 + */ +@Data +public class Config { + /** + * 录制启动模式: 1 自动启动录制任务 + */ + private Integer trigger; + /** + * Mix模式下布局:2 悬浮布局(默认) 3 自适应布局 + */ + private Integer mixLayout; + /** + * 文件切片时间(分钟) + */ + private Integer slicesMin; + /** + * 设置的音频文件格式 + */ + private String audioFormat; + /** + * 设置的视频文件格式 + */ + private String videoFormat; +} diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Output.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Output.java new file mode 100644 index 0000000..e098fce --- /dev/null +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/util/rongyun/model/Output.java @@ -0,0 +1,31 @@ +package com.supersavedriving.driver.modular.system.util.rongyun.model; + +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/4/6 10:50 + */ +@Data +public class Output { + /** + * 缓存的文件名。具体请参考「配置云端录制服务」中的切片文件命名规则。 + */ + private String fileName; + /** + * 音频采样率,如 48000。如果当前录制任务没有录制音频,该字段为空。 + */ + private Integer audioSample; + /** + * 视频分辨率,如 640x480。如果当前录制任务没有录制视频,该字段为空。 + */ + private String videoResoulation; + /** + * 切片生成的录制文件大小。 + */ + private Integer fileSize; + /** + * 已上传到的第三方存储的 URL。 + */ + private String fileUrl; +} 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 18e5e42..34c37a4 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 @@ -19,8 +19,8 @@ private String name; @ApiModelProperty("电话") private String phone; - @ApiModelProperty("优推开始时间") - private Long youTuiStart; + @ApiModelProperty("优推结束时间") + private Long youTuiEnd; @ApiModelProperty("账户余额") private Double balance; @ApiModelProperty("佣金余额") @@ -31,7 +31,7 @@ private Integer todayNum; @ApiModelProperty("本月接单") private Integer monthNum; - @ApiModelProperty("上班状态(0:没上班,1=一上班)") + @ApiModelProperty("上班状态(0:没上班,1=已上班)") private Integer work; @ApiModelProperty("在线时长") private Integer online; 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 389091e..216bb49 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 @@ -45,6 +45,8 @@ private Double estimatedPrice; @ApiModelProperty("预估里程") private Double estimatedMileage; + @ApiModelProperty("预估时间") + private Double estimatedTime; @ApiModelProperty("起步价") private Double startPrice; @ApiModelProperty("等待时长") diff --git a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderPriceWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderPriceWarpper.java index b0638b5..fd05f84 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderPriceWarpper.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderPriceWarpper.java @@ -52,6 +52,8 @@ private Double overBadWeatherPrice; @ApiModelProperty("折扣金额") private Double discountAmount; + @ApiModelProperty("优惠金额") + private Double discountedPrice; @ApiModelProperty("微信收款码") private String wxCollectionCode; @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 deleted file mode 100644 index 55f1222..0000000 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/OrderStatusWarpper.java +++ /dev/null @@ -1,16 +0,0 @@ -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/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/TokenWarpper.java b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/TokenWarpper.java index 18e1c5c..0c901cd 100644 --- a/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/TokenWarpper.java +++ b/driver/guns-admin/src/main/java/com/supersavedriving/driver/modular/system/warpper/TokenWarpper.java @@ -16,4 +16,6 @@ private Long validTime; @ApiModelProperty(value = "是否设置密码(0=否,1=是)", required = true, dataType = "int") private Integer isSetPassword; + @ApiModelProperty("融云token") + private String rytoken; } diff --git a/driver/guns-admin/src/main/resources/application.yml b/driver/guns-admin/src/main/resources/application.yml index e5042e1..db49129 100644 --- a/driver/guns-admin/src/main/resources/application.yml +++ b/driver/guns-admin/src/main/resources/application.yml @@ -13,8 +13,8 @@ application: name: driver-server profiles: - active: dev -# active: produce +# active: dev + active: produce mvc: static-path-pattern: /static/** view: @@ -51,19 +51,12 @@ base-package: com.supersavedriving.driver.modular -#spring: -# datasource: -# url: jdbc:mysql://Rm-wz9rpe0t74ys3b1h8go.mysql.rds.aliyuncs.com:3306/oktravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai -# username: root -# password: Root2020! -# db-name: guns #用来搜集数据库的所有表 -# filters: wall,mergeStat - spring: datasource: url: jdbc:mysql://127.0.0.1:3306/super_save_driving?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai username: root - password: 123456 + password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj +# password: 123456 db-name: guns #用来搜集数据库的所有表 filters: wall,mergeStat @@ -84,8 +77,8 @@ wx: grantType: authorization_code #填authorization_code - appid: wx36c966d381cd5d62 #应用唯一标识,在微信开放平台提交应用审核通过后获得 - appSecret: cf4b21c7175356f41fa3c426f26c20e4 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 + appid: wx8a9af3889395d0e1 #应用唯一标识,在微信开放平台提交应用审核通过后获得 + appSecret: 95a34f114973298cce4297a20bb59bc3 #应用密钥AppSecret,在微信开放平台提交应用审核通过后获得 appletsAppid: 1 #小程序APPid appletsAppSecret: 1 # mchId: 1636941942 #微信支付分配的商户号 @@ -108,14 +101,14 @@ --- -filePath: /usr/local/server/orderPostionFile/ #存储订单轨迹文件路径 +filePath: /usr/local/server/app/orderPostionFile/ #存储订单轨迹文件路径 #filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 #支付回调地址 #正式环境 -callbackPath: https://okyueche.com:443/user +#callbackPath: https://okyueche.com:443/user #测试环境 -#callbackPath: http://47.108.254.217:80/user +callbackPath: http://121.37.15.157:80/driver --- @@ -123,4 +116,11 @@ spring: data: mongodb: - uri: mongodb://127.0.0.1:27017/admin + uri: mongodb://root:CEtyLdKjPk0yeHNo@127.0.0.1:27017/admin +# uri: mongodb://127.0.0.1:27017/admin + +--- + +rongyun: + app_key: k51hidwqkx92b + app_secret: t0jxbPrHHar \ No newline at end of file diff --git a/driver/guns-admin/src/main/resources/logback-spring.xml b/driver/guns-admin/src/main/resources/logback-spring.xml index 645168a..c5caefd 100644 --- a/driver/guns-admin/src/main/resources/logback-spring.xml +++ b/driver/guns-admin/src/main/resources/logback-spring.xml @@ -7,8 +7,8 @@ <contextName>logback</contextName> <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> - <!--<property name="log.path" value="/usr/local/server/logs"/>--> - <property name="log.path" value="d:/logs/driver"/> + <property name="log.path" value="/usr/local/server/app/logs"/> + <!--<property name="log.path" value="d:/logs/driver"/>--> <!--0. 日志格式和颜色渲染 --> <!-- 彩色日志依赖的渲染类 --> diff --git a/driver/guns-admin/src/main/resources/redis.properties b/driver/guns-admin/src/main/resources/redis.properties index bc6b0e9..726be87 100644 --- a/driver/guns-admin/src/main/resources/redis.properties +++ b/driver/guns-admin/src/main/resources/redis.properties @@ -1,13 +1,21 @@ #redis���ÿ�ʼ # Redis���ݿ�������Ĭ��Ϊ0�� spring.redis.database=0 + # Redis��������ַ spring.redis.host=127.0.0.1 # Redis���������Ӷ˿� -spring.redis.port=6379 +spring.redis.port=16379 # Redis�������������루Ĭ��Ϊ�գ� -spring.redis.password=123456 -#spring.redis.password= +spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ + +## Redis��������ַ +#spring.redis.host=127.0.0.1 +## Redis���������Ӷ˿� +#spring.redis.port=6379 +## Redis�������������루Ĭ��Ϊ�գ� +#spring.redis.password=123456 + # ���ӳ������������ʹ�ø�ֵ��ʾû�����ƣ� spring.redis.jedis.pool.max-active=1024 # ���ӳ���������ȴ�ʱ�䣨ʹ�ø�ֵ��ʾû�����ƣ� diff --git a/eureka/pom.xml b/eureka/pom.xml index 0744038..6e58611 100644 --- a/eureka/pom.xml +++ b/eureka/pom.xml @@ -14,7 +14,7 @@ <name>eureka</name> <description>Eureka project for Spring Boot</description> - <packaging>war</packaging> + <packaging>jar</packaging> <properties> <java.version>1.8</java.version> @@ -33,17 +33,17 @@ </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-tomcat</artifactId> - <scope>provided</scope> - </dependency> - <dependency> - <groupId>javax.servlet</groupId> - <artifactId>javax.servlet-api</artifactId> - <version>3.1.0</version> - <scope>provided</scope> - </dependency> + <!--<dependency>--> + <!--<groupId>org.springframework.boot</groupId>--> + <!--<artifactId>spring-boot-starter-tomcat</artifactId>--> + <!--<scope>provided</scope>--> + <!--</dependency>--> + <!--<dependency>--> + <!--<groupId>javax.servlet</groupId>--> + <!--<artifactId>javax.servlet-api</artifactId>--> + <!--<version>3.1.0</version>--> + <!--<scope>provided</scope>--> + <!--</dependency>--> <dependency> <groupId>org.springframework.boot</groupId> diff --git a/eureka/src/main/java/com/sinata/eureka/EurekaApplication.java b/eureka/src/main/java/com/sinata/eureka/EurekaApplication.java index 1e9c18d..82ff9a0 100644 --- a/eureka/src/main/java/com/sinata/eureka/EurekaApplication.java +++ b/eureka/src/main/java/com/sinata/eureka/EurekaApplication.java @@ -8,15 +8,15 @@ @EnableEurekaServer//开启服务治理 @SpringBootApplication -public class EurekaApplication extends SpringBootServletInitializer { +public class EurekaApplication /*extends SpringBootServletInitializer*/ { public static void main(String[] args) { SpringApplication.run(EurekaApplication.class, args); } - @Override - protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { - return builder.sources(EurekaApplication.class); - } +// @Override +// protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { +// return builder.sources(EurekaApplication.class); +// } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java index 4215feb..facf287 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/AppUserController.java @@ -1,13 +1,19 @@ package com.supersavedriving.user.modular.api; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.supersavedriving.user.core.common.annotion.ServiceLog; import com.supersavedriving.user.core.util.ToolUtil; import com.supersavedriving.user.modular.system.model.AppUser; -import com.supersavedriving.user.modular.system.service.IAppUserService; -import com.supersavedriving.user.modular.system.service.IDriverService; +import com.supersavedriving.user.modular.system.model.SystemConfig; +import com.supersavedriving.user.modular.system.service.*; +import com.supersavedriving.user.modular.system.util.PayMoneyUtil; +import com.supersavedriving.user.modular.system.util.RedisUtil; import com.supersavedriving.user.modular.system.util.ResultUtil; import com.supersavedriving.user.modular.system.util.UUIDUtil; import com.supersavedriving.user.modular.system.util.huawei.OBSUtil; +import com.supersavedriving.user.modular.system.util.huawei.SMSUtil; import com.supersavedriving.user.modular.system.warpper.*; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -21,8 +27,11 @@ 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; /** * 用户控制器 @@ -36,6 +45,24 @@ @Autowired private IDriverService driverService; + + @Autowired + private ISystemConfigService systemConfigService; + + @Autowired + private PayMoneyUtil payMoneyUtil; + + @Autowired + private IUserToCouponService userToCouponService; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; + + @Autowired + private IComplaintService complaintService; + + @Autowired + private RedisUtil redisUtil; @@ -155,6 +182,11 @@ AppUser appUser = appUserService.selectById(uid); UserInfoWarpper userInfoWarpper = new UserInfoWarpper(); BeanUtils.copyProperties(appUser, userInfoWarpper); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + userInfoWarpper.setServiceCell(jsonObject.getString("num1")); + } return ResponseWarpper.success(userInfoWarpper); }catch (Exception e){ e.printStackTrace(); @@ -174,7 +206,7 @@ public ResponseWarpper<String> uploadImg(MultipartFile file){ try { InputStream inputStream = file.getInputStream(); - String name = file.getName(); + String name = file.getOriginalFilename(); name = UUIDUtil.getRandomCode() + name.substring(name.lastIndexOf(".")); String s = OBSUtil.putObjectToBucket(inputStream, name); return ResponseWarpper.success(s); @@ -183,4 +215,321 @@ return new ResponseWarpper(500, e.getMessage()); } } + + + + @ResponseBody + @PostMapping("/api/appUser/updateUserInfo") +// @ServiceLog(name = "修改个人信息", url = "/api/appUser/updateUserInfo") + @ApiOperation(value = "修改个人信息", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper updateUserInfo(UserInfo userInfo){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = appUserService.updateUserInfo(uid, userInfo); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + + @ResponseBody + @PostMapping("/api/appUser/queryPriceRules") +// @ServiceLog(name = "获取价格表", url = "/api/appUser/queryPriceRules") + @ApiOperation(value = "获取价格表", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<PriceRulesWarpper> queryPriceRules(){ + try { + PriceRulesWarpper priceRulesWarpper = systemConfigService.queryPriceRules(); + return ResponseWarpper.success(priceRulesWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryTopUpPrompt") +// @ServiceLog(name = "获取充值优惠提示", url = "/api/appUser/queryTopUpPrompt") + @ApiOperation(value = "获取充值优惠提示", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<String> queryTopUpPrompt(){ + try { + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 6)); + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + return ResponseWarpper.success("充值满" + jsonObject.getDouble("num2") + "元,下单享9折优惠!"); + } + return ResponseWarpper.success(); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/rechargeBalance") +// @ServiceLog(name = "充值操作", url = "/api/appUser/rechargeBalance") + @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 rechargeBalance(Double amount){ + if(null == amount){ + return ResponseWarpper.success(ResultUtil.paranErr("amount")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil resultUtil = appUserService.rechargeBalance(uid, amount); + return ResponseWarpper.success(resultUtil); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/appUser/rechargeBalanceCallback") +// @ServiceLog(name = "余额充值回调", url = "/base/appUser/rechargeBalanceCallback") + public void rechargeBalanceCallback(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); + appUserService.rechargeBalanceCallback(out_trade_no, transaction_id); + PrintWriter out = response.getWriter(); + out.print(result); + out.flush(); + out.close(); + } + }catch (Exception e){ + e.printStackTrace(); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryMyCoupons") +// @ServiceLog(name = "获取优惠券列表", url = "/api/appUser/queryMyCoupons") + @ApiOperation(value = "获取优惠券列表", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "状态(1=未使用,2=已使用,3=已过期)", 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<CouponsWarpper>> queryMyCoupons(Integer state, Integer pageNum, Integer pageSize){ + if(null == state){ + return ResponseWarpper.success(ResultUtil.paranErr("state")); + } + if(null == pageNum){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(null == pageSize){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<CouponsWarpper> couponsWarppers = userToCouponService.queryMyCoupons(uid, state, pageNum, pageSize); + return ResponseWarpper.success(couponsWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryUsedCouponNum") +// @ServiceLog(name = "获取已使用优惠券数量", url = "/api/appUser/queryUsedCouponNum") + @ApiOperation(value = "获取已使用优惠券数量", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<Integer> queryUsedCouponNum(){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + Integer integer = userToCouponService.queryUsedCouponNum(uid); + return ResponseWarpper.success(integer); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/queryBalanceDetails") +// @ServiceLog(name = "获取余额明细", url = "/api/appUser/queryBalanceDetails") + @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<BalanceDetailsWarpper>> queryBalanceDetails(String time, Integer pageNum, Integer pageSize){ + if(ToolUtil.isEmpty(time)){ + return ResponseWarpper.success(ResultUtil.paranErr("time")); + } + if(null == pageNum){ + return ResponseWarpper.success(ResultUtil.paranErr("pageNum")); + } + if(null == pageSize){ + return ResponseWarpper.success(ResultUtil.paranErr("pageSize")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<BalanceDetailsWarpper> balanceDetailsWarppers = accountChangeDetailService.queryBalanceDetails(uid, time, pageNum, pageSize); + return ResponseWarpper.success(balanceDetailsWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/cancelAccount") +// @ServiceLog(name = "注销账号", url = "/api/appUser/cancelAccount") + @ApiOperation(value = "注销账号", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper cancelAccount(){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + AppUser appUser = appUserService.selectById(uid); + appUser.setStatus(3); + appUserService.updateById(appUser); + return ResponseWarpper.success(); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/api/appUser/feedback") +// @ServiceLog(name = "投诉反馈", url = "/api/appUser/feedback") + @ApiOperation(value = "投诉反馈", tags = {"用户端-首页", "用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = false, dataType = "int"), + @ApiImplicitParam(value = "反馈内容", name = "content", required = true, dataType = "string"), + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper feedback(Integer orderId, String content){ + if(null == content){ + return ResponseWarpper.success(ResultUtil.paranErr("content")); + } + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + complaintService.feedback(uid, orderId, content); + return ResponseWarpper.success(); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/appUser/getVerificationCode") +// @ServiceLog(name = "获取短信验证码", url = "/base/appUser/getVerificationCode") + @ApiOperation(value = "获取短信验证码", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "国家代码+86", name = "receiver", required = true, dataType = "string"), + @ApiImplicitParam(value = "电话号码", name = "phone", required = true, dataType = "string"), + }) + public ResponseWarpper getVerificationCode(String receiver, String phone){ + if(ToolUtil.isEmpty(receiver)){ + return ResponseWarpper.success(ResultUtil.paranErr("receiver")); + } + if(ToolUtil.isEmpty(phone)){ + return ResponseWarpper.success(ResultUtil.paranErr("phone")); + } + try { + String numberRandom = UUIDUtil.getNumberRandom(5); + SMSUtil.send(phone, "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + numberRandom + "\"]"); + redisUtil.setStrValue(receiver + phone, numberRandom, 300);//5分钟有效期 + return ResponseWarpper.success(ResultUtil.success()); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + @ResponseBody + @PostMapping("/base/appUser/verifySMSCode") +// @ServiceLog(name = "验证短信验证码", url = "/base/appUser/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 { + 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()); + } + } + } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/OrderController.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/OrderController.java index dd2ffa0..53d9271 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/OrderController.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/api/OrderController.java @@ -6,6 +6,7 @@ import com.supersavedriving.user.modular.system.model.AppUser; import com.supersavedriving.user.modular.system.model.Order; import com.supersavedriving.user.modular.system.service.IAppUserService; +import com.supersavedriving.user.modular.system.service.IBillService; import com.supersavedriving.user.modular.system.service.IOrderService; import com.supersavedriving.user.modular.system.util.PayMoneyUtil; import com.supersavedriving.user.modular.system.util.ResultUtil; @@ -44,6 +45,9 @@ @Autowired private PayMoneyUtil payMoneyUtil; + + @Autowired + private IBillService billService; @@ -171,6 +175,28 @@ return ResponseWarpper.success(ResultUtil.tokenErr()); } OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(uid, orderId); + return ResponseWarpper.success(orderInfoWarpper); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/base/order/queryShareOrderInfo") +// @ServiceLog(name = "获取订单详情", url = "/base/order/queryShareOrderInfo") + @ApiOperation(value = "获取订单详情", tags = {"用户端-分享"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(value = "订单id", name = "orderId", required = true, dataType = "long"), + }) + public ResponseWarpper<OrderInfoWarpper> queryOrderInfo1(Long orderId){ + if(null == orderId){ + return ResponseWarpper.success(ResultUtil.paranErr("orderId")); + } + try { + OrderInfoWarpper orderInfoWarpper = orderService.queryOrderInfo(null, orderId); return ResponseWarpper.success(orderInfoWarpper); }catch (Exception e){ e.printStackTrace(); @@ -365,5 +391,108 @@ } } + @ResponseBody + @PostMapping("/api/order/queryMyOrder") +// @ServiceLog(name = "获取我的行程", url = "/api/order/queryMyOrder") + @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<OrderListWarpper>> queryMyOrder(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 = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<OrderListWarpper> orderListWarppers = orderService.queryMyOrder(uid, pageNum, pageSize); + return ResponseWarpper.success(orderListWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + @ResponseBody + @PostMapping("/api/order/queryNotInvoiceOrder") +// @ServiceLog(name = "获取未开票订单列表", url = "/api/order/queryNotInvoiceOrder") + @ApiOperation(value = "获取未开票订单列表", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper<List<OrderListWarpper>> queryNotInvoiceOrder(NotInvoiceOrder notInvoiceOrder){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<OrderListWarpper> orderListWarppers = orderService.queryNotInvoiceOrder(uid, notInvoiceOrder); + return ResponseWarpper.success(orderListWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/invoicing") +// @ServiceLog(name = "开票操作", url = "/api/order/invoicing") + @ApiOperation(value = "开票操作", tags = {"用户端-个人中心"}, notes = "") + @ApiImplicitParams({ + @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") + }) + public ResponseWarpper invoicing(Invoicing invoicing){ + try { + Integer uid = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + ResultUtil invoicing1 = billService.invoicing(uid, invoicing); + return ResponseWarpper.success(invoicing1); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } + + + + @ResponseBody + @PostMapping("/api/order/queryBillList") +// @ServiceLog(name = "获取开票历史", url = "/api/order/queryBillList") + @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<BillWarpper>> queryBillList(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 = appUserService.getUserByRequest(); + if(null == uid){ + return ResponseWarpper.success(ResultUtil.tokenErr()); + } + List<BillWarpper> billWarppers = billService.queryBillList(uid, pageNum, pageSize); + return ResponseWarpper.success(billWarppers); + }catch (Exception e){ + e.printStackTrace(); + return new ResponseWarpper(500, e.getMessage()); + } + } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/AccountChangeDetailMapper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/AccountChangeDetailMapper.java index 7d6656b..c046452 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/AccountChangeDetailMapper.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/AccountChangeDetailMapper.java @@ -2,10 +2,26 @@ import com.baomidou.mybatisplus.mapper.BaseMapper; import com.supersavedriving.user.modular.system.model.AccountChangeDetail; +import com.supersavedriving.user.modular.system.warpper.BalanceDetailsWarpper; +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 uid + * @param time + * @param pageNum + * @param pageSize + * @return + */ + List<BalanceDetailsWarpper> queryBalanceDetails(@Param("uid") Integer uid, @Param("time") String time, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/BillMapper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/BillMapper.java new file mode 100644 index 0000000..3f769a8 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/BillMapper.java @@ -0,0 +1,25 @@ +package com.supersavedriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.supersavedriving.user.modular.system.model.Bill; +import com.supersavedriving.user.modular.system.warpper.BillWarpper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:04 + */ +public interface BillMapper extends BaseMapper<Bill> { + + + /** + * 获取开票记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + */ + List<BillWarpper> queryBillList(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/ComplaintMapper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/ComplaintMapper.java new file mode 100644 index 0000000..2528f6f --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/ComplaintMapper.java @@ -0,0 +1,11 @@ +package com.supersavedriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.supersavedriving.user.modular.system.model.Complaint; + +/** + * @author zhibing.pu + * @date 2023/3/24 16:05 + */ +public interface ComplaintMapper extends BaseMapper<Complaint> { +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/OrderMapper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/OrderMapper.java index 5c06528..cede440 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/OrderMapper.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/OrderMapper.java @@ -2,8 +2,12 @@ import com.baomidou.mybatisplus.mapper.BaseMapper; import com.supersavedriving.user.modular.system.model.Order; +import com.supersavedriving.user.modular.system.warpper.NotInvoiceOrder; import com.supersavedriving.user.modular.system.warpper.OrderInfoWarpper; +import com.supersavedriving.user.modular.system.warpper.OrderListWarpper; import org.apache.ibatis.annotations.Param; + +import java.util.List; public interface OrderMapper extends BaseMapper<Order> { @@ -15,4 +19,23 @@ * @return */ OrderInfoWarpper queryOrderInfo(@Param("uid") Integer uid, @Param("orderId") Long orderId); + + + /** + * 获取乘客行程订单 + * @param uid + * @param pageNum + * @param pageSize + * @return + */ + List<OrderListWarpper> queryMyOrder(@Param("uid") Integer uid, @Param("pageNum") Integer pageNum, + @Param("pageSize") Integer pageSize); + + + /** + * 获取未开票订单 + * @param uid + * @return + */ + List<OrderListWarpper> queryNotInvoiceOrder(@Param("uid") Integer uid, @Param("notInvoiceOrder") NotInvoiceOrder notInvoiceOrder); } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/RechargeRecordMapper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/RechargeRecordMapper.java new file mode 100644 index 0000000..380c363 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/RechargeRecordMapper.java @@ -0,0 +1,11 @@ +package com.supersavedriving.user.modular.system.dao; + +import com.baomidou.mybatisplus.mapper.BaseMapper; +import com.supersavedriving.user.modular.system.model.RechargeRecord; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:55 + */ +public interface RechargeRecordMapper extends BaseMapper<RechargeRecord> { +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/UserToCouponMapper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/UserToCouponMapper.java index b78b3cf..d8f69ab 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/UserToCouponMapper.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/UserToCouponMapper.java @@ -4,6 +4,7 @@ import com.supersavedriving.user.modular.system.model.Coupon; import com.supersavedriving.user.modular.system.model.UserToCoupon; import com.supersavedriving.user.modular.system.warpper.CouponWarpper; +import com.supersavedriving.user.modular.system.warpper.CouponsWarpper; import org.apache.ibatis.annotations.Param; import java.util.List; @@ -32,4 +33,24 @@ * @return */ List<CouponWarpper> queryPayCouponList(@Param("uid") Integer uid, @Param("price") Double price); + + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + */ + List<CouponsWarpper> queryMyCoupons(@Param("uid") Integer uid, @Param("state") Integer state, + @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize); + + + /** + * 获取已使用优惠券数量 + * @param uid + * @return + */ + Integer queryUsedCouponNum(@Param("uid") Integer uid); } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml index 8e04146..c487e27 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/AccountChangeDetailMapper.xml @@ -5,13 +5,35 @@ <!-- 通用查询映射结果 --> <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.AccountChangeDetail"> <id column="id" property="id"/> + <result column="code" property="code"/> <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="orderId" property="orderId"/> <result column="explain" property="explain"/> <result column="createTime" property="createTime"/> </resultMap> + + + + <select id="queryBalanceDetails" resultType="com.supersavedriving.user.modular.system.warpper.BalanceDetailsWarpper"> + select + a.changeType as type, + a.`explain`, + b.startAddress, + b.endAddress, + UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, + (a.newData - a.oldData) as amount, + a.newData as balance + from t_account_change_detail a + left join t_order b on (a.orderId = b.id) + where a.userType = 1 and a.userId = #{uid} + <if test="null != time and '' != time"> + and DATE_FORMAT(a.createTime, '%Y年%m月') = #{time} + </if> + order by a.createTime desc limit #{pageNum}, #{pageSize} + </select> </mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/BillMapper.xml b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/BillMapper.xml new file mode 100644 index 0000000..b299f46 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/BillMapper.xml @@ -0,0 +1,35 @@ +<?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.user.modular.system.dao.BillMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Bill"> + <id column="id" property="id"/> + <result column="userId" property="userId"/> + <result column="orderId" property="orderId"/> + <result column="billType" property="billType"/> + <result column="billHeaderType" property="billHeaderType"/> + <result column="companyName" property="companyName"/> + <result column="companyTaxNumber" property="companyTaxNumber"/> + <result column="billContent" property="billContent"/> + <result column="moreContent" property="moreContent"/> + <result column="billAmount" property="billAmount"/> + <result column="addresseeName" property="addresseeName"/> + <result column="addresseePhone" property="addresseePhone"/> + <result column="addresseeEmail" property="addresseeEmail"/> + <result column="state" property="state"/> + <result column="createTime" property="createTime"/> + </resultMap> + + + <select id="queryBillList" resultType="com.supersavedriving.user.modular.system.warpper.BillWarpper"> + select + id, + billType, + billContent, + billAmount, + state, + UNIX_TIMESTAMP(createTime) * 1000 as createTime + from t_bill where userId = #{uid} order by createTime desc limit #{pageNum}, #{pageSize} + </select> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/ComplaintMapper.xml b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/ComplaintMapper.xml new file mode 100644 index 0000000..d1003e7 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/ComplaintMapper.xml @@ -0,0 +1,20 @@ +<?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.user.modular.system.dao.ComplaintMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.Complaint"> + <id column="id" property="id"/> + <result column="userId" property="userId"/> + <result column="orderId" property="orderId"/> + <result column="driverId" property="driverId"/> + <result column="reason" property="reason"/> + <result column="notes" property="notes"/> + <result column="state" property="state"/> + <result column="status" property="status"/> + <result column="createTime" property="createTime"/> + <result column="auditId" property="auditId"/> + <result column="auditPersonName" property="auditPersonName"/> + <result column="auditTime" property="auditTime"/> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/OrderMapper.xml b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/OrderMapper.xml index 9715b4f..d55f4d2 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/OrderMapper.xml +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/OrderMapper.xml @@ -58,6 +58,7 @@ <result column="startWaitTime" property="startWaitTime"/> <result column="state" property="state" /> <result column="oldState" property="oldState"/> + <result column="isInvoice" property="isInvoice"/> <result column="status" property="status" /> <result column="createTime" property="createTime" /> </resultMap> @@ -74,6 +75,7 @@ a.endAddress, a.endLat, a.endLng, + b.id as driverId, b.avatar as driverAvatar, b.`name` as driverName, b.phone as driverPhone, @@ -81,9 +83,48 @@ (DATE_FORMAT(now(), '%Y') - DATE_FORMAT(b.firstCertificateTime, '%Y')) as driverAge, (select count(1) from t_order where driverId = b.id and `status` = 1 and state in (107, 108, 109)) as driverNumber, b.score as driverScore, - a.state + a.state, + UNIX_TIMESTAMP(a.createTime) * 1000 as createTime, + c.score as evaluationScore, + c.evaluate as evaluationContent from t_order a left join t_driver b on (a.driverId = b.id) + left join t_evaluate c on (a.id = c.orderId) where a.id = #{orderId} </select> + + + <select id="queryMyOrder" resultType="com.supersavedriving.user.modular.system.warpper.OrderListWarpper"> + select + id, + '超省新代驾' as title, + startAddress, + endAddress, + state, + UNIX_TIMESTAMP(createTime) * 1000 as createTime + from t_order + where `status` = 1 and userId = #{uid} order by createTime desc limit #{pageNum}, #{pageSize} + </select> + + + + <select id="queryNotInvoiceOrder" resultType="com.supersavedriving.user.modular.system.warpper.OrderListWarpper"> + select + id, + '超省新代驾' as title, + startAddress, + endAddress, + state, + UNIX_TIMESTAMP(createTime) * 1000 as createTime, + payMoney as amount + from t_order + where `status` = 1 and isInvoice != 1 and state in (108, 109) and userId = #{uid} + <if test="null != notInvoiceOrder.startTime and '' != notInvoiceOrder.startTime and null != notInvoiceOrder.endTime and '' != notInvoiceOrder.endTime"> + and DATE_FORMAT(createTime, '%Y-%m-%d') between #{notInvoiceOrder.startTime} and #{notInvoiceOrder.endTime} + </if> + <if test="null != notInvoiceOrder.startAmount and null != notInvoiceOrder.endAmount"> + and payMoney between #{notInvoiceOrder.startAmount} and #{notInvoiceOrder.endAmount} + </if> + order by createTime desc limit #{notInvoiceOrder.pageNum}, #{notInvoiceOrder.pageSize} + </select> </mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/RechargeRecordMapper.xml b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/RechargeRecordMapper.xml new file mode 100644 index 0000000..1406fba --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/RechargeRecordMapper.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.user.modular.system.dao.RechargeRecordMapper"> + + <!-- 通用查询映射结果 --> + <resultMap id="BaseResultMap" type="com.supersavedriving.user.modular.system.model.RechargeRecord"> + <id column="id" property="id" /> + <result column="type" property="type" /> + <result column="userId" property="userId" /> + <result column="code" property="code" /> + <result column="amount" property="amount"/> + <result column="payType" property="payType" /> + <result column="payTime" property="payTime" /> + <result column="payStatus" property="payStatus" /> + <result column="orderNumber" property="orderNumber" /> + <result column="createTime" property="createTime" /> + <result column="agentId" property="agentId" /> + </resultMap> +</mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml index 99a190f..f11bea7 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/UserToCouponMapper.xml @@ -19,7 +19,20 @@ <select id="queryCoupon" resultType="com.supersavedriving.user.modular.system.model.Coupon"> select b.id, - a.* + a.agent_id as agentId, + a.branch_office_id as branchOfficeId, + a.create_time as createTime, + a.coupon_name as couponName, + a.coupon_type as couponType, + a.coupon_code as couponCode, + a.coupon_service_type as couponServiceType, + a.coupon_conditional_amount as couponConditionalAmount, + a.coupon_preferential_amount as couponPreferentialAmount, + a.coupon_validity as couponValidity, + a.coupon_send_quantity as couponSendQuantity, + a.coupon_state as couponState, + a.coupon_count as couponCount, + a.remaining_quantity as remainingQuantity from t_coupon a left join t_user_to_coupon b on (a.id = b.couponId) where b.status = 1 and b.expireTime > now() and b.validCount > 0 @@ -41,4 +54,32 @@ where b.userId = #{uid} and b.validCount > 0 and b.expireTime > now() and a.coupon_conditional_amount <= #{price} and a.coupon_preferential_amount < #{price} order by b.createTime </select> + + + <select id="queryMyCoupons" resultType="com.supersavedriving.user.modular.system.warpper.CouponsWarpper"> + select + a.id, + b.coupon_name as `name`, + b.coupon_conditional_amount as preferentialTerms, + b.coupon_preferential_amount as discountAmount, + UNIX_TIMESTAMP(a.expireTime) * 1000 as endTime + from t_user_to_coupon a + left join t_coupon b on (a.couponId = b.id) + where a.`status` = 1 and a.userId = #{uid} + <if test="null != state and 1 == state"> + and a.couponTotal = a.validCount and now() < a.expireTime + </if> + <if test="null != state and 2 == state"> + and a.couponTotal != a.validCount and now() < a.expireTime + </if> + <if test="null != state and 3 == state"> + and now() >= a.expireTime + </if> + order by a.createTime desc limit #{pageNum}, #{pageSize} + </select> + + + <select id="queryUsedCouponNum" resultType="int"> + select sum(couponTotal - validCount) from t_user_to_coupon where `status` = 1 and userId = #{uid} + </select> </mapper> \ No newline at end of file diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/AccountChangeDetail.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/AccountChangeDetail.java index 196518d..9f0edbd 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/AccountChangeDetail.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/AccountChangeDetail.java @@ -23,6 +23,11 @@ @TableField("id") private Integer id; /** + * 编号 + */ + @TableField("code") + private String code; + /** * 用户类型(1=用户,2=司机) */ @TableField("userType") @@ -53,6 +58,11 @@ @TableField("newData") private Double newData; /** + * 订单id + */ + @TableField("orderId") + private Long orderId; + /** * 变动说明 */ @TableField("explain") diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Bill.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Bill.java new file mode 100644 index 0000000..178fff1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Bill.java @@ -0,0 +1,94 @@ +package com.supersavedriving.user.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/24 9:59 + */ +@Data +@TableName("t_bill") +public class Bill { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 订单id + */ + @TableField("orderId") + private Integer orderId; + /** + * 发票类型 1电子发票 + */ + @TableField("billType") + private Integer billType; + /** + * 发票抬头 1公司 2个人 + */ + @TableField("billHeaderType") + private Integer billHeaderType; + /** + * 公司名称/个人抬头名称 + */ + @TableField("companyName") + private String companyName; + /** + * 公司税号 + */ + @TableField("companyTaxNumber") + private String companyTaxNumber; + /** + * 发票内容 + */ + @TableField("billContent") + private String billContent; + /** + * 更多内容 + */ + @TableField("moreContent") + private String moreContent; + /** + * 发票金额 + */ + @TableField("billAmount") + private Double billAmount; + /** + * 收件人姓名 + */ + @TableField("addresseeName") + private String addresseeName; + /** + * 收件人电话 + */ + @TableField("addresseePhone") + private String addresseePhone; + /** + * 收件人邮箱 + */ + @TableField("addresseeEmail") + private String addresseeEmail; + /** + * 开票状态 1待开票 2已开票 3开票失败 + */ + @TableField("state") + private Integer state; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Complaint.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Complaint.java new file mode 100644 index 0000000..bb9c3a3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Complaint.java @@ -0,0 +1,79 @@ +package com.supersavedriving.user.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/24 11:58 + */ +@Data +@TableName("t_complaint") +public class Complaint { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 订单id + */ + @TableField("orderId") + private Integer orderId; + /** + * 司机id + */ + @TableField("driverId") + private Integer driverId; + /** + * 投诉原因 + */ + @TableField("reason") + private String reason; + /** + * 注释 + */ + @TableField("notes") + private String notes; + /** + * 处理状态(1=待处理,2=已处理) + */ + @TableField("state") + private Integer state; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("status") + private Integer status; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 处理人id + */ + @TableField("auditId") + private Integer auditId; + /** + * 处理人名称 + */ + @TableField("auditPersonName") + private String auditPersonName; + /** + * 处理时间 + */ + @TableField("auditTime") + private Date auditTime; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Order.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Order.java index c8afd9d..0294c69 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Order.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/Order.java @@ -288,6 +288,11 @@ @TableField("oldState") private Integer oldState; /** + * 是否已开发票(0=否,1=是) + */ + @TableField("isInvoice") + private Integer isInvoice; + /** * 状态(1=正常,2=冻结,3=删除) */ @TableField("status") diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/RechargeRecord.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/RechargeRecord.java new file mode 100644 index 0000000..740115b --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/RechargeRecord.java @@ -0,0 +1,74 @@ +package com.supersavedriving.user.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/21 23:08 + */ +@Data +@TableName("t_recharge_record") +public class RechargeRecord { + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + private Integer id; + /** + * 数据类型(1=用户,2=司机,3=代理商) + */ + @TableField("type") + private Integer type; + /** + * 用户id + */ + @TableField("userId") + private Integer userId; + /** + * 流水号 + */ + @TableField("code") + private String code; + /** + * 充值金额 + */ + @TableField("amount") + private Double amount; + /** + * 支付方式(1=微信,2=系统充值) + */ + @TableField("payType") + private Integer payType; + /** + * 完成支付时间 + */ + @TableField("payTime") + private Date payTime; + /** + * 支付状态(1=待支付,2=已完成) + */ + @TableField("payStatus") + private Integer payStatus; + /** + * 第三方流水号 + */ + @TableField("orderNumber") + private String orderNumber; + /** + * 添加时间 + */ + @TableField("createTime") + private Date createTime; + /** + * 代理商id + */ + @TableField("agentId") + private Integer agentId; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAccountChangeDetailService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAccountChangeDetailService.java index 39a3918..4e63420 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAccountChangeDetailService.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAccountChangeDetailService.java @@ -2,6 +2,9 @@ import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.user.modular.system.model.AccountChangeDetail; +import com.supersavedriving.user.modular.system.warpper.BalanceDetailsWarpper; + +import java.util.List; /** * @author zhibing.pu @@ -16,4 +19,16 @@ * @throws Exception */ void saveData(AccountChangeDetail accountChangeDetail) throws Exception; + + + /** + * 获取余额明细 + * @param uid + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<BalanceDetailsWarpper> queryBalanceDetails(Integer uid, String time, Integer pageNum, Integer pageSize) throws Exception; } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAppUserService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAppUserService.java index 4f812a8..095cfa6 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAppUserService.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IAppUserService.java @@ -3,10 +3,13 @@ import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.user.modular.system.model.AppUser; import com.supersavedriving.user.modular.system.util.ResultUtil; +import com.supersavedriving.user.modular.system.warpper.CouponsWarpper; import com.supersavedriving.user.modular.system.warpper.SignInToRegister; import com.supersavedriving.user.modular.system.warpper.SignInToRegisterWarpper; +import com.supersavedriving.user.modular.system.warpper.UserInfo; import javax.servlet.http.HttpServletRequest; +import java.util.List; public interface IAppUserService extends IService<AppUser> { @@ -35,4 +38,45 @@ * @return */ Integer getUserByRequest() throws Exception; + + + /** + * 修改个人信息 + * @param userInfo + * @return + * @throws Exception + */ + ResultUtil updateUserInfo(Integer uid, UserInfo userInfo) throws Exception; + + + /** + * 余额充值 + * @param uid + * @param amount + * @return + * @throws Exception + */ + ResultUtil rechargeBalance(Integer uid, Double amount) throws Exception; + + + /** + * 余额充值回调处理 + * @param out_trade_no + * @param transaction_id + * @return + * @throws Exception + */ + void rechargeBalanceCallback(String out_trade_no, String transaction_id) throws Exception; + + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception; } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IBillService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IBillService.java new file mode 100644 index 0000000..1a15911 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IBillService.java @@ -0,0 +1,37 @@ +package com.supersavedriving.user.modular.system.service; + +import com.baomidou.mybatisplus.service.IService; +import com.supersavedriving.user.modular.system.model.Bill; +import com.supersavedriving.user.modular.system.util.ResultUtil; +import com.supersavedriving.user.modular.system.warpper.BillWarpper; +import com.supersavedriving.user.modular.system.warpper.Invoicing; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:07 + */ +public interface IBillService extends IService<Bill> { + + + /** + * 开票操作 + * @param uid + * @param invoicing + * @return + * @throws Exception + */ + ResultUtil invoicing(Integer uid, Invoicing invoicing) throws Exception; + + + /** + * 获取开票记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<BillWarpper> queryBillList(Integer uid, Integer pageNum, Integer pageSize) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IComplaintService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IComplaintService.java new file mode 100644 index 0000000..11128b0 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IComplaintService.java @@ -0,0 +1,20 @@ +package com.supersavedriving.user.modular.system.service; + +import com.baomidou.mybatisplus.service.IService; +import com.supersavedriving.user.modular.system.model.Complaint; + +/** + * @author zhibing.pu + * @date 2023/3/24 16:07 + */ +public interface IComplaintService extends IService<Complaint> { + + + /** + * 投诉反馈 + * @param orderId + * @param content + * @throws Exception + */ + void feedback(Integer uid, Integer orderId, String content) throws Exception; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IOrderService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IOrderService.java index bd8a81e..0320c9d 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IOrderService.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IOrderService.java @@ -129,4 +129,24 @@ * @throws Exception */ ResultUtil orderAppraise(Integer uid, Long orderId, Integer score, String content) throws Exception; + + + /** + * 获取用户行程记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<OrderListWarpper> queryMyOrder(Integer uid, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 获取未开票订单 + * @param uid + * @return + * @throws Exception + */ + List<OrderListWarpper> queryNotInvoiceOrder(Integer uid, NotInvoiceOrder notInvoiceOrder) throws Exception; } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IRechargeRecordService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IRechargeRecordService.java new file mode 100644 index 0000000..ff26097 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IRechargeRecordService.java @@ -0,0 +1,11 @@ +package com.supersavedriving.user.modular.system.service; + +import com.baomidou.mybatisplus.service.IService; +import com.supersavedriving.user.modular.system.model.RechargeRecord; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:56 + */ +public interface IRechargeRecordService extends IService<RechargeRecord> { +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/ISystemConfigService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/ISystemConfigService.java index 1d75ce4..7bb4940 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/ISystemConfigService.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/ISystemConfigService.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.service.IService; import com.supersavedriving.user.modular.system.model.SystemConfig; +import com.supersavedriving.user.modular.system.warpper.PriceRulesWarpper; /** * 系统配置 @@ -9,4 +10,12 @@ * @Date 2023/2/15 16:26 */ public interface ISystemConfigService extends IService<SystemConfig> { + + + /** + * 获取价格表 + * @return + * @throws Exception + */ + PriceRulesWarpper queryPriceRules() throws Exception; } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IUserToCouponService.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IUserToCouponService.java index 902cb60..cd6adaf 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IUserToCouponService.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IUserToCouponService.java @@ -4,6 +4,7 @@ import com.supersavedriving.user.modular.system.model.Coupon; import com.supersavedriving.user.modular.system.model.UserToCoupon; import com.supersavedriving.user.modular.system.warpper.CouponWarpper; +import com.supersavedriving.user.modular.system.warpper.CouponsWarpper; import java.util.List; @@ -27,9 +28,28 @@ /** * 获取订单支付页面的可用优惠券列表 * @param uid - * @param orderId * @return * @throws Exception */ List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception; + + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception; + + + /** + * 获取已使用优惠券数量 + * @param uid + * @return + */ + Integer queryUsedCouponNum(Integer uid); } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java index 4758eda..f0aa660 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AccountChangeDetailServiceImpl.java @@ -4,9 +4,11 @@ import com.supersavedriving.user.modular.system.dao.AccountChangeDetailMapper; import com.supersavedriving.user.modular.system.model.AccountChangeDetail; import com.supersavedriving.user.modular.system.service.IAccountChangeDetailService; +import com.supersavedriving.user.modular.system.warpper.BalanceDetailsWarpper; import org.springframework.stereotype.Service; import java.util.Date; +import java.util.List; /** * 账户变动 @@ -27,4 +29,20 @@ accountChangeDetail.setCreateTime(new Date()); this.baseMapper.insert(accountChangeDetail); } + + + /** + * 获取余额明细 + * @param uid + * @param time + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<BalanceDetailsWarpper> queryBalanceDetails(Integer uid, String time, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryBalanceDetails(uid, time, pageNum, pageSize); + } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java index fd81855..02bbbe2 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/AppUserServiceImpl.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alipay.api.domain.RechargeDetail; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.supersavedriving.user.core.common.constant.JwtConstants; @@ -10,20 +11,16 @@ import com.supersavedriving.user.core.util.JwtTokenUtil; import com.supersavedriving.user.core.util.ToolUtil; import com.supersavedriving.user.modular.system.dao.AppUserMapper; -import com.supersavedriving.user.modular.system.model.AppUser; -import com.supersavedriving.user.modular.system.model.Coupon; -import com.supersavedriving.user.modular.system.model.UserToCoupon; -import com.supersavedriving.user.modular.system.service.IAppUserService; -import com.supersavedriving.user.modular.system.service.ICouponService; -import com.supersavedriving.user.modular.system.service.IUserToCouponService; +import com.supersavedriving.user.modular.system.model.*; +import com.supersavedriving.user.modular.system.service.*; +import com.supersavedriving.user.modular.system.util.PayMoneyUtil; import com.supersavedriving.user.modular.system.util.RedisUtil; import com.supersavedriving.user.modular.system.util.ResultUtil; +import com.supersavedriving.user.modular.system.util.UUIDUtil; import com.supersavedriving.user.modular.system.util.weChat.WXCore; import com.supersavedriving.user.modular.system.util.weChat.WeChatUtil; import com.supersavedriving.user.modular.system.util.weChat.model.Code2Session; -import com.supersavedriving.user.modular.system.warpper.CouponWarpper; -import com.supersavedriving.user.modular.system.warpper.SignInToRegister; -import com.supersavedriving.user.modular.system.warpper.SignInToRegisterWarpper; +import com.supersavedriving.user.modular.system.warpper.*; import org.apache.shiro.authc.SimpleAuthenticationInfo; import org.apache.shiro.authc.UsernamePasswordToken; import org.apache.shiro.authc.credential.HashedCredentialsMatcher; @@ -35,6 +32,7 @@ import org.springframework.web.context.request.ServletRequestAttributes; import javax.servlet.http.HttpServletRequest; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; @@ -60,6 +58,15 @@ @Autowired private IUserToCouponService userToCouponService; + @Autowired + private IRechargeRecordService rechargeRecordService; + + @Autowired + private PayMoneyUtil payMoneyUtil; + + @Autowired + private IAccountChangeDetailService accountChangeDetailService; + @Override @@ -69,12 +76,9 @@ return ResultUtil.error(code2Session.getErrmsg()); } String openid = code2Session.getOpenid(); - AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("openid", openid).ne("status", 3)); + AppUser appUser = this.selectOne(new EntityWrapper<AppUser>().eq("openid", openid).eq("status", 1)); if(null == appUser){ return ResultUtil.error("无效的账号"); - } - if(appUser.getStatus() == 2){ - return ResultUtil.error("账号被冻结"); } String token = getToken(appUser); if(ToolUtil.isEmpty(token)){ @@ -237,4 +241,116 @@ return null; } } + + /** + * 修改个人信息 + * @param userInfo + * @return + * @throws Exception + */ + @Override + public ResultUtil updateUserInfo(Integer uid, UserInfo userInfo) throws Exception { + AppUser appUser = this.selectById(uid); + if(ToolUtil.isNotEmpty(userInfo.getAvatar())){ + appUser.setAvatar(userInfo.getAvatar()); + } + if(ToolUtil.isNotEmpty(userInfo.getEmergencyContact())){ + appUser.setEmergencyContact(userInfo.getEmergencyContact()); + } + if(ToolUtil.isNotEmpty(userInfo.getEmergencyPhone())){ + appUser.setEmergencyPhone(userInfo.getEmergencyPhone()); + } + if(ToolUtil.isNotEmpty(userInfo.getNickname())){ + appUser.setNickname(userInfo.getNickname()); + } + if(ToolUtil.isNotEmpty(userInfo.getPhone())){ + if(userInfo.getPhone().equals(appUser.getPhone())){ + return ResultUtil.error("新手机不能和原手机号相同"); + } + String value = redisUtil.getValue("+86" + userInfo.getPhone()); + if(ToolUtil.isEmpty(value) || !value.equals(userInfo.getCode())){ + return ResultUtil.error("验证码无效"); + } + appUser.setPhone(userInfo.getPhone()); + } + this.updateById(appUser); + return ResultUtil.success(); + } + + /** + * 余额充值 + * @param uid + * @param amount + * @return + * @throws Exception + */ + @Override + public ResultUtil rechargeBalance(Integer uid, Double amount) throws Exception { + if(0 >= amount){ + return ResultUtil.error("充值金额必须大于0"); + } + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmssSSS"); + String out_trade_no = sdf.format(new Date()) + UUIDUtil.getNumberRandom(3); + AppUser appUser = this.selectById(uid); + RechargeRecord rechargeRecord = new RechargeRecord(); + rechargeRecord.setType(1); + rechargeRecord.setUserId(uid); + rechargeRecord.setCode(out_trade_no); + rechargeRecord.setAmount(amount); + rechargeRecord.setCreateTime(new Date()); + rechargeRecord.setPayStatus(1); + rechargeRecord.setPayType(1); + rechargeRecordService.insert(rechargeRecord); + ResultUtil weixinpay = payMoneyUtil.weixinpay("余额充值", "", out_trade_no, amount.toString(), "/base/appUser/rechargeBalanceCallback", "JSAPI", appUser.getOpenid()); + return weixinpay; + } + + + /** + * 余额充值回调 + * @param out_trade_no + * @param transaction_id + * @return + * @throws Exception + */ + @Override + public void rechargeBalanceCallback(String out_trade_no, String transaction_id) throws Exception { + RechargeRecord rechargeRecord1 = rechargeRecordService.selectOne(new EntityWrapper<RechargeRecord>().eq("code", out_trade_no)); + if(rechargeRecord1.getPayStatus() != 1){ + return; + } + AppUser appUser = this.selectById(rechargeRecord1.getUserId()); + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); + accountChangeDetail.setUserType(1); + accountChangeDetail.setUserId(rechargeRecord1.getUserId()); + accountChangeDetail.setCode(System.currentTimeMillis() + UUIDUtil.getNumberRandom(3)); + accountChangeDetail.setChangeType(3); + accountChangeDetail.setType(1); + accountChangeDetail.setCreateTime(new Date()); + accountChangeDetail.setExplain("余额充值"); + accountChangeDetail.setOldData(appUser.getAccountBalance()); + appUser.setAccountBalance(appUser.getAccountBalance() + rechargeRecord1.getAmount()); + accountChangeDetail.setNewData(appUser.getAccountBalance()); + this.updateById(appUser); + accountChangeDetailService.saveData(accountChangeDetail); + + rechargeRecord1.setPayTime(new Date()); + rechargeRecord1.setPayStatus(2); + rechargeRecord1.setOrderNumber(transaction_id); + rechargeRecordService.updateById(rechargeRecord1); + } + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception { + return null; + } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/BillServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/BillServiceImpl.java new file mode 100644 index 0000000..ca10cc3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/BillServiceImpl.java @@ -0,0 +1,81 @@ +package com.supersavedriving.user.modular.system.service.impl; + +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.supersavedriving.user.core.util.ToolUtil; +import com.supersavedriving.user.modular.system.dao.BillMapper; +import com.supersavedriving.user.modular.system.model.Bill; +import com.supersavedriving.user.modular.system.model.Order; +import com.supersavedriving.user.modular.system.service.IBillService; +import com.supersavedriving.user.modular.system.service.IOrderService; +import com.supersavedriving.user.modular.system.util.ResultUtil; +import com.supersavedriving.user.modular.system.warpper.BillWarpper; +import com.supersavedriving.user.modular.system.warpper.Invoicing; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.Date; +import java.util.List; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:07 + */ +@Service +public class BillServiceImpl extends ServiceImpl<BillMapper, Bill> implements IBillService { + + @Autowired + private IOrderService orderService; + + + /** + * 开票操作 + * @param uid + * @param invoicing + * @return + * @throws Exception + */ + @Override + public ResultUtil invoicing(Integer uid, Invoicing invoicing) throws Exception { + if(ToolUtil.isEmpty(invoicing.getOrderIds())){ + return ResultUtil.error("请选择有效的开票订单"); + } + String[] split = invoicing.getOrderIds().split(","); + List<Order> orders = orderService.selectBatchIds(Arrays.asList(split)); + for (Order order : orders) { + if(null != order.getIsInvoice() && order.getIsInvoice() == 1){ + continue; + } + Bill bill = new Bill(); + BeanUtils.copyProperties(invoicing, bill); + bill.setUserId(order.getUserId()); + bill.setOrderId(order.getId().intValue()); + bill.setBillType(1); + bill.setBillContent("代驾服务费"); + bill.setBillAmount(order.getPayMoney()); + bill.setState(1); + bill.setCreateTime(new Date()); + this.insert(bill); + + order.setIsInvoice(1); + orderService.updateById(order); + } + return ResultUtil.success(); + } + + + /** + * 获取开票记录 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<BillWarpper> queryBillList(Integer uid, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryBillList(uid, pageNum, pageSize); + } +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/CommercialServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/CommercialServiceImpl.java index 62ede28..e2eea78 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/CommercialServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/CommercialServiceImpl.java @@ -37,11 +37,11 @@ @Override public List<CommercialWarpper> queryCommercialList(Integer uid, Integer type, Integer device) throws Exception { if(type == 1){//弹框广告 -// CommercialUserEject commercialUserEject = commercialUserEjectService.selectOne(new EntityWrapper<CommercialUserEject>().eq("userType", 2) -// .eq("userId", uid).last(" and DATE_FORMAT(now(), '%Y%m%d') = DATE_FORMAT(lastDate, '%Y%m%d')")); -// if(null != commercialUserEject){ -// return new ArrayList<>(); -// } + CommercialUserEject commercialUserEject = commercialUserEjectService.selectOne(new EntityWrapper<CommercialUserEject>().eq("userType", 2) + .eq("userId", uid).last(" and DATE_FORMAT(now(), '%Y%m%d') = DATE_FORMAT(lastDate, '%Y%m%d')")); + if(null != commercialUserEject){ + return new ArrayList<>(); + } } List<CommercialWarpper> commercialWarppers = this.baseMapper.queryCommercialList(type, device); if(type == 1 && commercialWarppers.size() > 0){//记录弹窗 diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/ComplaintServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/ComplaintServiceImpl.java new file mode 100644 index 0000000..9301de9 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/ComplaintServiceImpl.java @@ -0,0 +1,48 @@ +package com.supersavedriving.user.modular.system.service.impl; + +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.supersavedriving.user.modular.system.dao.ComplaintMapper; +import com.supersavedriving.user.modular.system.model.Complaint; +import com.supersavedriving.user.modular.system.model.Order; +import com.supersavedriving.user.modular.system.service.IComplaintService; +import com.supersavedriving.user.modular.system.service.IOrderService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2023/3/24 16:07 + */ +@Service +public class ComplaintServiceImpl extends ServiceImpl<ComplaintMapper, Complaint> implements IComplaintService { + + @Autowired + private IOrderService orderService; + + + + + /** + * 投诉反馈 + * @param orderId + * @param content + * @throws Exception + */ + @Override + public void feedback(Integer uid, Integer orderId, String content) throws Exception { + Complaint complaint = new Complaint(); + complaint.setUserId(uid); + if(null != orderId){ + Order order = orderService.selectById(orderId); + complaint.setOrderId(orderId); + complaint.setDriverId(order.getDriverId()); + } + complaint.setReason(content); + complaint.setState(1); + complaint.setStatus(1); + complaint.setCreateTime(new Date()); + this.updateById(complaint); + } +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java index 51f0934..49c1200 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/OrderServiceImpl.java @@ -118,7 +118,8 @@ String city = ""; District geocode = MapUtil.geocode(estimatedCosts.getStartLng().toString(), estimatedCosts.getStartLat().toString()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); city = null != weatherCity ? weatherCity.getId().toString() : ""; } Order order = getOrderPrice(1, d, 0, new Order(), city); @@ -270,28 +271,36 @@ } //恶劣天气 - boolean badWeather = WeatherUtil.isBadWeather(city); - if(badWeather){ - order.setBadWeatherDistance(num5);//恶劣天气公里 - order.setBadWeatherPrice(num6);//恶劣天气费 - if(distance.compareTo(num7) > 0){ - BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); - BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); - order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 - order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 - } + systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 8)); + if(null != systemConfig){ + JSONObject jsonObject1 = JSON.parseObject(systemConfig.getContent()); + Integer num11 = jsonObject1.getInteger("num1");//开启恶劣天气计价 + if(1 == num11){ + boolean badWeather = WeatherUtil.isBadWeather(city); + if(badWeather){ + order.setBadWeatherDistance(num5);//恶劣天气公里 + order.setBadWeatherPrice(num6);//恶劣天气费 + if(distance.compareTo(num7) > 0){ + BigDecimal subtract = new BigDecimal(distance).subtract(new BigDecimal(num7)); + BigDecimal multiply = subtract.multiply(new BigDecimal(num8)); + order.setOverBadWeatherDistance(subtract.doubleValue());//恶劣天气超出公里 + order.setOverBadWeatherPrice(multiply.doubleValue());//恶劣天气超出公里费 + } - double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); - if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) - if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 - order.setBadWeatherPrice(num9);//恶劣天气费 - order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 - }else{ - BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); - order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 + double add = new BigDecimal(order.getOverBadWeatherPrice()).add(new BigDecimal(order.getBadWeatherPrice())).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue(); + if(num9.compareTo(add) < 0){//超出最高金额(重新调整金额) + if(num9.compareTo(num6) < 0){//如果恶劣天气费大于最高金额 + order.setBadWeatherPrice(num9);//恶劣天气费 + order.setOverBadWeatherPrice(0D);//恶劣天气超出公里费 + }else{ + BigDecimal subtract = new BigDecimal(num9).subtract(new BigDecimal(add)); + order.setOverBadWeatherPrice(subtract.doubleValue());//恶劣天气超出公里费 + } + } } } } + //计算总金额 BigDecimal bigDecimal = new BigDecimal(order.getStartPrice() + order.getOverDrivePrice() + order.getLongDistancePrice() + order.getOverLongDistancePrice() + @@ -357,6 +366,16 @@ if(null != order){ return ResultUtil.error("您还有正在进行的订单"); } + + String startAddress = travelOrder.getStartAddress(); + startAddress = startAddress.replaceAll("& #40;", "("); + startAddress = startAddress.replaceAll("& #41;", ")"); + travelOrder.setStartAddress(startAddress);; + String endAddress = travelOrder.getEndAddress(); + endAddress = endAddress.replaceAll("& #40;", "("); + endAddress = endAddress.replaceAll("& #41;", ")"); + travelOrder.setEndAddress(endAddress); + order = new Order(); BeanUtils.copyProperties(travelOrder, order); if(ToolUtil.isEmpty(travelOrder.getUserPhone())){ @@ -382,7 +401,8 @@ String city = ""; District geocode = MapUtil.geocode(order.getStartLng(), order.getStartLat()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); city = null != weatherCity ? weatherCity.getId().toString() : ""; } order = getOrderPrice(1, d, 0, order, city); @@ -409,8 +429,11 @@ //推送状态 pushUtil.pushOrderStatus(uid, 1, order.getId(), order.getState()); - if(null != travelOrder.getDriverId()){ - pushUtil.pushOrderStatus(travelOrder.getDriverId(), 2, order.getId(), order.getState()); + if(null != order.getDriverId()){ + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); }else{ //推单 pushOrder(order); @@ -446,7 +469,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); @@ -467,6 +490,10 @@ if(ToolUtil.isEmpty(value)){ continue; } + Driver driver1 = driverService.selectById(youTuiDriver.getDriverId()); + if(driver1.getServerStatus() == 2){ + continue; + } Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); Double wgs84 = distance.get("WGS84"); if(d == null || d.compareTo(wgs84) > 0){ @@ -484,6 +511,9 @@ //开始范围查找 if(null == driver){ for (int i = 1; i < 4; i++) { + if(null != driver){ + break; + } num = jsonObject.getDouble("num" + i) / 1000;//范围公里 //构造半径 distanceR = new Distance(num, Metrics.KILOMETERS); @@ -504,6 +534,10 @@ Double score = null; Double d = null; for (Driver driver1 : drivers) { + String value = redisUtil.getValue("DRIVER" + driver1.getId()); + if(ToolUtil.isEmpty(value)){ + continue; + } if(integral == null || integral.compareTo(driver1.getIntegral()) < 0){//积分大 integral = driver1.getIntegral(); score = driver1.getScore(); @@ -517,10 +551,6 @@ continue; } if(integral.compareTo(driver1.getIntegral()) == 0 && score.compareTo(driver1.getScore()) == 0){//积分相同/评分相同对比距离 - String value = redisUtil.getValue("DRIVER" + driver1.getId()); - if(ToolUtil.isEmpty(value)){ - continue; - } Map<String, Double> distance = GeodesyUtil.getDistance(value, order.getStartLng() + "," + order.getStartLat()); Double wgs84 = distance.get("WGS84"); if(d == null || d.compareTo(wgs84) > 0){ @@ -577,9 +607,24 @@ cancelOrder.setStatus(1); cancelOrder.setCreateTime(new Date()); cancelOrderService.insert(cancelOrder); + order.setState(301); + this.updateById(order); AppUser appUser = appUserService.selectById(uid); appUser.setCancelCount(appUser.getCancelCount() + 1); appUserService.updateById(appUser); + Driver driver = driverService.selectById(order.getDriverId()); + if(null != driver){ + driver.setServerStatus(1); + driverService.updateById(driver); + } + + pushUtil.pushOrderStatus(uid, 1, orderId, order.getState()); + if(null != order.getDriverId()){ + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + } return ResultUtil.success(); } @@ -593,7 +638,19 @@ */ @Override public OrderInfoWarpper queryOrderInfo(Integer uid, Long orderId) throws Exception { - return this.baseMapper.queryOrderInfo(uid, orderId); + OrderInfoWarpper orderInfoWarpper = this.baseMapper.queryOrderInfo(uid, orderId); + SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 7)); + if(null != systemConfig){ + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + orderInfoWarpper.setServiceCell(jsonObject.getString("num1")); + } + String value = redisUtil.getValue("DRIVER" + orderInfoWarpper.getDriverId()); + if(ToolUtil.isNotEmpty(value)){ + String[] split = value.split(","); + orderInfoWarpper.setDriverLon(split[0]); + orderInfoWarpper.setDriverLat(split[1]); + } + return orderInfoWarpper; } @@ -623,7 +680,8 @@ String city = ""; District geocode = MapUtil.geocode(order.getStartLng().toString(), order.getStartLat().toString()); if(null != geocode){ - WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>().where(" '" + geocode.getDistrict() + "' like district")); + WeatherCity weatherCity = weatherCityService.selectOne(new EntityWrapper<WeatherCity>() + .where("'" + geocode.getCity() + "' like CONCAT('%', city, '%') and '" + geocode.getDistrict() + "' like CONCAT('%', district, '%') ")); city = null != weatherCity ? weatherCity.getId().toString() : ""; } Order order1 = new Order(); @@ -827,6 +885,15 @@ order.setState(108); this.updateById(order); + pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); + if(null != order.getDriverId()) { + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + } + + AccountChangeDetail accountChangeDetail = new AccountChangeDetail(); accountChangeDetail.setUserType(1); accountChangeDetail.setUserId(appUser.getId()); @@ -834,6 +901,7 @@ accountChangeDetail.setOldData(appUser.getAccountBalance()); accountChangeDetail.setType(1); accountChangeDetail.setChangeType(2); + accountChangeDetail.setOrderId(order.getId()); accountChangeDetail.setExplain("代驾服务费"); appUser.setAccountBalance(appUser.getAccountBalance() - payMoney); accountChangeDetail.setNewData(appUser.getAccountBalance()); @@ -878,6 +946,7 @@ accountChangeDetail.setOldData(appUser.getAccountBalance()); accountChangeDetail.setType(1); accountChangeDetail.setChangeType(2); + accountChangeDetail.setOrderId(order.getId()); accountChangeDetail.setExplain("代驾服务费"); appUser.setAccountBalance(appUser.getAccountBalance() > payMoney ? appUser.getAccountBalance() - payMoney : 0); accountChangeDetail.setNewData(appUser.getAccountBalance()); @@ -943,6 +1012,18 @@ Thread.sleep(wait); num++; } + }else{ + Thread.sleep(wait); + num++; + } + if(10 == num){ + AccountChangeDetail accountChangeDetail1 = accountChangeDetailService.selectById(accountChangeDetail.getId()); + AppUser appUser1 = appUserService.selectById(accountChangeDetail1.getUserId()); + Double b = accountChangeDetail1.getOldData() - accountChangeDetail1.getNewData(); + appUser1.setAccountBalance(appUser1.getAccountBalance() + b); + appUserService.updateById(appUser1); + + accountChangeDetailService.deleteById(accountChangeDetail.getId()); } } }catch (Exception e){ @@ -977,6 +1058,14 @@ this.updateById(order); //添加收入明细 saveCommission(order); + + pushUtil.pushOrderStatus(order.getUserId(), 1, order.getId(), order.getState()); + if(null != order.getDriverId()) { + PushOrderInfoWarpper pushOrderInfoWarpper = new PushOrderInfoWarpper(); + pushOrderInfoWarpper.setId(order.getId()); + pushOrderInfoWarpper.setState(order.getState()); + pushUtil.pushOrderInfo(order.getDriverId(), 2, pushOrderInfoWarpper); + } return ResultUtil.success(); } @@ -1007,7 +1096,7 @@ evaluate.setUserId(uid); evaluateService.insert(evaluate); Driver driver = driverService.selectById(order.getDriverId()); - driver.setScore((driver.getScore() + score) / 2); + driver.setScore(((null == driver.getScore() ? 0 : driver.getScore()) + score) / 2); if(score == 5){//司机积分奖励 SystemConfig systemConfig = systemConfigService.selectOne(new EntityWrapper<SystemConfig>().eq("type", 4)); if(null != systemConfig){ @@ -1306,6 +1395,7 @@ accountChangeDetail.setUserId(driver.getId()); accountChangeDetail.setType(1); accountChangeDetail.setChangeType(1); + accountChangeDetail.setOrderId(order.getId()); accountChangeDetail.setOldData(driver.getBalance() + driver.getCouponBalance()); accountChangeDetail.setExplain("订单收入"); accountChangeDetail.setCreateTime(new Date()); @@ -1317,4 +1407,32 @@ driverService.updateById(driver); accountChangeDetailService.saveData(accountChangeDetail); } + + + /** + * 获取乘客行程 + * @param uid + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<OrderListWarpper> queryMyOrder(Integer uid, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryMyOrder(uid, pageNum, pageSize); + } + + + /** + * 获取未开票订单 + * @param uid + * @return + * @throws Exception + */ + @Override + public List<OrderListWarpper> queryNotInvoiceOrder(Integer uid, NotInvoiceOrder notInvoiceOrder) throws Exception { + notInvoiceOrder.setPageNum((notInvoiceOrder.getPageNum() - 1) * notInvoiceOrder.getPageSize());; + return this.baseMapper.queryNotInvoiceOrder(uid, notInvoiceOrder); + } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java new file mode 100644 index 0000000..4287548 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/RechargeRecordServiceImpl.java @@ -0,0 +1,15 @@ +package com.supersavedriving.user.modular.system.service.impl; + +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.supersavedriving.user.modular.system.dao.RechargeRecordMapper; +import com.supersavedriving.user.modular.system.model.RechargeRecord; +import com.supersavedriving.user.modular.system.service.IRechargeRecordService; +import org.springframework.stereotype.Service; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:57 + */ +@Service +public class RechargeRecordServiceImpl extends ServiceImpl<RechargeRecordMapper, RechargeRecord> implements IRechargeRecordService { +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/SystemConfigServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/SystemConfigServiceImpl.java index ce896ae..b78e878 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/SystemConfigServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/SystemConfigServiceImpl.java @@ -1,10 +1,20 @@ package com.supersavedriving.user.modular.system.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.supersavedriving.user.modular.system.dao.SystemConfigMapper; import com.supersavedriving.user.modular.system.model.SystemConfig; import com.supersavedriving.user.modular.system.service.ISystemConfigService; +import com.supersavedriving.user.modular.system.warpper.PriceRulesWarpper; import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; /** * 系统配置 @@ -13,4 +23,71 @@ */ @Service public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigMapper, SystemConfig> implements ISystemConfigService { + + + /** + * 获取价格表 + * @return + * @throws Exception + */ + @Override + public PriceRulesWarpper queryPriceRules() throws Exception { + SystemConfig systemConfig = this.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); + PriceRulesWarpper priceRulesWarpper = new PriceRulesWarpper(); + if(null != systemConfig){ + //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":1,"num4":1,"num5":1,"num6":1,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"00:00","num2":"10:00","num3":3,"num4":3,"num5":3,"num6":3,"num7":3,"num8":3,"num9":3,"num10":3,"num11":3}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1}} + JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); + JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); + List<Map<String, Object>> basePrice = new ArrayList<>(); + List<Map<String, Object>> longDistanceCharges = new ArrayList<>(); + for (int i = 0; i < chargeStandard.size(); i++) { + JSONObject jsonObject1 = chargeStandard.getJSONObject(i); + String num1 = jsonObject1.getString("num1"); + String num2 = jsonObject1.getString("num2"); + Double num3 = jsonObject1.getDouble("num3"); + Double num4 = jsonObject1.getDouble("num4"); + Double num5 = jsonObject1.getDouble("num5"); + Double num6 = jsonObject1.getDouble("num6"); + Double num7 = jsonObject1.getDouble("num7"); + Double num8 = jsonObject1.getDouble("num8"); + Double num9 = jsonObject1.getDouble("num9"); + Double num10 = jsonObject1.getDouble("num10"); + Double num11 = jsonObject1.getDouble("num11"); + + + Map<String, Object> map1 = new HashMap<>(); + map1.put("time", num1 + "-" + num2); + map1.put("startingMileage", num3 + "公里(包含" + num3 + "公里)"); + map1.put("startingPrice", num4 + "元"); + map1.put("exceedStartingPrice", num6 + "元/" + num5 + "公里"); + basePrice.add(map1); + + Map<String, Object> map2 = new HashMap<>(); + map2.put("time", num1 + "-" + num2); + map2.put("startingMileage", num7 + "-" + num8 + "公里"); + map2.put("startingPrice", num9 + "元"); + map2.put("exceedStartingPrice", num11 + "元/" + num10 + "公里"); + longDistanceCharges.add(map2); + } + priceRulesWarpper.setBasePrice(JSON.toJSONString(basePrice)); + priceRulesWarpper.setLongDistanceCharges(JSON.toJSONString(longDistanceCharges)); + //额外费用 + JSONObject extraCost = jsonObject.getJSONObject("ExtraCost"); + Integer num1 = extraCost.getInteger("num1"); + Double num2 = extraCost.getDouble("num2"); + Integer num3 = extraCost.getInteger("num3"); + Double num4 = extraCost.getDouble("num4"); + Double num5 = extraCost.getDouble("num5"); + Double num6 = extraCost.getDouble("num6"); + Double num7 = extraCost.getDouble("num7"); + Double num8 = extraCost.getDouble("num8"); + Double num9 = extraCost.getDouble("num9"); + Map<String, Object> map = new HashMap<>(); + map.put("waitTime", num1 + "分钟/" + num2 + "元"); + map.put("exceedWaitTime", "超出" + num3 + "分钟,收取" + num4 + "元/分钟"); + map.put("badWeather", num5 + "公里内加收" + num6 + "元,超过" + num7 + "公里按照订单单价的" + num8 + "倍计费,最高收取" + num9 + "元"); + priceRulesWarpper.setAdditionalFee(JSON.toJSONString(map)); + } + return priceRulesWarpper; + } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/UserToCouponServiceImpl.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/UserToCouponServiceImpl.java index fe14ffc..1665047 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/UserToCouponServiceImpl.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/UserToCouponServiceImpl.java @@ -6,6 +6,7 @@ import com.supersavedriving.user.modular.system.model.UserToCoupon; import com.supersavedriving.user.modular.system.service.IUserToCouponService; import com.supersavedriving.user.modular.system.warpper.CouponWarpper; +import com.supersavedriving.user.modular.system.warpper.CouponsWarpper; import org.springframework.stereotype.Service; import java.util.List; @@ -41,4 +42,24 @@ public List<CouponWarpper> queryPayCouponList(Integer uid, Double price) throws Exception { return this.baseMapper.queryPayCouponList(uid, price); } + + /** + * 获取用户优惠券列表 + * @param uid + * @param state + * @param pageNum + * @param pageSize + * @return + * @throws Exception + */ + @Override + public List<CouponsWarpper> queryMyCoupons(Integer uid, Integer state, Integer pageNum, Integer pageSize) throws Exception { + pageNum = (pageNum - 1) * pageSize; + return this.baseMapper.queryMyCoupons(uid, state, pageNum, pageSize); + } + + @Override + public Integer queryUsedCouponNum(Integer uid) { + return this.baseMapper.queryUsedCouponNum(uid); + } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PayMoneyUtil.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PayMoneyUtil.java index 7e358a2..77db938 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PayMoneyUtil.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PayMoneyUtil.java @@ -72,11 +72,13 @@ @Value("${callbackPath}") private String callbackPath;//支付回调网关地址 - private String app_cert_path = "/usr/local/server/cer/zhifubao/user/app_cert_path.crt";//应用公钥证书路径 + private String app_cert_path = "/usr/local/server/app/cer/zhifubao/user/app_cert_path.crt";//应用公钥证书路径 - private String alipay_cert_path = "/usr/local/server/cer/zhifubao/user/alipay_cert_path.crt";//支付宝公钥证书文件路径 + private String alipay_cert_path = "/usr/local/server/app/cer/zhifubao/user/alipay_cert_path.crt";//支付宝公钥证书文件路径 - private String alipay_root_cert_path = "/usr/local/server/cer/zhifubao/user/alipay_root_cert_path.crt";//支付宝CA根证书文件路径 + private String alipay_root_cert_path = "/usr/local/server/app/cer/zhifubao/user/alipay_root_cert_path.crt";//支付宝CA根证书文件路径 + + private String weixin_cert_path = "/usr/local/server/app/cert/weixin/apiclient_cert.p12";//微信支付证书 private Map<String, JSONObject> order = new HashMap<>();//存储支付订单用于主动查询支付结果 @@ -601,8 +603,7 @@ Map<String, String> map1 = null; String body1 = null; try { - String certPath = "/usr/local/server/cert/weixin/apiclient_cert.p12"; - body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); + body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, weixin_cert_path, "PKCS12"); } catch (Exception e) { e.printStackTrace(); } @@ -855,8 +856,7 @@ xmlString.append("</xml>"); Map<String, String> map1 = null; - String certPath = "/usr/local/server/cert/weixin/apiclient_cert.p12";//证书地址 - String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); + String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, weixin_cert_path, "PKCS12"); //将结果xml解析成map body1 = body1.replaceAll("<!\\[CDATA\\[",""); body1 = body1.replaceAll("]]>", ""); @@ -932,8 +932,7 @@ xmlString.append("</xml>"); Map<String, String> map1 = null; - String certPath = "/usr/local/server/cert/weixin/apiclient_cert.p12";//证书地址 - String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, certPath, "PKCS12"); + String body1 = HttpClientUtil.pushHttpsRequsetXml(url, xmlString.toString(), new HashMap<>(), mchId, weixin_cert_path, "PKCS12"); //将结果xml解析成map body1 = body1.replaceAll("<!\\[CDATA\\[",""); body1 = body1.replaceAll("]]>", ""); diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java index 55520e7..8d506ad 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/PushUtil.java @@ -2,6 +2,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.supersavedriving.user.modular.system.warpper.PushOrderInfoWarpper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -129,6 +130,41 @@ } + + /** + * 推送订单数据 + * @param id + * @param type + * @param pushOrderInfoWarpper + */ + public void pushOrderInfo(Integer id, Integer type, PushOrderInfoWarpper pushOrderInfoWarpper){ + JSONObject msg = new JSONObject(); + msg.put("code", 200); + msg.put("msg", "SUCCESS"); + msg.put("method", "ORDER_INFO"); + msg.put("data", pushOrderInfoWarpper); + + //调用推送 + HttpHeaders headers = new HttpHeaders(); + // 以表单的方式提交 + headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); + //将请求头部和参数合成一个请求 + MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(); + params.add("msg", msg.toJSONString()); + params.add("id", id.toString()); + params.add("type", type.toString()); + HttpEntity<MultiValueMap<String, Object>> requestEntity = new HttpEntity<>(params, headers); + String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); + JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); + if(jsonObject1.getIntValue("code") != 200){ + logger.debug(jsonObject1.getString("msg")); + System.err.println(jsonObject1.getString("msg")); + } + } + + + + /** * 系统推单推送 * @param id 接受对象id diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/huawei/SMSUtil.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/huawei/SMSUtil.java index 633cc81..2204e55 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/huawei/SMSUtil.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/huawei/SMSUtil.java @@ -238,4 +238,13 @@ sc.init(null, trustAllCerts, null); HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory()); } + + + public static void main(String[] ages){ + try { + SMSUtil.send("15828353127", "1d0f0cbe5b214b0d8efa891730eb532a", "[\"" + 123456 + "\"]"); + } catch (Exception e) { + e.printStackTrace(); + } + } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BalanceDetailsWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BalanceDetailsWarpper.java new file mode 100644 index 0000000..0ff0f91 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BalanceDetailsWarpper.java @@ -0,0 +1,28 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 17:15 + */ +@Data +@ApiModel +public class BalanceDetailsWarpper { + @ApiModelProperty("使用类型(2=支付订单,3=余额充值)") + private Integer type; + @ApiModelProperty("使用说明") + private String explain; + @ApiModelProperty("起点") + private String startAddress; + @ApiModelProperty("终点") + private String endAddress; + @ApiModelProperty("时间") + private Long createTime; + @ApiModelProperty("变动金额") + private Double amount; + @ApiModelProperty("余额") + private Double balance; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BillWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BillWarpper.java new file mode 100644 index 0000000..d8f4ded --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/BillWarpper.java @@ -0,0 +1,26 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:50 + */ +@Data +@ApiModel +public class BillWarpper { + @ApiModelProperty("数据id") + private Integer id; + @ApiModelProperty("时间") + private Long createTime; + @ApiModelProperty("发票内容") + private String billContent; + @ApiModelProperty("发票类型 1电子发票") + private Integer billType; + @ApiModelProperty("开票金额") + private Double billAmount; + @ApiModelProperty("开票状态 1待开票 2已开票 3开票失败") + private Integer state; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponWarpper.java index c221b3a..b9770b1 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponWarpper.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponWarpper.java @@ -11,6 +11,8 @@ @Data @ApiModel public class CouponWarpper { + @ApiModelProperty("优惠券id") + private Integer id; @ApiModelProperty("满金额") private Double couponConditionalAmount; @ApiModelProperty("优惠金额") diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponsWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponsWarpper.java new file mode 100644 index 0000000..0ace619 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponsWarpper.java @@ -0,0 +1,24 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 15:28 + */ +@Data +@ApiModel +public class CouponsWarpper { + @ApiModelProperty("优惠券id") + private Integer id; + @ApiModelProperty("名称") + private String name; + @ApiModelProperty("优惠金额") + private Double discountAmount; + @ApiModelProperty("优惠条件") + private Double preferentialTerms; + @ApiModelProperty("有效期") + private Long endTime; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/Invoicing.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/Invoicing.java new file mode 100644 index 0000000..a4af90a --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/Invoicing.java @@ -0,0 +1,30 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/24 9:55 + */ +@Data +@ApiModel +public class Invoicing { + @ApiModelProperty(value = "订单id,多个已逗号分隔", dataType = "string", required = true) + private String orderIds; + @ApiModelProperty(value = "发票抬头类型(1=企业,2=个人)", dataType = "int", required = true) + private Integer billHeaderType; + @ApiModelProperty(value = "公司名称/个人名称", dataType = "string", required = true) + private String companyName; + @ApiModelProperty(value = "公司税号", dataType = "string", required = false) + private String companyTaxNumber; + @ApiModelProperty(value = "发票更多内容", dataType = "string", required = true) + private String moreContent; + @ApiModelProperty(value = "收件人姓名", dataType = "string", required = true) + private String addresseeName; + @ApiModelProperty(value = "收件人手机号", dataType = "string", required = true) + private String addresseePhone; + @ApiModelProperty(value = "收件人电子邮箱", dataType = "string", required = true) + private String addresseeEmail; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/NotInvoiceOrder.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/NotInvoiceOrder.java new file mode 100644 index 0000000..82b96f1 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/NotInvoiceOrder.java @@ -0,0 +1,26 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/24 10:30 + */ +@Data +@ApiModel +public class NotInvoiceOrder { + @ApiModelProperty(value = "订单开始时间(2023-01-01)", required = false, dataType = "string") + private String startTime; + @ApiModelProperty(value = "订单结束时间(2023-01-01)", required = false, dataType = "string") + private String endTime; + @ApiModelProperty(value = "订单开始金额", required = false, dataType = "double") + private Double startAmount; + @ApiModelProperty(value = "订单结束金额", required = false, dataType = "double") + private Double endAmount; + @ApiModelProperty(value = "页码,首页1", required = true, dataType = "int") + private Integer pageNum; + @ApiModelProperty(value = "页条数", required = true, dataType = "int") + private Integer pageSize; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderInfoWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderInfoWarpper.java index 82571d5..df3d0c7 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderInfoWarpper.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderInfoWarpper.java @@ -25,6 +25,8 @@ private String endLat; @ApiModelProperty("终点经度") private String endLng; + @ApiModelProperty("司机id") + private Integer driverId; @ApiModelProperty("司机头像") private String driverAvatar; @ApiModelProperty("司机名称") @@ -39,7 +41,19 @@ private Integer driverNumber; @ApiModelProperty("司机评分") private Double driverScore; + @ApiModelProperty("司机位置经度") + private String driverLon; + @ApiModelProperty("司机位置纬度") + private String driverLat; @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)") private Integer state; + @ApiModelProperty("客服电话") + private String serviceCell; + @ApiModelProperty("订单创建时间") + private Long createTime; + @ApiModelProperty("订单评分") + private Integer evaluationScore; + @ApiModelProperty("评价内容") + private String evaluationContent; } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderListWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderListWarpper.java index d704bdf..b2b0c34 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderListWarpper.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderListWarpper.java @@ -2,226 +2,27 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; - -@ApiModel("订单列表") -public class OrderListWarpper implements Comparable { +/** + * @author zhibing.pu + * @date 2023/3/18 10:22 + */ +@Data +@ApiModel +public class OrderListWarpper { @ApiModelProperty("订单id") private Integer id; - @ApiModelProperty("订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)") - private Integer type; - @ApiModelProperty("订单名称") - private String name; + @ApiModelProperty("标题") + private String title; @ApiModelProperty("订单时间") - private String time; - @ApiModelProperty("出发地") + private Long createTime; + @ApiModelProperty("金额") + private Double amount; + @ApiModelProperty("起点地址") private String startAddress; - @ApiModelProperty("目的地") + @ApiModelProperty("终点地址") private String endAddress; - @ApiModelProperty("红包金额") - private Double redMoney; - @ApiModelProperty("订单金额") - private Double orderMoney; - @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)<br/>" + - "小件物流订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待取货,5=送货中,6=已送达,7=待支付,8=需补差价,9=已取货,10=已取消,11=已支付差价)") + @ApiModelProperty("订单状态(101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中)") private Integer state; - @ApiModelProperty("人数") - private Integer peopleNumber; - @ApiModelProperty("下单用户") - private String user; - @ApiModelProperty("货物信息") - private String cargoNumber; - @ApiModelProperty("备注") - private String remark; - @ApiModelProperty("支付方式(1=OK平台支付(线上支付),2=其他方式支付(线下支付))") - private Integer payManner; - private Long travelTime; - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getTime() { - return time; - } - - public void setTime(String time) { - this.time = time; - } - - public String getStartAddress() { - return startAddress; - } - - public void setStartAddress(String startAddress) { - this.startAddress = startAddress; - } - - public String getEndAddress() { - return endAddress; - } - - public void setEndAddress(String endAddress) { - this.endAddress = endAddress; - } - - public Integer getState() { - return state; - } - - public void setState(Integer state) { - this.state = state; - } - - public Double getRedMoney() { - return redMoney; - } - - public void setRedMoney(Double redMoney) { - this.redMoney = redMoney; - } - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public Double getOrderMoney() { - return orderMoney; - } - - public void setOrderMoney(Double orderMoney) { - this.orderMoney = orderMoney; - } - - public Integer getPeopleNumber() { - return peopleNumber; - } - - public void setPeopleNumber(Integer peopleNumber) { - this.peopleNumber = peopleNumber; - } - - public String getUser() { - return user; - } - - public void setUser(String user) { - this.user = user; - } - - public String getRemark() { - return remark; - } - - public void setRemark(String remark) { - this.remark = remark; - } - - public Integer getPayManner() { - return payManner; - } - - public void setPayManner(Integer payManner) { - this.payManner = payManner; - } - - public Long getTravelTime() { - return travelTime; - } - - public void setTravelTime(Long travelTime) { - this.travelTime = travelTime; - } - - public String getCargoNumber() { - return cargoNumber; - } - - public void setCargoNumber(String cargoNumber) { - this.cargoNumber = cargoNumber; - } - - @Override - public String toString() { - return "OrderListWarpper{" + - "id=" + id + - ", type=" + type + - ", name='" + name + '\'' + - ", time='" + time + '\'' + - ", startAddress='" + startAddress + '\'' + - ", endAddress='" + endAddress + '\'' + - ", redMoney=" + redMoney + - ", orderMoney=" + orderMoney + - ", state=" + state + - ", peopleNumber=" + peopleNumber + - ", user='" + user + '\'' + - ", remark='" + remark + '\'' + - ", payManner=" + payManner + - '}'; - } - - public static List<OrderListWarpper> getOrderListWarpper(List<Map<String, Object>> maps){ - List<OrderListWarpper> list = new ArrayList<>(); - if(null != maps){ - for(Map<String, Object> map : maps){ - OrderListWarpper orderListWarpper = new OrderListWarpper(); - orderListWarpper.setId(null != map.get("id") ? Integer.valueOf(String.valueOf(map.get("id"))) : 0); - orderListWarpper.setName(null != map.get("name") ? String.valueOf(map.get("name")) : ""); - orderListWarpper.setTime(null != map.get("time") ? String.valueOf(map.get("time")) : ""); - orderListWarpper.setStartAddress(null != map.get("startAddress") ? String.valueOf(map.get("startAddress")) : ""); - orderListWarpper.setEndAddress(null != map.get("endAddress") ? String.valueOf(map.get("endAddress")) : ""); - orderListWarpper.setState(null != map.get("state") ? Integer.valueOf(String.valueOf(map.get("state"))) : 0); - orderListWarpper.setRedMoney(null != map.get("redMoney") ? Double.valueOf(String.valueOf(map.get("redMoney"))) : 0); - orderListWarpper.setOrderMoney(null != map.get("orderMoney") ? Double.valueOf(String.valueOf(map.get("orderMoney"))) : 0); - orderListWarpper.setType(null != map.get("type") ? Integer.valueOf(String.valueOf(map.get("type"))) : 0); - orderListWarpper.setPeopleNumber(null != map.get("peopleNumber") ? Integer.valueOf(String.valueOf(map.get("peopleNumber"))) : 0); - orderListWarpper.setUser(null != map.get("user") ? String.valueOf(map.get("user")) : ""); - orderListWarpper.setCargoNumber(null != map.get("cargoNumber") ? String.valueOf(map.get("cargoNumber")) : ""); - orderListWarpper.setRemark(null != map.get("remark") ? String.valueOf(map.get("remark")) : ""); - orderListWarpper.setPayManner(null != map.get("payManner") ? Integer.valueOf(String.valueOf(map.get("payManner"))) : 0); - orderListWarpper.setTravelTime(null != map.get("travelTime") ? Long.valueOf(String.valueOf(map.get("travelTime"))) : 0); - list.add(orderListWarpper); - } - } - Collections.sort(list); - return list; - } - - @Override - public int compareTo(Object o) { - if (o instanceof OrderListWarpper) { - OrderListWarpper s = (OrderListWarpper) o; - if(this.travelTime == null || s.travelTime == null){ - return -1; - } - if (this.travelTime > s.travelTime) { - return -1; - } else if (this.travelTime == s.travelTime) { - return 0; - } else { - return 1; - } - } - return 0; - } } diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderStatusWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderStatusWarpper.java deleted file mode 100644 index 6502544..0000000 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderStatusWarpper.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.supersavedriving.user.modular.system.warpper; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -@ApiModel("订单状态") -public class OrderStatusWarpper { - @ApiModelProperty("订单id") - private Integer orderId; - @ApiModelProperty("订单类型(1=专车,2=出租车,3=城际,4=小件物流-同城,5=小件物流-跨城,6=包车)") - private Integer orderType; - @ApiModelProperty("订单状态(1=待接单,2=待出发,3=待到达预约地点,4=待乘客上车,5=服务中,6=完成服务,7=待支付,8=待评价,9=已完成,10=已取消,11=改派中)") - private Integer state; - - public Integer getOrderId() { - return orderId; - } - - public void setOrderId(Integer orderId) { - this.orderId = orderId; - } - - public Integer getOrderType() { - return orderType; - } - - public void setOrderType(Integer orderType) { - this.orderType = orderType; - } - - public Integer getState() { - return state; - } - - public void setState(Integer state) { - this.state = state; - } -} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrdersWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrdersWarpper.java deleted file mode 100644 index 5076b58..0000000 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrdersWarpper.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.supersavedriving.user.modular.system.warpper; - -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; - -@ApiModel("可接单业务") -public class OrdersWarpper { - @ApiModelProperty("类型") - private Integer type; - @ApiModelProperty("类型名称") - private String name; - @ApiModelProperty("是否已设置(1=否,2=是)") - private Integer state; - - public Integer getType() { - return type; - } - - public void setType(Integer type) { - this.type = type; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public Integer getState() { - return state; - } - - public void setState(Integer state) { - this.state = state; - } -} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PriceRulesWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PriceRulesWarpper.java new file mode 100644 index 0000000..7d5b6c3 --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PriceRulesWarpper.java @@ -0,0 +1,20 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 14:16 + */ +@Data +@ApiModel +public class PriceRulesWarpper { + @ApiModelProperty("基础价格") + private String basePrice; + @ApiModelProperty("长途公里费用") + private String longDistanceCharges; + @ApiModelProperty("额外费") + private String additionalFee; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PushOrderInfoWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PushOrderInfoWarpper.java new file mode 100644 index 0000000..ccff87c --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/PushOrderInfoWarpper.java @@ -0,0 +1,24 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel +public class PushOrderInfoWarpper { + @ApiModelProperty("订单id") + private Long id; + @ApiModelProperty("司机纬度") + private String driverLat; + @ApiModelProperty("司机经度") + private String driverLng; + @ApiModelProperty("等待时长(分钟)") + private Integer waitTime; + @ApiModelProperty("行驶里程(公里)") + private Double actualMileage; + @ApiModelProperty("行驶时间(分钟)") + private Integer travelTime; + @ApiModelProperty("101=待接单,102=已接单,103=前往预约点,104=到达预约点,105=开始服务,106=到达目的地,107=待支付,108=待评价,109=已完成,201=转单中,301=已取消,401=等待中") + private Integer state; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/TravelOrder.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/TravelOrder.java index dfff124..55e3c97 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/TravelOrder.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/TravelOrder.java @@ -11,16 +11,16 @@ @Data @ApiModel public class TravelOrder { - @ApiModelProperty(value = "起点纬度", dataType = "double", required = true) - private Double startLat; - @ApiModelProperty(value = "起点经度", dataType = "double", required = true) - private Double startLng; + @ApiModelProperty(value = "起点纬度", dataType = "string", required = true) + private String startLat; + @ApiModelProperty(value = "起点经度", dataType = "string", required = true) + private String startLng; @ApiModelProperty(value = "起点地址", dataType = "string", required = true) private String startAddress; - @ApiModelProperty(value = "终点纬度", dataType = "double", required = false) - private Double endLat; - @ApiModelProperty(value = "终点经度", dataType = "double", required = false) - private Double endLng; + @ApiModelProperty(value = "终点纬度", dataType = "string", required = false) + private String endLat; + @ApiModelProperty(value = "终点经度", dataType = "string", required = false) + private String endLng; @ApiModelProperty(value = "终点地址", dataType = "string", required = false) private String endAddress; @ApiModelProperty(value = "司机数量", dataType = "int", required = true) diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfo.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfo.java new file mode 100644 index 0000000..bfb754c --- /dev/null +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfo.java @@ -0,0 +1,26 @@ +package com.supersavedriving.user.modular.system.warpper; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author zhibing.pu + * @date 2023/3/23 10:00 + */ +@Data +@ApiModel +public class UserInfo { + @ApiModelProperty(value = "头像", required = false, dataType = "string") + private String avatar; + @ApiModelProperty(value = "紧急联系人", required = false, dataType = "string") + private String emergencyContact; + @ApiModelProperty(value = "紧急联系人电话", required = false, dataType = "string") + private String emergencyPhone; + @ApiModelProperty(value = "姓名", required = false, dataType = "string") + private String nickname; + @ApiModelProperty(value = "手机号", required = false, dataType = "string") + private String phone; + @ApiModelProperty(value = "验证码", required = false, dataType = "string") + private String code; +} diff --git a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfoWarpper.java b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfoWarpper.java index fcf7df4..653ffab 100644 --- a/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfoWarpper.java +++ b/user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/UserInfoWarpper.java @@ -25,4 +25,6 @@ private String emergencyContact; @ApiModelProperty("紧急人电话") private String emergencyPhone; + @ApiModelProperty("客服电话") + private String serviceCell; } diff --git a/user/guns-admin/src/main/resources/application.yml b/user/guns-admin/src/main/resources/application.yml index bca63fa..3cdee0e 100644 --- a/user/guns-admin/src/main/resources/application.yml +++ b/user/guns-admin/src/main/resources/application.yml @@ -13,8 +13,8 @@ application: name: user-server profiles: - active: dev -# active: produce +# active: dev + active: produce mvc: static-path-pattern: /static/** view: @@ -50,20 +50,13 @@ --- -#spring: -# datasource: -# url: jdbc:mysql://Rm-wz9rpe0t74ys3b1h8go.mysql.rds.aliyuncs.com:3306/oktravel?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai -# username: root -# password: Root2020! -# db-name: guns #用来搜集数据库的所有表 -# filters: wall,mergeStat - spring: datasource: url: jdbc:mysql://127.0.0.1:3306/super_save_driving?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=Asia/Shanghai username: root - password: 123456 + password: f4OfRjqoN3jSiNGiUoiNsQdOBtCOKYRj +# password: 123456 db-name: guns #用来搜集数据库的所有表 filters: wall,mergeStat @@ -94,6 +87,7 @@ webAppSecret: 11 mchId: 1636941942 #微信支付分配的商户号 key: Eri2GR2SB3b6iIhaoD7k3KQ8X0wf1Ybh #key为商户平台设置的密钥key: + apiv3: AKJ51Z4nhSqYBxmOXgUyCKA1vLP0J5Aj #key为商户平台设置的密钥key: --- @@ -120,20 +114,21 @@ --- -filePath: /usr/local/server/orderPostionFile/ #存储订单轨迹文件路径 +filePath: /usr/local/server/app/orderPostionFile/ #存储订单轨迹文件路径 #filePath: C:/orderPostionFile/ #存储订单轨迹文件路径 #支付回调地址 #正式环境 -callbackPath: https://okyueche.com:443/user +#callbackPath: http://121.37.15.157:80/user #正式测试环境 -#callbackPath: http://39.108.148.228:80/user +callbackPath: http://121.37.15.157:80/user --- spring: data: mongodb: - uri: mongodb://127.0.0.1:27017/admin \ No newline at end of file + uri: mongodb://root:CEtyLdKjPk0yeHNo@127.0.0.1:27017/admin +# uri: mongodb://127.0.0.1:27017/admin \ No newline at end of file diff --git a/user/guns-admin/src/main/resources/logback-spring.xml b/user/guns-admin/src/main/resources/logback-spring.xml index 7a90601..08d7b97 100644 --- a/user/guns-admin/src/main/resources/logback-spring.xml +++ b/user/guns-admin/src/main/resources/logback-spring.xml @@ -7,8 +7,8 @@ <contextName>logback</contextName> <!-- name的值是变量的名称,value的值时变量定义的值。通过定义的值会被插入到logger上下文中。定义后,可以使“${}”来使用变量。 --> - <!--<property name="log.path" value="/usr/local/server/logs"/>--> - <property name="log.path" value="d:/logs/user"/> + <property name="log.path" value="/usr/local/server/app/logs"/> + <!--<property name="log.path" value="d:/logs/user"/>--> <!--0. 日志格式和颜色渲染 --> <!-- 彩色日志依赖的渲染类 --> diff --git a/user/guns-admin/src/main/resources/redis.properties b/user/guns-admin/src/main/resources/redis.properties index bc6b0e9..307358b 100644 --- a/user/guns-admin/src/main/resources/redis.properties +++ b/user/guns-admin/src/main/resources/redis.properties @@ -4,10 +4,17 @@ # Redis��������ַ spring.redis.host=127.0.0.1 # Redis���������Ӷ˿� -spring.redis.port=6379 +spring.redis.port=16379 # Redis�������������루Ĭ��Ϊ�գ� -spring.redis.password=123456 -#spring.redis.password= +spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ + +## Redis��������ַ +#spring.redis.host=127.0.0.1 +## Redis���������Ӷ˿� +#spring.redis.port=6379 +## Redis�������������루Ĭ��Ϊ�գ� +#spring.redis.password=123456 + # ���ӳ������������ʹ�ø�ֵ��ʾû�����ƣ� spring.redis.jedis.pool.max-active=1024 # ���ӳ���������ȴ�ʱ�䣨ʹ�ø�ֵ��ʾû�����ƣ� diff --git a/zuul/src/main/java/com/sinata/zuul/controller/NettyController.java b/zuul/src/main/java/com/sinata/zuul/controller/NettyController.java index b6d35fe..014a079 100644 --- a/zuul/src/main/java/com/sinata/zuul/controller/NettyController.java +++ b/zuul/src/main/java/com/sinata/zuul/controller/NettyController.java @@ -36,13 +36,6 @@ NettyServerController.sendMsgToClient(channel, msg); return JSON.toJSONString(ResultUtil.success()); } - - //智慧屏(设备号) - channel = NettyChannelMap.getData(id); - if(null != channel){ - NettyServerController.sendMsgToClient(channel, msg); - return JSON.toJSONString(ResultUtil.success()); - } return JSON.toJSONString(ResultUtil.error("推送失败-----用户id=" + id)); } diff --git a/zuul/src/main/java/com/sinata/zuul/util/applets/NettyWebSocketController.java b/zuul/src/main/java/com/sinata/zuul/util/applets/NettyWebSocketController.java index ee1364a..b7867cd 100644 --- a/zuul/src/main/java/com/sinata/zuul/util/applets/NettyWebSocketController.java +++ b/zuul/src/main/java/com/sinata/zuul/util/applets/NettyWebSocketController.java @@ -83,35 +83,30 @@ if (StringUtil.isNotEmpty(userId1)) { //确保账号在单个设备上登录 if (StringUtil.isNotEmpty(token)) { - NettyChannelMap.update_(token.substring(0, 23), ctx);//存储单点登录的通道 String token_ = redisUtil.getValue("USER_Applets_" + userId1);//获取缓存中最新的数据 if (StringUtil.isNotEmpty(token_) && !token.equals(token_)) {//不在同一设备上登录,向其他设备发送数据 + ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(0, 23)); JSONObject msg_ = new JSONObject(); msg_.put("code", 200); msg_.put("msg", "SUCCESS"); msg_.put("method", "OFFLINE"); msg_.put("data", new Object()); - this.sendMsgToClient(ctx, msg_.toJSONString()); - TimerTask timerTask = new TimerTask() { + this.sendMsgToClient(data_, msg_.toJSONString()); + new Timer().schedule(new TimerTask() { @Override public void run() { - NettyChannelMap.remove_(ctx); + NettyChannelMap.remove_(data_); } - }; - Timer timer = new Timer(); - timer.schedule(timerTask, 3000); - timer.cancel(); + }, 5000); } - if (StringUtil.isEmpty(token_)) {//确保登录的时候存储token失败的情况 - redisUtil.setStrValue("USER_Applets_" + userId1, token); - } + NettyChannelMap.update_(token.substring(0, 23), ctx);//存储单点登录的通道 + NettyChannelMap.update("Applets" + userId1, ctx); + redisUtil.setStrValue("USER_Applets_" + userId1, token); } //存储业务使用的通道 if (null != ctx && ctx.channel().isActive()) { NettyChannelMap.update("Applets" + userId1, ctx); -// String s = NettyMsg.setMsg(Method.ok, new HashMap<String, Object>()); -// ctx.writeAndFlush(Unpooled.copiedBuffer((s).getBytes())); } } diff --git a/zuul/src/main/java/com/sinata/zuul/util/echo/NettyChannelMap.java b/zuul/src/main/java/com/sinata/zuul/util/echo/NettyChannelMap.java index b27fd8f..db90e58 100644 --- a/zuul/src/main/java/com/sinata/zuul/util/echo/NettyChannelMap.java +++ b/zuul/src/main/java/com/sinata/zuul/util/echo/NettyChannelMap.java @@ -104,6 +104,11 @@ } } + + public static synchronized void remove_(String key) { + ctxMap.remove(key); + } + /** * Remove the data resources. diff --git a/zuul/src/main/java/com/sinata/zuul/util/echo/NettyServerController.java b/zuul/src/main/java/com/sinata/zuul/util/echo/NettyServerController.java index 1ebf342..b82f217 100644 --- a/zuul/src/main/java/com/sinata/zuul/util/echo/NettyServerController.java +++ b/zuul/src/main/java/com/sinata/zuul/util/echo/NettyServerController.java @@ -106,72 +106,56 @@ if(StringUtil.isNotEmpty(token)){ String token_ = redisUtil.getValue("USER_APP_"+ userId1);//获取缓存中最新的数据 if(StringUtil.isNotEmpty(token_) && !token.equals(token_)){//不在同一设备上登录,向其他设备发送数据 - JSONObject msg_ = new JSONObject(); + ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(0, 23)); + JSONObject msg_ = new JSONObject(); msg_.put("code", 200); msg_.put("msg", "SUCCESS"); msg_.put("method", "OFFLINE"); msg_.put("data", new Object()); - this.sendMsgToClient(ctx, msg_.toJSONString());//给当前通道发送消息 - TimerTask timerTask = new TimerTask() { + this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息 + new Timer().schedule(new TimerTask() { @Override public void run() { - NettyChannelMap.remove_(ctx); - NettyChannelMap.remove(ctx); + NettyChannelMap.remove_(data_); } - }; - Timer timer = new Timer(); - timer.schedule(timerTask, 3000); - timer.cancel(); - }else{ - NettyChannelMap.update_(token.substring(0, 23), ctx); - NettyChannelMap.update("USER" + userId1, ctx); - String s = NettyMsg.setMsg(Method.ok, new HashMap<String, Object>()); - ctx.writeAndFlush(Unpooled.copiedBuffer((s).getBytes())); - } - if(StringUtil.isEmpty(token_)){//确保登录的时候存储token失败的情况 - redisUtil.setStrValue("USER_APP_" + userId1, token); + }, 5000); } + NettyChannelMap.update_(token.substring(0, 23), ctx); + NettyChannelMap.update("USER" + userId1, ctx); + redisUtil.setStrValue("USER_APP_" + userId1, token); } + //存储通讯通道 + if(null != ctx && ctx.channel().isActive()){ + NettyChannelMap.update("USER" + userId1, ctx); + } }else{ //确保账号在单个设备上登录 - String value = redisUtil.getValue("DEVICE_" + userId1); - if(StringUtil.isNotEmpty(token) && StringUtil.isEmpty(device) && StringUtil.isEmpty(value)){//APP端登录的操作 + if(StringUtil.isNotEmpty(token)){//APP端登录的操作 String token_ = redisUtil.getValue("DRIVER_" + userId1);//缓存中拿最新数据 if(StringUtil.isNotEmpty(token_) && !token.equals(token_)){//不在同一设备上登录,向当前设备发送数据 - JSONObject msg_ = new JSONObject(); + ChannelHandlerContext data_ = NettyChannelMap.getData_(token_.substring(0, 23)); + JSONObject msg_ = new JSONObject(); msg_.put("code", 200); msg_.put("msg", "SUCCESS"); msg_.put("method", "OFFLINE"); msg_.put("data", new Object()); - this.sendMsgToClient(ctx, msg_.toJSONString());//给当前通道发送消息 - TimerTask timerTask = new TimerTask() { + this.sendMsgToClient(data_, msg_.toJSONString());//给当前通道发送消息 + new Timer().schedule(new TimerTask() { @Override public void run() { - NettyChannelMap.remove_(ctx); - NettyChannelMap.remove(ctx); + NettyChannelMap.remove_(data_); } - }; - Timer timer = new Timer(); - timer.schedule(timerTask, 3000); - timer.cancel(); - }else{ - NettyChannelMap.update("DRIVER" + userId1, ctx); - NettyChannelMap.update_(token.substring(0, 23), ctx); - String s = NettyMsg.setMsg(Method.ok, new HashMap<String, Object>()); - ctx.writeAndFlush(Unpooled.copiedBuffer((s).getBytes())); - } - if(StringUtil.isEmpty(token_)){//确保登录的时候存储token失败的情况 - redisUtil.setStrValue("DRIVER_" + userId1, token); + }, 5000); } + NettyChannelMap.update("DRIVER" + userId1, ctx); + NettyChannelMap.update_(token.substring(0, 23), ctx); + redisUtil.setStrValue("DRIVER_" + userId1, token); } - //存储通讯通道 if(null != ctx && ctx.channel().isActive()){ NettyChannelMap.update("DRIVER" + userId1, ctx); - String s = NettyMsg.setMsg(Method.ok, new HashMap<String, Object>()); - ctx.writeAndFlush(Unpooled.copiedBuffer((s).getBytes())); } } } diff --git a/zuul/src/main/resources/application.yml b/zuul/src/main/resources/application.yml index 206bc1d..b14faa5 100644 --- a/zuul/src/main/resources/application.yml +++ b/zuul/src/main/resources/application.yml @@ -1,5 +1,5 @@ server: - port: 80 + port: 81 spring: application: @@ -24,10 +24,6 @@ path: /driver/** #配置请求URL的请求规则 url: http://127.0.0.1:8007 #真正的微服务地址,path匹配的请求都转发到这里 serviceid: driver-server #指定Eureka注册中心的服务id - dispatch-server: #路由调度相关请求 - path: /dispatch/** #配置请求URL的请求规则 - url: http://127.0.0.1:8008 #真正的微服务地址,path匹配的请求都转发到这里 - serviceid: dispatch-server #指定Eureka注册中心的服务id # 配置zuul超时时间 host: connect-timeout-millis: 150000 diff --git a/zuul/src/main/resources/redis.properties b/zuul/src/main/resources/redis.properties index 7cb4d29..5d9655f 100644 --- a/zuul/src/main/resources/redis.properties +++ b/zuul/src/main/resources/redis.properties @@ -4,11 +4,16 @@ # Redis��������ַ spring.redis.host=127.0.0.1 # Redis���������Ӷ˿� -#spring.redis.port=16379 -spring.redis.port=6379 +spring.redis.port=16379 # Redis�������������루Ĭ��Ϊ�գ� -#spring.redis.password=mPMHThYzlT8DWgl8HLqwPEyPOiHDPPB5 -spring.redis.password=123456 +spring.redis.password=cKsEeyffDXG5PzNg8CIbrWxFluXrCprZ + +## Redis��������ַ +#spring.redis.host=127.0.0.1 +## Redis���������Ӷ˿� +#spring.redis.port=6379 +## Redis�������������루Ĭ��Ϊ�գ� +#spring.redis.password=123456 # ���ӳ������������ʹ�ø�ֵ��ʾû�����ƣ� spring.redis.jedis.pool.max-active=1024 # ���ӳ���������ȴ�ʱ�䣨ʹ�ø�ֵ��ʾû�����ƣ� -- Gitblit v1.7.1