|  | @@ -1,7 +1,9 @@
 | 
	
		
			
				|  |  |  package com.zhongshu.reward.server.core.service;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.github.microservice.auth.security.helper.AuthHelper;
 | 
	
		
			
				|  |  |  import com.github.microservice.core.util.result.content.ResultContent;
 | 
	
		
			
				|  |  |  import com.github.microservice.core.util.result.content.ResultState;
 | 
	
		
			
				|  |  | +import com.zhongshu.reward.client.model.VipUserModel;
 | 
	
		
			
				|  |  |  import com.zhongshu.reward.client.model.wallet.WalletReceiptsModel;
 | 
	
		
			
				|  |  |  import com.zhongshu.reward.client.type.ReceiptsStatus;
 | 
	
		
			
				|  |  |  import com.zhongshu.reward.client.type.ReceiptsType;
 | 
	
	
		
			
				|  | @@ -16,9 +18,9 @@ import com.zhongshu.reward.server.core.domain.Wallet;
 | 
	
		
			
				|  |  |  import com.zhongshu.reward.server.core.domain.WalletReceipts;
 | 
	
		
			
				|  |  |  import com.zhongshu.reward.server.core.util.DateUtils;
 | 
	
		
			
				|  |  |  import com.zhongshu.vip.client.model.param.VipUserParam;
 | 
	
		
			
				|  |  | -import com.zswl.cloud.bdb.client.vo.PromotionLogVo;
 | 
	
		
			
				|  |  |  import lombok.extern.slf4j.Slf4j;
 | 
	
		
			
				|  |  |  import org.apache.commons.lang3.ObjectUtils;
 | 
	
		
			
				|  |  | +import org.jetbrains.annotations.NotNull;
 | 
	
		
			
				|  |  |  import org.springframework.beans.BeanUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.stereotype.Service;
 | 
	
	
		
			
				|  | @@ -52,6 +54,9 @@ public class WalletReceiptsService {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      InviteRecordDao inviteRecordDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    AuthHelper authHelper;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      /**
 | 
	
		
			
				|  |  |       * 邀请返利入账
 | 
	
	
		
			
				|  | @@ -124,11 +129,43 @@ public class WalletReceiptsService {
 | 
	
		
			
				|  |  |          return ResultContent.build(ResultState.Success);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -    public Object listByWallet(String walletId){
 | 
	
		
			
				|  |  | -        List<WalletReceipts> list = walletReceiptsDao.findByWallet_IdOrderByCreateTimeDesc(walletId);
 | 
	
		
			
				|  |  | +    public Object listByWallet(){
 | 
	
		
			
				|  |  | +        String userId = authHelper.getCurrentUser().getUserId();
 | 
	
		
			
				|  |  | +        Wallet wallet = walletService.getWalletByUserId(userId);
 | 
	
		
			
				|  |  | +        List<WalletReceipts> list = walletReceiptsDao.findByWallet_IdOrderByCreateTimeDesc(wallet.getId());
 | 
	
		
			
				|  |  |          return ResultContent.buildContent(list.stream().map(this::toModel).collect(Collectors.toList()));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    public Object receiptsDetail(String receiptsId){
 | 
	
		
			
				|  |  | +        WalletReceipts walletReceipts = walletReceiptsDao.findTop1ById(receiptsId);
 | 
	
		
			
				|  |  | +        if (ObjectUtils.isEmpty(walletReceipts)){
 | 
	
		
			
				|  |  | +            return ResultContent.build(ResultState.Fail, "记录不存在");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        VipUserRecord vipUserRecord = walletReceipts.getVipUserRecord();
 | 
	
		
			
				|  |  | +        VipUserModel vipUserModel = new VipUserModel();
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(vipUserRecord, vipUserModel);
 | 
	
		
			
				|  |  | +        BeanUtils.copyProperties(walletReceipts, vipUserModel);
 | 
	
		
			
				|  |  | +        return ResultContent.buildContent(vipUserModel);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    public Object receiptsDetail(Integer year, Integer month){
 | 
	
		
			
				|  |  | +        String userId = authHelper.getCurrentUser().getUserId();
 | 
	
		
			
				|  |  | +        Long monthStartTime = DateUtils.getMonthStartTime(year, month);
 | 
	
		
			
				|  |  | +        Long monthEndTime = DateUtils.getMonthEndTime(year, month);
 | 
	
		
			
				|  |  | +        List<WalletReceipts> walletReceipts = walletReceiptsDao.inviteDetail(userId, monthStartTime, monthEndTime);
 | 
	
		
			
				|  |  | +        return ResultContent.buildContent(walletReceipts.stream().map(this::toVipUserModel).collect(Collectors.toList()));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private VipUserModel toVipUserModel(WalletReceipts walletReceipts) {
 | 
	
		
			
				|  |  | +        VipUserModel vipUserModel = new VipUserModel();
 | 
	
		
			
				|  |  | +        if (ObjectUtils.isNotEmpty(walletReceipts)){
 | 
	
		
			
				|  |  | +            VipUserRecord vipUserRecord = walletReceipts.getVipUserRecord();
 | 
	
		
			
				|  |  | +            BeanUtils.copyProperties(vipUserRecord, vipUserModel);
 | 
	
		
			
				|  |  | +            BeanUtils.copyProperties(walletReceipts, vipUserModel);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return vipUserModel;
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      WalletReceiptsModel toModel(WalletReceipts walletReceipts){
 | 
	
		
			
				|  |  |          WalletReceiptsModel model = new WalletReceiptsModel();
 | 
	
		
			
				|  |  |          if (null != walletReceipts){
 |