删除 无用操作
This commit is contained in:
@@ -14,15 +14,6 @@ public interface DiscSpinningService extends IService<DiscSpinning> {
|
||||
//领奖
|
||||
void receiveAsync(DiscSpinningRecord receive);
|
||||
|
||||
//提现
|
||||
void withdraw(UserEntity userInfo, Double money);
|
||||
|
||||
//提现
|
||||
void withdraw(UserEntity userInfo, Double money, String title);
|
||||
|
||||
//提现
|
||||
void withdrawAsync(UserEntity userInfo, Double money, String title);
|
||||
|
||||
//领取
|
||||
void receive1(DiscSpinningRecord receive);
|
||||
|
||||
|
||||
@@ -100,96 +100,6 @@ public class DiscSpinningServiceImpl extends ServiceImpl<DiscSpinningDao, DiscSp
|
||||
//存入余额 钱
|
||||
userMoneyService.updateAmount(1, receive.getUserId(), receive.getNumber().doubleValue());
|
||||
|
||||
|
||||
// 去除自动提现
|
||||
// if (receive.getNumber().compareTo(new BigDecimal("0.1")) > 0 && StringUtils.isNotBlank(userInfo.getZhiFuBao()) && StringUtils.isNotBlank(userInfo.getZhiFuBaoName())) {
|
||||
// //提现
|
||||
// withdraw(userInfo, receive.getNumber().doubleValue());
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void withdraw(UserEntity userInfo, Double money) {
|
||||
withdraw(userInfo, money, "[提现]");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void withdraw(UserEntity userInfo, Double money, String title) {
|
||||
CashOut cashOut = new CashOut();
|
||||
cashOut.setIsOut(false);
|
||||
cashOut.setMoney(money.toString());
|
||||
cashOut.setUserId(userInfo.getUserId());
|
||||
cashOut.setZhifubao(userInfo.getZhiFuBao());
|
||||
cashOut.setZhifubaoName(userInfo.getZhiFuBaoName());
|
||||
cashOut.setState(0);
|
||||
cashOut.setRate(0.00);
|
||||
cashOut.setUserType(1);
|
||||
cashOut.setCreateAt(DateUtil.now());
|
||||
cashOut.setUserType(1);
|
||||
cashOut.setWithdrawType(WithdrawTypeEnum.RED_ENVELOPE.getValue());
|
||||
|
||||
//最高提现金额
|
||||
CommonInfo one2 = commonRepository.findOne(910);
|
||||
if (one2 == null || money <= Double.parseDouble(one2.getValue())) {
|
||||
if (wuyouPay.checkCanCash(userInfo.getUserId(), WithdrawTypeEnum.RED_ENVELOPE, BigDecimal.valueOf(money))) {
|
||||
cashOut.setStatus(4);
|
||||
String outOrderNo = AliPayOrderUtil.createOrderId();
|
||||
cashOut.setOrderNumber(outOrderNo);
|
||||
BaseResp baseResp = wuyouPay.extractOrder(outOrderNo, userInfo.getUserId(), true, cashOut.getMoney(), cashOut.getZhifubao(), cashOut.getZhifubaoName());
|
||||
if (baseResp.getStatus() != null && (baseResp.getStatus().equals(2) || baseResp.getStatus().equals(10000))) {
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
userInfo.getUserId(), null, null, title, 4, 2, 1,
|
||||
new BigDecimal(money), "现金红包自动提现" + money + "元", 1);
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
//减去余额 钱
|
||||
userMoneyService.updateAmount(2, userInfo.getUserId(), money);
|
||||
|
||||
cashOut.setState(1);
|
||||
} else if (StringUtils.isNotBlank(baseResp.getErrorMsg())) {
|
||||
cashOut.setState(2);
|
||||
if (baseResp.getErrorMsg().contains("收款人账户号出款属性不匹配")) {
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
} else {
|
||||
cashOut.setRefund(baseResp.getErrorMsg());
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(baseResp.getMsg())) {
|
||||
cashOut.setState(2);
|
||||
cashOut.setRefund("提现失败,请检查支付宝账号与收款人姓名后,重试。");
|
||||
}
|
||||
} else {
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
userInfo.getUserId(), null, null, title, 4, 2, 1,
|
||||
new BigDecimal(money), "现金红包自动提现" + money + "元", 1);
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
//减去余额 钱
|
||||
userMoneyService.updateAmount(2, userInfo.getUserId(), money);
|
||||
cashOut.setState(3);
|
||||
}
|
||||
} else {
|
||||
UserMoneyDetails userMoneyDetails = new UserMoneyDetails(
|
||||
userInfo.getUserId(), null, null, title, 4, 2, 1,
|
||||
new BigDecimal(money), "现金红包自动提现" + money + "元", 1);
|
||||
userMoneyDetailsService.save(userMoneyDetails);
|
||||
//减去余额 钱
|
||||
userMoneyService.updateAmount(2, userInfo.getUserId(), money);
|
||||
}
|
||||
cashOutService.saveBody(cashOut);
|
||||
log.info("领取奖励执行完毕");
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void withdrawAsync(UserEntity userInfo, Double money, String title) {
|
||||
TransactionStatus transactionStatus = transactionManager.getTransaction(new DefaultTransactionDefinition());
|
||||
try {
|
||||
withdraw(userInfo, money, title);
|
||||
transactionManager.commit(transactionStatus);
|
||||
} catch (Exception e) {
|
||||
transactionManager.rollback(transactionStatus);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user