提现回调接口开放。待补充。

This commit is contained in:
但星霖 2024-03-30 14:23:33 +08:00
parent be5b3d0e60
commit 7b7963c12d
4 changed files with 41 additions and 10 deletions

View File

@ -45,7 +45,7 @@ public class PlayletUserWithdrawDepositRecordAppController extends BaseControlle
@ResponseBody @ResponseBody
@PostMapping("/getWithdrawDepositList") @PostMapping("/getWithdrawDepositList")
@ApiOperation(value = "分页查询用户提现记录列表") @ApiOperation(value = "分页查询用户提现记录列表")
public Result<PageInfo<PlayletItem>> getWithdrawDepositList(@RequestBody PlayletUserWithdrawDepositRecord playletUserWithdrawDepositRecord, public Result<PageInfo<PlayletUserWithdrawDepositRecord>> getWithdrawDepositList(@RequestBody PlayletUserWithdrawDepositRecord playletUserWithdrawDepositRecord,
@RequestParam(value = "pageNum") Integer pageNum, @RequestParam(value = "pageNum") Integer pageNum,
@RequestParam(value = "pageSize") Integer pageSize) { @RequestParam(value = "pageSize") Integer pageSize) {
return Result.success(service.getWithdrawDepositList(playletUserWithdrawDepositRecord, pageNum, pageSize)); return Result.success(service.getWithdrawDepositList(playletUserWithdrawDepositRecord, pageNum, pageSize));

View File

@ -2,17 +2,15 @@ package com.playlet.web.controller.system;
import java.util.List; import java.util.List;
import com.playlet.common.core.domain.Result;
import com.playlet.system.domain.PlayletUserWithdrawalPassword;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap; import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.playlet.common.annotation.Log; import com.playlet.common.annotation.Log;
import com.playlet.common.enums.BusinessType; import com.playlet.common.enums.BusinessType;
import com.playlet.system.domain.PlayletUserWithdrawDepositRecord; import com.playlet.system.domain.PlayletUserWithdrawDepositRecord;
@ -124,4 +122,13 @@ public class PlayletUserWithdrawDepositRecordController extends BaseController {
public AjaxResult remove(String ids) { public AjaxResult remove(String ids) {
return toAjax(playletUserWithdrawDepositRecordService.deletePlayletUserWithdrawDepositRecordByIds(ids)); return toAjax(playletUserWithdrawDepositRecordService.deletePlayletUserWithdrawDepositRecordByIds(ids));
} }
@ApiOperation(value = "交易回调")
@ResponseBody
@PostMapping("/recordCallbackUpdate")
public Result<Boolean> recordCallbackUpdate(@RequestBody PlayletUserWithdrawDepositRecord playletUserWithdrawalPassword) {
return Result.success(playletUserWithdrawDepositRecordService.recordCallbackUpdate(playletUserWithdrawalPassword.getWithdrawOrder(), playletUserWithdrawalPassword.getStatus()));
}
} }

View File

@ -59,4 +59,6 @@ public interface IPlayletUserWithdrawDepositRecordService extends IService<Playl
* @return 结果 * @return 结果
*/ */
int deletePlayletUserWithdrawDepositRecordById(Long id); int deletePlayletUserWithdrawDepositRecordById(Long id);
Boolean recordCallbackUpdate(String orderId, Long status);
} }

View File

