101 lines
3.3 KiB
Java
101 lines
3.3 KiB
Java
package com.ruoyi.index.controller;
|
|
|
|
import com.ruoyi.common.annotation.Anonymous;
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
import com.ruoyi.common.core.domain.BaseEntity;
|
|
import com.ruoyi.index.domain.BillStatusCount;
|
|
import com.ruoyi.index.domain.CargoSpaceCount;
|
|
import com.ruoyi.index.domain.IndexCount;
|
|
import com.ruoyi.index.domain.ViewIndexJob;
|
|
import com.ruoyi.index.mapper.ViewIndexJobMapper;
|
|
import com.ruoyi.index.service.IBillStatusCountService;
|
|
import com.ruoyi.index.service.ICargoSpaceCountService;
|
|
import com.ruoyi.index.service.IIndexCountService;
|
|
import com.ruoyi.job.mydojob.service.IMydoJobService;
|
|
import com.ruoyi.system.service.ISysDictDataService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.Collections;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.stream.Collectors;
|
|
|
|
/**
|
|
* 首页统计信息Controller
|
|
*
|
|
* @author ruoyi
|
|
*/
|
|
@RestController
|
|
@RequestMapping("/index")
|
|
public class IndexController extends BaseController {
|
|
@Autowired
|
|
private IBillStatusCountService billStatusCountService;
|
|
|
|
@Autowired
|
|
private ICargoSpaceCountService cargoSpaceCountService;
|
|
|
|
@Autowired
|
|
private IIndexCountService indexCountService;
|
|
|
|
@Autowired
|
|
private IMydoJobService mydoJobService;
|
|
|
|
@Autowired
|
|
private ISysDictDataService dictDataService;
|
|
|
|
/**
|
|
* 查询单据状态统计
|
|
*/
|
|
//@PreAuthorize("@ss.hasPermi('index:bill:list')")
|
|
@Anonymous
|
|
@GetMapping("/bill/status")
|
|
public AjaxResult getBillStatusCount() {
|
|
// Temporarily bypass the three unbounded bill queries while diagnosing dashboard latency.
|
|
return success(Collections.emptyList());
|
|
}
|
|
|
|
/**
|
|
* 查询各状态货位数量
|
|
*/
|
|
//@PreAuthorize("@ss.hasPermi('index:cargospace:list')")
|
|
@Anonymous
|
|
@GetMapping("/cargospace/count")
|
|
public AjaxResult getCargoSpaceCount() {
|
|
CargoSpaceCount cargoSpaceCount = cargoSpaceCountService.selectStatusCount(new BaseEntity());
|
|
return success(cargoSpaceCount);
|
|
}
|
|
|
|
/**
|
|
* 查询已完成单据数量统计
|
|
*/
|
|
//@PreAuthorize("@ss.hasPermi('index:count:list')")
|
|
@Anonymous
|
|
@GetMapping("/finishCount")
|
|
public AjaxResult getFinishCount() {
|
|
IndexCount indexCount = indexCountService.selectFinishCount(new BaseEntity());
|
|
return success(indexCount);
|
|
}
|
|
|
|
@Autowired
|
|
private ViewIndexJobMapper viewIndexJobMapper;
|
|
|
|
|
|
/**
|
|
* 获取任务状态统计
|
|
*/
|
|
@Anonymous
|
|
@GetMapping("/job/status")
|
|
public AjaxResult getJobStatusCount() {
|
|
List<ViewIndexJob> allJobs = viewIndexJobMapper.selectViewIndexJobByStatus(new BaseEntity());
|
|
Map<String, List<ViewIndexJob>> result = new HashMap<>();
|
|
result.put("status2", allJobs.stream().filter(job -> "2".equals(job.getStatus())).collect(Collectors.toList()));
|
|
result.put("status3", allJobs.stream().filter(job -> "3".equals(job.getStatus())).collect(Collectors.toList()));
|
|
return AjaxResult.success(result);
|
|
}
|
|
}
|