无关风月
4 天以前 7fd053651ac11db87fe4f6c57e65eed3b9a59452
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package com.ruoyi.other.service.impl;
 
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.api.feignClient.AppUserClient;
import com.ruoyi.account.api.model.AppUser;
import com.ruoyi.common.core.web.page.PageInfo;
import com.ruoyi.other.api.domain.IntegralRecord;
import com.ruoyi.other.api.domain.TIntegralRule;
import com.ruoyi.other.mapper.IntegralRecordMapper;
import com.ruoyi.other.mapper.IntegralRuleMapper;
import com.ruoyi.other.query.IntegralListQuery;
import com.ruoyi.other.service.TIntegralRecordService;
import com.ruoyi.other.service.TIntegralRuleService;
import com.ruoyi.other.vo.IntegralListVO;
import com.ruoyi.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
/**
 * @author zhibing.pu
 * @Date 2024/11/21 10:48
 */
@Service
public class IntegralRecordServiceImpl extends ServiceImpl<IntegralRecordMapper, IntegralRecord> implements TIntegralRecordService {
    @Autowired
    private AppUserClient appUserClient;
    @Override
    public PageInfo<IntegralListVO> integralPageList(IntegralListQuery query) {
        PageInfo<IntegralListVO> pageInfo = new PageInfo<>(query.getPageCurr(), query.getPageSize());
        List<IntegralListVO> list = this.baseMapper.integralPageList(query,pageInfo);
        List<AppUser> appUserAll = appUserClient.getAppUserAll();
        for (IntegralListVO integralListVO : list) {
            if (integralListVO.getAppUserId()!=null){
                AppUser appUser = appUserAll.stream().filter(e -> e.getId().equals(integralListVO.getAppUserId()))
                        .findFirst().orElse(null);
                if (appUser!=null){
                    integralListVO.setAppUserName(appUser.getName());
                    integralListVO.setPhone(appUser.getPhone());
                }
            }
        }
        pageInfo.setRecords(list);
        return pageInfo;
    }
}