| | |
| | | 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.TFeasibilityStudyReportMapper; |
| | | import com.ruoyi.system.model.TFeasibilityStudyReport; |
| | | import com.ruoyi.system.query.TFeasibilityStudyReportQuery; |
| | | import com.ruoyi.system.service.TFeasibilityStudyReportService; |
| | | import com.ruoyi.system.vo.TFeasibilityStudyReportVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @Service |
| | | public class TFeasibilityStudyReportServiceImpl extends ServiceImpl<TFeasibilityStudyReportMapper, TFeasibilityStudyReport> implements TFeasibilityStudyReportService { |
| | | |
| | | @Override |
| | | public PageInfo<TFeasibilityStudyReportVO> pageList(TFeasibilityStudyReportQuery query) { |
| | | PageInfo<TFeasibilityStudyReportVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TFeasibilityStudyReportVO> list = this.baseMapper.pageList(query,pageInfo); |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public PageInfo<TFeasibilityStudyReportVO> evaluatePageList(TFeasibilityStudyReportQuery query) { |
| | | PageInfo<TFeasibilityStudyReportVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize()); |
| | | List<TFeasibilityStudyReportVO> list = this.baseMapper.evaluatePageList(query,pageInfo); |
| | | for (TFeasibilityStudyReportVO tFeasibilityStudyReportVO : list) { |
| | | String scoreStr = tFeasibilityStudyReportVO.getEvaluateScore(); |
| | | if (scoreStr == null || scoreStr.isEmpty()) { |
| | | tFeasibilityStudyReportVO.setTotalScore(0); |
| | | continue; |
| | | } |
| | | |
| | | try { |
| | | // 使用 Stream 累加分数 |
| | | int sum = Arrays.stream(scoreStr.split(",")) |
| | | .mapToInt(Integer::parseInt) |
| | | .sum(); |
| | | tFeasibilityStudyReportVO.setTotalScore(sum); |
| | | } catch (NumberFormatException e) { |
| | | tFeasibilityStudyReportVO.setTotalScore(0); |
| | | } |
| | | } |
| | | pageInfo.setRecords(list); |
| | | return pageInfo; |
| | | } |
| | | |
| | | @Override |
| | | public Map<String, Integer> evaluateCount(TFeasibilityStudyReportQuery query) { |
| | | Map<String, Integer> map = this.baseMapper.evaluateCount(query); |
| | | return map; |
| | | } |
| | | } |