|
@@ -9,6 +9,7 @@ import com.ym.mec.biz.dal.dto.WithdrawInfoDto;
|
|
|
import com.ym.mec.biz.dal.entity.StudentWithdraw;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccount;
|
|
|
import com.ym.mec.biz.dal.entity.SysUserCashAccountDetail;
|
|
|
+import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PlatformCashAccountDetailTypeEnum;
|
|
|
import com.ym.mec.biz.dal.enums.PlatformCashAccountStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.TransTypeEnum;
|
|
@@ -51,9 +52,6 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(StudentWithdrawServiceImpl.class);
|
|
|
|
|
|
-// @Qualifier("auth-server")
|
|
|
-// @Autowired
|
|
|
-// private SysUserFeignService sysUserFeignService;
|
|
|
@Autowired
|
|
|
private SysUserCashAccountService cashAccountService;
|
|
|
@Autowired
|
|
@@ -78,9 +76,13 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
|
|
|
}
|
|
|
//第三方提现到用户银行卡
|
|
|
//用户个人虚拟账户金额减少
|
|
|
- updateCashAccount(sysUserCashAccount, withdrawDto);
|
|
|
+
|
|
|
+// updateCashAccount(sysUserCashAccount, withdrawDto);
|
|
|
//生成提现记录(缺少银行流水号,交易状态,用户承担的费用,平台承担的费用)
|
|
|
- saveStudentWithdraw(withdrawDto);
|
|
|
+ Integer withdrawId = saveStudentWithdraw(withdrawDto);
|
|
|
+
|
|
|
+ accountDetailService.addCashAccountDetail(withdrawDto.getUserId(),withdrawDto.getAmount(),withdrawId +"","",
|
|
|
+ PlatformCashAccountDetailTypeEnum.WITHDRAW,TransTypeEnum.FAST_PAYMENT, DealStatusEnum.ING,"");
|
|
|
} catch (Exception e) {
|
|
|
log.error("用户提现出现异常 {}", e.getMessage(), e);
|
|
|
throw new BizException(e.getMessage());
|
|
@@ -89,6 +91,26 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
|
|
|
}
|
|
|
return true;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 修改用户账户余额,保存账户明细
|
|
|
+ *
|
|
|
+ * @param withdrawDto
|
|
|
+ */
|
|
|
+ private void updateCashAccount(SysUserCashAccount sysUserCashAccount, WithdrawDto withdrawDto) {
|
|
|
+ BigDecimal balance = sysUserCashAccount.getBalance().subtract(withdrawDto.getAmount());
|
|
|
+ SysUserCashAccount account = new SysUserCashAccount();
|
|
|
+ account.setUserId(sysUserCashAccount.getUserId());
|
|
|
+ account.setBalance(balance);
|
|
|
+ account.setUpdateTime(new Date());
|
|
|
+ cashAccountService.update(account);
|
|
|
+ SysUserCashAccountDetail cashAccountDetail = new SysUserCashAccountDetail();
|
|
|
+ cashAccountDetail.setUserId(withdrawDto.getUserId());
|
|
|
+ cashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.WITHDRAW);
|
|
|
+ cashAccountDetail.setAmount(withdrawDto.getAmount());
|
|
|
+ cashAccountDetail.setBalance(balance);
|
|
|
+ cashAccountDetail.setCreateTime(new Date());
|
|
|
+ cashAccountDetailService.insert(cashAccountDetail);
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public PageInfo<WithdrawInfoDto> queryWithdrawPage(CashAccountDetail cashAccountDetail) {
|
|
@@ -146,33 +168,14 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 修改用户账户余额,保存账户明细
|
|
|
- *
|
|
|
- * @param withdrawDto
|
|
|
- */
|
|
|
- private void updateCashAccount(SysUserCashAccount sysUserCashAccount, WithdrawDto withdrawDto) {
|
|
|
- BigDecimal balance = sysUserCashAccount.getBalance().subtract(withdrawDto.getAmount());
|
|
|
- SysUserCashAccount account = new SysUserCashAccount();
|
|
|
- account.setUserId(sysUserCashAccount.getUserId());
|
|
|
- account.setBalance(balance);
|
|
|
- account.setUpdateTime(new Date());
|
|
|
- cashAccountService.update(account);
|
|
|
- SysUserCashAccountDetail cashAccountDetail = new SysUserCashAccountDetail();
|
|
|
- cashAccountDetail.setUserId(withdrawDto.getUserId());
|
|
|
- cashAccountDetail.setType(PlatformCashAccountDetailTypeEnum.WITHDRAW);
|
|
|
- cashAccountDetail.setAmount(withdrawDto.getAmount());
|
|
|
- cashAccountDetail.setBalance(balance);
|
|
|
- cashAccountDetail.setCreateTime(new Date());
|
|
|
- cashAccountDetailService.insert(cashAccountDetail);
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 保存提现记录
|
|
|
*
|
|
|
* @param withdrawDto
|
|
|
*/
|
|
|
- private void saveStudentWithdraw(WithdrawDto withdrawDto) {
|
|
|
+ private Integer saveStudentWithdraw(WithdrawDto withdrawDto) {
|
|
|
IdWorker idWorker = new IdWorker(0, 0);
|
|
|
StudentWithdraw studentWithdraw = new StudentWithdraw();
|
|
|
studentWithdraw.setWithdrawNo(idWorker.nextId());
|
|
@@ -181,6 +184,7 @@ public class StudentWithdrawServiceImpl extends BaseServiceImpl<String, StudentW
|
|
|
studentWithdraw.setAmount(withdrawDto.getAmount());
|
|
|
studentWithdraw.setCreateTime(new Date());
|
|
|
insert(studentWithdraw);
|
|
|
+ return studentWithdraw.getId();
|
|
|
}
|
|
|
|
|
|
}
|