项目初始化
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
package com.ruoyi.kpi.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* KPI 统计分析服务
|
||||
*
|
||||
* @author gw
|
||||
* @date 2025-05-21
|
||||
*/
|
||||
public interface KpiService {
|
||||
/**
|
||||
* 获取入库均匀分析数据
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param yearMonth 年月,格式:yyyy-MM
|
||||
* @return 入库均匀分析数据,包含每个巷道的入库数量
|
||||
*/
|
||||
Map<String, Object> getInAnalysis(String warehouseId, String yearMonth);
|
||||
|
||||
Map<String, Object> getOutAnalysis(String warehouseId, String yearMonth);
|
||||
|
||||
/**
|
||||
* 获取巷道均匀分析数据
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param startTime 开始时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTime 结束时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
* @return 巷道分析数据,包含巷道名称列表和对应的入库、出库数量列表
|
||||
*/
|
||||
Map<String, Object> getRoadwayAnalysis(String warehouseId, String startTime, String endTime);
|
||||
|
||||
|
||||
|
||||
Map<String, Object> getSpaceAnalysis(String warehouseId);
|
||||
|
||||
Map<String, Object> getRoadways(String warehouseId);
|
||||
|
||||
Map<String, Object> getPlatoons(String warehouseId, String roadwayId);
|
||||
|
||||
|
||||
Map<String,Object> getChartData(String warehouseId, String roadwayId, String thePlatoon);
|
||||
|
||||
Map<String,Object> getChartMag(String warehouseId, String theColumn, String theFloor, String thePlatoon);
|
||||
|
||||
|
||||
AjaxResult getInAnalysisByData(String warehouseId, String startTime, String endTime,String inOut);
|
||||
}
|
||||
@@ -0,0 +1,515 @@
|
||||
package com.ruoyi.kpi.service.impl;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.MessageUtils;
|
||||
import com.ruoyi.job.mydojob.domain.MydoJob;
|
||||
import com.ruoyi.job.mydojobfinish.domain.MydoJobFinish;
|
||||
import com.ruoyi.job.mydojobfinish.mapper.MydoJobFinishMapper;
|
||||
import com.ruoyi.kpi.service.KpiService;
|
||||
import com.ruoyi.stock.stock.domain.BasStock;
|
||||
import com.ruoyi.stock.stock.mapper.BasStockMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* KPI 统计分析 服务实现类
|
||||
*
|
||||
* @author gw
|
||||
* @date 2025-05-21
|
||||
*/
|
||||
@Service
|
||||
public class KpiServiceImpl implements KpiService
|
||||
{
|
||||
@Autowired
|
||||
private MydoJobFinishMapper mydoJobFinishMapper;
|
||||
|
||||
@Autowired
|
||||
private BasCargoSpaceMapper basCargoSpaceMapper;
|
||||
|
||||
@Autowired
|
||||
private BasStockMapper basStockMapper;
|
||||
/**
|
||||
* 获取入库均匀分析数据
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param yearMonth 年月(格式:yyyy-MM)
|
||||
* @return 入库均匀分析数据
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getInAnalysis(String warehouseId, String yearMonth)
|
||||
{
|
||||
MydoJob mydoJob = new MydoJob();
|
||||
|
||||
List<MydoJob> list = mydoJobFinishMapper.selectMydoJobFinishListByMydoJob(mydoJob);
|
||||
|
||||
Map<String, Integer> roadwayCount = new HashMap<>();
|
||||
|
||||
for (MydoJob job : list) {
|
||||
// 检查入库作业标识是否小于10
|
||||
if (job.getInOrOut() == null || Integer.parseInt(job.getInOrOut()) >= 20) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 按仓库ID筛选
|
||||
if (!warehouseId.equals(job.getWarehouseId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 如果指定了年月,则按年月筛选
|
||||
if (yearMonth != null && !yearMonth.isEmpty()) {
|
||||
if (job.getStartTime() == null || !job.getStartTime().startsWith(yearMonth)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String roadwayId = job.getRoadwayId();
|
||||
if (roadwayId != null) {
|
||||
roadwayCount.put(roadwayId, roadwayCount.getOrDefault(roadwayId, 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 将结果转换为指定格式
|
||||
List<String> tunnels = new ArrayList<>();
|
||||
List<Integer> counts = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, Integer> entry : roadwayCount.entrySet()) {
|
||||
tunnels.add(entry.getKey() + MessageUtils.message("kpi.spacePlan.roadway"));
|
||||
counts.add(entry.getValue());
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("tunnels", tunnels);
|
||||
result.put("counts", counts);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取出库均匀分析数据
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param yearMonth 年月(格式:yyyy-MM)
|
||||
* @return 出库均匀分析数据
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getOutAnalysis(String warehouseId, String yearMonth)
|
||||
{
|
||||
MydoJobFinish mydoJobFinish = new MydoJobFinish();
|
||||
|
||||
List<MydoJobFinish> list = mydoJobFinishMapper.selectMydoJobFinishList(mydoJobFinish);
|
||||
|
||||
Map<String, Integer> roadwayCount = new HashMap<>();
|
||||
|
||||
for (MydoJobFinish job : list) {
|
||||
// 检查出入库作业标识是否大于10
|
||||
if (job.getInOrOut() == null || Integer.parseInt(job.getInOrOut()) < 20) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 按仓库ID筛选
|
||||
if (!warehouseId.equals(job.getWarehouseId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 如果指定了年月,则按年月筛选
|
||||
if (yearMonth != null && !yearMonth.isEmpty()) {
|
||||
if (job.getStartTime() == null || !job.getStartTime().startsWith(yearMonth)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String roadwayId = job.getRoadwayId();
|
||||
if (roadwayId != null) {
|
||||
roadwayCount.put(roadwayId, roadwayCount.getOrDefault(roadwayId, 0) + 1);
|
||||
}
|
||||
}
|
||||
|
||||
// 将结果转换为指定格式
|
||||
List<String> tunnels = new ArrayList<>();
|
||||
List<Integer> counts = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<String, Integer> entry : roadwayCount.entrySet()) {
|
||||
tunnels.add(entry.getKey() + MessageUtils.message("kpi.spacePlan.roadway"));
|
||||
counts.add(entry.getValue());
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("tunnels", tunnels);
|
||||
result.put("counts", counts);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取巷道均匀分析数据
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param startTime 开始时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
* @param endTime 结束时间,格式:yyyy-MM-dd HH:mm:ss
|
||||
* @return 巷道分析数据
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getRoadwayAnalysis(String warehouseId, String startTime, String endTime)
|
||||
{
|
||||
MydoJobFinish mydoJobFinish = new MydoJobFinish();
|
||||
List<MydoJobFinish> list = mydoJobFinishMapper.selectMydoJobFinishList(mydoJobFinish);
|
||||
|
||||
// 用于存储每个巷道的入库和出库数量
|
||||
Map<String, Integer> inCounts = new HashMap<>();
|
||||
Map<String, Integer> outCounts = new HashMap<>();
|
||||
|
||||
for (MydoJobFinish job : list) {
|
||||
// 按仓库ID筛选
|
||||
if (!warehouseId.equals(job.getWarehouseId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 按时间范围筛选
|
||||
if (startTime != null && !startTime.isEmpty()) {
|
||||
if (job.getStartTime() == null || job.getStartTime().compareTo(startTime) < 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (endTime != null && !endTime.isEmpty()) {
|
||||
if (job.getStartTime() == null || job.getStartTime().compareTo(endTime) > 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String roadwayId = job.getRoadwayId();
|
||||
if (roadwayId != null) {
|
||||
// 区分入库和出库作业
|
||||
if (job.getInOrOut() != null) {
|
||||
int inOrOut = Integer.parseInt(job.getInOrOut());
|
||||
if (inOrOut < 20) {
|
||||
// 入库作业
|
||||
inCounts.put(roadwayId, inCounts.getOrDefault(roadwayId, 0) + 1);
|
||||
} else {
|
||||
// 出库作业
|
||||
outCounts.put(roadwayId, outCounts.getOrDefault(roadwayId, 0) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 合并所有巷道ID
|
||||
Set<String> allRoadways = new HashSet<>();
|
||||
allRoadways.addAll(inCounts.keySet());
|
||||
allRoadways.addAll(outCounts.keySet());
|
||||
|
||||
// 将结果转换为指定格式
|
||||
List<String> tunnels = new ArrayList<>();
|
||||
List<Integer> inCountsList = new ArrayList<>();
|
||||
List<Integer> outCountsList = new ArrayList<>();
|
||||
|
||||
for (String roadwayId : allRoadways) {
|
||||
tunnels.add(roadwayId + MessageUtils.message("kpi.spacePlan.roadway"));
|
||||
inCountsList.add(inCounts.getOrDefault(roadwayId, 0));
|
||||
outCountsList.add(outCounts.getOrDefault(roadwayId, 0));
|
||||
}
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put("tunnels", tunnels);
|
||||
result.put("inCounts", inCountsList);
|
||||
result.put("outCounts", outCountsList);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取货位分析数据
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @return 货位分析
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getSpaceAnalysis(String warehouseId)
|
||||
{
|
||||
BasCargoSpace basCargoSpace = new BasCargoSpace();
|
||||
basCargoSpace.setWarehouseId(warehouseId);
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(basCargoSpace);
|
||||
|
||||
// 如果查询结果为空,返回空数据
|
||||
if (list == null || list.isEmpty()) {
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("data", new ArrayList<>());
|
||||
return response;
|
||||
}
|
||||
|
||||
// 按巷道和状态分类统计
|
||||
Map<String, Map<String, Integer>> roadwayStats = new HashMap<>();
|
||||
Set<String> roadwayIds = new HashSet<>();
|
||||
|
||||
for (BasCargoSpace space : list) {
|
||||
String roadwayId = space.getRoadwayId();
|
||||
String status = space.getStatus();
|
||||
if (roadwayId != null && status != null) {
|
||||
roadwayIds.add(roadwayId);
|
||||
String statusName;
|
||||
switch (Integer.parseInt(status)) {
|
||||
case 1: statusName = "1"; break; // 空货位
|
||||
case 2: statusName = "2"; break; // 满货位
|
||||
case 3: statusName = "3"; break; // 入库分配
|
||||
case 4: statusName = "4"; break; // 出库分配
|
||||
case 5: statusName = "5"; break; // 入库需盘点
|
||||
case 6: statusName = "6"; break; // 出库需盘点
|
||||
default: continue;
|
||||
}
|
||||
|
||||
roadwayStats.computeIfAbsent(statusName, k -> new HashMap<>());
|
||||
Map<String, Integer> statusMap = roadwayStats.get(statusName);
|
||||
statusMap.merge(roadwayId, 1, Integer::sum);
|
||||
}
|
||||
}
|
||||
|
||||
// 构建前端所需的数据格式
|
||||
List<Map<String, Object>> result = new ArrayList<>();
|
||||
for (Map.Entry<String, Map<String, Integer>> entry : roadwayStats.entrySet()) {
|
||||
Map<String, Object> statusData = new HashMap<>();
|
||||
statusData.put("status", entry.getKey());
|
||||
|
||||
// 为每个巷道添加数量,如果没有数据则为0
|
||||
for (String roadwayId : roadwayIds) {
|
||||
statusData.put(MessageUtils.message("kpi.spacePlan.roadway") + roadwayId, entry.getValue().getOrDefault(roadwayId, 0));
|
||||
}
|
||||
|
||||
result.add(statusData);
|
||||
}
|
||||
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
response.put("data", result);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getRoadways(String warehouseId){
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
// 查询指定仓库的巷道信息
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
// 使用Set去重并排序巷道ID
|
||||
Set<String> roadwaySet = new TreeSet<>();
|
||||
for (BasCargoSpace space : list) {
|
||||
if (space.getRoadwayId() != null) {
|
||||
roadwaySet.add(space.getRoadwayId());
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为前端下拉框所需的格式
|
||||
List<Map<String, String>> roadways = new ArrayList<>();
|
||||
for (String roadwayId : roadwaySet) {
|
||||
Map<String, String> roadway = new HashMap<>();
|
||||
roadway.put("value", roadwayId);
|
||||
roadway.put("label", MessageUtils.message("kpi.spacePlan.roadway") + roadwayId);
|
||||
roadways.add(roadway);
|
||||
}
|
||||
|
||||
response.put("data", roadways);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getPlatoons(String warehouseId, String roadwayId){
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
// 查询指定仓库和巷道的排号信息
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
queryParams.setRoadwayId(roadwayId);
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
// 使用TreeSet去重并排序排号
|
||||
Set<Long> platoonSet = new TreeSet<>();
|
||||
for (BasCargoSpace space : list) {
|
||||
if (space.getThePlatoon() != null) {
|
||||
platoonSet.add(space.getThePlatoon());
|
||||
}
|
||||
}
|
||||
|
||||
// 转换为前端下拉框所需的格式
|
||||
List<Map<String, String>> platoons = new ArrayList<>();
|
||||
for (Long platoon : platoonSet) {
|
||||
Map<String, String> platoonMap = new HashMap<>();
|
||||
platoonMap.put("value", platoon.toString());
|
||||
platoonMap.put("label", platoon + MessageUtils.message("kpi.spacePlan.platoon"));
|
||||
platoons.add(platoonMap);
|
||||
}
|
||||
|
||||
response.put("data", platoons);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getChartData(String warehouseId, String roadwayId, String thePlatoon) {
|
||||
// 查询指定仓库、巷道和排号的货位信息
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
queryParams.setRoadwayId(roadwayId);
|
||||
if (thePlatoon != null) {
|
||||
queryParams.setThePlatoon(Long.parseLong(thePlatoon));
|
||||
}
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
// 用于存储不同状态的货位坐标
|
||||
String empty = "";
|
||||
String full = "";
|
||||
String inAllot = "";
|
||||
String outAllot = "";
|
||||
String inCheck = "";
|
||||
String outCheck = "";
|
||||
|
||||
// 用于存储列和层的集合
|
||||
Set<Long> columnSet = new TreeSet<>();
|
||||
Set<Long> floorSet = new TreeSet<>();
|
||||
|
||||
// 处理每个货位的状态
|
||||
for (BasCargoSpace space : list) {
|
||||
// 收集列和层信息
|
||||
columnSet.add(space.getTheColumn());
|
||||
floorSet.add(space.getTheFloor());
|
||||
|
||||
// 根据状态分类处理
|
||||
if (space.getStatus() != null) {
|
||||
String coordinate = "[" + space.getTheColumn() + "," + space.getTheFloor() + "," + space.getStatus() + "],";
|
||||
switch (Integer.parseInt(space.getStatus())) {
|
||||
case 1: empty += coordinate; break;
|
||||
case 2: full += coordinate; break;
|
||||
case 3: inAllot += coordinate; break;
|
||||
case 4: outAllot += coordinate; break;
|
||||
case 5: inCheck += coordinate; break;
|
||||
case 6: outCheck += coordinate; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 构建列和层的标签
|
||||
StringBuilder columnLabels = new StringBuilder();
|
||||
for (Long col : columnSet) {
|
||||
columnLabels.append("'").append(col).append(MessageUtils.message("kpi.spacePlan.column")).append("',");
|
||||
}
|
||||
String column = "[" + columnLabels.toString() + "]";
|
||||
|
||||
StringBuilder floorLabels = new StringBuilder();
|
||||
for (Long floor : floorSet) {
|
||||
floorLabels.append("'").append(floor).append(MessageUtils.message("kpi.spacePlan.floor")).append("',");
|
||||
}
|
||||
String floor = "[" + floorLabels.toString() + "]";
|
||||
|
||||
// 返回结果
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("empty", "[" + empty + "]");
|
||||
map.put("full", "[" + full + "]");
|
||||
map.put("inAllot", "[" + inAllot + "]");
|
||||
map.put("outAllot", "[" + outAllot + "]");
|
||||
map.put("inCheck", "[" + inCheck + "]");
|
||||
map.put("outCheck", "[" + outCheck + "]");
|
||||
map.put("floor", floor);
|
||||
map.put("column", column);
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Map<String,Object> getChartMag(String warehouseId,String theColumn,String theFloor,String thePlatoon){
|
||||
Map<String, Object> response = new HashMap<>();
|
||||
|
||||
// 查询指定货位信息
|
||||
BasCargoSpace queryParams = new BasCargoSpace();
|
||||
queryParams.setWarehouseId(warehouseId);
|
||||
queryParams.setTheColumn(Long.parseLong(theColumn));
|
||||
queryParams.setTheFloor(Long.parseLong(theFloor));
|
||||
queryParams.setThePlatoon(Long.parseLong(thePlatoon));
|
||||
|
||||
List<BasCargoSpace> list = basCargoSpaceMapper.selectBasCargoSpaceList(queryParams);
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
BasCargoSpace space = list.get(0);
|
||||
StringBuilder info = new StringBuilder();
|
||||
|
||||
// 拼接货位信息
|
||||
info.append("货位名称:").append(space.getCargoSpaceName()).append("<br>");
|
||||
info.append("是否锁定:").append("Y".equals(space.getLocked()) ? "是" : "否").append("<br>");
|
||||
info.append("托盘条码:").append(space.getTrayCode() != null ? space.getTrayCode() : "无").append("<br>");
|
||||
|
||||
// 根据cargoSpaceId查询BasStock表,获取productId和productName
|
||||
BasStock stockQuery = new BasStock();
|
||||
stockQuery.setCargoSpaceId(space.getCargoSpaceId());
|
||||
List<BasStock> stockList = basStockMapper.selectBasStockList(stockQuery);
|
||||
if (!stockList.isEmpty()) {
|
||||
BasStock stock = stockList.get(0);
|
||||
info.append("物料编码:").append(stock.getProductId() != null ? stock.getProductId() : "无").append("<br>");
|
||||
info.append("物料名称:").append(stock.getProductName() != null ? stock.getProductName() : "无").append("<br>");
|
||||
}
|
||||
|
||||
response.put("msg", info.toString());
|
||||
} else {
|
||||
response.put("msg", "未找到货位信息");
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult getInAnalysisByData(String warehouseId, String startTime, String endTime,String inOut) {
|
||||
Map<String,Object> res = new HashMap<>();
|
||||
MydoJob mydoJobParam = new MydoJob();
|
||||
mydoJobParam.setWarehouseId(warehouseId);
|
||||
// 直接查询创建时间是否在startTime与endTime之间
|
||||
mydoJobParam.setCreateLeftTime(startTime);
|
||||
mydoJobParam.setCreateRightTime(endTime);
|
||||
mydoJobParam.setInOut(inOut);
|
||||
List<DateTime> datesBetween = DateUtil.rangeToList(DateUtil.parseDate(startTime), DateUtil.parseDate(endTime), DateField.DAY_OF_MONTH);
|
||||
List<MydoJob> list = mydoJobFinishMapper.selectMydoJobFinishListByMydoJob(mydoJobParam);
|
||||
|
||||
// 获取所有巷道ID(1和2)
|
||||
List<String> roadwayIds = Arrays.asList("1", "2");
|
||||
|
||||
List<String> xAxis = new ArrayList<>();
|
||||
List<Map<String, Object>> series = new ArrayList<>();
|
||||
|
||||
// 为每个巷道创建一个系列
|
||||
for (String roadwayId : roadwayIds) {
|
||||
Map<String, Object> seriesItem = new HashMap<>();
|
||||
seriesItem.put("name", roadwayId + "号巷道");
|
||||
seriesItem.put("type", "line");
|
||||
List<Long> data = new ArrayList<>();
|
||||
seriesItem.put("data", data);
|
||||
series.add(seriesItem);
|
||||
}
|
||||
|
||||
// 按日期统计每个巷道的数量
|
||||
for (DateTime dateTime : datesBetween) {
|
||||
xAxis.add(DateUtil.format(dateTime, "yyyy-MM-dd"));
|
||||
|
||||
// 统计每个巷道在当天的数量
|
||||
for (int i = 0; i < roadwayIds.size(); i++) {
|
||||
String roadwayId = roadwayIds.get(i);
|
||||
long count = list.stream()
|
||||
.filter(mydoJob -> roadwayId.equals(mydoJob.getRoadwayId())
|
||||
&& DateUtil.isIn(mydoJob.getCreateTime(), DateUtil.beginOfDay(dateTime), DateUtil.endOfDay(dateTime)))
|
||||
.count();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
List<Long> data = (List<Long>) series.get(i).get("data");
|
||||
data.add(count);
|
||||
}
|
||||
}
|
||||
|
||||
res.put("xAxis", xAxis);
|
||||
res.put("series", series);
|
||||
return AjaxResult.success(res);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user