Przeglądaj źródła

统计分析六个指标

buzhanyi 1 rok temu
rodzic
commit
a376e13fcd

+ 17 - 11
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -4612,7 +4612,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         double d2 = y * 1.0;
         // 设置保留几位小数, “.”后面几个零就保留几位小数,这里设置保留2位小数
         DecimalFormat decimalFormat = new DecimalFormat("##.00%");
-        if (d1 == 0) {
+        if (d1 == 0 || d2 == 0) {
             return "0.00%";
         }
         return decimalFormat.format(d1 / d2);
@@ -4817,18 +4817,24 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         }
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
         LambdaQueryWrapper<PmDemand> dmLp = new LambdaQueryWrapper<>();
-        if (pmDemandReqVo.getDemandIdAll().size() > 0) {
-            dmLp.in(PmDemand::getDemandId, queryZD);
+
+        String lfbl = "";
+        if (ObjectUtils.isEmpty(pmDemandReqVo.getDeptList()) && ObjectUtils.isEmpty(pmDemandReqVo.getDemandIdAll())) {
+            lfbl = "0.00%";
         } else {
-            dmLp.in(PmDemand::getPurchaseDeptId, demandIdAll);
-        }
+            if (pmDemandReqVo.getDemandIdAll().size() > 0) {
+                dmLp.in(PmDemand::getDemandId, queryZD);
+            } else {
+                dmLp.in(PmDemand::getPurchaseDeptId, demandIdAll);
+            }
 
-        dmLp.gt(PmDemand::getPlanDemandSubTime, sdf.format(new Date()) + "-01-01 00:00:00");
-        List<PmDemand> demandList = pmDemandMapper.selectList(dmLp);
-        List<Long> deIds = demandList.stream().map(PmDemand::getDemandId).collect(Collectors.toList());
-        //出现流废标情况的项目
-        List<PmBidFailureHis> failureHis = pmBidFailureHisService.listByIds(deIds);
-        String lfbl = getPercent(failureHis.size(), countAfRwxd);
+            dmLp.gt(PmDemand::getPlanDemandSubTime, sdf.format(new Date()) + "-01-01 00:00:00");
+            List<PmDemand> demandList = pmDemandMapper.selectList(dmLp);
+            List<Long> deIds = demandList.stream().map(PmDemand::getDemandId).collect(Collectors.toList());
+            //出现流废标情况的项目
+            List<PmBidFailureHis> failureHis = pmBidFailureHisService.listByIds(deIds);
+            lfbl = getPercent(failureHis.size(), countAfRwxd);
+        }
 
         Map<String, String> result = new HashMap<>();
         result.put("zxl", zxl);

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

@@ -979,8 +979,8 @@
             resultType="java.util.Map">
         select ifnull(count(demand_id), 0) countNumber
         from pm_demand
-        <include refid="deptListOrDemandIdAllNoAnd"/>
-        AND project_status > 19
+        <include refid="deptListOrDemandIdAll"/>
+        project_status > 19
         AND DATE_ADD(task_release_time, INTERVAL 90 DAY) > NOW()
         AND YEAR(plan_demand_sub_time ) = YEAR(now())
     </select>