提现失败 处理
This commit is contained in:
parent
f6d6603f8d
commit
16a823d330
|
|
@ -1256,6 +1256,6 @@ public class CourseServiceImpl extends ServiceImpl<CourseDao, Course> implements
|
|||
courseDetailsDao.updateById(details);
|
||||
}
|
||||
|
||||
return null;
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,29 +144,39 @@ public class DiscSpinningController {
|
|||
if (StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
||||
receive.setTarget("1");
|
||||
//提现
|
||||
withdraw(receive, receive.getUserId(), receive.getNumber().doubleValue());
|
||||
}else {
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setClassify(5);
|
||||
userMoneyDetails.setMoney(receive.getNumber());
|
||||
userMoneyDetails.setUserId(receive.getUserId());
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
userMoneyDetails.setCreateTime(simpleDateFormat.format(new Date()));
|
||||
userMoneyDetails.setContent("现金大转盘:现金红包奖励");
|
||||
userMoneyDetails.setTitle("现金大转盘:现金红包奖励" + receive.getNumber() + "元");
|
||||
userMoneyDetails.setState(2);
|
||||
userMoneyDetails.setType(1);
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, receive.getUserId(), receive.getNumber().doubleValue());
|
||||
receive.setTarget("2");
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
receive.setTargetId(userMoneyDetails.getId());
|
||||
String result = withdraw(receive, receive.getUserId(), receive.getNumber().doubleValue());
|
||||
recordService.updateById(receive);
|
||||
|
||||
if (StringUtils.isBlank(result)) {
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
if ("提现成功,将在三个工作日内到账,请耐心等待!".equals(result)) {
|
||||
return Result.success(result);
|
||||
}
|
||||
}
|
||||
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setClassify(5);
|
||||
userMoneyDetails.setMoney(receive.getNumber());
|
||||
userMoneyDetails.setUserId(receive.getUserId());
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
userMoneyDetails.setCreateTime(simpleDateFormat.format(new Date()));
|
||||
userMoneyDetails.setContent("现金大转盘:现金红包奖励");
|
||||
userMoneyDetails.setTitle("现金大转盘:现金红包奖励" + receive.getNumber() + "元");
|
||||
userMoneyDetails.setState(2);
|
||||
userMoneyDetails.setType(1);
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, receive.getUserId(), receive.getNumber().doubleValue());
|
||||
receive.setTarget("2");
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
receive.setTargetId(userMoneyDetails.getId());
|
||||
|
||||
recordService.updateById(receive);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
public void withdraw(DiscSpinningRecord record, Long userId, Double money) {
|
||||
public String withdraw(DiscSpinningRecord record, Long userId, Double money) {
|
||||
UserEntity userInfo = userService.queryByUserId(userId);
|
||||
//最高提现金额
|
||||
CommonInfo one2 = commonRepository.findOne(910);
|
||||
|
|
@ -185,17 +195,21 @@ public class DiscSpinningController {
|
|||
cashOut.setCreateAt(date);
|
||||
if (one2 != null && money >= Double.parseDouble(one2.getValue())) {
|
||||
cashOutService.saveBody(cashOut);
|
||||
return;
|
||||
return "提现成功,将在三个工作日内到账,请耐心等待!";
|
||||
}
|
||||
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus().equals(2)) {
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
cashOut.setState(1);
|
||||
} else if (StringUtils.isNotBlank(baseResp.getErrorMsg())) {
|
||||
return baseResp.getErrorMsg();
|
||||
}
|
||||
cashOutService.saveBody(cashOut);
|
||||
record.setTargetId(cashOut.getId());
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@Transactional
|
||||
|
|
|
|||
|
|
@ -1,22 +1,34 @@
|
|||
package com.sqx.modules.job.task;
|
||||
|
||||
import com.sqx.modules.app.entity.UserMoneyDetails;
|
||||
import com.sqx.modules.app.service.UserMoneyDetailsService;
|
||||
import com.sqx.modules.app.service.UserMoneyService;
|
||||
import com.sqx.modules.pay.dao.CashOutDao;
|
||||
import com.sqx.modules.pay.entity.CashOut;
|
||||
import com.sqx.modules.pay.wuyou.BaseResp;
|
||||
import com.sqx.modules.pay.wuyou.WuyouPay;
|
||||
import com.sqx.modules.utils.AliPayOrderUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Component("CashOutTask")
|
||||
public class CashOutTask implements ITask{
|
||||
public class CashOutTask implements ITask {
|
||||
|
||||
@Autowired
|
||||
@Resource
|
||||
private CashOutDao cashOutDao;
|
||||
@Resource
|
||||
private UserMoneyService userMoneyService;
|
||||
@Resource
|
||||
private UserMoneyDetailsService userMoneyDetailsService;
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(getClass());
|
||||
|
||||
|
|
@ -28,10 +40,24 @@ public class CashOutTask implements ITask{
|
|||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus().equals(2)) {
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
cashOut.setState(1);
|
||||
}else {
|
||||
cashOut.setRefund(baseResp.getMsg());
|
||||
} else {
|
||||
cashOut.setRefund(StringUtils.isNotBlank(baseResp.getMsg()) ? baseResp.getMsg() : baseResp.getErrorMsg());
|
||||
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||
userMoneyDetails.setClassify(5);
|
||||
userMoneyDetails.setMoney(new BigDecimal(cashOut.getMoney()));
|
||||
userMoneyDetails.setUserId(cashOut.getUserId());
|
||||
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
userMoneyDetails.setCreateTime(simpleDateFormat.format(new Date()));
|
||||
userMoneyDetails.setContent("现金大转盘:提现失败存入余额");
|
||||
userMoneyDetails.setTitle("现金大转盘:现金红包奖励" + cashOut.getMoney() + "元");
|
||||
userMoneyDetails.setState(2);
|
||||
userMoneyDetails.setType(1);
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, cashOut.getUserId(), Double.parseDouble(cashOut.getMoney()));
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
}
|
||||
cashOutDao.updateById(cashOut);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -438,20 +438,23 @@ public class CashOutServiceImpl extends ServiceImpl<CashOutDao, CashOut> impleme
|
|||
userMoneyDetails.setCreateTime(date);
|
||||
UserMoney userMoney = userMoneyService.selectUserMoneyByUserId(userId);
|
||||
//提现判断余额是否足够
|
||||
if (userMoney.getAmount().doubleValue() >= money) { //用户金豆足够
|
||||
//扣除可提现余额
|
||||
userMoneyService.updateAmount(2, userId, money);
|
||||
}else {
|
||||
if (userMoney.getAmount().doubleValue() < money) {
|
||||
return Result.success("可提现余额不足!");
|
||||
}
|
||||
BaseResp baseResp = WuyouPay.extractOrder(outOrderNo, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus().equals(2)) {
|
||||
if (baseResp.getStatus() != null && baseResp.getStatus().equals(2)) {
|
||||
userMoneyDetails.setContent("成功提现:" + money);
|
||||
userMoneyDetails.setState(2);
|
||||
cashOut.setState(1);
|
||||
}
|
||||
|
||||
if (baseResp.getErrorMsg() != null) {
|
||||
return Result.error(baseResp.getErrorMsg());
|
||||
}
|
||||
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
baseMapper.insert(cashOut);
|
||||
userMoneyService.updateAmount(2, userId, money);
|
||||
return Result.success("提现成功,将在三个工作日内到账,请耐心等待!");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,4 +17,10 @@ public class BaseResp {
|
|||
// 支付 只有 SUCCESS 是成功的
|
||||
@JSONField(name = "pay_status")
|
||||
private String payStatus;
|
||||
|
||||
@JSONField(name = "error_msg")
|
||||
private String errorMsg;
|
||||
|
||||
@JSONField(name = "error_code")
|
||||
private String errorCode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class WuyouPay {
|
|||
payOrder("20221118123456794", "0.1", "Mozilla/5.0");
|
||||
// queryOrder("20221118123456791", "0.1", "Mozilla/5.0");
|
||||
|
||||
// extractOrder("20221118123456793", "1", "1157756119@qq.com", "巩奕杰");
|
||||
extractOrder("20221118123456793", "1", "1157756119@qq.com", "巩奕杰");
|
||||
// queryExtractOrder("20221118123456793", "1");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue