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