Browse Source

feature-img-1.0:处理提现逻辑

feature-1.0-img
Penny 3 years ago
parent
commit
d48b0e15b5
  1. 14
      bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/domain/WithdrawLog.java
  2. 8
      bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/dto/WithdrawDto.java
  3. 7
      bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/dto/WithdrawPageDto.java
  4. 20
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/CreatorMiniController.java
  5. 8
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/CreatorService.java
  6. 15
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/CreatorServiceImpl.java
  7. 25
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/WithdrawLogServiceImpl.java
  8. 8
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/vo/WithdrawLogVo.java
  9. 9
      bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/WithdrawLogMapper.xml
  10. 38
      bnyer-services/bnyer-system/src/main/java/com/bnyer/system/service/impl/WithdrawLogServiceImpl.java

14
bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/domain/WithdrawLog.java

@ -48,21 +48,13 @@ public class WithdrawLog extends BaseDomain {
@ApiModelProperty(value="提现金额") @ApiModelProperty(value="提现金额")
private BigDecimal amt; private BigDecimal amt;
/**
* 银行卡(加密)
*/
@TableField(value = "bank_no")
@ApiModelProperty(value="银行卡(加密)")
@Desensitized(type = SensitiveTypeEnum.BANK_CARD)
private String bankNo;
/** /**
* 支付宝手机号(加密) * 支付宝手机号(加密)
*/ */
@TableField(value = "phone") @TableField(value = "account_no")
@ApiModelProperty(value="支付宝手机号(加密)") @ApiModelProperty(value="收款账号(加密)")
@Desensitized(type = SensitiveTypeEnum.MOBILE_PHONE) @Desensitized(type = SensitiveTypeEnum.MOBILE_PHONE)
private String phone; private String accountNo;
/** /**
* 渠道(0->微信;1->银行卡) * 渠道(0->微信;1->银行卡)

8
bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/dto/WithdrawDto.java

@ -28,13 +28,9 @@ public class WithdrawDto implements Serializable {
@ApiModelProperty(value="提现金额") @ApiModelProperty(value="提现金额")
private BigDecimal amt; private BigDecimal amt;
@ApiModelProperty(value="银行卡(加密)") @ApiModelProperty(value="收款账号(加密)")
@Desensitized(type = SensitiveTypeEnum.BANK_CARD)
private String bankNo;
@ApiModelProperty(value="支付宝手机号(加密)")
@Desensitized(type = SensitiveTypeEnum.MOBILE_PHONE) @Desensitized(type = SensitiveTypeEnum.MOBILE_PHONE)
private String phone; private String accountNo;
@NotBlank(message = "渠道不能为空!") @NotBlank(message = "渠道不能为空!")
@ApiModelProperty(value="渠道(0->微信;1->银行卡;2->支付宝)") @ApiModelProperty(value="渠道(0->微信;1->银行卡;2->支付宝)")

7
bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/dto/WithdrawPageDto.java

@ -20,9 +20,6 @@ public class WithdrawPageDto extends BasePageDto {
@ApiModelProperty(value="状态(0->待审核;1->提现中;2->提现成功;3->提现失败)") @ApiModelProperty(value="状态(0->待审核;1->提现中;2->提现成功;3->提现失败)")
private String status; private String status;
@ApiModelProperty(value="银行卡(加密)") @ApiModelProperty(value="收款账号(加密)")
private String bankNo; private String accountNo;
@ApiModelProperty(value="支付宝手机号(加密)")
private String phone;
} }

20
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/CreatorMiniController.java

@ -201,38 +201,38 @@ public class CreatorMiniController extends BaseController {
} }
//@TokenCheck //@TokenCheck
@ApiOperation(value="查询指定艺术家账户") @ApiOperation(value="查询指定艺术家收款账户")
@GetMapping(value = "/getAccount/{creatorId}") @GetMapping(value = "/getAccount/{creatorId}")
public AjaxResult getAccount(@PathVariable @ApiParam("艺术家id") Long creatorId){ public AjaxResult getAccount(@PathVariable @ApiParam("艺术家id") Long creatorId){
log.info("【艺术家小程序】查询艺术家id:【{}】账户",creatorId); log.info("【艺术家小程序】查询艺术家id:【{}】账户",creatorId);
return AjaxResult.success(creatorAccountService.queryList(creatorId)); return AjaxResult.success(creatorAccountService.queryList(creatorId));
} }
@ApiOperation(value="新增艺术家账户") @ApiOperation(value="新增艺术家收款账户")
@PostMapping(value = "/insertAccount") @PostMapping(value = "/insertAccount")
public AjaxResult insertCreatorAccount(@Validated @RequestBody @ApiParam("creatorAccount对象") CreatorAccountDto dto){ public AjaxResult insertCreatorAccount(@Validated @RequestBody @ApiParam("creatorAccount对象") CreatorAccountDto dto){
return AjaxResult.success(creatorAccountService.insert(dto.extractParam())); return AjaxResult.success(creatorAccountService.insert(dto.extractParam()));
} }
@ApiOperation(value="修改艺术家账户") @ApiOperation(value="修改艺术家收款账户")
@PostMapping(value = "/updateAccount") @PostMapping(value = "/updateAccount")
public AjaxResult updateCreatorAccount(@Validated @RequestBody @ApiParam("creatorAccount对象") CreatorAccountDto dto){ public AjaxResult updateCreatorAccount(@Validated @RequestBody @ApiParam("creatorAccount对象") CreatorAccountDto dto){
return AjaxResult.success(creatorAccountService.update(dto.extractParam())); return AjaxResult.success(creatorAccountService.update(dto.extractParam()));
} }
@ApiOperation(value="检查艺术家账户是否存在") @ApiOperation(value="检查艺术家收款账户是否存在")
@PostMapping(value = "/checkAccountExist") @PostMapping(value = "/checkAccountExist")
public AjaxResult checkAccountExist(@Validated @RequestBody @ApiParam("艺术家账户存在对象") CreatorAccountExistDto dto){ public AjaxResult checkAccountExist(@Validated @RequestBody @ApiParam("艺术家账户存在对象") CreatorAccountExistDto dto){
return AjaxResult.success(creatorAccountService.checkAccountExist(dto.getCreatorId(),dto.getAccountNo())); return AjaxResult.success(creatorAccountService.checkAccountExist(dto.getCreatorId(),dto.getAccountNo()));
} }
@ApiOperation(value="检查艺术家账户是否超过4个") @ApiOperation(value="检查艺术家收款账户是否超过4个")
@GetMapping(value = "/checkAccountUpToFour/{creatorId}") @GetMapping(value = "/checkAccountUpToFour/{creatorId}")
public AjaxResult checkAccountUpToFour(@PathVariable @ApiParam("艺术家id") Long creatorId){ public AjaxResult checkAccountUpToFour(@PathVariable @ApiParam("艺术家id") Long creatorId){
return AjaxResult.success(creatorAccountService.checkAccountUpToFour(creatorId)); return AjaxResult.success(creatorAccountService.checkAccountUpToFour(creatorId));
} }
@ApiOperation(value="删除艺术家账户") @ApiOperation(value="删除艺术家收款账户")
@GetMapping(value = "/deleteAccount/{ids}") @GetMapping(value = "/deleteAccount/{ids}")
public AjaxResult deleteCreatorAccount(@PathVariable @ApiParam("主键ids") List<Long> ids){ public AjaxResult deleteCreatorAccount(@PathVariable @ApiParam("主键ids") List<Long> ids){
return AjaxResult.success(creatorAccountService.delete(ids)); return AjaxResult.success(creatorAccountService.delete(ids));
@ -362,6 +362,14 @@ public class CreatorMiniController extends BaseController {
return AjaxResult.success(creatorService.logout(param.getPhone())); return AjaxResult.success(creatorService.logout(param.getPhone()));
} }
//@TokenCheck
@GetMapping("/getCreatorInfo/{creatorId}")
@ApiOperation("获取艺术家信息")
public AjaxResult getCreatorInfo(@PathVariable @ApiParam("艺术家id") Long creatorId)
{
return AjaxResult.success(creatorService.getCreatorInfo(creatorId));
}
//@TokenCheck //@TokenCheck
@ApiOperation(value="查询艺术家分类图片数量") @ApiOperation(value="查询艺术家分类图片数量")
@GetMapping(value = "/queryCreatorTypeImgNum/{creatorId}") @GetMapping(value = "/queryCreatorTypeImgNum/{creatorId}")

8
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/CreatorService.java

@ -4,6 +4,7 @@ import com.bnyer.common.core.dto.CreatorDto;
import com.bnyer.common.core.dto.CreatorLoginDto; import com.bnyer.common.core.dto.CreatorLoginDto;
import com.bnyer.img.vo.CreatorDetailsVo; import com.bnyer.img.vo.CreatorDetailsVo;
import com.bnyer.img.vo.CreatorHotVo; import com.bnyer.img.vo.CreatorHotVo;
import com.bnyer.img.vo.CreatorLoginVo;
import com.bnyer.img.vo.CreatorVo; import com.bnyer.img.vo.CreatorVo;
import java.util.List; import java.util.List;
@ -88,4 +89,11 @@ public interface CreatorService {
* @return - * @return -
*/ */
int reVerify(Long creatorId); int reVerify(Long creatorId);
/**
* 获取艺术家信息
* @param creatorId 艺术家id
* @return -
*/
CreatorLoginVo getCreatorInfo(Long creatorId);
} }

