| | |
| | | import org.springblade.modules.stock.service.IStockService; |
| | | import org.springblade.core.boot.ctrl.BladeController; |
| | | |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | * |
| | | * @return |
| | | */ |
| | | @PostMapping("/StockCount") |
| | | public R StockCount() { |
| | | List<Map<String, Object>> maps = stockService.StockCount(); |
| | | @GetMapping("/StockCount") |
| | | public R StockCount(String detpId) { |
| | | List<Map<String, Object>> maps = stockService.StockCount(detpId); |
| | | //化肥0 |
| | | double hf = 0; |
| | | //有机肥1 |
| | |
| | | rknu += rknum; |
| | | cknu += cknum; |
| | | } |
| | | Map map= new HashMap(); |
| | | map.put("rknum",rknu); |
| | | map.put("cknum",cknu); |
| | | Map map = new HashMap(); |
| | | DecimalFormat df = new DecimalFormat("#0.000"); |
| | | String format = df.format(rknu); |
| | | Double a = Double.parseDouble(format); |
| | | String format1 = df.format(cknu); |
| | | double b = Double.parseDouble(format1); |
| | | map.put("rknum", a); |
| | | map.put("cknum", b); |
| | | return R.data(map); |
| | | } |
| | | |
| | | /** |
| | | * 小程序农资数据统计详情 |
| | | * |
| | | * @param stock |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @PostMapping("/pagenums") |
| | | public R pagenums(StocksVO stock, Query query) { |
| | | Double rknu = 0.0; |
| | | Double cknu = 0.0; |
| | | IPage<StocksVO> pages = stockService.slectNum(Condition.getPage(query), stock); |
| | | for (int i = 0; i < pages.getRecords().size(); i++) { |
| | | Double cgnum = pages.getRecords().get(i).getCgnum(); |
| | | Double dbrknum = pages.getRecords().get(i).getDbrknum(); |
| | | double v = cgnum + dbrknum; |
| | | pages.getRecords().get(i).setRknum(v); |
| | | Double lycknum = pages.getRecords().get(i).getLycknum(); |
| | | Double dbcknum = pages.getRecords().get(i).getDbcknum(); |
| | | Double bfcknum = pages.getRecords().get(i).getBfcknum(); |
| | | double v1 = lycknum + dbcknum + bfcknum; |
| | | pages.getRecords().get(i).setCknum(v1); |
| | | } |
| | | for (int j = 0; j < pages.getRecords().size(); j++) { |
| | | Double rknum = pages.getRecords().get(j).getRknum(); |
| | | Double cknum = pages.getRecords().get(j).getCknum(); |
| | | rknu += rknum; |
| | | cknu += cknum; |
| | | } |
| | | Map map = new HashMap(); |
| | | DecimalFormat df = new DecimalFormat("#0.000"); |
| | | String format = df.format(rknu); |
| | | Double a = Double.parseDouble(format); |
| | | String format1 = df.format(cknu); |
| | | double b = Double.parseDouble(format1); |
| | | map.put("rknum", a); |
| | | map.put("cknum", b); |
| | | List list = new ArrayList(); |
| | | list.add(map); |
| | | list.add(pages); |
| | | return R.data(list); |
| | | } |
| | | |
| | | |
| | | } |