buzhanyi 2 роки тому
батько
коміт
a9a927022f

+ 20 - 16
purchase-system/src/main/java/com/ozs/pm/service/impl/PmAuditDeptRefServiceImpl.java

@@ -55,16 +55,23 @@ public class PmAuditDeptRefServiceImpl extends ServiceImpl<PmAuditDeptRefMapper,
         Long cdeptId = null;
         Long bdeptId = null;
         String deptLevel = null;
-        if (ancestors.length == 2) { //C级
-            deptLevel = "C";
-        } else if (ancestors.length == 3) { //B级
-            deptLevel = "B";
-            cdeptId = Long.valueOf(ancestors[2]);
-        } else if (ancestors.length == 4) { //A级
+        if (ancestors.length < 5) {
+            if (ancestors.length == 2) { //C级
+                deptLevel = "C";
+            } else if (ancestors.length == 3) { //B级
+                deptLevel = "B";
+                cdeptId = Long.valueOf(ancestors[2]);
+            } else if (ancestors.length == 4) { //A级
+                deptLevel = "A";
+                cdeptId = Long.valueOf(ancestors[2]);
+                bdeptId = Long.valueOf(ancestors[3]);
+            }
+        } else if (ancestors.length >= 5) {
             deptLevel = "A";
-            cdeptId = Long.valueOf(ancestors[2]);
-            bdeptId = Long.valueOf(ancestors[3]);
+            bdeptId = Long.valueOf(ancestors[ancestors.length - 1]);
+            cdeptId = Long.valueOf(ancestors[ancestors.length - 2]);
         }
+
         if (!Arrays.asList("A", "B", "C").contains(deptLevel)) {
             throw new BaseException("管理员无权限提交需求。");
         }
@@ -143,23 +150,20 @@ public class PmAuditDeptRefServiceImpl extends ServiceImpl<PmAuditDeptRefMapper,
                 }
                 SysProcurementStandard sB = sysProcurementStandardsListB.get(0);
                 refB = new PmAuditDeptRef(null, refId, refType, deptId, "B", 0, userId + "", now, userId + "", now);
-                if (sB.getState() == 0) {
-                } else {
+                if (sB.getState() == 1) {
                     //B限额了判断是否超额,不超额就自己审。超额了追加C级
                     BigDecimal maximumB = sB.getMaximum();
                     //B不超额B审
                     if (maximumB.compareTo(evaluation) == 1) {
+                        refB = new PmAuditDeptRef(null, refId, refType, deptId, "B", 0, userId + "", now, userId + "", now);
                     } else {
-                        //C不限额C审,
-                        refB = null;
-//                        refB = new PmAuditDeptRef(null, refId, refType, deptId, "B", 1, userId + "", now, userId + "", now);
+                        //C不限额C审,(B先自己审核)
+                        refB = new PmAuditDeptRef(null, refId, refType, deptId, "B", 0, userId + "", now, userId + "", now);
                         refC = new PmAuditDeptRef(null, refId, refType, cdeptId, "C", 0, userId + "", now, userId + "", now);
                         pmAuditDeptRefService.save(refC);
                     }
                 }
-                if (!ObjectUtils.isEmpty(refB)) {
-                    pmAuditDeptRefService.save(refB);
-                }
+                pmAuditDeptRefService.save(refB);
                 break;
             default:
                 //C不限额C审,