feat(oa): 添加时间范围查询和丰富车间统计功能
- 在送货单和工艺卡相关业务对象中添加 startTime 和 endTime 字段,支持日期格式化 - 实现送货单及工艺卡明细的时间范围筛选逻辑 - 新增 CategoryValueVo 类用于封装分类统计数据 - 在车间报表服务中增加发货设备名称分布、制造负责人分布和作业负责人分布统计 - 更新报表视图对象以支持新增的统计字段展示
This commit is contained in:
@@ -83,6 +83,8 @@ public class OaDeliveryOrderDetailServiceImpl implements IOaDeliveryOrderDetailS
|
||||
lqw.eq(bo.getVolume() != null, OaDeliveryOrderDetail::getVolume, bo.getVolume());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getBoxSize()), OaDeliveryOrderDetail::getBoxSize, bo.getBoxSize());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getDetailRemark()), OaDeliveryOrderDetail::getDetailRemark, bo.getDetailRemark());
|
||||
// 时间范围查询创建时间
|
||||
lqw.between(bo.getStartTime() != null && bo.getEndTime() != null, OaDeliveryOrderDetail::getCreateTime, bo.getStartTime(), bo.getEndTime()); // 时间范围查询创建时间
|
||||
lqw.orderByDesc(OaDeliveryOrderDetail::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -80,6 +80,8 @@ public class OaDeliveryOrderServiceImpl implements IOaDeliveryOrderService {
|
||||
qw.eq(StringUtils.isNotBlank(bo.getDeliveryRemark()), "odo.delivery_remark", bo.getDeliveryRemark());
|
||||
// 模糊查询(供应商全称)
|
||||
qw.like(StringUtils.isNotBlank(bo.getSupplierFullname()), "odo.supplier_fullname", bo.getSupplierFullname());
|
||||
// 时间范围筛选
|
||||
qw.between(bo.getStartTime() != null && bo.getEndTime() != null, "odo.create_time", bo.getStartTime(), bo.getEndTime());
|
||||
// 按创建时间降序排序
|
||||
qw.orderByDesc("odo.create_time");
|
||||
//逻辑删除
|
||||
|
||||
@@ -76,6 +76,8 @@ public class OaProcessCardDetailServiceImpl implements IOaProcessCardDetailServi
|
||||
lqw.eq(bo.getProcessEndTime() != null, OaProcessCardDetail::getProcessEndTime, bo.getProcessEndTime());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getInspector()), OaProcessCardDetail::getInspector, bo.getInspector());
|
||||
lqw.eq(StringUtils.isNotBlank(bo.getUnqualifiedContent()), OaProcessCardDetail::getUnqualifiedContent, bo.getUnqualifiedContent());
|
||||
// 时间范围筛选
|
||||
lqw.between(bo.getStartTime() != null && bo.getEndTime() != null, OaProcessCardDetail::getCreateTime, bo.getStartTime(), bo.getEndTime());
|
||||
lqw.orderByDesc(OaProcessCardDetail::getCreateTime);
|
||||
return lqw;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,8 @@ public class OaProcessCardServiceImpl implements IOaProcessCardService {
|
||||
qw.eq(bo.getPlannedDeliveryDate() != null, "oc.planned_delivery_date", bo.getPlannedDeliveryDate());
|
||||
// 模糊查询(设备名称)
|
||||
qw.like(StringUtils.isNotBlank(bo.getEquipmentName()), "oc.equipment_name", bo.getEquipmentName());
|
||||
// 时间范围筛选 startTime endTime
|
||||
qw.between(bo.getStartTime() != null && bo.getEndTime() != null, "oc.create_time", bo.getStartTime(), bo.getEndTime());
|
||||
// 按创建时间降序排序
|
||||
qw.orderByDesc("oc.create_time");
|
||||
// 逻辑删除
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.ruoyi.oa.domain.OaDeliveryOrderDetail;
|
||||
import com.ruoyi.oa.domain.OaProcessCard;
|
||||
import com.ruoyi.oa.domain.OaProcessCardDetail;
|
||||
import com.ruoyi.oa.domain.vo.dashboard.OaWorkshopReportSummaryVo;
|
||||
import com.ruoyi.oa.domain.vo.dashboard.CategoryValueVo;
|
||||
import com.ruoyi.oa.mapper.OaDeliveryOrderDetailMapper;
|
||||
import com.ruoyi.oa.mapper.OaDeliveryOrderMapper;
|
||||
import com.ruoyi.oa.mapper.OaProcessCardDetailMapper;
|
||||
@@ -160,6 +161,62 @@ public class OaWorkshopReportServiceImpl implements IOaWorkshopReportService {
|
||||
involvedProjects.addAll(projFromCards);
|
||||
vo.setInvolvedProjectCount(involvedProjects.size());
|
||||
|
||||
// 发货明细设备名称分布
|
||||
List<CategoryValueVo> equipDist = new ArrayList<>();
|
||||
if (CollectionUtils.isNotEmpty(orderIds)) {
|
||||
LambdaQueryWrapper<OaDeliveryOrderDetail> dWrap2 = Wrappers.lambdaQuery();
|
||||
dWrap2.in(OaDeliveryOrderDetail::getOrderId, orderIds).eq(OaDeliveryOrderDetail::getDelFlag, 0);
|
||||
List<OaDeliveryOrderDetail> detailsAll = deliveryOrderDetailMapper.selectList(dWrap2);
|
||||
Map<String, Long> equipCount = detailsAll.stream()
|
||||
.map(OaDeliveryOrderDetail::getEquipmentName)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.groupingBy(s -> s, Collectors.counting()));
|
||||
equipCount.entrySet().stream()
|
||||
.sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
||||
.limit(20)
|
||||
.forEach(e -> {
|
||||
CategoryValueVo cv = new CategoryValueVo();
|
||||
cv.setName(e.getKey());
|
||||
cv.setValue(e.getValue());
|
||||
equipDist.add(cv);
|
||||
});
|
||||
}
|
||||
vo.setDeliveryEquipmentDistribution(equipDist);
|
||||
|
||||
// 4.3 负责人分布(从主表统计)
|
||||
Map<String, Long> mLeaderCount = cards.stream()
|
||||
.map(OaProcessCard::getManufacturingLeader)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.groupingBy(s -> s, Collectors.counting()));
|
||||
Map<String, Long> oLeaderCount = cards.stream()
|
||||
.map(OaProcessCard::getOperationLeader)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.groupingBy(s -> s, Collectors.counting()));
|
||||
|
||||
List<CategoryValueVo> mLeaderDist = mLeaderCount.entrySet().stream()
|
||||
.sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
||||
.limit(20)
|
||||
.map(e -> {
|
||||
CategoryValueVo cv = new CategoryValueVo();
|
||||
cv.setName(e.getKey());
|
||||
cv.setValue(e.getValue());
|
||||
return cv;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
vo.setManufacturingLeaderDistribution(mLeaderDist);
|
||||
|
||||
List<CategoryValueVo> oLeaderDist = oLeaderCount.entrySet().stream()
|
||||
.sorted(Map.Entry.<String, Long>comparingByValue().reversed())
|
||||
.limit(20)
|
||||
.map(e -> {
|
||||
CategoryValueVo cv = new CategoryValueVo();
|
||||
cv.setName(e.getKey());
|
||||
cv.setValue(e.getValue());
|
||||
return cv;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
vo.setOperationLeaderDistribution(oLeaderDist);
|
||||
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user