Browse Source

统计1.5

master
Jinyuanyuan 6 months ago
parent
commit
583d6fc916
  1. 6
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouContractinfoServiceImpl.java
  2. 166
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouProjectinfoServiceImpl.java
  3. 19
      huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouSubProjectinfoServiceImpl.java

6
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouContractinfoServiceImpl.java

@ -257,7 +257,11 @@ public class HuzhouContractinfoServiceImpl extends ServiceImpl<HuzhouContractinf
.select(HuzhouContractinfo::getProjectId,HuzhouContractinfo::getId); .select(HuzhouContractinfo::getProjectId,HuzhouContractinfo::getId);
List<HuzhouContractinfo> contractInfoList=contractinfoMapper.selectList(query); List<HuzhouContractinfo> contractInfoList=contractinfoMapper.selectList(query);
List<String> contractIds = contractInfoList.stream().map(x -> x.getId()).collect(Collectors.toList()); List<String> contractIds = contractInfoList.stream().map(x -> x.getId()).collect(Collectors.toList());
List<HuzhouContractinfo> result = contractinfoMapper.selectBatchIds(contractIds); List<HuzhouContractinfo> result= new ArrayList<>();
if(contractIds.size()!=0){
result = contractinfoMapper.selectBatchIds(contractIds);
}
return result; return result;
} }

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

