#
Junjie
2024-09-26 ac45194a5ff830a0f355a76a202e1d4f1d15a35b
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/EChartController.java
@@ -8,7 +8,12 @@
import com.zy.asrs.wms.asrs.entity.echart.EChartLineBean;
import com.zy.asrs.wms.asrs.entity.echart.EChartPieBean;
import com.zy.asrs.wms.asrs.entity.enums.LocStsType;
import com.zy.asrs.wms.asrs.entity.statistics.InformationTop;
import com.zy.asrs.wms.asrs.entity.statistics.ViewInOut;
import com.zy.asrs.wms.asrs.mapper.statistics.ViewInOutMapper;
import com.zy.asrs.wms.asrs.service.LocService;
import com.zy.asrs.wms.asrs.service.MatService;
import com.zy.asrs.wms.asrs.service.TaskDetlLogService;
import com.zy.asrs.wms.asrs.service.TaskLogService;
import com.zy.asrs.wms.system.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,6 +32,12 @@
    private LocService locService;
    @Autowired
    private TaskLogService taskLogService;
    @Autowired
    private TaskDetlLogService taskDetlLogService;
    @Autowired
    private ViewInOutMapper viewInOutMapper;
    @Autowired
    private MatService matService;
    @PostMapping("/charts/loc/use")
    public R locUse(){
@@ -111,4 +122,38 @@
        return R.ok().add(map);
    }
    @PostMapping("/charts/information")
    public R information() {
        HashMap<String, Object> data = new HashMap<>();
        long matCount = matService.count();
        Long inQty = 0L;
        Long outQty = 0L;
        Long totalQty = 0L;
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        ViewInOut viewInOut = viewInOutMapper.selectOne(new LambdaQueryWrapper<ViewInOut>().eq(ViewInOut::getYmd, format.format(new Date())).orderByDesc(ViewInOut::getYmd).last("limit 0,1"));
        if(viewInOut != null) {
            inQty = viewInOut.getInQty();
            outQty = viewInOut.getOutQty();
            totalQty = viewInOut.getTotalQty();
        }
        data.put("inCount", inQty);
        data.put("outCount", outQty);
        data.put("totalCount", totalQty);
        data.put("matCount", matCount);
        return R.ok().add(data);
    }
    @PostMapping("/charts/information/top")
    public R informationTop() {
        List<InformationTop> topIn = taskDetlLogService.getInformationTopIn(10);
        List<InformationTop> topOut = taskDetlLogService.getInformationTopOut(10);
        HashMap<String, Object> data = new HashMap<>();
        data.put("topIn", topIn);
        data.put("topOut", topOut);
        return R.ok().add(data);
    }
}