소스 검색

开工累计投资

chenr 3 달 전
부모
커밋
f5193fd8b0

+ 4 - 0
src/main/java/org/springblade/modules/project/mapper/ProjectInvestPlanMapper.java

@@ -47,4 +47,8 @@ public interface ProjectInvestPlanMapper extends BaseMapper<ProjectInvestPlan> {
     BigDecimal getYearAllByProjectId(@Param("id")Long id);
 
     void updateAllInvestYearAllByProjectId(@Param("id")Long id, @Param("finalInvestYearAllToTal")BigDecimal finalInvestYearAllToTal);
+
+    BigDecimal getYearAllByType(@Param("type") Integer type,@Param("year") String year);
+
+    BigDecimal getYearAll(@Param("year")String year);
 }

+ 6 - 0
src/main/java/org/springblade/modules/project/mapper/ProjectInvestPlanMapper.xml

@@ -16,4 +16,10 @@
     <select id="getYearAllByProjectId" resultType="java.math.BigDecimal">
         select invest_year_all from d_project_invest_plan where is_deleted = 0 and project_id = #{id}  limit 1
     </select>
+    <select id="getYearAllByType" resultType="java.math.BigDecimal">
+       SELECT ifNull(sum(dpip.invest_year),0) from d_project_invest_plan dpip left join d_project_info dpi on dpi.id = dpip.project_id where dpi.project_type = #{type} and dpi.is_deleted = 0 and dpip.plan_year = #{year} and dpip.is_deleted = 0
+    </select>
+    <select id="getYearAll" resultType="java.math.BigDecimal">
+        select ifNull(sum(invest_year),0) from d_project_invest_plan where plan_year=#{year} and is_deleted = 0
+    </select>
 </mapper>

+ 3 - 0
src/main/java/org/springblade/modules/project/pojo/vo/DataInvestStatVO.java

@@ -60,6 +60,9 @@ public class DataInvestStatVO {
         @Schema(description = "未完成投资")
         private BigDecimal unFinishedMoney;
 
+        @Schema(description = "投资年累计")
+        private BigDecimal investYearAll;
+
         @Schema(description = "投资走势")
         private Map<String,List<BigDecimal>> map;
 

+ 3 - 0
src/main/java/org/springblade/modules/project/pojo/vo/DataProjectStatVO.java

@@ -34,4 +34,7 @@ public class DataProjectStatVO {
 
     @Schema(description = "滞后项目")
     private Integer total3;
+
+    @Schema(description = "累计完成投资")
+    private BigDecimal investYearAll;
 }

+ 4 - 0
src/main/java/org/springblade/modules/project/service/IProjectInvestPlanService.java

@@ -21,4 +21,8 @@ public interface IProjectInvestPlanService extends BaseService<ProjectInvestPlan
     BigDecimal getYearAllByProjectId(Long id);
 
     void updateAllInvestYearAllByProjectId(Long id, BigDecimal finalInvestYearAllToTal);
+
+    BigDecimal getYearAllByType(Integer type,String year);
+
+    BigDecimal getYearAll(String year);
 }

+ 10 - 4
src/main/java/org/springblade/modules/project/service/impl/ProjectInfoServiceImpl.java

@@ -655,7 +655,7 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
                     yearPlan.setIsFillPlan(1);
                 }
             }
-            if(year.getIsInvestYear()!=null&&year.getIsInvestYear()==0){
+            if(year.getIsInvestYear()==null||year.getIsInvestYear()==0){
                 BigDecimal totalInvestMoney=monthList.stream()
                     .map(ProjectPlanProgress::getInvestMoney)
                     .filter(investMoney -> investMoney != null)
@@ -786,13 +786,16 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
         if (scheduleType != null && scheduleType != -1){
             vo2s = vo2s.stream().filter(l->scheduleType.equals(l.getScheduleType())).collect(Collectors.toList());
         }
+        vo.setInvestYearAll(BigDecimal.ZERO);
+        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));
         if (vo.getPlanAllMoney().compareTo(BigDecimal.ZERO) == 0){
-            vo.setInvestRatio(vo.getCurrentMoney());
+            vo.setInvestRatio(vo.getInvestYearAll());
         }else {
-            vo.setInvestRatio(vo.getCurrentMoney().multiply(new BigDecimal(100)).divide(vo.getPlanAllMoney(),2,RoundingMode.UP));
+            vo.setInvestRatio(vo.getInvestYearAll().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());
@@ -923,11 +926,14 @@ public class ProjectInfoServiceImpl extends BaseServiceImpl<ProjectInfoMapper, P
             for (Integer type : types2) {
                 List<DataInvestStatVO2> vo2List = listMap.get(type);
                 DataInvestStatVO.InvestInfo info = new DataInvestStatVO.InvestInfo();
+                info.setInvestYearAll(BigDecimal.ZERO);
+                BigDecimal investYearAll=investPlanService.getYearAllByType(type,dto.getYear()+"");
+                info.setInvestYearAll(investYearAll);
                 info.setProjectStageName(vo2List.get(0).getProjectStageName());
                 info.setProjectTypeName(vo2List.get(0).getProjectTypeName());
                 info.setPlanAllMoney(vo2List.stream().map(l->l.getPlanAllMoney()).reduce(BigDecimal.ZERO,BigDecimal::add));
                 info.setCurrentMoney(vo2List.stream().map(l->l.getCurrentMoney()).reduce(BigDecimal.ZERO,BigDecimal::add));
-                info.setUnFinishedMoney(vo2List.stream().map(l->l.getUnFinishedMoney()).reduce(BigDecimal.ZERO,BigDecimal::add));
+                info.setUnFinishedMoney(info.getPlanAllMoney().subtract(info.getInvestYearAll()));
                 //走势图
                 Map<String,List<BigDecimal>> stringListMap = new HashMap<>();
                 List<BigDecimal> planInvest = new ArrayList<>();

+ 10 - 0
src/main/java/org/springblade/modules/project/service/impl/ProjectInvestPlanServiceImpl.java

@@ -41,4 +41,14 @@ public class ProjectInvestPlanServiceImpl extends BaseServiceImpl<ProjectInvestP
     public void updateAllInvestYearAllByProjectId(Long id, BigDecimal finalInvestYearAllToTal) {
         baseMapper.updateAllInvestYearAllByProjectId(id,finalInvestYearAllToTal);
     }
+
+    @Override
+    public BigDecimal getYearAllByType(Integer type,String year) {
+        return baseMapper.getYearAllByType(type,year);
+    }
+
+    @Override
+    public BigDecimal getYearAll(String year) {
+        return baseMapper.getYearAll(year);
+    }
 }