hexiao hace 2 años
padre
commit
63f34de30f

+ 3 - 1
purchase-admin/src/main/java/com/ozs/web/controller/pm/PmDemandController.java

@@ -52,7 +52,9 @@ public class PmDemandController extends BaseController {
     @PreAuthorize("@ss.hasPermi('pm:demand:list')")
     @Log(title = ModularConstans.demand, businessType = BusinessType.QUERY)
     public AjaxResult list(@RequestBody PmDemandReqVo pmDemandReqVo) {
-        IPage<PmDemandResVo> page  = pmDemandService.selectPmDemandList(pmDemandReqVo,0);
+        pmDemandReqVo.setDeptId(getDeptId());
+        pmDemandReqVo.setUserId(getUserId());
+        IPage<PmDemandResVo> page = pmDemandService.selectPmDemandList(pmDemandReqVo, 0);
         return success(page);
 
     }

+ 15 - 8
purchase-system/src/main/java/com/ozs/pm/service/impl/PmDemandServiceImpl.java

@@ -383,13 +383,20 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
     @Override
     public IPage<PmDemandResVo> selectPmDemandList(PmDemandReqVo pmDemandReqVo, int reqType) {
         LambdaQueryWrapper<PmDemand> lw = new LambdaQueryWrapper<>();
-
-        LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
-        l.eq(PmAuditDeptRef::getDeptId, pmDemandReqVo.getDeptId());
-        l.eq(PmAuditDeptRef::getRefType, "2");
-        List<PmAuditDeptRef> list = pmAuditDeptRefService.list(l);
-        if (!ObjectUtils.isEmpty(list) && !pmDemandReqVo.getUserId().equals(Integer.parseInt("1"))) {
-            lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()));
+        //  4 (合同信息管理)、 0(需求单位管理) 、 5(项目建设管理)  需求单位
+        //  1(需求需求审核) 、2 (任务下达管理)      采购管理部门
+        //  3(采购执行管理)   采购办
+
+        if (Arrays.asList(1, 2, 3).contains(reqType)) {
+            LambdaQueryWrapper<PmAuditDeptRef> l = new LambdaQueryWrapper<>();
+            l.eq(PmAuditDeptRef::getDeptId, pmDemandReqVo.getDeptId());
+            l.eq(PmAuditDeptRef::getRefType, "2");
+            List<PmAuditDeptRef> list = pmAuditDeptRefService.list(l);
+            if (!ObjectUtils.isEmpty(list) && !pmDemandReqVo.getUserId().equals(Integer.parseInt("1"))) {
+                lw.in(PmDemand::getDemandId, list.stream().map(PmAuditDeptRef::getRefId).collect(Collectors.toList()));
+            }
+        } else {
+            lw.eq(PmDemand::getPurchaseDeptId, SecurityUtils.getDeptId());
         }
 
 
@@ -748,7 +755,7 @@ public class PmDemandServiceImpl extends ServiceImpl<PmDemandMapper, PmDemand> i
     @Override
     @Transactional(rollbackFor = Exception.class)
     public boolean reviewTo(PmDemandReqVo pmDemandReqVo) {
-       PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
+        PmDemand pmDemand = this.getById(pmDemandReqVo.getDemandId());
 
         PmDemand pmDemandUpdate = new PmDemand();
         pmDemandUpdate.setDemandId(pmDemand.getDemandId());