提交 30477cdc 编写于 作者: ibizdev's avatar ibizdev

xignzi006 发布系统代码

上级 6fd0b216
import { Verify } from '@/utils/verify/verify';
/**
* 作为丢单结束
*
* @export
* @class LostLogicBase
*/
export default class LostLogicBase {
/**
* 名称
*
* @memberof LostLogicBase
*/
private name:string ="Lost";
/**
* 唯一标识
*
* @memberof LostLogicBase
*/
private id:string = "B1D85A42-1233-42FF-A463-1506BAE6FB4E";
/**
* 默认参数名称
*
* @memberof LostLogicBase
*/
private defaultParamName:string = "Default";
/**
* 参数集合
*
* @memberof LostLogicBase
*/
private paramsMap:Map<string,any> = new Map();
/**
* Creates an instance of LostLogicBase.
*
* @param {*} [opts={}]
* @memberof LostLogicBase
*/
constructor(opts: any = {}) {
this.initParams(opts);
}
/**
* 初始化参数集合
*
* @param {*} [opts={}]
* @memberof LostLogicBase
*/
public initParams(opts:any){
this.paramsMap.set('Default',opts);
}
/**
* 执行逻辑
*
* @param context 应用上下文
* @param params 传入参数
*/
public onExecute(context:any,params:any,isloading:boolean){
return this.executeBegin(context,params,isloading);
}
/**
* 开始
*
* @param params 传入参数
*/
private async executeBegin(context:any,params:any,isloading:boolean){
//开始节点
return this.paramsMap.get(this.defaultParamName).data;
}
}
\ No newline at end of file
import { Http,Util } from '@/utils';
import LostLogicBase from './lost-logic-base';
/**
* 作为丢单结束
*
* @export
* @class LostLogic
*/
export default class LostLogic extends LostLogicBase{
/**
* Creates an instance of LostLogic
*
* @param {*} [opts={}]
* @memberof LostLogic
*/
constructor(opts: any = {}) {
super(opts);
}
}
\ No newline at end of file
import { Http,Util } from '@/utils';
import EntityService from '../entity-service';
import LostLogic from '@/service/opportunity/lost-logic';
import WinLogic from '@/service/opportunity/win-logic';
......
import OpportunityService from '@/service/opportunity/opportunity-service';
import { Verify } from '@/utils/verify/verify';
......@@ -58,6 +59,24 @@ export default class WinLogicBase {
}
/**
* 计算0节点结果
*
* @param params 传入参数
*/
public compute0Cond(params:any):boolean{
return true;
}
/**
* 计算1节点结果
*
* @param params 传入参数
*/
public compute1Cond(params:any):boolean{
return true;
}
/**
* 执行逻辑
*
......@@ -69,6 +88,43 @@ export default class WinLogicBase {
}
/**
* 准备参数
*
* @param context 应用上下文
* @param params 传入参数
*/
private async executePrepareparam1(context:any,params:any,isloading:boolean){
// 准备参数节点
let tempDstParam0Context:any = this.paramsMap.get('Default').context?this.paramsMap.get('Default').context:{};
let tempDstParam0Data:any = this.paramsMap.get('Default').data?this.paramsMap.get('Default').data:{};
Object.assign(tempDstParam0Data,{statecode:"1"});
this.paramsMap.set('Default',{data:tempDstParam0Data,context:tempDstParam0Context});
if(this.compute1Cond(params)){
return this.executeDeaction1(context,params,isloading);
}
}
/**
* 更新商机状态
*
* @param context 应用上下文
* @param params 传入参数
*/
private async executeDeaction1(context:any,params:any,isloading:boolean){
// 行为处理节点
let result: any;
let actionParam:any = this.paramsMap.get('Default');
const targetService:OpportunityService = new OpportunityService();
if (targetService['Update'] && targetService['Update'] instanceof Function) {
result = await targetService['Update'](actionParam.context,actionParam.data, false);
}
if(result && result.status == 200){
Object.assign(actionParam.data,result.data);
return this.paramsMap.get(this.defaultParamName).data;
}
}
/**
* 开始
*
......@@ -76,7 +132,9 @@ export default class WinLogicBase {
*/
private async executeBegin(context:any,params:any,isloading:boolean){
//开始节点
return this.paramsMap.get(this.defaultParamName).data;
if(this.compute0Cond(params)){
return this.executePrepareparam1(context,params,isloading);
}
}
......
......@@ -512,6 +512,7 @@ public class Account extends EntityMP implements Serializable {
/**
* 状态描述
*/
@DEField(defaultValue = "1")
@TableField(value = "statuscode")
@JSONField(name = "statuscode")
@JsonProperty("statuscode")
......@@ -756,6 +757,7 @@ public class Account extends EntityMP implements Serializable {
/**
* 状态
*/
@DEField(defaultValue = "1")
@TableField(value = "statecode")
@JSONField(name = "statecode")
@JsonProperty("statecode")
......
package cn.ibizlab.businesscentral.core.sales.service.logic;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import cn.ibizlab.businesscentral.core.sales.domain.Opportunity;
/**
* 关系型数据实体[Lost] 对象
*/
public interface IOpportunityLostLogic {
void execute(Opportunity opportunity ) ;
}
package cn.ibizlab.businesscentral.core.sales.service.logic.impl;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.kie.api.runtime.KieSession;
import org.kie.api.runtime.KieContainer;
import cn.ibizlab.businesscentral.core.sales.service.logic.IOpportunityLostLogic;
import cn.ibizlab.businesscentral.core.sales.domain.Opportunity;
/**
* 关系型数据实体[Lost] 对象
*/
@Slf4j
@Service
public class OpportunityLostLogicImpl implements IOpportunityLostLogic{
@Autowired
private KieContainer kieContainer;
@Autowired
private cn.ibizlab.businesscentral.core.sales.service.IOpportunityService iBzSysDefaultService;
public cn.ibizlab.businesscentral.core.sales.service.IOpportunityService getIBzSysDefaultService() {
return this.iBzSysDefaultService;
}
public void execute(Opportunity et){
KieSession kieSession = null;
try{
kieSession=kieContainer.newKieSession();
kieSession.insert(et);
kieSession.setGlobal("opportunitylostdefault",et);
kieSession.setGlobal("iBzSysOpportunityDefaultService",iBzSysDefaultService);
kieSession.setGlobal("curuser", cn.ibizlab.businesscentral.util.security.AuthenticationUser.getAuthenticationUser());
kieSession.startProcess("cn.ibizlab.businesscentral.core.sales.service.logic.opportunitylost");
}catch(Exception e){
throw new RuntimeException("执行[作为丢单结束]处理逻辑发生异常"+e);
}finally {
if(kieSession!=null)
kieSession.destroy();
}
}
}
......@@ -26,6 +26,13 @@ public class OpportunityWinLogicImpl implements IOpportunityWinLogic{
@Autowired
private KieContainer kieContainer;
@Autowired
private cn.ibizlab.businesscentral.core.sales.service.IOpportunityService opportunityservice;
public cn.ibizlab.businesscentral.core.sales.service.IOpportunityService getOpportunityService() {
return this.opportunityservice;
}
@Autowired
private cn.ibizlab.businesscentral.core.sales.service.IOpportunityService iBzSysDefaultService;
......@@ -41,6 +48,7 @@ public class OpportunityWinLogicImpl implements IOpportunityWinLogic{
kieSession=kieContainer.newKieSession();
kieSession.insert(et);
kieSession.setGlobal("opportunitywindefault",et);
kieSession.setGlobal("opportunityservice",opportunityservice);
kieSession.setGlobal("iBzSysOpportunityDefaultService",iBzSysDefaultService);
kieSession.setGlobal("curuser", cn.ibizlab.businesscentral.util.security.AuthenticationUser.getAuthenticationUser());
kieSession.startProcess("cn.ibizlab.businesscentral.core.sales.service.logic.opportunitywin");
......
package cn.ibizlab.businesscentral.sales.logic.opportunitylogic.lost;
import java.util.Map;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
global cn.ibizlab.businesscentral.core.sales.domain.Opportunity opportunitylostdefault;
global cn.ibizlab.businesscentral.core.sales.service.IOpportunityService iBzSysOpportunityDefaultService;
global cn.ibizlab.businesscentral.util.security.AuthenticationUser curuser;
no-loop
//逻辑处理节点[开始]
rule "begin"
ruleflow-group "opportunitylostbegin"
when
then
end
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="cn.ibizlab.businesscentral.core.sales.service.logic.opportunitylost" isClosed="false" isExecutable="true" name="ScoreRule" processType="Private" tns:packageName="cn.ibizlab.businesscentral.core.sales.service.logic.opportunitylost">
<extensionElements>
<tns:import name="java.util.Map" />
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.businesscentral.util.helper.RuleUtils"/>
<tns:global identifier="opportunitylostdefault" type="cn.ibizlab.businesscentral.core.sales.domain.Opportunity" />
</extensionElements>
<startEvent id="B1D85A42-1233-42FF-A463-1506BAE6FB4E" isInterrupting="true"/>
<endEvent id="B1D85A42-1233-42FF-A463-1506BAE6FB4E_End" name="End"/>
<sequenceFlow id="B1D85A42-1233-42FF-A463-1506BAE6FB4E_End_Line" sourceRef="B1D85A42-1233-42FF-A463-1506BAE6FB4E" targetRef="B1D85A42-1233-42FF-A463-1506BAE6FB4E_End"/>
</process>
</definitions>
......@@ -4,11 +4,30 @@ import java.util.Map;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
global cn.ibizlab.businesscentral.core.sales.domain.Opportunity opportunitywindefault;
global cn.ibizlab.businesscentral.core.sales.service.IOpportunityService opportunityservice;
global cn.ibizlab.businesscentral.core.sales.service.IOpportunityService iBzSysOpportunityDefaultService;
global cn.ibizlab.businesscentral.util.security.AuthenticationUser curuser;
no-loop
//逻辑处理节点[准备参数]
rule "prepareparam1"
ruleflow-group "opportunitywinprepareparam1"
when
then
opportunitywindefault.set("statecode","1");
update(opportunitywindefault);//更新fact中变量值
end
//逻辑处理节点[更新商机状态]
rule "deaction1"
ruleflow-group "opportunitywindeaction1"
when
then
opportunityservice.update(opportunitywindefault);
update(opportunitywindefault);//更新fact中变量值
end
//逻辑处理节点[开始]
rule "begin"
ruleflow-group "opportunitywinbegin"
......
......@@ -7,9 +7,15 @@
<tns:import name="cn.ibizlab.businesscentral.util.helper.RuleUtils"/>
<tns:global identifier="opportunitywindefault" type="cn.ibizlab.businesscentral.core.sales.domain.Opportunity" />
</extensionElements>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="opportunitywinprepareparam1" id="9AF21B6E-E640-462C-BEB7-73DB98CCA415" implementation="http://www.jboss.org/drools/rule" name="准备参数"/>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="opportunitywindeaction1" id="82449038-E49E-4D7C-A2E9-80652938DF37" implementation="http://www.jboss.org/drools/rule" name="更新商机状态"/>
<endEvent id="82449038-E49E-4D7C-A2E9-80652938DF37_End" name="End"/>
<sequenceFlow id="82449038-E49E-4D7C-A2E9-80652938DF37_End_Line" sourceRef="82449038-E49E-4D7C-A2E9-80652938DF37" targetRef="82449038-E49E-4D7C-A2E9-80652938DF37_End"/>
<startEvent id="67643EA0-5920-48F8-8411-251152430059" isInterrupting="true"/>
<endEvent id="67643EA0-5920-48F8-8411-251152430059_End" name="End"/>
<sequenceFlow id="67643EA0-5920-48F8-8411-251152430059_End_Line" sourceRef="67643EA0-5920-48F8-8411-251152430059" targetRef="67643EA0-5920-48F8-8411-251152430059_End"/>
<sequenceFlow id="B950E7C9-997B-4606-A7F7-8469CCB133AC" sourceRef="67643EA0-5920-48F8-8411-251152430059" targetRef="9AF21B6E-E640-462C-BEB7-73DB98CCA415">
</sequenceFlow>
<sequenceFlow id="8D9A63FE-EBE4-4DBD-B55E-E741DD40CF1C" sourceRef="9AF21B6E-E640-462C-BEB7-73DB98CCA415" targetRef="82449038-E49E-4D7C-A2E9-80652938DF37">
</sequenceFlow>
</process>
</definitions>
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册