下单校验

用户余额
This commit is contained in:
邱贞招 2024-10-06 09:00:55 +08:00
parent 1585e00184
commit fc0d19d7f9
11 changed files with 212 additions and 157 deletions

View File

@ -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("订单类型不能为空");
}
}
/**
* 确认支付
*/

View File

@ -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----------------------------*/
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
/**
* 微信退款回调

View File

@ -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);
}

View File

@ -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) {

View File

@ -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);
}
/**

View File

@ -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);
}
/**
* 新增用户岗位信息
*

View File

@ -7,11 +7,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<resultMap type="RlOrderVO" id="RlOrderResult" autoMapping="true"/>
<sql id="selectRlOrderVo">
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
</sql>
<sql id="selectRlOrderDetail">
@ -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"
<if test="orderNo != null and orderNo != ''"> and o.order_no = #{orderNo}</if>
<if test="outTradeNo != null and outTradeNo != ''"> and o.out_trade_no = #{outTradeNo}</if>
<if test="userId != null"> and o.user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
<if test="phone != null and phone != ''"> and u.phone like concat('%', #{phone}, '%')</if>
<if test="ruleId != null"> and o.rule_id = #{ruleId}</if>
<if test="deviceMac != null and deviceMac != ''"> and o.device_mac = #{deviceMac}</if>
<if test="sn != null and sn != ''"> and o.sn = #{sn}</if>
@ -167,6 +172,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderNo != null and orderNo != ''"> and order_no = #{orderNo}</if>
<if test="outTradeNo != null and outTradeNo != ''"> and out_trade_no = #{outTradeNo}</if>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="userName != null and userName != ''"> and u.user_name like concat('%', #{userName}, '%')</if>
<if test="phone != null and phone != ''"> and u.phone like concat('%', #{phone}, '%')</if>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="paid != null and paid != ''"> and paid = #{paid}</if>
</where>
@ -192,6 +199,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderNo != null and orderNo != ''">order_no,</if>
<if test="outTradeNo != null">out_trade_no,</if>
<if test="userId != null">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>
<if test="phone != null and phone != ''">phone,</if>
<if test="ruleId != null">rule_id,</if>
<if test="deviceMac != null">device_mac,</if>
<if test="sn != null">sn,</if>
@ -243,11 +252,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="returnMethod != null">return_method,</if>
<if test="address != null">address,</if>
<if test="autoCancelTime != null">auto_cancel_time,</if>
<if test="cost != null">cost,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderNo != null and orderNo != ''">#{orderNo},</if>
<if test="outTradeNo != null">#{outTradeNo},</if>
<if test="userId != null">#{userId},</if>
<if test="userName != null and userName != ''">#{userName},</if>
<if test="phone != null and phone != ''">#{phone},</if>
<if test="ruleId != null">#{ruleId},</if>
<if test="deviceMac != null">#{deviceMac},</if>
<if test="sn != null">#{sn},</if>
@ -299,6 +311,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="returnMethod != null">#{returnMethod},</if>
<if test="address != null">#{address},</if>
<if test="autoCancelTime != null">#{autoCancelTime},</if>
<if test="cost != null">#{cost},</if>
</trim>
</insert>
@ -308,6 +321,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="outTradeNo != null">out_trade_no = #{outTradeNo},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="deviceMac != null">device_mac = #{deviceMac},</if>
<if test="sn != null">sn = #{sn},</if>
@ -359,6 +374,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="returnMethod != null">return_method = #{returnMethod},</if>
<if test="address != null">address = #{address},</if>
<if test="autoCancelTime != null">auto_cancel_time = #{autoCancelTime},</if>
</trim>
where order_id = #{orderId}
</update>
@ -369,6 +385,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderNo != null and orderNo != ''">order_no = #{orderNo},</if>
<if test="outTradeNo != null">out_trade_no = #{outTradeNo},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="userName != null and userName != ''">user_name = #{userName},</if>
<if test="phone != null and phone != ''">phone = #{phone},</if>
<if test="ruleId != null">rule_id = #{ruleId},</if>
<if test="deviceMac != null">device_mac = #{deviceMac},</if>
<if test="sn != null">sn = #{sn},</if>
@ -417,6 +435,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="outUnit != null">out_unit = #{outUnit},</if>
<if test="outPrice != null">out_price = #{outPrice},</if>
<if test="returnType != null">return_type = #{returnType},</if>
<if test="cost != null">cost = #{cost},</if>
</trim>
where order_no = #{orderNo}
</update>

View File

@ -152,7 +152,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
</select>
<insert id="insertUser" parameterType="RlUser" useGeneratedKeys="true" keyProperty="userId">
<select id="selectUserBalanceById" resultType="java.math.BigDecimal">
select balance from rl_user_ext
where user_id = #{userId}
</select>
<insert id="insertUser" parameterType="RlUser" useGeneratedKeys="true" keyProperty="userId">
insert into rl_user(
<if test="userId != null and userId != 0">user_id,</if>
<if test="userName != null and userName != ''">user_name,</if>