| | |
| | | import org.springblade.modules.farmplant.vo.FarmPlantVO; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | }); |
| | | return page.setRecords(farmPlantVOS); |
| | | } |
| | | |
| | | /** |
| | | * 农产品种养统计 |
| | | * @param farm 农产品种植对象 |
| | | * @param page 分页查询对象 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<FarmPlantVO> getFarmPlantStatistics(IPage<FarmPlantVO> page, FarmPlantVO farm) { |
| | | List<FarmPlantVO> farmPlantVOS = baseMapper.getFarmPlantStatistics(page, farm); |
| | | //遍历 |
| | | farmPlantVOS.forEach(farmPlantVO -> { |
| | | if (farmPlantVO.getLandUnit().equals("1")){ |
| | | BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.1); |
| | | farmPlantVO.setAreas(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | } |
| | | if (farmPlantVO.getLandUnit().equals("2")){ |
| | | BigDecimal bg = new BigDecimal(farmPlantVO.getAreas()*0.0015); |
| | | farmPlantVO.setAreas(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); |
| | | } |
| | | }); |
| | | return page.setRecords(farmPlantVOS); |
| | | } |
| | | } |