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

zhouweidong 发布系统代码 [ibz-wf,统一工作流]

上级 17911095
...@@ -76,6 +76,20 @@ public class WFMemberSearchContext extends QueryWrapperContext<WFMember> { ...@@ -76,6 +76,20 @@ public class WFMemberSearchContext extends QueryWrapperContext<WFMember> {
this.getSearchCond().like("personname", n_personname_like); this.getSearchCond().like("personname", n_personname_like);
} }
} }
private String n_orgid_eq;//[单位]
public void setN_orgid_eq(String n_orgid_eq) {
this.n_orgid_eq = n_orgid_eq;
if(!ObjectUtils.isEmpty(this.n_orgid_eq)){
this.getSearchCond().eq("orgid", n_orgid_eq);
}
}
private String n_mdeptid_eq;//[主部门]
public void setN_mdeptid_eq(String n_mdeptid_eq) {
this.n_mdeptid_eq = n_mdeptid_eq;
if(!ObjectUtils.isEmpty(this.n_mdeptid_eq)){
this.getSearchCond().eq("mdeptid", n_mdeptid_eq);
}
}
/** /**
* 启用快速搜索 * 启用快速搜索
......
...@@ -106,9 +106,8 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl ...@@ -106,9 +106,8 @@ public class WFGroupServiceImpl extends ServiceImpl<WFGroupMapper, WFGroup> impl
@Transactional @Transactional
public WFGroup get(String key) { public WFGroup get(String key) {
WFGroup et = getById(key); WFGroup et = getById(key);
if(et == null){ if (et == null) {
et = new WFGroup(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.setId(key);
} }
else { else {
et.setWfmember(wfmemberService.selectByGroupid(key)); et.setWfmember(wfmemberService.selectByGroupid(key));
......
...@@ -110,9 +110,8 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i ...@@ -110,9 +110,8 @@ public class WFMemberServiceImpl extends ServiceImpl<WFMemberMapper, WFMember> i
@Transactional @Transactional
public WFMember get(String key) { public WFMember get(String key) {
WFMember et = getById(key); WFMember et = getById(key);
if(et == null){ if (et == null) {
et = new WFMember(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.setMemberid(key);
} }
else { else {
} }
......
...@@ -100,9 +100,8 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit ...@@ -100,9 +100,8 @@ public class WFProcessDefinitionServiceImpl extends ServiceImpl<WFProcessDefinit
@Transactional @Transactional
public WFProcessDefinition get(String key) { public WFProcessDefinition get(String key) {
WFProcessDefinition et = getById(key); WFProcessDefinition et = getById(key);
if(et == null){ if (et == null) {
et = new WFProcessDefinition(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.setDefinitionkey(key);
} }
else { else {
} }
......
...@@ -100,9 +100,8 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i ...@@ -100,9 +100,8 @@ public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> i
@Transactional @Transactional
public WFSystem get(String key) { public WFSystem get(String key) {
WFSystem et = getById(key); WFSystem et = getById(key);
if(et == null){ if (et == null) {
et = new WFSystem(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.setPssystemid(key);
} }
else { else {
} }
......
...@@ -103,9 +103,8 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme ...@@ -103,9 +103,8 @@ public class WFUserServiceImpl extends ServiceImpl<WFUserMapper, WFUser> impleme
@Transactional @Transactional
public WFUser get(String key) { public WFUser get(String key) {
WFUser et = getById(key); WFUser et = getById(key);
if(et == null){ if (et == null) {
et = new WFUser(); throw new BadRequestAlertException("数据不存在", this.getClass().getSimpleName(), key);
et.setId(key);
} }
else { else {
} }
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<!--输出实体[WF_GROUP]数据结构 --> <!--输出实体[WF_GROUP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group-9-1"> <changeSet author="root" id="tab-wf_group-9-1">
<createTable tableName="IBZWFGROUP"> <createTable tableName="IBZWFGROUP">
<column name="GROUPID" remarks="" type="VARCHAR(100)"> <column name="GROUPID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_GROUPID"/> <constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_GROUPID"/>
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<!--输出实体[WF_GROUP_MEMBER]数据结构 --> <!--输出实体[WF_GROUP_MEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group_member-10-2"> <changeSet author="root" id="tab-wf_group_member-13-2">
<createTable tableName="IBZWFMEMBER"> <createTable tableName="IBZWFMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)"> <column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_MEMBER_MEMBERID"/> <constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_MEMBER_MEMBERID"/>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<!--输出实体[WF_DEFINITION]数据结构 --> <!--输出实体[WF_DEFINITION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_definition-1-3"> <changeSet author="root" id="tab-wf_definition-1-3">
<createTable tableName="IBZWFDEFINITION"> <createTable tableName="IBZWFDEFINITION">
<column name="DEFINITIONKEY" remarks="" type="VARCHAR(100)"> <column name="DEFINITIONKEY" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_DEFINITION_DEFINITIONKEY"/> <constraints primaryKey="true" primaryKeyName="PK_WF_DEFINITION_DEFINITIONKEY"/>
...@@ -79,7 +79,7 @@ ...@@ -79,7 +79,7 @@
<!--输出实体[WF_GROUP]外键关系 --> <!--输出实体[WF_GROUP]外键关系 -->
<!--输出实体[WF_GROUP_MEMBER]外键关系 --> <!--输出实体[WF_GROUP_MEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-10-5"> <changeSet author="root" id="fk-wf_group_member-13-5">
<addForeignKeyConstraint baseColumnNames="GROUPID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_GROUP" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="GROUPID" referencedTableName="IBZWFGROUP" validate="true"/> <addForeignKeyConstraint baseColumnNames="GROUPID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_GROUP" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="GROUPID" referencedTableName="IBZWFGROUP" validate="true"/>
</changeSet> </changeSet>
<!--输出实体[WF_DEFINITION]外键关系 --> <!--输出实体[WF_DEFINITION]外键关系 -->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ibizlab.core.workflow.mapper.WFGroupMapper"> <mapper namespace="cn.ibizlab.core.workflow.mapper.WFGroupMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> <!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ibizlab.core.workflow.mapper.WFMemberMapper"> <mapper namespace="cn.ibizlab.core.workflow.mapper.WFMemberMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> <!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ibizlab.core.workflow.mapper.WFProcessDefinitionMapper"> <mapper namespace="cn.ibizlab.core.workflow.mapper.WFProcessDefinitionMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> <!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ibizlab.core.workflow.mapper.WFSystemMapper"> <mapper namespace="cn.ibizlab.core.workflow.mapper.WFSystemMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> <!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.ibizlab.core.workflow.mapper.WFUserMapper"> <mapper namespace="cn.ibizlab.core.workflow.mapper.WFUserMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性--> <!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
......
...@@ -12,4 +12,3 @@ public interface WFGroupMapping extends MappingBase<WFGroupDTO, WFGroup> { ...@@ -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 WFMemberMapping extends MappingBase<WFMemberDTO, WFMember> {
} }
...@@ -12,4 +12,3 @@ public interface WFProcessDefinitionMapping extends MappingBase<WFProcessDefinit ...@@ -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 WFREModelMapping extends MappingBase<WFREModelDTO, WFREModel> {
} }
...@@ -12,4 +12,3 @@ public interface WFSystemMapping extends MappingBase<WFSystemDTO, WFSystem> { ...@@ -12,4 +12,3 @@ public interface WFSystemMapping extends MappingBase<WFSystemDTO, WFSystem> {
} }
...@@ -12,4 +12,3 @@ public interface WFTaskMapping extends MappingBase<WFTaskDTO, WFTask> { ...@@ -12,4 +12,3 @@ public interface WFTaskMapping extends MappingBase<WFTaskDTO, WFTask> {
} }
...@@ -12,4 +12,3 @@ public interface WFUserMapping extends MappingBase<WFUserDTO, WFUser> { ...@@ -12,4 +12,3 @@ public interface WFUserMapping extends MappingBase<WFUserDTO, WFUser> {
} }
...@@ -136,7 +136,6 @@ public class WFMemberResource { ...@@ -136,7 +136,6 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-searchDefault-all') and hasPermission(#context,'ibzwf-WFMember-Get')")
@ApiOperation(value = "获取DEFAULT", tags = {"成员" } ,notes = "获取DEFAULT") @ApiOperation(value = "获取DEFAULT", tags = {"成员" } ,notes = "获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfmembers/fetchdefault") @RequestMapping(method= RequestMethod.GET , value="/wfmembers/fetchdefault")
public ResponseEntity<List<WFMemberDTO>> fetchDefault(WFMemberSearchContext context) { public ResponseEntity<List<WFMemberDTO>> fetchDefault(WFMemberSearchContext context) {
...@@ -149,7 +148,6 @@ public class WFMemberResource { ...@@ -149,7 +148,6 @@ public class WFMemberResource {
.body(list); .body(list);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-searchDefault-all') and hasPermission(#context,'ibzwf-WFMember-Get')")
@ApiOperation(value = "查询DEFAULT", tags = {"成员" } ,notes = "查询DEFAULT") @ApiOperation(value = "查询DEFAULT", tags = {"成员" } ,notes = "查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfmembers/searchdefault") @RequestMapping(method= RequestMethod.POST , value="/wfmembers/searchdefault")
public ResponseEntity<Page<WFMemberDTO>> searchDefault(@RequestBody WFMemberSearchContext context) { public ResponseEntity<Page<WFMemberDTO>> searchDefault(@RequestBody WFMemberSearchContext context) {
...@@ -265,7 +263,6 @@ public class WFMemberResource { ...@@ -265,7 +263,6 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-searchDefault-all') and hasPermission(#context,'ibzwf-WFMember-Get')")
@ApiOperation(value = "根据角色/用户组获取DEFAULT", tags = {"成员" } ,notes = "根据角色/用户组获取DEFAULT") @ApiOperation(value = "根据角色/用户组获取DEFAULT", tags = {"成员" } ,notes = "根据角色/用户组获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfgroups/{wfgroup_id}/wfmembers/fetchdefault") @RequestMapping(method= RequestMethod.GET , value="/wfgroups/{wfgroup_id}/wfmembers/fetchdefault")
public ResponseEntity<List<WFMemberDTO>> fetchWFMemberDefaultByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id,WFMemberSearchContext context) { public ResponseEntity<List<WFMemberDTO>> fetchWFMemberDefaultByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id,WFMemberSearchContext context) {
...@@ -279,7 +276,6 @@ public class WFMemberResource { ...@@ -279,7 +276,6 @@ public class WFMemberResource {
.body(list); .body(list);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-searchDefault-all') and hasPermission(#context,'ibzwf-WFMember-Get')")
@ApiOperation(value = "根据角色/用户组查询DEFAULT", tags = {"成员" } ,notes = "根据角色/用户组查询DEFAULT") @ApiOperation(value = "根据角色/用户组查询DEFAULT", tags = {"成员" } ,notes = "根据角色/用户组查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfgroups/{wfgroup_id}/wfmembers/searchdefault") @RequestMapping(method= RequestMethod.POST , value="/wfgroups/{wfgroup_id}/wfmembers/searchdefault")
public ResponseEntity<Page<WFMemberDTO>> searchWFMemberDefaultByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody WFMemberSearchContext context) { public ResponseEntity<Page<WFMemberDTO>> searchWFMemberDefaultByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody WFMemberSearchContext context) {
...@@ -393,7 +389,6 @@ public class WFMemberResource { ...@@ -393,7 +389,6 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true); return ResponseEntity.status(HttpStatus.OK).body(true);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-searchDefault-all') and hasPermission(#context,'ibzwf-WFMember-Get')")
@ApiOperation(value = "根据用户获取DEFAULT", tags = {"成员" } ,notes = "根据用户获取DEFAULT") @ApiOperation(value = "根据用户获取DEFAULT", tags = {"成员" } ,notes = "根据用户获取DEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfusers/{wfuser_id}/wfmembers/fetchdefault") @RequestMapping(method= RequestMethod.GET , value="/wfusers/{wfuser_id}/wfmembers/fetchdefault")
public ResponseEntity<List<WFMemberDTO>> fetchWFMemberDefaultByWFUser(@PathVariable("wfuser_id") String wfuser_id,WFMemberSearchContext context) { public ResponseEntity<List<WFMemberDTO>> fetchWFMemberDefaultByWFUser(@PathVariable("wfuser_id") String wfuser_id,WFMemberSearchContext context) {
...@@ -407,7 +402,6 @@ public class WFMemberResource { ...@@ -407,7 +402,6 @@ public class WFMemberResource {
.body(list); .body(list);
} }
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-searchDefault-all') and hasPermission(#context,'ibzwf-WFMember-Get')")
@ApiOperation(value = "根据用户查询DEFAULT", tags = {"成员" } ,notes = "根据用户查询DEFAULT") @ApiOperation(value = "根据用户查询DEFAULT", tags = {"成员" } ,notes = "根据用户查询DEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfusers/{wfuser_id}/wfmembers/searchdefault") @RequestMapping(method= RequestMethod.POST , value="/wfusers/{wfuser_id}/wfmembers/searchdefault")
public ResponseEntity<Page<WFMemberDTO>> searchWFMemberDefaultByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody WFMemberSearchContext context) { public ResponseEntity<Page<WFMemberDTO>> searchWFMemberDefaultByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody WFMemberSearchContext context) {
......
package cn.ibizlab.util.aspect; package cn.ibizlab.util.aspect;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.domain.DELogic; import cn.ibizlab.util.domain.DELogic;
import cn.ibizlab.util.domain.EntityBase; import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.helper.DEFieldCacheMap; import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around; import org.aspectj.lang.annotation.Around;
...@@ -22,6 +20,8 @@ import org.kie.api.builder.Results; ...@@ -22,6 +20,8 @@ import org.kie.api.builder.Results;
import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession; import org.kie.api.runtime.KieSession;
import org.kie.internal.io.ResourceFactory; 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.EvaluationContext;
import org.springframework.expression.Expression; import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser; import org.springframework.expression.ExpressionParser;
...@@ -35,7 +35,6 @@ import org.springframework.util.StringUtils; ...@@ -35,7 +35,6 @@ import org.springframework.util.StringUtils;
import javax.xml.stream.XMLInputFactory; import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamReader;
import java.io.File; import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -109,7 +108,7 @@ public class DELogicAspect { ...@@ -109,7 +108,7 @@ public class DELogicAspect {
* @param action * @param action
*/ */
private void executeBeforeLogic(EntityBase entity, String 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)) { if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action); executeLogic(bpmnFile, entity, action);
} }
...@@ -122,7 +121,7 @@ public class DELogicAspect { ...@@ -122,7 +121,7 @@ public class DELogicAspect {
* @param action * @param action
*/ */
private void executeAfterLogic(EntityBase entity, String 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)) { if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action); executeLogic(bpmnFile, entity, action);
} }
...@@ -135,7 +134,7 @@ public class DELogicAspect { ...@@ -135,7 +134,7 @@ public class DELogicAspect {
* @param action * @param action
*/ */
private void executeLogic(EntityBase entity, String 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)) { if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action); executeLogic(bpmnFile, entity, action);
} }
...@@ -147,9 +146,10 @@ public class DELogicAspect { ...@@ -147,9 +146,10 @@ public class DELogicAspect {
* @param bpmnFile * @param bpmnFile
* @param entity * @param entity
*/ */
private void executeLogic(File bpmnFile, Object entity, String action) { private void executeLogic(Resource bpmnFile, Object entity, String action) {
log.debug("开始执行实体处理逻辑[{}:{}:{}:本地模式]", entity.getClass().getSimpleName(), action, bpmnFile.getName()); try {
String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getPath().getBytes()); log.debug("开始执行实体处理逻辑[{}:{}:{}:本地模式]", entity.getClass().getSimpleName(), action, bpmnFile.getFilename());
String bpmnId = DigestUtils.md5DigestAsHex(bpmnFile.getURL().getPath().getBytes());
DELogic logic = getDELogic(bpmnFile); DELogic logic = getDELogic(bpmnFile);
if (logic == null) { if (logic == null) {
return; return;
...@@ -172,7 +172,11 @@ public class DELogicAspect { ...@@ -172,7 +172,11 @@ public class DELogicAspect {
} }
} }
kieSession.startProcess(mainProcess.getId()); kieSession.startProcess(mainProcess.getId());
log.debug("实体处理逻辑[{}:{}:{}:本地模式]执行结束", entity.getClass().getSimpleName(), action, bpmnFile.getName()); 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");
}
} }
/** /**
...@@ -180,11 +184,11 @@ public class DELogicAspect { ...@@ -180,11 +184,11 @@ public class DELogicAspect {
* *
* @param logic * @param logic
*/ */
private void reloadLogic(DELogic logic) { private void reloadLogic(DELogic logic) throws IOException {
KieServices kieServices = KieServices.get(); KieServices kieServices = KieServices.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem(); KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
for (File bpmn : logic.getRefRuleFiles()) { for (Resource bpmn : logic.getRefRuleFiles()) {
kieFileSystem.write(ResourceFactory.newFileResource(bpmn)); kieFileSystem.write(ResourceFactory.newUrlResource(bpmn.getURL()));
} }
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll(); KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
Results results = kieBuilder.getResults(); Results results = kieBuilder.getResults();
...@@ -239,28 +243,29 @@ public class DELogicAspect { ...@@ -239,28 +243,29 @@ public class DELogicAspect {
* @param bpmnFile * @param bpmnFile
* @return * @return
*/ */
@SneakyThrows private DELogic getDELogic(Resource bpmnFile) {
private DELogic getDELogic(File bpmnFile) {
DELogic logic = null; DELogic logic = null;
XMLStreamReader reader = null; XMLStreamReader reader = null;
InputStream bpmn = null; InputStream bpmn = null;
try { try {
if (bpmnFile.exists()) { if (bpmnFile.exists()) {
XMLInputFactory factory = XMLInputFactory.newInstance(); XMLInputFactory factory = XMLInputFactory.newInstance();
bpmn = new FileInputStream(bpmnFile); bpmn = bpmnFile.getInputStream();
reader = factory.createXMLStreamReader(bpmn); reader = factory.createXMLStreamReader(bpmn);
BpmnModel model = bpmnXMLConverter.convertToBpmnModel(reader); BpmnModel model = bpmnXMLConverter.convertToBpmnModel(reader);
Process mainProcess = model.getMainProcess(); Process mainProcess = model.getMainProcess();
if (mainProcess == null) { if (mainProcess == null) {
return null; return null;
} }
log.debug("正在加载 BPMN:{}", bpmnFile.getURL().getPath());
List<DELogic> refLogics = new ArrayList<>(); List<DELogic> refLogics = new ArrayList<>();
List<File> refFiles = new ArrayList<>(); List<Resource> refFiles = new ArrayList<>();
//自己 bpmn 及 drl //自己 bpmn 及 drl
refFiles.add(bpmnFile); refFiles.add(bpmnFile);
File drlFile = getDrl(bpmnFile); Resource drlFile = getDrl(bpmnFile);
if (drlFile != null && drlFile.exists()) { if (drlFile != null && drlFile.exists()) {
refFiles.add(drlFile); refFiles.add(drlFile);
log.debug("正在加载 DRL:{}", drlFile.getURL().getPath());
} }
//子 bpmn 及 drl //子 bpmn 及 drl
if (!ObjectUtils.isEmpty(model.getMainProcess()) && !ObjectUtils.isEmpty(model.getMainProcess().getFlowElementMap())) { if (!ObjectUtils.isEmpty(model.getMainProcess()) && !ObjectUtils.isEmpty(model.getMainProcess().getFlowElementMap())) {
...@@ -268,11 +273,7 @@ public class DELogicAspect { ...@@ -268,11 +273,7 @@ public class DELogicAspect {
if (item instanceof CallActivity) { if (item instanceof CallActivity) {
CallActivity subBpmn = (CallActivity) item; CallActivity subBpmn = (CallActivity) item;
String bpmnFileName = subBpmn.getName(); String bpmnFileName = subBpmn.getName();
log.debug("正在加载 BPMN:{}", bpmnFileName); Resource subBpmnFile = getSubBpmn(bpmnFileName);
File subBpmnFile = getSubBpmn(bpmnFileName);
if (ObjectUtils.isEmpty(subBpmnFile)) {
log.debug("BPMN:{},缺少文件:{} ", bpmnFileName, subBpmnFile);
}
DELogic refLogic = getDELogic(subBpmnFile); DELogic refLogic = getDELogic(subBpmnFile);
if (refLogic != null) { if (refLogic != null) {
refLogics.add(refLogic); refLogics.add(refLogic);
...@@ -292,7 +293,7 @@ public class DELogicAspect { ...@@ -292,7 +293,7 @@ public class DELogicAspect {
logic.setMd5(getMd5(refFiles)); logic.setMd5(getMd5(refFiles));
} }
} catch (Exception e) { } catch (Exception e) {
log.error("执行处理逻辑失败"+e); log.error("执行处理逻辑失败" + e);
} finally { } finally {
try { try {
if (reader != null) { if (reader != null) {
...@@ -302,7 +303,7 @@ public class DELogicAspect { ...@@ -302,7 +303,7 @@ public class DELogicAspect {
bpmn.close(); bpmn.close();
} }
} catch (Exception e) { } catch (Exception e) {
log.error("执行处理逻辑失败"+e); log.error("执行处理逻辑失败" + e);
} }
} }
return logic; return logic;
...@@ -327,10 +328,10 @@ public class DELogicAspect { ...@@ -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()); return getEntity(service.getSuperclass());
} }
log.error("获取实体信息失败,未能在[{}]中找到参数为实体类对象的行为,如create.update等",service.getSimpleName()); log.error("获取实体信息失败,未能在[{}]中找到参数为实体类对象的行为,如create.update等", service.getSimpleName());
return null; return null;
} }
...@@ -340,19 +341,19 @@ public class DELogicAspect { ...@@ -340,19 +341,19 @@ public class DELogicAspect {
* @param subFiles * @param subFiles
* @return * @return
*/ */
private String getMd5(List<File> subFiles) { private String getMd5(List<Resource> subFiles) {
try { try {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
for (File file : subFiles) { for (Resource file : subFiles) {
InputStream bpmnFile = null; InputStream bpmnFile = null;
try { try {
bpmnFile = new FileInputStream(file); bpmnFile = file.getInputStream();
if (!ObjectUtils.isEmpty(bpmnFile)) { if (!ObjectUtils.isEmpty(bpmnFile)) {
String strBpmn = IOUtils.toString(bpmnFile, "UTF-8"); String strBpmn = IOUtils.toString(bpmnFile, "UTF-8");
buffer.append(strBpmn); buffer.append(strBpmn);
} }
} catch (Exception e) { } catch (Exception e) {
log.error("处理逻辑版本检查失败"+e); log.error("处理逻辑版本检查失败" + e);
} finally { } finally {
if (bpmnFile != null) { if (bpmnFile != null) {
bpmnFile.close(); bpmnFile.close();
...@@ -365,7 +366,7 @@ public class DELogicAspect { ...@@ -365,7 +366,7 @@ public class DELogicAspect {
return null; return null;
} }
} catch (Exception e) { } catch (Exception e) {
log.error("处理逻辑版本检查失败"+e); log.error("处理逻辑版本检查失败" + e);
return null; return null;
} }
} }
...@@ -378,10 +379,8 @@ public class DELogicAspect { ...@@ -378,10 +379,8 @@ public class DELogicAspect {
* @param logicExecMode * @param logicExecMode
* @return * @return
*/ */
private File getLocalModel(String entity, String action, LogicExecMode logicExecMode) { private Resource getLocalModel(String entity, String action, LogicExecMode logicExecMode) {
String logicName = String.format("%s.bpmn", logicExecMode.text); return new ClassPathResource("rules" + File.separator + entity + File.separator + action.toLowerCase() + File.separator + logicExecMode.text + ".bpmn");
String filePath = File.separator + "rules" + File.separator + entity + File.separator + action.toLowerCase() + File.separator + logicName;
return getBpmnFile(filePath);
} }
/** /**
...@@ -390,9 +389,8 @@ public class DELogicAspect { ...@@ -390,9 +389,8 @@ public class DELogicAspect {
* @param logicName * @param logicName
* @return * @return
*/ */
private File getSubBpmn(String logicName) { private Resource getSubBpmn(String logicName) {
String filePath = String.format("/rules/%s", logicName); return new ClassPathResource(String.format("rules/%s", logicName));
return getBpmnFile(filePath);
} }
/** /**
...@@ -401,41 +399,10 @@ public class DELogicAspect { ...@@ -401,41 +399,10 @@ public class DELogicAspect {
* @param bpmn * @param bpmn
* @return * @return
*/ */
private File getDrl(File bpmn) { private Resource getDrl(Resource bpmn) {
if (bpmn.getPath().endsWith("RuleFlow.bpmn")) { String filePath = ((ClassPathResource) bpmn).getPath();
return getBpmnFile(bpmn.getPath().replace("RuleFlow.bpmn", "Rule.drl")); filePath = filePath.endsWith("RuleFlow.bpmn") ? filePath.replace("RuleFlow.bpmn", "Rule.drl") : filePath.replace(".bpmn", ".drl");
} else { return new ClassPathResource(filePath);
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;
} }
/** /**
...@@ -446,8 +413,8 @@ public class DELogicAspect { ...@@ -446,8 +413,8 @@ public class DELogicAspect {
* @param action * @param action
* @return * @return
*/ */
private boolean isValid(File bpmn, Object entity, Object action) { private boolean isValid(Resource bpmn, Object entity, Object action) {
String logicId = String.format("%s%s%s", entity.getClass().getSimpleName(), action, bpmn.getName()).toLowerCase(); String logicId = String.format("%s%s%s", entity.getClass().getSimpleName(), action, bpmn.getFilename()).toLowerCase();
if (validLogic.containsKey(logicId)) { if (validLogic.containsKey(logicId)) {
return true; return true;
} else { } else {
......
...@@ -24,4 +24,5 @@ public interface IBZWFFeignClient ...@@ -24,4 +24,5 @@ public interface IBZWFFeignClient
JSONObject wfstart(@PathVariable("system") String system, @PathVariable("appname") String appname, JSONObject wfstart(@PathVariable("system") String system, @PathVariable("appname") String appname,
@PathVariable("entity") String entity, @PathVariable("entity") String entity,
@PathVariable("businessKey") String businessKey, @RequestBody JSONObject instance); @PathVariable("businessKey") String businessKey, @RequestBody JSONObject instance);
} }
...@@ -2,6 +2,7 @@ package cn.ibizlab.util.domain; ...@@ -2,6 +2,7 @@ package cn.ibizlab.util.domain;
import lombok.Data; import lombok.Data;
import org.flowable.bpmn.model.Process; import org.flowable.bpmn.model.Process;
import org.springframework.core.io.Resource;
import org.kie.api.runtime.KieContainer; import org.kie.api.runtime.KieContainer;
import java.io.File; import java.io.File;
import java.io.Serializable; import java.io.Serializable;
...@@ -14,6 +15,6 @@ public class DELogic implements Serializable { ...@@ -14,6 +15,6 @@ public class DELogic implements Serializable {
Process process; Process process;
KieContainer container; KieContainer container;
List<DELogic> refLogic; List<DELogic> refLogic;
List<File> refRuleFiles; List<Resource> refRuleFiles;
String md5; String md5;
} }
...@@ -67,6 +67,7 @@ public class SearchContextBase implements ISearchContext{ ...@@ -67,6 +67,7 @@ public class SearchContextBase implements ISearchContext{
* 工作流流程标识 * 工作流流程标识
*/ */
public String processDefinitionKey; public String processDefinitionKey;
/** /**
* 获取工作流步骤标识 * 获取工作流步骤标识
*/ */
......
...@@ -254,6 +254,7 @@ public class AuthenticationUser implements UserDetails ...@@ -254,6 +254,7 @@ public class AuthenticationUser implements UserDetails
if(this.sessionParams==null) if(this.sessionParams==null)
{ {
sessionParams = getUserSessionParam(); sessionParams = getUserSessionParam();
sessionParams.put("srfdynainstid",this.getSrfdynainstid());
sessionParams.put("srfpersonid", this.getUserid()); sessionParams.put("srfpersonid", this.getUserid());
sessionParams.put("srfpersonname", this.getPersonname()); sessionParams.put("srfpersonname", this.getPersonname());
sessionParams.put("srforgsectorid", this.getMdeptid()); sessionParams.put("srforgsectorid", this.getMdeptid());
......
...@@ -3,7 +3,6 @@ package cn.ibizlab.util.security; ...@@ -3,7 +3,6 @@ package cn.ibizlab.util.security;
import io.jsonwebtoken.ExpiredJwtException; import io.jsonwebtoken.ExpiredJwtException;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.service.AuthenticationUserService; import cn.ibizlab.util.service.AuthenticationUserService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.context.SecurityContextHolder;
...@@ -22,6 +21,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -22,6 +21,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.util.*; import java.util.*;
import org.springframework.util.StringUtils;
@Slf4j @Slf4j
@Component @Component
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册