@ -65,15 +65,16 @@ public class PlayletUserWithdrawDepositRecordServiceImpl extends ServiceImpl<Pla
playletUserWithdrawDepositRecord.setUpdateTime(DateUtils.getNowDate()); playletUserWithdrawDepositRecord.setUpdateTime(DateUtils.getNowDate());
// 订单号生成 // 订单号生成
String uuIdMsg = null; String uuIdMsg = null;
for(;;){ for (; ; ) {
uuIdMsg = UUID.randomUUID().toString(); uuIdMsg = UUID.randomUUID().toString();
QueryWrapper<PlayletUserWithdrawDepositRecord> wrapper = new QueryWrapper<>(); QueryWrapper<PlayletUserWithdrawDepositRecord> wrapper = new QueryWrapper<>();
wrapper.lambda().select().eq(PlayletUserWithdrawDepositRecord::getWithdrawOrder, uuIdMsg); wrapper.lambda().select().eq(PlayletUserWithdrawDepositRecord::getWithdrawOrder, uuIdMsg);
PlayletUserWithdrawDepositRecord recordByDb = playletUserWithdrawDepositRecordMapper.selectOne(wrapper); PlayletUserWithdrawDepositRecord recordByDb = playletUserWithdrawDepositRecordMapper.selectOne(wrapper);
if(ObjectUtils.isNull(recordByDb)){ if (ObjectUtils.isNull(recordByDb)) {
break; break;
} }
} }
// todo:根据银行手续费提示进行修改金额待补充
playletUserWithdrawDepositRecord.setWithdrawOrder(UUID.randomUUID().toString()); playletUserWithdrawDepositRecord.setWithdrawOrder(UUID.randomUUID().toString());
return playletUserWithdrawDepositRecordMapper.insertPlayletUserWithdrawDepositRecord(playletUserWithdrawDepositRecord); return playletUserWithdrawDepositRecordMapper.insertPlayletUserWithdrawDepositRecord(playletUserWithdrawDepositRecord);
} }
@ -90,9 +91,10 @@ public class PlayletUserWithdrawDepositRecordServiceImpl extends ServiceImpl<Pla
QueryWrapper<PlayletUserWithdrawDepositRecord> wrapper = new QueryWrapper<>(); QueryWrapper<PlayletUserWithdrawDepositRecord> wrapper = new QueryWrapper<>();
wrapper.lambda().select().eq(PlayletUserWithdrawDepositRecord::getWithdrawOrder, playletUserWithdrawDepositRecord.getWithdrawOrder()); wrapper.lambda().select().eq(PlayletUserWithdrawDepositRecord::getWithdrawOrder, playletUserWithdrawDepositRecord.getWithdrawOrder());
PlayletUserWithdrawDepositRecord recordByDb = playletUserWithdrawDepositRecordMapper.selectOne(wrapper); PlayletUserWithdrawDepositRecord recordByDb = playletUserWithdrawDepositRecordMapper.selectOne(wrapper);
if(ObjectUtils.isNull(recordByDb)){ if (ObjectUtils.isNull(recordByDb)) {
throw new ServiceException("当前订单号不存在,禁止修改"); throw new ServiceException("当前订单号不存在,禁止修改");
} }
// todo:根据银行手续费提示进行修改金额待补充
playletUserWithdrawDepositRecord.setUpdateTime(DateUtils.getNowDate()); playletUserWithdrawDepositRecord.setUpdateTime(DateUtils.getNowDate());
return playletUserWithdrawDepositRecordMapper.updatePlayletUserWithdrawDepositRecord(playletUserWithdrawDepositRecord); return playletUserWithdrawDepositRecordMapper.updatePlayletUserWithdrawDepositRecord(playletUserWithdrawDepositRecord);
} }
@ -118,4 +120,24 @@ public class PlayletUserWithdrawDepositRecordServiceImpl extends ServiceImpl<Pla
public int deletePlayletUserWithdrawDepositRecordById(Long id) { public int deletePlayletUserWithdrawDepositRecordById(Long id) {
return playletUserWithdrawDepositRecordMapper.deletePlayletUserWithdrawDepositRecordById(id); return playletUserWithdrawDepositRecordMapper.deletePlayletUserWithdrawDepositRecordById(id);
} }
@Override
public Boolean recordCallbackUpdate(String orderId, Long status) {
// 通过订单号去查询 如果没有当前订单号禁止修改
QueryWrapper<PlayletUserWithdrawDepositRecord> wrapper = new QueryWrapper<>();
wrapper.lambda().select().eq(PlayletUserWithdrawDepositRecord::getWithdrawOrder, orderId);
PlayletUserWithdrawDepositRecord recordByDb = playletUserWithdrawDepositRecordMapper.selectOne(wrapper);
if (ObjectUtils.isNull(recordByDb)) {
throw new ServiceException("当前订单号不存在,回调更新失败");
}
// 更新状态 1 申请提现 2 审批通过 3 交易完成 4 审批不通过
if (status == 1L || status == 2L || status == 3L || status == 4L) {
} else {
throw new ServiceException("状态信息异常。回调更新失败。");
}
recordByDb.setStatus(status);
recordByDb.setUpdateTime(DateUtils.getNowDate());
return playletUserWithdrawDepositRecordMapper.updatePlayletUserWithdrawDepositRecord(recordByDb) > 0;
}
} }