@ -32,6 +32,7 @@ import com.easy.admin.sys.service.SysDictService;
import com.easy.admin.util.PasswordUtil; import com.easy.admin.util.PasswordUtil;
import com.easy.admin.util.ShiroUtil; import com.easy.admin.util.ShiroUtil;
import javassist.expr.NewArray; import javassist.expr.NewArray;
import kotlin.collections.EmptyList;
import org.activiti.engine.IdentityService; import org.activiti.engine.IdentityService;
import org.activiti.engine.RuntimeService; import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService; import org.activiti.engine.TaskService;
@ -512,6 +513,7 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
// return "0"; // return "0";
// } // }
//查询当前用户名下主项目和子项目的id
@Override @Override
public Map<String,List<String>> findAllProjectIds() { public Map<String,List<String>> findAllProjectIds() {
HuzhouProjectinfo projectInfo =new HuzhouProjectinfo(); HuzhouProjectinfo projectInfo =new HuzhouProjectinfo();
@ -533,62 +535,83 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
return result; return result;
} }
//统计主项目和子项目中的总投资
@Override @Override
public BigDecimal totalMoneyByProjectIds(Map<String,List<String>> projectIds) { public BigDecimal totalMoneyByProjectIds(Map<String,List<String>> projectIds) {
LambdaQueryWrapper<HuzhouProjectinfo> query = new LambdaQueryWrapper<>(new HuzhouProjectinfo()) BigDecimal zxmTotal = new BigDecimal("0.00");
.in(HuzhouProjectinfo::getId,projectIds.get("zxm")) BigDecimal cxmTotal = new BigDecimal("0.00");
.select(HuzhouProjectinfo::getId,HuzhouProjectinfo::getTotalMoney); if(projectIds.get("zxm").size()!=0) {
List<HuzhouProjectinfo> projectInfoList=projectinfoMapper.selectList(query); LambdaQueryWrapper<HuzhouProjectinfo> query = new LambdaQueryWrapper<>(new HuzhouProjectinfo())
BigDecimal zxmTotal = new BigDecimal(Double.toString(projectInfoList.stream().mapToDouble(x -> x.getTotalMoney()).sum())); .in(HuzhouProjectinfo::getId, projectIds.get("zxm"))
.select(HuzhouProjectinfo::getId, HuzhouProjectinfo::getTotalMoney);
LambdaQueryWrapper<HuzhouSubProjectinfo> cquery = new LambdaQueryWrapper<>(new HuzhouSubProjectinfo()) List<HuzhouProjectinfo> projectInfoList = projectinfoMapper.selectList(query);
.in(HuzhouSubProjectinfo::getId,projectIds.get("cxm")) zxmTotal = new BigDecimal(Double.toString(projectInfoList.stream().mapToDouble(x -> x.getTotalMoney()).sum()));
.select(HuzhouSubProjectinfo::getId,HuzhouSubProjectinfo::getTotalMoney); }
List<HuzhouSubProjectinfo> subProjectInfoList=subProjectinfoMapper.selectList(cquery); if(projectIds.get("cxm").size()!=0){
BigDecimal cxmTotal = new BigDecimal(Double.toString(subProjectInfoList.stream().mapToDouble(x -> x.getTotalMoney()).sum())); LambdaQueryWrapper<HuzhouSubProjectinfo> cquery = new LambdaQueryWrapper<>(new HuzhouSubProjectinfo())
.in(HuzhouSubProjectinfo::getId,projectIds.get("cxm"))
.select(HuzhouSubProjectinfo::getId,HuzhouSubProjectinfo::getTotalMoney);
List<HuzhouSubProjectinfo> subProjectInfoList=subProjectinfoMapper.selectList(cquery);
cxmTotal = new BigDecimal(Double.toString(subProjectInfoList.stream().mapToDouble(x -> x.getTotalMoney()).sum()));
}
BigDecimal result = zxmTotal.add(cxmTotal); BigDecimal result = zxmTotal.add(cxmTotal);
return result; return result;
} }
//统计项目总进度(计划阶段已完成数和未完成数)
@Override @Override
public ProjectProgressOV countProjectProgress() { public ProjectProgressOV countProjectProgress() {
int fininshNum=0;
int unfininshNum=0;
//1、查询所有项目 //1、查询所有项目
//2、查询所有项目对应的计划阶段 //2、查询所有项目对应的计划阶段
Map<String, List<String>> projectIdsMap = this.findAllProjectIds(); Map<String, List<String>> projectIdsMap = this.findAllProjectIds();
List<String> projectIdsList = projectIdsMap.get("zxm"); List<String> projectIdsList = projectIdsMap.get("zxm");
projectIdsList.addAll(projectIdsMap.get("cxm")); projectIdsList.addAll(projectIdsMap.get("cxm"));
List<HuzhouPlaninfo> planInfoList = planinfoService.listByProjectIds(projectIdsList); if(projectIdsList.size()!=0){
int fininshNum = (int) planInfoList.stream().filter(x -> (x.getIsfinish().equals("2"))).count(); List<HuzhouPlaninfo> planInfoList = planinfoService.listByProjectIds(projectIdsList);
int unfininshNum=planInfoList.size()-fininshNum; fininshNum = (int) planInfoList.stream().filter(x -> (x.getIsfinish().equals("2"))).count();
unfininshNum = planInfoList.size()-fininshNum;
}
ProjectProgressOV result = ProjectProgressOV.builder().fininshNum(fininshNum).unfininshNum(unfininshNum).build(); ProjectProgressOV result = ProjectProgressOV.builder().fininshNum(fininshNum).unfininshNum(unfininshNum).build();
return result; return result;
} }
//统计资金拨付情况(支付阶段在计划中已完成即为已付款)
@Override @Override
public FundOV countFund() { public FundOV countFund() {
Map<String, List<String>> projectIdsMap = this.findAllProjectIds(); Map<String, List<String>> projectIdsMap = this.findAllProjectIds();
List<String> projectIdsList = projectIdsMap.get("zxm"); List<String> projectIdsList = projectIdsMap.get("zxm");
projectIdsList.addAll(projectIdsMap.get("cxm")); projectIdsList.addAll(projectIdsMap.get("cxm"));
List<HuzhouContractinfo> contractInfoList = contractinfoService.ListByProjectIds(projectIdsList); BigDecimal totalAmount = new BigDecimal("0.00");
List<HuzhouPlaninfo> planInfoList = planinfoService.listByProjectIds(projectIdsList); BigDecimal unPayAmount = new BigDecimal("0.00");
BigDecimal payAmount = new BigDecimal("0.00"); BigDecimal payAmount = new BigDecimal("0.00");
Map<String, Double> contractMoneyMap; if(projectIdsList.size()!=0){
List<String> finishPlanTaskList; List<HuzhouContractinfo> contractInfoList = contractinfoService.ListByProjectIds(projectIdsList);
for(String projectId:projectIdsList){ List<HuzhouPlaninfo> planInfoList = planinfoService.listByProjectIds(projectIdsList);
contractMoneyMap = contractInfoList.stream().filter(x -> x.getProjectId().equals(projectId)) Map<String, Double> contractMoneyMap;
.collect(Collectors.toMap(HuzhouContractinfo::getTaskName, HuzhouContractinfo::getTotalMoney)); List<String> finishPlanTaskList;
finishPlanTaskList = planInfoList.stream().filter(x->x.getProjectId().equals(projectId)) for(String projectId:projectIdsList){
.filter(x->x.getIsfinish().equals("2")).map(x->x.getTaskName()).collect(Collectors.toList()); contractMoneyMap = contractInfoList.stream().filter(x -> x.getProjectId().equals(projectId))
for(String key:contractMoneyMap.keySet()){ .collect(Collectors.toMap(HuzhouContractinfo::getTaskName, HuzhouContractinfo::getTotalMoney));
if(finishPlanTaskList.contains(key)){ finishPlanTaskList = planInfoList.stream().filter(x->x.getProjectId().equals(projectId))
payAmount=payAmount.add(new BigDecimal(Double.toString(contractMoneyMap.get(key)))); .filter(x->x.getIsfinish().equals("2")).map(x->x.getTaskName()).collect(Collectors.toList());
for(String key:contractMoneyMap.keySet()){
if(finishPlanTaskList.contains(key)){
payAmount=payAmount.add(new BigDecimal(Double.toString(contractMoneyMap.get(key))));
}
} }
} }
//根据projectIds累加总金额
totalAmount = this.totalMoneyByProjectIds(projectIdsMap);
unPayAmount = totalAmount.subtract(payAmount);
} }
//根据projectIds累加总金额
BigDecimal totalAmount = this.totalMoneyByProjectIds(projectIdsMap);
BigDecimal unPayAmount = totalAmount.subtract(payAmount);
FundOV result = FundOV.builder().fininshNum(payAmount.toString()).unfininshNum(unPayAmount.toString()).build(); FundOV result = FundOV.builder().fininshNum(payAmount.toString()).unfininshNum(unPayAmount.toString()).build();
return result; return result;
} }
@ -598,49 +621,60 @@ public class HuzhouProjectinfoServiceImpl extends ServiceImpl<HuzhouProjectinfoM
Map<String, List<String>> projectIdsMap = this.findAllProjectIds(); Map<String, List<String>> projectIdsMap = this.findAllProjectIds();
List<String> zxmIds = projectIdsMap.get("zxm"); List<String> zxmIds = projectIdsMap.get("zxm");
List<String> cxmIds = projectIdsMap.get("cxm"); List<String> cxmIds = projectIdsMap.get("cxm");
List<HuzhouProjectinfo> projectInfoList = projectinfoMapper.selectBatchIds(zxmIds); zxmIds.addAll(cxmIds);
List<HuzhouSubProjectinfo> cProjectinfoList = subProjectinfoService.listByProjectIds(cxmIds); CountOV result;
projectInfoList.addAll(cProjectinfoList);
List<Select> projectStage1 = dictService.selectByDictType("projectStage").stream().collect(Collectors.toList());
Map<String, String> projectStage = dictService.selectByDictType("projectStage").stream().collect(Collectors.toMap(x -> x.getValue(), x -> x.getLabel()));
Map<String, String> reformTasks = dictService.selectByDictType("reformTasks").stream().collect(Collectors.toMap(x -> x.getValue(), x -> x.getLabel()));
//根据项目状态统计
List<ProjectStatusOV> projectStatusList= new ArrayList<>(); List<ProjectStatusOV> projectStatusList= new ArrayList<>();
Map<String, List<HuzhouProjectinfo>> statusCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getStage()));
for(String key:statusCountMap.keySet()){
projectStatusList.add(ProjectStatusOV.builder().name(projectStage.get(key)).value(statusCountMap.get(key).size()).build());
}
//根据所属改革任务统计(阶段完成情况)
List<CommonCountOV> projectByReformList= new ArrayList<>(); List<CommonCountOV> projectByReformList= new ArrayList<>();
Map<String, List<HuzhouProjectinfo>> reformCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getReformName().trim()));
for (String key:reformCountMap.keySet()){
List<String> keyProjectIdsList = reformCountMap.get(key).stream().map(x -> x.getId()).collect(Collectors.toList());
Map<String, Integer> countMap = planinfoService.conutCompletionStatus(keyProjectIdsList);
projectByReformList.add(CommonCountOV.builder().name(reformTasks.get(key)).fininshNum(countMap.get("fininshNum")).unfininshNum(countMap.get("unfininshNum")).build());
}
//根据行政区统计
List<CommonCountOV> projectByRegionList= new ArrayList<>(); List<CommonCountOV> projectByRegionList= new ArrayList<>();
Map<String, List<HuzhouProjectinfo>> regionCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getAdminDivision().trim()));
for (String key:regionCountMap.keySet()){
List<String> keyProjectIdsList = regionCountMap.get(key).stream().map(x -> x.getId()).collect(Collectors.toList());
Map<String, Integer> countMap = planinfoService.conutCompletionStatus(keyProjectIdsList);
projectByRegionList.add(CommonCountOV.builder().name(key).fininshNum(countMap.get("fininshNum")).unfininshNum(countMap.get("unfininshNum")).build());
}
//根据单位统计
List<CommonCountOV> projectByWorkplaceList= new ArrayList<>(); List<CommonCountOV> projectByWorkplaceList= new ArrayList<>();
Map<String, List<HuzhouProjectinfo>> workplaceCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getWorkplaceProperties().trim())); if(zxmIds.size()!=0){
for (String key:workplaceCountMap.keySet()){ List<HuzhouProjectinfo> projectInfoList = projectinfoMapper.selectBatchIds(zxmIds);
List<String> keyProjectIdsList = workplaceCountMap.get(key).stream().map(x -> x.getId()).collect(Collectors.toList()); List<HuzhouSubProjectinfo> cProjectinfoList = subProjectinfoService.listByProjectIds(cxmIds);
Map<String, Integer> countMap = planinfoService.conutCompletionStatus(keyProjectIdsList); projectInfoList.addAll(cProjectinfoList);
projectByWorkplaceList.add(CommonCountOV.builder().name(key).fininshNum(countMap.get("fininshNum")).unfininshNum(countMap.get("unfininshNum")).build()); Map<String, String> projectStage = dictService.selectByDictType("projectStage").stream().collect(Collectors.toMap(x -> x.getValue(), x -> x.getLabel()));
Map<String, String> reformTasks = dictService.selectByDictType("reformTasks").stream().collect(Collectors.toMap(x -> x.getValue(), x -> x.getLabel()));
//根据项目状态统计
Map<String, List<HuzhouProjectinfo>> statusCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getStage()));
for(String key:statusCountMap.keySet()){
projectStatusList.add(ProjectStatusOV.builder().name(projectStage.get(key)).value(statusCountMap.get(key).size()).build());
}
//根据所属改革任务统计(阶段完成情况)
Map<String, List<HuzhouProjectinfo>> reformCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getReformName().trim()));
for (String key:reformCountMap.keySet()){
List<String> keyProjectIdsList = reformCountMap.get(key).stream().map(x -> x.getId()).collect(Collectors.toList());
Map<String, Integer> countMap = planinfoService.conutCompletionStatus(keyProjectIdsList);
projectByReformList.add(CommonCountOV.builder().name(reformTasks.get(key)).fininshNum(countMap.get("fininshNum")).unfininshNum(countMap.get("unfininshNum")).build());
}
//根据行政区统计
Map<String, List<HuzhouProjectinfo>> regionCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getAdminDivision().trim()));
for (String key:regionCountMap.keySet()){
List<String> keyProjectIdsList = regionCountMap.get(key).stream().map(x -> x.getId()).collect(Collectors.toList());
Map<String, Integer> countMap = planinfoService.conutCompletionStatus(keyProjectIdsList);
projectByRegionList.add(CommonCountOV.builder().name(key).fininshNum(countMap.get("fininshNum")).unfininshNum(countMap.get("unfininshNum")).build());
}
//根据单位统计
Map<String, List<HuzhouProjectinfo>> workplaceCountMap = projectInfoList.stream().collect(Collectors.groupingBy(x -> x.getWorkplaceProperties().trim()));
for (String key:workplaceCountMap.keySet()){
List<String> keyProjectIdsList = workplaceCountMap.get(key).stream().map(x -> x.getId()).collect(Collectors.toList());
Map<String, Integer> countMap = planinfoService.conutCompletionStatus(keyProjectIdsList);
projectByWorkplaceList.add(CommonCountOV.builder().name(key).fininshNum(countMap.get("fininshNum")).unfininshNum(countMap.get("unfininshNum")).build());
}
ProjectProgressOV projectProgress = countProjectProgress();
FundOV fund = countFund();
result = CountOV.builder().xiangmZJD(projectProgress).xiangmuZJ(fund)
.xiangmuZT(projectStatusList).XXQY(projectByRegionList).SSGGRW(projectByReformList).DWSX(projectByWorkplaceList).build();
}else {
result=CountOV.builder().xiangmZJD(ProjectProgressOV.builder().fininshNum(0).unfininshNum(0).build())
.xiangmuZJ(FundOV.builder().fininshNum("0").unfininshNum("0").build())
.xiangmuZT(projectStatusList)
.XXQY(projectByRegionList)
.SSGGRW(projectByReformList)
.DWSX(projectByWorkplaceList).build();
} }
ProjectProgressOV projectProgress = countProjectProgress();
FundOV fund = countFund();
CountOV result = CountOV.builder().xiangmZJD(projectProgress).xiangmuZJ(fund)
.xiangmuZT(projectStatusList).XXQY(projectByRegionList).SSGGRW(projectByReformList).DWSX(projectByWorkplaceList).build();
return result; return result;
} }

