| | |
| | | } |
| | | |
| | | /** |
| | | * 近24小时入出库折线(横轴小时),与按日 {@link #locIoLineCharts()} 数据口径不同,供电视机「作业效率」使用 |
| | | */ |
| | | @GetMapping("/line/charts/hourly") |
| | | public R locIoLineChartsHourly() { |
| | | Map<String, Object> map = new HashMap<>(); |
| | | List<AxisBean> list = new ArrayList<>(); |
| | | |
| | | List<WorkChartAxis> listChart = reportQueryMapper.getChartAxisHourly(); |
| | | if (listChart == null) { |
| | | listChart = Collections.emptyList(); |
| | | } |
| | | |
| | | ArrayList<Integer> data1 = new ArrayList<>(); |
| | | ArrayList<Integer> data2 = new ArrayList<>(); |
| | | List<String> categories = new ArrayList<>(); |
| | | |
| | | SimpleDateFormat sfKey = new SimpleDateFormat("yyyy-MM-dd HH"); |
| | | SimpleDateFormat sfLabel = new SimpleDateFormat("HH:00"); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | calendar.add(Calendar.HOUR_OF_DAY, -23); |
| | | |
| | | for (int i = 0; i < 24; i++) { |
| | | String key = sfKey.format(calendar.getTime()); |
| | | categories.add(sfLabel.format(calendar.getTime())); |
| | | |
| | | int inV = 0; |
| | | int outV = 0; |
| | | for (WorkChartAxis w : listChart) { |
| | | if (w.getYmd() != null && key.equals(w.getYmd().trim())) { |
| | | inV = w.getInqty(); |
| | | outV = w.getOutqty(); |
| | | break; |
| | | } |
| | | } |
| | | data1.add(inV); |
| | | data2.add(outV); |
| | | calendar.add(Calendar.HOUR_OF_DAY, 1); |
| | | } |
| | | |
| | | AxisBean inqty = new AxisBean(); |
| | | inqty.setName("入库数量"); |
| | | Integer[] array1 = new Integer[data1.size()]; |
| | | inqty.setData(data1.toArray(array1)); |
| | | list.add(inqty); |
| | | |
| | | AxisBean outqty = new AxisBean(); |
| | | outqty.setName("出库数量"); |
| | | Integer[] array2 = new Integer[data2.size()]; |
| | | outqty.setData(data2.toArray(array2)); |
| | | list.add(outqty); |
| | | |
| | | map.put("categories", categories); |
| | | map.put("rows", list); |
| | | return R.ok(map); |
| | | } |
| | | |
| | | /** |
| | | * 库存信息查询接口 |
| | | */ |
| | | @GetMapping("/queryLoc") |