gaodd 3 lat temu
rodzic
commit
b60d36282c

+ 46 - 69
src/main/java/com/unissoft/ventilation/service/impl/ProcessAuditServiceImpl.java

@@ -647,19 +647,33 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
647 647
         List<ProcessAudit> list = processAuditMapper.selectList(ew);
648 648
         map.put("data", list);
649 649
         
650
-        int depot = list.get(0).getDepotId();
651
-        int ongoingStep = Integer.valueOf(list.get(0).getOngoingStep());
652
-        if(list2.size()>0){
653
-        	 depot = list2.get(0).getDepotId();
654
-             ongoingStep = Integer.valueOf(list2.get(0).getOngoingStep());
655
-        }
656
-		
657
-        if(list.get(0).getResult() == 0){ //如果是多流程 则把审批数据分开
658
-        	for (ProcessAudit processAudit : list) {
659
-				if(processAudit.getResult() == 1){
660
-					list2.add(processAudit);
661
-				}
662
-			}
650
+        int depot = 0;
651
+        int ongoingStep = 0;
652
+        
653
+        if(list.get(0).getType().equals("xzjh") || list.get(0).getType().equals("xzsq")){
654
+            if(list.size()>0){
655
+            	 depot = list.get(0).getDepotId();
656
+                 ongoingStep = Integer.valueOf(list.get(0).getOngoingStep());
657
+                if(list2.size()>0){
658
+                	 depot = list2.get(0).getDepotId();
659
+                     ongoingStep = Integer.valueOf(list2.get(0).getOngoingStep());
660
+                }
661
+        		
662
+                if(list.get(0).getResult() == 0){ //如果是多流程 则把审批数据分开
663
+                	int index = 0;
664
+                	for (int i = 0; i < list.size(); i++) {
665
+                    	if(list.get(i).getResult() == 1){
666
+                    		index = i;
667
+                    		break;
668
+                    	}
669
+            		}
670
+                	for (int i = 0; i < list.size(); i++) {
671
+						if( i >= index){
672
+							list2.add(list.get(i));
673
+						}
674
+					}
675
+                }
676
+            }
663 677
         }
664 678
 
665 679
         //流程基础数据
@@ -689,64 +703,21 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
689 703
                 HashMap<String, Object> map1 = Maps.newHashMap();
690 704
                 map1.put("step", mainList.get(i));//主表数据
691 705
                 map1.put("list", subList);//子表数据
692
-                //审批人数据
693
-                if(mainList.get(i).getExistProcess().equals(0)){
694
-                	if(auditFirst){
695
-                		createAudit( mainList, list, i, map1, depot, ongoingStep);
696
-                		auditFirst = false;
697
-                	}else{
698
-                		createAudit( mainList, list2, i, map1,depot, ongoingStep);
699
-                		
700
-                	}
706
+                if(list.get(0).getType().equals("xzjh") || list.get(0).getType().equals("xzsq")){
707
+                	
708
+                    //审批人数据
709
+                    if(mainList.get(i).getExistProcess().equals(0)){
710
+                    	if(auditFirst){
711
+                    		createAudit( mainList, list, i, map1, depot, ongoingStep);
712
+                    		auditFirst = false;
713
+                    	}else{
714
+                    		createAudit( mainList, list2, i, map1,depot, ongoingStep);
715
+                    		
716
+                    	}
717
+                    }
701 718
                 }
702
-                /*if(list.get(0).getType().equals("xzjh")  mainList.get(i).getType()){
703
-            		createAudit( mainList, list, i, map1);
704
-            	}else if(list2.size()>0){
705
-            		createAudit( mainList, list2, i, map1);
706
-            	}*/
707
-                
708 719
                 process.add(map1);
709
-                /*if(list.get(0).getType().equals("xzjh") || list.get(0).getType().equals("xzsq")){
710
-                	if(mainList.get(i).getExistProcess().equals(0) && i <= Integer.valueOf(list.get(0).getOngoingStep())){//存在流程
711
-                    	QueryWrapper<ProcessBasis> ew3 = new QueryWrapper<>();
712
-                        ew3.eq("main_id", mainList.get(i).getId());
713
-                        List<ProcessBasis> basisList = processBasisMapper.selectList(ew3);
714
-                        List<ProcessBasis> pbList = processBasisService.getBasisByType(basisList.get(0).getType(), null, list.get(0).getDepotId());
715
-                        if(pbList.size()>0){
716
-                           	
717
-                           	//判断是否是通过
718
-                           	boolean flag = list.get(0).getAuditState().equals(2);
719
-                           	//保管员
720
-                   			pbList.get(0).setAuditTime(list.get(0).getApplyTime());//保管员的时间为 申请时间
721
-                   			pbList.get(0).setContent(list.get(0).getApplyPeople());//保管员为申请人
722
-                           	for (int j = 0; j < pbList.size(); j++) {
723
-                           		    if(j==0)continue;//保管员 不做处理
724
-                           		    //审批人
725
-                           		    ProcessBasis item = pbList.get(j);
726
-                           			if(j-1<=list.size()-1){
727
-                           				// 业务
728
-                           				ProcessAudit audit = list.get(j-1);
729
-                           				item.setAuditTime(audit.getAuditTime());
730
-                           				item.setContent(audit.getToPeople());
731
-                           				if(flag){//不通过
732
-                                   			if(j-1==list.size()-1){
733
-                                   				item.setAuditState(2);
734
-                                   			}else{
735
-                                   				item.setAuditState(1);
736
-                                   			}
737
-                                   		}else{
738
-                                   			item.setAuditState(audit.getAuditState());
739
-                                   		}
740
-                           				
741
-                           			}
742
-                   			}
743
-                           	if(pbList.get(1).getAuditState().equals(4) || pbList.get(1).getAuditState().equals(3)){
744
-                           		pbList.get(1).setAuditState(1);
745
-                           	}
746
-                        	map1.put("audit", pbList);
747
-                        }
748
-                    }
749
-                }*/
720
+                
750 721
             }
751 722
         }else{
752 723
         	HashMap<String, Object> map1 = Maps.newHashMap();
@@ -1541,6 +1512,12 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
1541 1512
                        			}
1542 1513
                        		}else{
1543 1514
                        			item.setAuditState(audit.getAuditState());
1515
+                       			/*if(audit.getAuditState() == null){
1516
+                       				item.setAuditState(0);
1517
+                       			}else{
1518
+                       				
1519
+                       			}*/
1520
+                       			
1544 1521
                        		}
1545 1522
                				
1546 1523
                			}