buzhanyi 2 years ago
parent
commit
8c3a4b12cd

+ 13 - 0
purchase-admin/src/main/java/com/ozs/web/controller/statisticalAnalysis/AnalysisController.java

@@ -69,6 +69,19 @@ public class AnalysisController extends BaseController {
         return AjaxResult.success(pmDemandService.countByProjectAttr(pmDemandReqVo));
     }
 
+    @ApiOperation(value = "任务属性分布")
+    @PostMapping("/countByTaskAttr")
+    //@PreAuthorize("@ss.hasPermi('statistical:countByProjectAttr')")
+    @Log(title = ModularConstans.statisticalAnalysis, businessType = BusinessType.QUERY)
+    public AjaxResult countByTaskAttr(@RequestBody PmDemandReqVo pmDemandReqVo) {
+        //按照项目属性统计所有的项目
+        if (StringUtils.isNull(pmDemandReqVo.getPurchaseDeptId())) {
+            return error("登录账号的单位 不能为空!");
+        }
+
+        return AjaxResult.success(pmDemandService.countByTaskAttr(pmDemandReqVo));
+    }
+
     @ApiOperation(value = "需采转化情况统计")
     @PostMapping("/countByPurchaseChange")
     //@PreAuthorize("@ss.hasPermi('statistical:countByPurchaseChange')")

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

