|
@@ -86,8 +86,8 @@ public class WxTransferService {
|
|
* @param param
|
|
* @param param
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @Transactional
|
|
|
|
- public Object transfer(WalletTransferParam param){
|
|
|
|
|
|
+// @Transactional
|
|
|
|
+ public ResultContent transfer(WalletTransferParam param){
|
|
String userId = authHelper.getCurrentUser().getUserId();
|
|
String userId = authHelper.getCurrentUser().getUserId();
|
|
OperateDisable operateDisable = operateDisableDao.findTopByUserIdAndType(userId, OperateType.TRANSFER);
|
|
OperateDisable operateDisable = operateDisableDao.findTopByUserIdAndType(userId, OperateType.TRANSFER);
|
|
if (ObjectUtils.isNotEmpty(operateDisable)){
|
|
if (ObjectUtils.isNotEmpty(operateDisable)){
|
|
@@ -121,6 +121,15 @@ public class WxTransferService {
|
|
transferModel.setTotalNum(detailList.size());
|
|
transferModel.setTotalNum(detailList.size());
|
|
transferModel.setTransferDetailList(detailList);
|
|
transferModel.setTransferDetailList(detailList);
|
|
|
|
|
|
|
|
+ //初始化提现单
|
|
|
|
+ WxTransferBatch wxTransferBatch = new WxTransferBatch();
|
|
|
|
+ wxTransferBatch.setBatchNo(outBatchNo);
|
|
|
|
+ wxTransferBatch.setDetailNo(outDetailNo);
|
|
|
|
+ wxTransferBatch.setWallet(wallet);
|
|
|
|
+ wxTransferBatch.setTotal(param.getTotal());
|
|
|
|
+ wxTransferBatch.setChannel(TransferChannel.WeChat);
|
|
|
|
+ wxTransferBatch.setBeforeWalletInfo(wallet);
|
|
|
|
+
|
|
InitiateBatchTransferResponse response = wechatService.initiateBatchTransfer(transferModel, param.getAppid());
|
|
InitiateBatchTransferResponse response = wechatService.initiateBatchTransfer(transferModel, param.getAppid());
|
|
if (response==null){
|
|
if (response==null){
|
|
OperateDisable newDisable = new OperateDisable();
|
|
OperateDisable newDisable = new OperateDisable();
|
|
@@ -128,19 +137,23 @@ public class WxTransferService {
|
|
newDisable.setType(OperateType.TRANSFER);
|
|
newDisable.setType(OperateType.TRANSFER);
|
|
newDisable.setTTL(new Date(this.dbHelper.getTime() + 60*60 * 1000L));
|
|
newDisable.setTTL(new Date(this.dbHelper.getTime() + 60*60 * 1000L));
|
|
operateDisableDao.save(newDisable);
|
|
operateDisableDao.save(newDisable);
|
|
- return ResultContent.build(ResultState.Fail);
|
|
|
|
|
|
+ wxTransferBatch.setTransferStatus(TransferStatus.FAIL);
|
|
|
|
+ wxTransferBatch.setFailReason("提现失败请一小时后再次尝试");
|
|
|
|
+ wxTransferBatchDao.save(wxTransferBatch);
|
|
|
|
+ //失败做一次补偿
|
|
|
|
+ return transfer(param);
|
|
}
|
|
}
|
|
- WxTransferBatch wxTransferBatch = new WxTransferBatch();
|
|
|
|
- wxTransferBatch.setBatchNo(outBatchNo);
|
|
|
|
- wxTransferBatch.setDetailNo(outDetailNo);
|
|
|
|
- wxTransferBatch.setWallet(wallet);
|
|
|
|
- wxTransferBatch.setTotal(param.getTotal());
|
|
|
|
- wxTransferBatch.setChannel(TransferChannel.WeChat);
|
|
|
|
- wxTransferBatch.setBeforeWalletInfo(wallet);
|
|
|
|
|
|
+// wxTransferBatch.setBatchNo(outBatchNo);
|
|
|
|
+// wxTransferBatch.setDetailNo(outDetailNo);
|
|
|
|
+// wxTransferBatch.setWallet(wallet);
|
|
|
|
+// wxTransferBatch.setTotal(param.getTotal());
|
|
|
|
+// wxTransferBatch.setChannel(TransferChannel.WeChat);
|
|
|
|
+// wxTransferBatch.setBeforeWalletInfo(wallet);
|
|
wxTransferBatch.setBatchStatus(response.getBatchStatus());
|
|
wxTransferBatch.setBatchStatus(response.getBatchStatus());
|
|
wxTransferBatch.setWxBatchId(response.getBatchId());
|
|
wxTransferBatch.setWxBatchId(response.getBatchId());
|
|
wxTransferBatch.setTransferStatus(TransferStatus.PROCESSING);
|
|
wxTransferBatch.setTransferStatus(TransferStatus.PROCESSING);
|
|
wxTransferBatchDao.save(wxTransferBatch);
|
|
wxTransferBatchDao.save(wxTransferBatch);
|
|
|
|
+
|
|
wallet.setAmount(wallet.getAmount().subtract(param.getTotal()));
|
|
wallet.setAmount(wallet.getAmount().subtract(param.getTotal()));
|
|
wallet.setTodayTransferAmount(wallet.getTodayTransferAmount().add(param.getTotal()));
|
|
wallet.setTodayTransferAmount(wallet.getTodayTransferAmount().add(param.getTotal()));
|
|
walletDao.save(wallet);
|
|
walletDao.save(wallet);
|