| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.activity.entity.HuiminPayQuery; |
| | |
| | | public Page<SalesDetailVO> selectPage(HuiminPayQuery query) { |
| | | Page<SalesDetailVO> salesDetailVOPage = baseMapper.selectSalesDetailPage(new Page<>(query.getCurrent(), query.getSize()), query); |
| | | List<SalesDetailVO> records = salesDetailVOPage.getRecords(); |
| | | for (SalesDetailVO record : records) { |
| | | List<THuiminRecord> list = huiminRecordService.list(new LambdaQueryWrapper<THuiminRecord>() |
| | | .eq(THuiminRecord::getAppUserId, record.getAppUserId()) |
| | | .eq(THuiminRecord::getHuiminCardId, record.getCarId())); |
| | | record.setUseTimes(list.size()); |
| | | } |
| | | if (CollUtil.isNotEmpty(records)){ |
| | | List<Integer> appUserIdList = records.stream().map(SalesDetailVO::getAppUserId).collect(Collectors.toList()); |
| | | List<AppUser> appUserList = appUserClient.queryAppUserBatch(appUserIdList); |
| | |
| | | */ |
| | | @Override |
| | | public List<SalesDetailVO> exportData(HuiminPayQuery query) { |
| | | return baseMapper.exportData(query); |
| | | List<SalesDetailVO> records = baseMapper.exportData(query); |
| | | if (CollUtil.isNotEmpty(records)){ |
| | | List<Integer> appUserIdList = records.stream().map(SalesDetailVO::getAppUserId).collect(Collectors.toList()); |
| | | List<AppUser> appUserList = appUserClient.queryAppUserBatch(appUserIdList); |
| | | Map<Integer, AppUser> appUserMap = appUserList.stream().collect(Collectors.toMap(AppUser::getId, appUser -> appUser)); |
| | | records.forEach(item->{ |
| | | AppUser appUser = appUserMap.get(item.getAppUserId()); |
| | | if (Objects.nonNull(appUser)){ |
| | | item.setUserName(appUser.getName()); |
| | | item.setPhone(appUser.getPhone()); |
| | | } |
| | | List<TStudent> studentList = studentClient.getStudentByIds(item.getStudentId()); |
| | | if (CollUtil.isNotEmpty(studentList)){ |
| | | item.setStudentName(studentList.stream().map(TStudent::getName).collect(Collectors.joining(","))); |
| | | } |
| | | }); |
| | | } |
| | | return records; |
| | | } |
| | | } |