Browse Source

DeBugDeBugDeBug

buzhanyi 2 years ago
parent
commit
ff88a56323

+ 5 - 4
purchase-admin/src/main/java/com/ozs/web/controller/home/SystemHomepageController.java

@@ -7,6 +7,7 @@ import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.common.enums.BusinessType;
 import com.ozs.plan.doman.vo.responseVo.PlanQuarterResponseVo;
 import com.ozs.plan.service.PlanYearsService;
+import com.ozs.pm.doman.PmDemand;
 import com.ozs.pm.doman.vo.responseVo.PmDemandResVo;
 import com.ozs.pm.service.IPmDemandService;
 import io.swagger.annotations.ApiOperation;
@@ -164,16 +165,16 @@ public class SystemHomepageController extends BaseController {
     @GetMapping("/purchasingManagement/will/demandWaitExamine")
     @Log(title = ModularConstans.systemHome, businessType = BusinessType.QUERY)
     public AjaxResult demandWaitExamine() {
-        List<PmDemandResVo> resVos = pmDemandService.demandWaitExamine();
-        return AjaxResult.success(resVos);
+        List<PmDemand> demandList = pmDemandService.demandWaitExamine();
+        return AjaxResult.success(pmDemandService.listToVoList(demandList));
     }
 
     @ApiOperation(value = "采购管理部门首页待办事项(任务待下达)")
     @GetMapping("/purchasingManagement/will/taskWaitRelease")
     @Log(title = ModularConstans.systemHome, businessType = BusinessType.QUERY)
     public AjaxResult taskWaitRelease() {
-        List<PmDemandResVo> resVos = pmDemandService.taskWaitRelease();
-        return AjaxResult.success(resVos);
+        List<PmDemand> demandList = pmDemandService.taskWaitRelease();
+        return AjaxResult.success(pmDemandService.listToVoList(demandList));
     }
 
     @ApiOperation(value = "采购办首页待办事项(全部)")

+ 40 - 44
purchase-system/src/main/java/com/ozs/plan/service/impl/PlanYearsServiceImpl.java

@@ -852,41 +852,28 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
     public AjaxResult demandUnitWillManipulateTotalNum() {
         List<StatisticalChartsResVo> result = new ArrayList<>();
         //计划待提交,需求待提交,合同待填制,项目建设待完成
-        List<PlanQuarterResponseVo> planRes = getListByProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
-        List<PmDemandResVo> demandRes = demandService.demandWaitCommit();
-        List<PmDemandResVo> pmDemandResVos = demandService.contractWaitFilled();
-        List<PmDemandResVo> pmDemandResVos1 = demandService.projectWaitFinish();
+        Integer numByProjectStatus = getNumByProjectStatus(ProjectStatus.PLANWAITCOMMIT.getCode());
+        Integer numByStatus = demandService.getNumByStatus(PmProjectStatus.DEMAND_WAIT_COMMIT.getCode());
+        Integer numByStatus1 = demandService.getNumByStatus(PmProjectStatus.CONTRACT_WAIT_FILL.getCode());
+        Integer numByStatus2 = demandService.getNumByStatus(PmProjectStatus.UNDER_CONSTRUCTION.getCode());
         StatisticalChartsResVo chartsResVo = new StatisticalChartsResVo();
         chartsResVo.setColumnName("计划待提交");
-        if (!ObjectUtils.isEmpty(planRes)) {
-            chartsResVo.setNum(planRes.size());
-        } else {
-            chartsResVo.setNum(0);
-        }
+        chartsResVo.setNum(numByProjectStatus);
         result.add(chartsResVo);
+
         StatisticalChartsResVo chartsResVo1 = new StatisticalChartsResVo();
         chartsResVo1.setColumnName("需求待提交");
-        if (!ObjectUtils.isEmpty(demandRes)) {
-            chartsResVo1.setNum(demandRes.size());
-        } else {
-            chartsResVo1.setNum(0);
-        }
+        chartsResVo1.setNum(numByStatus);
         result.add(chartsResVo1);
+
         StatisticalChartsResVo chartsResVo2 = new StatisticalChartsResVo();
         chartsResVo2.setColumnName("合同待填制");
-        if (!ObjectUtils.isEmpty(pmDemandResVos)) {
-            chartsResVo2.setNum(pmDemandResVos.size());
-        } else {
-            chartsResVo2.setNum(0);
-        }
+        chartsResVo2.setNum(numByStatus1);
         result.add(chartsResVo2);
+
         StatisticalChartsResVo chartsResVo3 = new StatisticalChartsResVo();
         chartsResVo3.setColumnName("项目建设待完成");
-        if (!ObjectUtils.isEmpty(pmDemandResVos1)) {
-            chartsResVo3.setNum(pmDemandResVos1.size());
-        } else {
-            chartsResVo3.setNum(0);
-        }
+        chartsResVo3.setNum(numByStatus2);
         result.add(chartsResVo3);
 
         StatisticalChartsResVo chartsResVoT = new StatisticalChartsResVo();
@@ -902,8 +889,9 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         List<HomeToDoQueryResVo> homeRes = new ArrayList<>();
         //计划待审核,需求待审核,任务待下达
         List<PlanQuarterResponseVo> planRes = getListByProjectStatus(ProjectStatus.PLANWAIEXAMINE.getCode());
-        List<PmDemandResVo> demandRes = demandService.demandWaitExamine();
+        List<PmDemand> demandRes = demandService.demandWaitExamine();
         demandRes.addAll(demandService.taskWaitRelease());
+        List<PmDemandResVo> vos = demandService.listToVoList(demandRes);
         //转为首页table展示数据
         if (!ObjectUtils.isEmpty(planRes) && planRes.size() > 0) {
             for (PlanQuarterResponseVo planVo : planRes) {
@@ -913,7 +901,7 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
             }
         }
         if (!ObjectUtils.isEmpty(demandRes) && demandRes.size() > 0) {
-            for (PmDemandResVo demandResVo : demandRes) {
+            for (PmDemandResVo demandResVo : vos) {
                 HomeToDoQueryResVo home = new HomeToDoQueryResVo();
                 home.setEvaluation(BigDecimal.valueOf(demandResVo.getEvaluation()));
                 BeanUtils.copyProperties(demandResVo, home);
@@ -928,33 +916,23 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
     public AjaxResult purchasingManagementWillManipulateTotalNum() {
         List<StatisticalChartsResVo> result = new ArrayList<>();
         //计划待审核,需求待审核,任务待下达
-        List<PlanQuarterResponseVo> planRes = getListByProjectStatus(ProjectStatus.PLANWAIEXAMINE.getCode());
-        List<PmDemandResVo> demandRes = demandService.demandWaitExamine();
-        List<PmDemandResVo> demandResVos = demandService.taskWaitRelease();
+        Integer status = getNumByProjectStatus(ProjectStatus.PLANWAIEXAMINE.getCode());
+        Integer numByStatus = demandService.getNumByStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
+        Integer numByStatus1 = demandService.getNumByStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
 
         StatisticalChartsResVo chartsResVo = new StatisticalChartsResVo();
         chartsResVo.setColumnName("计划待审核");
-        if (!ObjectUtils.isEmpty(planRes)) {
-            chartsResVo.setNum(planRes.size());
-        } else {
-            chartsResVo.setNum(0);
-        }
+        chartsResVo.setNum(status);
         result.add(chartsResVo);
+
         StatisticalChartsResVo chartsResVo1 = new StatisticalChartsResVo();
         chartsResVo1.setColumnName("需求待审核");
-        if (!ObjectUtils.isEmpty(demandRes)) {
-            chartsResVo1.setNum(demandRes.size());
-        } else {
-            chartsResVo1.setNum(0);
-        }
+        chartsResVo1.setNum(numByStatus);
         result.add(chartsResVo1);
+
         StatisticalChartsResVo chartsResVo2 = new StatisticalChartsResVo();
         chartsResVo2.setColumnName("任务待下达");
-        if (!ObjectUtils.isEmpty(demandResVos)) {
-            chartsResVo2.setNum(demandResVos.size());
-        } else {
-            chartsResVo2.setNum(0);
-        }
+        chartsResVo2.setNum(numByStatus1);
         result.add(chartsResVo2);
 
         StatisticalChartsResVo chartsResVoT = new StatisticalChartsResVo();
@@ -1174,6 +1152,24 @@ public class PlanYearsServiceImpl extends ServiceImpl<PlanYearsMapper, PlanYears
         return vos;
     }
 
+    //计划待提交、计划待审核的数量
+    public Integer getNumByProjectStatus(String projectStatus) {
+        LoginUser user = SecurityUtils.getLoginUser();
+        LambdaQueryWrapper<PlanYears> yearsLp = new LambdaQueryWrapper<PlanYears>();
+        yearsLp.eq(PlanYears::getDelFlay, DataIsDelete.DataNOTDelete.getCode());
+        yearsLp.eq(PlanYears::getProjectStatus, projectStatus);
+        yearsLp.eq(PlanYears::getPurchaseDeptId, user.getDeptId());
+        Long count = planYearsMapper.selectCount(yearsLp);
+
+        LambdaQueryWrapper<PlanQuarter> quarterLp = new LambdaQueryWrapper<PlanQuarter>();
+        quarterLp.eq(PlanQuarter::getDelFlay, DataIsDelete.DataNOTDelete.getCode());
+        quarterLp.eq(PlanQuarter::getProjectStatus, projectStatus);
+        quarterLp.eq(PlanQuarter::getPurchaseDeptId, user.getDeptId());
+        Long aLong = planQuarterMapper.selectCount(quarterLp);
+        //融合一起
+        return Math.toIntExact(count) + Math.toIntExact(aLong);
+    }
+
     /**
      * 年度计划与季度数据一起
      *

+ 15 - 2
purchase-system/src/main/java/com/ozs/pm/service/IPmDemandService.java

@@ -160,14 +160,14 @@ public interface IPmDemandService extends IService<PmDemand> {
      *
      * @return
      */
-    List<PmDemandResVo> demandWaitExamine();
+    List<PmDemand> demandWaitExamine();
 
     /**
      * 采购管理部门首页待办事项(任务待下达)
      *
      * @return
      */
-    List<PmDemandResVo> taskWaitRelease();
+    List<PmDemand> taskWaitRelease();
 
     List<PmDemandResVo> purchaseDemandDocking();
 
@@ -387,4 +387,17 @@ public interface IPmDemandService extends IService<PmDemand> {
      */
     AjaxResult exceedLink(PmDemandReqVo pmDemandReqVo);
 
+    /**
+     * 查到多个状态的结果后统一进行转换
+     */
+    public List<PmDemandResVo> listToVoList(List<PmDemand> demandList);
+
+    /**
+     * 查询不同状态下的项目数据的数量
+     *
+     * @param projectStatus
+     * @return
+     */
+    public Integer getNumByStatus(String projectStatus);
+
 }

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

@@ -1805,15 +1805,13 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
     }
 
     @Override
-    public List<PmDemandResVo> demandWaitExamine() {
-        List<PmDemand> byStatus = getListByStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
-        return listToVoList(byStatus);
+    public List<PmDemand> demandWaitExamine() {
+        return getListByStatus(PmProjectStatus.DEMAND_WAIT_AUDIT.getCode());
     }
 
     @Override
-    public List<PmDemandResVo> taskWaitRelease() {
-        List<PmDemand> byStatus = getListByStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
-        return listToVoList(byStatus);
+    public List<PmDemand> taskWaitRelease() {
+        return getListByStatus(PmProjectStatus.TASK_WAIT_RELEASE.getCode());
     }
 
     @Override