| | |
| | | import org.springblade.modules.recovery.entity.Recovery; |
| | | import org.springblade.modules.recovery.service.RecoveryService; |
| | | import org.springblade.modules.recovery.vo.RecoveryVO; |
| | | import org.springblade.modules.stock.vo.StocksVO; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | import java.text.DecimalFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 农事记录控制器 |
| | |
| | | farmingRecordService.save(record); |
| | | |
| | | //库存 |
| | | //先查询是否有该农产品的库存 |
| | | //先查询是否有该农产品的库存(根据地块,农产品) |
| | | FarmProductStock stock = new FarmProductStock(); |
| | | stock.setFarmPlantId(recovery.getFarmPlantId()); |
| | | stock.setStrainId(recovery.getStrainId()); |
| | | stock.setLandId(recovery.getLandId()); |
| | | FarmProductStock stock1 = farmProductStockService.getOne(new QueryWrapper<>(stock)); |
| | | if (null != stock1) { |
| | | //更新库存 |
| | |
| | | double now = Double.parseDouble(recovery.getWeight()); |
| | | double addNum = add(old, now); |
| | | stock1.setWeight(String.valueOf(addNum)); |
| | | |
| | | //总采收 |
| | | double olds = Double.parseDouble(stock1.getRecovery()); |
| | | double addNums = add(olds, now); |
| | | stock1.setRecovery(String.valueOf(addNums)); |
| | | //更新 |
| | | farmProductStockService.updateById(stock1); |
| | | } else { |
| | |
| | | productStock.setTime(recovery.getTime()); |
| | | productStock.setStrainId(recovery.getStrainId()); |
| | | productStock.setWeight(recovery.getWeight()); |
| | | productStock.setRecovery(recovery.getWeight()); |
| | | productStock.setFarmPlantId(recovery.getFarmPlantId()); |
| | | productStock.setTenantId(recovery.getTenantId()); |
| | | productStock.setDeptId(recovery.getDeptId()); |
| | | productStock.setLandId(recovery.getLandId()); |
| | | //新增操作 |
| | | farmProductStockService.save(productStock); |
| | | } |
| | |
| | | return R.status(recoveryService.removeByIds(Func.toLongList(ids))); |
| | | } |
| | | |
| | | /** |
| | | * 数据统计采收详情 |
| | | */ |
| | | @PostMapping("/recoveryStatistics") |
| | | public R<IPage<RecoveryVO>> recoveryStatistics(RecoveryVO recoveryVO, Query query){ |
| | | IPage<RecoveryVO> pages = recoveryService.recoveryStatistics(Condition.getPage(query), recoveryVO); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * xcx数据统计采收详情 |
| | | */ |
| | | @GetMapping("/recoveryStatisticsx") |
| | | public R recoveryStatisticsx( RecoveryVO recoveryVO, Query query){ |
| | | IPage<RecoveryVO> pages = recoveryService.recoveryStatisticsx(Condition.getPage(query), recoveryVO); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 小程序采收详情列表自定义分页 |