@@ -76,6 +76,13 @@ public interface PmDemandMapper extends BaseMapper<PmDemand> {
      */
     StatisticalChartsResVo countByProjectAttr(@Param("vo") PmDemandReqVo pmDemandReqVo);
 
+    /**
+     * 按照项目属性统计所有的项目(“任务待下达”)
+     *
+     * @return
+     */
+    StatisticalChartsResVo countByTaskAttr(@Param("vo") PmDemandReqVo pmDemandReqVo);
+
     /**
      * 按照采购方式统计所有的项目
      *

+ 8 - 0
purchase-system/src/main/java/com/ozs/pm/service/IPmDemandService.java

@@ -218,6 +218,14 @@ public interface IPmDemandService extends IService<PmDemand> {
      */
     List<StatisticalChartsResVo> countByProjectAttr(PmDemandReqVo pmDemandReqVo);
 
+    /**
+     * 统计分析-按照项目属性统计所有的项目(任务待下达)
+     *
+     * @param
+     * @return
+     */
+    List<StatisticalChartsResVo> countByTaskAttr(PmDemandReqVo pmDemandReqVo);
+
     /**
      * 统计分析-按照采购方式统计所有的项目
      *

+ 41 - 0
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -2057,6 +2057,41 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         return resVos;
     }
 
+    @Override
+    public List<StatisticalChartsResVo> countByTaskAttr(PmDemandReqVo pmDemandReqVo) {
+        //是-1就是查询自己及子孙级以下,否则只查询指定部门
+        if (pmDemandReqVo.getPurchaseDeptId().equals(-1)) {
+            pmDemandReqVo.setDeptList(isQueryAll(pmDemandReqVo.getPurchaseDeptId()));
+        } else {
+            pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
+        }
+        //状态为“任务待下达”以后的数据
+        pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
+        List<StatisticalChartsResVo> resVos = new ArrayList<>();
+        //重点采购项目
+        pmDemandReqVo.setProjectAttr(ProjectAttribute.emergency.getCode());
+        StatisticalChartsResVo vo1 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
+        vo1.setColumnName("重点采购项目");
+        resVos.add(vo1);
+        //重大规划任务项目
+        pmDemandReqVo.setProjectAttr(ProjectAttribute.majorPlan.getCode());
+        StatisticalChartsResVo vo2 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
+        vo2.setColumnName("重大规划任务项目");
+        resVos.add(vo2);
+        //规划任务项目
+        pmDemandReqVo.setProjectAttr(ProjectAttribute.plan.getCode());
+        StatisticalChartsResVo vo3 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
+        vo3.setColumnName("规划任务项目");
+        resVos.add(vo3);
+        //一般采购项目
+        pmDemandReqVo.setProjectAttr(ProjectAttribute.commonly.getCode());
+        StatisticalChartsResVo vo4 = pmDemandMapper.countByTaskAttr(pmDemandReqVo);
+        vo4.setColumnName("一般采购项目");
+        resVos.add(vo4);
+
+        return resVos;
+    }
+
     @Override
     public List<StatisticalChartsResVo> countByPurchaseMode(PmDemandReqVo pmDemandReqVo) {
         //是-1就是查询自己及子孙级以下,否则只查询指定部门
@@ -2065,6 +2100,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         } else {
             pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
         }
+        //状态为“任务待下达”以后的数据
+        pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
         List<StatisticalChartsResVo> resVos = new ArrayList<>();
         //公开招标
         pmDemandReqVo.setPurchaseMode(ProcurementMethodSuggest.OPEN_BIDDING.getCode());
@@ -2103,6 +2140,8 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         } else {
             pmDemandReqVo.setDemandIdAll(isQueryZD(pmDemandReqVo.getPurchaseDeptId()));
         }
+        //状态为“任务待下达”以后的数据
+        pmDemandReqVo.setProjectStatus(Long.valueOf(PmProjectStatus.TASK_WAIT_RELEASE.getCode()));
         List<StatisticalChartsResVo> resVos = new ArrayList<>();
         //概算金额包括:100万以下采购任务、100至500万元采购任务、500至1000万元采购任务、1000至5000万元采购任务、5000至1亿元采购任务、1亿元及以上采购任务
         pmDemandReqVo.setEvaluation(100);
@@ -3949,6 +3988,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
     }
 
     //数据转换
+    @Override
     public List<PmDemandResVo> listToVoList(List<PmDemand> demandList) {
         List<PmDemandResVo> pmDemandResponseVoList = new ArrayList<>();
         if (!ObjectUtils.isEmpty(demandList) && demandList.size() > 0) {
@@ -3958,6 +3998,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
     }
 
     //查询不同状态下的项目数据的数量
+    @Override
     public Integer getNumByStatus(String projectStatus) {
         LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<PmDemand>();
         //  4 (合同信息管理)、 0(需求单位管理) 、 5(项目建设管理)  需求单位

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

@@ -97,6 +97,15 @@
         find_in_set(#{vo.projectAttr},project_attr)
     </select>
 
+    <select id="countByTaskAttr" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
+            resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
+        SELECT project_attr columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
+        FROM `pm_demand`
+        <include refid="deptListOrDemandIdAll"/>
+        find_in_set(#{vo.projectAttr},project_attr)
+        AND project_status &gt; #{vo.projectStatus}
+    </select>
+
     <select id="countByPurchaseMode" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
             resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
         SELECT purchase_mode columnName, ifnull(COUNT(demand_id), 0) num, ifnull(sum(evaluation), 0) evaluationTotal
@@ -104,7 +113,8 @@
         <if test="(vo.deptList != null and vo.deptList.size != 0) or (vo.demandIdAll != null and vo.demandIdAll.size != 0)">
             <include refid="deptListOrDemandIdAll"/>
         </if>
-         purchase_mode=#{vo.purchaseMode}
+        purchase_mode=#{vo.purchaseMode}
+        AND project_status &gt; #{vo.projectStatus}
     </select>
 
     <select id="countByEvaluationLt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
@@ -113,6 +123,7 @@
         FROM `pm_demand`
         <include refid="deptListOrDemandIdAll"/>
         evaluation &lt; #{vo.evaluation}
+        AND project_status &gt; #{vo.projectStatus}
     </select>
 
     <select id="countByEvaluationBet" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
@@ -121,6 +132,7 @@
         FROM `pm_demand`
         <include refid="deptListOrDemandIdAll"/>
         evaluation BETWEEN #{vo.evaluation} and #{vo.evaluationEnd}
+        AND project_status &gt; #{vo.projectStatus}
     </select>
     <select id="countByEvaluationGt" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"
             resultType="com.ozs.pm.doman.vo.responseVo.StatisticalChartsResVo">
@@ -128,6 +140,7 @@
         FROM `pm_demand`
         <include refid="deptListOrDemandIdAll"/>
         evaluation &gt; #{vo.evaluation}
+        AND project_status &gt; #{vo.projectStatus}
     </select>
 
     <select id="countProjectExceedThisYear" parameterType="com.ozs.pm.doman.vo.requestVo.PmDemandReqVo"