解决冲突
This commit is contained in:
@@ -1,10 +1,13 @@
|
||||
package com.ruoyi.kpi.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.ruoyi.bas.cargoSpace.domain.BasCargoSpace;
|
||||
import com.ruoyi.bas.cargoSpace.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.job.mydojobfinish.domain.MydoJobFinish;
|
||||
import com.ruoyi.job.mydojobfinish.mapper.MydoJobFinishMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.kpi.mapper.BasCargoSpaceMapper;
|
||||
import com.ruoyi.kpi.domain.BasCargoSpace;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@@ -12,13 +15,11 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.ruoyi.kpi.mapper.MydoJobFinishMapper;
|
||||
import com.ruoyi.kpi.domain.MydoJobFinish;
|
||||
import com.ruoyi.kpi.service.KpiService;
|
||||
|
||||
/**
|
||||
* KPI 统计分析 服务实现类
|
||||
*
|
||||
*
|
||||
* @author gw
|
||||
* @date 2025-05-21
|
||||
*/
|
||||
@@ -32,7 +33,7 @@ public class KpiServiceImpl implements KpiService
|
||||
private BasCargoSpaceMapper basCargoSpaceMapper;
|
||||
/**
|
||||
* 获取入库均匀分析数据
|
||||
*
|
||||
*
|
||||
* @param warehouseId 仓库ID
|
||||
* @param yearMonth 年月(格式:yyyy-MM)
|
||||
* @return 入库均匀分析数据
|
||||
@@ -51,19 +52,19 @@ public class KpiServiceImpl implements KpiService
|
||||
if (job.getInOrOut() == null || Integer.parseInt(job.getInOrOut()) >= 10) {
|
||||
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);
|
||||
@@ -73,7 +74,7 @@ public class KpiServiceImpl implements KpiService
|
||||
// 将结果转换为指定格式
|
||||
List<String> tunnels = new ArrayList<>();
|
||||
List<Integer> counts = new ArrayList<>();
|
||||
|
||||
|
||||
for (Map.Entry<String, Integer> entry : roadwayCount.entrySet()) {
|
||||
tunnels.add(entry.getKey() + "巷道");
|
||||
counts.add(entry.getValue());
|
||||
@@ -165,7 +166,7 @@ public class KpiServiceImpl implements KpiService
|
||||
if (!warehouseId.equals(job.getWarehouseId())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// 按时间范围筛选
|
||||
if (startTime != null && !startTime.isEmpty()) {
|
||||
if (job.getStartTime() == null || job.getStartTime().compareTo(startTime) < 0) {
|
||||
@@ -177,7 +178,7 @@ public class KpiServiceImpl implements KpiService
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
String roadwayId = job.getRoadwayId();
|
||||
if (roadwayId != null) {
|
||||
// 区分入库和出库作业
|
||||
@@ -203,7 +204,7 @@ public class KpiServiceImpl implements KpiService
|
||||
List<String> tunnels = new ArrayList<>();
|
||||
List<Integer> inCountsList = new ArrayList<>();
|
||||
List<Integer> outCountsList = new ArrayList<>();
|
||||
|
||||
|
||||
for (String roadwayId : allRoadways) {
|
||||
tunnels.add(roadwayId + "巷道");
|
||||
inCountsList.add(inCounts.getOrDefault(roadwayId, 0));
|
||||
@@ -262,12 +263,12 @@ public class KpiServiceImpl implements KpiService
|
||||
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("巷道" + roadwayId, entry.getValue().getOrDefault(roadwayId, 0));
|
||||
}
|
||||
|
||||
|
||||
result.add(statusData);
|
||||
}
|
||||
|
||||
@@ -277,4 +278,4 @@ public class KpiServiceImpl implements KpiService
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user