|
@@ -110,6 +110,11 @@ public class ProjectService extends ServiceImpl<ProjectMapper,Project> {
|
|
|
return projectMapper.findByCondition(page, request);
|
|
|
}
|
|
|
|
|
|
+ private void count(List<ProjectResponse> list) {
|
|
|
+ Map<String, Long> collect = list.stream().collect(Collectors.groupingBy(ProjectResponse::getProjectStatus, Collectors.counting()));
|
|
|
+ System.out.println(collect.toString());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @param mtCompanyId 公司id
|
|
|
* @param projectStatus 项目状态
|
|
@@ -118,10 +123,20 @@ public class ProjectService extends ServiceImpl<ProjectMapper,Project> {
|
|
|
* @date 2020/1/19 11:30 上午
|
|
|
*/
|
|
|
public Map<String, Object> countAll(Long mtCompanyId, String projectStatus) {
|
|
|
+ LambdaQueryWrapper<Project> lambdaQueryWrapper = new QueryWrapper<Project>().lambda();
|
|
|
+ lambdaQueryWrapper.eq(Project::getMtCompanyId, mtCompanyId);
|
|
|
+ List<Project> projects = list(lambdaQueryWrapper);
|
|
|
+ Map<String, Long> collect = projects.stream().collect(Collectors.groupingBy(Project::getProjectStatus, Collectors.counting()));
|
|
|
+ Map<String, Integer> totalMap = new HashMap<>();
|
|
|
+ totalMap.put("notStart", collect.get(CommonEnum.ProjectStatus.NOT_START.getCode()).intValue());
|
|
|
+ totalMap.put("inService", collect.get(CommonEnum.ProjectStatus.IN_SERVICE.getCode()).intValue());
|
|
|
+ totalMap.put("stopService", collect.get(CommonEnum.ProjectStatus.STOP_SERVICE.getCode()).intValue());
|
|
|
+ totalMap.put("overdue", collect.get(CommonEnum.ProjectStatus.OVERDUE.getCode()).intValue());
|
|
|
int projectCount = count(mtCompanyId, projectStatus);
|
|
|
int liftCount = projectLiftRelevanceService.count(mtCompanyId, projectStatus);
|
|
|
int stopLiftCount = platformCompanyService.count(mtCompanyId, projectStatus);
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
+ resultMap.put("totalCount", totalMap);
|
|
|
resultMap.put("projectCount", projectCount);
|
|
|
resultMap.put("liftCount", liftCount);
|
|
|
resultMap.put("stopLiftCount", stopLiftCount);
|