36 changed files with 745 additions and 106 deletions
@ -0,0 +1,74 @@ |
|||
package com.bnyer.img.controller; |
|||
|
|||
import com.alibaba.fastjson.JSON; |
|||
import com.bnyer.common.core.web.controller.BaseController; |
|||
import com.bnyer.common.core.web.domain.AjaxResult; |
|||
import com.bnyer.common.core.web.page.TableDataInfo; |
|||
import com.bnyer.img.domain.WithdrawLog; |
|||
import com.bnyer.img.dto.VerifyDto; |
|||
import com.bnyer.img.dto.VerifyPageDto; |
|||
import com.bnyer.img.dto.WithdrawPageDto; |
|||
import com.bnyer.img.dto.checkWithdrawDto; |
|||
import com.bnyer.img.service.WithdrawLogService; |
|||
import com.github.pagehelper.PageHelper; |
|||
import io.swagger.annotations.Api; |
|||
import io.swagger.annotations.ApiOperation; |
|||
import io.swagger.annotations.ApiParam; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.validation.annotation.Validated; |
|||
import org.springframework.web.bind.annotation.*; |
|||
|
|||
import java.util.List; |
|||
|
|||
@Api(value = "【图文平台】提现记录接口",tags = "【图文平台】提现记录接口") |
|||
@RestController |
|||
@RequestMapping("/img/withdrawLog") |
|||
@Slf4j |
|||
public class WithdrawLogController extends BaseController { |
|||
|
|||
@Autowired |
|||
private WithdrawLogService withdrawLogService; |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="查询提现记录分页") |
|||
@PostMapping("/page") |
|||
public TableDataInfo pageWithdrawLog(@RequestBody @ApiParam("分页对象") WithdrawPageDto dto){ |
|||
PageHelper.startPage(dto.getPageNum(), dto.getPageSize()); |
|||
List<WithdrawLog> withdrawLogs = withdrawLogService.queryPage(dto); |
|||
return getDataTable(withdrawLogs); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="删除提现记录") |
|||
@DeleteMapping(value = "/delete/{ids}") |
|||
public AjaxResult deleteWithdrawLog(@PathVariable @ApiParam("主键ids") List<Long> ids){ |
|||
log.debug("【图文平台后台】删除提现记录参数为:{}", ids); |
|||
return AjaxResult.success(withdrawLogService.delete(ids)); |
|||
} |
|||
|
|||
@ApiOperation(value="查询提现记录详情") |
|||
@GetMapping(value = "/details/{id}") |
|||
public AjaxResult details(@PathVariable @ApiParam("主键id") Long id){ |
|||
log.debug("【图文平台后台】查询提现记录参数为:{}", id); |
|||
return AjaxResult.success(withdrawLogService.queryDetails(id)); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="审核提现通过") |
|||
@PostMapping(value = "/verifyPass") |
|||
public AjaxResult verifyPass(@Validated @RequestBody @ApiParam("审核对象") VerifyDto dto){ |
|||
log.debug("【图文平台后台】审核提现通过参数为:{}", JSON.toJSONString(dto)); |
|||
return AjaxResult.success(withdrawLogService.verifyPass(dto)); |
|||
} |
|||
|
|||
//@RequiresPermissions("system:config:list")
|
|||
@ApiOperation(value="审核提现拒绝") |
|||
@PostMapping(value = "/verifyUnPass") |
|||
public AjaxResult verifyUnPass(@Validated @RequestBody @ApiParam("审核对象") VerifyDto dto){ |
|||
log.debug("【图文平台后台】审核提现不通过参数为:{}", JSON.toJSONString(dto)); |
|||
return AjaxResult.success(withdrawLogService.verifyUnPass(dto)); |
|||
} |
|||
|
|||
|
|||
} |
|||
@ -0,0 +1,19 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("下载记录分页接收类") |
|||
public class DownloadLogPageDto extends BasePageDto { |
|||
|
|||
@ApiModelProperty(value="渠道(0->抖音;1->快手;2->微信)") |
|||
private String channel; |
|||
|
|||
@ApiModelProperty(value="搜索码") |
|||
private String scanCode; |
|||
} |
|||
@ -0,0 +1,43 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import com.bnyer.common.core.annotation.Desensitized; |
|||
import com.bnyer.common.core.enums.SensitiveTypeEnum; |
|||
import com.bnyer.common.core.utils.bean.BeanUtils; |
|||
import com.bnyer.img.domain.WithdrawLog; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("提现接收类") |
|||
public class WithdrawDto implements Serializable { |
|||
|
|||
@NotNull(message = "艺术家id不能为空!") |
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
@NotNull(message = "提现金额不能为空!") |
|||
@ApiModelProperty(value="提现金额") |
|||
private Integer amt; |
|||
|
|||
@ApiModelProperty(value="银行卡(加密)") |
|||
@Desensitized(type = SensitiveTypeEnum.BANK_CARD) |
|||
private String bankNo; |
|||
|
|||
@NotBlank(message = "渠道不能为空!") |
|||
@ApiModelProperty(value="渠道(0->微信;1->银行卡)") |
|||
private String channel; |
|||
|
|||
public WithdrawLog extractParam(){ |
|||
WithdrawLog withdrawLog = new WithdrawLog(); |
|||
BeanUtils.copyProperties(this,withdrawLog); |
|||
return withdrawLog; |
|||
} |
|||
} |
|||
@ -0,0 +1,25 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("提现记录分页接收类") |
|||
public class WithdrawPageDto extends BasePageDto { |
|||
|
|||
@ApiModelProperty(value="流水号") |
|||
private String orderId; |
|||
|
|||
@ApiModelProperty(value="渠道(0->微信;1->银行卡)") |
|||
private String channel; |
|||
|
|||
@ApiModelProperty(value="状态(0->待审核;1->提现中;2->提现成功;3->提现失败)") |
|||
private String status; |
|||
|
|||
@ApiModelProperty(value="银行卡(加密)") |
|||
private String bankNo; |
|||
} |
|||
@ -0,0 +1,26 @@ |
|||
package com.bnyer.img.dto; |
|||
|
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import javax.validation.constraints.NotBlank; |
|||
import javax.validation.constraints.NotEmpty; |
|||
import javax.validation.constraints.NotNull; |
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("检查提现接收类") |
|||
public class checkWithdrawDto implements Serializable { |
|||
|
|||
@NotNull(message = "艺术家id不能为空!") |
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
@NotNull(message = "额度不能为空!") |
|||
@ApiModelProperty(value="额度") |
|||
private Integer amt; |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
package com.bnyer.img.service; |
|||
|
|||
import com.bnyer.img.domain.DownloadLog; |
|||
import com.bnyer.img.domain.VerifyLog; |
|||
import com.bnyer.img.dto.DownloadLogPageDto; |
|||
import com.bnyer.img.dto.VerifyPageDto; |
|||
import com.bnyer.img.vo.VerifyLogVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chengkun |
|||
* @date 2022/5/31 10:37 |
|||
*/ |
|||
public interface DownloadLogService { |
|||
|
|||
/** |
|||
* 新增下载记录 |
|||
* @param downloadLog 记录参数 |
|||
* @return - |
|||
*/ |
|||
int insertDownloadLog(DownloadLog downloadLog); |
|||
|
|||
/** |
|||
* 查询下载记录分页 |
|||
* @param params 分页参数 |
|||
* @return - |
|||
*/ |
|||
List<DownloadLog> queryPage(DownloadLogPageDto params); |
|||
|
|||
/** |
|||
* 删除记录 |
|||
* @param ids 主键ids |
|||
* @return - |
|||
*/ |
|||
int delete(List<Long> ids); |
|||
|
|||
/** |
|||
* 根据艺术家id查询下载状态记录 |
|||
* @param creatorId 艺术家id |
|||
* @return - |
|||
*/ |
|||
VerifyLogVo queryVerifyStatus(Long creatorId); |
|||
} |
|||
@ -0,0 +1,79 @@ |
|||
package com.bnyer.img.service; |
|||
|
|||
import com.bnyer.img.domain.WithdrawLog; |
|||
import com.bnyer.img.dto.VerifyDto; |
|||
import com.bnyer.img.dto.WithdrawPageDto; |
|||
import com.bnyer.img.vo.WithdrawLogVo; |
|||
|
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chengkun |
|||
* @date 2022/5/31 10:37 |
|||
*/ |
|||
public interface WithdrawLogService { |
|||
|
|||
/** |
|||
* 新增提现记录 |
|||
* @param withdrawLog 提现记录对象 |
|||
* @return - |
|||
*/ |
|||
int insert(WithdrawLog withdrawLog); |
|||
|
|||
/** |
|||
* 查询提现记录分页 |
|||
* @param params 分页参数 |
|||
* @return - |
|||
*/ |
|||
List<WithdrawLog> queryPage(WithdrawPageDto params); |
|||
|
|||
/** |
|||
* 查询提现详情 |
|||
* @param id 主键id |
|||
* @return - |
|||
*/ |
|||
WithdrawLog queryDetails(Long id); |
|||
|
|||
/** |
|||
* 删除记录 |
|||
* @param ids 主键ids |
|||
* @return - |
|||
*/ |
|||
int delete(List<Long> ids); |
|||
|
|||
/** |
|||
* 小程序查询艺术家提现记录列表 |
|||
* @param creatorId 艺术家id |
|||
* @return - |
|||
*/ |
|||
List<WithdrawLogVo> queryFrontList(Long creatorId); |
|||
|
|||
/** |
|||
* 小程序根据流水号查询提现记录详情 |
|||
* @param orderId 流水号 |
|||
* @return - |
|||
*/ |
|||
WithdrawLogVo queryFrontDetails(String orderId); |
|||
|
|||
/** |
|||
* 审核提现通过 |
|||
* @param params 审核参数 |
|||
* @return - |
|||
*/ |
|||
int verifyPass(VerifyDto params); |
|||
|
|||
/** |
|||
* 审核提现拒绝 |
|||
* @param params 审核参数 |
|||
* @return - |
|||
*/ |
|||
int verifyUnPass(VerifyDto params); |
|||
|
|||
/** |
|||
* 检查该艺术家是否可提现 |
|||
* @param creatorId 艺术家id |
|||
* @param amt 额度 |
|||
* @return - |
|||
*/ |
|||
boolean checkWithdraw(Long creatorId,Integer amt); |
|||
} |
|||
@ -0,0 +1,153 @@ |
|||
package com.bnyer.img.service.impl; |
|||
|
|||
import com.alibaba.fastjson.JSONObject; |
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|||
import com.bnyer.common.core.exception.ServiceException; |
|||
import com.bnyer.common.core.utils.DesensitizedUtils; |
|||
import com.bnyer.common.core.utils.Sm4Util; |
|||
import com.bnyer.common.core.utils.StringUtils; |
|||
import com.bnyer.img.constants.TiktokConstant; |
|||
import com.bnyer.img.domain.Creator; |
|||
import com.bnyer.img.domain.WithdrawLog; |
|||
import com.bnyer.img.dto.VerifyDto; |
|||
import com.bnyer.img.dto.WithdrawPageDto; |
|||
import com.bnyer.img.mapper.CreatorMapper; |
|||
import com.bnyer.img.mapper.WithdrawLogMapper; |
|||
import com.bnyer.img.service.WithdrawLogService; |
|||
import com.bnyer.img.vo.WithdrawLogVo; |
|||
import lombok.extern.slf4j.Slf4j; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
import org.springframework.transaction.annotation.Transactional; |
|||
|
|||
import java.util.Date; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author chengkun |
|||
* @date 2022/5/30 16:46 |
|||
*/ |
|||
@Service |
|||
@Slf4j |
|||
public class WithdrawLogServiceImpl implements WithdrawLogService { |
|||
|
|||
@Autowired |
|||
private WithdrawLogMapper withdrawLogMapper; |
|||
|
|||
@Autowired |
|||
private CreatorMapper creatorMapper; |
|||
|
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int insert(WithdrawLog withdrawLog) { |
|||
Creator creator = creatorMapper.selectById(withdrawLog.getCreatorId()); |
|||
if(creator == null){ |
|||
throw new ServiceException("该艺术家不存在!", TiktokConstant.TIKTOK_CREATOR_NOT_EXIST); |
|||
} |
|||
//此处以分为单位
|
|||
if(creator.getAmt() < withdrawLog.getAmt() * 100){ |
|||
throw new ServiceException("该艺术家当前可提现余额不足,提现失败!", TiktokConstant.CREATOR_AMT_NOT_ENOUGH); |
|||
} |
|||
withdrawLog.setCreateTime(new Date()); |
|||
withdrawLog.setUpdateTime(new Date()); |
|||
withdrawLog.setStatus("0"); |
|||
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|||
withdrawLog.setBankNo(Sm4Util.sm4Encryption(withdrawLog.getBankNo())); |
|||
} |
|||
//TODO 订单id待核实了广告平台给予的奖励来确定是否有专属订单
|
|||
return withdrawLogMapper.insert(withdrawLog); |
|||
} |
|||
|
|||
@Override |
|||
public List<WithdrawLog> queryPage(WithdrawPageDto params) { |
|||
LambdaQueryWrapper<WithdrawLog> wrapper = new LambdaQueryWrapper<>(); |
|||
if(StringUtils.isNotBlank(params.getStatus())){ |
|||
wrapper.eq(WithdrawLog::getStatus,params.getStatus()); |
|||
} |
|||
if(StringUtils.isNotBlank(params.getChannel())){ |
|||
wrapper.eq(WithdrawLog::getChannel,params.getChannel()); |
|||
} |
|||
if(StringUtils.isNotBlank(params.getOrderId())){ |
|||
wrapper.eq(WithdrawLog::getOrderId,params.getOrderId()); |
|||
} |
|||
if(StringUtils.isNotBlank(params.getBankNo())){ |
|||
wrapper.eq(WithdrawLog::getBankNo, Sm4Util.sm4Encryption(params.getBankNo())); |
|||
} |
|||
wrapper.orderByDesc(WithdrawLog::getCreateTime); |
|||
List<WithdrawLog> withdrawLogs = withdrawLogMapper.selectList(wrapper); |
|||
for (WithdrawLog withdrawLog : withdrawLogs) { |
|||
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|||
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); |
|||
JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLog), WithdrawLog.class); |
|||
} |
|||
} |
|||
return withdrawLogs; |
|||
} |
|||
|
|||
@Override |
|||
public WithdrawLog queryDetails(Long id) { |
|||
WithdrawLog withdrawLog = withdrawLogMapper.selectById(id); |
|||
if(StringUtils.isNotBlank(withdrawLog.getBankNo())){ |
|||
withdrawLog.setBankNo(Sm4Util.sm4Decrypt(withdrawLog.getBankNo())); |
|||
JSONObject.parseObject(DesensitizedUtils.getJsonNoCopy(withdrawLog), WithdrawLog.class); |
|||
} |
|||
return withdrawLog; |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int delete(List<Long> ids) { |
|||
return withdrawLogMapper.deleteBatchIds(ids); |
|||
} |
|||
|
|||
@Override |
|||
public List<WithdrawLogVo> queryFrontList(Long creatorId) { |
|||
return withdrawLogMapper.queryFrontList(creatorId); |
|||
} |
|||
|
|||
@Override |
|||
public WithdrawLogVo queryFrontDetails(String orderId) { |
|||
return withdrawLogMapper.queryFrontDetails(orderId); |
|||
} |
|||
|
|||
@Override |
|||
@Transactional(rollbackFor = Exception.class) |
|||
public int verifyPass(VerifyDto params) { |
|||
WithdrawLog withdrawLog = withdrawLogMapper.selectById(params.getId()); |
|||
if(withdrawLog == null){ |
|||
throw new ServiceException("该笔提现申请不存在!", TiktokConstant.WITHDRAW_LOG_NOT_EXIST); |
|||
} |
|||
withdrawLog.setStatus("1"); |
|||
withdrawLog.setReason(params.getReason()); |
|||
int update = withdrawLogMapper.updateById(withdrawLog); |
|||
//TODO 此处审核通过,调用微信企业付款到零钱方法
|
|||
return update; |
|||
} |
|||
|
|||
@Override |
|||
@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 |
|||
public boolean checkWithdraw(Long creatorId,Integer amt) { |
|||
Creator creator = creatorMapper.selectById(creatorId); |
|||
if(creator == null){ |
|||
throw new ServiceException("该艺术家不存在!", TiktokConstant.TIKTOK_CREATOR_NOT_EXIST); |
|||
} |
|||
//此处以分为单位
|
|||
if(creator.getAmt() >= amt * 100){ |
|||
return true; |
|||
}else{ |
|||
return false; |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,53 @@ |
|||
package com.bnyer.img.vo; |
|||
|
|||
import com.bnyer.common.core.annotation.Desensitized; |
|||
import com.bnyer.common.core.enums.SensitiveTypeEnum; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import io.swagger.annotations.ApiModel; |
|||
import io.swagger.annotations.ApiModelProperty; |
|||
import lombok.Getter; |
|||
import lombok.Setter; |
|||
|
|||
import java.io.Serializable; |
|||
|
|||
|
|||
@Getter |
|||
@Setter |
|||
@ApiModel("提现记录响应体") |
|||
public class WithdrawLogVo implements Serializable { |
|||
|
|||
@ApiModelProperty(value="主键id") |
|||
private Integer id; |
|||
|
|||
@ApiModelProperty(value="流水号") |
|||
private String orderId; |
|||
|
|||
@ApiModelProperty(value="艺术家id") |
|||
private Long creatorId; |
|||
|
|||
@ApiModelProperty(value="提现金额") |
|||
private Integer amt; |
|||
|
|||
@ApiModelProperty(value="银行卡(加密)") |
|||
@Desensitized(type = SensitiveTypeEnum.BANK_CARD) |
|||
private String bankNo; |
|||
|
|||
@ApiModelProperty(value="渠道(0->微信;1->银行卡)") |
|||
private String channel; |
|||
|
|||
@ApiModelProperty(value="状态(0->待审核;1->提现中;2->提现成功;3->提现失败;4->审核拒绝)") |
|||
private String status; |
|||
|
|||
@ApiModelProperty(value="理由") |
|||
private String reason; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="提现时间") |
|||
private String createTime; |
|||
|
|||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
|||
@ApiModelProperty(value="到账时间") |
|||
private String achieveTime; |
|||
|
|||
private static final long serialVersionUID = 1L; |
|||
} |
|||
Loading…
Reference in new issue