oa更新项目总览

This commit is contained in:
2026-06-08 10:11:33 +08:00
parent 3334248847
commit 79e536aeca
5 changed files with 800 additions and 0 deletions

View File

@@ -98,6 +98,22 @@ public class SysOaProjectController extends BaseController {
return data == null ? R.fail("项目不存在") : R.ok(data);
}
/**
* 项目总览统计卡片:总数 / 完成 / 未完成 / 逾期(仅含已绑定进度的项目)
*/
@GetMapping("/overview/stats")
public R<java.util.Map<String, Long>> overviewStats(SysOaProjectBo bo) {
return R.ok(iSysOaProjectService.getOverviewStats(bo));
}
/**
* 项目总览列表:仅返回已绑定进度的项目
*/
@GetMapping("/overview/list")
public TableDataInfo<SysOaProjectVo> overviewList(SysOaProjectBo bo, PageQuery pageQuery) {
return iSysOaProjectService.queryOverviewPageList(bo, pageQuery);
}
/**
* 获取项目管理详细信息
*

View File

@@ -14,6 +14,7 @@ import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 项目管理Service接口
@@ -108,4 +109,14 @@ public interface ISysOaProjectService {
* 综合看板:项目详情 + 任务 + 进度主表 + 进度步骤(一次返回)
*/
OaProjectDashboardVo getProjectDashboard(Long projectId);
/**
* 项目总览统计:总数 / 完成 / 未完成 / 逾期(仅统计已绑定进度的项目)
*/
Map<String, Long> getOverviewStats(SysOaProjectBo bo);
/**
* 项目总览列表仅返回已绑定进度oa_project_schedule 有记录)的项目,分页
*/
TableDataInfo<SysOaProjectVo> queryOverviewPageList(SysOaProjectBo bo, PageQuery pageQuery);
}

View File

@@ -675,4 +675,58 @@ public class SysOaProjectServiceImpl implements ISysOaProjectService {
return vo;
}
/**
* 项目总览统计:总数 / 完成 / 未完成 / 逾期
* 仅统计已绑定进度oa_project_schedule 有记录)的项目
*/
@Override
public Map<String, Long> getOverviewStats(SysOaProjectBo bo) {
List<SysOaProjectVo> raw = queryList(bo == null ? new SysOaProjectBo() : bo);
Set<Long> withSchedule = findProjectIdsWithSchedule();
List<SysOaProjectVo> all = raw.stream()
.filter(p -> p.getProjectId() != null && withSchedule.contains(p.getProjectId()))
.collect(Collectors.toList());
long total = all.size();
long completed = 0L, undone = 0L, overdue = 0L;
Date today = new Date();
for (SysOaProjectVo p : all) {
boolean done = "1".equals(p.getProjectStatus());
if (done) {
completed++;
} else {
undone++;
if (p.getFinishTime() != null && p.getFinishTime().before(today)) {
overdue++;
}
}
}
Map<String, Long> r = new LinkedHashMap<>();
r.put("total", total);
r.put("completed", completed);
r.put("undone", undone);
r.put("overdue", overdue);
return r;
}
/**
* 项目总览列表:在常规分页查询基础上加 EXISTS 子查询,
* 仅返回已经在 oa_project_schedule 中建立进度的项目。
*/
@Override
public TableDataInfo<SysOaProjectVo> queryOverviewPageList(SysOaProjectBo bo, PageQuery pageQuery) {
QueryWrapper<SysOaProject> qw = buildAliasPQueryWrapper(bo);
qw.exists("SELECT 1 FROM oa_project_schedule sch WHERE sch.project_id = p.project_id AND sch.del_flag = '0'");
Page<SysOaProjectVo> result = baseMapper.selectVoPlus(pageQuery.build(), qw);
return TableDataInfo.build(result);
}
private Set<Long> findProjectIdsWithSchedule() {
List<OaProjectScheduleVo> all = oaProjectScheduleService.queryList(new OaProjectScheduleBo());
if (all == null) return Collections.emptySet();
return all.stream()
.map(OaProjectScheduleVo::getProjectId)
.filter(Objects::nonNull)
.collect(Collectors.toSet());
}
}