Commit 3780314a authored by hezhen's avatar hezhen

123

parent 48983eaf
...@@ -92,6 +92,15 @@ public class MyWalletCath implements Serializable { ...@@ -92,6 +92,15 @@ public class MyWalletCath implements Serializable {
@ApiModelProperty(value = "订单状态:0-未提现,待审核,1-已审核") @ApiModelProperty(value = "订单状态:0-未提现,待审核,1-已审核")
private Integer stauts; private Integer stauts;
/**
* 失败原因
*/
@Column(name = "reason")
@ApiModelProperty(value = "失败原因")
private String reason;
/** /**
* 提现日期 * 提现日期
*/ */
......
...@@ -304,23 +304,24 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { ...@@ -304,23 +304,24 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
myWallet.setUserId(userId); myWallet.setUserId(userId);
myWallet.setBalance(balnece); myWallet.setBalance(balnece);
myWallet.setWithdrawals(withdrawals); myWallet.setWithdrawals(withdrawals);
myWallet.setVersion(sumDto.getVersion()); myWallet.setVersion(sumDto.getVersion());
mapper.updMyWater(myWallet); mapper.updMyWater(myWallet);
return ObjectRestResponse.succ(walletCath.getId()); return ObjectRestResponse.succ(walletCath.getId());
} }
//提现审核 //提现审核
public ObjectRestResponse verifyCath(Integer cathId,String cono){ public ObjectRestResponse verifyCath(Integer cathId,String cono,String reason,Integer status){
if (StringUtils.isBlank(cono)||cathId==null||cathId==0){ if ((status==1&&StringUtils.isBlank(cono))||(status==2&&StringUtils.isBlank(reason))||cathId==null||cathId==0){
return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数不能为空"); return ObjectRestResponse.createFailedResult(ResultCode.NULL_CODE, "参数不能为空");
} }
MyWalletCath cath=myWalletCathBiz.selectById(cathId); MyWalletCath cath=myWalletCathBiz.selectById(cathId);
if (cath==null){ if (cath==null){
return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "提现记录不存在"); return ObjectRestResponse.createFailedResult(ResultCode.NOTEXIST_CODE, "提现记录不存在");
} }
cath.setStauts(1); cath.setStauts(status);
cath.setCono(cono); cath.setCono(cono);
cath.setReason(reason);
cath.setFinishTime(System.currentTimeMillis()); cath.setFinishTime(System.currentTimeMillis());
int num=myWalletCathBiz.updateSelectiveByIdRe(cath); int num=myWalletCathBiz.updateSelectiveByIdRe(cath);
if (num>0){ if (num>0){
...@@ -329,23 +330,34 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> { ...@@ -329,23 +330,34 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
wallet.setUserId(userId); wallet.setUserId(userId);
wallet=selectOne(wallet); wallet=selectOne(wallet);
if (wallet!=null){ if (wallet!=null){
//当时钱包的余额
BigDecimal balance=cath.getBalance(); BigDecimal balance=cath.getBalance();
BigDecimal realAmount=cath.getRealAmount(); BigDecimal realAmount=cath.getRealAmount();
BigDecimal commission=cath.getCommission(); BigDecimal commission=cath.getCommission();
MyWalletDetail detail=new MyWalletDetail(); if (status==1){
detail.setUserId(userId); MyWalletDetail detail=new MyWalletDetail();
detail.setItype(1); detail.setUserId(userId);
detail.setCono(cathId); detail.setItype(1);
detail.setBalance(balance); detail.setCono(cathId);
detail.setAmount(realAmount); detail.setBalance(balance);
detail.setSource(10); detail.setAmount(realAmount);
myWalletDetailBiz.insertSelective(detail); detail.setSource(10);
detail.setId(null); myWalletDetailBiz.insertSelective(detail);
detail.setSource(13); detail.setId(null);
balance=balance.subtract(realAmount).setScale(2, RoundingMode.HALF_UP); detail.setSource(13);
detail.setBalance(balance); balance=balance.subtract(realAmount).setScale(2, RoundingMode.HALF_UP);
detail.setAmount(commission); detail.setBalance(balance);
myWalletDetailBiz.insertSelective(detail); detail.setAmount(commission);
myWalletDetailBiz.insertSelective(detail);
}else {
BigDecimal amount=realAmount.add(commission);
balance=wallet.getBalance().add(amount);
BigDecimal withdrawals=wallet.getWithdrawals().subtract(amount);
wallet.setBalance(balance);
wallet.setWithdrawals(withdrawals);
mapper.updMyWater(wallet);
}
} }
} }
return ObjectRestResponse.succ(); return ObjectRestResponse.succ();
......
...@@ -37,9 +37,11 @@ public class WalletCathAdminController { ...@@ -37,9 +37,11 @@ public class WalletCathAdminController {
@ApiOperation("提现审核") @ApiOperation("提现审核")
public ObjectRestResponse verifyCath( public ObjectRestResponse verifyCath(
@RequestParam(value = "cathId",defaultValue = "0") Integer cathId, @RequestParam(value = "cathId",defaultValue = "0") Integer cathId,
@RequestParam(value = "cono",defaultValue = "") String cono){ @RequestParam(value = "cono",defaultValue = "") String cono,
@RequestParam(value = "reason",defaultValue = "") String reason,
@RequestParam(value = "status",defaultValue = "1") Integer status){
try { try {
return myWalletBiz.verifyCath(cathId,cono); return myWalletBiz.verifyCath(cathId,cono,reason,status);
}catch (Exception e) { }catch (Exception e) {
throw new BaseException(e); throw new BaseException(e);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment