diff --git a/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java b/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java
index 8f103bd..4d57d2d 100644
--- a/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java
+++ b/ridelease-admin/src/main/java/com/ruoyi/web/controller/app/AppVerifyController.java
@@ -110,10 +110,54 @@ public class AppVerifyController extends BaseController
public AjaxResult createOrder(@RequestBody RlOrderQuery order)
{
logger.info("【下单】请求参数:order={}", JSON.toJSON(order));
+ // 下单校验
+ orderCheck(order);
PrepayResponseVO orderServiceOrder = orderService.createOrder(order,getUserId());
return success(orderServiceOrder);
}
+ private void orderCheck(RlOrderQuery order) {
+ if(StringUtils.isEmpty(order.getOrderNo())){
+ throw new ServiceException("订单号不能为空");
+ }
+ // 车型id不能为空
+ if(order.getModelId() != null){
+ throw new ServiceException("车型id不能为空");
+ }
+ // 配送方式不能为空
+ if(order.getDeliveryMethod() != null){
+ throw new ServiceException("配送方式不能为空");
+ }
+ // 取车时间不能为空
+ if(ObjectUtil.isNotNull(order.getPickupTime())){
+ throw new ServiceException("取车时间不能为空");
+ }
+ // 取车经纬度不能为空
+ if(StringUtils.isEmpty(order.getPickupLon()) && StringUtils.isEmpty(order.getPickupLat())){
+ throw new ServiceException("取车经度不能为空");
+ }
+ // ruleId不能为空
+ if(order.getRuleId() != null){
+ throw new ServiceException("计费规则id不能为空");
+ }
+ // agentId不能为空
+ if(order.getAgentId() != null){
+ throw new ServiceException("代理商id不能为空");
+ }
+ // storeId不能为空
+ if(order.getStoreId() != null){
+ throw new ServiceException("门店id不能为空");
+ }
+ // 数量num不能为空
+ if(order.getNum() != null){
+ throw new ServiceException("数量不能为空");
+ }
+ // 订单类型type不能为空
+ if(order.getType() != null){
+ throw new ServiceException("订单类型不能为空");
+ }
+ }
+
/**
* 确认支付
*/
diff --git a/ridelease-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java b/ridelease-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java
index 6c38895..c1c4d02 100644
--- a/ridelease-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java
+++ b/ridelease-common/src/main/java/com/ruoyi/common/constant/ServiceConstants.java
@@ -673,4 +673,33 @@ public class ServiceConstants {
public static final String RETURN_METHOD_PICKUP = "2";
/**----------------------------还车方式end----------------------------*/
+
+ /**----------------------------业务类型start----------------------------*/
+ /** 业务类型:1-骑行订单;2-押金订单;3-押金订单退款;4-骑行订单退款(包含调度费、停车点外调度费)5-提现;6-提现失败;7-车损收入;8-短信扣费 */
+ /** 业务类型:1-骑行订单 */
+ public static final String RIDE_ORDER = "1";
+
+ /** 业务类型:2-押金订单 */
+ public static final String DEPOSIT_ORDER = "2";
+
+ /** 业务类型:3-押金订单退款 */
+ public static final String DEPOSIT_REFUND_ORDER = "3";
+
+ /** 业务类型:4-骑行订单退款(包含调度费、停车点外调度费) */
+ public static final String RIDE_REFUND_ORDER = "4";
+
+ /** 业务类型:5-提现 */
+ public static final String WITHDRAWAL = "5";
+
+ /** 业务类型:6-提现失败 */
+ public static final String WITHDRAWAL_FAILURE = "6";
+
+ /** 业务类型:7-车损收入 */
+ public static final String CAR_DAMAGE_INCOME = "7";
+
+ /** 业务类型:8-短信扣费 */
+ public static final String SMS_FEE_DEDUCTION = "8";
+
+ /**----------------------------业务类型end----------------------------*/
+
}
diff --git a/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java b/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java
index 42986f6..bb27c4e 100644
--- a/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java
+++ b/ridelease-system/src/main/java/com/ruoyi/system/domain/order/RlOrder.java
@@ -35,6 +35,14 @@ public class RlOrder extends BaseEntity
@Excel(name = "用户ID")
private Long userId;
+ /** 用户名 */
+ @Excel(name = "用户名")
+ private String userName;
+
+ /** 手机号 */
+ @Excel(name = "手机号")
+ private String phone;
+
/** 计费规则id */
@Excel(name = "计费规则id")
private Long ruleId;
@@ -235,4 +243,7 @@ public class RlOrder extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "支付时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date autoCancelTime;
+
+ /** 成本 */
+ private BigDecimal cost;
}
diff --git a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java
index 618fc66..985ecd6 100644
--- a/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java
+++ b/ridelease-system/src/main/java/com/ruoyi/system/mapper/RlUserMapper.java
@@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.entity.RlUserVO;
import com.ruoyi.common.core.domain.vo.LabelVo;
import org.apache.ibatis.annotations.Param;
+import java.math.BigDecimal;
import java.util.List;
/**
@@ -184,4 +185,12 @@ public interface RlUserMapper
* 更新用户密码
*/
int updateUserPwd(@Param("userId") Long userId, @Param("password") String password);
+
+ /**
+ * 获取用户余额
+ *
+ * @param userId 用户id
+ * @return 结果
+ */
+ BigDecimal selectUserBalanceById(Long userId);
}
diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/CallbackService.java b/ridelease-system/src/main/java/com/ruoyi/system/service/CallbackService.java
index bb56aa0..236046d 100644
--- a/ridelease-system/src/main/java/com/ruoyi/system/service/CallbackService.java
+++ b/ridelease-system/src/main/java/com/ruoyi/system/service/CallbackService.java
@@ -21,7 +21,7 @@ public interface CallbackService {
* @param outTradeNo
* @return String
*/
- public void businessHandle(String outTradeNo,AttachVo attachVo,String payType);
+ public void businessHandle(String outTradeNo,String payType);
/**
* 微信退款回调
diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlUserService.java b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlUserService.java
index 325ccf2..31ed9f2 100644
--- a/ridelease-system/src/main/java/com/ruoyi/system/service/IRlUserService.java
+++ b/ridelease-system/src/main/java/com/ruoyi/system/service/IRlUserService.java
@@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.entity.RlUser;
import com.ruoyi.system.domain.query.AuthenticationQuery;
+import java.math.BigDecimal;
import java.util.List;
/**
@@ -365,4 +366,12 @@ public interface IRlUserService
* @param roleIds 角色组
*/
public void insertUserAuth(Long userId, Long[] roleIds);
+
+ /**
+ * 获取用户余额
+ *
+ * @param userId 用户id
+ * @return 结果
+ */
+ BigDecimal selectUserBalanceById(Long userId);
}
diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java
index 7f65be3..3e5a6bb 100644
--- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java
+++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/CallbackServiceImpl.java
@@ -2,19 +2,18 @@ package com.ruoyi.system.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.ServiceConstants;
-import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.pay.wx.domain.NotifyEventType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.http.HttpUtils;
import com.ruoyi.system.domain.EtCallbackLog;
+import com.ruoyi.system.domain.changeBalance.RlChangeBalance;
import com.ruoyi.system.domain.channel.ChannelVO;
import com.ruoyi.system.domain.order.RlOrder;
import com.ruoyi.system.domain.refund.RlRefund;
-import com.ruoyi.system.domain.vo.AttachVo;
+import com.ruoyi.system.domain.rule.RlFeeRule;
import com.ruoyi.system.mapper.EtCallbackLogMapper;
import com.ruoyi.system.service.*;
import com.wechat.pay.java.core.RSAAutoCertificateConfig;
@@ -28,7 +27,6 @@ import com.wechat.pay.java.service.refund.model.Status;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.support.TransactionTemplate;
@@ -36,6 +34,7 @@ import org.springframework.transaction.support.TransactionTemplate;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
+import java.util.Date;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -52,7 +51,7 @@ public class CallbackServiceImpl implements CallbackService {
private IRlOrderService orderService;
@Autowired
- private RedisCache redisCache;
+ private IRlFeeRuleService feeRuleService;
@Resource
private IRlRefundService etRefundService;
@@ -69,23 +68,11 @@ public class CallbackServiceImpl implements CallbackService {
@Autowired
private RlChannelService rlChannelService;
- @Value("${aliyun.accessKeyId}")
- private String accessKeyId;
+ @Autowired
+ private IRlUserService userService;
- @Value("${aliyun.accessKeySecret}")
- private String accessKeySecret;
-
- @Value("${aliyun.signName}")
- private String signName;
-
- @Value("${aliyun.templateCode}")
- private String templateCode;
-
- @Value("${aliyun.templateCode2}")
- private String templateCode2;
-
-// @Resource
-// private EtMsgLogMapper etMsgLogMapper;
+ @Autowired
+ private IRlChangeBalanceService changeBalanceService;
/**
@@ -112,144 +99,85 @@ public class CallbackServiceImpl implements CallbackService {
if (Transaction.TradeStateEnum.SUCCESS.equals(transaction.getTradeState())) {
// 充值成功后的业务处理
etCallbackLog.setBody(JSON.toJSONString(transaction));
- AttachVo attachVo = JSONObject.parseObject(transaction.getAttach(),AttachVo.class);
- businessHandle(transaction.getOutTradeNo(), attachVo, ServiceConstants.PAY_TYPE_WX);//业务处理
+ businessHandle(transaction.getOutTradeNo(), ServiceConstants.PAY_TYPE_WX);//业务处理
}
}
}
/**
* 支付成功后的业务处理
+ * 1. 更改订单状态,订单到期时间修改,账变记录保存至订单
+ * 2. 生成配送工单
+ * 3. 生成账变记录
*/
@Override
- public void businessHandle(String outTradeNo,AttachVo attachVo,String payType) {
+ public void businessHandle(String outTradeNo,String payType) {
// 充值成功后的业务处理
RlOrder order = orderService.selectRlOrderByOutTradeNo(outTradeNo);
RlOrder order1 = new RlOrder();
order1.setOrderId(order.getOrderId());
logger.info("【微信支付回调】订单信息 : " + JSON.toJSONString(order));
- logger.info("【微信支付回调】========== orderId : " + order.getOrderId());
-
Long payChannel = order.getPayChannel();
ChannelVO channelVO = rlChannelService.selectSmChannelByChannelId(payChannel);
-// AsUser asUser = asUserMapper.selectUserById(order.getUserId());
-// /** 支付回调逻辑 1. 处理预约还是开锁 电压 */
-// AsDevice asDevice = null;
-// if(StrUtil.isNotBlank(order.getSn())){
-// asDevice = asDeviceMapper.selectAsDeviceBySn(order.getSn());
-// }
-// if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_RIDING)){
-// logger.info("【微信支付回调】骑行支付");
-// // 1-骑行支付 关锁
-// EtOperatingArea area = etOperatingAreaService.selectEtOperatingAreaByAreaId(order.getAreaId());
-// order1.setMark("骑行支付");
-// logger.info("=================【微信支付回调】11111111==================");
-// if(ServiceConstants.RETURN_VERIFY_YES.equals(area.getReturnVerify())){
-// logger.info("【微信支付回调】还车-----需要-----拍照审核");
-// order1.setStatus(ServiceConstants.ORDER_STATUS_TO_BE_AUDIT);//如果还车需要拍照审核,状态为待审核
-// BigDecimal amount = order.getPayFee();
-//
-// // 异步处理短信
-// if("1".equals(area.getMsgSwitch())){
-// asynchronousMsg(order, amount);
-// }
-// }else{
-// logger.info("【微信支付回调】还车-----不需要-----拍照审核");
-// order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
-// // 还车结算___小时后自动退押金---创建一个定时器TimerTask,计算出退还时间后,执行退款操作
-// logger.info("=================【微信支付回调】22222222==================");
-// // 退还押金处理
-// refundDeposit(area.getDeposit(), order, asUser);
-// logger.info("=================【微信支付回调】33333333==================");
-// // 用户付款通知
-// if("1".equals(area.getMsgSwitch())){
-// asynchronousMsg2(order);
-// }
-// }
-// asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//还车后车辆正常运营
-// asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
-// // 新增资金流水记录
-// EtCapitalFlow capitalFlow = capitalFlowRecords(order, ServiceConstants.FLOW_TYPE_INCOME, ServiceConstants.ORDER_TYPE_RIDING, ServiceConstants.OWNER_TYPE_OPERATOR, null, ServiceConstants.PAY_TYPE_WX);
-// logger.info("=================【微信支付回调-新增资金流水记录后】=================={}",JSON.toJSON(capitalFlow));
-// order1.setHandlingCharge(capitalFlow.getHandlingCharge());
-// order1.setPlatformServiceFee(capitalFlow.getPlatformServiceFee());
-// order1.setOperatorDividend(capitalFlow.getOperatorDividend());
-// order1.setCost(getCost(channelVO,order.getPayFee()));
-// logger.info("=================【微信支付回调】4444444==================");
-// }else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_APPOINTMENT)){
-// logger.info("【微信支付回调】取消预约支付");
-// // 2-取消预约支付
-// order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
-// order1.setMark("取消预约支付");
-// asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_NORMAL);//取消预约支付后车辆正常运营
-// asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_CLOSE);
-// }else if(attachVo.getType().equals(ServiceConstants.ORDER_TYPE_COUPON)){
-// /** 优惠券订单 */
-// logger.info("【微信支付回调】优惠券支付");
-// // 3-优惠券支付
-// order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
-// order1.setMark("优惠券支付");
-// // 优惠券成功处理逻辑
-// couponSuccessHandle(order);
-// }else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_DEPOSIT)){
-// logger.info("【微信支付回调】押金支付");
-// // 4-押金支付
-// order1.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
-// asUser.setBalance(order.getTotalFee());
-// order1.setMark("押金支付");
-// // 删除用户缓存
-// String token = attachVo.getToken();
-// logger.info("【微信支付回调】删除用户缓存:"+token);
-// if (StringUtils.isNotNull(token))
-// {
-// redisCache.deleteObject(CacheConstants.LOGIN_TOKEN_KEY + token);
-// }
-// }else{
-// logger.error("【微信支付回调】 : 支付场景不存在");
-// throw new ServiceException("【微信支付回调】支付场景不存在");
-// }
-// if(ObjectUtil.isNotNull(asDevice)){
-// int device = asDeviceService.updateAsDevice(asDevice);
-// if(device==0){
-// logger.error("【微信支付回调】更新车辆状态失败");
-// throw new ServiceException("【微信支付回调】更新车辆状态失败");
-// }
-// }
-//
-// Boolean execute = transactionTemplate.execute(e -> {
-// order1.setPaid("1");
-// order1.setPayTime(DateUtils.getNowDate());
-// order1.setPayType(payType);
-// order1.setLocking("0");
-// // 如果使用了优惠券则扣除一次使用次数
-// if(ObjectUtil.isNotNull(order.getLogId())){
-// EtCouponUserLog couponUserLog = etCouponClaimLogMapper.selectEtCouponClaimLogByLogId(order.getLogId());
-// EtCoupon etCoupon = etCouponMapper.selectEtCouponByCouponId(couponUserLog.getCouponId());
-// logger.info("【微信支付回调】优惠券信息 : " + JSON.toJSONString(etCoupon));
-// if(ObjectUtil.isNotNull(etCoupon) && (etCoupon.getType().equals(ServiceConstants.COUPON_TYPE_DISCOUNT_CARD) || etCoupon.getType().equals(ServiceConstants.COUPON_TYPE_VOUCHER)) && couponUserLog.getLimitNum() > 0){
-// etCouponClaimLogMapper.deductLimitNum(couponUserLog.getLogId());
-// logger.info("【微信支付回调】优惠券使用次数-1");
-// }
-// }
-// logger.info("=================【微信支付回调】开始更新订单信息=================={}",JSON.toJSON(order1));
-// int updateEtOrder = orderService.updateEtOrder(order1);
-// if(updateEtOrder==0){
-// logger.error("【微信支付回调】更新订单信息失败");
-// throw new ServiceException("【微信支付回调】更新订单信息失败");
-// }
-// if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_DEPOSIT)){
-// logger.info("=================【微信支付回调】开始更新用户信息==================");
-// int updateUser = userService.updateUser(asUser);
-// if(updateUser==0){
-// logger.error("【微信支付回调】更新用户押金失败");
-// throw new ServiceException("【微信支付回调】更新用户押金失败");
-// }
-// }
-// logger.info("=================【微信支付回调】全部结束!!!!!==================");
-// return Boolean.TRUE;
-// });
-// if(!execute)throw new ServiceException("管理员开锁失败");
+ logger.info("【微信支付回调】租赁订单支付");
+
+ /** 计算到期时间*/
+ calculateExpiryTime(order);
+
+ Boolean execute = transactionTemplate.execute(e -> {
+ /** 生成账变记录*/
+ generateChanggeBalance(order);
+ order1.setPaid("1");
+ order1.setPayTime(DateUtils.getNowDate());
+ order1.setPayType(payType);
+ order1.setCost(getCost(channelVO,order.getPayFee()));
+ logger.info("=================【微信支付回调】开始更新订单信息=================={}",JSON.toJSON(order1));
+ int updateEtOrder = orderService.updateRlOrder(order1);
+ if(updateEtOrder==0){
+ logger.error("【微信支付回调】更新订单信息失败");
+ throw new ServiceException("【微信支付回调】更新订单信息失败");
+ }
+ logger.info("=================【微信支付回调】全部结束!!!!!==================");
+ return Boolean.TRUE;
+ });
+ if(!execute)throw new ServiceException("微信支付回调失败");
+ }
+
+
+ private void generateChanggeBalance(RlOrder order) {
+ RlChangeBalance rlChangeBalance = new RlChangeBalance();
+ rlChangeBalance.setOrderNo(order.getOrderNo());
+ rlChangeBalance.setOutTradeNo(order.getOutTradeNo());
+ rlChangeBalance.setType("1");
+ rlChangeBalance.setBusType(ServiceConstants.RIDE_ORDER);
+ BigDecimal balance = userService.selectUserBalanceById(order.getUserId());
+ rlChangeBalance.setBeforeBalance(balance);
+ rlChangeBalance.setAfterBalance(balance.add(order.getPayFee()));
+ rlChangeBalance.setAmount(order.getPayFee());
+ rlChangeBalance.setOwnerId(order.getUserId());
+ rlChangeBalance.setOwnerName(order.getUserName());
+ rlChangeBalance.setOwnerPhone(order.getPhone());
+ rlChangeBalance.setCreateTime(DateUtils.getNowDate());
+ rlChangeBalance.setReason("租赁订单:"+ order.getOrderNo());
+ int i = changeBalanceService.insertRlChangeBalance(rlChangeBalance);
+ if(i>0){
+ logger.info("【微信支付回调】账变记录插入成功");
+ }
+ }
+
+ private void calculateExpiryTime(RlOrder order) {
+ /** 如果是租赁订单,根据取车时间计算到期时间
+ * 如果是续费订单,根据到期时间计算续费订单的到期时间 */
+ RlFeeRule feeRule = feeRuleService.selectRlFeeRuleByRuleId(order.getRuleId());
+ Date startTime = null;
+ if(order.getType().equals(ServiceConstants.ORDER_TYPE_LEASE)){
+ startTime = order.getPickupTime();
+ }else{
+ startTime = order.getExpiryTime();
+ }
+ Date expiryTime = DateUtils.getTimeAfterXUnit(startTime, order.getNum(), feeRule.getRentalUnit());
+ order.setExpiryTime(expiryTime);
}
private BigDecimal getCost(ChannelVO channel,BigDecimal payFee) {
diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java
index fed488e..743673d 100644
--- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java
+++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlOrderServiceImpl.java
@@ -312,16 +312,6 @@ public class RlOrderServiceImpl implements IRlOrderService
order.setOutUnit(feeRule.getOutUnit());
order.setOutPrice(feeRule.getOutPrice());
order.setRentalUnit(feeRule.getRentalUnit());
- /** 如果是租赁订单,根据取车时间计算到期时间
- * 如果是续费订单,根据到期时间计算续费订单的到期时间 */
- Date startTime = null;
- if(order.getType().equals(ServiceConstants.ORDER_TYPE_LEASE)){
- startTime = order.getPickupTime();
- }else{
- startTime = order.getExpiryTime();
- }
- Date expiryTime = DateUtils.getTimeAfterXUnit(startTime, order.getNum(), feeRule.getRentalUnit());
- order.setExpiryTime(expiryTime);
}
/**
diff --git a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java
index e4c125a..10f291e 100644
--- a/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java
+++ b/ridelease-system/src/main/java/com/ruoyi/system/service/impl/RlUserServiceImpl.java
@@ -662,6 +662,17 @@ public class RlUserServiceImpl implements IRlUserService{
insertUserRole(userId, roleIds);
}
+ /**
+ * 获取用户余额
+ *
+ * @param userId 用户id
+ * @return 结果
+ */
+ @Override
+ public BigDecimal selectUserBalanceById(Long userId) {
+ return rlUserMapper.selectUserBalanceById(userId);
+ }
+
/**
* 新增用户岗位信息
*
diff --git a/ridelease-system/src/main/resources/mapper/system/RlOrderMapper.xml b/ridelease-system/src/main/resources/mapper/system/RlOrderMapper.xml
index 0d66d0a..e607d5e 100644
--- a/ridelease-system/src/main/resources/mapper/system/RlOrderMapper.xml
+++ b/ridelease-system/src/main/resources/mapper/system/RlOrderMapper.xml
@@ -7,11 +7,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
- select order_id, order_no, out_trade_no, user_id, rule_id, device_mac, sn, pay_time, pay_type, paid, type, total_fee, pay_fee, deposit, overdue_fee, dispatch_fee,delivery_fee,
+ select order_id, order_no, out_trade_no, user_id, user_name, phone, rule_id, device_mac, sn, pay_time, pay_type, paid, type, total_fee, pay_fee, deposit, overdue_fee, dispatch_fee,delivery_fee,
lease_fee, mark, duration, status, create_time, return_time, deposit_deduction, deposit_order_no, deduction_amount, used_sn, change_reason,
auto_refund_deposit, rental_unit, handling_charge, platform_service_fee, operator_dividend, pay_channel, delivery_method, pickup_time,
agent_id, store_id, merchant_id, pickup_city, pickup_loc, pickup_lon, pickup_lat, model_id, expiry_time, original_order_no, num, price, `explain`,
- instructions, out_unit, out_price,return_type,return_method,address,auto_cancel_time from rl_order
+ instructions, out_unit, out_price,return_type,return_method,address,auto_cancel_time,cost from rl_order
@@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.order_no,
o.out_trade_no,
o.user_id,
+ o.user_name,
+ o.phone,
o.rule_id,
o.device_mac,
o.sn,
@@ -79,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
o.address,
o.auto_cancel_time,
o.merchant_id,
+ o.cost,
CONCAT(
CASE
WHEN r.rental_unit = 'hours' THEN '时租'
@@ -115,6 +118,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and o.order_no = #{orderNo}
and o.out_trade_no = #{outTradeNo}
and o.user_id = #{userId}
+ and u.user_name like concat('%', #{userName}, '%')
+ and u.phone like concat('%', #{phone}, '%')
and o.rule_id = #{ruleId}
and o.device_mac = #{deviceMac}
and o.sn = #{sn}
@@ -167,6 +172,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and order_no = #{orderNo}
and out_trade_no = #{outTradeNo}
and user_id = #{userId}
+ and u.user_name like concat('%', #{userName}, '%')
+ and u.phone like concat('%', #{phone}, '%')
and status = #{status}
and paid = #{paid}
@@ -192,6 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order_no,
out_trade_no,
user_id,
+ user_name,
+ phone,
rule_id,
device_mac,
sn,
@@ -243,11 +252,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
return_method,
address,
auto_cancel_time,
+ cost,
#{orderNo},
#{outTradeNo},
#{userId},
+ #{userName},
+ #{phone},
#{ruleId},
#{deviceMac},
#{sn},
@@ -299,6 +311,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{returnMethod},
#{address},
#{autoCancelTime},
+ #{cost},
@@ -308,6 +321,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order_no = #{orderNo},
out_trade_no = #{outTradeNo},
user_id = #{userId},
+ user_name = #{userName},
+ phone = #{phone},
rule_id = #{ruleId},
device_mac = #{deviceMac},
sn = #{sn},
@@ -359,6 +374,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
return_method = #{returnMethod},
address = #{address},
auto_cancel_time = #{autoCancelTime},
+
where order_id = #{orderId}
@@ -369,6 +385,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order_no = #{orderNo},
out_trade_no = #{outTradeNo},
user_id = #{userId},
+ user_name = #{userName},
+ phone = #{phone},
rule_id = #{ruleId},
device_mac = #{deviceMac},
sn = #{sn},
@@ -417,6 +435,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
out_unit = #{outUnit},
out_price = #{outPrice},
return_type = #{returnType},
+ cost = #{cost},
where order_no = #{orderNo}
diff --git a/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml b/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml
index bf1a5f1..22ec2a3 100644
--- a/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml
+++ b/ridelease-system/src/main/resources/mapper/system/RlUserMapper.xml
@@ -152,7 +152,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-
+
+
+
insert into rl_user(
user_id,
user_name,