|  | @@ -2,6 +2,7 @@ package com.yonge.cooleshow.biz.dal.service.impl;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  |  import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.dto.excel.UserWithdrawalExport;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.enums.FrozenTypeEnum;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.constant.SysConfigConstant;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dao.UserBankCardDao;
 | 
	
	
		
			
				|  | @@ -18,6 +19,10 @@ import com.yonge.cooleshow.biz.dal.vo.UserBankCardVo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.vo.res.WithdrawalInfoRes;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.exception.BizException;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.utils.easyexcel.ErrMsg;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.utils.easyexcel.ExcelDataReaderProperty;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.utils.easyexcel.ExcelException;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.utils.string.StringUtil;
 | 
	
		
			
				|  |  |  import com.yonge.toolset.utils.string.ValueUtil;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
		
			
				|  |  |  import org.slf4j.LoggerFactory;
 | 
	
	
		
			
				|  | @@ -29,8 +34,12 @@ import com.yonge.cooleshow.biz.dal.dto.search.TeacherWithdrawalSearch;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dao.UserWithdrawalDao;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.UserWithdrawalService;
 | 
	
		
			
				|  |  |  import org.springframework.transaction.annotation.Transactional;
 | 
	
		
			
				|  |  | +import org.springframework.util.CollectionUtils;
 | 
	
		
			
				|  |  | +import org.springframework.util.DigestUtils;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import java.math.BigDecimal;
 | 
	
		
			
				|  |  | +import java.util.ArrayList;
 | 
	
		
			
				|  |  | +import java.util.Comparator;
 | 
	
		
			
				|  |  |  import java.util.Date;
 | 
	
		
			
				|  |  |  import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -55,7 +64,9 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
		
			
				|  |  |      public IPage<UserWithdrawalVo> selectPage(IPage<UserWithdrawalVo> page, TeacherWithdrawalSearch query) {
 | 
	
		
			
				|  |  | -        return page.setRecords(baseMapper.selectPage(page, query));
 | 
	
		
			
				|  |  | +        List<UserWithdrawalVo> withdrawalVoList = baseMapper.selectPage(page, query);
 | 
	
		
			
				|  |  | +        withdrawalVoList.forEach(o -> o.setBankCard(ValueUtil.fuzzyBankCard(o.getBankCard())));
 | 
	
		
			
				|  |  | +        return page.setRecords(withdrawalVoList);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Override
 | 
	
	
		
			
				|  | @@ -109,13 +120,59 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
 | 
	
		
			
				|  |  |          );
 | 
	
		
			
				|  |  |          accountRecordDto.setFrozenType(FrozenTypeEnum.FROZEN);
 | 
	
		
			
				|  |  |          HttpResponseResult<UserAccountRecord> accountChange = userAccountService.accountChange(accountRecordDto);
 | 
	
		
			
				|  |  | -        if(accountChange.getStatus()){
 | 
	
		
			
				|  |  | +        if (accountChange.getStatus()) {
 | 
	
		
			
				|  |  |              return HttpResponseResult.succeed(true);
 | 
	
		
			
				|  |  | -        }else{
 | 
	
		
			
				|  |  | +        } else {
 | 
	
		
			
				|  |  |              throw new BizException("提现失败");
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    @Transactional
 | 
	
		
			
				|  |  | +    public void importExcel(List<ExcelDataReaderProperty<UserWithdrawalExport>> dataList) {
 | 
	
		
			
				|  |  | +        List<ErrMsg> errMsgList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        dataList.sort(Comparator.comparingInt(ExcelDataReaderProperty::getRowIndex));
 | 
	
		
			
				|  |  | +        List<UserWithdrawal> userWithdrawalList = new ArrayList<>();
 | 
	
		
			
				|  |  | +        for (ExcelDataReaderProperty<UserWithdrawalExport> dataReaderProperty : dataList) {
 | 
	
		
			
				|  |  | +            String errMsg = dataReaderProperty.getErrorMessage();
 | 
	
		
			
				|  |  | +            if (StringUtil.isEmpty(errMsg)) {
 | 
	
		
			
				|  |  | +                errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), errMsg));
 | 
	
		
			
				|  |  | +                continue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            UserWithdrawalExport data = dataReaderProperty.getClazz();
 | 
	
		
			
				|  |  | +            StringBuffer buffer = new StringBuffer(data.getId().toString());
 | 
	
		
			
				|  |  | +            buffer.append(data.getUserId());
 | 
	
		
			
				|  |  | +            buffer.append(data.getAmount());
 | 
	
		
			
				|  |  | +            buffer.append(data.getActualAmount());
 | 
	
		
			
				|  |  | +            String sign = DigestUtils.md5DigestAsHex(buffer.toString().getBytes());
 | 
	
		
			
				|  |  | +            if (!data.getSign().equals(sign)) {
 | 
	
		
			
				|  |  | +                errMsgList.add(new ErrMsg(dataReaderProperty.getRowIndex(), "验签失败"));
 | 
	
		
			
				|  |  | +                continue;
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +            UserWithdrawal userWithdrawal = new UserWithdrawal();
 | 
	
		
			
				|  |  | +            userWithdrawal.setId(data.getId());
 | 
	
		
			
				|  |  | +            userWithdrawal.setBankFlowNo(data.getBankFlowNo());
 | 
	
		
			
				|  |  | +            userWithdrawal.setStatus(data.getStatus());
 | 
	
		
			
				|  |  | +            userWithdrawalList.add(userWithdrawal);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        if (!CollectionUtils.isEmpty(errMsgList)) {
 | 
	
		
			
				|  |  | +            throw new ExcelException("导入异常", errMsgList);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        authWithdrawalBancth(userWithdrawalList);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    /***
 | 
	
		
			
				|  |  | +     * 审核
 | 
	
		
			
				|  |  | +     * @author liweifan
 | 
	
		
			
				|  |  | +     * @param: userWithdrawalList
 | 
	
		
			
				|  |  | +     * @updateTime 2022/4/20 11:18
 | 
	
		
			
				|  |  | +     */
 | 
	
		
			
				|  |  | +    private void authWithdrawalBancth(List<UserWithdrawal> userWithdrawalList) {
 | 
	
		
			
				|  |  | +        for (UserWithdrawal userWithdrawal : userWithdrawalList) {
 | 
	
		
			
				|  |  | +            baseMapper.updateById(userWithdrawal);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      /***
 | 
	
		
			
				|  |  |       * 入提现表
 | 
	
		
			
				|  |  |       * @author liweifan
 | 
	
	
		
			
				|  | @@ -135,8 +192,6 @@ public class UserWithdrawalServiceImpl extends ServiceImpl<UserWithdrawalDao, Us
 | 
	
		
			
				|  |  |          BigDecimal actualAmount = withdrawalReq.getAmountWithdrawal().subtract(withdrawalServiceFee);
 | 
	
		
			
				|  |  |          userWithdrawal.setActualAmount(actualAmount);
 | 
	
		
			
				|  |  |          userWithdrawal.setBankCard(bankCardVo.getBankCard());
 | 
	
		
			
				|  |  | -        //todo 银行流水号
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  |          userWithdrawal.setCreateTime(new Date());
 | 
	
		
			
				|  |  |          userWithdrawal.setUpdateTime(new Date());
 | 
	
		
			
				|  |  |          userWithdrawal.setStatus(AuthStatusEnum.DOING);
 |