gongdecai 2 سال پیش
والد
کامیت
ee49f37b39

+ 146 - 25
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/CommonUserController.java

@@ -36,6 +36,7 @@ import com.yh.saas.toolkit.workflow.service.IWorkflowHistoryService;
 import org.activiti.engine.impl.util.CollectionUtil;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
@@ -48,6 +49,7 @@ import java.util.List;
 import com.alibaba.fastjson.JSON;
 
 import java.net.URLEncoder;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -181,43 +183,161 @@ public class CommonUserController {
      * @return
      */
     @GetMapping("/getHis")
-    public List<NewWorkflowStep> getHis(String businessKey, String workflowId) throws ServiceException {
+    public List<NewWorkflowStep> getHis(String businessKey, String workflowId, String branch) throws ServiceException {
         List<WorkflowHistoricTask> workflowHistoricTasks = workflowHistoryService.getInstanceHistories(businessKey);
+        if(!CollectionUtils.isEmpty(workflowHistoricTasks)){
+            List<WorkflowHistoricTask> workflowHistoricTasks1 = new ArrayList<>(workflowHistoricTasks);
+            Date time = null;
+            for(int i=0;i<workflowHistoricTasks.size();i++){
+                for(int x=0;x<workflowHistoricTasks1.size();x++){
+                    if(workflowHistoricTasks.get(i).getTaskName().equals(workflowHistoricTasks.get(x).getTaskName())
+                    &&workflowHistoricTasks.get(i).getClaimTime().before(workflowHistoricTasks.get(x).getClaimTime())){
+                        time = workflowHistoricTasks.get(x).getClaimTime();
+                        break;
+                    }
+
+                }
+
+                }
+            if(time != null){
+                for(int i=0;i<workflowHistoricTasks.size();i++){
+                    if(workflowHistoricTasks.get(i).getClaimTime().before(time)){
+                        workflowHistoricTasks.remove(i);
+                    }
+                }
+            }
+//            List<Boolean> idList=workflowHistoricTasks.stream().map(WorkflowHistoricTask::getApproved).collect(Collectors.toList());
+//            if(idList.contains(false)){
+//                for(int i=0;i<workflowHistoricTasks.size();i++){
+//
+//                }
+//            }
+
+
+        }
         Workflow workflow = workflowService.getWorkflowDetail(workflowId);
         List<NewWorkflowStep> newWorkflowSteps = new ArrayList<>();
         if (workflow != null) {
-            Collections.reverse(workflowHistoricTasks);
             List<WorkflowStep> workflowSteps = workflow.getSteps();
+            int flag = 0;
+            int biaoshi = 0;
             for (int i = 0; i < workflowSteps.size(); i++) {
-                NewWorkflowStep newWorkflowStep = new NewWorkflowStep();
-                BeanUtils.copyProperties(workflowSteps.get(i), newWorkflowStep);
-                if("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))){
-                    newWorkflowStep.setCountersignType("ALL");
-                }
-                List<WorkflowHistoricTask> workflowHistoricTasks1 = new ArrayList<>();
-                for (int k = 0; k < workflowHistoricTasks.size(); k++) {
-                    if (newWorkflowStep.getDesc().equals(workflowHistoricTasks.get(k).getTaskName())) {
-                        workflowHistoricTasks1.add(workflowHistoricTasks.get(k));
+                if (!StringUtils.isEmpty(branch)) {
+                    if (!StringUtils.isEmpty(workflowSteps.get(i).getBranchExpression())&&workflowSteps.get(i).getBranchExpression().contains(branch)) {
+                        if (flag == 0) {
+
+                            workflowSteps.get(i + 1).setBranchExpression(workflowSteps.get(i).getBranchExpression());
+
+                            NewWorkflowStep newWorkflowStep = new NewWorkflowStep();
+                            BeanUtils.copyProperties(workflowSteps.get(i), newWorkflowStep);
+                            if ("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))) {
+                                newWorkflowStep.setCountersignType("ALL");
+                            }
+                            List<WorkflowHistoricTask> workflowHistoricTasks1 = new ArrayList<>();
+                            for (int k = 0; k < workflowHistoricTasks.size(); k++) {
+                                if (newWorkflowStep.getDesc().equals(workflowHistoricTasks.get(k).getTaskName())) {
+                                    workflowHistoricTasks1.add(workflowHistoricTasks.get(k));
+                                }
+
+                            }
+                            newWorkflowStep.setWorkflowHistoricTasks(workflowHistoricTasks1);
+
+
+                            List<CommonStaff> commonStaffs = new ArrayList<>();
+                            if ("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))) {
+                                String aduit = workflowSteps.get(i).getAuditUsers();
+                                String[] aduits = aduit.split(",");
+                                for (int k = 0; k < aduits.length; k++) {
+                                    CommonStaff commonStaff = staffService.selectById(aduits[k]);
+                                    if (commonStaff != null) {
+                                        commonStaffs.add(commonStaff);
+                                    }
+
+                                }
+                                newWorkflowStep.setCommonStaffs(commonStaffs);
+                            }
+                            newWorkflowSteps.add(newWorkflowStep);
+                        }
+                        if (!StringUtils.isEmpty(workflowSteps.get(i).getBranchExpression())
+                                &&workflowSteps.get(i).getBranchExpression().contains(branch)
+                               &&workflowSteps.get(i).getBranchNodeLocation()!=null
+                                &&"END".equals(workflowSteps.get(i).getBranchNodeLocation().name())) {
+                            flag = 1;
+                        }
+
                     }
+                    if ("zt".equals(branch)) {
+                        if ("BEGIN".equals(workflowSteps.get(i).getBranchNodeLocation()) && StringUtils.isEmpty(workflowSteps.get(i).getBranchExpression())) {
+                            biaoshi = 1;
+                        }
+                        if(biaoshi ==1){
+                            NewWorkflowStep newWorkflowStep = new NewWorkflowStep();
+                            BeanUtils.copyProperties(workflowSteps.get(i), newWorkflowStep);
+                            if ("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))) {
+                                newWorkflowStep.setCountersignType("ALL");
+                            }
+                            List<WorkflowHistoricTask> workflowHistoricTasks1 = new ArrayList<>();
+                            for (int k = 0; k < workflowHistoricTasks.size(); k++) {
+                                if (newWorkflowStep.getDesc().equals(workflowHistoricTasks.get(k).getTaskName())) {
+                                    workflowHistoricTasks1.add(workflowHistoricTasks.get(k));
+                                }
+
+                            }
+                            newWorkflowStep.setWorkflowHistoricTasks(workflowHistoricTasks1);
+
+
+                            List<CommonStaff> commonStaffs = new ArrayList<>();
+                            if ("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))) {
+                                String aduit = workflowSteps.get(i).getAuditUsers();
+                                String[] aduits = aduit.split(",");
+                                for (int k = 0; k < aduits.length; k++) {
+                                    CommonStaff commonStaff = staffService.selectById(aduits[k]);
+                                    if (commonStaff != null) {
+                                        commonStaffs.add(commonStaff);
+                                    }
+
+                                }
+                                newWorkflowStep.setCommonStaffs(commonStaffs);
+                            }
+                            newWorkflowSteps.add(newWorkflowStep);
+                        }
 
-                }
-                newWorkflowStep.setWorkflowHistoricTasks(workflowHistoricTasks1);
+                        if("END".equals(workflowSteps.get(i).getBranchNodeLocation().name()) && StringUtils.isEmpty(workflowSteps.get(i).getBranchExpression())){
+                            biaoshi = 1;
+                        }
+                    }
+                } else {
+                    NewWorkflowStep newWorkflowStep = new NewWorkflowStep();
+                    BeanUtils.copyProperties(workflowSteps.get(i), newWorkflowStep);
+                    if ("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))) {
+                        newWorkflowStep.setCountersignType("ALL");
+                    }
+                    List<WorkflowHistoricTask> workflowHistoricTasks1 = new ArrayList<>();
+                    for (int k = 0; k < workflowHistoricTasks.size(); k++) {
+                        if (newWorkflowStep.getDesc().equals(workflowHistoricTasks.get(k).getTaskName())) {
+                            workflowHistoricTasks1.add(workflowHistoricTasks.get(k));
+                        }
+
+                    }
+                    newWorkflowStep.setWorkflowHistoricTasks(workflowHistoricTasks1);
 
 
-                List<CommonStaff> commonStaffs = new ArrayList<>();
-                if ("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))) {
-                    String aduit = workflowSteps.get(i).getAuditUsers();
-                    String[] aduits = aduit.split(",");
-                    for (int k = 0; k < aduits.length; k++) {
-                        CommonStaff commonStaff = staffService.selectById(aduits[k]);
-                        if (commonStaff != null) {
-                            commonStaffs.add(commonStaff);
-                        }
+                    List<CommonStaff> commonStaffs = new ArrayList<>();
+                    if ("ALL".equals(String.valueOf(workflowSteps.get(i).getCountersignType()))) {
+                        String aduit = workflowSteps.get(i).getAuditUsers();
+                        String[] aduits = aduit.split(",");
+                        for (int k = 0; k < aduits.length; k++) {
+                            CommonStaff commonStaff = staffService.selectById(aduits[k]);
+                            if (commonStaff != null) {
+                                commonStaffs.add(commonStaff);
+                            }
 
+                        }
+                        newWorkflowStep.setCommonStaffs(commonStaffs);
                     }
-                    newWorkflowStep.setCommonStaffs(commonStaffs);
+                    newWorkflowSteps.add(newWorkflowStep);
                 }
-                newWorkflowSteps.add(newWorkflowStep);
+
             }
 
         }
@@ -386,6 +506,7 @@ public class CommonUserController {
     public Page<NoticeTaskInfo> findHisPageNoticeTasks(NoticeTaskInfo noticeTask) {
         return commonUserService.findHisPageNoticeTasks(noticeTask);
     }
+
     /**
      * 查询任务
      *
@@ -470,7 +591,7 @@ public class CommonUserController {
     @PostMapping("/test")
     public void test() throws Exception {
         String userId = "2dbbee49f86f47c9b2ef6f7bba34b441";
-        geTuiUtils.callPhone(userId);
+//        geTuiUtils.callPhone(userId);
 //        JSONObject jsonObject = new JSONObject();
 //        jsonObject.put("msg", "1234567");
 //        MessagePusherUtils.sendPrivateMessage(AuthSecurityUtils.getCurrentUserId(),JSONObject.toJSONString(jsonObject));

+ 7 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/AcquisitionCheckList.java

@@ -53,7 +53,13 @@ public class AcquisitionCheckList implements IWorkflowTaskChecklist<PurchasePric
             WarehouseBaseInfo warehouseBaseInfo = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
                     .eq("warehouse_name",purchasePrice.getWarehouseName())
                     .eq("comp_id",purchasePrice.getCompId()));
-            variableMap.put("jointVentureParties", warehouseBaseInfo.getJointVentureParties());
+            if(warehouseBaseInfo == null){
+                variableMap.put("jointVentureParties", "中天");
+            }
+            else{
+
+                variableMap.put("jointVentureParties", warehouseBaseInfo.getJointVentureParties());
+            }
         }
         return variableMap;
     }

+ 7 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/ExepenseList.java

@@ -50,7 +50,13 @@ public class ExepenseList implements IWorkflowTaskChecklist<ExpenseInfo> {
             WarehouseBaseInfo warehouseBaseInfo = warehouseBaseInfoService.selectOne(new EntityWrapper<WarehouseBaseInfo>()
                     .eq("warehouse_name",expenseInfo.getWarehouseName())
                     .eq("comp_id",expenseInfo.getCompId()));
-            variableMap.put("jointVentureParties", warehouseBaseInfo.getJointVentureParties());
+            if(warehouseBaseInfo == null){
+                variableMap.put("jointVentureParties", "中天");
+            }
+            else{
+
+                variableMap.put("jointVentureParties", warehouseBaseInfo.getJointVentureParties());
+            }
         }
         return variableMap;
     }

+ 6 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/TranSettlementReportCheckList.java

@@ -42,7 +42,12 @@ public class TranSettlementReportCheckList implements IWorkflowTaskChecklist<Bat
         ContractManagementInfo contractManagementInfo = contractManagementInfoService.selectOne(new EntityWrapper<ContractManagementInfo>()
                 .eq("contract_no",tranSettlementReport.getContractNo()));
         Map<String, Object> variableMap = new HashMap<>();
-        variableMap.put("jointVentureParties", contractManagementInfo.getJointVentureParties());
+        if(contractManagementInfo != null){
+            variableMap.put("jointVentureParties", contractManagementInfo.getJointVentureParties());
+        }
+        else{
+            variableMap.put("jointVentureParties", "中天");
+        }
         return variableMap;
     }
 }