buzhanyi 1 год назад
Родитель
Сommit
01ba509fb1

+ 13 - 6
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -4682,10 +4682,12 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         List<StatisticalChartsResVo> resVos = new ArrayList<>();
         Long userId = SecurityUtils.getUserId();
         //是-1就是查询自己及子孙级以下,否则只查询指定部门
+        List<Long> demandIdAll = isQueryAll(pmDemandReqVo.getPurchaseDeptId());
+        List<Long> queryZD = isQueryZD(pmDemandReqVo.getPurchaseDeptId());
         if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
-            pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
+            pmDemandReqVo.setDeptList(demandIdAll);
         } else {
-            pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
+            pmDemandReqVo.setDemandIdAll(queryZD);
         }
         //"采购管理部门“执行率”、“规划执行率”、“完成率”、“滞后率”、“偏差率”、“流废标率”
         //(1)执行率:年度计划中已提报需求项目占比
@@ -4807,15 +4809,20 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         String pcl = getPercent((countXmWtj + countXmYtj), Math.toIntExact(planQuarter));
         //(6)流废标率,出现流废标情况的项目/审核下达采购机构实施的采购项目
         //项目状态存在过“流废标处置”的项目数/项目状态为“任务已下达”以后的状态的所有项目*100%
+        //本年度的项目
         if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
-            pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
+            pmDemandReqVo.setDeptList(demandIdAll);
         } else {
-            pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
+            pmDemandReqVo.setDemandIdAll(queryZD);
         }
-        //本年度的项目
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
         LambdaQueryWrapper<PmDemand> dmLp = new LambdaQueryWrapper<>();
-        dmLp.in(PmDemand::getDemandId, pmDemandReqVo.getDemandIdAll());
+        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());