Browse Source

统计项目详情1.1

master
Jinyuanyuan 2 months ago
parent
commit
6ee355030c
  1. 3
      huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java
  2. 2
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouPlaninfoMapper.java
  3. 4
      huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouPlaninfoMapper.xml
  4. 2
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java
  5. 103
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java
  6. 6
      huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/ProjectDetailOV.java

3
huzhou/src/main/java/com/easy/admin/modules/huzhou/controller/HuzhouProjectController.java

@ -314,9 +314,10 @@ public class HuzhouProjectController {
}
@GetMapping("/getProjectDetailPage")
public Result<?> getProjectDetailPage(HuzhouProjectinfoOV projectinfo,
@RequestParam(name="stage", defaultValue="") String stage,
@RequestParam(name="current", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
IPage<ProjectDetailOV> result = projectinfoService.getProjectDetailPage(projectinfo, pageNo, pageSize);
IPage<ProjectDetailOV> result = projectinfoService.getProjectDetailPage(projectinfo,stage, pageNo, pageSize);
return Result.ok(result);
}
@GetMapping("/countStage")

2
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/HuzhouPlaninfoMapper.java

@ -16,4 +16,6 @@ public interface HuzhouPlaninfoMapper extends BaseMapper<HuzhouPlaninfo> {
Integer getStartedProjectNum(@Param("projectIds") List<String> projectIds);
String getTaskName(@Param("projectId") String projectId,@Param("taskLevel") String taskLevel);
String getIsOffline(@Param("projectId") String projectId,@Param("taskLevel") String taskLevel);
}

4
huzhou/src/main/java/com/easy/admin/modules/huzhou/dao/mapping/HuzhouPlaninfoMapper.xml

@ -14,4 +14,8 @@
<select id="getTaskName" resultType="java.lang.String">
select task_name from huzhou_planinfo where project_id=#{projectId} and task_level=#{taskLevel}
</select>
<select id="getIsOffline" resultType="java.lang.String">
select isoffline from huzhou_planinfo where project_id=#{projectId} and task_level=#{taskLevel}
</select>
</mapper>

2
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/IHuzhouProjectinfoService.java

@ -193,7 +193,7 @@ public interface IHuzhouProjectinfoService extends IService<HuzhouProjectinfo> {
IPage<ProjectSummaryOV> getProjectSummaryPageByTask(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize);
IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize);
IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo,String stage, Integer pageNo, Integer pageSize);
List<CountStageOV> countStage(HuzhouProjectinfo projectInfo);

103
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java