15
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/CreatorServiceImpl.java

@ -228,4 +228,19 @@ public class CreatorServiceImpl implements CreatorService {
creator.setStatus("0"); creator.setStatus("0");
return creatorMapper.update(creator,wrapper); return creatorMapper.update(creator,wrapper);
} }
@Override
public CreatorLoginVo getCreatorInfo(Long creatorId) {
LambdaQueryWrapper<Creator> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(Creator::getId,creatorId);
wrapper.eq(Creator::getIsShow,"1");
Creator creator = creatorMapper.selectOne(wrapper);
if(creator != null){
CreatorLoginVo creatorInfo = new CreatorLoginVo();
BeanUtils.copyProperties(creator, creatorInfo);
return creatorInfo;
}else{
return null;
}
}
} }

25
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/WithdrawLogServiceImpl.java

@ -50,14 +50,15 @@ public class WithdrawLogServiceImpl implements WithdrawLogService {
withdrawLog.setCreateTime(new Date()); withdrawLog.setCreateTime(new Date());
withdrawLog.setUpdateTime(new Date()); withdrawLog.setUpdateTime(new Date());
withdrawLog.setStatus("0"); withdrawLog.setStatus("0");
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ if(StringUtils.isNotBlank(withdrawLog.getAccountNo())){
withdrawLog.setBankNo(Sm4Util.sm4Encryption(withdrawLog.getBankNo())); withdrawLog.setAccountNo(Sm4Util.sm4Encryption(withdrawLog.getAccountNo()));
}
if(StringUtils.isNotBlank(withdrawLog.getPhone())){
withdrawLog.setPhone(Sm4Util.sm4Encryption(withdrawLog.getPhone()));
} }
//生成订单id //生成订单id
withdrawLog.setOrderId(IdUtil.getSnowflakeNextIdStr()); withdrawLog.setOrderId(IdUtil.getSnowflakeNextIdStr());
//扣除账户余额
BigDecimal amt = creator.getAmt().subtract(withdrawLog.getAmt());
creator.setAmt(amt);
creatorMapper.updateById(creator);
return withdrawLogMapper.insert(withdrawLog); return withdrawLogMapper.insert(withdrawLog);
} }
@ -66,11 +67,8 @@ public class WithdrawLogServiceImpl implements WithdrawLogService {
List<WithdrawLogVo> withdrawLogVos = withdrawLogMapper.queryFrontList(creatorId); List<WithdrawLogVo> withdrawLogVos = withdrawLogMapper.queryFrontList(creatorId);
if(withdrawLogVos.size() > 0){ if(withdrawLogVos.size() > 0){
for (WithdrawLogVo withdrawLogVo : withdrawLogVos) { for (WithdrawLogVo withdrawLogVo : withdrawLogVos) {
if(StringUtils.isNotBlank(withdrawLogVo.getPhone())){ if(StringUtils.isNotBlank(withdrawLogVo.getAccountNo())){
withdrawLogVo.setPhone(Sm4Util.sm4Decrypt(withdrawLogVo.getPhone())); withdrawLogVo.setAccountNo(Sm4Util.sm4Decrypt(withdrawLogVo.getAccountNo()));
}
if(StringUtils.isNotBlank(withdrawLogVo.getBankNo())){
withdrawLogVo.setBankNo(Sm4Util.sm4Decrypt(withdrawLogVo.getBankNo()));
} }
JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLogVo), WithdrawLogVo.class); JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLogVo), WithdrawLogVo.class);
} }
@ -82,11 +80,8 @@ public class WithdrawLogServiceImpl implements WithdrawLogService {
@Override @Override
public WithdrawLogVo queryFrontDetails(String orderId) { public WithdrawLogVo queryFrontDetails(String orderId) {
WithdrawLogVo withdrawLogVo = withdrawLogMapper.queryFrontDetails(orderId); WithdrawLogVo withdrawLogVo = withdrawLogMapper.queryFrontDetails(orderId);
if(StringUtils.isNotBlank(withdrawLogVo.getPhone())){ if(StringUtils.isNotBlank(withdrawLogVo.getAccountNo())){
withdrawLogVo.setPhone(Sm4Util.sm4Decrypt(withdrawLogVo.getPhone())); withdrawLogVo.setAccountNo(Sm4Util.sm4Decrypt(withdrawLogVo.getAccountNo()));
}
if(StringUtils.isNotBlank(withdrawLogVo.getBankNo())){
withdrawLogVo.setBankNo(Sm4Util.sm4Decrypt(withdrawLogVo.getBankNo()));
} }
JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLogVo), WithdrawLogVo.class); JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLogVo), WithdrawLogVo.class);
return withdrawLogVo; return withdrawLogVo;

