feat(oa): 添加时间范围查询和丰富车间统计功能

- 在送货单和工艺卡相关业务对象中添加 startTime 和 endTime 字段,支持日期格式化
- 实现送货单及工艺卡明细的时间范围筛选逻辑
- 新增 CategoryValueVo 类用于封装分类统计数据
- 在车间报表服务中增加发货设备名称分布、制造负责人分布和作业负责人分布统计
- 更新报表视图对象以支持新增的统计字段展示
This commit is contained in:
2025-12-12 11:07:12 +08:00
parent 0f857a7c12
commit e71ba481df
11 changed files with 115 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
package com.ruoyi.oa.domain.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import lombok.Data;
@@ -10,6 +11,7 @@ import java.util.Date;
import java.util.List;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 送货单主业务对象 oa_delivery_order
@@ -115,4 +117,11 @@ public class OaDeliveryOrderBo extends BaseEntity {
//明细
private List<OaDeliveryOrderDetailBo> detailList;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endTime;
}

View File

@@ -1,5 +1,6 @@
package com.ruoyi.oa.domain.bo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.validate.AddGroup;
import com.ruoyi.common.core.validate.EditGroup;
import lombok.Data;
@@ -10,6 +11,7 @@ import java.util.Date;
import java.math.BigDecimal;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 送货单明细业务对象 oa_delivery_order_detail
@@ -102,5 +104,12 @@ public class OaDeliveryOrderDetailBo extends BaseEntity {
*/
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endTime;
}

View File

@@ -13,6 +13,7 @@ import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 工艺卡主业务对象 oa_process_card
@@ -68,4 +69,12 @@ public class OaProcessCardBo extends BaseEntity {
//工艺卡明细
private List<OaProcessCardDetailBo> oaProcessCardDetailList;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endTime;
}

View File

@@ -11,6 +11,7 @@ import java.util.Date;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.domain.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;
/**
* 工艺卡明细业务对象 oa_process_card_detail
@@ -78,5 +79,12 @@ public class OaProcessCardDetailBo extends BaseEntity {
*/
private String remark;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date startTime;
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date endTime;
}

View File

@@ -0,0 +1,9 @@
package com.ruoyi.oa.domain.vo.dashboard;
import lombok.Data;
@Data
public class CategoryValueVo {
private String name;
private Long value;
}

View File

@@ -49,4 +49,10 @@ public class OaWorkshopReportSummaryVo {
private List<String> manufacturingLeaders;
@ExcelProperty("作业负责人列表")
private List<String> operationLeaders;
// 明细设备名称分布
private List<CategoryValueVo> deliveryEquipmentDistribution;
// 负责人分布
private List<CategoryValueVo> manufacturingLeaderDistribution;
private List<CategoryValueVo> operationLeaderDistribution;
}

View File

@@ -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;
}

View File

@@ -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");
//逻辑删除

View File

@@ -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;
}

View File

@@ -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");
// 逻辑删除

View File

@@ -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;
}
}