| | |
| | | import org.springblade.modules.farmplant.entity.FarmProductStock; |
| | | import org.springblade.modules.farmplant.service.FarmProductStockService; |
| | | import org.springblade.modules.farmplant.vo.FarmProductStockVO; |
| | | import org.springblade.modules.process.service.IProcessService; |
| | | import org.springblade.modules.processInv.entity.ProcessInv; |
| | | import org.springblade.modules.processInv.service.IProcessInvService; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | |
| | | public class FarmProductStockController extends BladeController { |
| | | |
| | | private final FarmProductStockService farmProductStockService; |
| | | private final IProcessInvService processInvService; |
| | | private final IProcessService processService; |
| | | |
| | | /** |
| | | * 详情 |
| | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | @GetMapping("/strainCount") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入farmProductStock") |
| | | public R<IPage<FarmProductStockVO>> strainCount(FarmProductStockVO farmProductStock, Query query) { |
| | | IPage<FarmProductStockVO> pages = farmProductStockService.selectFarmProductStockPagesCount(Condition.getPage(query), farmProductStock); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | */ |
| | |
| | | public R<List<FarmProductStockVO>> pages(FarmProductStockVO farmProductStock) { |
| | | List<FarmProductStockVO> pages = farmProductStockService.selectFarmProductStockPages(farmProductStock); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | @GetMapping("/getFarmProductStockByFarmIdAndStrainId") |
| | | public R<FarmProductStock> findFarmProductStockByFarmIdAndStrainId(String farmId,Integer strainId) { |
| | | List<FarmProductStock> farmProductStockList = farmProductStockService.findFarmProductStockByFarmIdAndStrainId(farmId,strainId); |
| | | if (farmProductStockList.size() == 0) { |
| | | return R.data(null); |
| | | } |
| | | return R.data(farmProductStockList.get(0)); |
| | | } |
| | | |
| | | /** |
| | |
| | | //统计当前库存农产品 |
| | | Map<String, String> sum = farmProductStockService.statisticsStock(year, farmId); |
| | | //统计当前库存加工产品 |
| | | Map<String, String> jgsum = null; |
| | | // Map<String, String> jgsum = null; |
| | | Double jgsum = processInvService.statisticsStock(year,farmId); |
| | | Double jgNcl = processService.statistics(year,farmId); |
| | | if (sum != null){ |
| | | map.put("sum",sum.get("sum")); |
| | | map.put("ncpNcl", sum.get("cssum")); |
| | |
| | | map.put("sum",0); |
| | | map.put("ncpNcl",0); |
| | | } |
| | | map.put("jgsum",0); |
| | | map.put("jgsum",jgsum); |
| | | |
| | | //农产品年产量统计 |
| | | // List<Map<String, Double>> Nsum = farmProductStockService.statisticsYield(year, deptId); |
| | |
| | | |
| | | |
| | | //加工产品年产量统计 |
| | | map.put("jgNcl",0); |
| | | map.put("jgNcl",jgNcl); |
| | | return R.data(map); |
| | | } |
| | | |
| | |
| | | public R statisticsStockMonth(String year,String farmId) { |
| | | |
| | | //采收数量统计 |
| | | Map map = new HashMap(); |
| | | Map<String,List<Map<String, String>>> map = new HashMap(); |
| | | List<Map<String, String>> cssum = farmProductStockService.statisticsStockMonth(year, farmId); |
| | | //加工产品数量统计 |
| | | Map<String, String> jgsum = null; |
| | | List<Map<String, String>> jgsum = processService.statisticsMonth(year,farmId); |
| | | |
| | | return R.data(cssum); |
| | | map.put("csssum",cssum); |
| | | map.put("jgsum",jgsum); |
| | | return R.data(map); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.data(cssum); |
| | | } |
| | | |
| | | @GetMapping("/getByLandId") |
| | | public R getByLandId(String strainId,String landId){ |
| | | FarmProductStock farmProductStock = farmProductStockService.selectBy2Id(strainId,landId); |
| | | return R.data(farmProductStock); |
| | | } |
| | | |
| | | } |