|
@@ -2,6 +2,7 @@ package com.dayou.workflow.config;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
@@ -34,6 +35,8 @@ import java.util.stream.Collectors;
|
|
import static com.dayou.enums.FinanceInvoiceState.审核拒绝;
|
|
import static com.dayou.enums.FinanceInvoiceState.审核拒绝;
|
|
import static com.dayou.enums.FinanceInvoiceState.审核通过;
|
|
import static com.dayou.enums.FinanceInvoiceState.审核通过;
|
|
import static com.dayou.enums.GlobalConfigEnum.*;
|
|
import static com.dayou.enums.GlobalConfigEnum.*;
|
|
|
|
+import static com.dayou.enums.MainBusinessEnum.ASSET_BUSINESS;
|
|
|
|
+import static com.dayou.enums.MainBusinessEnum.MAJOR_BUSINESS;
|
|
import static com.dayou.enums.workflow.NodeLogEnum.PASS;
|
|
import static com.dayou.enums.workflow.NodeLogEnum.PASS;
|
|
import static com.dayou.enums.workflow.NodeStateEnum.*;
|
|
import static com.dayou.enums.workflow.NodeStateEnum.*;
|
|
|
|
|
|
@@ -80,6 +83,12 @@ public class WorkNodeProcessable {
|
|
@Autowired
|
|
@Autowired
|
|
private IMajorProductionAllotService majorProductionAllotService;
|
|
private IMajorProductionAllotService majorProductionAllotService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IProductionFundService productionFundService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private IOrderFundService orderFundService;
|
|
|
|
+
|
|
|
|
|
|
/**
|
|
/**
|
|
* 提交流程前置处理
|
|
* 提交流程前置处理
|
|
@@ -365,6 +374,7 @@ public class WorkNodeProcessable {
|
|
return department.getLeaderId();
|
|
return department.getLeaderId();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public void beforeEnding(WorkFlowNodeInstance currentInstanceNode){
|
|
public void beforeEnding(WorkFlowNodeInstance currentInstanceNode){
|
|
//终止前节点控制前置处理。
|
|
//终止前节点控制前置处理。
|
|
MainBusinessEnum mainBusinessEnum = MainBusinessEnum.valueOf(currentInstanceNode.getBusinessType());
|
|
MainBusinessEnum mainBusinessEnum = MainBusinessEnum.valueOf(currentInstanceNode.getBusinessType());
|
|
@@ -386,6 +396,58 @@ public class WorkNodeProcessable {
|
|
businessPerformanceDistributionService.update(new LambdaUpdateWrapper<BusinessPerformanceDistribution>()
|
|
businessPerformanceDistributionService.update(new LambdaUpdateWrapper<BusinessPerformanceDistribution>()
|
|
.set(BusinessPerformanceDistribution :: getDeleted, 1)
|
|
.set(BusinessPerformanceDistribution :: getDeleted, 1)
|
|
.eq(BusinessPerformanceDistribution::getDeclareId ,currentInstanceNode.getBusinessId()));
|
|
.eq(BusinessPerformanceDistribution::getDeclareId ,currentInstanceNode.getBusinessId()));
|
|
|
|
+ case ASSET_BUSINESS: // 资产流程终止节点前的处理
|
|
|
|
+ // 删除节点任务
|
|
|
|
+ workTaskRecordService.update(new LambdaUpdateWrapper<WorkTaskRecord>().set(BaseEntity::getDeleted, true).eq(WorkTaskRecord::getInstanceId, currentInstanceNode.getId()));
|
|
|
|
+
|
|
|
|
+ // 判断是否出具了产品,出具了产品的话需要将产品应收款改为0
|
|
|
|
+ if (ObjectUtil.isNotNull(currentInstanceNode.getBusinessSubId()) && !currentInstanceNode.getBusinessSubId().isEmpty()) {
|
|
|
|
+ // 预评
|
|
|
|
+ productionFundService.update(new LambdaUpdateWrapper<ProductionFund>()
|
|
|
|
+ .set(ProductionFund::getProductionShouldAmount, 0)
|
|
|
|
+ .eq(ProductionFund::getBusinessType, ASSET_BUSINESS.getCode())
|
|
|
|
+ .eq(ProductionFund::getBusinessId, currentInstanceNode.getBusinessId())
|
|
|
|
+ .eq(ProductionFund::getProductionNo, currentInstanceNode.getBusinessSubId())
|
|
|
|
+ .eq(BaseEntity::getDeleted, false));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(currentInstanceNode.getBusinessMinId()) && !currentInstanceNode.getBusinessMinId().isEmpty()) {
|
|
|
|
+ // 报告
|
|
|
|
+ productionFundService.update(new LambdaUpdateWrapper<ProductionFund>()
|
|
|
|
+ .set(ProductionFund::getProductionShouldAmount, 0)
|
|
|
|
+ .eq(ProductionFund::getBusinessType, ASSET_BUSINESS.getCode())
|
|
|
|
+ .eq(ProductionFund::getBusinessId, currentInstanceNode.getBusinessId())
|
|
|
|
+ .eq(ProductionFund::getProductionNo, currentInstanceNode.getBusinessMinId())
|
|
|
|
+ .eq(BaseEntity::getDeleted, false));
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case MAJOR_BUSINESS: // 大中型流程终止节点前的处理
|
|
|
|
+ // 删除节点任务
|
|
|
|
+ workTaskRecordService.update(new LambdaUpdateWrapper<WorkTaskRecord>().set(BaseEntity::getDeleted, true).eq(WorkTaskRecord::getInstanceId, currentInstanceNode.getId()));
|
|
|
|
+
|
|
|
|
+ // 判断是否出具了产品,出具了产品的话需要将产品应收款改为0
|
|
|
|
+ if (ObjectUtil.isNotNull(currentInstanceNode.getBusinessSubId()) && !currentInstanceNode.getBusinessSubId().isEmpty()) {
|
|
|
|
+ // 预评
|
|
|
|
+ productionFundService.update(new LambdaUpdateWrapper<ProductionFund>()
|
|
|
|
+ .set(ProductionFund::getProductionShouldAmount, 0)
|
|
|
|
+ .eq(ProductionFund::getBusinessType, MAJOR_BUSINESS.getCode())
|
|
|
|
+ .eq(ProductionFund::getBusinessId, currentInstanceNode.getBusinessId())
|
|
|
|
+ .eq(ProductionFund::getProductionNo, currentInstanceNode.getBusinessSubId())
|
|
|
|
+ .eq(BaseEntity::getDeleted, false));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(currentInstanceNode.getBusinessMinId()) && !currentInstanceNode.getBusinessMinId().isEmpty()) {
|
|
|
|
+ // 报告
|
|
|
|
+ productionFundService.update(new LambdaUpdateWrapper<ProductionFund>()
|
|
|
|
+ .set(ProductionFund::getProductionShouldAmount, 0)
|
|
|
|
+ .eq(ProductionFund::getBusinessType, MAJOR_BUSINESS.getCode())
|
|
|
|
+ .eq(ProductionFund::getBusinessId, currentInstanceNode.getBusinessId())
|
|
|
|
+ .eq(ProductionFund::getProductionNo, currentInstanceNode.getBusinessMinId())
|
|
|
|
+ .eq(BaseEntity::getDeleted, false));
|
|
|
|
+ }
|
|
|
|
+ break;
|
|
|
|
+ case PERSONAL_BUSINESS: // 个贷业务流程终止节点前的处理
|
|
|
|
+ // 删除节点任务
|
|
|
|
+ workTaskRecordService.update(new LambdaUpdateWrapper<WorkTaskRecord>().set(BaseEntity::getDeleted, true).eq(WorkTaskRecord::getInstanceId, currentInstanceNode.getId()));
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|