| | |
| | | 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.TTesterOtherTaskMapper; |
| | | import com.ruoyi.system.model.TTesterOtherTask; |
| | | import com.ruoyi.system.query.TTesterOtherTaskQuery; |
| | | import com.ruoyi.system.service.TTesterOtherTaskService; |
| | | import com.ruoyi.system.vo.TTesterOtherTaskVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TTesterOtherTaskServiceImpl extends ServiceImpl<TTesterOtherTaskMapper, TTesterOtherTask> implements TTesterOtherTaskService { |
| | | |
| | | @Override |
| | | public PageInfo<TTesterOtherTaskVO> pageList(TTesterOtherTaskQuery query) { |
| | | PageInfo<TTesterOtherTaskVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TTesterOtherTaskVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | return pageInfo; |
| | | } |
| | | // 统计总分数 |
| | | List<TTesterOtherTask> teamList = this.list(); |
| | | for (TTesterOtherTaskVO tTesterOtherTaskVO : list) { |
| | | List<TTesterOtherTask> taskList = teamList.stream().filter(item -> item.getTeamId().equals(tTesterOtherTaskVO.getTeamId())).collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(taskList)){ |
| | | tTesterOtherTaskVO.setTotalScore(0); |
| | | } |
| | | tTesterOtherTaskVO.setTotalScore(taskList.stream().mapToInt(TTesterOtherTask::getEvaluateScore).sum()); |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | } |