gaodd преди 3 години
родител
ревизия
bc53475e25
променени са 1 файла, в които са добавени 76 реда и са изтрити 5 реда
  1. 76 5
      src/main/java/com/unissoft/ventilation/service/impl/ProcessAuditServiceImpl.java

+ 76 - 5
src/main/java/com/unissoft/ventilation/service/impl/ProcessAuditServiceImpl.java

@@ -638,13 +638,29 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
638 638
     public Map<String, Object> getDataByProcessId(String processId) {
639 639
         // TODO Auto-generated method  stub
640 640
         HashMap<String, Object> map = Maps.newHashMap();
641
-
641
+       
642
+        List<ProcessAudit> list2 = new ArrayList<ProcessAudit>();
642 643
 
643 644
         //根据唯一的流程标识 获取该流程下的所有数据
644 645
         QueryWrapper<ProcessAudit> ew = new QueryWrapper<>();
645 646
         ew.eq("process_id", processId);
646 647
         List<ProcessAudit> list = processAuditMapper.selectList(ew);
647 648
         map.put("data", list);
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
+			}
663
+        }
648 664
 
649 665
         //流程基础数据
650 666
         List<Map<String, Object>> process = new ArrayList<>();
@@ -655,6 +671,7 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
655 671
         	ew1.eq("type", list.get(0).getType());
656 672
         }
657 673
         
674
+        boolean auditFirst = true; 
658 675
         List<ProcessMain> mainList = processMainMapper.selectList(ew1);
659 676
         if(mainList.size()>0){
660 677
         	for (int i = 0; i < mainList.size(); i++) {
@@ -673,7 +690,23 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
673 690
                 map1.put("step", mainList.get(i));//主表数据
674 691
                 map1.put("list", subList);//子表数据
675 692
                 //审批人数据
676
-                if(list.get(0).getType().equals("xzjh") || list.get(0).getType().equals("xzsq")){
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
+                	}
701
+                }
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
+                process.add(map1);
709
+                /*if(list.get(0).getType().equals("xzjh") || list.get(0).getType().equals("xzsq")){
677 710
                 	if(mainList.get(i).getExistProcess().equals(0) && i <= Integer.valueOf(list.get(0).getOngoingStep())){//存在流程
678 711
                     	QueryWrapper<ProcessBasis> ew3 = new QueryWrapper<>();
679 712
                         ew3.eq("main_id", mainList.get(i).getId());
@@ -713,9 +746,7 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
713 746
                         	map1.put("audit", pbList);
714 747
                         }
715 748
                     }
716
-                }
717
-                
718
-                process.add(map1);
749
+                }*/
719 750
             }
720 751
         }else{
721 752
         	HashMap<String, Object> map1 = Maps.newHashMap();
@@ -1480,4 +1511,44 @@ public class ProcessAuditServiceImpl extends ServiceImpl<ProcessAuditMapper, Pro
1480 1511
     public List<ProcessAudit> getCurrentMonthData() {
1481 1512
         return processAuditMapper.getCurrentMonthData();
1482 1513
     }
1514
+    
1515
+    public void createAudit(List<ProcessMain> mainList,List<ProcessAudit> list,int i,HashMap<String, Object> map1,int depot,int ongoingStep) {
1516
+        	QueryWrapper<ProcessBasis> ew3 = new QueryWrapper<>();
1517
+            ew3.eq("main_id", mainList.get(i).getId());
1518
+            List<ProcessBasis> basisList = processBasisMapper.selectList(ew3);
1519
+            List<ProcessBasis> pbList = processBasisService.getBasisByType(basisList.get(0).getType(), null, depot);
1520
+            if(pbList.size()>0 && i <= Integer.valueOf(ongoingStep) && list.size()>0){
1521
+               	
1522
+               	//判断是否是通过
1523
+               	boolean flag = list.get(0).getAuditState().equals(2);
1524
+               	//保管员
1525
+       			pbList.get(0).setAuditTime(list.get(0).getApplyTime());//保管员的时间为 申请时间
1526
+       			pbList.get(0).setContent(list.get(0).getApplyPeople());//保管员为申请人
1527
+               	for (int j = 0; j < pbList.size(); j++) {
1528
+               		    if(j==0)continue;//保管员 不做处理
1529
+               		    //审批人
1530
+               		    ProcessBasis item = pbList.get(j);
1531
+               			if(j-1<=list.size()-1){
1532
+               				// 业务
1533
+               				ProcessAudit audit = list.get(j-1);
1534
+               				item.setAuditTime(audit.getAuditTime());
1535
+               				item.setContent(audit.getToPeople());
1536
+               				if(flag){//不通过
1537
+                       			if(j-1==list.size()-1){
1538
+                       				item.setAuditState(2);
1539
+                       			}else{
1540
+                       				item.setAuditState(1);
1541
+                       			}
1542
+                       		}else{
1543
+                       			item.setAuditState(audit.getAuditState());
1544
+                       		}
1545
+               				
1546
+               			}
1547
+       			}
1548
+               	if(pbList.get(1).getAuditState().equals(4) || pbList.get(1).getAuditState().equals(3)){
1549
+               		pbList.get(1).setAuditState(1);
1550
+               	}
1551
+            }
1552
+            map1.put("audit", pbList);
1553
+	}
1483 1554
 }