|
|
|
@ -15,6 +15,7 @@ import com.hnac.hzims.safeproduct.entity.CarEntity;
|
|
|
|
|
import com.hnac.hzims.safeproduct.mapper.CarMapper; |
|
|
|
|
import com.hnac.hzims.safeproduct.service.*; |
|
|
|
|
import com.hnac.hzims.safeproduct.vo.CarMilesYearVO; |
|
|
|
|
import org.apache.commons.collections4.map.HashedMap; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
@ -29,6 +30,7 @@ import java.io.IOException;
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.net.URLEncoder; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Comparator; |
|
|
|
|
import java.util.List; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
@ -71,7 +73,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
|
|
|
|
|
} |
|
|
|
|
List<String> carList = records.stream().map(CarMilesYearVO::getPlateNumber).collect(Collectors.toList()); |
|
|
|
|
List<CarMilesYearDTO> milesList = baseMapper.selectMilesByCar(carList, year); |
|
|
|
|
List<CarMilesYearVO> res = new ArrayList<>(); |
|
|
|
|
HashedMap<String, CarMilesYearVO> map = new HashedMap<>(); |
|
|
|
|
milesList.forEach(data -> { |
|
|
|
|
CarMilesYearVO carMilesYearVO = records.stream().filter(x -> x.getPlateNumber().equals(data.getPlateNumber())) |
|
|
|
|
.collect(Collectors.toList()).get(0); |
|
|
|
@ -127,11 +129,14 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, CarEntity> implements
|
|
|
|
|
carMilesYearVO.setSumMiles(sum.add(data.getMiles())); |
|
|
|
|
} |
|
|
|
|
if (!carMilesYearVO.getSumMiles().equals(new BigDecimal(0))) { |
|
|
|
|
res.add(carMilesYearVO); |
|
|
|
|
map.put(carMilesYearVO.getPlateNumber(), carMilesYearVO); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
List<CarMilesYearVO> list = new ArrayList<>(map.values()); |
|
|
|
|
List<CarMilesYearVO> res = list.stream().sorted(Comparator.comparing(CarMilesYearVO::getCreateTime).reversed()) |
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
page.setRecords(res); |
|
|
|
|
page.setTotal(res.size()); |
|
|
|
|
page.setTotal(carPage.getTotal()); |
|
|
|
|
return page; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|