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

ibiz4j 发布系统代码 [ibz-ou,统一组织单位]

上级 b1f2f192
......@@ -1207,6 +1207,206 @@ mock.onPost(new RegExp(/^\/sysdeptmembers\/?([a-zA-Z0-9\-\;]{0,35})\/save$/)).re
return [status, data];
});
// SaveDeptMember
mock.onPost(new RegExp(/^\/sysorganizations\/([a-zA-Z0-9\-\;]{1,35})\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/)).reply((config: any) => {
console.groupCollapsed("实体:sysdeptmember 方法: SaveDeptMember");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['orgid','deptid','userid','memberid'];
const matchArray:any = new RegExp(/^\/sysorganizations\/([a-zA-Z0-9\-\;]{1,35})\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// SaveDeptMember
mock.onPost(new RegExp(/^\/sysorganizations\/([a-zA-Z0-9\-\;]{1,35})\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/)).reply((config: any) => {
console.groupCollapsed("实体:sysdeptmember 方法: SaveDeptMember");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['orgid','userid','memberid'];
const matchArray:any = new RegExp(/^\/sysorganizations\/([a-zA-Z0-9\-\;]{1,35})\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// SaveDeptMember
mock.onPost(new RegExp(/^\/sysorganizations\/([a-zA-Z0-9\-\;]{1,35})\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/)).reply((config: any) => {
console.groupCollapsed("实体:sysdeptmember 方法: SaveDeptMember");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['orgid','deptid','memberid'];
const matchArray:any = new RegExp(/^\/sysorganizations\/([a-zA-Z0-9\-\;]{1,35})\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// SaveDeptMember
mock.onPost(new RegExp(/^\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/)).reply((config: any) => {
console.groupCollapsed("实体:sysdeptmember 方法: SaveDeptMember");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['deptid','userid','memberid'];
const matchArray:any = new RegExp(/^\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// SaveDeptMember
mock.onPost(new RegExp(/^\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/)).reply((config: any) => {
console.groupCollapsed("实体:sysdeptmember 方法: SaveDeptMember");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['userid','memberid'];
const matchArray:any = new RegExp(/^\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// SaveDeptMember
mock.onPost(new RegExp(/^\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/)).reply((config: any) => {
console.groupCollapsed("实体:sysdeptmember 方法: SaveDeptMember");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['deptid','memberid'];
const matchArray:any = new RegExp(/^\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table({});
console.groupEnd();
console.groupEnd();
return [status, {}];
});
// SaveDeptMember
mock.onPost(new RegExp(/^\/sysdeptmembers\/?([a-zA-Z0-9\-\;]{0,35})\/savedeptmember$/)).reply((config: any) => {
console.groupCollapsed("实体:sysdeptmember 方法: SaveDeptMember");
console.table({url:config.url, method: config.method, data:config.data});
let status = MockAdapter.mockStatus(config);
if (status !== 200) {
return [status, null];
}
const paramArray:Array<any> = ['memberid'];
const matchArray:any = new RegExp(/^\/sysdeptmembers\/([a-zA-Z0-9\-\;]{1,35})\/savedeptmember$/).exec(config.url);
let tempValue: any = {};
if(matchArray && matchArray.length >1 && paramArray && paramArray.length >0){
paramArray.forEach((item: any, index: number) => {
Object.defineProperty(tempValue, item, {
enumerable: true,
value: matchArray[index + 1]
});
});
}
//let items = mockDatas ? mockDatas : [];
//let _items = items.find((item: any) => Object.is(item.memberid, tempValue.memberid));
let data = JSON.parse(config.data);
mockDatas.forEach((item)=>{
if(item['memberid'] == tempValue['memberid'] ){
for(let value in data){
if(item.hasOwnProperty(value)){
item[value] = data[value];
}
}
}
})
console.groupCollapsed("response数据 status: "+status+" data: ");
console.table(data);
console.groupEnd();
console.groupEnd();
return [status, data];
});
// FetchDefault
mock.onGet(new RegExp(/^\/sysorganizations\/([a-zA-Z0-9\-\;]{1,35})\/sysdepartments\/([a-zA-Z0-9\-\;]{1,35})\/sysemployees\/([a-zA-Z0-9\-\;]{1,35})\/sysdeptmembers\/fetchdefault$/)).reply((config: any) => {
......
......@@ -500,6 +500,62 @@ export default class SysDeptMemberServiceBase extends EntityService {
return res;
}
/**
* SaveDeptMember接口方法
*
* @param {*} [context={}]
* @param {*} [data={}]
* @param {boolean} [isloading]
* @returns {Promise<any>}
* @memberof SysDeptMemberServiceBase
*/
public async SaveDeptMember(context: any = {},data: any = {}, isloading?: boolean): Promise<any> {
if(context.sysorganization && context.sysdepartment && context.sysemployee && context.sysdeptmember){
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/sysorganizations/${context.sysorganization}/sysdepartments/${context.sysdepartment}/sysemployees/${context.sysemployee}/sysdeptmembers/${context.sysdeptmember}/savedeptmember`,data,isloading);
return res;
}
if(context.sysorganization && context.sysemployee && context.sysdeptmember){
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/sysorganizations/${context.sysorganization}/sysemployees/${context.sysemployee}/sysdeptmembers/${context.sysdeptmember}/savedeptmember`,data,isloading);
return res;
}
if(context.sysorganization && context.sysdepartment && context.sysdeptmember){
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/sysorganizations/${context.sysorganization}/sysdepartments/${context.sysdepartment}/sysdeptmembers/${context.sysdeptmember}/savedeptmember`,data,isloading);
return res;
}
if(context.sysdepartment && context.sysemployee && context.sysdeptmember){
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/sysdepartments/${context.sysdepartment}/sysemployees/${context.sysemployee}/sysdeptmembers/${context.sysdeptmember}/savedeptmember`,data,isloading);
return res;
}
if(context.sysemployee && context.sysdeptmember){
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/sysemployees/${context.sysemployee}/sysdeptmembers/${context.sysdeptmember}/savedeptmember`,data,isloading);
return res;
}
if(context.sysdepartment && context.sysdeptmember){
let masterData:any = {};
Object.assign(data,masterData);
let res:any = await Http.getInstance().post(`/sysdepartments/${context.sysdepartment}/sysdeptmembers/${context.sysdeptmember}/savedeptmember`,data,isloading);
return res;
}
let res:any = Http.getInstance().post(`/sysdeptmembers/${context.sysdeptmember}/savedeptmember`,data,isloading);
return res;
}
/**
* FetchDefault接口方法
*
......
......@@ -167,6 +167,22 @@ public class SysDeptMember extends EntityMP implements Serializable {
}
/**
* 获取 [标识]
*/
public String getMemberid() {
if(ObjectUtils.isEmpty(memberid)) {
memberid=(String)getDefaultKey(true);
}
return memberid;
}
@Override
public Serializable getDefaultKey(boolean gen) {
if((!ObjectUtils.isEmpty(this.getDeptid()))&&(!ObjectUtils.isEmpty(this.getUserid())))
return DigestUtils.md5DigestAsHex(String.format("%s||%s" ,this.getDeptid(),this.getUserid()).getBytes());
return null;
}
/**
* 复制当前对象数据到目标对象(粘贴重置)
* @param targetEntity 目标数据对象
......
......@@ -27,6 +27,13 @@ import cn.ibizlab.core.ou.domain.SysDepartment;
@Data
public class SysDepartmentSearchContext extends QueryWrapperContext<SysDepartment> {
private String n_deptid_in;//[部门标识]
public void setN_deptid_in(String n_deptid_in) {
this.n_deptid_in = n_deptid_in;
if(!ObjectUtils.isEmpty(this.n_deptid_in)){
this.getSearchCond().in("deptid",this.n_deptid_in.split(";"));
}
}
private String n_deptcode_like;//[部门代码]
public void setN_deptcode_like(String n_deptcode_like) {
this.n_deptcode_like = n_deptcode_like;
......@@ -47,6 +54,13 @@ public class SysDepartmentSearchContext extends QueryWrapperContext<SysDepartmen
if(!ObjectUtils.isEmpty(this.n_orgid_eq)){
this.getSearchCond().eq("orgid", n_orgid_eq);
}
}
private String n_orgid_in;//[单位]
public void setN_orgid_in(String n_orgid_in) {
this.n_orgid_in = n_orgid_in;
if(!ObjectUtils.isEmpty(this.n_orgid_in)){
this.getSearchCond().in("orgid",this.n_orgid_in.split(";"));
}
}
private String n_pdeptid_eq;//[上级部门]
public void setN_pdeptid_eq(String n_pdeptid_eq) {
......
......@@ -75,6 +75,13 @@ public class SysEmployeeSearchContext extends QueryWrapperContext<SysEmployee> {
if(!ObjectUtils.isEmpty(this.n_mdeptid_eq)){
this.getSearchCond().eq("mdeptid", n_mdeptid_eq);
}
}
private String n_mdeptid_in;//[主部门]
public void setN_mdeptid_in(String n_mdeptid_in) {
this.n_mdeptid_in = n_mdeptid_in;
if(!ObjectUtils.isEmpty(this.n_mdeptid_in)){
this.getSearchCond().in("mdeptid",this.n_mdeptid_in.split(";"));
}
}
private String n_mdeptname_like;//[主部门名称]
public void setN_mdeptname_like(String n_mdeptname_like) {
......@@ -96,6 +103,13 @@ public class SysEmployeeSearchContext extends QueryWrapperContext<SysEmployee> {
if(!ObjectUtils.isEmpty(this.n_postid_eq)){
this.getSearchCond().eq("postid", n_postid_eq);
}
}
private String n_postid_in;//[岗位标识]
public void setN_postid_in(String n_postid_in) {
this.n_postid_in = n_postid_in;
if(!ObjectUtils.isEmpty(this.n_postid_in)){
this.getSearchCond().in("postid",this.n_postid_in.split(";"));
}
}
private String n_postname_eq;//[岗位名称]
public void setN_postname_eq(String n_postname_eq) {
......@@ -117,6 +131,13 @@ public class SysEmployeeSearchContext extends QueryWrapperContext<SysEmployee> {
if(!ObjectUtils.isEmpty(this.n_orgid_eq)){
this.getSearchCond().eq("orgid", n_orgid_eq);
}
}
private String n_orgid_in;//[单位]
public void setN_orgid_in(String n_orgid_in) {
this.n_orgid_in = n_orgid_in;
if(!ObjectUtils.isEmpty(this.n_orgid_in)){
this.getSearchCond().in("orgid",this.n_orgid_in.split(";"));
}
}
private String n_orgcode_leftlike;//[单位代码]
public void setN_orgcode_leftlike(String n_orgcode_leftlike) {
......
......@@ -27,6 +27,13 @@ import cn.ibizlab.core.ou.domain.SysOrganization;
@Data
public class SysOrganizationSearchContext extends QueryWrapperContext<SysOrganization> {
private String n_orgid_in;//[单位标识]
public void setN_orgid_in(String n_orgid_in) {
this.n_orgid_in = n_orgid_in;
if(!ObjectUtils.isEmpty(this.n_orgid_in)){
this.getSearchCond().in("orgid",this.n_orgid_in.split(";"));
}
}
private String n_orgid_like;//[单位标识]
public void setN_orgid_like(String n_orgid_like) {
this.n_orgid_like = n_orgid_like;
......
......@@ -36,6 +36,7 @@ public interface ISysDeptMemberService extends IService<SysDeptMember> {
boolean checkKey(SysDeptMember et);
boolean save(SysDeptMember et);
void saveBatch(List<SysDeptMember> list);
SysDeptMember saveDeptMember(SysDeptMember et);
Page<SysDeptMember> searchDefault(SysDeptMemberSearchContext context);
List<SysDeptMember> selectByDeptid(String deptid);
void removeByDeptid(String deptid);
......
......@@ -57,6 +57,10 @@ public class SysDeptMemberServiceImpl extends ServiceImpl<SysDeptMemberMapper, S
@Autowired
@Lazy
protected cn.ibizlab.core.ou.service.ISysPostService syspostService;
@Autowired
@Lazy
protected cn.ibizlab.core.ou.service.logic.ISysDeptMembersaveDeptMemberLogic savedeptmemberLogic;
@Autowired
@Lazy
ISysDeptMemberService proxyService;
......@@ -78,7 +82,7 @@ public class SysDeptMemberServiceImpl extends ServiceImpl<SysDeptMemberMapper, S
@Transactional
public void createBatch(List<SysDeptMember> list) {
list.forEach(item->fillParentData(item));
this.saveBatch(list, batchSize);
this.saveOrUpdateBatch(list,batchSize);
}
@Override
......@@ -197,6 +201,13 @@ public class SysDeptMemberServiceImpl extends ServiceImpl<SysDeptMemberMapper, S
}
}
@Override
@Transactional
public SysDeptMember saveDeptMember(SysDeptMember et) {
savedeptmemberLogic.execute(et);
return et ;
}
@Override
public List<SysDeptMember> selectByDeptid(String deptid) {
......
package cn.ibizlab.core.ou.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.core.ou.domain.SysDeptMember;
/**
* 关系型数据实体[saveDeptMember] 对象
*/
public interface ISysDeptMembersaveDeptMemberLogic {
void execute(SysDeptMember et) ;
}
package cn.ibizlab.core.ou.service.logic.impl;
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.core.ou.service.logic.ISysDeptMembersaveDeptMemberLogic;
import cn.ibizlab.core.ou.domain.SysDeptMember;
/**
* 关系型数据实体[saveDeptMember] 对象
*/
@Slf4j
@Service
public class SysDeptMembersaveDeptMemberLogicImpl implements ISysDeptMembersaveDeptMemberLogic {
@Autowired
private KieContainer kieContainer;
@Autowired
private cn.ibizlab.core.ou.service.ISysDeptMemberService sysdeptmemberservice;
public cn.ibizlab.core.ou.service.ISysDeptMemberService getSysdeptmemberService() {
return this.sysdeptmemberservice;
}
@Autowired
private cn.ibizlab.core.ou.service.ISysDeptMemberService iBzSysDefaultService;
public cn.ibizlab.core.ou.service.ISysDeptMemberService getIBzSysDefaultService() {
return this.iBzSysDefaultService;
}
@Override
public void execute(SysDeptMember et) {
KieSession kieSession = null;
try {
kieSession = kieContainer.newKieSession();
kieSession.insert(et);
kieSession.setGlobal("sysdeptmembersavedeptmemberdefault", et);
kieSession.setGlobal("sysdeptmemberservice", sysdeptmemberservice);
kieSession.setGlobal("iBzSysSysdeptmemberDefaultService", iBzSysDefaultService);
kieSession.setGlobal("curuser", cn.ibizlab.util.security.AuthenticationUser.getAuthenticationUser());
kieSession.startProcess("cn.ibizlab.core.ou.service.logic.sysdeptmembersavedeptmember");
} catch (Exception e) {
throw new RuntimeException("执行[保存部门成员]处理逻辑发生异常" + e);
} finally {
if(kieSession != null) {
kieSession.destroy();
}
}
}
}
package cn.ibizlab.core.util.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.rocketmq.client.consumer.DefaultMQPushConsumer;
import com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import com.alibaba.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
import com.alibaba.rocketmq.client.consumer.listener.MessageListenerConcurrently;
import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import com.alibaba.rocketmq.common.message.MessageExt;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
import java.util.List;
@Slf4j
@Configuration
public class RocketMQConfig {
@Bean("SysEmployeedeleteSysUserproducer")
public DefaultMQProducer sysEmployeedeleteSysUserproducer(){
DefaultMQProducer producer = null;
try{
producer= new DefaultMQProducer();
producer.setSendMsgTimeout(6000);
producer.setNamesrvAddr("127.0.0.1:9876");
producer.setInstanceName("rmq-instance");
}
catch(Exception e){
log.error("初始化消息发送对象异常!");
}
return producer;
}
@Bean("SysEmployeesaveSysUserproducer")
public DefaultMQProducer sysEmployeesaveSysUserproducer(){
DefaultMQProducer producer = null;
try{
producer= new DefaultMQProducer();
producer.setSendMsgTimeout(6000);
producer.setNamesrvAddr("127.0.0.1:9876");
producer.setInstanceName("rmq-instance");
}
catch(Exception e){
log.error("初始化消息发送对象异常!");
}
return producer;
}
@Autowired
@Lazy
cn.ibizlab.core.ou.service.ISysDeptMemberService SysDeptMemberService;
@Bean("SysDeptMembersaveDeptMemberconsumer")
public DefaultMQPushConsumer sysDeptMembersaveDeptMemberconsumer(){
DefaultMQPushConsumer consumer = null;
try {
consumer = new DefaultMQPushConsumer();
consumer.setNamesrvAddr("127.0.0.1:9876");
consumer.setInstanceName("rmq-instance");
consumer.subscribe("saveSysUser", "saveSysUser");
consumer.registerMessageListener(new MessageListenerConcurrently() {
public ConsumeConcurrentlyStatus consumeMessage(
List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
for (MessageExt msg : msgs) {
cn.ibizlab.core.ou.domain.SysDeptMember domain = JSON.parseObject(new String(msg.getBody()),cn.ibizlab.core.ou.domain.SysDeptMember.class);
SysDeptMemberService.saveDeptMember(domain);
}
return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
}
});
consumer.start();
}catch (Exception e){
log.error("初始化消息接收对象异常!");
}
return consumer;
}
}
......@@ -4,7 +4,7 @@
<!--输出实体[SYS_DEPT]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_dept-60-1">
<changeSet author="a_A_5d9d78509" id="tab-sys_dept-62-1">
<createTable tableName="IBZDEPT">
<column name="DEPTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_DEPT_DEPTID"/>
......@@ -42,7 +42,7 @@
<!--输出实体[SYS_DEPTMEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_deptmember-29-2">
<changeSet author="a_A_5d9d78509" id="tab-sys_deptmember-33-2">
<createTable tableName="IBZDEPTMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_DEPTMEMBER_MEMBERID"/>
......@@ -60,7 +60,7 @@
<!--输出实体[SYS_EMP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_emp-78-3">
<changeSet author="a_A_5d9d78509" id="tab-sys_emp-83-3">
<createTable tableName="IBZEMP">
<column name="USERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_EMP_USERID"/>
......@@ -140,7 +140,7 @@
<!--输出实体[SYS_ORG]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_org-35-4">
<changeSet author="a_A_5d9d78509" id="tab-sys_org-36-4">
<createTable tableName="IBZORG">
<column name="ORGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ORG_ORGID"/>
......@@ -221,34 +221,34 @@
</changeSet>
<!--输出实体[SYS_DEPT]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_dept-60-8">
<changeSet author="a_A_5d9d78509" id="fk-sys_dept-62-8">
<addForeignKeyConstraint baseColumnNames="PDEPTID" baseTableName="IBZDEPT" constraintName="DER1N_SYS_DEPT_SYS_DEPT_PDEPTI" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-sys_dept-60-9">
<changeSet author="a_A_5d9d78509" id="fk-sys_dept-62-9">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZDEPT" constraintName="DER1N_SYS_DEPT_SYS_ORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[SYS_DEPTMEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-29-10">
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-33-10">
<addForeignKeyConstraint baseColumnNames="DEPTID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_SYS_DEPTMEMBER_SYS_DEPT_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-29-11">
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-33-11">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_SYS_DEPTMEMBER_SYS_EMP_U" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="USERID" referencedTableName="IBZEMP" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-29-12">
<changeSet author="a_A_5d9d78509" id="fk-sys_deptmember-33-12">
<addForeignKeyConstraint baseColumnNames="POSTID" baseTableName="IBZDEPTMEMBER" constraintName="DER1N_SYS_DEPTMEMBER_SYS_POST_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="POSTID" referencedTableName="IBZPOST" validate="true"/>
</changeSet>
<!--输出实体[SYS_EMP]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-78-13">
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-83-13">
<addForeignKeyConstraint baseColumnNames="MDEPTID" baseTableName="IBZEMP" constraintName="DER1N_SYS_EMP_SYS_DEPT_MDEPTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-78-14">
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-83-14">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZEMP" constraintName="DER1N_SYS_EMP_SYS_ORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-78-15">
<changeSet author="a_A_5d9d78509" id="fk-sys_emp-83-15">
<addForeignKeyConstraint baseColumnNames="POSTID" baseTableName="IBZEMP" constraintName="DER1N_SYS_EMP_SYS_POST_POSTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="POSTID" referencedTableName="IBZPOST" validate="true"/>
</changeSet>
<!--输出实体[SYS_ORG]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_org-35-16">
<changeSet author="a_A_5d9d78509" id="fk-sys_org-36-16">
<addForeignKeyConstraint baseColumnNames="PORGID" baseTableName="IBZORG" constraintName="DER1N_SYS_ORG_SYS_ORG_PORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[SYS_POST]外键关系 -->
......
......@@ -16,7 +16,7 @@
"delogicname":"部门成员",
"sysmoudle":{"id":"OU","name":"ou"},
"dedataset":[{"id":"Default" , "name":"DEFAULT"}],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" }],
"deaction":[{"id":"Create" , "name":"Create" , "type":"BUILTIN" },{"id":"Update" , "name":"Update" , "type":"BUILTIN" },{"id":"Remove" , "name":"Remove" , "type":"BUILTIN" },{"id":"Get" , "name":"Get" , "type":"BUILTIN" },{"id":"GetDraft" , "name":"GetDraft" , "type":"BUILTIN" },{"id":"CheckKey" , "name":"CheckKey" , "type":"BUILTIN" },{"id":"Save" , "name":"Save" , "type":"BUILTIN" },{"id":"SaveDeptMember" , "name":"保存部门成员" , "type":"DELOGIC" }],
"datascope":[{"id":"all","name":"全部数据"}]
}
, {
......
package cn.ibizlab.ou.logic.sysdeptmemberlogic.savedeptmember;
import java.util.Map;
import java.util.HashMap;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
import org.springframework.util.ObjectUtils;
import cn.ibizlab.util.errors.BadRequestAlertException;
global cn.ibizlab.core.ou.domain.SysDeptMember sysdeptmembersavedeptmemberdefault;
global cn.ibizlab.core.ou.service.ISysDeptMemberService sysdeptmemberservice;
global cn.ibizlab.core.ou.service.ISysDeptMemberService iBzSysSysdeptmemberDefaultService;
global cn.ibizlab.util.security.AuthenticationUser curuser;
no-loop
//逻辑处理节点[开始]
rule "begin"
ruleflow-group "sysdeptmembersavedeptmemberbegin"
when
then
end
//逻辑处理节点[准备sysuser参数]
rule "prepareparam1"
ruleflow-group "sysdeptmembersavedeptmemberprepareparam1"
when
then
update(sysdeptmembersavedeptmemberdefault);//更新fact中变量值
end
//逻辑处理节点[保存部门用户]
rule "deaction1"
ruleflow-group "sysdeptmembersavedeptmemberdeaction1"
when
then
sysdeptmemberservice.save(sysdeptmembersavedeptmemberdefault);
update(sysdeptmembersavedeptmemberdefault);//更新fact中变量值
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.core.ou.service.logic.sysdeptmembersavedeptmember" isClosed="false" isExecutable="true" name="ScoreRule" processType="Private" tns:packageName="cn.ibizlab.core.ou.service.logic.sysdeptmembersavedeptmember">
<extensionElements>
<tns:import name="java.util.Map" />
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
<tns:global identifier="sysdeptmembersavedeptmemberdefault" type="cn.ibizlab.core.ou.domain.SysDeptMember" />
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="sysdeptmembersavedeptmemberprepareparam1" id="prepareparam1" implementation="http://www.jboss.org/drools/rule" name="准备sysUser参数"/>
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="sysdeptmembersavedeptmemberdeaction1" id="deaction1" implementation="http://www.jboss.org/drools/rule" name="保存部门用户"/>
<endEvent id="deaction1_end" name="end"/>
<sequenceFlow id="deaction1_end_line" sourceRef="deaction1" targetRef="deaction1_end"/>
<sequenceFlow id="prepareparam1_deaction1" sourceRef="prepareparam1" targetRef="deaction1">
</sequenceFlow>
<sequenceFlow id="gateway-begin_prepareparam1" sourceRef="gateway-begin" targetRef="prepareparam1">
<conditionExpression language="http://www.jboss.org/drools/rule" ><![CDATA[
$sysdeptmembersavedeptmemberdefault:SysDeptMember();
eval($sysdeptmembersavedeptmemberdefault==sysdeptmembersavedeptmemberdefault);
eval((RuleUtils.test($sysdeptmembersavedeptmemberdefault.get("mdeptid"),"ISNOTNULL",""))&&(RuleUtils.test($sysdeptmembersavedeptmemberdefault.get("userid"),"ISNOTNULL","")))
]]>
</conditionExpression>
</sequenceFlow>
<exclusiveGateway id="gateway-begin" name="Gateway" gatewayDirection="Diverging" default="gateway-begin_end_line"></exclusiveGateway>
<sequenceFlow id="begin_gateway-begin_gatewayline" sourceRef="begin" targetRef="gateway-begin"></sequenceFlow>
<sequenceFlow id="gateway-begin_end_line" sourceRef="gateway-begin" targetRef="gateway-begin_end"/>
<endEvent id="gateway-begin_end" name="end"/>
</process>
</definitions>
......@@ -342,6 +342,7 @@
"data_type":"VARCHAR",
"data_length":100,
"key_field":0,
"union_key":"KEY1",
"show_order":2,
"major_field":0
},
......@@ -378,6 +379,7 @@
"data_type":"VARCHAR",
"data_length":100,
"key_field":0,
"union_key":"KEY2",
"show_order":4,
"major_field":0
},
......
......@@ -85,6 +85,7 @@
<oracle.version>19.8.0.0</oracle.version>
<postgresql.version>42.2.6</postgresql.version>
<rocketmq.version>4.7.0</rocketmq.version>
</properties>
......@@ -261,6 +262,11 @@
<version>${baomidou-jobs.version}</version>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-client</artifactId>
<version>${rocketmq.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
......
package cn.ibizlab.util.aspect;
import com.alibaba.fastjson.JSON;
import com.alibaba.rocketmq.client.producer.DefaultMQProducer;
import com.alibaba.rocketmq.common.message.Message;
import lombok.extern.slf4j.Slf4j;
import cn.ibizlab.util.domain.EntityBase;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Lazy;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.List;
/**
* rocketMQ消息切面
*/
@Aspect
@Component
@Slf4j
public class RocketMQAspect
{
private final ExpressionParser parser = new SpelExpressionParser();
@Autowired
@Qualifier("SysEmployeedeleteSysUserproducer")
@Lazy
DefaultMQProducer SysEmployeedeleteSysUserproducer;
@AfterReturning(value = "(execution(* cn.ibizlab.core.*.service.*SysEmployee*.create*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.update*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.save*(..)) ||execution(* cn.ibizlab.core.*.service.*SysEmployee*.remove*(..))) && !execution(* cn.ibizlab.core.es.service.*.create*(..)) && !execution(* cn.ibizlab.core.es.service.*.update*(..)) && !execution(* cn.ibizlab.core.es.service.*.save*(..)) && !execution(* cn.ibizlab.core.es.service.*.remove*(..))")
@Async
public void sysEmployeedeleteSysUserproducer(JoinPoint point) {
sendMsg(SysEmployeedeleteSysUserproducer, "deleteSysUser", "deleteSysUser", getEntity(point));
}
@Autowired
@Qualifier("SysEmployeesaveSysUserproducer")
@Lazy
DefaultMQProducer SysEmployeesaveSysUserproducer;
@AfterReturning(value = "(execution(* cn.ibizlab.core.*.service.*SysEmployee*.create*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.update*(..))||execution(* cn.ibizlab.core.*.service.*SysEmployee*.save*(..)) ||execution(* cn.ibizlab.core.*.service.*SysEmployee*.remove*(..))) && !execution(* cn.ibizlab.core.es.service.*.create*(..)) && !execution(* cn.ibizlab.core.es.service.*.update*(..)) && !execution(* cn.ibizlab.core.es.service.*.save*(..)) && !execution(* cn.ibizlab.core.es.service.*.remove*(..))")
@Async
public void sysEmployeesaveSysUserproducer(JoinPoint point) {
sendMsg(SysEmployeesaveSysUserproducer, "saveSysUser", "saveSysUser", getEntity(point));
}
/**
* 输出过滤行为
* @param point
* @param actionName
*/
private void outputAction(JoinPoint point,String actionName) {
Object [] args = point.getArgs();
if(ObjectUtils.isEmpty(args) || args.length==0) {
return;
}
Object arg = args[0];
Object service = point.getTarget();
EvaluationContext serviceCtx = new StandardEvaluationContext();
serviceCtx.setVariable("service", service);
serviceCtx.setVariable("arg", arg);
Expression serviceExp = parser.parseExpression(String.format("#service.%s(#arg)", actionName));
serviceExp.getValue(serviceCtx);
}
/**
* 获取实体对象
* @param point
* @return
*/
private Object getEntity(JoinPoint point) {
Object entity=null;
String action=point.getSignature().getName();
Object [] args = point.getArgs();
if(ObjectUtils.isEmpty(args) || args.length==0 || StringUtils.isEmpty(action)) {
return entity;
}
Object arg=args[0];
if(arg instanceof EntityBase || arg instanceof List) {
return arg;
}
else {
return null;
}
}
/**
* 发送消息
* @param producer
* @param topic
* @param tag
* @param body
*/
private void sendMsg(DefaultMQProducer producer, String topic, String tag, Object body) {
if(ObjectUtils.isEmpty(body)) {
log.error("发送消息失败,无法获取到要发送的消息内容!");
return;
}
try {
producer.start();
Message message = new Message(topic, tag, JSON.toJSONString(body).getBytes());
producer.send(message);
producer.shutdown();
} catch (Exception e) {
log.error("消息发送异常,"+e);
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册