8
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/vo/WithdrawLogVo.java

@ -29,13 +29,9 @@ public class WithdrawLogVo implements Serializable {
@ApiModelProperty(value="提现金额") @ApiModelProperty(value="提现金额")
private BigDecimal amt; private BigDecimal amt;
@ApiModelProperty(value="银行卡(加密)") @ApiModelProperty(value="收款账号(加密)")
@Desensitized(type = SensitiveTypeEnum.BANK_CARD)
private String bankNo;
@ApiModelProperty(value="支付宝手机号(加密)")
@Desensitized(type = SensitiveTypeEnum.MOBILE_PHONE) @Desensitized(type = SensitiveTypeEnum.MOBILE_PHONE)
private String phone; private String accountNo;
@ApiModelProperty(value="渠道(0->微信;1->银行卡;2->支付宝)") @ApiModelProperty(value="渠道(0->微信;1->银行卡;2->支付宝)")
private String channel; private String channel;

9
bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/WithdrawLogMapper.xml

@ -8,8 +8,7 @@
<result column="creator_id" jdbcType="BIGINT" property="creatorId" /> <result column="creator_id" jdbcType="BIGINT" property="creatorId" />
<result column="order_id" jdbcType="VARCHAR" property="orderId" /> <result column="order_id" jdbcType="VARCHAR" property="orderId" />
<result column="amt" jdbcType="DECIMAL" property="amt" /> <result column="amt" jdbcType="DECIMAL" property="amt" />
<result column="bank_no" jdbcType="VARCHAR" property="bankNo" /> <result column="account_no" jdbcType="VARCHAR" property="accountNo" />
<result column="phone" jdbcType="VARCHAR" property="phone" />
<result column="reason" jdbcType="VARCHAR" property="reason" /> <result column="reason" jdbcType="VARCHAR" property="reason" />
<result column="status" jdbcType="CHAR" property="status" /> <result column="status" jdbcType="CHAR" property="status" />
<result column="channel" jdbcType="CHAR" property="channel" /> <result column="channel" jdbcType="CHAR" property="channel" />
@ -20,12 +19,12 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, creator_id, amt, bank_no, phone, `status`, create_time, update_time, sort,is_show,order_id,channel,reason id, creator_id, amt, account_no, `status`, create_time, update_time, sort,is_show,order_id,channel,reason
</sql> </sql>
<select id="queryFrontList" resultType="com.bnyer.img.vo.WithdrawLogVo"> <select id="queryFrontList" resultType="com.bnyer.img.vo.WithdrawLogVo">
select select
id, creator_id, amt, bank_no,phone,status,create_time,update_time,order_id,channel,reason id, creator_id, amt, account_no,status,create_time,update_time,order_id,channel,reason
from img_withdraw_log from img_withdraw_log
where is_show = '1' and creator_id = #{creatorId} where is_show = '1' and creator_id = #{creatorId}
order by create_time desc order by create_time desc
@ -33,7 +32,7 @@
<select id="queryFrontDetails" resultType="com.bnyer.img.vo.WithdrawLogVo"> <select id="queryFrontDetails" resultType="com.bnyer.img.vo.WithdrawLogVo">
select select
id, creator_id, amt, bank_no,phone,status,create_time,update_time,order_id,channel,reason id, creator_id, amt, account_no,status,create_time,update_time,order_id,channel,reason
from img_withdraw_log from img_withdraw_log
where is_show = '1' and order_id = #{orderId} where is_show = '1' and order_id = #{orderId}
</select> </select>

38
bnyer-services/bnyer-system/src/main/java/com/bnyer/system/service/impl/WithdrawLogServiceImpl.java

@ -69,20 +69,14 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService {
if(StringUtils.isNotBlank(params.getOrderId())){ if(StringUtils.isNotBlank(params.getOrderId())){
wrapper.eq(WithdrawLog::getOrderId,params.getOrderId()); wrapper.eq(WithdrawLog::getOrderId,params.getOrderId());
} }
if(StringUtils.isNotBlank(params.getBankNo())){ if(StringUtils.isNotBlank(params.getAccountNo())){
wrapper.eq(WithdrawLog::getBankNo, Sm4Util.sm4Encryption(params.getBankNo())); wrapper.eq(WithdrawLog::getAccountNo, Sm4Util.sm4Encryption(params.getAccountNo()));
}
if(StringUtils.isNotBlank(params.getPhone())){
wrapper.eq(WithdrawLog::getPhone, Sm4Util.sm4Encryption(params.getPhone()));
} }
wrapper.orderByDesc(WithdrawLog::getCreateTime); wrapper.orderByDesc(WithdrawLog::getCreateTime);
List<WithdrawLog> withdrawLogs = withdrawLogMapper.selectList(wrapper); List<WithdrawLog> withdrawLogs = withdrawLogMapper.selectList(wrapper);
for (WithdrawLog withdrawLog : withdrawLogs) { for (WithdrawLog withdrawLog : withdrawLogs) {
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ if(StringUtils.isNotBlank(withdrawLog.getAccountNo())){
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); withdrawLog.setAccountNo(Sm4Util.sm4Decrypt(withdrawLog.getAccountNo()));
}
if(StringUtils.isNotBlank(withdrawLog.getPhone())){
withdrawLog.setPhone(Sm4Util.sm4Decrypt(withdrawLog.getPhone()));
} }
DesensitizedUtils.getJsonNoCopy(withdrawLog); DesensitizedUtils.getJsonNoCopy(withdrawLog);
} }
@ -92,11 +86,8 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService {
@Override @Override
public WithdrawLog queryDetails(Long id) { public WithdrawLog queryDetails(Long id) {
WithdrawLog withdrawLog = withdrawLogMapper.selectById(id); WithdrawLog withdrawLog = withdrawLogMapper.selectById(id);
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ if(StringUtils.isNotBlank(withdrawLog.getAccountNo())){
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); withdrawLog.setAccountNo(Sm4Util.sm4Decrypt(withdrawLog.getAccountNo()));
}
if(StringUtils.isNotBlank(withdrawLog.getPhone())){
withdrawLog.setPhone(Sm4Util.sm4Decrypt(withdrawLog.getPhone()));
} }
JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLog), WithdrawLog.class); JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLog), WithdrawLog.class);
return withdrawLog; return withdrawLog;
@ -181,6 +172,11 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService {
withdrawLog.setReason(params.getReason()); withdrawLog.setReason(params.getReason());
if(params.getVerifyStatus().equals(WithdrawConstant.UNPASS)){ if(params.getVerifyStatus().equals(WithdrawConstant.UNPASS)){
//审核拒绝 //审核拒绝
//归还账户额度
Creator creator = creatorMapper.selectById(withdrawLog.getCreatorId());
BigDecimal amt = creator.getAmt().add(withdrawLog.getAmt());
creator.setAmt(amt);
creatorMapper.updateById(creator);
withdrawLog.setStatus("4"); withdrawLog.setStatus("4");
withdrawLog.setUpdateTime(new Date()); withdrawLog.setUpdateTime(new Date());
return withdrawLogMapper.updateById(withdrawLog); return withdrawLogMapper.updateById(withdrawLog);
@ -194,7 +190,7 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService {
CreatorAccountVo creatorAccount = creatorAccountService.queryListByType(withdrawLog.getCreatorId(), "1"); CreatorAccountVo creatorAccount = creatorAccountService.queryListByType(withdrawLog.getCreatorId(), "1");
if(creatorAccount != null){ if(creatorAccount != null){
try{ try{
AlipayFundTransUniTransferResponse body = this.trans(withdrawLog.getOrderId(), creatorAccount.getAliPayNo(), creatorAccount.getName(), withdrawLog.getAmt()); AlipayFundTransUniTransferResponse body = this.trans(withdrawLog.getOrderId(), creatorAccount.getAccountNo(), creatorAccount.getName(), withdrawLog.getAmt());
if(!body.getCode().equals(WithdrawConstant.SUCCESS)){ if(!body.getCode().equals(WithdrawConstant.SUCCESS)){
//提现失败 //提现失败
withdrawLog.setStatus("3"); withdrawLog.setStatus("3");
@ -202,11 +198,6 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService {
log.error("艺术家【{}】订单【{}】提现失败!原因为:【{}】",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),body.getSubMsg()); log.error("艺术家【{}】订单【{}】提现失败!原因为:【{}】",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),body.getSubMsg());
return withdrawLogMapper.updateById(withdrawLog); return withdrawLogMapper.updateById(withdrawLog);
} }
//扣除账户余额
Creator creator = creatorMapper.selectById(withdrawLog.getCreatorId());
BigDecimal amt = creator.getAmt().subtract(withdrawLog.getAmt());
creator.setAmt(amt);
creatorMapper.updateById(creator);
//TODO 分布式锁 //TODO 分布式锁
}catch (AlipayApiException e){ }catch (AlipayApiException e){
log.error("艺术家【{}】订单【{}】提现异常!原因为:【{}】",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),e); log.error("艺术家【{}】订单【{}】提现异常!原因为:【{}】",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),e);
@ -218,10 +209,11 @@ public class WithdrawLogServiceImpl implements IWithdrawLogService {
}else{ }else{
throw new ServiceException("该艺术家未绑定支付宝账户!请手动设置!"); throw new ServiceException("该艺术家未绑定支付宝账户!请手动设置!");
} }
}else if(withdrawLog.getChannel().equals(WithdrawConstant.BANK)){ }else if(withdrawLog.getChannel().equals(WithdrawConstant.WECHAT)){
//TODO 转账到银行卡待开发 //TODO 转账到微信待开发
} }
log.info("艺术家【{}】订单【{}】提现【{}】元成功!",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),withdrawLog.getAmt()); log.info("艺术家【{}】订单【{}】提现【{}】元成功!",withdrawLog.getCreatorId(),withdrawLog.getOrderId(),withdrawLog.getAmt());
//TODO 微信推送/企业微信推送提现成功通知
return withdrawLogMapper.updateById(withdrawLog); return withdrawLogMapper.updateById(withdrawLog);
} }
} }

Loading…
Cancel
Save