feat:代码合并、流程回调监听
This commit is contained in:
24
pom.xml
24
pom.xml
@@ -16,13 +16,13 @@
|
||||
<url>https://github.com/YunaiV/ruoyi-vue-pro</url>
|
||||
|
||||
<properties>
|
||||
<revision>3.0.41</revision>
|
||||
<business.supply.version>3.0.41</business.supply.version>
|
||||
<business.base.version>3.0.41</business.base.version>
|
||||
<business.logistic.version>3.0.41</business.logistic.version>
|
||||
<business.manage.version>3.0.41</business.manage.version>
|
||||
<revision>3.0.42</revision>
|
||||
<business.supply.version>3.0.42</business.supply.version>
|
||||
<business.base.version>3.0.42</business.base.version>
|
||||
<business.logistic.version>3.0.42</business.logistic.version>
|
||||
<business.manage.version>3.0.42</business.manage.version>
|
||||
<business.qms.version>3.0.42</business.qms.version>
|
||||
<business.mes.version>3.0.41</business.mes.version>
|
||||
<business.mes.version>3.0.42</business.mes.version>
|
||||
<!-- Maven 相关 -->
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
@@ -195,7 +195,7 @@
|
||||
<name>中铜 ZStack 私服</name>
|
||||
<url>http://172.16.46.63:30708/repository/test/</url>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
</repository>
|
||||
</repositories>
|
||||
@@ -244,12 +244,12 @@
|
||||
<id>env-local</id>
|
||||
<properties>
|
||||
<env.name>local</env.name>
|
||||
<!-- <config.server-addr>localhost:8848</config.server-addr>-->
|
||||
<config.server-addr>172.16.46.63:30848</config.server-addr>
|
||||
<config.namespace>local</config.namespace>
|
||||
<config.server-addr>localhost:8848</config.server-addr>
|
||||
<!-- <config.server-addr>172.16.46.63:30848</config.server-addr>-->
|
||||
<config.namespace>zgty-qms-local</config.namespace>
|
||||
<config.group>DEFAULT_GROUP</config.group>
|
||||
<config.username/>
|
||||
<config.password/>
|
||||
<config.username>qms</config.username>
|
||||
<config.password>1234567890</config.password>
|
||||
<config.version>1.0.0</config.version>
|
||||
</properties>
|
||||
</profile>
|
||||
|
||||
@@ -38,6 +38,11 @@
|
||||
<artifactId>zt-module-capital-api</artifactId>
|
||||
<version>${business.supply.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-module-product-api</artifactId>
|
||||
<version>${business.mes.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zt.plat</groupId>
|
||||
<artifactId>zt-module-qms-api</artifactId>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.zt.plat.module.bpm.framework.rpc.config;
|
||||
|
||||
import com.zt.plat.module.capital.api.AmountCreditApplyApi;
|
||||
import com.zt.plat.module.capital.api.splyAmountRequest.AmountRequestApi;
|
||||
import com.zt.plat.module.capital.api.splyAmtCrdtAppl.AmountCreditApplyApi;
|
||||
import com.zt.plat.module.product.api.MesProcessRoutApi;
|
||||
import com.zt.plat.module.product.api.plan.MesCompanyPlanApi;
|
||||
import com.zt.plat.module.product.api.plan.MesFactoryPlanApi;
|
||||
import com.zt.plat.module.system.api.dept.DeptApi;
|
||||
import com.zt.plat.module.system.api.dept.PostApi;
|
||||
import com.zt.plat.module.system.api.dict.DictDataApi;
|
||||
@@ -13,6 +17,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration(value = "bpmRpcConfiguration", proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = {RoleApi.class, DeptApi.class, PostApi.class, AdminUserApi.class, SmsSendApi.class, DictDataApi.class,
|
||||
PermissionApi.class, AmountCreditApplyApi.class})
|
||||
PermissionApi.class, AmountCreditApplyApi.class, MesProcessRoutApi.class, MesFactoryPlanApi.class, MesCompanyPlanApi.class, AmountRequestApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.zt.plat.module.bpm.service.qms.listener;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.qms.api.task.QmsApi;
|
||||
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
|
||||
import com.zt.plat.module.qms.enums.ErrorCodeConstants;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.delegate.DelegateExecution;
|
||||
import org.flowable.engine.delegate.JavaDelegate;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
|
||||
|
||||
/**
|
||||
* QMS模块执行监听
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class QmsExecutionListener implements JavaDelegate {
|
||||
|
||||
@Autowired
|
||||
private QmsApi qmsApi;
|
||||
@Resource private RuntimeService runtimeService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(DelegateExecution execution) {
|
||||
log.info("[QmsExecutionListener][execution({}) 被调用!变量有:{}]", execution.getId(), execution.getCurrentFlowableListener().getFieldExtensions());
|
||||
Map<String, Object> variables = execution.getVariables();
|
||||
JSONObject jsonObject = new JSONObject(variables);
|
||||
|
||||
|
||||
|
||||
String insId = execution.getProcessInstanceId();
|
||||
String businessKey = execution.getProcessInstanceBusinessKey();
|
||||
QmsBpmDTO qmsBpmDTO = new QmsBpmDTO(insId, businessKey, jsonObject, "");
|
||||
Map<String, Object> v = runtimeService.getVariables(execution.getProcessInstanceId());
|
||||
// Object status = runtimeService.getVariable(execution.getProcessInstanceId(), WfProcessConstant.TASK_VARIABLE_PROCESS_TERMINATE);
|
||||
CommonResult<JSONObject> result = qmsApi.bpmCallback(qmsBpmDTO);
|
||||
if (!result.isSuccess()) {
|
||||
log.error("[QmsExecutionListener][execution({}) 回调失败!错误码:{},错误信息:{}]", execution.getId(), result.getCode(), result.getMsg());
|
||||
throw exception0(ErrorCodeConstants.ERROR_CODE_MODULE_QMS_BPM, result.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.zt.plat.module.bpm.service.qms.listener;
|
||||
|
||||
import com.zt.plat.framework.common.pojo.CommonResult;
|
||||
import com.zt.plat.module.qms.api.task.QmsApi;
|
||||
import com.zt.plat.module.qms.api.task.dto.QmsBpmDTO;
|
||||
import com.zt.plat.module.qms.enums.ErrorCodeConstants;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.engine.delegate.TaskListener;
|
||||
import org.flowable.task.service.delegate.DelegateTask;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.zt.plat.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
|
||||
|
||||
/**
|
||||
* QMS模块任务监听
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class QmsTaskListener implements TaskListener {
|
||||
@Autowired
|
||||
private QmsApi qmsApi;
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
log.info("[QmsTaskListener][delegateTask({})]", delegateTask);
|
||||
String state = delegateTask.getState();
|
||||
Map<String, Object> variables = delegateTask.getVariables();
|
||||
JSONObject jsonObject = new JSONObject(variables);
|
||||
String insId = delegateTask.getProcessInstanceId();
|
||||
QmsBpmDTO qmsBpmDTO = new QmsBpmDTO(insId, "", jsonObject, state);
|
||||
CommonResult<JSONObject> result = qmsApi.bpmCallback(qmsBpmDTO);
|
||||
if (!result.isSuccess()) {
|
||||
log.error("[QmsExecutionListener][execution({}) 回调失败!错误码:{},错误信息:{}]", delegateTask.getId(), result.getCode(), result.getMsg());
|
||||
throw exception0(ErrorCodeConstants.ERROR_CODE_MODULE_QMS_BPM, result.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user