Compare commits

...

2 Commits

Author SHA1 Message Date
磷叶
2f0a51b5c8 统一接口实现 2025-02-24 15:55:23 +08:00
磷叶
439f1d9da2 统一接口实现 2025-02-24 15:54:11 +08:00
5 changed files with 25 additions and 58 deletions

View File

@ -14,6 +14,8 @@ public class BriefKeys {
public static final String PROJECT_STATUS = "projectStatus";
// 项目开发完成
public static final String PROJECT_DEV_COMPLETED = "projectDevCompleted";
// 项目开发正常完成
public static final String PROJECT_DEV_ON_TIME_COMPLETED = "projectDevOnTimeCompleted";
// 项目逾期开发未完成
public static final String PROJECT_OVERDUE_DEV_UNCOMPLETED = "projectOverdueDevUncompleted";
// 项目逾期开发完成

View File

@ -30,6 +30,9 @@ public class ProjectBriefVO {
@ApiModelProperty("开发已完成")
private Integer devCompleted;
@ApiModelProperty("开发正常完成")
private Integer devOnTimeCompleted;
@ApiModelProperty("开发逾期未完成")
private Integer devOverdueUncompleted;

View File

@ -8,4 +8,7 @@ public class MonthProjectQuery {
@ApiModelProperty("年份")
private Integer year;
@ApiModelProperty("数据隔离")
private Boolean scope;
}

View File

@ -18,7 +18,6 @@ import com.ruoyi.dashboard.index.domain.brief.BriefKeys;
import com.ruoyi.dashboard.index.domain.brief.ProjectBriefVO;
import com.ruoyi.dashboard.project.domain.monthProject.MonthProjectQuery;
import com.ruoyi.dashboard.project.domain.monthProject.MonthProjectVO;
import com.ruoyi.dashboard.project.domain.projectRate.ProjectRateVO;
@Service
public class DashboardProjectService {
@ -30,7 +29,7 @@ public class DashboardProjectService {
List<MonthProjectVO> result = new ArrayList<>();
// 查询每月新增的项目数
List<IntegerIntegerVO> startList = this.selectCoungGroupByStartMonth(query);
List<IntegerIntegerVO> startList = this.selectCountGroupByStartMonth(query);
// 查询每月完成的项目数
List<IntegerIntegerVO> finishList = this.selectCountGroupByCompleteMonth(query);
@ -73,25 +72,23 @@ public class DashboardProjectService {
List<StringIntegerVO> projectMap = projectService.selectCountGroupByStatus(query);
vo.setStatusGroup(projectMap);
}
if (keyList.contains(BriefKeys.PROJECT_DEV_ON_TIME_COMPLETED)) {
vo.setDevOnTimeCompleted(this.selectDevOnTimeCompletedCount(query));
}
if (keyList.contains(BriefKeys.PROJECT_DEV_COMPLETED)) {
int devCompleted = this.selectDevCompletedCount(query);
vo.setDevCompleted(devCompleted);
vo.setDevCompleted(this.selectDevCompletedCount(query));
}
if (keyList.contains(BriefKeys.PROJECT_OVERDUE_DEV_UNCOMPLETED)) {
int devOverdueUncompleted = this.selectDevOverdueUncompletedCount(query);
vo.setDevOverdueUncompleted(devOverdueUncompleted);
vo.setDevOverdueUncompleted(this.selectDevOverdueUncompletedCount(query));
}
if (keyList.contains(BriefKeys.PROJECT_OVERDUE_DEV_COMPLETED)) {
int devOverdueCompleted = this.selectDevOverdueCompletedCount(query);
vo.setDevOverdueCompleted(devOverdueCompleted);
vo.setDevOverdueCompleted(this.selectDevOverdueCompletedCount(query));
}
if (keyList.contains(BriefKeys.PROJECT_DEV_OVERDUE)) {
int devOverdue = this.selectDevOverdueCount(query);
vo.setDevOverdue(devOverdue);
vo.setDevOverdue(this.selectDevOverdueCount(query));
}
if (keyList.contains(BriefKeys.PROJECT_DEV_SOON_EXPIRE)) {
int soonExpire = this.selectDevSoonExpireCount(query);
vo.setDevSoonExpire(soonExpire);
vo.setDevSoonExpire(this.selectDevSoonExpireCount(query));
}
}
@ -115,64 +112,32 @@ public class DashboardProjectService {
return projectService.selectCount(query);
}
// 按月查询新增项目数
public List<IntegerIntegerVO> selectCountGroupByCreateMonth(MonthProjectQuery query) {
ProjectQuery projectQuery = new ProjectQuery();
projectQuery.setCreateYear(query.getYear());
return projectService.selectCountGroupByCreateMonth(projectQuery);
}
// 按月查询完成项目数
public List<IntegerIntegerVO> selectCountGroupByCompleteMonth(MonthProjectQuery query) {
ProjectQuery projectQuery = new ProjectQuery();
projectQuery.setCompleteYear(query.getYear());
projectQuery.setScope(query.getScope());
return projectService.selectCountGroupByCompleteMonth(projectQuery);
}
// 按月查询开始项目数
public List<IntegerIntegerVO> selectCoungGroupByStartMonth(MonthProjectQuery query) {
public List<IntegerIntegerVO> selectCountGroupByStartMonth(MonthProjectQuery query) {
ProjectQuery projectQuery = new ProjectQuery();
projectQuery.setStartYear(query.getYear());
projectQuery.setScope(query.getScope());
return projectService.selectCountGroupByStartMonth(projectQuery);
}
// 获取项目比率
public ProjectRateVO selectProjectRate() {
ProjectRateVO result = new ProjectRateVO();
// 查询总数
ProjectQuery query = new ProjectQuery();
query.setScope(true);
int total = projectService.selectCount(query);
result.setTotal(total);
// 查询完成数
result.setCompleted(this.selectCompletedCount());
// 查询超期数
result.setDevOverdue(this.selectDevOverdueCount());
return result;
}
// 查询完成数
private int selectCompletedCount() {
private int selectDevCompletedCount(ProjectQuery projectQuery) {
ProjectQuery query = new ProjectQuery();
BeanUtils.copyBeanProp(query, projectQuery);
query.setStatusList(ProjectStatus.completedList());
query.setScope(true);
return projectService.selectCount(query);
}
// 查询开发超期数
private int selectDevOverdueCount() {
ProjectQuery query = new ProjectQuery();
query.setDevOverdue(true);
query.setScope(true);
return projectService.selectCount(query);
}
// 查询正常开发完成数
private int selectDevCompletedCount(ProjectQuery projectQuery) {
private int selectDevOnTimeCompletedCount(ProjectQuery projectQuery) {
ProjectQuery query = new ProjectQuery();
BeanUtils.copyBeanProp(query, projectQuery);
query.setStatusList(ProjectStatus.completedList());

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.dashboard;
import com.ruoyi.bst.project.domain.ProjectQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
@ -23,15 +24,8 @@ public class DashboardProjectController {
@GetMapping("/month")
@PreAuthorize("@ss.hasPermi('dashboard:project:month')")
public AjaxResult month(MonthProjectQuery query) {
query.setScope(true);
return AjaxResult.success(dashboardProjectService.selectMonthProject(query));
}
// 获取项目比率
@GetMapping("/rate")
@PreAuthorize("@ss.hasPermi('dashboard:project:rate')")
public AjaxResult rate() {
return AjaxResult.success(dashboardProjectService.selectProjectRate());
}
}