19
huzhou/src/main/java/com/easy/admin/modules/huzhou/service/impl/HuzhouSubProjectinfoServiceImpl.java

@ -95,12 +95,19 @@ public class HuzhouSubProjectinfoServiceImpl extends ServiceImpl<HuzhouSubProjec
@Override @Override
public List<HuzhouSubProjectinfo> listByProjectIds(List<String> projectIds) { public List<HuzhouSubProjectinfo> listByProjectIds(List<String> projectIds) {
LambdaQueryWrapper<HuzhouSubProjectinfo> query = new LambdaQueryWrapper<>(new HuzhouSubProjectinfo()) List<HuzhouSubProjectinfo> result= new ArrayList<>();
.in(HuzhouSubProjectinfo::getProjectId,projectIds) if(projectIds.size()!=0){
.select(HuzhouSubProjectinfo::getProjectId,HuzhouSubProjectinfo::getId); LambdaQueryWrapper<HuzhouSubProjectinfo> query = new LambdaQueryWrapper<>(new HuzhouSubProjectinfo())
List<HuzhouSubProjectinfo> subProjectInfoList=subProjectinfoMapper.selectList(query); .in(HuzhouSubProjectinfo::getProjectId,projectIds)
List<String> subProjectsIds = subProjectInfoList.stream().map(x -> x.getId()).collect(Collectors.toList()); .select(HuzhouSubProjectinfo::getProjectId,HuzhouSubProjectinfo::getId);
List<HuzhouSubProjectinfo> result = subProjectinfoMapper.selectBatchIds(subProjectsIds); List<HuzhouSubProjectinfo> subProjectInfoList=subProjectinfoMapper.selectList(query);
List<String> subProjectsIds = subProjectInfoList.stream().map(x -> x.getId()).collect(Collectors.toList());
if(subProjectsIds.size()!=0){
result = subProjectinfoMapper.selectBatchIds(subProjectsIds);
}
}
return result; return result;
} }
} }

Loading…
Cancel
Save