| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | | import java.util.Date; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 农产品库存控制器 |
| | | * @since 2022-05-18 |
| | | * |
| | | * @author zhongrj |
| | | * @since 2022-05-18 |
| | | */ |
| | | @RestController |
| | | @AllArgsConstructor |
| | |
| | | } |
| | | |
| | | /** |
| | | * 自定义分页 |
| | | */ |
| | | @GetMapping("/pages") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = "传入farmProductStock") |
| | | public R<List<FarmProductStockVO>> pages(FarmProductStockVO farmProductStock) { |
| | | List<FarmProductStockVO> pages = farmProductStockService.selectFarmProductStockPages(farmProductStock); |
| | | return R.data(pages); |
| | | } |
| | | |
| | | /** |
| | | * 统计产量 |
| | | * |
| | | * @param farmProductStock |
| | | * @return |
| | | */ |
| | |
| | | * 大屏产量统计 |
| | | */ |
| | | @PostMapping("/selctProductCount") |
| | | public R selctProductCount( String year) { |
| | | public R selctProductCount(String year) { |
| | | return R.data(farmProductStockService.selctProductCount(year)); |
| | | } |
| | | |
| | | /** |
| | | * 小程序统计产量详情 |
| | | * |
| | | * @param farmProductStock |
| | | * @return |
| | | */ |
| | | @GetMapping("/statisticsProductx") |
| | | public R statisticsProductx(FarmProductStockVO farmProductStock, Query query) { |
| | | Double zwei = 0.0; |
| | | IPage<FarmProductStockVO> pages = farmProductStockService.statisticsProductx(Condition.getPage(query), farmProductStock); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | String weight = pages.getRecords().get(i).getWeight(); |
| | | Double a=Double.parseDouble(weight); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(a); |
| | | //产量 |
| | | Double wei = Double.parseDouble(format); |
| | | pages.getRecords().get(i).setWeight(format); |
| | | zwei += wei; |
| | | } |
| | | Map map = new HashMap(); |
| | | List list = new ArrayList(); |
| | | DecimalFormat df = new DecimalFormat("#.00"); |
| | | String format = df.format(zwei); |
| | | map.put("zwei", format); |
| | | list.add(map); |
| | | list.add(pages); |
| | | return R.data(list); |
| | | } |
| | | |
| | | /** |
| | | * 大屏经营概况库存数量与年产量 |
| | | */ |
| | | @GetMapping("/statisticsStockAndYield") |
| | | public R statisticsStockAndYield(String year,String farmId) { |
| | | |
| | | //库存数量统计 |
| | | Map map = new HashMap(); |
| | | //统计当前库存农产品 |
| | | Map<String, String> sum = farmProductStockService.statisticsStock(year, farmId); |
| | | //统计当前库存加工产品 |
| | | Map<String, String> jgsum = null; |
| | | map.put("sum",sum.get("sum")); |
| | | map.put("jgsum",0); |
| | | |
| | | //农产品年产量统计 |
| | | // List<Map<String, Double>> Nsum = farmProductStockService.statisticsYield(year, deptId); |
| | | // double ncpNcl = Nsum.get(1).get("sum") + Nsum.get(0).get("sum"); |
| | | |
| | | map.put("ncpNcl", sum.get("cssum")); |
| | | |
| | | //加工产品年产量统计 |
| | | map.put("jgNcl",0); |
| | | return R.data(map); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 按月份统计产量 |
| | | */ |
| | | @GetMapping("/statisticsStockMonth") |
| | | public R statisticsStockMonth(String year,String deptId) { |
| | | |
| | | //采收数量统计 |
| | | Map map = new HashMap(); |
| | | List<Map<String, String>> cssum = farmProductStockService.statisticsStockMonth(year, deptId); |
| | | //加工产品数量统计 |
| | | Map<String, String> jgsum = null; |
| | | |
| | | return R.data(cssum); |
| | | } |
| | | |
| | | /** |
| | | * 农产品监管 |
| | | */ |
| | | @GetMapping("/productsSupervise") |
| | | public R productsSupervise(String year,String farmId) { |
| | | |
| | | Map<String, String> cssum = farmProductStockService.productsSupervise(year, farmId); |
| | | |
| | | return R.data(cssum); |
| | | } |
| | | |
| | | } |