|
@@ -47,6 +47,7 @@ import java.math.RoundingMode;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.nio.file.Paths;
|
|
|
import java.text.DateFormat;
|
|
|
+import java.text.NumberFormat;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
import java.util.*;
|
|
@@ -91,7 +92,12 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
ProjectInfo info = new ProjectInfo();
|
|
|
BeanUtils.copyProperties(dto,info);
|
|
|
info.setId(SnowFlakeUtil.getId());
|
|
|
- this.save(info);
|
|
|
+ try {
|
|
|
+ this.save(info);
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new ServiceException("新增失败:字段太长");
|
|
|
+ }
|
|
|
+
|
|
|
//保存计划信息
|
|
|
List<ProjectInvestPlan> list = dto.getList();
|
|
|
if (list == null || list.size() == 0){
|
|
@@ -164,11 +170,40 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
vo.setFinishedFillRatio(vo.getFinishedFill().divide(totalField,2, RoundingMode.UP));
|
|
|
}
|
|
|
vo.setInvestYearAll(investPlanService.getYearAllByProjectId(vo.getId()));
|
|
|
+ ProjectInvestPlan p=investPlanService.getInvestYearAndYearlyInvest(vo.getId(), dto.getPlanYear());
|
|
|
+ if(p!=null){
|
|
|
+ if(p.getYearlyInvest()!=null&&p.getYearlyInvest().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ vo.setYearlyInvest(p.getYearlyInvest());
|
|
|
+ }
|
|
|
+ if(p.getInvestYear()!=null&&p.getInvestYear().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ vo.setInvestYear(p.getInvestYear());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(vo.getYearlyInvest()!=null&&vo.getYearlyInvest().compareTo(BigDecimal.ZERO)!=0&&vo.getInvestYear()!=null&&vo.getInvestYear().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ // 执行除法运算,并将结果转换为百分比字符串
|
|
|
+ BigDecimal ratio = vo.getInvestYear().divide(vo.getYearlyInvest(), 4, BigDecimal.ROUND_HALF_UP); // 保留4位小数,四舍五入
|
|
|
+ NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
|
+ percentFormat.setMaximumFractionDigits(2); // 最多保留两位小数
|
|
|
+ String result = percentFormat.format(ratio);
|
|
|
+ vo.setYearlyInvestRate(result);
|
|
|
+ }
|
|
|
+ if(vo.getInvestYearAll()!=null&&vo.getInvestYearAll().compareTo(BigDecimal.ZERO)!=0&&vo.getAllInvestMoney()!=null&&vo.getAllInvestMoney().compareTo(BigDecimal.ZERO)!=0){
|
|
|
+ BigDecimal ratio = vo.getInvestYearAll().divide(vo.getAllInvestMoney(), 4, BigDecimal.ROUND_HALF_UP); // 保留4位小数,四舍五入
|
|
|
+ NumberFormat percentFormat = NumberFormat.getPercentInstance();
|
|
|
+ percentFormat.setMaximumFractionDigits(2); // 最多保留两位小数
|
|
|
+ String result = percentFormat.format(ratio);
|
|
|
+ vo.setInvestYearRate(result);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return iPage;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
public ProjectInfoDetailVO detail(Long id) {
|
|
|
//获取项目详情
|
|
@@ -284,10 +319,14 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
public ProjectAndPlanDetailVO detail2(Long id) {
|
|
|
//项目详情
|
|
|
ProjectAndPlanDetailVO vo = baseMapper.detail2(id);
|
|
|
- if (vo.getBuildScaleUnit() == 1){
|
|
|
- vo.setBuildScaleName(vo.getBuildScale()+"(公里)");
|
|
|
+ if(vo.getBuildScale()==null||vo.getBuildScale().isEmpty()){
|
|
|
+ vo.setBuildScaleName("");
|
|
|
}else {
|
|
|
- vo.setBuildScaleName(vo.getBuildScale());
|
|
|
+ if (vo.getBuildScaleUnit() == 1){
|
|
|
+ vo.setBuildScaleName(vo.getBuildScale()+"(公里)");
|
|
|
+ }else {
|
|
|
+ vo.setBuildScaleName(vo.getBuildScale());
|
|
|
+ }
|
|
|
}
|
|
|
//获取所有-有计划的年
|
|
|
List<ProjectInvestPlanVO> planList = baseMapper.getAllPlanByProjectId(id);
|
|
@@ -743,22 +782,56 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
//判断是否选择过月,选择过月则计划总投资为季度-实际完成投资为当月
|
|
|
if (month != null && month != -1) {
|
|
|
if (quarters[month] == 1) {
|
|
|
- vo2.setPlanAllMoney(plan.getOneInvest() == null ? BigDecimal.ZERO : plan.getOneInvest());
|
|
|
- vo2.setCurrentMoney(plan.getOneInvestFinish() == null ? BigDecimal.ZERO : plan.getOneInvestFinish());
|
|
|
+ if(plan.getOneInvest()!=null){
|
|
|
+ BigDecimal oneDivide=plan.getOneInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ if(month==3){
|
|
|
+ vo2.setPlanAllMoney(plan.getOneInvest());
|
|
|
+ }else {
|
|
|
+ vo2.setPlanAllMoney(oneDivide.multiply(BigDecimal.valueOf(month)));
|
|
|
+ }
|
|
|
+ }
|
|
|
} else if (quarters[month] == 2) {
|
|
|
- vo2.setPlanAllMoney(plan.getTwoInvest() == null ? BigDecimal.ZERO : plan.getTwoInvest());
|
|
|
- vo2.setCurrentMoney(plan.getTwoInvestFinish() == null ? BigDecimal.ZERO : plan.getTwoInvestFinish());
|
|
|
+ if(plan.getTwoInvest()!=null){
|
|
|
+ BigDecimal twoDivide=plan.getTwoInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ if(month==6){
|
|
|
+ vo2.setPlanAllMoney(plan.getOneInvest()==null?BigDecimal.ZERO:plan.getOneInvest().add(plan.getTwoInvest()));
|
|
|
+ }else {
|
|
|
+ vo2.setPlanAllMoney(plan.getOneInvest()==null?BigDecimal.ZERO:plan.getOneInvest().add(twoDivide.multiply(BigDecimal.valueOf(month-3))));
|
|
|
+ }
|
|
|
+ }
|
|
|
} else if (quarters[month] == 3) {
|
|
|
- vo2.setPlanAllMoney(plan.getThreeInvest() == null ? BigDecimal.ZERO : plan.getThreeInvest());
|
|
|
- vo2.setCurrentMoney(plan.getThreeInvestFinish() == null ? BigDecimal.ZERO : plan.getThreeInvestFinish());
|
|
|
+ if(plan.getThreeInvest()!=null){
|
|
|
+ BigDecimal ThreeDivide=plan.getThreeInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ if(month==9){
|
|
|
+ vo2.setPlanAllMoney(plan.getOneInvest()==null?BigDecimal.ZERO:plan.getOneInvest().add(plan.getTwoInvest()==null?BigDecimal.ZERO:plan.getTwoInvest()).add(plan.getThreeInvest()));
|
|
|
+ }else {
|
|
|
+ vo2.setPlanAllMoney(plan.getOneInvest()==null?BigDecimal.ZERO:plan.getOneInvest().add(plan.getTwoInvest()==null?BigDecimal.ZERO:plan.getTwoInvest()).add(ThreeDivide.multiply(BigDecimal.valueOf(month-6))));
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
- vo2.setPlanAllMoney(plan.getFourInvest() == null ? BigDecimal.ZERO : plan.getFourInvest());
|
|
|
- vo2.setCurrentMoney(plan.getFourInvestFinish() == null ? BigDecimal.ZERO : plan.getFourInvestFinish());
|
|
|
+ if(plan.getFourInvest()!=null){
|
|
|
+ BigDecimal FourDivide=plan.getFourInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ if(month==12){
|
|
|
+ vo2.setPlanAllMoney(plan.getYearlyInvest() == null ? BigDecimal.ZERO : plan.getYearlyInvest());
|
|
|
+ }else {
|
|
|
+ vo2.setPlanAllMoney(plan.getOneInvest()==null?BigDecimal.ZERO:plan.getOneInvest().add(plan.getTwoInvest()==null?BigDecimal.ZERO:plan.getTwoInvest()).add(plan.getThreeInvest()==null?BigDecimal.ZERO:plan.getThreeInvest()).add(FourDivide.multiply(BigDecimal.valueOf(month-9))));
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+ List<ProjectPlanProgress> list=planProgressService.list(new LambdaQueryWrapper<>(ProjectPlanProgress.class).eq(ProjectPlanProgress::getProjectId, vo2.getId()).eq(ProjectPlanProgress::getPlanYear,year).orderByAsc(ProjectPlanProgress::getPlanMonth));
|
|
|
+ BigDecimal investMoneyAll = list.stream()
|
|
|
+ .filter(item -> item.getPlanMonth() != null && item.getPlanMonth() <= month)
|
|
|
+ .map(item -> {
|
|
|
+ // 处理 null,默认为 0
|
|
|
+ return item.getInvestMoney() == null ? BigDecimal.ZERO : item.getInvestMoney();
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo2.setCurrentMoney(investMoneyAll);
|
|
|
} else {
|
|
|
//没有选择过月计划总投资为年-实际完成投资为当年,
|
|
|
vo2.setPlanAllMoney(plan.getYearlyInvest() == null ? BigDecimal.ZERO : plan.getYearlyInvest());
|
|
|
- vo2.setCurrentMoney(plan.getYearFinishInvest() == null ? BigDecimal.ZERO : plan.getYearFinishInvest());
|
|
|
+ vo2.setCurrentMoney(plan.getInvestYear() == null ? BigDecimal.ZERO : plan.getInvestYear());
|
|
|
}
|
|
|
//判断项目进程类型
|
|
|
if ((plan.getIsOneInvestFinish() == 1 && plan.getOneInvest().compareTo(plan.getOneInvestFinish()) > 0) ||
|
|
@@ -793,12 +866,12 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
BigDecimal investYearAll=investPlanService.getYearAll(dto.getYear()+"");
|
|
|
vo.setInvestYearAll(investYearAll);
|
|
|
vo.setProjectTotal(vo2s.size());
|
|
|
- vo.setPlanAllMoney(vo2s.stream().map(l->l.getPlanAllMoney()).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
- vo.setCurrentMoney(vo2s.stream().map(l->l.getCurrentMoney()).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
+ vo.setPlanAllMoney(vo2s.stream().filter(l->l.getPlanAllMoney()!=null).map(l->l.getPlanAllMoney()).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
+ vo.setCurrentMoney(vo2s.stream().filter(l->l.getCurrentMoney()!=null).map(l->l.getCurrentMoney()).reduce(BigDecimal.ZERO,BigDecimal::add));
|
|
|
if (vo.getPlanAllMoney().compareTo(BigDecimal.ZERO) == 0){
|
|
|
- vo.setInvestRatio(vo.getInvestYearAll());
|
|
|
+ vo.setInvestRatio(vo.getCurrentMoney());
|
|
|
}else {
|
|
|
- vo.setInvestRatio(vo.getInvestYearAll().multiply(new BigDecimal(100)).divide(vo.getPlanAllMoney(),2,RoundingMode.UP));
|
|
|
+ vo.setInvestRatio(vo.getCurrentMoney().multiply(new BigDecimal(100)).divide(vo.getPlanAllMoney(),2,RoundingMode.UP));
|
|
|
}
|
|
|
vo.setTotal1((int) vo2s.stream().filter(l->l.getScheduleType() == 1).count());
|
|
|
vo.setTotal2((int) vo2s.stream().filter(l->l.getScheduleType() == 2).count());
|
|
@@ -825,7 +898,7 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
if (vo2s.size() == 0){
|
|
|
return vo;
|
|
|
}
|
|
|
- //有遗漏有比如计划年份不在所选年份里,但是该项目在所选的年份有投资,也需要加上 2025-05-09 王博念
|
|
|
+ //有遗漏有计划年份不在所选年份里,但是该项目在所选的年份有投资,也需要加上 2025-05-09 王博念
|
|
|
List<DataInvestStatVO2> vo3s = baseMapper.dataInvestStat1(dto);
|
|
|
vo2s.addAll(vo3s);
|
|
|
List<ProjectInvestPlan> planList = investPlanService.list(new LambdaQueryWrapper<ProjectInvestPlan>()
|
|
@@ -837,6 +910,8 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
Map<Long, ProjectInvestPlan> planMap = planList.stream().collect(Collectors.toMap(l -> l.getProjectId(), l -> l));
|
|
|
int[] quarters = {0,1,1,1,2,2,2,3,3,3,4,4,4};
|
|
|
Integer month = dto.getMonth();
|
|
|
+
|
|
|
+ List<BigDecimal> list111=new ArrayList<>();
|
|
|
for (DataInvestStatVO2 vo2 : vo2s) {
|
|
|
//获取当年计划
|
|
|
ProjectInvestPlan plan = planMap.get(vo2.getId());
|
|
@@ -866,13 +941,45 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
vo2.setUnFinishedMoney(vo2.getPlanAllMoney().subtract(vo2.getCurrentMoney()));
|
|
|
}
|
|
|
//设置每个季度数据
|
|
|
- vo2.setOneFinished(plan.getOneInvestFinish() == null?BigDecimal.ZERO:plan.getOneInvestFinish());
|
|
|
+ List<ProjectPlanProgress> lists=planProgressService.list(new LambdaQueryWrapper<>(ProjectPlanProgress.class).eq(ProjectPlanProgress::getProjectId, vo2.getId()).eq(ProjectPlanProgress::getPlanYear,year).orderByAsc(ProjectPlanProgress::getPlanMonth));
|
|
|
+ BigDecimal investMoneyAll1 = lists.stream()
|
|
|
+ .filter(item -> item.getPlanMonth() != null && item.getPlanMonth() <= 3)
|
|
|
+ .map(item -> {
|
|
|
+ // 处理 null,默认为 0
|
|
|
+ return item.getInvestMoney() == null ? BigDecimal.ZERO : item.getInvestMoney();
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo2.setOneFinished(investMoneyAll1);
|
|
|
vo2.setOneUnFinished(plan.getOneInvest() == null?BigDecimal.ZERO:plan.getOneInvest().subtract(vo2.getOneFinished()));
|
|
|
- vo2.setTwoFinished(plan.getTwoInvestFinish() == null?BigDecimal.ZERO:plan.getTwoInvestFinish());
|
|
|
+
|
|
|
+ BigDecimal investMoneyAll2 = lists.stream()
|
|
|
+ .filter(item -> item.getPlanMonth() != null && item.getPlanMonth() > 3&&item.getPlanMonth()<=6)
|
|
|
+ .map(item -> {
|
|
|
+ // 处理 null,默认为 0
|
|
|
+ return item.getInvestMoney() == null ? BigDecimal.ZERO : item.getInvestMoney();
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo2.setTwoFinished(investMoneyAll2);
|
|
|
vo2.setTwoUnFinished(plan.getTwoInvest() == null?BigDecimal.ZERO:plan.getTwoInvest().subtract(vo2.getTwoFinished()));
|
|
|
- vo2.setThreeFinished(plan.getThreeInvestFinish() == null?BigDecimal.ZERO:plan.getThreeInvestFinish());
|
|
|
+
|
|
|
+ BigDecimal investMoneyAll3 = lists.stream()
|
|
|
+ .filter(item -> item.getPlanMonth() != null && item.getPlanMonth() > 6&& item.getPlanMonth() <=9)
|
|
|
+ .map(item -> {
|
|
|
+ // 处理 null,默认为 0
|
|
|
+ return item.getInvestMoney() == null ? BigDecimal.ZERO : item.getInvestMoney();
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo2.setThreeFinished(investMoneyAll3);
|
|
|
vo2.setThreeUnFinished(plan.getThreeInvest() == null?BigDecimal.ZERO:plan.getThreeInvest().subtract(vo2.getThreeFinished()));
|
|
|
- vo2.setFourFinished(plan.getFourInvestFinish() == null?BigDecimal.ZERO:plan.getFourInvestFinish());
|
|
|
+
|
|
|
+ BigDecimal investMoneyAll4 = lists.stream()
|
|
|
+ .filter(item -> item.getPlanMonth() != null && item.getPlanMonth() > 9&& item.getPlanMonth() <=12)
|
|
|
+ .map(item -> {
|
|
|
+ // 处理 null,默认为 0
|
|
|
+ return item.getInvestMoney() == null ? BigDecimal.ZERO : item.getInvestMoney();
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ vo2.setFourFinished(investMoneyAll4);
|
|
|
vo2.setFourUnFinished(plan.getFourInvest() == null?BigDecimal.ZERO:plan.getFourInvest().subtract(vo2.getFourFinished()));
|
|
|
//判断项目进程类型
|
|
|
if (plan.getOneInvest() == null || plan.getTwoInvest() == null || plan.getThreeInvest() == null || plan.getFourInvest() == null ||
|
|
@@ -923,6 +1030,36 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
Set<Integer> stages = map.keySet();
|
|
|
ArrayList<Integer> stages2 = new ArrayList<>(stages);
|
|
|
Collections.sort(stages2);
|
|
|
+ Map<String,List<BigDecimal>> map2=new HashMap<>();
|
|
|
+ List<BigDecimal> planInvestAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> finishedInvestAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> oneMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> twoMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> threeMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> fourMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> fiveMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> sixMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> sevenMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> eightMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> nineMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> tenMonthAll =new ArrayList<>();
|
|
|
+ List<BigDecimal> elevenMonthAll = new ArrayList<>();
|
|
|
+ List<BigDecimal> twelveMonthAll = new ArrayList<>();
|
|
|
+
|
|
|
+ List<BigDecimal> oneMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> twoMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> threeMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> fourMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> fiveMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> sixMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> sevenMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> eightMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> nineMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> tenMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> elevenMonthAll2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> twelveMonthAll2 = new ArrayList<>();
|
|
|
+
|
|
|
+
|
|
|
for (Integer stage : stages2) {
|
|
|
//按照项目类型分组
|
|
|
Map<Integer, List<DataInvestStatVO2>> listMap = map.get(stage).stream().collect(Collectors.groupingBy(DataInvestStatVO2::getProjectType));
|
|
@@ -931,9 +1068,10 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
Collections.sort(types2);
|
|
|
for (Integer type : types2) {
|
|
|
List<DataInvestStatVO2> vo2List = listMap.get(type);
|
|
|
+ List<Long> projectIds = vo2List.stream().map(o -> o.getId()).collect(Collectors.toList());
|
|
|
DataInvestStatVO.InvestInfo info = new DataInvestStatVO.InvestInfo();
|
|
|
info.setInvestYearAll(BigDecimal.ZERO);
|
|
|
- BigDecimal investYearAll=investPlanService.getYearAllByType(type,dto.getYear()+"");
|
|
|
+ BigDecimal investYearAll=investPlanService.getYearAllByType(type,dto.getYear()+"",projectIds);
|
|
|
info.setInvestYearAll(investYearAll);
|
|
|
info.setProjectStageName(vo2List.get(0).getProjectStageName());
|
|
|
info.setProjectTypeName(vo2List.get(0).getProjectTypeName());
|
|
@@ -944,69 +1082,201 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
Map<String,List<BigDecimal>> stringListMap = new HashMap<>();
|
|
|
List<BigDecimal> planInvest = new ArrayList<>();
|
|
|
List<BigDecimal> finishedInvest = new ArrayList<>();
|
|
|
- List<BigDecimal> unFinishedInvest = new ArrayList<>();
|
|
|
- BigDecimal one = BigDecimal.ZERO;
|
|
|
- BigDecimal two = BigDecimal.ZERO;
|
|
|
- BigDecimal three = BigDecimal.ZERO;
|
|
|
- BigDecimal four = BigDecimal.ZERO;
|
|
|
- BigDecimal one2 = BigDecimal.ZERO;
|
|
|
- BigDecimal two2 = BigDecimal.ZERO;
|
|
|
- BigDecimal three2 = BigDecimal.ZERO;
|
|
|
- BigDecimal four2 = BigDecimal.ZERO;
|
|
|
- BigDecimal one3 = BigDecimal.ZERO;
|
|
|
- BigDecimal two3 = BigDecimal.ZERO;
|
|
|
- BigDecimal three3 = BigDecimal.ZERO;
|
|
|
- BigDecimal four3 = BigDecimal.ZERO;
|
|
|
+
|
|
|
+ //计划投资1-12月
|
|
|
+ List<BigDecimal> oneMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> twoMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> threeMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> fourMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> fiveMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> sixMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> sevenMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> eightMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> nineMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> tenMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> elevenMonth = new ArrayList<>();
|
|
|
+ List<BigDecimal> twelveMonth = new ArrayList<>();
|
|
|
+
|
|
|
+ //实际投资1-12月
|
|
|
+ List<BigDecimal> oneMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> twoMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> threeMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> fourMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> fiveMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> sixMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> sevenMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> eightMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> nineMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> tenMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> elevenMonth2 = new ArrayList<>();
|
|
|
+ List<BigDecimal> twelveMonth2 = new ArrayList<>();
|
|
|
+
|
|
|
for (DataInvestStatVO2 vo2 : vo2List) {
|
|
|
ProjectInvestPlan plan = planMap.get(vo2.getId());
|
|
|
+ if(plan.getOneInvest()==null){
|
|
|
+ plan.setOneInvest(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(plan.getTwoInvest()==null){
|
|
|
+ plan.setTwoInvest(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(plan.getThreeInvest()==null){
|
|
|
+ plan.setThreeInvest(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
+ if(plan.getFourInvest()==null){
|
|
|
+ plan.setFourInvest(BigDecimal.ZERO);
|
|
|
+ }
|
|
|
if (plan.getOneInvest() != null){
|
|
|
- one = one.add(plan.getOneInvest());
|
|
|
+ BigDecimal oneDivide=plan.getOneInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ oneMonthAll.add(oneDivide);
|
|
|
+ twoMonthAll.add(oneDivide.multiply(new BigDecimal(2)));
|
|
|
+ threeMonthAll.add(plan.getOneInvest());
|
|
|
+ oneMonth.add(oneDivide);
|
|
|
+ twoMonth.add(oneDivide.multiply(new BigDecimal(2)));
|
|
|
+ threeMonth.add(plan.getOneInvest());
|
|
|
+
|
|
|
}
|
|
|
if (plan.getTwoInvest() != null){
|
|
|
- two = two.add(plan.getTwoInvest());
|
|
|
+ BigDecimal twoDivide=plan.getTwoInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ fourMonthAll.add(plan.getOneInvest().add(twoDivide));
|
|
|
+ fiveMonthAll.add(plan.getOneInvest().add(twoDivide).add(twoDivide));
|
|
|
+ sixMonthAll.add(plan.getOneInvest().add(plan.getTwoInvest()));
|
|
|
+ fourMonth.add(plan.getOneInvest().add(twoDivide));
|
|
|
+ fiveMonth.add(plan.getOneInvest().add(twoDivide).add(twoDivide));
|
|
|
+ sixMonth.add(plan.getOneInvest().add(plan.getTwoInvest()));
|
|
|
+
|
|
|
}
|
|
|
if (plan.getThreeInvest() != null){
|
|
|
- three = three.add(plan.getThreeInvest());
|
|
|
+ BigDecimal threeDivide=plan.getThreeInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ sevenMonthAll.add(plan.getOneInvest().add(plan.getTwoInvest()).add(threeDivide));
|
|
|
+ eightMonthAll.add(plan.getOneInvest().add(plan.getTwoInvest()).add(threeDivide.multiply(new BigDecimal(2))));
|
|
|
+ nineMonthAll.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()));
|
|
|
+ sevenMonth.add(plan.getOneInvest().add(plan.getTwoInvest()).add(threeDivide));
|
|
|
+ eightMonth.add(plan.getOneInvest().add(plan.getTwoInvest()).add(threeDivide.multiply(new BigDecimal(2))));
|
|
|
+ nineMonth.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()));
|
|
|
+
|
|
|
}
|
|
|
if (plan.getFourInvest() != null){
|
|
|
- four = four.add(plan.getFourInvest());
|
|
|
+ BigDecimal fourDivide=plan.getFourInvest().divide(BigDecimal.valueOf(3),2, RoundingMode.HALF_UP);
|
|
|
+ tenMonthAll.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()).add(fourDivide));
|
|
|
+ elevenMonthAll.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()).add(fourDivide.multiply(new BigDecimal(2))));
|
|
|
+ twelveMonthAll.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()).add(plan.getFourInvest()));
|
|
|
+ tenMonth.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()).add(fourDivide));
|
|
|
+ elevenMonth.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()).add(fourDivide.multiply(new BigDecimal(2))));
|
|
|
+ twelveMonth.add(plan.getOneInvest().add(plan.getTwoInvest()).add(plan.getThreeInvest()).add(plan.getFourInvest()));
|
|
|
+
|
|
|
}
|
|
|
- one2 = one2.add(vo2.getOneFinished());
|
|
|
- one3 = one3.add(vo2.getOneUnFinished());
|
|
|
-
|
|
|
- two2 = two2.add(vo2.getTwoFinished());
|
|
|
- two3 = two3.add(vo2.getTwoUnFinished());
|
|
|
-
|
|
|
- three2 = three2.add(vo2.getThreeFinished());
|
|
|
- three3 = three3.add(vo2.getThreeUnFinished());
|
|
|
-
|
|
|
- four2 = four2.add(vo2.getFourFinished());
|
|
|
- four3 = four3.add(vo2.getFourUnFinished());
|
|
|
- }
|
|
|
- planInvest.add(one);
|
|
|
- planInvest.add(two);
|
|
|
- planInvest.add(three);
|
|
|
- planInvest.add(four);
|
|
|
- finishedInvest.add(one2);
|
|
|
- finishedInvest.add(two2);
|
|
|
- finishedInvest.add(three2);
|
|
|
- finishedInvest.add(four2);
|
|
|
- unFinishedInvest.add(one3);
|
|
|
- unFinishedInvest.add(two3);
|
|
|
- unFinishedInvest.add(three3);
|
|
|
- unFinishedInvest.add(four3);
|
|
|
+
|
|
|
+ List<ProjectPlanProgress> lists=planProgressService.list(new LambdaQueryWrapper<>(ProjectPlanProgress.class).eq(ProjectPlanProgress::getProjectId, vo2.getId()).eq(ProjectPlanProgress::getPlanYear,year).orderByAsc(ProjectPlanProgress::getPlanMonth));
|
|
|
+
|
|
|
+ oneMonthAll2.add(getSum1(lists,1));
|
|
|
+ twoMonthAll2.add(getSum1(lists,2));
|
|
|
+ threeMonthAll2.add(getSum1(lists,3));
|
|
|
+ fourMonthAll2.add(getSum1(lists,4));
|
|
|
+ fiveMonthAll2.add(getSum1(lists,5));
|
|
|
+ sixMonthAll2.add(getSum1(lists,6));
|
|
|
+ sevenMonthAll2.add(getSum1(lists,7));
|
|
|
+ eightMonthAll2.add(getSum1(lists,8));
|
|
|
+ nineMonthAll2.add(getSum1(lists,9));
|
|
|
+ tenMonthAll2.add(getSum1(lists,10));
|
|
|
+ elevenMonthAll2.add(getSum1(lists,11));
|
|
|
+ twelveMonthAll2.add(getSum1(lists,12));
|
|
|
+
|
|
|
+ oneMonth2.add(getSum1(lists,1));
|
|
|
+ twoMonth2.add(getSum1(lists,2));
|
|
|
+ threeMonth2.add(getSum1(lists,3));
|
|
|
+ fourMonth2.add(getSum1(lists,4));
|
|
|
+ fiveMonth2.add(getSum1(lists,5));
|
|
|
+ sixMonth2.add(getSum1(lists,6));
|
|
|
+ sevenMonth2.add(getSum1(lists,7));
|
|
|
+ eightMonth2.add(getSum1(lists,8));
|
|
|
+ nineMonth2.add(getSum1(lists,9));
|
|
|
+ tenMonth2.add(getSum1(lists,10));
|
|
|
+ elevenMonth2.add(getSum1(lists,11));
|
|
|
+ twelveMonth2.add(getSum1(lists,12));
|
|
|
+ }
|
|
|
+
|
|
|
+ planInvest.add(getSum(oneMonth));
|
|
|
+ planInvest.add(getSum(twoMonth));
|
|
|
+ planInvest.add(getSum(threeMonth));
|
|
|
+ planInvest.add(getSum(fourMonth));
|
|
|
+ planInvest.add(getSum(fiveMonth));
|
|
|
+ planInvest.add(getSum(sixMonth));
|
|
|
+ planInvest.add(getSum(sevenMonth));
|
|
|
+ planInvest.add(getSum(eightMonth));
|
|
|
+ planInvest.add(getSum(nineMonth));
|
|
|
+ planInvest.add(getSum(tenMonth));
|
|
|
+ planInvest.add(getSum(elevenMonth));
|
|
|
+ planInvest.add(getSum(twelveMonth));
|
|
|
+
|
|
|
+ finishedInvest.add(getSum(oneMonth2));
|
|
|
+ finishedInvest.add(getSum(twoMonth2));
|
|
|
+ finishedInvest.add(getSum(threeMonth2));
|
|
|
+ finishedInvest.add(getSum(fourMonth2));
|
|
|
+ finishedInvest.add(getSum(fiveMonth2));
|
|
|
+ finishedInvest.add(getSum(sixMonth2));
|
|
|
+ finishedInvest.add(getSum(sevenMonth2));
|
|
|
+ finishedInvest.add(getSum(eightMonth2));
|
|
|
+ finishedInvest.add(getSum(nineMonth2));
|
|
|
+ finishedInvest.add(getSum(tenMonth2));
|
|
|
+ finishedInvest.add(getSum(elevenMonth2));
|
|
|
+ finishedInvest.add(getSum(twelveMonth2));
|
|
|
//a计划b实际c未完成
|
|
|
stringListMap.put("a",planInvest);
|
|
|
stringListMap.put("b",finishedInvest);
|
|
|
- stringListMap.put("c",unFinishedInvest);
|
|
|
info.setMap(stringListMap);
|
|
|
list.add(info);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ planInvestAll.add(getSum(oneMonthAll));
|
|
|
+ planInvestAll.add(getSum(twoMonthAll));
|
|
|
+ planInvestAll.add(getSum(threeMonthAll));
|
|
|
+ planInvestAll.add(getSum(fourMonthAll));
|
|
|
+ planInvestAll.add(getSum(fiveMonthAll));
|
|
|
+ planInvestAll.add(getSum(sixMonthAll));
|
|
|
+ planInvestAll.add(getSum(sevenMonthAll));
|
|
|
+ planInvestAll.add(getSum(eightMonthAll));
|
|
|
+ planInvestAll.add(getSum(nineMonthAll));
|
|
|
+ planInvestAll.add(getSum(tenMonthAll));
|
|
|
+ planInvestAll.add(getSum(elevenMonthAll));
|
|
|
+ planInvestAll.add(getSum(twelveMonthAll));
|
|
|
+
|
|
|
+ finishedInvestAll.add(getSum(oneMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(twoMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(threeMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(fourMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(fiveMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(sixMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(sevenMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(eightMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(nineMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(tenMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(elevenMonthAll2));
|
|
|
+ finishedInvestAll.add(getSum(twelveMonthAll2));
|
|
|
+
|
|
|
+ map2.put("a",planInvestAll);
|
|
|
+ map2.put("b",finishedInvestAll);
|
|
|
+ vo.setMap2(map2);
|
|
|
vo.setList(list);
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
+ public BigDecimal getSum(List<BigDecimal> list){
|
|
|
+ return list.stream()
|
|
|
+ .filter(Objects::nonNull) // 确保没有 null 值
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
+ public BigDecimal getSum1(List<ProjectPlanProgress>list,Integer i){
|
|
|
+ return list.stream()
|
|
|
+ .filter(item -> item.getPlanMonth() != null && item.getPlanMonth() <=i)
|
|
|
+ .map(item -> {
|
|
|
+ // 处理 null,默认为 0
|
|
|
+ return item.getInvestMoney() == null ? BigDecimal.ZERO : item.getInvestMoney();
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public DataScheduleStatVO dataScheduleStat(DataStatDTO dto) {
|
|
|
Integer year = dto.getYear();
|
|
@@ -1589,7 +1859,7 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
|
|
|
//rowHead每一行的第一个值
|
|
|
String rowHead = cells.get(0).getText().replaceAll("\\s*", "");
|
|
|
ReportVO1 rowData = null;
|
|
|
- if (rowHead.contains("一、市交通运输委")&&reportVOMap2.containsKey("一、市交通运输委")){
|
|
|
+ if (rowHead.contains("一、市交通运输委")&&reportVOMap1.containsKey("一、市交通运输委")){
|
|
|
rowData = reportVOMap1.get("一、市交通运输委");
|
|
|
rowData.setYearProjectTotal(94);
|
|
|
rowData.setYearPlanInvest(new BigDecimal("1155"));
|