From eaa20cb58afc80e3612fd6e93d6f27e181a027e7 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 07 四月 2023 17:38:29 +0800 Subject: [PATCH] 提交用户端开发版本 --- user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/impl/BillServiceImpl.java | 81 + user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/NotInvoiceOrder.java | 26 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/util/huawei/SMSUtil.java | 9 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 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/OrderMapper.java | 23 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/ISystemConfigService.java | 9 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 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 +++ user/guns-admin/src/main/resources/application.yml | 25 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderListWarpper.java | 231 ----- 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 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 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/dao/mapping/BillMapper.xml | 35 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 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/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 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 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/model/AccountChangeDetail.java | 10 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/CouponWarpper.java | 2 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/OrderInfoWarpper.java | 14 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 + 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 + 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 /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 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/model/Order.java | 5 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/service/IBillService.java | 37 user/guns-admin/src/main/java/com/supersavedriving/user/modular/system/warpper/Invoicing.java | 30 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 56 files changed, 2,070 insertions(+), 344 deletions(-) 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 # ���ӳ���������ȴ�ʱ�䣨ʹ�ø�ֵ��ʾû�����ƣ� -- Gitblit v1.7.1