1. 联调
This commit is contained in:
parent
59c3ff74c8
commit
ba9f9fa754
|
@ -144,10 +144,10 @@ public class AppVerifyController extends BaseController
|
||||||
if(order.getRuleId()==null){
|
if(order.getRuleId()==null){
|
||||||
return error("=============================================ruleId未传!!!=============================================");
|
return error("=============================================ruleId未传!!!=============================================");
|
||||||
}
|
}
|
||||||
//设备是否在线
|
// //设备是否在线
|
||||||
if(!asDeviceService.isOnline(order.getSn())){
|
// if(!asDeviceService.isOnline(order.getSn())){
|
||||||
return error("设备不在线");
|
// return error("设备不在线");
|
||||||
}
|
// }
|
||||||
//实名判断
|
//实名判断
|
||||||
if(!asUserService.checkIsAuthentication(order.getUserId())){
|
if(!asUserService.checkIsAuthentication(order.getUserId())){
|
||||||
return error("您还未实名,请先实名");
|
return error("您还未实名,请先实名");
|
||||||
|
@ -265,16 +265,15 @@ public class AppVerifyController extends BaseController
|
||||||
if(userId!=null){
|
if(userId!=null){
|
||||||
AsUser asUser = asUserService.selectUserById(userId);
|
AsUser asUser = asUserService.selectUserById(userId);
|
||||||
if(asUser!=null){
|
if(asUser!=null){
|
||||||
BigDecimal result = asUser.getBalance().subtract(deposit);
|
int comparisonResult = deposit.compareTo(BigDecimal.ZERO);
|
||||||
int comparisonResult = result.compareTo(BigDecimal.ZERO);
|
|
||||||
if (comparisonResult < 0) {
|
if (comparisonResult < 0) {
|
||||||
throw new ServiceException("余额不足,扣除押金后余额小于0");
|
throw new ServiceException("余额不足,扣除押金后余额小于0");
|
||||||
}
|
}
|
||||||
asUser.setBalance(result);//更新用余额
|
asUser.setBalance(deposit);//更新用余额
|
||||||
// 更新用户并更新缓存
|
// 更新用户并更新缓存
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
AsUser currentUser = loginUser.getAsUser();
|
AsUser currentUser = loginUser.getAsUser();
|
||||||
currentUser.setBalance(result);
|
currentUser.setBalance(deposit);
|
||||||
if (asUserService.updateUserProfile(currentUser) > 0)
|
if (asUserService.updateUserProfile(currentUser) > 0)
|
||||||
{
|
{
|
||||||
logger.info("【提现金额】更新用户缓存:"+ JSON.toJSON(currentUser));
|
logger.info("【提现金额】更新用户缓存:"+ JSON.toJSON(currentUser));
|
||||||
|
@ -661,7 +660,7 @@ public class AppVerifyController extends BaseController
|
||||||
int updateUser = asUserService.updateUser(asUser);
|
int updateUser = asUserService.updateUser(asUser);
|
||||||
if (updateUser>0)
|
if (updateUser>0)
|
||||||
{
|
{
|
||||||
logger.info("【提现金额】保存身份信息成功");
|
logger.info("【实名认证】保存身份信息成功");
|
||||||
// 更新缓存用户信息
|
// 更新缓存用户信息
|
||||||
tokenService.setLoginUser(loginUser);
|
tokenService.setLoginUser(loginUser);
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,9 @@ public class CallbackController {
|
||||||
@RequestMapping(value = "/wechat", method = RequestMethod.POST)
|
@RequestMapping(value = "/wechat", method = RequestMethod.POST)
|
||||||
public ResponseEntity<Boolean> weChat(HttpServletRequest request) {
|
public ResponseEntity<Boolean> weChat(HttpServletRequest request) {
|
||||||
try {
|
try {
|
||||||
callbackService.weChat(request);
|
synchronized (callbackService) { // 注意这里的锁对象选择很重要
|
||||||
|
callbackService.weChat(request);
|
||||||
|
}
|
||||||
} catch (ValidationException e) {
|
} catch (ValidationException e) {
|
||||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(null);
|
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).body(null);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -6,9 +6,12 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://localhost:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
# url: jdbc:mysql://localhost:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
# username: root
|
||||||
|
# password: 123456
|
||||||
|
url: jdbc:mysql://106.75.233.135:3306/electripper?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: root
|
username: root
|
||||||
password: 123456
|
password: 9671e015b05b3f11
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
|
|
|
@ -196,8 +196,8 @@ wx:
|
||||||
merchantSerialNumber: 66910F800A60768020F07D39A56AE701574A16AE
|
merchantSerialNumber: 66910F800A60768020F07D39A56AE701574A16AE
|
||||||
refund:
|
refund:
|
||||||
# 退款回调地址
|
# 退款回调地址
|
||||||
notifyUrl: https://dianche.chuantewulian.cn/prod-api/payment/callback/wechat/refund
|
# notifyUrl: https://dianche.chuantewulian.cn/prod-api/payment/callback/wechat/refund
|
||||||
|
notifyUrl: http://124.221.246.124:2289/payment/callback/wechat/refund
|
||||||
# 锁设置
|
# 锁设置
|
||||||
lock:
|
lock:
|
||||||
# 锁前缀
|
# 锁前缀
|
||||||
|
|
|
@ -67,4 +67,11 @@ public interface EtDividendDetailMapper
|
||||||
*/
|
*/
|
||||||
public int isDividendComputed(String date);
|
public int isDividendComputed(String date);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据订单号查询分账明细
|
||||||
|
* @param orderNo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<EtDividendDetail> selectEtDividendDetailByOrderNo(String orderNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,14 @@ public interface IEtDividendDetailService
|
||||||
*/
|
*/
|
||||||
public EtDividendDetail selectEtDividendDetailById(Long id);
|
public EtDividendDetail selectEtDividendDetailById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询分账明细
|
||||||
|
*
|
||||||
|
* @param orderNo 订单号
|
||||||
|
* @return 分账明细
|
||||||
|
*/
|
||||||
|
public List<EtDividendDetail> selectEtDividendDetailByOrderNo(String orderNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询分账明细列表
|
* 查询分账明细列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -437,7 +437,10 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
String finalOrderNo = orderNo;
|
String finalOrderNo = orderNo;
|
||||||
Boolean execute = transactionTemplate.execute(e -> {
|
Boolean execute = transactionTemplate.execute(e -> {
|
||||||
/** 2.发送命令*/
|
/** 2.发送命令*/
|
||||||
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_OPEN,"编号开锁");
|
ResponseVo responseVo = sendCommandWithResp(asDevice.getMac(), token, IotConstants.COMMAND_OPEN, "编号开锁");
|
||||||
|
if(responseVo.getCode() != 0){
|
||||||
|
return Boolean.FALSE;
|
||||||
|
}
|
||||||
/** 3.更新车辆状态*/
|
/** 3.更新车辆状态*/
|
||||||
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
asDevice.setLockStatus(ServiceConstants.LOCK_STATUS_OPEN);
|
||||||
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING);
|
asDevice.setStatus(ServiceConstants.VEHICLE_STATUS_IN_USING);
|
||||||
|
@ -854,9 +857,6 @@ public class AsDeviceServiceImpl extends ServiceImpl<AsDeviceMapper, AsDevice> i
|
||||||
OrderResponse orderResponse = new OrderResponse();
|
OrderResponse orderResponse = new OrderResponse();
|
||||||
String orderNo = appointmentVo.getOrderNo();
|
String orderNo = appointmentVo.getOrderNo();
|
||||||
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
EtOrder order = etOrderService.selectEtOrderByOrderNo(orderNo);
|
||||||
//1.发送开锁命令并更新车辆状态
|
|
||||||
String token = Token.getToken();
|
|
||||||
sendCommand(asDevice.getMac(), token,IotConstants.COMMAND_CLOSE,"取消预约关锁");
|
|
||||||
/** 5.记录行程*/
|
/** 5.记录行程*/
|
||||||
int tripLog = tripLogService.tripLog(order.getOrderNo(),order.getSn(),ServiceConstants.TRIP_LOG_TYPE_UNLOCK_RIDE);
|
int tripLog = tripLogService.tripLog(order.getOrderNo(),order.getSn(),ServiceConstants.TRIP_LOG_TYPE_UNLOCK_RIDE);
|
||||||
if(tripLog==0){
|
if(tripLog==0){
|
||||||
|
|
|
@ -516,7 +516,6 @@ public class AsUserServiceImpl implements IAsUserService
|
||||||
String idCard = authenticationVo.getIdCard();
|
String idCard = authenticationVo.getIdCard();
|
||||||
String realName = authenticationVo.getRealName();
|
String realName = authenticationVo.getRealName();
|
||||||
Object o = VerifyIdentityUtil.verifyIdentity(verifyUrl, appcode, idCard, realName);
|
Object o = VerifyIdentityUtil.verifyIdentity(verifyUrl, appcode, idCard, realName);
|
||||||
|
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,9 +18,7 @@ import com.ruoyi.common.utils.http.HttpUtils;
|
||||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||||
import com.ruoyi.system.domain.*;
|
import com.ruoyi.system.domain.*;
|
||||||
import com.ruoyi.system.domain.vo.AttachVo;
|
import com.ruoyi.system.domain.vo.AttachVo;
|
||||||
import com.ruoyi.system.mapper.AsDeviceMapper;
|
import com.ruoyi.system.mapper.*;
|
||||||
import com.ruoyi.system.mapper.AsUserMapper;
|
|
||||||
import com.ruoyi.system.mapper.SysUserMapper;
|
|
||||||
import com.ruoyi.system.service.*;
|
import com.ruoyi.system.service.*;
|
||||||
import com.wechat.pay.java.core.notification.Notification;
|
import com.wechat.pay.java.core.notification.Notification;
|
||||||
import com.wechat.pay.java.core.notification.NotificationParser;
|
import com.wechat.pay.java.core.notification.NotificationParser;
|
||||||
|
@ -45,6 +43,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
import java.util.concurrent.ScheduledExecutorService;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -58,6 +57,12 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IEtOrderService orderService;
|
private IEtOrderService orderService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EtOrderMapper etOrderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private EtRefundMapper etRefundMapper;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAsDeviceService asDeviceService;
|
private IAsDeviceService asDeviceService;
|
||||||
|
|
||||||
|
@ -108,7 +113,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
* 微信支付回调
|
* 微信支付回调
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SneakyThrows
|
// @SneakyThrows
|
||||||
@Transactional
|
@Transactional
|
||||||
public void weChat(HttpServletRequest request) {
|
public void weChat(HttpServletRequest request) {
|
||||||
String body = HttpUtils.getBody(request);
|
String body = HttpUtils.getBody(request);
|
||||||
|
@ -162,7 +167,12 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
if(autoRefundDeposit!=null && autoRefundDeposit>0){
|
if(autoRefundDeposit!=null && autoRefundDeposit>0){
|
||||||
//创建一个定时器,计算出退还时间后,执行退款操作
|
//创建一个定时器,计算出退还时间后,执行退款操作
|
||||||
// 往后推autoRefundDeposit小时执行
|
// 往后推autoRefundDeposit小时执行
|
||||||
// scheduledExecutorService.schedule(() -> {
|
scheduledExecutorService.schedule(() -> {
|
||||||
|
// 如果退款成功直接返回
|
||||||
|
EtRefund refund2 = etRefundMapper.selectEtRefundByOrderNo(order.getOrderNo());
|
||||||
|
if(ObjectUtil.isNotNull(refund2) && refund2.getRefundResult().equals(Constants.SUCCESS2)){
|
||||||
|
return;
|
||||||
|
}
|
||||||
logger.info("【微信支付回调】退还押金定时任务开始");
|
logger.info("【微信支付回调】退还押金定时任务开始");
|
||||||
// 退款
|
// 退款
|
||||||
Long userId = order.getUserId();
|
Long userId = order.getUserId();
|
||||||
|
@ -171,7 +181,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
etOrder.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
etOrder.setPaid(ServiceConstants.ORDER_PAY_STATUS_PAID);
|
||||||
etOrder.setType(ServiceConstants.ORDER_TYPE_DEPOSIT);
|
etOrder.setType(ServiceConstants.ORDER_TYPE_DEPOSIT);
|
||||||
etOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
etOrder.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
List<EtOrder> etOrders = orderService.selectEtOrderList(etOrder);
|
List<EtOrder> etOrders = etOrderMapper.selectEtOrderList(etOrder);
|
||||||
if (etOrders.size() == 0 || ObjectUtil.isNull(etOrders) ) {
|
if (etOrders.size() == 0 || ObjectUtil.isNull(etOrders) ) {
|
||||||
throw new ServiceException("押金充值记录不存在");
|
throw new ServiceException("押金充值记录不存在");
|
||||||
}
|
}
|
||||||
|
@ -185,8 +195,10 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
if(newestOrder.getTotalFee().compareTo(new BigDecimal(deposit))!=0){
|
if(newestOrder.getTotalFee().compareTo(new BigDecimal(deposit))!=0){
|
||||||
throw new ServiceException("押金充值记录与当前运营区的押金不同");
|
throw new ServiceException("押金充值记录与当前运营区的押金不同");
|
||||||
}
|
}
|
||||||
Refund refund = wxPayService.refund(newestOrder,autoRefundDeposit+"个小时后自动退押金", newestOrder.getTotalFee());
|
String reason = autoRefundDeposit + "个小时后自动退押金";
|
||||||
EtRefund refund1= orderService.createRefund(etOrder, newestOrder.getTotalFee(), null, null, null, null, refund,ServiceConstants.REFUND_TYPE_DEPOSIT);
|
Refund refund = wxPayService.refund(newestOrder,reason, newestOrder.getTotalFee());
|
||||||
|
newestOrder.setReason(reason);
|
||||||
|
EtRefund refund1= orderService.createRefund(newestOrder, newestOrder.getTotalFee(), null, null, null, null, refund,ServiceConstants.REFUND_TYPE_DEPOSIT);
|
||||||
int i = etRefundService.insertEtRefund(refund1);
|
int i = etRefundService.insertEtRefund(refund1);
|
||||||
if(i>0){
|
if(i>0){
|
||||||
logger.info("【自动退款】保存退款对象成功");
|
logger.info("【自动退款】保存退款对象成功");
|
||||||
|
@ -195,17 +207,22 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
capitalFlowRecords(newestOrder,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND);
|
capitalFlowRecords(newestOrder,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_DEPOSIT_REFUND);
|
||||||
|
|
||||||
// 更新用户信息,清除缓存
|
// 更新用户信息,清除缓存
|
||||||
asUser.setBalance(asUser.getBalance().subtract(newestOrder.getTotalFee()));
|
asUser.setBalance(BigDecimal.ZERO);
|
||||||
int updateUser = userService.updateUser(asUser);
|
int updateUser = userService.updateUser(asUser);
|
||||||
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
|
||||||
redisCache.deleteObject(keys);
|
|
||||||
if(updateUser>0){
|
if(updateUser>0){
|
||||||
|
Collection<String> keys = SpringUtils.getBean(RedisCache.class).keys(CacheConstants.LOGIN_TOKEN_KEY + "*");
|
||||||
|
redisCache.deleteObject(keys);
|
||||||
logger.info("【微信支付回调】退还押金,更新用户余额成功!");
|
logger.info("【微信支付回调】退还押金,更新用户余额成功!");
|
||||||
}
|
}
|
||||||
|
logger.info("=================【微信支付回调】退还押金定时任务结束!!!==================");
|
||||||
} else {
|
} else {
|
||||||
throw new ServiceException("没有找到押金充值记录");
|
throw new ServiceException("没有找到押金充值记录");
|
||||||
}
|
}
|
||||||
// }, autoRefundDeposit, TimeUnit.HOURS);
|
}, autoRefundDeposit , TimeUnit.HOURS);
|
||||||
|
}
|
||||||
|
List<EtDividendDetail> etDividendDetails = dividendDetailService.selectEtDividendDetailByOrderNo(order.getOrderNo());
|
||||||
|
if(ObjectUtil.isNotNull(etDividendDetails) && etDividendDetails.size()>0){
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
logger.info("=================【微信支付回调】开始请求分账==================");
|
logger.info("=================【微信支付回调】开始请求分账==================");
|
||||||
logger.info("区域对象====="+JSON.toJSONString(area));
|
logger.info("区域对象====="+JSON.toJSONString(area));
|
||||||
|
@ -279,7 +296,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
logger.info("【微信支付回调】押金支付");
|
logger.info("【微信支付回调】押金支付");
|
||||||
// 4-押金支付
|
// 4-押金支付
|
||||||
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
order.setStatus(ServiceConstants.ORDER_STATUS_ORDER_END);
|
||||||
asUser.setBalance(asUser.getBalance().add(order.getTotalFee()));
|
asUser.setBalance(order.getTotalFee());
|
||||||
order.setMark("押金支付");
|
order.setMark("押金支付");
|
||||||
|
|
||||||
// 新增资金流水记录
|
// 新增资金流水记录
|
||||||
|
@ -314,6 +331,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
logger.error("【微信支付回调】更新用户押金失败");
|
logger.error("【微信支付回调】更新用户押金失败");
|
||||||
throw new ServiceException("【微信支付回调】更新用户押金失败");
|
throw new ServiceException("【微信支付回调】更新用户押金失败");
|
||||||
}
|
}
|
||||||
|
logger.info("=================【微信支付回调】全部结束!!!!!==================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -357,7 +375,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
// todo capitalFlow.setOperatorBalance();
|
// todo capitalFlow.setOperatorBalance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BigDecimal bigDecimal = new BigDecimal(handlingCharge);
|
BigDecimal bigDecimal = new BigDecimal(handlingCharge).divide(new BigDecimal(1000), 2, BigDecimal.ROUND_HALF_UP);
|
||||||
capitalFlow.setHandlingCharge(bigDecimal.multiply(order.getTotalFee()));//手续费
|
capitalFlow.setHandlingCharge(bigDecimal.multiply(order.getTotalFee()));//手续费
|
||||||
capitalFlow.setPayType(ServiceConstants.PAY_TYPE_WX);
|
capitalFlow.setPayType(ServiceConstants.PAY_TYPE_WX);
|
||||||
capitalFlow.setCreateTime(DateUtils.getNowDate());
|
capitalFlow.setCreateTime(DateUtils.getNowDate());
|
||||||
|
@ -399,6 +417,7 @@ public class CallbackServiceImpl implements CallbackService {
|
||||||
EtOrder order = orderService.selectEtOrderByOrderNo(refund.getOrderNo());
|
EtOrder order = orderService.selectEtOrderByOrderNo(refund.getOrderNo());
|
||||||
// 新增资金流水记录
|
// 新增资金流水记录
|
||||||
capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_RIDING_REFUND);
|
capitalFlowRecords(order,ServiceConstants.FLOW_TYPE_DISBURSE,ServiceConstants.ORDER_TYPE_RIDING_REFUND);
|
||||||
|
logger.info("【微信退款回调】全部结束!!!!!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,11 @@ public class EtDividendDetailServiceImpl implements IEtDividendDetailService
|
||||||
return etDividendDetailMapper.selectEtDividendDetailById(id);
|
return etDividendDetailMapper.selectEtDividendDetailById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<EtDividendDetail> selectEtDividendDetailByOrderNo(String orderNo) {
|
||||||
|
return etDividendDetailMapper.selectEtDividendDetailByOrderNo(orderNo);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询分账明细列表
|
* 查询分账明细列表
|
||||||
*
|
*
|
||||||
|
|
|
@ -749,20 +749,24 @@ public class EtOrderServiceImpl implements IEtOrderService
|
||||||
etRefund.setUserId(etOrder.getUserId());
|
etRefund.setUserId(etOrder.getUserId());
|
||||||
etRefund.setRefundNo(refund.getOutRefundNo());
|
etRefund.setRefundNo(refund.getOutRefundNo());
|
||||||
etRefund.setType(type);
|
etRefund.setType(type);
|
||||||
StringBuilder itemDesc = new StringBuilder();
|
if(type.equals(ServiceConstants.REFUND_TYPE_DEPOSIT)){
|
||||||
if(ObjectUtil.isNotNull(appointmentFee) && !appointmentFee.equals(BigDecimal.ZERO)){
|
etRefund.setItemDesc("押金自动退款");
|
||||||
itemDesc.append("预约费:").append(appointmentFee).append("元,");
|
}else{
|
||||||
|
StringBuilder itemDesc = new StringBuilder();
|
||||||
|
if(ObjectUtil.isNotNull(appointmentFee) && !appointmentFee.equals(BigDecimal.ZERO)){
|
||||||
|
itemDesc.append("预约费:").append(appointmentFee).append("元,");
|
||||||
|
}
|
||||||
|
if(ObjectUtil.isNotNull(dispatchFee) && !dispatchFee.equals(BigDecimal.ZERO)){
|
||||||
|
itemDesc.append("调度费:").append(dispatchFee).append("元,");
|
||||||
|
}
|
||||||
|
if(ObjectUtil.isNotNull(manageFee) && !manageFee.equals(BigDecimal.ZERO)){
|
||||||
|
itemDesc.append("管理费:").append(manageFee).append("元,");
|
||||||
|
}
|
||||||
|
if(ObjectUtil.isNotNull(ridingFee) && !ridingFee.equals(BigDecimal.ZERO)){
|
||||||
|
itemDesc.append("骑行费:").append(ridingFee).append("元,");
|
||||||
|
}
|
||||||
|
etRefund.setItemDesc(itemDesc.toString());
|
||||||
}
|
}
|
||||||
if(ObjectUtil.isNotNull(dispatchFee) && !dispatchFee.equals(BigDecimal.ZERO)){
|
|
||||||
itemDesc.append("调度费:").append(dispatchFee).append("元,");
|
|
||||||
}
|
|
||||||
if(ObjectUtil.isNotNull(manageFee) && !manageFee.equals(BigDecimal.ZERO)){
|
|
||||||
itemDesc.append("管理费:").append(manageFee).append("元,");
|
|
||||||
}
|
|
||||||
if(ObjectUtil.isNotNull(ridingFee) && !ridingFee.equals(BigDecimal.ZERO)){
|
|
||||||
itemDesc.append("骑行费:").append(ridingFee).append("元,");
|
|
||||||
}
|
|
||||||
etRefund.setItemDesc(itemDesc.toString());
|
|
||||||
return etRefund;
|
return etRefund;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,12 +160,14 @@ public class WxPayService implements IWxPayService {
|
||||||
public Refund refund(EtOrder etOrder,String reason,BigDecimal amount) {
|
public Refund refund(EtOrder etOrder,String reason,BigDecimal amount) {
|
||||||
CreateRequest request = new CreateRequest();
|
CreateRequest request = new CreateRequest();
|
||||||
request.setOutTradeNo(etOrder.getOutTradeNo());
|
request.setOutTradeNo(etOrder.getOutTradeNo());
|
||||||
request.setOutRefundNo(IdUtils.randomUUID2());
|
request.setOutRefundNo(IdUtils.getOrderNo("ref"));
|
||||||
request.setReason(reason);
|
request.setReason(reason);
|
||||||
request.setAmount(getAmountReq(etOrder.getTotalFee(),amount));
|
request.setAmount(getAmountReq(etOrder.getTotalFee(),amount));
|
||||||
request.setNotifyUrl(wxPayConfig.getRefundNotifyUrl());
|
request.setNotifyUrl(wxPayConfig.getRefundNotifyUrl());
|
||||||
log.info("【退款】请求微信参数:【{}】",JSON.toJSONString(request));
|
log.info("【退款】请求微信参数:【{}】",JSON.toJSONString(request));
|
||||||
return refundService2.create(request);
|
Refund refund = refundService2.create(request);
|
||||||
|
log.info("【退款】微信返回结果:【{}】",JSON.toJSONString(refund));
|
||||||
|
return refund;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 请求分账API */
|
/** 请求分账API */
|
||||||
|
|
|
@ -43,6 +43,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
WHERE DATE(create_time) = #{date}
|
WHERE DATE(create_time) = #{date}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectEtDividendDetailByOrderNo" resultType="com.ruoyi.system.domain.EtDividendDetail">
|
||||||
|
<include refid="selectEtDividendDetailVo"/>
|
||||||
|
where order_no = #{orderNo}
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertEtDividendDetail" parameterType="EtDividendDetail">
|
<insert id="insertEtDividendDetail" parameterType="EtDividendDetail">
|
||||||
insert into et_dividend_detail
|
insert into et_dividend_detail
|
||||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
|
|
@ -14,6 +14,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<result property="manageFee" column="manage_fee" />
|
<result property="manageFee" column="manage_fee" />
|
||||||
<result property="ridingFee" column="riding_fee" />
|
<result property="ridingFee" column="riding_fee" />
|
||||||
<result property="appointmentFee" column="appointment_fee" />
|
<result property="appointmentFee" column="appointment_fee" />
|
||||||
|
<result property="type" column="type" />
|
||||||
<result property="reason" column="reason" />
|
<result property="reason" column="reason" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
<result property="itemDesc" column="item_desc" />
|
<result property="itemDesc" column="item_desc" />
|
||||||
|
@ -21,7 +22,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEtRefundVo">
|
<sql id="selectEtRefundVo">
|
||||||
select id, refund_no, order_no, user_id, amount, dispatch_fee, manage_fee, riding_fee, appointment_fee, reason, create_time, item_desc,refund_result from et_refund
|
select id, refund_no, order_no, user_id, amount, dispatch_fee, manage_fee, riding_fee, appointment_fee, type, reason, create_time, item_desc,refund_result from et_refund
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEtRefundList" parameterType="EtRefund" resultMap="EtRefundResult">
|
<select id="selectEtRefundList" parameterType="EtRefund" resultMap="EtRefundResult">
|
||||||
|
@ -33,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="amount != null "> and amount = #{amount}</if>
|
<if test="amount != null "> and amount = #{amount}</if>
|
||||||
<if test="itemDesc != null and itemDesc != ''"> and item_desc like concat('%', #{itemDesc}, '%')</if>
|
<if test="itemDesc != null and itemDesc != ''"> and item_desc like concat('%', #{itemDesc}, '%')</if>
|
||||||
<if test="refundResult != null "> and refund_result = #{refundResult}</if>
|
<if test="refundResult != null "> and refund_result = #{refundResult}</if>
|
||||||
|
<if test="type != null "> and type = #{type}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
@ -63,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="manageFee != null">manage_fee,</if>
|
<if test="manageFee != null">manage_fee,</if>
|
||||||
<if test="ridingFee != null">riding_fee,</if>
|
<if test="ridingFee != null">riding_fee,</if>
|
||||||
<if test="appointmentFee != null">appointment_fee,</if>
|
<if test="appointmentFee != null">appointment_fee,</if>
|
||||||
|
<if test="type != null">type,</if>
|
||||||
<if test="reason != null">reason,</if>
|
<if test="reason != null">reason,</if>
|
||||||
<if test="createTime != null">create_time,</if>
|
<if test="createTime != null">create_time,</if>
|
||||||
<if test="itemDesc != null">item_desc,</if>
|
<if test="itemDesc != null">item_desc,</if>
|
||||||
|
@ -78,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="manageFee != null">#{manageFee},</if>
|
<if test="manageFee != null">#{manageFee},</if>
|
||||||
<if test="ridingFee != null">#{ridingFee},</if>
|
<if test="ridingFee != null">#{ridingFee},</if>
|
||||||
<if test="appointmentFee != null">#{appointmentFee},</if>
|
<if test="appointmentFee != null">#{appointmentFee},</if>
|
||||||
|
<if test="type != null">#{type},</if>
|
||||||
<if test="reason != null">#{reason},</if>
|
<if test="reason != null">#{reason},</if>
|
||||||
<if test="createTime != null">#{createTime},</if>
|
<if test="createTime != null">#{createTime},</if>
|
||||||
<if test="itemDesc != null">#{itemDesc},</if>
|
<if test="itemDesc != null">#{itemDesc},</if>
|
||||||
|
@ -96,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<if test="manageFee != null">manage_fee = #{manageFee},</if>
|
<if test="manageFee != null">manage_fee = #{manageFee},</if>
|
||||||
<if test="ridingFee != null">riding_fee = #{ridingFee},</if>
|
<if test="ridingFee != null">riding_fee = #{ridingFee},</if>
|
||||||
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
|
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
|
||||||
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="reason != null">reason = #{reason},</if>
|
<if test="reason != null">reason = #{reason},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="itemDesc != null">item_desc = #{itemDesc},</if>
|
<if test="itemDesc != null">item_desc = #{itemDesc},</if>
|
||||||
|
@ -106,13 +111,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<update id="updateEtRefundByRefundNo">
|
<update id="updateEtRefundByRefundNo">
|
||||||
update et_refund
|
update et_refund
|
||||||
<trim prefix="SET" suffixOverrides=",">
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
<if test="refundNo != null">refund_no = #{refundNo},</if>
|
|
||||||
<if test="userId != null">user_id = #{userId},</if>
|
<if test="userId != null">user_id = #{userId},</if>
|
||||||
<if test="amount != null">amount = #{amount},</if>
|
<if test="amount != null">amount = #{amount},</if>
|
||||||
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
|
<if test="dispatchFee != null">dispatch_fee = #{dispatchFee},</if>
|
||||||
<if test="manageFee != null">manage_fee = #{manageFee},</if>
|
<if test="manageFee != null">manage_fee = #{manageFee},</if>
|
||||||
<if test="ridingFee != null">riding_fee = #{ridingFee},</if>
|
<if test="ridingFee != null">riding_fee = #{ridingFee},</if>
|
||||||
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
|
<if test="appointmentFee != null">appointment_fee = #{appointmentFee},</if>
|
||||||
|
<if test="type != null">type = #{type},</if>
|
||||||
<if test="reason != null">reason = #{reason},</if>
|
<if test="reason != null">reason = #{reason},</if>
|
||||||
<if test="createTime != null">create_time = #{createTime},</if>
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
<if test="itemDesc != null">item_desc = #{itemDesc},</if>
|
<if test="itemDesc != null">item_desc = #{itemDesc},</if>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user