提现申请审核
This commit is contained in:
@@ -1,10 +1,15 @@
|
|||||||
package com.sqx.modules.pay.service.impl;
|
package com.sqx.modules.pay.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.map.MapProxy;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.sqx.common.exception.SqxException;
|
||||||
|
import com.sqx.common.utils.Constant;
|
||||||
import com.sqx.common.utils.PageUtils;
|
import com.sqx.common.utils.PageUtils;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.dao.MsgDao;
|
import com.sqx.modules.app.dao.MsgDao;
|
||||||
@@ -17,7 +22,6 @@ import com.sqx.modules.app.service.UserMoneyService;
|
|||||||
import com.sqx.modules.app.service.UserService;
|
import com.sqx.modules.app.service.UserService;
|
||||||
import com.sqx.modules.common.entity.CommonInfo;
|
import com.sqx.modules.common.entity.CommonInfo;
|
||||||
import com.sqx.modules.common.service.CommonInfoService;
|
import com.sqx.modules.common.service.CommonInfoService;
|
||||||
import com.sqx.modules.course.entity.CourseCollect;
|
|
||||||
import com.sqx.modules.invite.entity.InviteMoney;
|
import com.sqx.modules.invite.entity.InviteMoney;
|
||||||
import com.sqx.modules.invite.service.InviteMoneyService;
|
import com.sqx.modules.invite.service.InviteMoneyService;
|
||||||
import com.sqx.modules.message.dao.MessageInfoDao;
|
import com.sqx.modules.message.dao.MessageInfoDao;
|
||||||
@@ -45,10 +49,7 @@ import weixin.popular.support.TokenManager;
|
|||||||
import javax.websocket.SendResult;
|
import javax.websocket.SendResult;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提现申请记录
|
* 提现申请记录
|
||||||
@@ -511,4 +512,75 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
|||||||
return Result.success("提现成功,将在三个工作日内到账,请耐心等待!");
|
return Result.success("提现成功,将在三个工作日内到账,请耐心等待!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageUtils auditPage(Map<String, Object> params) {
|
||||||
|
MapProxy proxy = MapProxy.create(params);
|
||||||
|
CashOut cashOut = BeanUtil.toBean(params, CashOut.class);
|
||||||
|
//cashOut.setState(3);
|
||||||
|
long pageNum = proxy.getLong(Constant.PAGE, 1L);
|
||||||
|
long pageSize = proxy.getLong(Constant.LIMIT, 10L);
|
||||||
|
IPage<CashOut> page = baseMapper.selectCashOutPage(new Page<>(pageNum, pageSize), cashOut);
|
||||||
|
return new PageUtils(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void audit(CashOut cashOut) {
|
||||||
|
long id = cashOut.getId();
|
||||||
|
Integer isAgree = cashOut.getIsAgree();
|
||||||
|
if (isAgree == null) {
|
||||||
|
throw new SqxException("请选择同意或者拒绝!");
|
||||||
|
}
|
||||||
|
if (isAgree == 0 && StrUtil.isBlank(cashOut.getRefund())) {
|
||||||
|
throw new SqxException("请输入拒绝原因!");
|
||||||
|
}
|
||||||
|
CashOut entity = baseMapper.selectById(id);
|
||||||
|
if (entity == null) {
|
||||||
|
throw new SqxException("提现申请不存在!");
|
||||||
|
}
|
||||||
|
if(entity.getState() != 3){
|
||||||
|
throw new SqxException("提现申请状态无效,请刷新后重试!");
|
||||||
|
}
|
||||||
|
if (isAgree == 1) {
|
||||||
|
entity.setState(0);
|
||||||
|
} else {
|
||||||
|
entity.setState(2);
|
||||||
|
entity.setRefund(cashOut.getRefund());
|
||||||
|
}
|
||||||
|
UserEntity userEntity = userService.selectUserById(entity.getUserId());
|
||||||
|
if(userEntity == null){
|
||||||
|
throw new SqxException("提现用户信息不存在!");
|
||||||
|
}
|
||||||
|
if (isAgree == 0) {
|
||||||
|
baseMapper.updateById(entity);
|
||||||
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||||
|
entity.getUserId(), null, null, "[提现退款]", 4, 1, 2,
|
||||||
|
new BigDecimal(entity.getMoney()), "提现失败,自动退款" + entity.getMoney() + "元", 1);
|
||||||
|
userMoneyDetailsService.save(userMoneyDetails);
|
||||||
|
//归还余额 钱
|
||||||
|
userMoneyService.updateAmount(1, entity.getUserId(), Convert.toDouble(entity.getMoney()));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (StrUtil.isBlank(entity.getOrderNumber())) {
|
||||||
|
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||||
|
entity.setOrderNumber(outOrderNo);
|
||||||
|
}
|
||||||
|
// 执行提现操作
|
||||||
|
BaseResp baseResp = WuyouPay.extractOrder(entity.getOrderNumber(), entity.getMoney(), entity.getZhifubao(), entity.getZhifubaoName());
|
||||||
|
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||||
|
entity.setState(1);
|
||||||
|
} else if (StringUtils.isNotBlank(baseResp.getErrorMsg())) {
|
||||||
|
entity.setState(2);
|
||||||
|
if (baseResp.getErrorMsg().contains("收款人账户号出款属性不匹配")) {
|
||||||
|
entity.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||||
|
} else {
|
||||||
|
entity.setRefund(baseResp.getErrorMsg());
|
||||||
|
}
|
||||||
|
} else if (StringUtils.isNotBlank(baseResp.getMsg())) {
|
||||||
|
entity.setState(2);
|
||||||
|
entity.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||||
|
}
|
||||||
|
baseMapper.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user