gongdecai 2 năm trước cách đây
mục cha
commit
4fb19769a3

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

@@ -612,22 +612,23 @@ public class CommonUserController {
 
     @PostMapping("/test")
     public void test() throws Exception {
-        String userId = "2dbbee49f86f47c9b2ef6f7bba34b441";
-//        geTuiUtils.callPhone(userId);
-//        JSONObject jsonObject = new JSONObject();
-//        jsonObject.put("msg", "1234567");
-//        MessagePusherUtils.sendPrivateMessage(AuthSecurityUtils.getCurrentUserId(),JSONObject.toJSONString(jsonObject));
-        UnimallMessage messageDO = new UnimallMessage();
-        messageDO.setAdminId(AuthSecurityUtils.getCurrentUserId());
-        messageDO.setCustomer(AuthSecurityUtils.getCurrentUserInfo().getLoginName());
-        messageDO.setOperation("XX");
-        messageDO.setResult("XX");
-        messageDO.setGmtUpdate(new Date());
-        messageDO.setGmtCreate(new Date());
-        messageDO.setTaskId(IdGenerator.generateUUID());
-        messageDO.setCompanyId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
-        messageDO.setPath("XXXXX");
-        webSocket.sendOneMessage(messageDO);
+//        String userId = "2dbbee49f86f47c9b2ef6f7bba34b441";
+////        geTuiUtils.callPhone(userId);
+////        JSONObject jsonObject = new JSONObject();
+////        jsonObject.put("msg", "1234567");
+////        MessagePusherUtils.sendPrivateMessage(AuthSecurityUtils.getCurrentUserId(),JSONObject.toJSONString(jsonObject));
+//        UnimallMessage messageDO = new UnimallMessage();
+//        messageDO.setAdminId(AuthSecurityUtils.getCurrentUserId());
+//        messageDO.setCustomer(AuthSecurityUtils.getCurrentUserInfo().getLoginName());
+//        messageDO.setOperation("XX");
+//        messageDO.setResult("XX");
+//        messageDO.setGmtUpdate(new Date());
+//        messageDO.setGmtCreate(new Date());
+//        messageDO.setTaskId(IdGenerator.generateUUID());
+//        messageDO.setCompanyId(AuthSecurityUtils.getCurrentUserInfo().getCompId());
+//        messageDO.setPath("XXXXX");
+//        webSocket.sendOneMessage(messageDO);
+        workflowService.stopInstance("_1040331392328097792","a0685e1c3b3746448954dc9103adf479","发起人撤回");
     }
 }
 

+ 10 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/NewWorkflowController.java

@@ -271,4 +271,14 @@ public class NewWorkflowController {
     public void removeLatestWorkflow(@RequestBody Workflow workflow) {
         workflowService.removeLatestWorkflow(workflow.getId());
     }
+
+
+    /**
+     * 停止审核流
+     *
+     */
+    @PostMapping("/api/stopInstance")
+    public void stopInstance(@RequestParam String workflowId, @RequestParam String businessKey) {
+        workflowService.stopInstance(workflowId,businessKey,"发起人撤回");
+    }
 }

+ 20 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/ExpenseInfoServiceImpl.java

@@ -686,8 +686,26 @@ public class ExpenseInfoServiceImpl extends ServiceImpl<ExpenseInfoMapper, Expen
             }
             // 退回的单子 再启用
             else {
-                this.updateById(expenseInfo);
-                workflowService.activateInstance(expenseInfo.getWorkflowId(), expenseInfo.getId());
+                if("发起人撤回".equals(expenseInfo.getApproveStatus())){
+                    Workflow workflow = workflowService
+                            .findLatestWorkflowByBusinessCodeByApp(expenseInfo.getCompId(), "FEIYONGGUANLI-APPROVE");
+                    // 没配置审核流程,直接结束并处理信息
+                    if (workflow == null) {
+                        throw new YException(YExceptionEnum.PURCHASE_ORDER_ERROR);
+                    }
+                    // 开启审核流
+                    else {
+                        // 设置状态 已提交审核
+                        expenseInfo.setWorkflowId(workflow.getId());
+                        this.updateById(expenseInfo);
+                        workflowService.startInstance(workflow.getId(), expenseInfo.getId());
+                    }
+                }
+                else{
+
+                    this.updateById(expenseInfo);
+                    workflowService.activateInstance(expenseInfo.getWorkflowId(), expenseInfo.getId());
+                }
             }
 
             //  添加提交历史

+ 2 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/workflow/ExepenseListener.java

@@ -29,7 +29,7 @@ public class ExepenseListener extends AbstractWorkflowTaskListener {
         } else {
             expenseInfo.setApproveStatus(status);
         }
-        expenseInfoService.updateAllColumnById(expenseInfo);
+        expenseInfoService.updateById(expenseInfo);
     }
 
     @Override
@@ -41,7 +41,7 @@ public class ExepenseListener extends AbstractWorkflowTaskListener {
         expenseInfo.setStatusFlag(StatusEnum.PURCHASE_FAILED.getFlag());
         expenseInfo.setStatus(StatusEnum.PURCHASE_FAILED.getName());
         expenseInfo.setApproveStatus(null);
-        expenseInfoService.updateAllColumnById(expenseInfo);
+        expenseInfoService.updateById(expenseInfo);
 
     }