| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.system.mapper.TCrmClinicMapper; |
| | | import com.ruoyi.system.mapper.TCrmSupplierMapper; |
| | | import com.ruoyi.system.mapper.TErpIssueReportingMapper; |
| | | import com.ruoyi.system.model.TCrmClinic; |
| | | import com.ruoyi.system.model.TCrmSupplier; |
| | | import com.ruoyi.system.model.TErpGoodsType; |
| | | import com.ruoyi.system.model.TErpIssueReporting; |
| | | import com.ruoyi.system.query.TErpIssueReportingQuery; |
| | | import com.ruoyi.system.service.TErpIssueReportingService; |
| | | import com.ruoyi.system.vo.TErpIssueReportingVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TErpIssueReportingServiceImpl extends ServiceImpl<TErpIssueReportingMapper, TErpIssueReporting> implements TErpIssueReportingService { |
| | | |
| | | @Autowired |
| | | private TCrmSupplierMapper crmSupplierMapper; |
| | | @Autowired |
| | | private TCrmClinicMapper crmClinicMapper; |
| | | |
| | | @Override |
| | | public PageInfo<TErpIssueReportingVO> pageList(TErpIssueReportingQuery query) { |
| | | PageInfo<TErpIssueReportingVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TErpIssueReportingVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | List<String> reportUserIds = list.stream().map(TErpIssueReportingVO::getReportUserId).collect(Collectors.toList()); |
| | | List<TCrmSupplier> crmSuppliers = crmSupplierMapper.selectBatchIds(reportUserIds); |
| | | List<TCrmClinic> crmClinics = crmClinicMapper.selectBatchIds(reportUserIds); |
| | | for (TErpIssueReportingVO tErpIssueReportingVO : list) { |
| | | switch (tErpIssueReportingVO.getReportType()) { |
| | | case 1: |
| | | crmSuppliers.stream().filter(t -> t.getId().equals(tErpIssueReportingVO.getReportUserId())).findFirst().ifPresent(t -> tErpIssueReportingVO.setSupplierClinicName(t.getSupplierName())); |
| | | break; |
| | | case 2: |
| | | crmClinics.stream().filter(t -> t.getId().equals(tErpIssueReportingVO.getReportUserId())).findFirst().ifPresent(t -> tErpIssueReportingVO.setSupplierClinicName(t.getClinicName())); |
| | | break; |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |