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

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

上级 fe0e498f
......@@ -52,6 +52,7 @@ import CodeListService from "@/codelist/codelist-service";
import EntityService from '@/service/entity-service';
import { Vue, Component, Prop, Provide, Emit, Watch } from 'vue-property-decorator';
import { Environment } from '@/environments/environment';
import moment from "moment";
@Component({
})
......@@ -395,11 +396,11 @@ export default class AppDataUploadView extends Vue {
let reader = new FileReader();
reader.onload = (e:any) => {
let data = e.target.result;
this.workBookData = XLSX.read(data, {type: 'binary'});
this.workBookData = XLSX.read(data, {type: 'binary',cellDates: true});
let xlsxData = XLSX.utils.sheet_to_json(this.workBookData.Sheets[this.workBookData.SheetNames[0]]);
let list1 = this.getFirstRow(this.workBookData);
xlsxData = this.AddXlsxData(xlsxData, list1);
this.importDataArray = JSON.parse(JSON.stringify(xlsxData));
this.importDataArray = this.$util.deepCopy(xlsxData);
(this.$refs.inputUpLoad as any).value = '';
};
reader.readAsBinaryString(f);
......@@ -505,6 +506,11 @@ export default class AppDataUploadView extends Vue {
data.forEach((item:any) =>{
let curObject:any = {};
Object.keys(item).forEach((ele:any) => {
// todo XLSX读取时间为国际时间(东8区)+8H转为标准时间
if (item[ele] instanceof Date){
const tempDate:Date = item[ele];
item[ele] = moment(tempDate).add(8, 'h').format("YYYY-MM-DD HH:mm:ss");
}
if(this.allFieldMap.get(ele).codelist){
let codelistTag:string = this.allFieldMap.get(ele).codelist.tag;
let codelistIsNumber:boolean = this.allFieldMap.get(ele).codelist.isnumber;
......
......@@ -84,140 +84,142 @@
</template>
<script lang="ts">
import {Vue, Component, Prop, Model, Emit} from "vue-property-decorator";
import {Subject} from "rxjs";
import {Environment} from '@/environments/environment';
import moment from 'moment';
import {Vue, Component, Prop, Model, Emit} from "vue-property-decorator";
import {Environment} from '@/environments/environment';
import moment from 'moment';
@Component({})
export default class AppMessagePopover extends Vue {
@Component({})
export default class AppMessagePopover extends Vue {
// 是否显示小圆点
public showIsDot: any = false;
// 默认显示的tab页
public default_tab_pane: any = "first";
// 待办列表
public myTasks: any = [];
// 待办面板标签
public myTasksLabel: any = "待办";
// 待办面板显示条数
public taskShowCnt:number = 0;
// 消息列表
public myMsgs: any = [];
// 消息面板标签
public myMsgsLabel: any = "消息";
// 信息面板显示条数
public msgShowCnt:number = 0;
// 是否显示小圆点
public showIsDot: any = false;
// 默认显示的tab页
public default_tab_pane: any = "first";
// 待办列表
public myTasks: any = [];
// 待办面板标签
public myTasksLabel: any = "待办";
// 待办面板显示条数
public taskShowCnt:number = 0;
// 消息列表
public myMsgs: any = [];
// 消息面板标签
public myMsgsLabel: any = "消息";
// 信息面板显示条数
public msgShowCnt:number = 0;
/**
* vue创建
*/
created(): void {}
/**
* vue创建
*/
created(): void {}
/**
* vue挂载
*/
mounted(): void {
// 首次获取待办列表
this.getMyTasks();
// 定时器:每隔1分钟重新获取待办列表
const timer = setInterval(()=>{
this.getMyTasks();
},60000);
// 监听定时器,在vue销毁前清除定时器
this.$once('hook:beforeDestroy',()=>{
// 清除定时器
clearInterval(timer);
});
/**
* vue挂载
*/
mounted(): void {
if(!Environment.workflow){
return;
}
// 首次获取待办列表
this.getMyTasks();
// 定时器:每隔1分钟重新获取待办列表
const timer = setInterval(()=>{
this.getMyTasks();
},60000);
// 监听定时器,在vue销毁前清除定时器
this.$once('hook:beforeDestroy',()=>{
// 清除定时器
clearInterval(timer);
});
}
/**
* 获取待办列表
*/
public getMyTasks() {
let url: any = '/wfcore/mytasks';
this.$http.get(url).then((response: any) => {
if (response && response.status == 200) {
const data: any = response.data;
if (data && data.length > 0) {
this.myTasks = data;
this.showIsDot = true;
} else {
this.myTasks = [];
}
// 获取消息列表
this.getMyMsgs();
/**
* 获取待办列表
*/
public getMyTasks() {
let url: any = '/wfcore/mytasks';
this.$http.get(url).then((response: any) => {
if (response && response.status == 200) {
const data: any = response.data;
if (data && data.length > 0) {
this.myTasks = data;
this.showIsDot = true;
} else {
this.myTasks = [];
}
}).catch((error: any) => {
console.warn("加载数据错误");
})
}
/**
* 获取消息列表
*/
public getMyMsgs(){
// TODO:接口获取消息列表,这里用的待办数据
this.myMsgs = this.myTasks;
if (this.myMsgs.length > 0 && this.myTasks.length == 0) {
// 显示小圆点
this.showIsDot = true;
// 获取消息列表
this.getMyMsgs();
}
}
}).catch((error: any) => {
console.warn("加载数据错误");
})
}
/**
* 点击标签事件
*/
public handleTag(data: any) {
if (!data) return this.$message.error("未获取到标签内容");
// 拼接要打开的窗口地址
const baseUrl:any = Environment.BaseUrl;
const openUrl:any = baseUrl + `/wfcore/mytasks/${data.processDefinitionKey}/web/${data.processInstanceBusinessKey}/usertasks/${data.taskDefinitionKey}`;
// 打开新窗口
window.open(openUrl,'_blank');
/**
* 获取消息列表
*/
public getMyMsgs(){
// TODO:接口获取消息列表,这里用的待办数据
this.myMsgs = this.myTasks;
if (this.myMsgs.length > 0 && this.myTasks.length == 0) {
// 显示小圆点
this.showIsDot = true;
}
}
/**
* 销毁之前
*/
beforeDestroy(): void {
// 清空数据
this.showIsDot = false;
this.myTasks = [];
this.myMsgs = [];
}
/**
* 点击标签事件
*/
public handleTag(data: any) {
if (!data) return this.$message.error("未获取到标签内容");
// 拼接要打开的窗口地址
const baseUrl:any = Environment.BaseUrl;
const openUrl:any = baseUrl + `/wfcore/mytasks/${data.processDefinitionKey}/web/${data.processInstanceBusinessKey}/usertasks/${data.taskDefinitionKey}`;
// 打开新窗口
window.open(openUrl,'_blank');
}
/**
* 时间格式转换
*/
public formatDate(date: string, format: string) {
if(date && format) {
return moment(date).format(format);
}
return date;
}
/**
* 销毁之前
*/
beforeDestroy(): void {
// 清空数据
this.showIsDot = false;
this.myTasks = [];
this.myMsgs = [];
}
/**
* 加载更多
*/
public showMore(cnt: string) {
if(Object.is('taskShowCnt', cnt)) {
this.taskShowCnt + 10 < this.myTasks.length ? this.taskShowCnt += 10 : this.taskShowCnt += this.myTasks.length-this.taskShowCnt;
}
if(Object.is('msgShowCnt', cnt)) {
this.msgShowCnt + 10 < this.myMsgs.length ? this.msgShowCnt += 10 : this.msgShowCnt += this.myMsgs.length-this.msgShowCnt;
}
/**
* 时间格式转换
*/
public formatDate(date: string, format: string) {
if(date && format) {
return moment(date).format(format);
}
return date;
}
/**
* 弹出框 显示/隐藏 时显示条数初始化
*/
public initTabCnt() {
this.taskShowCnt = this.myTasks.length >= 10 ? 10 : this.myTasks.length;
this.msgShowCnt = this.myMsgs.length >= 10 ? 10 : this.myMsgs.length;
/**
* 加载更多
*/
public showMore(cnt: string) {
if(Object.is('taskShowCnt', cnt)) {
this.taskShowCnt + 10 < this.myTasks.length ? this.taskShowCnt += 10 : this.taskShowCnt += this.myTasks.length-this.taskShowCnt;
}
if(Object.is('msgShowCnt', cnt)) {
this.msgShowCnt + 10 < this.myMsgs.length ? this.msgShowCnt += 10 : this.msgShowCnt += this.myMsgs.length-this.msgShowCnt;
}
}
/**
* 弹出框 显示/隐藏 时显示条数初始化
*/
public initTabCnt() {
this.taskShowCnt = this.myTasks.length >= 10 ? 10 : this.myTasks.length;
this.msgShowCnt = this.myMsgs.length >= 10 ? 10 : this.myMsgs.length;
}
}
</script>
<style lang='less'>
......
......@@ -12,8 +12,8 @@
:filterable="filterable"
@on-open-change="onClick"
:placeholder="placeholder?placeholder:$t('components.dropDownListMpicker.placeholder')">
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value.toString()" :label="item.text">
<Checkbox :value = "(currentVal.indexOf(item.value.toString()))==-1?false:true">
<i-option v-for="(item, index) in items" :key="index" :class="item.class" :value="item.value ? item.value.toString():''" :label="item.text">
<Checkbox :value="(currentVal.indexOf(item.value ? item.value.toString() : '')) == -1 ? false : true">
{{Object.is(codelistType,'STATIC') ? $t('codelist.'+tag+'.'+item.value) : item.text}}
</Checkbox>
</i-option>
......
......@@ -394,7 +394,9 @@ export default class DropDownList extends Vue {
if(type === 'number'){
item.value = item.value.toString();
}else{
if(item.value.indexOf('.') == -1){
if(type == "null") {
this.valueType == "number" ? item.value = 0 : item.value = '';
}else if(item.value.indexOf('.') == -1){
item.value = parseInt(item.value);
}else{
item.value = parseFloat(item.value);
......
......@@ -45,6 +45,8 @@ export const Environment = {
ibizlabtUrl: 'https://www.ibizlab.cn',
// ibiz论坛地址
ibizbbstUrl: 'https://bbs.ibizlab.cn',
// 是否启用工作流
workflow: false,
};
// 挂载外部配置文件
if ((window as any).Environment) {
......
......@@ -6,6 +6,7 @@
}
.sys-department-tree-exp-view{
position: relative;
height: 100%;
}
......@@ -6,6 +6,7 @@
}
.sys-organization-tree-exp-view{
position: relative;
height: 100%;
}
......@@ -144,7 +144,7 @@
<i-col v-show="detailsModel.createdate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createdate' :itemRules="this.rules().createdate" class='' :caption="$t('entities.sysdepartment.main_form.details.createdate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createdate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createdate' :value="data.createdate" dataType="DATETIME" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
<app-span name='createdate' :value="data.createdate" dataType="DATETIME" unitName="" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
:data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
......@@ -154,7 +154,7 @@
<i-col v-show="detailsModel.updatedate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updatedate' :itemRules="this.rules().updatedate" class='' :caption="$t('entities.sysdepartment.main_form.details.updatedate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updatedate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updatedate' :value="data.updatedate" dataType="DATETIME" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
<app-span name='updatedate' :value="data.updatedate" dataType="DATETIME" unitName="" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
:data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
......
......@@ -102,7 +102,7 @@
<i-col v-show="detailsModel.createdate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='createdate' :itemRules="this.rules().createdate" class='' :caption="$t('entities.sysorganization.main_form.details.createdate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.createdate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='createdate' :value="data.createdate" dataType="DATETIME" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
<app-span name='createdate' :value="data.createdate" dataType="DATETIME" unitName="" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
:data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
......@@ -112,7 +112,7 @@
<i-col v-show="detailsModel.updatedate.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='updatedate' :itemRules="this.rules().updatedate" class='' :caption="$t('entities.sysorganization.main_form.details.updatedate')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.updatedate.error" :isEmptyCaption="false" labelPos="LEFT">
<app-span name='updatedate' :value="data.updatedate" dataType="DATETIME" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
<app-span name='updatedate' :value="data.updatedate" dataType="DATETIME" unitName="" valueFormat="%1$tY-%1$tm-%1$td %1$tH:%1$tM:%1$tS" :precision="0"
:data="data" :context="context" :viewparams="viewparams" :localContext ='{ }' :localParam ='{ }' style="">
</app-span>
......
......@@ -58,10 +58,6 @@ public class SysDeptMemberServiceImpl extends ServiceImpl<SysDeptMemberMapper, S
@Lazy
protected cn.ibizlab.core.ou.service.ISysPostService syspostService;
@Autowired
@Lazy
protected cn.ibizlab.core.ou.service.logic.ISysDeptMembersaveDeptMemberLogic savedeptmemberLogic;
protected int batchSize = 500;
@Override
......@@ -201,7 +197,6 @@ public class SysDeptMemberServiceImpl extends ServiceImpl<SysDeptMemberMapper, S
@Override
@Transactional
public SysDeptMember saveDeptMember(SysDeptMember et) {
savedeptmemberLogic.execute(et);
return et ;
}
......
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] 对象
*/
@Deprecated
public interface ISysDeptMembersaveDeptMemberLogic {
void execute(SysDeptMember et) ;
}
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.SysEmployee;
/**
* 关系型数据实体[saveDeptMember] 对象
*/
@Deprecated
public interface ISysEmployeesaveDeptMemberLogic {
void execute(SysEmployee 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;
@Deprecated
public class SysDeptMembersaveDeptMemberLogicImpl{
/**
* 关系型数据实体[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.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.ISysEmployeesaveDeptMemberLogic;
import cn.ibizlab.core.ou.domain.SysEmployee;
@Deprecated
public class SysEmployeesaveDeptMemberLogicImpl{
/**
* 关系型数据实体[saveDeptMember] 对象
*/
@Slf4j
@Service
public class SysEmployeesaveDeptMemberLogicImpl implements ISysEmployeesaveDeptMemberLogic {
@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.ISysEmployeeService iBzSysDefaultService;
public cn.ibizlab.core.ou.service.ISysEmployeeService getIBzSysDefaultService() {
return this.iBzSysDefaultService;
}
@Override
public void execute(SysEmployee et) {
KieSession kieSession = null;
try {
kieSession = kieContainer.newKieSession();
kieSession.insert(et);
kieSession.setGlobal("sysemployeesavedeptmemberdefault", et);
cn.ibizlab.core.ou.domain.SysDeptMember sysemployeesavedeptmembermember = new cn.ibizlab.core.ou.domain.SysDeptMember();
kieSession.insert(sysemployeesavedeptmembermember);
kieSession.setGlobal("sysemployeesavedeptmembermember", sysemployeesavedeptmembermember);
kieSession.setGlobal("sysdeptmemberservice", sysdeptmemberservice);
kieSession.setGlobal("iBzSysSysemployeeDefaultService", iBzSysDefaultService);
kieSession.setGlobal("curuser", cn.ibizlab.util.security.AuthenticationUser.getAuthenticationUser());
kieSession.startProcess("cn.ibizlab.core.ou.service.logic.sysemployeesavedeptmember");
} catch (Exception e) {
throw new RuntimeException("执行[保存人事关系]处理逻辑发生异常" + e);
} finally {
if(kieSession != null) {
kieSession.destroy();
}
}
}
}
package cn.ibizlab.core.util.config;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.*;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;
import org.kie.internal.io.ResourceFactory;
import org.kie.spring.KModuleBeanFactoryPostProcessor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.io.IOException;
import java.util.List;
@Configuration
public class DroolsAutoConfiguration {
private Log logger= LogFactory.getLog(DroolsAutoConfiguration.class);
private static final String RULES_PATH = "rules/";
@Bean
@ConditionalOnMissingBean(KieFileSystem.class)
public KieFileSystem kieFileSystem() throws IOException {
KieFileSystem kieFileSystem = getKieServices().newKieFileSystem();
for (Resource file : getRuleFiles()) {
kieFileSystem.write(ResourceFactory.newUrlResource(file.getURL()));
}
return kieFileSystem;
}
private Resource[] getRuleFiles() throws IOException {
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
return resourcePatternResolver.getResources("classpath*:" + RULES_PATH + "**/*.*");
}
@Bean
@ConditionalOnMissingBean(KieContainer.class)
public KieContainer kieContainer() throws IOException {
final KieRepository kieRepository = getKieServices().getRepository();
kieRepository.addKieModule(new KieModule() {
public ReleaseId getReleaseId() {
return kieRepository.getDefaultReleaseId();
}
});
KieBuilder kieBuilder = getKieServices().newKieBuilder(kieFileSystem());
kieBuilder.buildAll();
if(kieBuilder.getResults().hasMessages(new Message.Level[] { Message.Level.ERROR })){
List<Message> errors = kieBuilder.getResults().getMessages(new Message.Level[] { Message.Level.ERROR });
StringBuilder stringBuilder = new StringBuilder("Errors:");
for (Message msg : errors)
{
stringBuilder.append(new StringBuilder().append("\n ").append(prettyBuildMessage(msg)).toString());
}
logger.error(String.format("初始化处理逻辑发生异常,异常原因为[%s]",stringBuilder.toString()));
//忽略处理逻辑
getKieServices().newKieBuilder(getKieServices().newKieFileSystem()).buildAll();
}
return getKieServices().newKieContainer(kieRepository.getDefaultReleaseId());
}
private KieServices getKieServices() {
return KieServices.Factory.get();
}
@Bean
@ConditionalOnMissingBean(KieBase.class)
public KieBase kieBase() throws IOException {
return kieContainer().getKieBase();
}
@Bean
@ConditionalOnMissingBean(KieSession.class)
public KieSession kieSession() throws IOException {
return kieContainer().newKieSession();
}
@Bean
@ConditionalOnMissingBean(KModuleBeanFactoryPostProcessor.class)
public KModuleBeanFactoryPostProcessor kiePostProcessor() {
return new KModuleBeanFactoryPostProcessor();
}
/**
* 输出异常信息
* @param msg
* @return
*/
public static String prettyBuildMessage(Message msg)
{
return new StringBuilder().append("Message: {id=").append(msg.getId()).append(", level=").append(msg.getLevel()).append(", path=").append(msg.getPath()).append(", line=").append(msg.getLine())
.append(", column=").append(msg.getColumn()).append(", text=\"").append(msg.getText()).append("\"}").toString();
public KieContainer kieContainer() {
KieServices kieServices = KieServices.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
kieServices.newKieBuilder(kieFileSystem).buildAll();
return kieServices.newKieContainer(kieServices.getRepository().getDefaultReleaseId());
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
<!--输出实体[SYS_DEPT]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_dept-79-1">
<changeSet author="root" id="tab-sys_dept-79-1">
<createTable tableName="IBZDEPT">
<column name="DEPTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_DEPT_DEPTID"/>
......@@ -44,7 +44,7 @@
<!--输出实体[SYS_DEPTMEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_deptmember-35-2">
<changeSet author="root" id="tab-sys_deptmember-35-2">
<createTable tableName="IBZDEPTMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_DEPTMEMBER_MEMBERID"/>
......@@ -62,7 +62,7 @@
<!--输出实体[SYS_EMP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_emp-85-3">
<changeSet author="root" id="tab-sys_emp-85-3">
<createTable tableName="IBZEMP">
<column name="USERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_EMP_USERID"/>
......@@ -142,7 +142,7 @@
<!--输出实体[SYS_ORG]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_org-49-4">
<changeSet author="root" id="tab-sys_org-49-4">
<createTable tableName="IBZORG">
<column name="ORGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_ORG_ORGID"/>
......@@ -174,7 +174,7 @@
<!--输出实体[SYS_POST]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_post-25-5">
<changeSet author="root" id="tab-sys_post-25-5">
<createTable tableName="IBZPOST">
<column name="POSTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_POST_POSTID"/>
......@@ -192,7 +192,7 @@
<!--输出实体[SYS_TEAM]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_team-25-6">
<changeSet author="root" id="tab-sys_team-25-6">
<createTable tableName="IBZTEAM">
<column name="TEAMID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_TEAM_TEAMID"/>
......@@ -208,7 +208,7 @@
<!--输出实体[SYS_TEAMMEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-sys_teammember-30-7">
<changeSet author="root" id="tab-sys_teammember-30-7">
<createTable tableName="IBZTEAMMEMBER">
<column name="TEAMMEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_SYS_TEAMMEMBER_TEAMMEMBERID"/>
......@@ -225,46 +225,46 @@
</changeSet>
<!--输出实体[SYS_DEPT]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_dept-79-8">
<changeSet author="root" id="fk-sys_dept-79-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-79-9">
<changeSet author="root" id="fk-sys_dept-79-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-35-10">
<changeSet author="root" id="fk-sys_deptmember-35-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-35-11">
<changeSet author="root" id="fk-sys_deptmember-35-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-35-12">
<changeSet author="root" id="fk-sys_deptmember-35-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-85-13">
<changeSet author="root" id="fk-sys_emp-85-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-85-14">
<changeSet author="root" id="fk-sys_emp-85-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-85-15">
<changeSet author="root" id="fk-sys_emp-85-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-49-16">
<changeSet author="root" id="fk-sys_org-49-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]外键关系 -->
<!--输出实体[SYS_TEAM]外键关系 -->
<!--输出实体[SYS_TEAMMEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-sys_teammember-30-17">
<changeSet author="root" id="fk-sys_teammember-30-17">
<addForeignKeyConstraint baseColumnNames="USERID" baseTableName="IBZTEAMMEMBER" constraintName="DER1N_SYS_TEAMMEMBER_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_teammember-30-18">
<changeSet author="root" id="fk-sys_teammember-30-18">
<addForeignKeyConstraint baseColumnNames="POSTID" baseTableName="IBZTEAMMEMBER" constraintName="DER1N_SYS_TEAMMEMBER_SYS_POST_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="POSTID" referencedTableName="IBZPOST" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-sys_teammember-30-19">
<changeSet author="root" id="fk-sys_teammember-30-19">
<addForeignKeyConstraint baseColumnNames="TEAMID" baseTableName="IBZTEAMMEMBER" constraintName="DER1N_SYS_TEAMMEMBER_SYS_TEAM_" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="TEAMID" referencedTableName="IBZTEAM" validate="true"/>
</changeSet>
......
<?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.extensions.service.logic.execute" isClosed="false" isExecutable="true" name="ou_sysdeptmember_savedeptmember.execLogic" processType="Private" tns:packageName="cn.ibizlab.core.extensions.service.logic.execute">
<extensionElements>
<tns:import name="java.util.Map"/>
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<endEvent id="prepareparam1_end" name="end"/>
<callActivity activiti:exclusive="true" calledElement="cn.ibizlab.core.ou.service.logic.sysdeptmembersavedeptmember" id="saveDeptMember" name="SysDeptMembersaveDeptMemberRuleFlow.bpmn"/>
<sequenceFlow id="begin_saveDeptMember" sourceRef="begin" targetRef="saveDeptMember"/>
<sequenceFlow id="saveDeptMember_saveDeptMember" sourceRef="saveDeptMember" targetRef="prepareparam1_end"/>
</process>
</definitions>
<?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">
<process id="cn.ibizlab.core.ou.service.logic.sysdeptmembersavedeptmember" isClosed="false" isExecutable="true" name="ou_sysdeptmember_savedeptmember_RuleFlow" 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:metaData express="" name="sysdeptmembersavedeptmemberdefault" type="entity"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.ou.service.ISysDeptMemberService))" name="sysdeptmemberservice" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.ou.service.ISysDeptMemberService))" name="iBzSysSysdeptmemberDefaultService" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.AuthenticationUser).getAuthenticationUser()" name="curuser" type="session"/>
<tns:global identifier="sysdeptmembersavedeptmemberdefault" type="cn.ibizlab.core.ou.domain.SysDeptMember" />
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
......
<?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.sysemployeesavedeptmember" isClosed="false" isExecutable="true" name="ScoreRule" processType="Private" tns:packageName="cn.ibizlab.core.ou.service.logic.sysemployeesavedeptmember">
<process id="cn.ibizlab.core.ou.service.logic.sysemployeesavedeptmember" isClosed="false" isExecutable="true" name="ou_sysemployee_savedeptmember_RuleFlow" processType="Private" tns:packageName="cn.ibizlab.core.ou.service.logic.sysemployeesavedeptmember">
<extensionElements>
<tns:import name="java.util.Map" />
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
<tns:metaData express="" name="sysemployeesavedeptmemberdefault" type="entity"/>
<tns:metaData express="new cn.ibizlab.core.ou.domain.SysDeptMember()" name="sysemployeesavedeptmembermember" type="refentity"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.ou.service.ISysDeptMemberService))" name="sysdeptmemberservice" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(cn.ibizlab.core.ou.service.ISysEmployeeService))" name="iBzSysSysemployeeDefaultService" type="service"/>
<tns:metaData express="T(cn.ibizlab.util.security.AuthenticationUser).getAuthenticationUser()" name="curuser" type="session"/>
<tns:global identifier="sysemployeesavedeptmemberdefault" type="cn.ibizlab.core.ou.domain.SysEmployee" />
<tns:global identifier="sysemployeesavedeptmembermember" type="cn.ibizlab.core.ou.domain.SysDeptMember" />
</extensionElements>
......
......@@ -86,6 +86,7 @@
<oracle.version>19.8.0.0</oracle.version>
<postgresql.version>42.2.6</postgresql.version>
<rocketmq.version>4.7.0</rocketmq.version>
<flowable-modeler.version>6.4.2</flowable-modeler.version>
</properties>
<dependencyManagement>
......@@ -262,6 +263,16 @@
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
<version>${flowable-modeler.version}</version>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-conf</artifactId>
<version>${flowable-modeler.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
......
......@@ -73,7 +73,7 @@ public class SysDepartmentResource {
SysDepartment domain = sysdepartmentMapping.toDomain(sysdepartmentdto);
domain .setDeptid(sysdepartment_id);
sysdepartmentService.update(domain );
SysDepartmentDTO dto = sysdepartmentMapping.toDto(domain );
SysDepartmentDTO dto = sysdepartmentMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -124,8 +124,10 @@ public class SysDepartmentResource {
@ApiOperation(value = "保存部门", tags = {"部门" }, notes = "保存部门")
@RequestMapping(method = RequestMethod.POST, value = "/sysdepartments/save")
public ResponseEntity<Boolean> save(@RequestBody SysDepartmentDTO sysdepartmentdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysdepartmentService.save(sysdepartmentMapping.toDomain(sysdepartmentdto)));
public ResponseEntity<SysDepartmentDTO> save(@RequestBody SysDepartmentDTO sysdepartmentdto) {
SysDepartment domain = sysdepartmentMapping.toDomain(sysdepartmentdto);
sysdepartmentService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdepartmentMapping.toDto(domain));
}
@ApiOperation(value = "批量保存部门", tags = {"部门" }, notes = "批量保存部门")
......@@ -245,10 +247,11 @@ public class SysDepartmentResource {
@ApiOperation(value = "根据单位机构保存部门", tags = {"部门" }, notes = "根据单位机构保存部门")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysdepartments/save")
public ResponseEntity<Boolean> saveBySysOrganization(@PathVariable("sysorganization_id") String sysorganization_id, @RequestBody SysDepartmentDTO sysdepartmentdto) {
public ResponseEntity<SysDepartmentDTO> saveBySysOrganization(@PathVariable("sysorganization_id") String sysorganization_id, @RequestBody SysDepartmentDTO sysdepartmentdto) {
SysDepartment domain = sysdepartmentMapping.toDomain(sysdepartmentdto);
domain.setOrgid(sysorganization_id);
return ResponseEntity.status(HttpStatus.OK).body(sysdepartmentService.save(domain));
sysdepartmentService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdepartmentMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构批量保存部门", tags = {"部门" }, notes = "根据单位机构批量保存部门")
......
......@@ -72,7 +72,7 @@ public class SysDeptMemberResource {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
domain .setMemberid(sysdeptmember_id);
sysdeptmemberService.update(domain );
SysDeptMemberDTO dto = sysdeptmemberMapping.toDto(domain );
SysDeptMemberDTO dto = sysdeptmemberMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -123,8 +123,10 @@ public class SysDeptMemberResource {
@ApiOperation(value = "保存部门成员", tags = {"部门成员" }, notes = "保存部门成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysdeptmembers/save")
public ResponseEntity<Boolean> save(@RequestBody SysDeptMemberDTO sysdeptmemberdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberService.save(sysdeptmemberMapping.toDomain(sysdeptmemberdto)));
public ResponseEntity<SysDeptMemberDTO> save(@RequestBody SysDeptMemberDTO sysdeptmemberdto) {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
sysdeptmemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberMapping.toDto(domain));
}
@ApiOperation(value = "批量保存部门成员", tags = {"部门成员" }, notes = "批量保存部门成员")
......@@ -256,10 +258,11 @@ public class SysDeptMemberResource {
@ApiOperation(value = "根据部门保存部门成员", tags = {"部门成员" }, notes = "根据部门保存部门成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysdepartments/{sysdepartment_id}/sysdeptmembers/save")
public ResponseEntity<Boolean> saveBySysDepartment(@PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
public ResponseEntity<SysDeptMemberDTO> saveBySysDepartment(@PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
domain.setDeptid(sysdepartment_id);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberService.save(domain));
sysdeptmemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberMapping.toDto(domain));
}
@ApiOperation(value = "根据部门批量保存部门成员", tags = {"部门成员" }, notes = "根据部门批量保存部门成员")
......@@ -393,10 +396,11 @@ public class SysDeptMemberResource {
@ApiOperation(value = "根据人员保存部门成员", tags = {"部门成员" }, notes = "根据人员保存部门成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysemployees/{sysemployee_id}/sysdeptmembers/save")
public ResponseEntity<Boolean> saveBySysEmployee(@PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
public ResponseEntity<SysDeptMemberDTO> saveBySysEmployee(@PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberService.save(domain));
sysdeptmemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberMapping.toDto(domain));
}
@ApiOperation(value = "根据人员批量保存部门成员", tags = {"部门成员" }, notes = "根据人员批量保存部门成员")
......@@ -530,10 +534,11 @@ public class SysDeptMemberResource {
@ApiOperation(value = "根据部门人员保存部门成员", tags = {"部门成员" }, notes = "根据部门人员保存部门成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysdepartments/{sysdepartment_id}/sysemployees/{sysemployee_id}/sysdeptmembers/save")
public ResponseEntity<Boolean> saveBySysDepartmentSysEmployee(@PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
public ResponseEntity<SysDeptMemberDTO> saveBySysDepartmentSysEmployee(@PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberService.save(domain));
sysdeptmemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberMapping.toDto(domain));
}
@ApiOperation(value = "根据部门人员批量保存部门成员", tags = {"部门成员" }, notes = "根据部门人员批量保存部门成员")
......@@ -667,10 +672,11 @@ public class SysDeptMemberResource {
@ApiOperation(value = "根据单位机构部门保存部门成员", tags = {"部门成员" }, notes = "根据单位机构部门保存部门成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysdepartments/{sysdepartment_id}/sysdeptmembers/save")
public ResponseEntity<Boolean> saveBySysOrganizationSysDepartment(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
public ResponseEntity<SysDeptMemberDTO> saveBySysOrganizationSysDepartment(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
domain.setDeptid(sysdepartment_id);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberService.save(domain));
sysdeptmemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构部门批量保存部门成员", tags = {"部门成员" }, notes = "根据单位机构部门批量保存部门成员")
......@@ -804,10 +810,11 @@ public class SysDeptMemberResource {
@ApiOperation(value = "根据单位机构人员保存部门成员", tags = {"部门成员" }, notes = "根据单位机构人员保存部门成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysemployees/{sysemployee_id}/sysdeptmembers/save")
public ResponseEntity<Boolean> saveBySysOrganizationSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
public ResponseEntity<SysDeptMemberDTO> saveBySysOrganizationSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberService.save(domain));
sysdeptmemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构人员批量保存部门成员", tags = {"部门成员" }, notes = "根据单位机构人员批量保存部门成员")
......@@ -941,10 +948,11 @@ public class SysDeptMemberResource {
@ApiOperation(value = "根据单位机构部门人员保存部门成员", tags = {"部门成员" }, notes = "根据单位机构部门人员保存部门成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysdepartments/{sysdepartment_id}/sysemployees/{sysemployee_id}/sysdeptmembers/save")
public ResponseEntity<Boolean> saveBySysOrganizationSysDepartmentSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
public ResponseEntity<SysDeptMemberDTO> saveBySysOrganizationSysDepartmentSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysDeptMemberDTO sysdeptmemberdto) {
SysDeptMember domain = sysdeptmemberMapping.toDomain(sysdeptmemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberService.save(domain));
sysdeptmemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysdeptmemberMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构部门人员批量保存部门成员", tags = {"部门成员" }, notes = "根据单位机构部门人员批量保存部门成员")
......
......@@ -73,7 +73,7 @@ public class SysEmployeeResource {
SysEmployee domain = sysemployeeMapping.toDomain(sysemployeedto);
domain .setUserid(sysemployee_id);
sysemployeeService.update(domain );
SysEmployeeDTO dto = sysemployeeMapping.toDto(domain );
SysEmployeeDTO dto = sysemployeeMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -143,8 +143,10 @@ public class SysEmployeeResource {
@ApiOperation(value = "保存人员", tags = {"人员" }, notes = "保存人员")
@RequestMapping(method = RequestMethod.POST, value = "/sysemployees/save")
public ResponseEntity<Boolean> save(@RequestBody SysEmployeeDTO sysemployeedto) {
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeService.save(sysemployeeMapping.toDomain(sysemployeedto)));
public ResponseEntity<SysEmployeeDTO> save(@RequestBody SysEmployeeDTO sysemployeedto) {
SysEmployee domain = sysemployeeMapping.toDomain(sysemployeedto);
sysemployeeService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeMapping.toDto(domain));
}
@ApiOperation(value = "批量保存人员", tags = {"人员" }, notes = "批量保存人员")
......@@ -283,10 +285,11 @@ public class SysEmployeeResource {
}
@ApiOperation(value = "根据部门保存人员", tags = {"人员" }, notes = "根据部门保存人员")
@RequestMapping(method = RequestMethod.POST, value = "/sysdepartments/{sysdepartment_id}/sysemployees/save")
public ResponseEntity<Boolean> saveBySysDepartment(@PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysEmployeeDTO sysemployeedto) {
public ResponseEntity<SysEmployeeDTO> saveBySysDepartment(@PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysEmployeeDTO sysemployeedto) {
SysEmployee domain = sysemployeeMapping.toDomain(sysemployeedto);
domain.setMdeptid(sysdepartment_id);
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeService.save(domain));
sysemployeeService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeMapping.toDto(domain));
}
@ApiOperation(value = "根据部门批量保存人员", tags = {"人员" }, notes = "根据部门批量保存人员")
......@@ -428,10 +431,11 @@ public class SysEmployeeResource {
}
@ApiOperation(value = "根据单位机构保存人员", tags = {"人员" }, notes = "根据单位机构保存人员")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysemployees/save")
public ResponseEntity<Boolean> saveBySysOrganization(@PathVariable("sysorganization_id") String sysorganization_id, @RequestBody SysEmployeeDTO sysemployeedto) {
public ResponseEntity<SysEmployeeDTO> saveBySysOrganization(@PathVariable("sysorganization_id") String sysorganization_id, @RequestBody SysEmployeeDTO sysemployeedto) {
SysEmployee domain = sysemployeeMapping.toDomain(sysemployeedto);
domain.setOrgid(sysorganization_id);
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeService.save(domain));
sysemployeeService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构批量保存人员", tags = {"人员" }, notes = "根据单位机构批量保存人员")
......@@ -573,10 +577,11 @@ public class SysEmployeeResource {
}
@ApiOperation(value = "根据单位机构部门保存人员", tags = {"人员" }, notes = "根据单位机构部门保存人员")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysdepartments/{sysdepartment_id}/sysemployees/save")
public ResponseEntity<Boolean> saveBySysOrganizationSysDepartment(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysEmployeeDTO sysemployeedto) {
public ResponseEntity<SysEmployeeDTO> saveBySysOrganizationSysDepartment(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @RequestBody SysEmployeeDTO sysemployeedto) {
SysEmployee domain = sysemployeeMapping.toDomain(sysemployeedto);
domain.setMdeptid(sysdepartment_id);
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeService.save(domain));
sysemployeeService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysemployeeMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构部门批量保存人员", tags = {"人员" }, notes = "根据单位机构部门批量保存人员")
......
......@@ -73,7 +73,7 @@ public class SysOrganizationResource {
SysOrganization domain = sysorganizationMapping.toDomain(sysorganizationdto);
domain .setOrgid(sysorganization_id);
sysorganizationService.update(domain );
SysOrganizationDTO dto = sysorganizationMapping.toDto(domain );
SysOrganizationDTO dto = sysorganizationMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -124,8 +124,10 @@ public class SysOrganizationResource {
@ApiOperation(value = "保存单位机构", tags = {"单位机构" }, notes = "保存单位机构")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/save")
public ResponseEntity<Boolean> save(@RequestBody SysOrganizationDTO sysorganizationdto) {
return ResponseEntity.status(HttpStatus.OK).body(sysorganizationService.save(sysorganizationMapping.toDomain(sysorganizationdto)));
public ResponseEntity<SysOrganizationDTO> save(@RequestBody SysOrganizationDTO sysorganizationdto) {
SysOrganization domain = sysorganizationMapping.toDomain(sysorganizationdto);
sysorganizationService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(sysorganizationMapping.toDto(domain));
}
@ApiOperation(value = "批量保存单位机构", tags = {"单位机构" }, notes = "批量保存单位机构")
......
......@@ -72,7 +72,7 @@ public class SysPostResource {
SysPost domain = syspostMapping.toDomain(syspostdto);
domain .setPostid(syspost_id);
syspostService.update(domain );
SysPostDTO dto = syspostMapping.toDto(domain );
SysPostDTO dto = syspostMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -123,8 +123,10 @@ public class SysPostResource {
@ApiOperation(value = "保存岗位", tags = {"岗位" }, notes = "保存岗位")
@RequestMapping(method = RequestMethod.POST, value = "/sysposts/save")
public ResponseEntity<Boolean> save(@RequestBody SysPostDTO syspostdto) {
return ResponseEntity.status(HttpStatus.OK).body(syspostService.save(syspostMapping.toDomain(syspostdto)));
public ResponseEntity<SysPostDTO> save(@RequestBody SysPostDTO syspostdto) {
SysPost domain = syspostMapping.toDomain(syspostdto);
syspostService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(syspostMapping.toDto(domain));
}
@ApiOperation(value = "批量保存岗位", tags = {"岗位" }, notes = "批量保存岗位")
......
......@@ -72,7 +72,7 @@ public class SysTeamMemberResource {
SysTeamMember domain = systeammemberMapping.toDomain(systeammemberdto);
domain .setTeammemberid(systeammember_id);
systeammemberService.update(domain );
SysTeamMemberDTO dto = systeammemberMapping.toDto(domain );
SysTeamMemberDTO dto = systeammemberMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -123,8 +123,10 @@ public class SysTeamMemberResource {
@ApiOperation(value = "保存组成员", tags = {"组成员" }, notes = "保存组成员")
@RequestMapping(method = RequestMethod.POST, value = "/systeammembers/save")
public ResponseEntity<Boolean> save(@RequestBody SysTeamMemberDTO systeammemberdto) {
return ResponseEntity.status(HttpStatus.OK).body(systeammemberService.save(systeammemberMapping.toDomain(systeammemberdto)));
public ResponseEntity<SysTeamMemberDTO> save(@RequestBody SysTeamMemberDTO systeammemberdto) {
SysTeamMember domain = systeammemberMapping.toDomain(systeammemberdto);
systeammemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberMapping.toDto(domain));
}
@ApiOperation(value = "批量保存组成员", tags = {"组成员" }, notes = "批量保存组成员")
......@@ -245,10 +247,11 @@ public class SysTeamMemberResource {
@ApiOperation(value = "根据人员保存组成员", tags = {"组成员" }, notes = "根据人员保存组成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysemployees/{sysemployee_id}/systeammembers/save")
public ResponseEntity<Boolean> saveBySysEmployee(@PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
public ResponseEntity<SysTeamMemberDTO> saveBySysEmployee(@PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
SysTeamMember domain = systeammemberMapping.toDomain(systeammemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberService.save(domain));
systeammemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberMapping.toDto(domain));
}
@ApiOperation(value = "根据人员批量保存组成员", tags = {"组成员" }, notes = "根据人员批量保存组成员")
......@@ -372,10 +375,11 @@ public class SysTeamMemberResource {
@ApiOperation(value = "根据组保存组成员", tags = {"组成员" }, notes = "根据组保存组成员")
@RequestMapping(method = RequestMethod.POST, value = "/systeams/{systeam_id}/systeammembers/save")
public ResponseEntity<Boolean> saveBySysTeam(@PathVariable("systeam_id") String systeam_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
public ResponseEntity<SysTeamMemberDTO> saveBySysTeam(@PathVariable("systeam_id") String systeam_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
SysTeamMember domain = systeammemberMapping.toDomain(systeammemberdto);
domain.setTeamid(systeam_id);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberService.save(domain));
systeammemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberMapping.toDto(domain));
}
@ApiOperation(value = "根据组批量保存组成员", tags = {"组成员" }, notes = "根据组批量保存组成员")
......@@ -499,10 +503,11 @@ public class SysTeamMemberResource {
@ApiOperation(value = "根据部门人员保存组成员", tags = {"组成员" }, notes = "根据部门人员保存组成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysdepartments/{sysdepartment_id}/sysemployees/{sysemployee_id}/systeammembers/save")
public ResponseEntity<Boolean> saveBySysDepartmentSysEmployee(@PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
public ResponseEntity<SysTeamMemberDTO> saveBySysDepartmentSysEmployee(@PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
SysTeamMember domain = systeammemberMapping.toDomain(systeammemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberService.save(domain));
systeammemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberMapping.toDto(domain));
}
@ApiOperation(value = "根据部门人员批量保存组成员", tags = {"组成员" }, notes = "根据部门人员批量保存组成员")
......@@ -626,10 +631,11 @@ public class SysTeamMemberResource {
@ApiOperation(value = "根据单位机构人员保存组成员", tags = {"组成员" }, notes = "根据单位机构人员保存组成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysemployees/{sysemployee_id}/systeammembers/save")
public ResponseEntity<Boolean> saveBySysOrganizationSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
public ResponseEntity<SysTeamMemberDTO> saveBySysOrganizationSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
SysTeamMember domain = systeammemberMapping.toDomain(systeammemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberService.save(domain));
systeammemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构人员批量保存组成员", tags = {"组成员" }, notes = "根据单位机构人员批量保存组成员")
......@@ -753,10 +759,11 @@ public class SysTeamMemberResource {
@ApiOperation(value = "根据单位机构部门人员保存组成员", tags = {"组成员" }, notes = "根据单位机构部门人员保存组成员")
@RequestMapping(method = RequestMethod.POST, value = "/sysorganizations/{sysorganization_id}/sysdepartments/{sysdepartment_id}/sysemployees/{sysemployee_id}/systeammembers/save")
public ResponseEntity<Boolean> saveBySysOrganizationSysDepartmentSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
public ResponseEntity<SysTeamMemberDTO> saveBySysOrganizationSysDepartmentSysEmployee(@PathVariable("sysorganization_id") String sysorganization_id, @PathVariable("sysdepartment_id") String sysdepartment_id, @PathVariable("sysemployee_id") String sysemployee_id, @RequestBody SysTeamMemberDTO systeammemberdto) {
SysTeamMember domain = systeammemberMapping.toDomain(systeammemberdto);
domain.setUserid(sysemployee_id);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberService.save(domain));
systeammemberService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(systeammemberMapping.toDto(domain));
}
@ApiOperation(value = "根据单位机构部门人员批量保存组成员", tags = {"组成员" }, notes = "根据单位机构部门人员批量保存组成员")
......
......@@ -72,7 +72,7 @@ public class SysTeamResource {
SysTeam domain = systeamMapping.toDomain(systeamdto);
domain .setTeamid(systeam_id);
systeamService.update(domain );
SysTeamDTO dto = systeamMapping.toDto(domain );
SysTeamDTO dto = systeamMapping.toDto(domain);
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
......@@ -123,8 +123,10 @@ public class SysTeamResource {
@ApiOperation(value = "保存组", tags = {"组" }, notes = "保存组")
@RequestMapping(method = RequestMethod.POST, value = "/systeams/save")
public ResponseEntity<Boolean> save(@RequestBody SysTeamDTO systeamdto) {
return ResponseEntity.status(HttpStatus.OK).body(systeamService.save(systeamMapping.toDomain(systeamdto)));
public ResponseEntity<SysTeamDTO> save(@RequestBody SysTeamDTO systeamdto) {
SysTeam domain = systeamMapping.toDomain(systeamdto);
systeamService.save(domain);
return ResponseEntity.status(HttpStatus.OK).body(systeamMapping.toDto(domain));
}
@ApiOperation(value = "批量保存组", tags = {"组" }, notes = "批量保存组")
......
......@@ -90,5 +90,39 @@
<artifactId>feign-httpclient</artifactId>
</dependency>
<!-- drools -->
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-compiler</artifactId>
</dependency>
<dependency>
<groupId>org.drools</groupId>
<artifactId>drools-core</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-spring</artifactId>
</dependency>
<dependency>
<groupId>org.kie</groupId>
<artifactId>kie-api</artifactId>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-json-converter</artifactId>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-ui-modeler-conf</artifactId>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
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;
import org.aspectj.lang.annotation.Aspect;
import org.flowable.bpmn.converter.BpmnXMLConverter;
import org.flowable.bpmn.model.*;
import org.flowable.bpmn.model.Process;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
import org.kie.api.builder.Message;
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.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.stereotype.Component;
import org.springframework.util.DigestUtils;
import org.springframework.util.ObjectUtils;
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;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
/**
* 实体处理逻辑切面(前后附加逻辑、实体行为调用处理逻辑)
*/
@Aspect
@Component
@Slf4j
public class DELogicAspect {
private static BpmnXMLConverter bpmnXMLConverter = new BpmnXMLConverter();
private final ExpressionParser parser = new SpelExpressionParser();
private ConcurrentMap<String, DELogic> deLogicMap = new ConcurrentHashMap<>();
private static Map<String, Object> validLogic = new HashMap<>();
/**
* 执行实体行为附加逻辑、实体行为调用处理逻辑
*
* @param point
* @return
* @throws Throwable
*/
@Around("execution(* cn.ibizlab.core.*.service.*.*(..))")
public Object executeLogic(ProceedingJoinPoint point) throws Throwable {
Object args[] = point.getArgs();
if (ObjectUtils.isEmpty(args) || args.length == 0) {
return point.proceed();
}
Object service = point.getTarget();
Object arg = args[0];
String action = point.getSignature().getName();
EntityBase entity = null;
if ("remove".equalsIgnoreCase(action) || "get".equalsIgnoreCase(action)) {
entity = getEntity(service.getClass());
String id = DEFieldCacheMap.getDEKeyField(entity.getClass());
if(StringUtils.isEmpty(id)) {
log.debug("无法获取实体主键属性[{}]",entity.getClass().getSimpleName());
return point.proceed();
}
entity.set(id, arg);
} else if (arg instanceof EntityBase) {
entity = (EntityBase) arg;
}
if (entity != null) {
executeBeforeLogic(entity, action);
Object result = point.proceed();
executeLogic(entity, action);
executeAfterLogic(entity, action);
return result;
}
return point.proceed();
}
/**
* 前附加逻辑
*
* @param entity
* @param action
*/
private void executeBeforeLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.BEFORE);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action);
}
}
/**
* 后附加逻辑
*
* @param entity
* @param action
*/
private void executeAfterLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.AFTER);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action);
}
}
/**
* 实体行为调用处理逻辑
*
* @param entity
* @param action
*/
private void executeLogic(EntityBase entity, String action) {
File bpmnFile = getLocalModel(entity.getClass().getSimpleName(), action, LogicExecMode.EXEC);
if (bpmnFile != null && bpmnFile.exists() && isValid(bpmnFile, entity, action)) {
executeLogic(bpmnFile, entity, action);
}
}
/**
* 编译并执行规则(bpmn、drl)
*
* @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);
}
}
kieSession.startProcess(mainProcess.getId());
log.debug("实体处理逻辑[{}:{}:{}:本地模式]执行结束", entity.getClass().getSimpleName(), action, bpmnFile.getName());
}
/**
* 编译规则
*
* @param logic
*/
private void reloadLogic(DELogic logic) {
KieServices kieServices = KieServices.get();
KieFileSystem kieFileSystem = kieServices.newKieFileSystem();
for (File bpmn : logic.getRefRuleFiles()) {
kieFileSystem.write(ResourceFactory.newFileResource(bpmn));
}
KieBuilder kieBuilder = kieServices.newKieBuilder(kieFileSystem).buildAll();
Results results = kieBuilder.getResults();
if (results.hasMessages(Message.Level.ERROR)) {
throw new BadRequestAlertException(String.format("编译实体处理逻辑 [%s] 发生异常, %s", logic.getName(), results.getMessages()), "LogicAspect", "reloadLogic");
}
KieContainer kieContainer = kieServices.newKieContainer(kieServices.getRepository().getDefaultReleaseId());
logic.setContainer(kieContainer);
}
/**
* 填充逻辑参数
*
* @param kieSession
* @param process
* @param entity
*/
private void fillGlobalParam(KieSession kieSession, Process process, Object entity) {
Map<String, List<ExtensionElement>> params = process.getExtensionElements();
for (Map.Entry<String, List<ExtensionElement>> param : params.entrySet()) {
if ("metaData".equalsIgnoreCase(param.getKey())) {
List<ExtensionElement> globalParams = param.getValue();
for (ExtensionElement globalParam : globalParams) {
Object value = null;
Map<String, List<ExtensionAttribute>> globalParamAttr = globalParam.getAttributes();
if (globalParamAttr.containsKey("name") && globalParamAttr.containsKey("type") && globalParamAttr.containsKey("express")) {
ExtensionAttribute name = globalParamAttr.get("name").get(0);
ExtensionAttribute type = globalParamAttr.get("type").get(0);
ExtensionAttribute express = globalParamAttr.get("express").get(0);
String express_value = express.getValue();
EvaluationContext oldContext = new StandardEvaluationContext();
if ("entity".equalsIgnoreCase(type.getValue())) {
value = entity;
}
if (!ObjectUtils.isEmpty(type.getValue()) && ObjectUtils.isEmpty(value)) {
Expression oldExp = parser.parseExpression(express_value);
value = oldExp.getValue(oldContext);
}
if ("entity".equalsIgnoreCase(type.getValue()) || "refentity".equalsIgnoreCase(type.getValue())) {
kieSession.insert(value);
}
kieSession.setGlobal(name.getValue(), value);
}
}
}
}
}
/**
* 获取逻辑配置
*
* @param bpmnFile
* @return
*/
@SneakyThrows
private DELogic getDELogic(File bpmnFile) {
DELogic logic = null;
XMLStreamReader reader = null;
InputStream bpmn = null;
try {
if (bpmnFile.exists()) {
XMLInputFactory factory = XMLInputFactory.newInstance();
bpmn = new FileInputStream(bpmnFile);
reader = factory.createXMLStreamReader(bpmn);
BpmnModel model = bpmnXMLConverter.convertToBpmnModel(reader);
Process mainProcess = model.getMainProcess();
if (mainProcess == null) {
return null;
}
List<DELogic> refLogics = new ArrayList<>();
List<File> refFiles = new ArrayList<>();
//自己 bpmn 及 drl
refFiles.add(bpmnFile);
File drlFile = getDrl(bpmnFile);
if (drlFile != null && drlFile.exists()) {
refFiles.add(drlFile);
}
//子 bpmn 及 drl
if (!ObjectUtils.isEmpty(model.getMainProcess()) && !ObjectUtils.isEmpty(model.getMainProcess().getFlowElementMap())) {
model.getMainProcess().getFlowElementMap().values().forEach(item -> {
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);
}
DELogic refLogic = getDELogic(subBpmnFile);
if (refLogic != null) {
refLogics.add(refLogic);
if (!ObjectUtils.isEmpty(refLogic.getRefRuleFiles())) {
refFiles.addAll(refLogic.getRefRuleFiles());
}
}
}
});
}
logic = new DELogic();
logic.setId(mainProcess.getId());
logic.setName(mainProcess.getName());
logic.setProcess(mainProcess);
logic.setRefLogic(refLogics);
logic.setRefRuleFiles(refFiles);
logic.setMd5(getMd5(refFiles));
}
} catch (Exception e) {
} finally {
try {
if (reader != null) {
reader.close();
}
if (bpmn != null) {
bpmn.close();
}
} catch (Exception e) {
}
}
return logic;
}
/**
* 获取实体
*
* @param service
* @return
*/
private EntityBase getEntity(Class service) {
Method[] methods = service.getDeclaredMethods();
for (Method method : methods) {
for (Class cls : method.getParameterTypes()) {
try {
Object arg = cls.newInstance();
if (arg instanceof EntityBase) {
return (EntityBase) arg;
}
} catch (Exception e) {
}
}
}
if(!ObjectUtils.isEmpty(service.getSuperclass()) && !service.getSuperclass().getName().equals(Object.class.getName())) {
return getEntity(service.getSuperclass());
}
throw new BadRequestAlertException("获取实体信息失败", "DELogicAspect", "getEntity");
}
/**
* 获取bpmn md5
*
* @param subFiles
* @return
*/
private String getMd5(List<File> subFiles) {
try {
StringBuffer buffer = new StringBuffer();
for (File file : subFiles) {
InputStream bpmnFile = null;
try {
bpmnFile = new FileInputStream(file);
if (!ObjectUtils.isEmpty(bpmnFile)) {
String strBpmn = IOUtils.toString(bpmnFile, "UTF-8");
buffer.append(strBpmn);
}
} catch (Exception e) {
} finally {
if (bpmnFile != null) {
bpmnFile.close();
}
}
}
if (!StringUtils.isEmpty(buffer.toString())) {
return DigestUtils.md5DigestAsHex(buffer.toString().getBytes());
} else {
return null;
}
} catch (Exception e) {
return null;
}
}
/**
* 本地逻辑
*
* @param entity
* @param action
* @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);
}
/**
* 处理逻辑 bpmn
*
* @param logicName
* @return
*/
private File getSubBpmn(String logicName) {
String filePath = String.format("/rules/%s", logicName);
return getBpmnFile(filePath);
}
/**
* 处理逻辑 drl
*
* @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) {
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
return bpmn;
}
/**
* 逻辑是否有效
*
* @param bpmn
* @param entity
* @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();
if (validLogic.containsKey(logicId)) {
return true;
} else {
return false;
}
}
static {
validLogic.put("sysdeptmembersavedeptmemberexec.bpmn", 1);
}
public enum LogicExecMode {
/**
* 前附加逻辑
*/
BEFORE("0", "before"),
/**
* 后附加逻辑
*/
AFTER("1", "after"),
/**
*
*/
EXEC("2", "exec");
LogicExecMode(String value, String text) {
this.value = value;
this.text = text;
}
private String value;
private String text;
}
}
package cn.ibizlab.util.domain;
import lombok.Data;
import org.flowable.bpmn.model.Process;
import org.kie.api.runtime.KieContainer;
import java.io.File;
import java.io.Serializable;
import java.util.List;
@Data
public class DELogic implements Serializable {
String id;
String name;
Process process;
KieContainer container;
List<DELogic> refLogic;
List<File> refRuleFiles;
String md5;
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册