| | |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | import java.util.stream.IntStream; |
| | | |
| | | @Service |
| | | public class IApiDataServiceImpl implements IApiDataService { |
| | |
| | | |
| | | return apiDataMapper.listTop10(beginTime, endTime); |
| | | } |
| | | |
| | | @Override |
| | | public List<StatisticsEventsVO.ArithmeticVO> arithmeticEvent(Integer streetId, String beginTime, String endTime) { |
| | | List<StatisticsEventsVO.ArithmeticVO> list = apiDataMapper.arithmeticEvent(streetId, beginTime, endTime); |
| | | Integer all = list.stream().flatMapToInt(o -> IntStream.of(o.getCount())).sum(); |
| | | list.stream().forEach(o -> { |
| | | o.setRatio(new BigDecimal(((double) o.getCount() / (double) all)).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | }); |
| | | return list; |
| | | } |
| | | |
| | | @Override |
| | | public List<StatisticsEventsVO.LotVO> listLot(Integer streetId, String beginTime, String endTime) { |
| | | return apiDataMapper.listLot(streetId, beginTime, endTime); |
| | | } |
| | | } |