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

ibiz4j 发布系统代码 [ibiz-rt,ibizlab-runtime]

上级 cce8ad34
......@@ -88,8 +88,7 @@ public class DictCatalogServiceImpl implements IDictCatalogService {
public DictCatalog get(String id) {
DictCatalog et=dictCatalogFeignClient.get(id);
if(et==null){
et=new DictCatalog();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class DictOptionServiceImpl implements IDictOptionService {
public DictOption get(String value_key) {
DictOption et=dictOptionFeignClient.get(value_key);
if(et==null){
et=new DictOption();
et.setValueKey(value_key);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), value_key);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class MetaDynamicModelServiceImpl implements IMetaDynamicModelService {
public MetaDynamicModel get(String configid) {
MetaDynamicModel et=metaDynamicModelFeignClient.get(configid);
if(et==null){
et=new MetaDynamicModel();
et.setConfigid(configid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), configid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SDFileServiceImpl implements ISDFileService {
public SDFile get(String id) {
SDFile et=sDFileFeignClient.get(id);
if(et==null){
et=new SDFile();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class MsgBodyServiceImpl implements IMsgBodyService {
public MsgBody get(String msg_id) {
MsgBody et=msgBodyFeignClient.get(msg_id);
if(et==null){
et=new MsgBody();
et.setMsgId(msg_id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), msg_id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class MsgOpenAccessServiceImpl implements IMsgOpenAccessService {
public MsgOpenAccess get(String id) {
MsgOpenAccess et=msgOpenAccessFeignClient.get(id);
if(et==null){
et=new MsgOpenAccess();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class MsgTemplateServiceImpl implements IMsgTemplateService {
public MsgTemplate get(String tid) {
MsgTemplate et=msgTemplateFeignClient.get(tid);
if(et==null){
et=new MsgTemplate();
et.setTid(tid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), tid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class MsgUserAccountServiceImpl implements IMsgUserAccountService {
public MsgUserAccount get(String id) {
MsgUserAccount et=msgUserAccountFeignClient.get(id);
if(et==null){
et=new MsgUserAccount();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysDepartmentServiceImpl implements ISysDepartmentService {
public SysDepartment get(String deptid) {
SysDepartment et=sysDepartmentFeignClient.get(deptid);
if(et==null){
et=new SysDepartment();
et.setDeptid(deptid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), deptid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysDeptMemberServiceImpl implements ISysDeptMemberService {
public SysDeptMember get(String memberid) {
SysDeptMember et=sysDeptMemberFeignClient.get(memberid);
if(et==null){
et=new SysDeptMember();
et.setMemberid(memberid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), memberid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysEmployeeServiceImpl implements ISysEmployeeService {
public SysEmployee get(String userid) {
SysEmployee et=sysEmployeeFeignClient.get(userid);
if(et==null){
et=new SysEmployee();
et.setUserid(userid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), userid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysOrganizationServiceImpl implements ISysOrganizationService {
public SysOrganization get(String orgid) {
SysOrganization et=sysOrganizationFeignClient.get(orgid);
if(et==null){
et=new SysOrganization();
et.setOrgid(orgid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), orgid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysPostServiceImpl implements ISysPostService {
public SysPost get(String postid) {
SysPost et=sysPostFeignClient.get(postid);
if(et==null){
et=new SysPost();
et.setPostid(postid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), postid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysTeamMemberServiceImpl implements ISysTeamMemberService {
public SysTeamMember get(String teammemberid) {
SysTeamMember et=sysTeamMemberFeignClient.get(teammemberid);
if(et==null){
et=new SysTeamMember();
et.setTeammemberid(teammemberid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), teammemberid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysTeamServiceImpl implements ISysTeamService {
public SysTeam get(String teamid) {
SysTeam et=sysTeamFeignClient.get(teamid);
if(et==null){
et=new SysTeam();
et.setTeamid(teamid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), teamid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class PayOpenAccessServiceImpl implements IPayOpenAccessService {
public PayOpenAccess get(String id) {
PayOpenAccess et=payOpenAccessFeignClient.get(id);
if(et==null){
et=new PayOpenAccess();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class PayTradeServiceImpl implements IPayTradeService {
public PayTrade get(String trade_id) {
PayTrade et=payTradeFeignClient.get(trade_id);
if(et==null){
et=new PayTrade();
et.setTradeId(trade_id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), trade_id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class JobsInfoServiceImpl implements IJobsInfoService {
public JobsInfo get(String id) {
JobsInfo et=jobsInfoFeignClient.get(id);
if(et==null){
et=new JobsInfo();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class JobsLockServiceImpl implements IJobsLockService {
public JobsLock get(String id) {
JobsLock et=jobsLockFeignClient.get(id);
if(et==null){
et=new JobsLock();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class JobsLogServiceImpl implements IJobsLogService {
public JobsLog get(String id) {
JobsLog et=jobsLogFeignClient.get(id);
if(et==null){
et=new JobsLog();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class JobsRegistryServiceImpl implements IJobsRegistryService {
public JobsRegistry get(String id) {
JobsRegistry et=jobsRegistryFeignClient.get(id);
if(et==null){
et=new JobsRegistry();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysAppServiceImpl implements ISysAppService {
public SysApp get(String id) {
SysApp et=sysAppFeignClient.get(id);
if(et==null){
et=new SysApp();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysAuthLogServiceImpl implements ISysAuthLogService {
public SysAuthLog get(String logid) {
SysAuthLog et=sysAuthLogFeignClient.get(logid);
if(et==null){
et=new SysAuthLog();
et.setLogid(logid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), logid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysOpenAccessServiceImpl implements ISysOpenAccessService {
public SysOpenAccess get(String id) {
SysOpenAccess et=sysOpenAccessFeignClient.get(id);
if(et==null){
et=new SysOpenAccess();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysPSSystemServiceImpl implements ISysPSSystemService {
public SysPSSystem get(String pssystemid) {
SysPSSystem et=sysPSSystemFeignClient.get(pssystemid);
if(et==null){
et=new SysPSSystem();
et.setPssystemid(pssystemid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), pssystemid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysPermissionServiceImpl implements ISysPermissionService {
public SysPermission get(String permissionid) {
SysPermission et=sysPermissionFeignClient.get(permissionid);
if(et==null){
et=new SysPermission();
et.setPermissionid(permissionid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), permissionid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysRolePermissionServiceImpl implements ISysRolePermissionService {
public SysRolePermission get(String rolepermissionid) {
SysRolePermission et=sysRolePermissionFeignClient.get(rolepermissionid);
if(et==null){
et=new SysRolePermission();
et.setRolepermissionid(rolepermissionid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), rolepermissionid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysRoleServiceImpl implements ISysRoleService {
public SysRole get(String roleid) {
SysRole et=sysRoleFeignClient.get(roleid);
if(et==null){
et=new SysRole();
et.setRoleid(roleid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), roleid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysUserAuthServiceImpl implements ISysUserAuthService {
public SysUserAuth get(String id) {
SysUserAuth et=sysUserAuthFeignClient.get(id);
if(et==null){
et=new SysUserAuth();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysUserRoleServiceImpl implements ISysUserRoleService {
public SysUserRole get(String userroleid) {
SysUserRole et=sysUserRoleFeignClient.get(userroleid);
if(et==null){
et=new SysUserRole();
et.setUserroleid(userroleid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), userroleid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class SysUserServiceImpl implements ISysUserService {
public SysUser get(String userid) {
SysUser et=sysUserFeignClient.get(userid);
if(et==null){
et=new SysUser();
et.setUserid(userid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), userid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFGroupServiceImpl implements IWFGroupService {
public WFGroup get(String id) {
WFGroup et=wFGroupFeignClient.get(id);
if(et==null){
et=new WFGroup();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFMemberServiceImpl implements IWFMemberService {
public WFMember get(String memberid) {
WFMember et=wFMemberFeignClient.get(memberid);
if(et==null){
et=new WFMember();
et.setMemberid(memberid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), memberid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFProcessDefinitionServiceImpl implements IWFProcessDefinitionServi
public WFProcessDefinition get(String definitionkey) {
WFProcessDefinition et=wFProcessDefinitionFeignClient.get(definitionkey);
if(et==null){
et=new WFProcessDefinition();
et.setDefinitionkey(definitionkey);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), definitionkey);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFProcessInstanceServiceImpl implements IWFProcessInstanceService {
public WFProcessInstance get(String id) {
WFProcessInstance et=wFProcessInstanceFeignClient.get(id);
if(et==null){
et=new WFProcessInstance();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFProcessNodeServiceImpl implements IWFProcessNodeService {
public WFProcessNode get(String usertaskid) {
WFProcessNode et=wFProcessNodeFeignClient.get(usertaskid);
if(et==null){
et=new WFProcessNode();
et.setUsertaskid(usertaskid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), usertaskid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFREModelServiceImpl implements IWFREModelService {
public WFREModel get(String id) {
WFREModel et=wFREModelFeignClient.get(id);
if(et==null){
et=new WFREModel();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFSystemServiceImpl implements IWFSystemService {
public WFSystem get(String pssystemid) {
WFSystem et=wFSystemFeignClient.get(pssystemid);
if(et==null){
et=new WFSystem();
et.setPssystemid(pssystemid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), pssystemid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFTaskServiceImpl implements IWFTaskService {
public WFTask get(String id) {
WFTask et=wFTaskFeignClient.get(id);
if(et==null){
et=new WFTask();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFTaskWayServiceImpl implements IWFTaskWayService {
public WFTaskWay get(String sequenceflowid) {
WFTaskWay et=wFTaskWayFeignClient.get(sequenceflowid);
if(et==null){
et=new WFTaskWay();
et.setSequenceflowid(sequenceflowid);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), sequenceflowid);
}
else{
}
......
......@@ -88,8 +88,7 @@ public class WFUserServiceImpl implements IWFUserService {
public WFUser get(String id) {
WFUser et=wFUserFeignClient.get(id);
if(et==null){
et=new WFUser();
et.setId(id);
throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), id);
}
else{
}
......
......@@ -12,4 +12,3 @@ public interface DictCatalogMapping extends MappingBase<DictCatalogDTO, DictCata
}
......@@ -12,4 +12,3 @@ public interface DictOptionMapping extends MappingBase<DictOptionDTO, DictOption
}
......@@ -12,4 +12,3 @@ public interface JobsInfoMapping extends MappingBase<JobsInfoDTO, JobsInfo> {
}
......@@ -12,4 +12,3 @@ public interface JobsLockMapping extends MappingBase<JobsLockDTO, JobsLock> {
}
......@@ -12,4 +12,3 @@ public interface JobsLogMapping extends MappingBase<JobsLogDTO, JobsLog> {
}
......@@ -12,4 +12,3 @@ public interface JobsRegistryMapping extends MappingBase<JobsRegistryDTO, JobsRe
}
......@@ -12,4 +12,3 @@ public interface MetaDynamicModelMapping extends MappingBase<MetaDynamicModelDTO
}
......@@ -12,4 +12,3 @@ public interface MsgBodyMapping extends MappingBase<MsgBodyDTO, MsgBody> {
}
......@@ -12,4 +12,3 @@ public interface MsgOpenAccessMapping extends MappingBase<MsgOpenAccessDTO, MsgO
}
......@@ -12,4 +12,3 @@ public interface MsgTemplateMapping extends MappingBase<MsgTemplateDTO, MsgTempl
}
......@@ -12,4 +12,3 @@ public interface MsgUserAccountMapping extends MappingBase<MsgUserAccountDTO, Ms
}
......@@ -12,4 +12,3 @@ public interface PayOpenAccessMapping extends MappingBase<PayOpenAccessDTO, PayO
}
......@@ -12,4 +12,3 @@ public interface PayTradeMapping extends MappingBase<PayTradeDTO, PayTrade> {
}
......@@ -12,4 +12,3 @@ public interface SysAppMapping extends MappingBase<SysAppDTO, SysApp> {
}
......@@ -12,4 +12,3 @@ public interface SysAuthLogMapping extends MappingBase<SysAuthLogDTO, SysAuthLog
}
......@@ -12,4 +12,3 @@ public interface SysDepartmentMapping extends MappingBase<SysDepartmentDTO, SysD
}
......@@ -12,4 +12,3 @@ public interface SysDeptMemberMapping extends MappingBase<SysDeptMemberDTO, SysD
}
......@@ -12,4 +12,3 @@ public interface SysEmployeeMapping extends MappingBase<SysEmployeeDTO, SysEmplo
}
......@@ -12,4 +12,3 @@ public interface SysOpenAccessMapping extends MappingBase<SysOpenAccessDTO, SysO
}
......@@ -12,4 +12,3 @@ public interface SysOrganizationMapping extends MappingBase<SysOrganizationDTO,
}
......@@ -12,4 +12,3 @@ public interface SysPermissionMapping extends MappingBase<SysPermissionDTO, SysP
}
......@@ -12,4 +12,3 @@ public interface SysPostMapping extends MappingBase<SysPostDTO, SysPost> {
}
......@@ -12,4 +12,3 @@ public interface SysRoleMapping extends MappingBase<SysRoleDTO, SysRole> {
}
......@@ -12,4 +12,3 @@ public interface SysRolePermissionMapping extends MappingBase<SysRolePermissionD
}
......@@ -12,4 +12,3 @@ public interface SysTeamMapping extends MappingBase<SysTeamDTO, SysTeam> {
}
......@@ -12,4 +12,3 @@ public interface SysTeamMemberMapping extends MappingBase<SysTeamMemberDTO, SysT
}
......@@ -12,4 +12,3 @@ public interface SysUserAuthMapping extends MappingBase<SysUserAuthDTO, SysUserA
}
......@@ -12,4 +12,3 @@ public interface SysUserMapping extends MappingBase<SysUserDTO, SysUser> {
}
......@@ -12,4 +12,3 @@ public interface SysUserRoleMapping extends MappingBase<SysUserRoleDTO, SysUserR
}
......@@ -12,4 +12,3 @@ public interface WFGroupMapping extends MappingBase<WFGroupDTO, WFGroup> {
}
......@@ -12,4 +12,3 @@ public interface WFMemberMapping extends MappingBase<WFMemberDTO, WFMember> {
}
......@@ -12,4 +12,3 @@ public interface WFProcessDefinitionMapping extends MappingBase<WFProcessDefinit
}
......@@ -12,4 +12,3 @@ public interface WFREModelMapping extends MappingBase<WFREModelDTO, WFREModel> {
}
......@@ -12,4 +12,3 @@ public interface WFSystemMapping extends MappingBase<WFSystemDTO, WFSystem> {
}
......@@ -12,4 +12,3 @@ public interface WFUserMapping extends MappingBase<WFUserDTO, WFUser> {
}
package cn.ibizlab.util.aspect;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.domain.DELogic;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
......@@ -22,6 +20,8 @@ import org.kie.api.builder.Results;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.internal.io.ResourceFactory;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
......@@ -35,7 +35,6 @@ import org.springframework.util.StringUtils;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
......@@ -109,7 +108,7 @@ public class DELogicAspect {
* @param action
*/
private void executeBeforeLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.BEFORE);
Resource bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.BEFORE);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action);
}
......@@ -122,7 +121,7 @@ public class DELogicAspect {
* @param action
*/
private void executeAfterLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.AFTER);
Resource bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.AFTER);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action);
}
......@@ -135,7 +134,7 @@ public class DELogicAspect {
* @param action
*/
private void executeLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.EXEC);
Resource bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.EXEC);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action);
}
......@@ -147,32 +146,37 @@ public class DELogicAspect {
* @param bpmnFile
* @param entity
*/
private void executeLogic(File bpmnFile, Object entity, String action) {
log.debug("开始执行实体处理逻辑[{}:{}:{}:本地模式]", entity.getClass().getSimpleName(), action, bpmnFile.getName());
String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getPath().getBytes());
DELogic logic = getDELogic(bpmnFile);
if (logic == null) {
return;
}
if (deLogicMap.containsKey(bpmnId) && logic.getMd5().equals(deLogicMap.get(bpmnId).getMd5())) {
logic = deLogicMap.get(bpmnId);
} else {
reloadLogic(logic);
deLogicMap.put(bpmnId, logic);
}
KieContainer container = logic.getContainer();
KieSession kieSession = container.getKieBase().newKieSession();
Process mainProcess = logic.getProcess();
//主流程参数
fillGlobalParam(kieSession, mainProcess, entity);
//子流程参数
if (!ObjectUtils.isEmpty(logic.getRefLogic())) {
for (DELogic subLogic : logic.getRefLogic()) {
fillGlobalParam(kieSession, subLogic.getProcess(), entity);
private void executeLogic(Resource bpmnFile, Object entity, String action) {
try {
log.debug("开始执行实体处理逻辑[{}:{}:{}:本地模式]", entity.getClass().getSimpleName(), action, bpmnFile.getFilename());
String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getURL().getPath().getBytes());
DELogic logic = getDELogic(bpmnFile);
if (logic == null) {
return;
}
if (deLogicMap.containsKey(bpmnId) && logic.getMd5().equals(deLogicMap.get(bpmnId).getMd5())) {
logic = deLogicMap.get(bpmnId);
} else {
reloadLogic(logic);
deLogicMap.put(bpmnId, logic);
}
KieContainer container = logic.getContainer();
KieSession kieSession = container.getKieBase().newKieSession();
Process mainProcess = logic.getProcess();
//主流程参数
fillGlobalParam(kieSession, mainProcess, entity);
//子流程参数
if (!ObjectUtils.isEmpty(logic.getRefLogic())) {
for (DELogic subLogic : logic.getRefLogic()) {
fillGlobalParam(kieSession, subLogic.getProcess(), entity);
}
}
kieSession.startProcess(mainProcess.getId());
log.debug("实体处理逻辑[{}:{}:{}:本地模式]执行结束", entity.getClass().getSimpleName(), action, bpmnFile.getFilename());
} catch (IOException e) {
log.error("实体处理逻辑[{}:{}:{}:本地模式]发生异常", entity.getClass().getSimpleName(), action, bpmnFile.getFilename());
throw new BadRequestAlertException("执行实体处理逻辑发生异常" + e.getMessage(), "DELogicAspect", "executeLogic");
}
kieSession.startProcess(mainProcess.getId());
log.debug("实体处理逻辑[{}:{}:{}:本地模式]执行结束", entity.getClass().getSimpleName(), action, bpmnFile.getName());
}
/**
......@@ -180,11 +184,11 @@ public class DELogicAspect {
*
* @param logic
*/
private void reloadLogic(DELogic logic) {
private void reloadLogic(DELogic logic) throws IOException {
KieServices kieServices = KieServices.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
for (File bpmn : logic.getRefRuleFiles()) {
kieFileSystem.write(ResourceFactory.newFileResource(bpmn));
for (Resource bpmn : logic.getRefRuleFiles()) {
kieFileSystem.write(ResourceFactory.newUrlResource(bpmn.getURL()));
}
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
Results results = kieBuilder.getResults();
......@@ -239,28 +243,29 @@ public class DELogicAspect {
* @param bpmnFile
* @return
*/
@SneakyThrows
private DELogic getDELogic(File bpmnFile) {
private DELogic getDELogic(Resource bpmnFile) {
DELogic logic = null;
XMLStreamReader reader = null;
InputStream bpmn = null;
try {
if (bpmnFile.exists()) {
XMLInputFactory factory = XMLInputFactory.newInstance();
bpmn = new FileInputStream(bpmnFile);
bpmn = bpmnFile.getInputStream();
reader = factory.createXMLStreamReader(bpmn);
BpmnModel model = bpmnXMLConverter.convertToBpmnModel(reader);
Process mainProcess = model.getMainProcess();
if (mainProcess == null) {
return null;
}
log.debug("正在加载 BPMN:{}", bpmnFile.getURL().getPath());
List<DELogic> refLogics = new ArrayList<>();
List<File> refFiles = new ArrayList<>();
List<Resource> refFiles = new ArrayList<>();
//自己 bpmn 及 drl
refFiles.add(bpmnFile);
File drlFile = getDrl(bpmnFile);
Resource drlFile = getDrl(bpmnFile);
if (drlFile != null && drlFile.exists()) {
refFiles.add(drlFile);
log.debug("正在加载 DRL:{}", drlFile.getURL().getPath());
}
//子 bpmn 及 drl
if (!ObjectUtils.isEmpty(model.getMainProcess()) && !ObjectUtils.isEmpty(model.getMainProcess().getFlowElementMap())) {
......@@ -268,11 +273,7 @@ public class DELogicAspect {
if (item instanceof CallActivity) {
CallActivity subBpmn = (CallActivity) item;
String bpmnFileName = subBpmn.getName();
log.debug("正在加载 BPMN:{}", bpmnFileName);
File subBpmnFile = getSubBpmn(bpmnFileName);
if (ObjectUtils.isEmpty(subBpmnFile)) {
log.debug("BPMN:{},缺少文件:{} ", bpmnFileName, subBpmnFile);
}
Resource subBpmnFile = getSubBpmn(bpmnFileName);
DELogic refLogic = getDELogic(subBpmnFile);
if (refLogic != null) {
refLogics.add(refLogic);
......@@ -292,7 +293,7 @@ public class DELogicAspect {
logic.setMd5(getMd5(refFiles));
}
} catch (Exception e) {
log.error("执行处理逻辑失败"+e);
log.error("执行处理逻辑失败" + e);
} finally {
try {
if (reader != null) {
......@@ -302,7 +303,7 @@ public class DELogicAspect {
bpmn.close();
}
} catch (Exception e) {
log.error("执行处理逻辑失败"+e);
log.error("执行处理逻辑失败" + e);
}
}
return logic;
......@@ -327,10 +328,10 @@ public class DELogicAspect {
}
}
}
if(!ObjectUtils.isEmpty(service.getSuperclass()) && !service.getSuperclass().getName().equals(Object.class.getName())) {
if (!ObjectUtils.isEmpty(service.getSuperclass()) && !service.getSuperclass().getName().equals(Object.class.getName())) {
return getEntity(service.getSuperclass());
}
log.error("获取实体信息失败,未能在[{}]中找到参数为实体类对象的行为,如create.update等",service.getSimpleName());
log.error("获取实体信息失败,未能在[{}]中找到参数为实体类对象的行为,如create.update等", service.getSimpleName());
return null;
}
......@@ -340,19 +341,19 @@ public class DELogicAspect {
* @param subFiles
* @return
*/
private String getMd5(List<File> subFiles) {
private String getMd5(List<Resource> subFiles) {
try {
StringBuffer buffer = new StringBuffer();
for (File file : subFiles) {
for (Resource file : subFiles) {
InputStream bpmnFile = null;
try {
bpmnFile = new FileInputStream(file);
bpmnFile = file.getInputStream();
if (!ObjectUtils.isEmpty(bpmnFile)) {
String strBpmn = IOUtils.toString(bpmnFile, "UTF-8");
buffer.append(strBpmn);
}
} catch (Exception e) {
log.error("处理逻辑版本检查失败"+e);
log.error("处理逻辑版本检查失败" + e);
} finally {
if (bpmnFile != null) {
bpmnFile.close();
......@@ -365,12 +366,12 @@ public class DELogicAspect {
return null;
}
} catch (Exception e) {
log.error("处理逻辑版本检查失败"+e);
log.error("处理逻辑版本检查失败" + e);
return null;
}
}
/**
/**
* 本地逻辑
*
* @param entity
......@@ -378,10 +379,8 @@ public class DELogicAspect {
* @param logicExecMode
* @return
*/
private File getLocalModel(String entity, String action, LogicExecMode logicExecMode) {
String logicName = String.format("%s.bpmn", logicExecMode.text);
String filePath = File.separator + "rules" + File.separator + entity + File.separator + action.toLowerCase() + File.separator + logicName;
return getBpmnFile(filePath);
private Resource getLocalModel(String entity, String action, LogicExecMode logicExecMode) {
return new ClassPathResource("rules" + File.separator + entity + File.separator + action.toLowerCase() + File.separator + logicExecMode.text + ".bpmn");
}
/**
......@@ -390,9 +389,8 @@ public class DELogicAspect {
* @param logicName
* @return
*/
private File getSubBpmn(String logicName) {
String filePath = String.format("/rules/%s", logicName);
return getBpmnFile(filePath);
private Resource getSubBpmn(String logicName) {
return new ClassPathResource(String.format("rules/%s", logicName));
}
/**
......@@ -401,41 +399,10 @@ public class DELogicAspect {
* @param bpmn
* @return
*/
private File getDrl(File bpmn) {
if (bpmn.getPath().endsWith("RuleFlow.bpmn")) {
return getBpmnFile(bpmn.getPath().replace("RuleFlow.bpmn", "Rule.drl"));
} else {
return getBpmnFile(bpmn.getPath().replace(".bpmn", ".drl"));
}
}
/**
* 获取 bpmn
*
* @param filePath
* @return
*/
private File getBpmnFile(String filePath) {
InputStream in = null;
File bpmn = null;
try {
in = this.getClass().getResourceAsStream(filePath.replace("\\", "/"));
if (in != null) {
bpmn = new File(filePath);
FileUtils.copyToFile(in, bpmn);
}
} catch (IOException e) {
log.error("执行处理逻辑失败,无法获取逻辑文件"+e);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return bpmn;
private Resource getDrl(Resource bpmn) {
String filePath = ((ClassPathResource) bpmn).getPath();
filePath = filePath.endsWith("RuleFlow.bpmn") ? filePath.replace("RuleFlow.bpmn", "Rule.drl") : filePath.replace(".bpmn", ".drl");
return new ClassPathResource(filePath);
}
/**
......@@ -446,8 +413,8 @@ public class DELogicAspect {
* @param action
* @return
*/
private boolean isValid(File bpmn, Object entity, Object action) {
String logicId = String.format("%s%s%s", entity.getClass().getSimpleName(), action, bpmn.getName()).toLowerCase();
private boolean isValid(Resource bpmn, Object entity, Object action) {
String logicId = String.format("%s%s%s", entity.getClass().getSimpleName(), action, bpmn.getFilename()).toLowerCase();
if (validLogic.containsKey(logicId)) {
return true;
} else {
......
......@@ -24,4 +24,5 @@ public interface IBZWFFeignClient
JSONObject wfstart(@PathVariable("system") String system, @PathVariable("appname") String appname,
@PathVariable("entity") String entity,
@PathVariable("businessKey") String businessKey, @RequestBody JSONObject instance);
}
......@@ -2,6 +2,7 @@ package cn.ibizlab.util.domain;
import lombok.Data;
import org.flowable.bpmn.model.Process;
import org.springframework.core.io.Resource;
import org.kie.api.runtime.KieContainer;
import java.io.File;
import java.io.Serializable;
......@@ -14,6 +15,6 @@ public class DELogic implements Serializable {
Process process;
KieContainer container;
List<DELogic> refLogic;
List<File> refRuleFiles;
List<Resource> refRuleFiles;
String md5;
}
......@@ -67,6 +67,7 @@ public class SearchContextBase implements ISearchContext{
* 工作流流程标识
*/
public String processDefinitionKey;
/**
* 获取工作流步骤标识
*/
......
......@@ -52,6 +52,11 @@ public class AuthenticationUser implements UserDetails
* 租户
*/
private String srfdcid;
/**
* 系统标识
*/
private String srfsystemid;
/**
/**
* 动态实例标识
*/
......@@ -254,6 +259,8 @@ public class AuthenticationUser implements UserDetails
if(this.sessionParams==null)
{
sessionParams = getUserSessionParam();
sessionParams.put("srfsystemid",this.getSrfsystemid());
sessionParams.put("srfdynainstid",this.getSrfdynainstid());
sessionParams.put("srfpersonid", this.getUserid());
sessionParams.put("srfpersonname", this.getPersonname());
sessionParams.put("srforgsectorid", this.getMdeptid());
......
......@@ -3,7 +3,6 @@ package cn.ibizlab.util.security;
import io.jsonwebtoken.ExpiredJwtException;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.service.AuthenticationUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
......@@ -22,6 +21,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
import org.springframework.util.StringUtils;
@Slf4j
@Component
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册