|
|
@ -1,5 +1,6 @@ |
|
|
package com.bnyer.img.service.impl; |
|
|
package com.bnyer.img.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.bnyer.common.core.exception.ServiceException; |
|
|
import com.bnyer.common.core.exception.ServiceException; |
|
|
@ -7,6 +8,7 @@ import com.bnyer.common.core.utils.DesensitizedUtils; |
|
|
import com.bnyer.common.core.utils.Sm4Util; |
|
|
import com.bnyer.common.core.utils.Sm4Util; |
|
|
import com.bnyer.common.core.utils.StringUtils; |
|
|
import com.bnyer.common.core.utils.StringUtils; |
|
|
import com.bnyer.img.constants.TiktokConstant; |
|
|
import com.bnyer.img.constants.TiktokConstant; |
|
|
|
|
|
import com.bnyer.img.constants.WithdrawConstant; |
|
|
import com.bnyer.img.domain.Creator; |
|
|
import com.bnyer.img.domain.Creator; |
|
|
import com.bnyer.img.domain.WithdrawLog; |
|
|
import com.bnyer.img.domain.WithdrawLog; |
|
|
import com.bnyer.img.dto.VerifyDto; |
|
|
import com.bnyer.img.dto.VerifyDto; |
|
|
@ -20,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
import java.util.Date; |
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@ -46,7 +49,7 @@ public class WithdrawLogServiceImpl implements WithdrawLogService { |
|
|
throw new ServiceException("该艺术家不存在!", TiktokConstant.TIKTOK_CREATOR_NOT_EXIST); |
|
|
throw new ServiceException("该艺术家不存在!", TiktokConstant.TIKTOK_CREATOR_NOT_EXIST); |
|
|
} |
|
|
} |
|
|
//此处以分为单位
|
|
|
//此处以分为单位
|
|
|
if(creator.getAmt() < withdrawLog.getAmt() * 100){ |
|
|
if(creator.getAmt().compareTo(withdrawLog.getAmt()) == -1){ |
|
|
throw new ServiceException("该艺术家当前可提现余额不足,提现失败!", TiktokConstant.CREATOR_AMT_NOT_ENOUGH); |
|
|
throw new ServiceException("该艺术家当前可提现余额不足,提现失败!", TiktokConstant.CREATOR_AMT_NOT_ENOUGH); |
|
|
} |
|
|
} |
|
|
withdrawLog.setCreateTime(new Date()); |
|
|
withdrawLog.setCreateTime(new Date()); |
|
|
@ -55,7 +58,8 @@ public class WithdrawLogServiceImpl implements WithdrawLogService { |
|
|
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|
|
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|
|
withdrawLog.setBankNo(Sm4Util.sm4Encryption(withdrawLog.getBankNo())); |
|
|
withdrawLog.setBankNo(Sm4Util.sm4Encryption(withdrawLog.getBankNo())); |
|
|
} |
|
|
} |
|
|
//TODO 订单id待核实了广告平台给予的奖励来确定是否有专属订单
|
|
|
//生成订单id
|
|
|
|
|
|
withdrawLog.setOrderId(IdUtil.getSnowflakeNextIdStr()); |
|
|
return withdrawLogMapper.insert(withdrawLog); |
|
|
return withdrawLogMapper.insert(withdrawLog); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -79,7 +83,7 @@ public class WithdrawLogServiceImpl implements WithdrawLogService { |
|
|
for (WithdrawLog withdrawLog : withdrawLogs) { |
|
|
for (WithdrawLog withdrawLog : withdrawLogs) { |
|
|
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|
|
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|
|
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); |
|
|
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); |
|
|
JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLog), WithdrawLog.class); |
|
|
DesensitizedUtils.getJsonNoCopy(withdrawLog); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return withdrawLogs; |
|
|
return withdrawLogs; |
|
|
@ -113,38 +117,35 @@ public class WithdrawLogServiceImpl implements WithdrawLogService { |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public int verifyPass(VerifyDto params) { |
|
|
public int verify(VerifyDto params) { |
|
|
WithdrawLog withdrawLog = withdrawLogMapper.selectById(params.getId()); |
|
|
WithdrawLog withdrawLog = withdrawLogMapper.selectById(params.getId()); |
|
|
if(withdrawLog == null){ |
|
|
if(withdrawLog == null){ |
|
|
throw new ServiceException("该笔提现申请不存在!", TiktokConstant.WITHDRAW_LOG_NOT_EXIST); |
|
|
throw new ServiceException("该笔提现申请不存在!", TiktokConstant.WITHDRAW_LOG_NOT_EXIST); |
|
|
} |
|
|
} |
|
|
withdrawLog.setStatus("1"); |
|
|
|
|
|
withdrawLog.setReason(params.getReason()); |
|
|
withdrawLog.setReason(params.getReason()); |
|
|
|
|
|
if(params.getVerifyStatus().equals(WithdrawConstant.UNPASS)){ |
|
|
|
|
|
//审核拒绝
|
|
|
|
|
|
withdrawLog.setStatus("4"); |
|
|
|
|
|
withdrawLog.setUpdateTime(new Date()); |
|
|
|
|
|
return withdrawLogMapper.updateById(withdrawLog); |
|
|
|
|
|
} |
|
|
|
|
|
//审核通过
|
|
|
|
|
|
withdrawLog.setStatus("1"); |
|
|
|
|
|
withdrawLog.setUpdateTime(new Date()); |
|
|
int update = withdrawLogMapper.updateById(withdrawLog); |
|
|
int update = withdrawLogMapper.updateById(withdrawLog); |
|
|
//TODO 此处审核通过,调用微信企业付款到零钱方法
|
|
|
//TODO 此处审核通过,调用微信企业付款到零钱方法
|
|
|
return update; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
return update; |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
|
public int verifyUnPass(VerifyDto params) { |
|
|
|
|
|
WithdrawLog withdrawLog = withdrawLogMapper.selectById(params.getId()); |
|
|
|
|
|
if(withdrawLog == null){ |
|
|
|
|
|
throw new ServiceException("该笔提现申请不存在!", TiktokConstant.WITHDRAW_LOG_NOT_EXIST); |
|
|
|
|
|
} |
|
|
|
|
|
withdrawLog.setStatus("4"); |
|
|
|
|
|
withdrawLog.setReason(params.getReason()); |
|
|
|
|
|
return withdrawLogMapper.updateById(withdrawLog); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public boolean checkWithdraw(Long creatorId,Integer amt) { |
|
|
public boolean checkWithdraw(Long creatorId, BigDecimal amt) { |
|
|
Creator creator = creatorMapper.selectById(creatorId); |
|
|
Creator creator = creatorMapper.selectById(creatorId); |
|
|
if(creator == null){ |
|
|
if(creator == null){ |
|
|
throw new ServiceException("该艺术家不存在!", TiktokConstant.TIKTOK_CREATOR_NOT_EXIST); |
|
|
throw new ServiceException("该艺术家不存在!", TiktokConstant.TIKTOK_CREATOR_NOT_EXIST); |
|
|
} |
|
|
} |
|
|
//此处以分为单位
|
|
|
//此处以分为单位
|
|
|
if(creator.getAmt() >= amt * 100){ |
|
|
if(creator.getAmt().compareTo(amt) > -1){ |
|
|
return true; |
|
|
return true; |
|
|
}else{ |
|
|
}else{ |
|
|
return false; |
|
|
return false; |
|
|
|