Selaa lähdekoodia

统计分析新需求

buzhanyi 1 vuosi sitten
vanhempi
commit
25735cf085

+ 8 - 0
purchase-system/src/main/java/com/ozs/pm/mapper/PmDemandMapper.java

@@ -648,4 +648,12 @@ public interface PmDemandMapper extends BaseMapper<PmDemand> {
      */
     Map<String, Object> purchaseProjectYTB(@Param("vo") PmDemandReqVo pmDemandReqVo);
 
+
+    /**
+     * 各阶段项目数量分布本年度
+     *
+     * @param pmDemandReqVo
+     * @return
+     */
+    Map<String, Object> purchaseProjectDistributionBND(@Param("vo") PmDemandReqVo pmDemandReqVo);
 }

+ 7 - 3
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -4608,6 +4608,9 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         double d2 = y * 1.0;
         // 设置保留几位小数, “.”后面几个零就保留几位小数,这里设置保留2位小数
         DecimalFormat decimalFormat = new DecimalFormat("##.00%");
+        if (d1 == 0) {
+            return "0.00%";
+        }
         return decimalFormat.format(d1 / d2);
     }
 
@@ -4689,6 +4692,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         }
         lw.eq(PlanYears::getDelFlay, DataIsDelete.DataNOTDelete.getCode());
         lw.orderBy(true, false, PlanYears::getCreateTime);
+
         //年度计划中所有的项目数
         long countPlanYear = planYearsService.count(lw);
         //状态为“需求待审核”以后的数据
@@ -4710,7 +4714,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         afsh.add(PmProjectStatus.UNDER_CONSTRUCTION.getCode());
         afsh.add(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode());
         pmDemandReqVo.setProjectStatusList(afsh);
-        Map<String, Object> num1 = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
+        Map<String, Object> num1 = pmDemandMapper.purchaseProjectDistributionBND(pmDemandReqVo);
         int countAfsh = Integer.parseInt(num1.get("countNumber").toString());
         //执行率
         String zxl = getPercent(countAfsh, Math.toIntExact(countPlanYear));
@@ -4728,7 +4732,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         afhttz.add(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode());
         pmDemandReqVo.setProjectStatusList(afhttz);
         //“合同待填制”及以后的所有项目状态的项目数
-        Map<String, Object> num2 = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
+        Map<String, Object> num2 = pmDemandMapper.purchaseProjectDistributionBND(pmDemandReqVo);
         int countAfhttz = Integer.parseInt(num2.get("countNumber").toString());
         //完成率
         String wcl = getPercent(countAfhttz, countAfsh);
@@ -4751,7 +4755,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         afRwxd.add(PmProjectStatus.COMPLETION_CONSTRUCTION.getCode());
         pmDemandReqVo.setProjectStatusList(afRwxd);
         //“任务下达”后
-        Map<String, Object> num3 = pmDemandMapper.purchaseProjectDistribution(pmDemandReqVo);
+        Map<String, Object> num3 = pmDemandMapper.purchaseProjectDistributionBND(pmDemandReqVo);
         int countAfRwxd = Integer.parseInt(num3.get("countNumber").toString());
         //该项目超过90日
         Map<String, Object> num4 = pmDemandMapper.purchaseProjectConducted90Days(pmDemandReqVo);

+ 21 - 0
purchase-system/src/main/resources/mapper/pm/PmDemandMapper.xml

@@ -972,6 +972,7 @@
                 #{item}
             </foreach>
         </if>
+        AND YEAR(plan_demand_sub_time ) = YEAR(now())
     </select>
 
     <select id="purchaseProjectConducted90Days" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
@@ -981,6 +982,7 @@
         <include refid="deptListOrDemandIdAllNoAnd"/>
         AND project_status > 19
         AND DATE_ADD(task_release_time, INTERVAL 90 DAY) > NOW()
+        AND YEAR(plan_demand_sub_time ) = YEAR(now())
     </select>
 
     <select id="purchaseProjectWTB" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
@@ -999,6 +1001,7 @@
             </foreach>
         </if>
         AND plan_demand_sub_time &lt; now()
+        AND YEAR(plan_demand_sub_time ) = YEAR(now())
     </select>
 
     <select id="purchaseProjectYTB" resultType="java.util.Map"
@@ -1009,6 +1012,24 @@
         real_demand_commit_time is not null
     </select>
 
+    <select id="purchaseProjectDistributionBND" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
+            resultType="java.util.Map">
+        select ifnull(count(demand_id), 0) countNumber,ifnull(sum(evaluation), 0) evaluationTotal
+        from pm_demand
+        <include refid="deptListOrDemandIdAllNoAnd"/>
+        <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
+            AND
+        </if>
+        <if test="vo.projectStatusList!=null and vo.projectStatusList.size != 0">
+            project_status in
+            <foreach collection="vo.projectStatusList" item="item" index="index"
+                     separator="," open="(" close=")">
+                #{item}
+            </foreach>
+        </if>
+        AND YEAR(plan_demand_sub_time ) = YEAR(now())
+    </select>
+
     <!--   统计里查询全部or查询指定部门及下级超额项目-->
     <sql id="deptListOrDemandIdAll">
         WHERE