Explorar o código

本级审核后,上级才可以看到该数据并进行审核

buzhanyi hai 1 ano
pai
achega
dae37be18a

+ 12 - 14
purchase-admin/src/main/java/com/ozs/web/controller/pm/PmDemandController.java

@@ -57,15 +57,11 @@ public class PmDemandController extends BaseController {
     @PreAuthorize("@ss.hasPermi('pm:demand:list')")
     @Log(title = ModularConstans.demand, businessType = BusinessType.QUERY)
     public AjaxResult list(@RequestBody PmDemandReqVo pmDemandReqVo) {
-        Page pages = new Page();
         pmDemandReqVo.setDeptId(getDeptId());
         pmDemandReqVo.setIsAdmin(SysUser.isAdmin(getUserId()));
         pmDemandReqVo.setUserId(getUserId());
-        List<PmDemandResVo> list = pmDemandService.selectPmDemandListDe(pmDemandReqVo);
-        pages = PageUtils.getPages(pmDemandReqVo.getPageNum().intValue(), pmDemandReqVo.getPageSize().intValue(), list);
-        IPage<PmDemandResVo> results = new Page<>(pages.getCurrent(), pages.getSize(), list.size());
-        results.setRecords(pages.getRecords());
-        return success(results);
+        IPage<PmDemandResVo> page = pmDemandService.selectPmDemandList(pmDemandReqVo, 0);
+        return success(page);
 
     }
 
@@ -214,16 +210,18 @@ public class PmDemandController extends BaseController {
     @PreAuthorize("@ss.hasPermi('pm:examine:list')")
     @Log(title = ModularConstans.demandExamine, businessType = BusinessType.QUERY)
     public AjaxResult examineList(@RequestBody PmDemandReqVo pmDemandReqVo) {
+        Page pages = new Page();
+        pmDemandReqVo.setDeptId(getDeptId());
         pmDemandReqVo.setIsAdmin(SysUser.isAdmin(getUserId()));
-        //前端没有选择部门id,就默认登录人的id
-        if (!ObjectUtils.isEmpty(pmDemandReqVo.getDeptId())) {
-            pmDemandReqVo.setDeptId(pmDemandReqVo.getDeptId());
-        } else {
-            pmDemandReqVo.setDeptId(getDeptId());
-        }
         pmDemandReqVo.setUserId(getUserId());
-        IPage<PmDemandResVo> page = pmDemandService.selectPmDemandList(pmDemandReqVo, 1);
-        return success(page);
+        List<PmDemandResVo> list = pmDemandService.selectPmDemandListDe(pmDemandReqVo);
+        IPage<PmDemandResVo> results = new Page<>();
+        if (!ObjectUtils.isEmpty(list)) {
+            pages = PageUtils.getPages(pmDemandReqVo.getPageNum().intValue(), pmDemandReqVo.getPageSize().intValue(), list);
+            results = new Page<>(pages.getCurrent(), pages.getSize(), list.size());
+            results.setRecords(pages.getRecords());
+        }
+        return success(results);
     }
 
     @ApiOperation(value = "审核采购需求通过", notes = "必传demandId和上传附件,其他字段不传")

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

@@ -38,6 +38,9 @@ public interface IPmDemandService extends IService<PmDemand> {
      */
     IPage<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo, int reqType);
 
+    /**
+     * 查询采购需求列表
+     */
     List<PmDemandResVo> selectPmDemandListDe(PmDemandReqVo pmDemandReqVo);
 
 

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

@@ -684,7 +684,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
             List<PmDemandResVo> pmDemandResVos = demandChangeTo(pageRes.getRecords());
 
             for (PmDemandResVo vo : pmDemandResVos) {
-                if (Arrays.asList(1, 2).contains(reqType)) {
+                if (1 == reqType) {
                     // 根据项目id 和 部门id 和 参数类型 获取 部门级别
                     List<PmAuditDeptRef> collect = list.stream()
                             .filter(o -> o.getRefId().equals(vo.getDemandId()))
@@ -772,13 +772,17 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
     @Override
     public List<PmDemandResVo> selectPmDemandListDe(PmDemandReqVo pmDemandReqVo) {
         LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<>();
+        SysUser sysUser = userService.selectUserById(SecurityUtils.getUserId());
         List<PmAuditDeptRef> list = new ArrayList<>();
         LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
         l.eq(PmAuditDeptRef::getDeptId, SecurityUtils.getDeptId());
         l.eq(PmAuditDeptRef::getRefType, "2");
         list = pmAuditDeptRefService.list(l);
         if (!pmDemandReqVo.getIsAdmin()) {
-            lw.eq(PmDemand::getCreateBy, SecurityUtils.getUserId());
+            if (!ObjectUtils.isEmpty(list)) {
+                lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId());
+                lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toSet()));
+            }
         }
 
         if (!StringUtils.isBlank(pmDemandReqVo.getProjectName())) {
@@ -802,6 +806,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
         if (!StringUtils.isBlank(pmDemandReqVo.getEndDate())) {
             lw.apply("(plan_demand_sub_time <= '" + pmDemandReqVo.getEndDate() + "' or plan_purchase_finish_time <= '" + pmDemandReqVo.getEndDate() + "' or plan_deliver_time <=  '" + pmDemandReqVo.getEndDate() + "' )");
         }
+        lw.apply("(project_status >=8 )");
 
         lw.last(" order by project_status, plan_demand_sub_time");
         List<PmDemand> demandList = pmDemandMapper.selectList(lw);