#
Junjie
2025-02-14 ac4341ea6b66ae02427d39d35f41d42d78b2eb2e
zy-asrs-wms/src/main/java/com/zy/asrs/wms/asrs/controller/EChartController.java
@@ -8,8 +8,14 @@
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.common.annotation.CacheData;
import com.zy.asrs.wms.system.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
@@ -27,8 +33,15 @@
    private LocService locService;
    @Autowired
    private TaskLogService taskLogService;
    @Autowired
    private TaskDetlLogService taskDetlLogService;
    @Autowired
    private ViewInOutMapper viewInOutMapper;
    @Autowired
    private MatService matService;
    @PostMapping("/charts/loc/use")
    @CacheData(tableName = {"man_loc"})
    public R locUse(){
        List<EChartPieBean> list = new ArrayList<>();
@@ -60,6 +73,7 @@
    }
    @PostMapping("/charts/loc/line")
    @CacheData(tableName = {"man_task_log"})
    public R locIoLineCharts(){
        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
        Calendar calendar = Calendar.getInstance();
@@ -111,4 +125,40 @@
        return R.ok().add(map);
    }
    @PostMapping("/charts/information")
    @CacheData(tableName = {"man_mat", "man_task", "man_task_log"})
    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")
    @CacheData(tableName = {"man_task_detl_log"})
    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);
    }
}