| | |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 首页秧苗产品总和 |
| | | */ |
| | | @GetMapping("/strainCountYM") |
| | | public R<IPage<FarmPlantVO>> strainCountYM(FarmPlantVO farmPlant, Query query) { |
| | | IPage<FarmPlantVO> pages = farmplantService.selectFarmPlantPageCountYM(Condition.getPage(query), farmPlant); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | //直播 |
| | | record.setType("11"); |
| | | } |
| | | if(farmPlant.getPlantingWay().equals("2")){ |
| | | //秧苗 |
| | | record.setType("13"); |
| | | } |
| | | record.setLandId(farmPlant.getLandId()); |
| | | record.setOperator(farmPlant.getCreateUser()); |
| | | record.setContent("品种: " + farmPlant.getVarieties()); |
| | |
| | | } |
| | | //更新并返回 |
| | | return R.status(status); |
| | | } |
| | | |
| | | @PostMapping("/overAll") |
| | | public R overAll(@RequestBody FarmPlantVO farmPlantVO){ |
| | | boolean status = false; |
| | | for (int i=0;i<farmPlantVO.getIds().length;i++){ |
| | | FarmPlant farmPlant = new FarmPlant(); |
| | | farmPlant.setId(farmPlantVO.getIds()[i]); |
| | | farmPlant.setEndPlantTime(farmPlantVO.getEndPlantTime()); |
| | | farmPlant.setStatus("2"); |
| | | status = farmplantService.updateById(farmPlant); |
| | | //判断该地块是否还有种植的农产品 |
| | | FarmPlant farmPlant2 = farmplantService.getById(farmPlant.getId()); |
| | | FarmPlant farmPlant1 = new FarmPlant(); |
| | | farmPlant1.setLandId(farmPlant2.getLandId()); |
| | | farmPlant1.setStatus("1"); |
| | | List<FarmPlant> list = farmplantService.list(new QueryWrapper<>(farmPlant1)); |
| | | if (list.size() < 1) { |
| | | //更新该地块的耕种状态 |
| | | Land land = new Land(); |
| | | land.setType(1); |
| | | land.setId(Long.parseLong(farmPlant2.getLandId())); |
| | | landService.updateById(land); |
| | | } |
| | | } |
| | | return R.data(status); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @GetMapping("/getFarmPlantStatisticsCountx") |
| | | public R getFarmPlantStatisticsCountx(FarmPlantVO farmPlant, Query query) { |
| | | Double num = 0.0; |
| | | // Double num = 0.0; |
| | | IPage<FarmPlantVO> pages = farmplantService.getFarmPlantStatisticsCountz(Condition.getPage(query), farmPlant); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | String area = pages.getRecords().get(i).getArea(); |
| | | Double a = Double.parseDouble(area); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(a); |
| | | pages.getRecords().get(i).setArea(format); |
| | | num += a; |
| | | } |
| | | Map map = new HashMap(); |
| | | List list = new ArrayList(); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(num); |
| | | map.put("znum", format); |
| | | list.add(map); |
| | | list.add(pages); |
| | | return R.data(list); |
| | | // for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | // String area = pages.getRecords().get(i).getArea(); |
| | | // Double a = Double.parseDouble(area); |
| | | // DecimalFormat df = new DecimalFormat("#.00"); |
| | | // String format = df.format(a); |
| | | // pages.getRecords().get(i).setArea(format); |
| | | // num += a; |
| | | // } |
| | | // Map map = new HashMap(); |
| | | // List list = new ArrayList(); |
| | | // DecimalFormat df = new DecimalFormat("#.00"); |
| | | // String format = df.format(num); |
| | | // map.put("znum", format); |
| | | // list.add(map); |
| | | // list.add(pages); |
| | | // return R.data(list); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | |