| | |
| | | import org.springblade.modules.farmplant.vo.FarmPlantVO; |
| | | import org.springblade.modules.farmplant.vo.StrainVO; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | |
| | | List<FarmPlantVO> farmPlantVOS = baseMapper.selectFarmPlantPage(page, farm); |
| | | //遍历 |
| | | farmPlantVOS.forEach(farmPlantVO -> { |
| | | //面积单位(0: 亩 1:分 2:平方米) |
| | | if (farmPlantVO.getLandUnit().equals("0")) { |
| | | farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 1)); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<FarmPlantVO> selectFarmPlantPageCount(IPage<Object> page, FarmPlantVO farmPlant) { |
| | | return baseMapper.selectFarmPlantPageCount(page, farmPlant); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<FarmPlantVO> selectFarmPlantPageCountYM(IPage<Object> page, FarmPlantVO farmPlant) { |
| | | return baseMapper.selectFarmPlantPageCountYM(page, farmPlant); |
| | | } |
| | | |
| | | @Override |
| | | public IPage<FarmPlantVO> getFarmPlantStatisticsCountz(IPage<FarmPlantVO> page, FarmPlantVO farm) { |
| | | List<FarmPlantVO> farmPlantVOS = baseMapper.getFarmPlantStatisticsCountz(page, farm); |
| | | //遍历 |
| | | farmPlantVOS.forEach(farmPlantVO -> { |
| | | if (farmPlantVO.getLandUnit().equals("1")) { |
| | | farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.1)); |
| | | } |
| | | if (farmPlantVO.getLandUnit().equals("2")) { |
| | | farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.0015)); |
| | | } |
| | | }); |
| | | // //遍历 |
| | | // farmPlantVOS.forEach(farmPlantVO -> { |
| | | // if (farmPlantVO.getLandUnit().equals("1")) { |
| | | // farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.1)); |
| | | // } |
| | | // if (farmPlantVO.getLandUnit().equals("2")) { |
| | | // farmPlantVO.setArea(String.format("%.2f", Double.parseDouble(farmPlantVO.getArea()) * 0.0015)); |
| | | // } |
| | | // }); |
| | | return page.setRecords(farmPlantVOS); |
| | | } |
| | | |
| | |
| | | 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()); |
| | | } |
| | | }); |
| | | // 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); |
| | | } |
| | | |