@ -793,6 +793,27 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
.projectProgress(formatted).build();
return result;
}
public String countProgress(List<String> projectIds) {
int fininshNum = 0;
double totalProgress = 0.00;
double progress = 0.00;
String result = "0.00";
if (projectIds.size() != 0) {
for(String id:projectIds){
LambdaQueryWrapper<HuzhouPlaninfo> query=new LambdaQueryWrapper<>();
query.eq(HuzhouPlaninfo::getProjectId,id);
List<HuzhouPlaninfo> planInfoList = planinfoMapper.selectList(query);
fininshNum = (int) planInfoList.stream().filter(x -> (x.getIsfinish().equals("2"))).count();
if (fininshNum != 0 && planInfoList.size() != 0) {
totalProgress = (double) fininshNum / planInfoList.size()+totalProgress;
}
}
progress=totalProgress/projectIds.size();
result = String.format("%.2f", progress);
}
return result;
}
@Override
public ProjectProgressOV getProgressByType() {
@ -1392,8 +1413,8 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
for(ProjectSummaryOV p:projectSummaryPageList){
List<HuzhouProjectinfoOV> groupByDuty = projectAndChildInfoPageList.getRecords().stream().filter(x -> x.getDutyWorkplace().equals(p.getDutyWorkplace())).collect(Collectors.toList());
List<String> projectIds = groupByDuty.stream().map(x -> x.getId()).collect(Collectors.toList());
ProjectProgressOV progress = this.getProgress(projectIds);
p.setProjectProgress(progress.getProjectProgress());
String progress = this.countProgress(projectIds);
p.setProjectProgress(progress);
}
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
@ -1413,8 +1434,8 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
for(ProjectSummaryOV p:projectSummaryPageList){
List<HuzhouProjectinfoOV> groupByTask = projectAndChildInfoPageList.getRecords().stream().filter(x -> x.getReformName().equals(p.getReformName()) && x.getSuperLeader().equals(p.getSuperLeader())).collect(Collectors.toList());
List<String> projectIds = groupByTask.stream().map(x -> x.getId()).collect(Collectors.toList());
ProjectProgressOV progress = this.getProgress(projectIds);
p.setProjectProgress(progress.getProjectProgress());
String progress = this.countProgress(projectIds);
p.setProjectProgress(progress);
}
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
@ -1422,25 +1443,32 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(projectSummaryPageList.size());
return result;
}
public IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo, Integer pageNo, Integer pageSize){
public IPage<ProjectDetailOV> getProjectDetailPage(HuzhouProjectinfo projectInfo,String stage, Integer pageNo, Integer pageSize){
IPage<ProjectDetailOV> result = new Page<>();
List<ProjectDetailOV> records=new ArrayList<>();
HashMap<String,String> stageMap=new HashMap<>();
stageMap.put("0","项目申报阶段");//申报
stageMap.put("1","项目立项阶段");//立项
stageMap.put("2","项目采购阶段");//采购
stageMap.put("3","项目建设阶段");//建设
stageMap.put("4","绩效评估阶段");//绩效
stageMap.put("5","项目验收阶段");//验收
//只要入库项目
projectInfo.setType("1");
projectInfo.setDutyWorkplace(projectInfo.getDutyWorkplace());
ProjectInfoAuthSelect projectInfoAuthSelect = CommonUtils.setGetProjectInfoAuth(projectInfo);
Page page = new Page(pageNo, pageSize);
Page page = new Page(1, 10000);
Page<HuzhouProjectinfoOV> projectAndChildInfoPageList = projectinfoMapper.getProjectAndChildInfoPageList(page, projectInfoAuthSelect);
List<HuzhouProjectinfoOV> projectAndChildInfoList = projectAndChildInfoPageList.getRecords().stream().collect(Collectors.toList());
BigDecimal contractMoney=new BigDecimal("0");
BigDecimal contractCentralMoney=new BigDecimal("0");
for(HuzhouProjectinfoOV p:projectAndChildInfoList){
ProjectDetailOV projectDetail=new ProjectDetailOV();
BeanUtils.copyProperties(p,projectDetail);
Map<String, BigDecimal> moneyMap = projectinfoMapper.getMoneyById(p.getId());
BigDecimal contractMoney=null;
BigDecimal contractCentralMoney=null;
if(moneyMap != null && !moneyMap.isEmpty()){
contractMoney=Optional.ofNullable(moneyMap.get("contractMoney")).orElse(new BigDecimal("0"));
contractCentralMoney=Optional.ofNullable(moneyMap.get("contractCentralMoney")).orElse(new BigDecimal("0"));
contractMoney=moneyMap.get("contractMoney");
contractCentralMoney=moneyMap.get("contractCentralMoney");
}
projectDetail.setContractMoney(contractMoney);
projectDetail.setContractCentralMoney(contractCentralMoney);
@ -1454,20 +1482,65 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
List<String[]> keyList = levelList.stream().filter(x -> x.length == 2).collect(Collectors.toList());
int max = keyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax();
String key=String.valueOf(max);
taskName=planinfoMapper.getTaskName(p.getId(),key);
taskName=stageMap.get(key);
}else {
taskName="项目申报阶段";
}
projectDetail.setProjectStage(taskName);
//当前节点
LambdaQueryWrapper<HuzhouPlaninfo> query1=new LambdaQueryWrapper<>();
query1.eq(HuzhouPlaninfo::getProjectId,p.getId());
query1.eq(HuzhouPlaninfo::getIsfinish,"1");
List<String[]> onGoingLevelList = planinfoService.list(query1).stream().map(x -> x.getTaskLevel().split("\\.")).collect(Collectors.toList());
String stepName="";
String isUpload="";
String isOffline="0";
if(!onGoingLevelList.isEmpty()){//有1取1,多1取最大
List<String[]> onGoingKeyList = onGoingLevelList.stream().filter(x -> x.length == 2).collect(Collectors.toList());
int firstMax = onGoingKeyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax();
List<String[]> onGoingKeyFilterList = onGoingKeyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax))).collect(Collectors.toList());
int secondMax = onGoingKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax();
String level=firstMax+"."+secondMax;
stepName=planinfoMapper.getTaskName(p.getId(),level);
isOffline = planinfoMapper.getIsOffline(p.getId(), level);
isUpload="1";
}
else if(onGoingLevelList.isEmpty() && !levelList.isEmpty()){//没有1,有2
List<String[]> keyList = levelList.stream().filter(x -> x.length == 2).collect(Collectors.toList());
int firstMax = keyList.stream().mapToInt(x -> Integer.parseInt(x[0])).summaryStatistics().getMax();
List<String[]> onGoingKeyFilterList = keyList.stream().filter(x -> x[0].equals(String.valueOf(firstMax))).collect(Collectors.toList());
int secondMax = onGoingKeyFilterList.stream().mapToInt(x -> Integer.parseInt(x[1])).summaryStatistics().getMax();
String level=firstMax+"."+secondMax;
stepName=planinfoMapper.getTaskName(p.getId(),level);
isOffline = planinfoMapper.getIsOffline(p.getId(), level);
isUpload="1";
}
projectDetail.setStepName(stepName);
projectDetail.setIsUpload(isUpload);
projectDetail.setIsOffline(isOffline);
// 进度
List<String> projectIds=new ArrayList<>();
projectIds.add(p.getId());
ProjectProgressOV progress = this.getProgress(projectIds);
projectDetail.setProjectProgress(progress.getProjectProgress());
String progress = this.countProgress(projectIds);
projectDetail.setProjectProgress(progress);
records.add(projectDetail);
}
//项目阶段筛选
if(!Objects.equals(stage, "")){
String queryStage = stageMap.get(stage);
List<ProjectDetailOV> filterRecords=records.stream().filter(x->x.getProjectStage().equals(queryStage)).collect(Collectors.toList());
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectDetailOV> currentPageData = filterRecords.subList(fromIndex, Math.min(fromIndex + pageSize, filterRecords.size()));
result.setSize(pageSize).setCurrent(pageNo).setRecords(currentPageData).setTotal(filterRecords.size());
}else {
//手动分页
int fromIndex = (pageNo - 1) * pageSize;
List<ProjectDetailOV> currentPageData = records.subList(fromIndex, Math.min(fromIndex + pageSize, records.size()));
result.setCurrent(pageNo).setSize(pageSize).setRecords(currentPageData).setTotal(records.size());
}
result.setCurrent(pageNo).setSize(pageSize).setRecords(records).setTotal(projectAndChildInfoPageList.getTotal());
return result;
}
public List<CountStageOV> countStage(HuzhouProjectinfo projectInfo){

6
huzhou/src/main/java/com/easy/admin/modules/huzhou/vo/ProjectDetailOV.java

@ -36,6 +36,12 @@ public class ProjectDetailOV {
private String projectProgress;
private String stepName;
private String isUpload;
private String isOffline;
}

Loading…
Cancel
Save