瀏覽代碼

流程相关

yzc 2 年之前
父節點
當前提交
7cae06f5d5

+ 5 - 0
hx-service-api/victoriatourist-api/src/main/java/com/fjhx/entity/purchase/Purchase.java

@@ -103,4 +103,9 @@ public class Purchase extends BaseEntity {
     @TableField(exist = false)
     private String supplierName;
 
+    /**下一节点审批人id*/
+    private Long processInstanceUserId;
+    /**下一节点审批人名称*/
+    private String processInstanceUserName;
+
 }

+ 30 - 7
hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/impl/PurchaseFlowServiceImpl.java

@@ -3,7 +3,9 @@ package com.fjhx.service.purchase.impl;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
 import com.fjhx.entity.apply.ApplyPurchase;
+import com.fjhx.entity.example.ExampleInfo;
 import com.fjhx.entity.purchase.Purchase;
+import com.fjhx.enums.ProcessNodeHandleObjectTypeEnum;
 import com.fjhx.enums.apply.ApplyPurchaseStatusEnum;
 import com.fjhx.enums.flow.FlowCodeEnum;
 import com.fjhx.enums.purchase.PurchaseStatusEnum;
@@ -14,14 +16,14 @@ import com.fjhx.service.purchase.PurchaseFlowService;
 import com.fjhx.service.purchase.PurchaseService;
 import com.fjhx.uitl.code.CodeEnum;
 import com.fjhx.uitl.flow.FlowUserUtil;
-import com.fjhx.utils.Assert;
-import com.fjhx.utils.BigDecimalUtil;
-import com.fjhx.utils.ExampleAbstract;
-import com.fjhx.utils.FlowConstructor;
+import com.fjhx.utils.*;
+import org.apache.commons.lang3.StringUtils;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.redis.lock.RedisLockClient;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.system.user.entity.User;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
@@ -170,15 +172,29 @@ public class PurchaseFlowServiceImpl implements PurchaseFlowService {
                 price = price.add(BigDecimalUtil.multiply(goods.getQuantity(), goods.getUnitPrice(), 2));
             }
             purchase.setPrice(price);
-            purchaseService.saveOrUpdate(purchase);
-            applyPurchaseService.saveOrUpdateBatch(goodsList);
+
 
             // 流程标题
             String title = AuthUtil.getUserName() + " 在" + LocalDate.now() + "日发起了 采购审批流程(单号:" + purchase.getCode() + ")";
 
             if (Func.isEmpty(purchase.getFlowId())) {
                 // 启动流程
-                flowConstructor().create(purchase.getId(), title, purchase.getFlowRemark(), purchase.getId());
+                ExampleResult exampleResult = flowConstructor().create(purchase.getId(), title, purchase.getFlowRemark(), purchase.getId());
+
+                exampleResult.after(()->{
+                    //处理下一节点处理人信息
+                    JSONObject nextNodeHandleUserInfo = new JSONObject();
+                    FlowUserUtil.getNextNodeHandleUserInfo(exampleResult, nextNodeHandleUserInfo);
+                    purchase.setFlowId(nextNodeHandleUserInfo.getLong("flowId"));
+                    purchase.setFlowApproverId(nextNodeHandleUserInfo.getLong("flowApproverId"));
+                    purchase.setFlowApproverName(nextNodeHandleUserInfo.getString("flowApproverName"));
+
+                    //下一节点处理人信息-新字段
+                    purchase.setProcessInstanceUserId(nextNodeHandleUserInfo.getLong("flowApproverId"));
+                    purchase.setProcessInstanceUserName(nextNodeHandleUserInfo.getString("flowApproverName"));
+                });
+
+
             } else {
                 // 获取当前节点对应的按钮ID
                 Long buttonId = iFlowClient.getButtonIdByExampleInfoId(purchase.getFlowId());
@@ -186,6 +202,9 @@ public class PurchaseFlowServiceImpl implements PurchaseFlowService {
                 flowConstructor().jump(purchase.getId(), buttonId, purchase.getFlowRemark(), purchase.getId());
             }
 
+            purchaseService.saveOrUpdate(purchase);
+            applyPurchaseService.saveOrUpdateBatch(goodsList);
+
             return true;
         })) {
             throw new ServiceException("当前系统繁忙,请稍后重试!");
@@ -215,6 +234,10 @@ public class PurchaseFlowServiceImpl implements PurchaseFlowService {
             entity.setFlowApproverId(nextNodeHandleUserInfo.getLong("flowApproverId"));
             entity.setFlowApproverName(nextNodeHandleUserInfo.getString("flowApproverName"));
 
+            //下一节点处理人信息-新字段
+            entity.setProcessInstanceUserId(nextNodeHandleUserInfo.getLong("flowApproverId"));
+            entity.setProcessInstanceUserName(nextNodeHandleUserInfo.getString("flowApproverName"));
+
             //修改流程信息
             purchaseService.updateById(entity);
         });

+ 2 - 2
hx-service/victoriatourist/src/main/java/com/fjhx/service/purchase/impl/PurchaseServiceImpl.java

@@ -70,8 +70,8 @@ public class PurchaseServiceImpl extends ServiceImpl<PurchaseMapper, Purchase> i
 
         IWrapper<Purchase> wrapper = IWrapper.getWrapper(condition);
 
-        wrapper.ge(Purchase::getStatus, PurchaseStatusEnum.STATUS_30.getKey())
-                .eq(Purchase::getStatus)
+//        wrapper.ge(Purchase::getStatus, PurchaseStatusEnum.STATUS_30.getKey())
+        wrapper.eq(Purchase::getStatus)
                 .apply(ObjectUtil.isNotEmpty(condition.get("keyword")), "instr(`code`, '" + condition.get("keyword") + "') > 0")
                 .orderByDesc(ApplyPurchase::getId);