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

ibiz4j 发布系统代码

上级 3bfd3f66
## v7.0.0-alpha.5 [2020-5-21]
### Bug修复
修复表格视图搜索placeholder显示为搜索字段
修复表单嵌表单分页异常
修复门户视图操作栏标题
修复看板部件高度自动撑
修复表单分组,界面行为组不显示
修复表格操作列数据异常
### 功能新增及优化
#### 模板
支持拷贝功能
支持实体甘特图视图
支持面板项隐藏表单项
支持表格列最小宽度和操作列样式支持
支持列表项、面板代码表转化
#### 基础文件
支持列表项、面板代码表转化
修复表单分组,界面行为组不显示
## v7.0.0-alpha.4 [2020-5-14]
### Bug修复
......
......@@ -24,7 +24,8 @@
"element-ui": "^2.13.0",
"file-saver": "^2.0.2",
"font-awesome": "^4.7.0",
"ibiz-gantt-elastic": "^1.0.8",
"ibiz-gantt-elastic": "^1.0.12",
"ibiz-vue-lib": "^0.1.4",
"interactjs": "^1.9.4",
"moment": "^2.24.0",
"path-to-regexp": "^6.1.0",
......
......@@ -71,6 +71,10 @@ import AppUploadFileInfo from './components/app-upload-file-info/app-upload-file
import ContextMenu from './components/context-menu/context-menu'
import AppColumnFormat from './components/app-column-format/app-column-format.vue'
import AppQuickGroup from './components/app-quick-group/app-quick-group.vue'
import AppOrgSelect from './components/app-org-select/app-org-select.vue'
import IBizGroupSelect from './components/ibiz-group-select/ibiz-group-select.vue'
import IBizGroupPicker from './components/ibiz-group-picker/ibiz-group-picker.vue'
// 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister;
......@@ -151,5 +155,8 @@ export const AppComponents = {
v.component('context-menu',ContextMenu);
v.component('app-column-format',AppColumnFormat);
v.component('app-quick-group',AppQuickGroup);
v.component('app-org-select',AppOrgSelect);
v.component('ibiz-group-select',IBizGroupSelect);
v.component('ibiz-group-picker',IBizGroupPicker);
},
};
\ No newline at end of file
.app-org-select {
width: 100%;
}
\ No newline at end of file
<template>
<div class="app-org-select">
<ibiz-select-tree :NodesData="NodesData" v-model="selectTreeValue" :multiple="false" @select="treeSelectChange"></ibiz-select-tree>
</div>
</template>
<script lang = 'ts'>
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
import { Http } from '@/utils';
@Component({})
export default class AppOrgSelect extends Vue {
/**
* 表单数据
*
* @memberof AppOrgSelect
*/
@Prop() public data!:any;
/**
* 上下文
*
* @memberof AppOrgSelect
*/
@Prop() public context!:any;
/**
* 填充对象
*
* @memberof AppOrgSelect
*/
@Prop() public fillMap:any;
/**
* 过滤项
*
* @memberof AppOrgSelect
*/
@Prop() public filter?:string;
/**
* 是否多选
*
* @memberof AppOrgSelect
*/
@Prop({default:false}) public multiple?:boolean;
/**
* 监听表单数据变化
*
* @memberof AppOrgSelect
*/
@Watch('data',{immediate:true,deep:true})
onDataChange(newVal: any, oldVal: any) {
if(newVal){
this.computedSelectedData();
if(this.filter){
let tempFilterValue:any = this.initBasicData();
// filter值变化才去请求数据
if(tempFilterValue && (this.copyFilterValue !== tempFilterValue)){
this.loadTreeData(this.orgDataUrl.replace('${orgid}',tempFilterValue));
this.copyFilterValue = tempFilterValue;
}
}
}
}
/**
* 查询单位路径
*
* @memberof AppOrgSelect
*/
public orgDataUrl:string ="/ibzorganizations/${orgid}/suborg/picker";
/**
* 选择值
*
* @memberof AppOrgSelect
*/
public selectTreeValue:any = "";
/**
* 树节点数据
*
* @memberof AppOrgSelect
*/
public NodesData:any = [];
/**
* 备份过滤值
*
* @memberof AppOrgSelect
*/
public copyFilterValue:any;
/**
* vue生命周期
*
* @memberof AppOrgSelect
*/
public created(){
if(!this.filter){
this.loadTreeData(this.orgDataUrl.replace('${orgid}','alls'));
}
}
/**
* 加载树数据
*
* @memberof AppOrgSelect
*/
public initBasicData(){
// 计算出过滤值
if(this.filter){
if(this.data && this.data[this.filter]){
return this.data[this.filter];
}else if(this.context && this.context[this.filter]){
return this.context[this.filter];
}else{
return null;
}
}
}
/**
* 计算选中值
*
* @memberof AppOrgSelect
*/
public computedSelectedData(){
// 单选
if(!this.multiple){
if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
}
}else{
// 多选
}
}
/**
* 加载树数据
*
* @memberof AppOrgSelect
*/
public loadTreeData(requestUrl:string){
Http.getInstance().get(requestUrl).then((res:any) =>{
if(!res.status && res.status !== 200){
console.error("加载数据失败");
return;
}
this.NodesData = res.data;
console.log(this.NodesData);
})
}
/**
* 树选择触发事件
*
* @memberof AppOrgSelect
*/
public treeSelectChange($event:any){
// 多选
if(this.multiple){
}else{
// 单选
if($event){
const tempValue:any = JSON.parse($event)[0];
if(this.fillMap && Object.keys(this.fillMap).length >0){
Object.keys(this.fillMap).forEach((item:any) =>{
this.emitValue(this.fillMap[item],tempValue[item]);
})
}
}else{
if(this.fillMap && Object.keys(this.fillMap).length >0){
Object.keys(this.fillMap).forEach((item:any) =>{
this.emitValue(this.fillMap[item],null);
})
}
}
}
}
/**
* 抛值
*
* @memberof AppOrgSelect
*/
public emitValue(name:string,value:any){
this.$emit('formitemvaluechange',{name:name,value:value});
}
}
</script>
<style lang="less">
@import "./app-org-select.less";
</style>
\ No newline at end of file
<template>
<div class="ibiz-group-picker">
<div class="ibiz-group-container">
<div v-if="showTree" class="ibiz-group-tree">
<ibiz-select-tree :NodesData="treeItems" v-model="treeSelectVal" :isShowSearchBar="false" @select="treeSelect"></ibiz-select-tree>
</div>
<div class="ibiz-group-content">
<ibiz-group-card :data="cardItems" text="label" value="id" groupName="group" :multiple="multiple" :defaultSelect="cardSelctVal" @select="groupSelect"></ibiz-group-card>
</div>
</div>
<div class="ibiz-group-footer">
<el-button size="small" type="primary" @click="onOK">确认</el-button>
<el-button size="small" @click="onCancel">取消</el-button>
</div>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
import { Http } from '../../utils';
@Component({})
export default class IBizGroupPicker extends Vue {
/**
* 视图上下文参数
*
* @type {*}
* @memberof IBizGroupPicker
*/
@Prop() viewdata: any;
/**
* 视图参数
*
* @type {*}
* @memberof IBizGroupPicker
*/
@Prop() viewparam: any;
/**
* 多选
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected multiple: boolean = false;
/**
* 树数据集
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected treeItems: any[] = [];
/**
* 分组表数据集
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected cardItems: any[] = [];
/**
* 视图上下文参数对象
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected viewData: any;
/**
* 视图参数对象
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected viewParam: any;
/**
* 树选中值
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected treeSelectVal: string = '';
/**
* 分组表选中集合
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected cardSelctVal: any = [];
/**
* 数据选中集合
*
* @type {*}
* @memberof IBizGroupPicker
*/
protected selects: any[] = [];
/**
* 是否显示树
*
* @type {*}
* @memberof IBizGroupPicker
*/
get showTree() {
if(!Object.is(this.viewData.srforgid, this.viewParam.srforgid)) {
return true;
}
}
/**
* 生命周期
*
* @type {*}
* @memberof IBizGroupPicker
*/
public created() {
if(!this.viewdata || !this.viewparam) {
return;
}
this.viewData = JSON.parse(this.viewdata);
this.viewParam = JSON.parse(this.viewparam);
this.multiple = this.viewParam.multiple;
if (this.viewParam.selects) {
this.cardSelctVal = this.viewParam.selects;
}
this.load();
}
/**
* 加载数据
*
* @type {*}
* @memberof IBizGroupPicker
*/
public load() {
if(this.showTree) {
this.loadTree();
} else {
this.loadGroupData(this.viewParam.srforgid);
}
}
/**
* 加载树数据
*
* @type {*}
* @memberof IBizGroupPicker
*/
public loadTree() {
let get = Http.getInstance().get(`/ibzorganizations/450000/suborg/ibzdepartments/picker`, true);
get.then((response: any) => {
if(response.status === 200) {
this.treeItems = response.data;
}
}).catch((error: any) => {
console.log(error)
})
}
/**
* 加载分组表数据
*
* @type {*}
* @memberof IBizGroupPicker
*/
public loadGroupData(key: string) {
let get = Http.getInstance().get(`/ibzorganizations/${key}/ibzemployees/picker`, true);
get.then((response: any) => {
if(response.status === 200) {
this.cardItems = response.data;
}
}).catch((error: any) => {
console.log(error)
})
}
/**
* 树选中
*
* @type {*}
* @memberof IBizGroupPicker
*/
public treeSelect(event: any) {
if(!event || JSON.parse(event).length == 0) {
return;
}
const items: any = JSON.parse(event);
this.loadGroupData(items[0].id);
}
/**
* 分组表选中
*
* @type {*}
* @memberof IBizGroupPicker
*/
public groupSelect(event: any) {
// if (!event || !event.selects) {
// return;
// }
// if(!this.multiple) {
// this.selects = [];
// }
// if(event.rselect) {
// let index: number = this.selects.findIndex((item: any) => Object.is(event.rselect, item.id));
// if(index >= 0) {
// this.selects.splice(index, 1);
// }
// } else {
// event.selects.forEach((key: string) => {
// let index: number = this.selects.findIndex((item: any) => Object.is(key, item.id));
// if(index >= 0) {
// return;
// }
// let item: any = this.cardItems.find((item: any) => Object.is(key, item.id));
// if (item) {
// this.selects.push(item);
// }
// });
// }
// 测试 start
if(!this.multiple) {
this.selects = [];
}
event.forEach((key: string) => {
let index: number = this.selects.findIndex((item: any) => Object.is(key, item.id));
if(index >= 0) {
return;
}
let item: any = this.cardItems.find((item: any) => Object.is(key, item.id));
if (item) {
this.selects.push(item);
}
});
// 测试 end
}
/**
* 确认
*
* @type {*}
* @memberof IBizGroupPicker
*/
public onOK() {
this.$emit('close', this.selects);
}
/**
* 取消
*
* @type {*}
* @memberof IBizGroupPicker
*/
public onCancel() {
this.$emit('close');
}
}
</script>
<style lang="less">
.ibiz-group-container {
display: flex;
height: calc(100% - 65px);
.ibiz-group-tree {
width: 400px;
border-right: 1px solid #ddd;
padding: 0 10px;
overflow: auto;
height: 100%;
}
.ibiz-group-content {
flex-grow: 1;
padding: 0 10px;
overflow: auto;
height: 100%;
}
}
.ibiz-group-footer {
padding: 16px;
text-align: right;
border-top: 1px solid #ddd;
}
</style>
\ No newline at end of file
<template>
<div class="ibiz-group-select">
<div class="ibiz-group-content">
<span v-if="!multiple">
{{ selectName }}
</span>
<template v-else v-for="(select, index) of selects">
<div :key="index" class="ibiz-group-item">
{{ select.label }}
<i class="el-icon-close" @click="remove(select)"></i>
</div>
</template>
</div>
<div class="ibiz-group-open">
<i class="el-icon-search" @click="openView"></i>
</div>
</div>
</template>
<script lang="ts">
import { Component, Vue, Prop, Watch } from 'vue-property-decorator';
import { Subject } from 'rxjs';
@Component({})
export default class IBizGroupSelect extends Vue {
/**
* 名称标识
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() name!: string;
/**
* 数据接口地址
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() url?: string;
/**
* 多选
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop({default: false}) multiple?: boolean;
/**
* 数据对象
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() data: any;
/**
* 过滤属性标识
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop({default: 'orgid'}) filter?: string;
/**
* 是否启用
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() disabled?: boolean;
/**
* 值
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() value: any;
/**
* 上下文参数
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() context: any;
/**
* 关联属性
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Prop() valueitem: any;
/**
* 选中项集合
*
* @type {*}
* @memberof IBizGroupSelect
*/
protected selects: any[] = [];
/**
* 值变化
*
* @type {*}
* @memberof IBizGroupSelect
*/
@Watch('value')
onValueChange(newVal: any) {
this.selects = [];
if (newVal) {
let vals: any[] = newVal.split(',');
let vals2: any[] = [];
if(this.valueitem) {
vals2 = this.data[this.valueitem].split(',');
}
vals.forEach((val: string, index: number) => {
this.selects.push({
label: val,
id: vals2.length > 0 ? vals2[index] : null
})
})
}
}
/**
* 单选时选中名称
*
* @type {*}
* @memberof IBizGroupSelect
*/
get selectName() {
if(this.selects.length > 0) {
return this.selects[0].label;
}
}
/**
* 打开选择视图
*
* @type {*}
* @memberof IBizGroupSelect
*/
public openView() {
const view: any = {
viewname: 'ibiz-group-picker',
title: '分组选择'
};
let sels: any = this.selects.map((select: any) => {
return select.id;
})
const context: any = JSON.parse(JSON.stringify(this.context));
const param: any = {};
let orgid: any = this.filter;
Object.assign(param, {
orgid: this.data[orgid],
multiple: this.multiple,
selects: sels
});
let container: Subject<any> = this.$appmodal.openModal(view, context, param);
container.subscribe((result: any) => {
if (!result || !Object.is(result.ret, 'OK')) {
return;
}
this.openViewClose(result);
});
}
/**
* 选择视图关闭
*
* @type {*}
* @memberof IBizGroupSelect
*/
public openViewClose(result: any) {
console.log(result)
this.selects = [];
if (result.datas && result.datas.length > 0) {
result.datas.forEach((data: any) => {
this.selects.push({
id: data.id,
label: data.label
})
});
}
this.setValue()
}
/**
* 数据删除
*
* @type {*}
* @memberof IBizGroupSelect
*/
public remove(item: any) {
this.selects.splice(this.selects.indexOf(item), 1);
this.setValue()
}
/**
* 设置值
*
* @type {*}
* @memberof IBizGroupSelect
*/
public setValue() {
let item: any = {};
if(this.multiple) {
let label = '';
let value = '';
this.selects.forEach((select: any) => {
label += ',' + select.label;
value += ',' + select.id;
});
Object.assign(item, {
label: label ? label.substring(1) : null,
id: value ? value.substring(1) : null
})
} else {
item = this.selects.length > 0 ? this.selects[0] : {};
}
if(this.name) {
this.$emit('formitemvaluechange', { name: this.name, value: item.label });
}
if(this.valueitem) {
this.$emit('formitemvaluechange', { name: this.valueitem, value: item.id });
}
}
}
</script>
<style lang="less">
.ibiz-group-select {
width: 100%;
display: flex;
border: 1px solid #DCDFE6;
min-height: 32px;
border-radius: 4px;
.ibiz-group-content {
flex-grow: 1;
padding: 0 16px;
.ibiz-group-item {
display: inline-block;
border: 1px solid #bbb;
line-height: 24px;
border-radius: 5px;
margin-right: 5px;
padding: 0 5px;
}
}
.ibiz-group-open {
width: 20px;
display: flex;
text-align: center;
align-items: center;
}
}
.ibiz-group-select:hover {
border-color: #108cee;
}
</style>
\ No newline at end of file
......@@ -4,6 +4,7 @@ import VueRouter from 'vue-router';
import App from '@/App.vue';
import ElementUi from 'element-ui';
import ViewUI from 'view-design';
import ibizLab from 'ibiz-vue-lib';
import { Interceptors } from '@/utils';
import {Print} from '@/utils/print';
import i18n from '@/locale'
......@@ -30,7 +31,8 @@ Vue.config.errorHandler = function (err: any, vm: any, info: any) {
console.log(err);
}
Vue.config.productionTip = false;
Vue.use(Print)
Vue.use(Print);
Vue.use(ibizLab);
Vue.use(Vuex);
Vue.use(VueRouter);;
Vue.use(ElementUi, {
......
......@@ -1199,7 +1199,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof Main
*/
public uiAction(row: any, tag: any, $event: any) {
this.rowClick(row, true);
// this.rowClick(row, true);
}
/**
......
......@@ -1185,7 +1185,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof Main
*/
public uiAction(row: any, tag: any, $event: any) {
this.rowClick(row, true);
// this.rowClick(row, true);
}
/**
......
......@@ -1237,7 +1237,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof Main
*/
public uiAction(row: any, tag: any, $event: any) {
this.rowClick(row, true);
// this.rowClick(row, true);
}
/**
......
......@@ -1199,7 +1199,7 @@ export default class MainBase extends Vue implements ControlInterface {
* @memberof Main
*/
public uiAction(row: any, tag: any, $event: any) {
this.rowClick(row, true);
// this.rowClick(row, true);
}
/**
......
......@@ -5209,10 +5209,10 @@ human-signals@^1.1.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-1.1.1.tgz#c5b1cd14f50aeae09ab6c59fe63ba3395fe4dfa3"
integrity sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==
ibiz-gantt-elastic@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/ibiz-gantt-elastic/-/ibiz-gantt-elastic-1.0.8.tgz#d7c40b6b0068a9303772594608375d42b8dbcb61"
integrity sha512-vlawRcYGiNv6N8N9Wx2ZO7oorV3R6dZWYT7Yvb2lxWfdWYX+cK1KZP0p+2S/Is1/A7+eDFhu60iZ2nf7LExaFQ==
ibiz-gantt-elastic@^1.0.12:
version "1.0.12"
resolved "https://registry.yarnpkg.com/ibiz-gantt-elastic/-/ibiz-gantt-elastic-1.0.12.tgz#6865ef41e94b8b31f00f4cd1f0f60f132f7398d3"
integrity sha512-UHmnTG5q13xUuCKXSf73ZpwN/iOM9M73jFQ+C9wJWAsZcrDVc/36bPaSalMcfRWpfWREtU9wMnONXtFGVvS6pw==
dependencies:
dayjs "^1.8.16"
resize-observer-polyfill "^1.5.1"
......
......@@ -23,7 +23,7 @@ import java.util.List;
@Configuration
@EnableFeignClients(basePackages = {"cn.ibizlab" })
@EnableZuulProxy
@ComponentScan(basePackages = {"cn.ibizlab"})
@ComponentScan(basePackages = {"cn.ibizlab.web","cn.ibizlab.util"})
@MapperScan("cn.ibizlab.*.mapper")
@SpringBootApplication(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class,
......
......@@ -76,6 +76,14 @@ public class WFProcessInstance extends EntityClient implements Serializable {
@JsonProperty("startTime")
private Timestamp starttime;
/**
* 结束时间
*/
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "endTime" , format="yyyy-MM-dd HH:mm:ss")
@JsonProperty("endTime")
private Timestamp endtime;
/**
* 属性
*/
......@@ -122,6 +130,13 @@ public class WFProcessInstance extends EntityClient implements Serializable {
this.starttime = starttime ;
this.modify("starttime",starttime);
}
/**
* 设置 [结束时间]
*/
public void setEndtime(Timestamp endtime){
this.endtime = endtime ;
this.modify("endtime",endtime);
}
/**
* 设置 [属性]
*/
......
......@@ -21,33 +21,38 @@ import java.io.Serializable;
import lombok.Data;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.util.domain.EntityClient;
import com.baomidou.mybatisplus.annotation.*;
import cn.ibizlab.util.domain.EntityMP;
/**
* ServiceApi [系统] 对象
* 实体[系统]
*/
@Data
public class WFSystem extends EntityClient implements Serializable {
@TableName(value = "IBZPSSYSTEM",resultMap = "WFSystemResultMap")
public class WFSystem extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 系统标识
*/
@DEField(isKeyField=true)
@JSONField(name = "pSSystemId")
@JsonProperty("pSSystemId")
@TableId(value= "pssystemid",type=IdType.UUID)
@JSONField(name = "pssystemid")
@JsonProperty("pssystemid")
private String pssystemid;
/**
* 系统名称
*/
@JSONField(name = "pSSystemName")
@JsonProperty("pSSystemName")
@TableField(value = "pssystemname")
@JSONField(name = "pssystemname")
@JsonProperty("pssystemname")
private String pssystemname;
/**
* 设置 [系统名称]
*/
......
......@@ -17,17 +17,36 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import cn.ibizlab.util.filter.SearchContextBase;
import cn.ibizlab.util.filter.QueryWrapperContext;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.core.workflow.domain.WFSystem;
/**
* ServiceApi数据实体[WFSystem] 查询条件对象
* 关系型数据实体[WFSystem] 查询条件对象
*/
@Slf4j
@Data
public class WFSystemSearchContext extends SearchContextBase {
private String n_pssystemname_like;//[系统名称]
public class WFSystemSearchContext extends QueryWrapperContext<WFSystem> {
private String n_pssystemname_like;//[系统名称]
public void setN_pssystemname_like(String n_pssystemname_like) {
this.n_pssystemname_like = n_pssystemname_like;
if(!ObjectUtils.isEmpty(this.n_pssystemname_like)){
this.getSelectCond().like("pssystemname", n_pssystemname_like);
}
}
/**
* 启用快速搜索
*/
public void setQuery(String query)
{
this.query=query;
if(!StringUtils.isEmpty(query)){
this.getSelectCond().or().like("pssystemname",query);
}
}
}
......@@ -18,10 +18,12 @@ import cn.ibizlab.core.workflow.domain.WFSystem;
import cn.ibizlab.core.workflow.filter.WFSystemSearchContext;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[WFSystem] 服务对象接口
*/
public interface IWFSystemService{
public interface IWFSystemService extends IService<WFSystem>{
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
......@@ -35,8 +37,21 @@ public interface IWFSystemService{
boolean checkKey(WFSystem et) ;
WFSystem get(String key) ;
Page<WFSystem> searchDefault(WFSystemSearchContext context) ;
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return select * from table where id = '1'
*/
List<JSONObject> select(String sql, Map param);
/**
*自定义SQL
* @param sql update table set name ='test' where id =#{et.param}
* @param param 参数列表 param.put("param","1");
* @return update table set name ='test' where id = '1'
*/
boolean execute(String sql, Map param);
}
......@@ -30,31 +30,47 @@ import cn.ibizlab.core.workflow.service.IWFSystemService;
import cn.ibizlab.util.helper.CachedBeanCopier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.ibizlab.core.workflow.mapper.WFSystemMapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
/**
* 实体[系统] 无存储服务对象接口实现
* 实体[系统] 服务对象接口实现
*/
@Slf4j
@Service
public class WFSystemServiceImpl implements IWFSystemService {
@Service("WFSystemServiceImpl")
public class WFSystemServiceImpl extends ServiceImpl<WFSystemMapper, WFSystem> implements IWFSystemService {
private int batchSize = 500;
@Override
@Transactional
public boolean remove(String key) {
return true;
boolean result=removeById(key);
return result ;
}
public void removeBatch(Collection<String> idList){
@Override
public void removeBatch(Collection<String> idList) {
removeByIds(idList);
}
@Override
@Transactional
public boolean update(WFSystem et) {
//代码实现
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("pssystemid",et.getPssystemid())))
return false;
CachedBeanCopier.copy(get(et.getPssystemid()),et);
return true;
}
public void updateBatch(List<WFSystem> list){
@Override
public void updateBatch(List<WFSystem> list) {
updateBatchById(list,batchSize);
}
@Override
......@@ -65,48 +81,98 @@ public class WFSystemServiceImpl implements IWFSystemService {
@Override
@Transactional
public boolean save(WFSystem et) {
//代码实现
if(!saveOrUpdate(et))
return false;
return true;
}
@Override
@Transactional(
rollbackFor = {Exception.class}
)
public boolean saveOrUpdate(WFSystem et) {
if (null == et) {
return false;
} else {
return checkKey(et) ? this.update(et) : this.create(et);
}
}
@Override
public void saveBatch(List<WFSystem> list) {
saveOrUpdateBatch(list,batchSize);
}
@Override
@Transactional
public boolean create(WFSystem et) {
//代码实现
if(!this.retBool(this.baseMapper.insert(et)))
return false;
CachedBeanCopier.copy(get(et.getPssystemid()),et);
return true;
}
public void createBatch(List<WFSystem> list){
@Override
public void createBatch(List<WFSystem> list) {
this.saveBatch(list,batchSize);
}
@Override
public boolean checkKey(WFSystem et) {
return false;
return (!ObjectUtils.isEmpty(et.getPssystemid()))&&(!Objects.isNull(this.getById(et.getPssystemid())));
}
@Override
@Transactional
public WFSystem get(String key) {
WFSystem et = new WFSystem();
et.setPssystemid(key);
WFSystem et = getById(key);
if(et==null){
et=new WFSystem();
et.setPssystemid(key);
}
else{
}
return et;
}
/**
* 查询集合 DEFAULT
*/
@Override
public Page<WFSystem> searchDefault(WFSystemSearchContext context) {
return new PageImpl<WFSystem>(new ArrayList(),context.getPageable(),0);
com.baomidou.mybatisplus.extension.plugins.pagination.Page<WFSystem> pages=baseMapper.searchDefault(context.getPages(),context,context.getSelectCond());
return new PageImpl<WFSystem>(pages.getRecords(), context.getPageable(), pages.getTotal());
}
@Override
public List<JSONObject> select(String sql, Map param){
return this.baseMapper.selectBySQL(sql,param);
}
@Override
@Transactional
public boolean execute(String sql , Map param){
if (sql == null || sql.isEmpty()) {
return false;
}
if (sql.toLowerCase().trim().startsWith("insert")) {
return this.baseMapper.insertBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("update")) {
return this.baseMapper.updateBySQL(sql,param);
}
if (sql.toLowerCase().trim().startsWith("delete")) {
return this.baseMapper.deleteBySQL(sql,param);
}
log.warn("暂未支持的SQL语法");
return true;
}
}
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog" xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.6.xsd">
<!--输出实体[WF_GROUP]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group-24-1">
<createTable tableName="IBZWFGROUP">
<column name="GROUPID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_GROUPID"/>
</column>
<column name="GROUPNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="GROUPSCOPE" remarks="" type="VARCHAR(100)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_DEFINITION]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_definition-51-2">
<createTable tableName="IBZWFDEFINITION">
<column name="DEFINITIONKEY" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_DEFINITION_DEFINITIONKEY"/>
</column>
<column name="DEFINITIONNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="MODELVERSION" remarks="" type="INT">
</column>
<column name="MODELENABLE" remarks="" type="INT">
</column>
<column name="PSSYSTEMID" remarks="" type="VARCHAR(100)">
</column>
<column name="TASKDEFINITIONKEY" remarks="" type="VARCHAR(100)">
</column>
<column name="MD5CHECK" remarks="" type="VARCHAR(100)">
</column>
<column name="BPMNFILE" remarks="" type="VARCHAR(1000)">
</column>
<column name="DEPLOYKEY" remarks="" type="VARCHAR(100)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_GROUP_MEMBER]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-wf_group_member-39-3">
<createTable tableName="IBZWFMEMBER">
<column name="MEMBERID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_WF_GROUP_MEMBER_MEMBERID"/>
</column>
<column name="MEMBERNAME" remarks="" type="VARCHAR(100)">
</column>
<column name="GROUPID" remarks="" type="VARCHAR(100)">
</column>
<column name="USERID" remarks="" type="VARCHAR(100)">
</column>
</createTable>
</changeSet>
<!--输出实体[WF_GROUP]外键关系 -->
<!--输出实体[WF_DEFINITION]外键关系 -->
<!--输出实体[WF_GROUP_MEMBER]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-wf_group_member-39-4">
<addForeignKeyConstraint baseColumnNames="GROUPID" baseTableName="IBZWFMEMBER" constraintName="DER1N_WF_GROUP_MEMBER_WF_GROUP" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="GROUPID" referencedTableName="IBZWFGROUP" validate="true"/>
</changeSet>
</databaseChangeLog>
!!!!模版产生代码错误:----
FTL stack trace ("~" means nesting-related):
- Failed at: #if de.getAllPSDEDBConfigs()?? && de... [in template "CODETEMPL_zh_CN" at line 14, column 5]
----
\ No newline at end of file
......@@ -4,6 +4,9 @@
<mapper namespace="cn.ibizlab.core.workflow.mapper.WFSystemMapper">
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="WFSystemResultMap" databaseId="mysql">
<![CDATA[select t1.* from (SELECT t1.`PSSYSTEMID`, t1.`PSSYSTEMNAME` FROM `IBZPSSYSTEM` t1 ) t1 where pssystemid=#{id}]]>
</select>
<!--通过mybatis将查询结果注入到entity中,通过配置autoMapping="true"由mybatis自动处理映射关系 -->
<resultMap id="WFSystemResultMap" type="cn.ibizlab.core.workflow.domain.WFSystem" autoMapping="true">
......@@ -28,5 +31,11 @@
]]>
</sql>
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`PSSYSTEMID`, t1.`PSSYSTEMNAME` FROM `IBZPSSYSTEM` t1
]]>
</sql>
</mapper>
......@@ -40,6 +40,21 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
@Autowired
AuthorizationTokenFilter authenticationTokenFilter;
@Value("${ibiz.auth.path:v7/login}")
private String loginPath;
@Value("${ibiz.auth.logoutpath:v7/logout}")
private String logoutPath;
@Value("${ibiz.file.uploadpath:ibizutil/upload}")
private String uploadpath;
@Value("${ibiz.file.downloadpath:ibizutil/download}")
private String downloadpath;
@Value("${ibiz.file.previewpath:ibizutil/preview}")
private String previewpath;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
auth
......@@ -67,13 +82,16 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
httpSecurity
httpSecurity
// 禁用 CSRF
.csrf().disable()
// 授权异常
.exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
// 不创建会话
.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and()
// 过滤请求
.authorizeRequests()
.antMatchers(
......@@ -88,15 +106,21 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
"/**/fonts/**",
"/**/js/**",
"/**/img/**",
"/",
"/webjars/**",
"/swagger-resources/**",
"/v2/**"
"/"
).permitAll()
// 服务中暂时只为重构用户身份,不进行身份认证
.anyRequest().permitAll()
//放行登录请求
.antMatchers( HttpMethod.POST,"/"+loginPath).permitAll()
//放行注销请求
.antMatchers( HttpMethod.GET,"/"+logoutPath).permitAll()
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
httpSecurity
.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class);
}
......
......@@ -54,16 +54,14 @@ public class WFGroupResource {
public WFGroupDTO permissionDTO=new WFGroupDTO();
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Save-all')")
@ApiOperation(value = "Save", tags = {"WFGroup" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/save")
public ResponseEntity<Boolean> save(@RequestBody WFGroupDTO wfgroupdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.save(wfgroupMapping.toDomain(wfgroupdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFGroup" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
......@@ -71,10 +69,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Update-all')")
@ApiOperation(value = "Update", tags = {"WFGroup" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/{wfgroup_id}")
@Transactional
......@@ -86,6 +81,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFGroup" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
......@@ -93,30 +89,21 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFGroup" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfgroups/getdraft")
public ResponseEntity<WFGroupDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupMapping.toDto(wfgroupService.getDraft(new WFGroup())));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFGroup" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFGroupDTO wfgroupdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.checkKey(wfgroupMapping.toDomain(wfgroupdto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Create-all')")
@ApiOperation(value = "Create", tags = {"WFGroup" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups")
@Transactional
......@@ -127,6 +114,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatch", tags = {"WFGroup" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFGroupDTO> wfgroupdtos) {
......@@ -134,10 +122,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFGroup" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/{wfgroup_id}")
@Transactional
......@@ -145,6 +130,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(wfgroupService.remove(wfgroup_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFGroup" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -152,10 +138,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Get-all')")
@ApiOperation(value = "Get", tags = {"WFGroup" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfgroups/{wfgroup_id}")
public ResponseEntity<WFGroupDTO> get(@PathVariable("wfgroup_id") String wfgroup_id) {
......@@ -164,7 +147,7 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFGroup" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfgroups/fetchdefault")
public ResponseEntity<List<WFGroupDTO>> fetchDefault(WFGroupSearchContext context) {
......@@ -177,7 +160,7 @@ public class WFGroupResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFGroup-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"WFGroup" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfgroups/searchdefault")
public ResponseEntity<Page<WFGroupDTO>> searchDefault(@RequestBody WFGroupSearchContext context) {
......@@ -185,8 +168,4 @@ public class WFGroupResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfgroupMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
......@@ -54,30 +54,21 @@ public class WFMemberResource {
public WFMemberDTO permissionDTO=new WFMemberDTO();
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFMember" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfmembers/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFMemberDTO wfmemberdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.checkKey(wfmemberMapping.toDomain(wfmemberdto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFMember" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfmembers/getdraft")
public ResponseEntity<WFMemberDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberMapping.toDto(wfmemberService.getDraft(new WFMember())));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Create-all')")
@ApiOperation(value = "Create", tags = {"WFMember" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfmembers")
@Transactional
......@@ -88,6 +79,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatch", tags = {"WFMember" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfmembers/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -95,10 +87,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFMember" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfmembers/{wfmember_id}")
@Transactional
......@@ -106,6 +95,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.remove(wfmember_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFMember" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfmembers/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -113,16 +103,14 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Save-all')")
@ApiOperation(value = "Save", tags = {"WFMember" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfmembers/save")
public ResponseEntity<Boolean> save(@RequestBody WFMemberDTO wfmemberdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.save(wfmemberMapping.toDomain(wfmemberdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFMember" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfmembers/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -130,10 +118,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Update-all')")
@ApiOperation(value = "Update", tags = {"WFMember" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfmembers/{wfmember_id}")
@Transactional
......@@ -145,6 +130,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFMember" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfmembers/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -152,10 +138,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Get-all')")
@ApiOperation(value = "Get", tags = {"WFMember" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfmembers/{wfmember_id}")
public ResponseEntity<WFMemberDTO> get(@PathVariable("wfmember_id") String wfmember_id) {
......@@ -164,7 +147,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFMember" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfmembers/fetchdefault")
public ResponseEntity<List<WFMemberDTO>> fetchDefault(WFMemberSearchContext context) {
......@@ -177,7 +160,7 @@ public class WFMemberResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"WFMember" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfmembers/searchdefault")
public ResponseEntity<Page<WFMemberDTO>> searchDefault(@RequestBody WFMemberSearchContext context) {
......@@ -185,17 +168,14 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfmemberMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-CheckKey-all')")
@ApiOperation(value = "CheckKeyByWFGroup", tags = {"WFMember" }, notes = "CheckKeyByWFGroup")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/{wfgroup_id}/wfmembers/checkkey")
public ResponseEntity<Boolean> checkKeyByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody WFMemberDTO wfmemberdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.checkKey(wfmemberMapping.toDomain(wfmemberdto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-GetDraft-all')")
@ApiOperation(value = "GetDraftByWFGroup", tags = {"WFMember" }, notes = "GetDraftByWFGroup")
@RequestMapping(method = RequestMethod.GET, value = "/wfgroups/{wfgroup_id}/wfmembers/getdraft")
public ResponseEntity<WFMemberDTO> getDraftByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id) {
......@@ -204,7 +184,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberMapping.toDto(wfmemberService.getDraft(domain)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Create-all')")
@ApiOperation(value = "CreateByWFGroup", tags = {"WFMember" }, notes = "CreateByWFGroup")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/{wfgroup_id}/wfmembers")
@Transactional
......@@ -216,6 +196,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatchByWFGroup", tags = {"WFMember" }, notes = "createBatchByWFGroup")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/{wfgroup_id}/wfmembers/batch")
public ResponseEntity<Boolean> createBatchByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -227,7 +208,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Remove-all')")
@ApiOperation(value = "RemoveByWFGroup", tags = {"WFMember" }, notes = "RemoveByWFGroup")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/{wfgroup_id}/wfmembers/{wfmember_id}")
@Transactional
......@@ -235,6 +216,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.remove(wfmember_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatchByWFGroup", tags = {"WFMember" }, notes = "RemoveBatchByWFGroup")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfgroups/{wfgroup_id}/wfmembers/batch")
public ResponseEntity<Boolean> removeBatchByWFGroup(@RequestBody List<String> ids) {
......@@ -242,7 +224,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Save-all')")
@ApiOperation(value = "SaveByWFGroup", tags = {"WFMember" }, notes = "SaveByWFGroup")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/{wfgroup_id}/wfmembers/save")
public ResponseEntity<Boolean> saveByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody WFMemberDTO wfmemberdto) {
......@@ -251,6 +233,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.save(domain));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatchByWFGroup", tags = {"WFMember" }, notes = "SaveBatchByWFGroup")
@RequestMapping(method = RequestMethod.POST, value = "/wfgroups/{wfgroup_id}/wfmembers/savebatch")
public ResponseEntity<Boolean> saveBatchByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -262,7 +245,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Update-all')")
@ApiOperation(value = "UpdateByWFGroup", tags = {"WFMember" }, notes = "UpdateByWFGroup")
@RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/{wfgroup_id}/wfmembers/{wfmember_id}")
@Transactional
......@@ -275,6 +258,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatchByWFGroup", tags = {"WFMember" }, notes = "UpdateBatchByWFGroup")
@RequestMapping(method = RequestMethod.PUT, value = "/wfgroups/{wfgroup_id}/wfmembers/batch")
public ResponseEntity<Boolean> updateBatchByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -286,7 +270,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Get-all')")
@ApiOperation(value = "GetByWFGroup", tags = {"WFMember" }, notes = "GetByWFGroup")
@RequestMapping(method = RequestMethod.GET, value = "/wfgroups/{wfgroup_id}/wfmembers/{wfmember_id}")
public ResponseEntity<WFMemberDTO> getByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @PathVariable("wfmember_id") String wfmember_id) {
......@@ -295,7 +279,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@ApiOperation(value = "fetchDEFAULTByWFGroup", tags = {"WFMember" } ,notes = "fetchDEFAULTByWFGroup")
@RequestMapping(method= RequestMethod.GET , value="/wfgroups/{wfgroup_id}/wfmembers/fetchdefault")
public ResponseEntity<List<WFMemberDTO>> fetchWFMemberDefaultByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id,WFMemberSearchContext context) {
......@@ -309,7 +293,7 @@ public class WFMemberResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@ApiOperation(value = "searchDEFAULTByWFGroup", tags = {"WFMember" } ,notes = "searchDEFAULTByWFGroup")
@RequestMapping(method= RequestMethod.POST , value="/wfgroups/{wfgroup_id}/wfmembers/searchdefault")
public ResponseEntity<Page<WFMemberDTO>> searchWFMemberDefaultByWFGroup(@PathVariable("wfgroup_id") String wfgroup_id, @RequestBody WFMemberSearchContext context) {
......@@ -318,17 +302,14 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfmemberMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-CheckKey-all')")
@ApiOperation(value = "CheckKeyByWFUser", tags = {"WFMember" }, notes = "CheckKeyByWFUser")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/{wfuser_id}/wfmembers/checkkey")
public ResponseEntity<Boolean> checkKeyByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody WFMemberDTO wfmemberdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.checkKey(wfmemberMapping.toDomain(wfmemberdto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-GetDraft-all')")
@ApiOperation(value = "GetDraftByWFUser", tags = {"WFMember" }, notes = "GetDraftByWFUser")
@RequestMapping(method = RequestMethod.GET, value = "/wfusers/{wfuser_id}/wfmembers/getdraft")
public ResponseEntity<WFMemberDTO> getDraftByWFUser(@PathVariable("wfuser_id") String wfuser_id) {
......@@ -337,7 +318,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberMapping.toDto(wfmemberService.getDraft(domain)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Create-all')")
@ApiOperation(value = "CreateByWFUser", tags = {"WFMember" }, notes = "CreateByWFUser")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/{wfuser_id}/wfmembers")
@Transactional
......@@ -349,6 +330,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatchByWFUser", tags = {"WFMember" }, notes = "createBatchByWFUser")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/{wfuser_id}/wfmembers/batch")
public ResponseEntity<Boolean> createBatchByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -360,7 +342,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Remove-all')")
@ApiOperation(value = "RemoveByWFUser", tags = {"WFMember" }, notes = "RemoveByWFUser")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/{wfuser_id}/wfmembers/{wfmember_id}")
@Transactional
......@@ -368,6 +350,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.remove(wfmember_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatchByWFUser", tags = {"WFMember" }, notes = "RemoveBatchByWFUser")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/{wfuser_id}/wfmembers/batch")
public ResponseEntity<Boolean> removeBatchByWFUser(@RequestBody List<String> ids) {
......@@ -375,7 +358,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Save-all')")
@ApiOperation(value = "SaveByWFUser", tags = {"WFMember" }, notes = "SaveByWFUser")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/{wfuser_id}/wfmembers/save")
public ResponseEntity<Boolean> saveByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody WFMemberDTO wfmemberdto) {
......@@ -384,6 +367,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(wfmemberService.save(domain));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatchByWFUser", tags = {"WFMember" }, notes = "SaveBatchByWFUser")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/{wfuser_id}/wfmembers/savebatch")
public ResponseEntity<Boolean> saveBatchByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -395,7 +379,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Update-all')")
@ApiOperation(value = "UpdateByWFUser", tags = {"WFMember" }, notes = "UpdateByWFUser")
@RequestMapping(method = RequestMethod.PUT, value = "/wfusers/{wfuser_id}/wfmembers/{wfmember_id}")
@Transactional
......@@ -408,6 +392,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatchByWFUser", tags = {"WFMember" }, notes = "UpdateBatchByWFUser")
@RequestMapping(method = RequestMethod.PUT, value = "/wfusers/{wfuser_id}/wfmembers/batch")
public ResponseEntity<Boolean> updateBatchByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody List<WFMemberDTO> wfmemberdtos) {
......@@ -419,7 +404,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Get-all')")
@ApiOperation(value = "GetByWFUser", tags = {"WFMember" }, notes = "GetByWFUser")
@RequestMapping(method = RequestMethod.GET, value = "/wfusers/{wfuser_id}/wfmembers/{wfmember_id}")
public ResponseEntity<WFMemberDTO> getByWFUser(@PathVariable("wfuser_id") String wfuser_id, @PathVariable("wfmember_id") String wfmember_id) {
......@@ -428,7 +413,7 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@ApiOperation(value = "fetchDEFAULTByWFUser", tags = {"WFMember" } ,notes = "fetchDEFAULTByWFUser")
@RequestMapping(method= RequestMethod.GET , value="/wfusers/{wfuser_id}/wfmembers/fetchdefault")
public ResponseEntity<List<WFMemberDTO>> fetchWFMemberDefaultByWFUser(@PathVariable("wfuser_id") String wfuser_id,WFMemberSearchContext context) {
......@@ -442,7 +427,7 @@ public class WFMemberResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFMember-Default-all')")
@ApiOperation(value = "searchDEFAULTByWFUser", tags = {"WFMember" } ,notes = "searchDEFAULTByWFUser")
@RequestMapping(method= RequestMethod.POST , value="/wfusers/{wfuser_id}/wfmembers/searchdefault")
public ResponseEntity<Page<WFMemberDTO>> searchWFMemberDefaultByWFUser(@PathVariable("wfuser_id") String wfuser_id, @RequestBody WFMemberSearchContext context) {
......@@ -451,8 +436,4 @@ public class WFMemberResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfmemberMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
......@@ -54,16 +54,14 @@ public class WFProcessDefinitionResource {
public WFProcessDefinitionDTO permissionDTO=new WFProcessDefinitionDTO();
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Save-all')")
@ApiOperation(value = "Save", tags = {"WFProcessDefinition" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/save")
public ResponseEntity<Boolean> save(@RequestBody WFProcessDefinitionDTO wfprocessdefinitiondto) {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.save(wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFProcessDefinition" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
......@@ -71,10 +69,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Update-all')")
@ApiOperation(value = "Update", tags = {"WFProcessDefinition" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfprocessdefinitions/{wfprocessdefinition_id}")
@Transactional
......@@ -86,6 +81,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFProcessDefinition" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
......@@ -93,10 +89,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Get-all')")
@ApiOperation(value = "Get", tags = {"WFProcessDefinition" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfprocessdefinitions/{wfprocessdefinition_id}")
public ResponseEntity<WFProcessDefinitionDTO> get(@PathVariable("wfprocessdefinition_id") String wfprocessdefinition_id) {
......@@ -105,30 +98,21 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFProcessDefinition" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFProcessDefinitionDTO wfprocessdefinitiondto) {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.checkKey(wfprocessdefinitionMapping.toDomain(wfprocessdefinitiondto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFProcessDefinition" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfprocessdefinitions/getdraft")
public ResponseEntity<WFProcessDefinitionDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionMapping.toDto(wfprocessdefinitionService.getDraft(new WFProcessDefinition())));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Create-all')")
@ApiOperation(value = "Create", tags = {"WFProcessDefinition" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions")
@Transactional
......@@ -139,6 +123,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatch", tags = {"WFProcessDefinition" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFProcessDefinitionDTO> wfprocessdefinitiondtos) {
......@@ -146,10 +131,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFProcessDefinition" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfprocessdefinitions/{wfprocessdefinition_id}")
@Transactional
......@@ -157,6 +139,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(wfprocessdefinitionService.remove(wfprocessdefinition_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFProcessDefinition" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfprocessdefinitions/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -164,7 +147,7 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFProcessDefinition" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfprocessdefinitions/fetchdefault")
public ResponseEntity<List<WFProcessDefinitionDTO>> fetchDefault(WFProcessDefinitionSearchContext context) {
......@@ -177,7 +160,7 @@ public class WFProcessDefinitionResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFProcessDefinition-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"WFProcessDefinition" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfprocessdefinitions/searchdefault")
public ResponseEntity<Page<WFProcessDefinitionDTO>> searchDefault(@RequestBody WFProcessDefinitionSearchContext context) {
......@@ -185,8 +168,4 @@ public class WFProcessDefinitionResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfprocessdefinitionMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
......@@ -54,10 +54,7 @@ public class WFREModelResource {
public WFREModelDTO permissionDTO=new WFREModelDTO();
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Update-all')")
@ApiOperation(value = "Update", tags = {"WFREModel" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/{wfremodel_id}")
@Transactional
......@@ -69,6 +66,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'None',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFREModel" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfremodels/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
......@@ -76,16 +74,14 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Save-all')")
@ApiOperation(value = "Save", tags = {"WFREModel" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/save")
public ResponseEntity<Boolean> save(@RequestBody WFREModelDTO wfremodeldto) {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.save(wfremodelMapping.toDomain(wfremodeldto)));
}
@PreAuthorize("hasPermission('Save',{'None',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFREModel" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
......@@ -93,10 +89,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Get-all')")
@ApiOperation(value = "Get", tags = {"WFREModel" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfremodels/{wfremodel_id}")
public ResponseEntity<WFREModelDTO> get(@PathVariable("wfremodel_id") String wfremodel_id) {
......@@ -105,10 +98,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Create-all')")
@ApiOperation(value = "Create", tags = {"WFREModel" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels")
@Transactional
......@@ -119,6 +109,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'None',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatch", tags = {"WFREModel" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFREModelDTO> wfremodeldtos) {
......@@ -126,20 +117,14 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFREModel" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfremodels/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFREModelDTO wfremodeldto) {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.checkKey(wfremodelMapping.toDomain(wfremodeldto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFREModel" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/{wfremodel_id}")
@Transactional
......@@ -147,6 +132,7 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelService.remove(wfremodel_id));
}
@PreAuthorize("hasPermission('Remove',{'None',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFREModel" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfremodels/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -154,17 +140,14 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFREModel" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfremodels/getdraft")
public ResponseEntity<WFREModelDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfremodelMapping.toDto(wfremodelService.getDraft(new WFREModel())));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFREModel" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfremodels/fetchdefault")
public ResponseEntity<List<WFREModelDTO>> fetchDefault(WFREModelSearchContext context) {
......@@ -177,7 +160,7 @@ public class WFREModelResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFREModel-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"WFREModel" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfremodels/searchdefault")
public ResponseEntity<Page<WFREModelDTO>> searchDefault(@RequestBody WFREModelSearchContext context) {
......@@ -185,8 +168,4 @@ public class WFREModelResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfremodelMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
......@@ -54,10 +54,7 @@ public class WFSystemResource {
public WFSystemDTO permissionDTO=new WFSystemDTO();
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFSystem" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfsystems/{wfsystem_id}")
@Transactional
......@@ -65,6 +62,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.remove(wfsystem_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFSystem" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfsystems/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -72,10 +70,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Update-all')")
@ApiOperation(value = "Update", tags = {"WFSystem" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfsystems/{wfsystem_id}")
@Transactional
......@@ -87,6 +82,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFSystem" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfsystems/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
......@@ -94,26 +90,21 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFSystem" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfsystems/getdraft")
public ResponseEntity<WFSystemDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemMapping.toDto(wfsystemService.getDraft(new WFSystem())));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Save-all')")
@ApiOperation(value = "Save", tags = {"WFSystem" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/save")
public ResponseEntity<Boolean> save(@RequestBody WFSystemDTO wfsystemdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.save(wfsystemMapping.toDomain(wfsystemdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFSystem" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
......@@ -121,10 +112,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Create-all')")
@ApiOperation(value = "Create", tags = {"WFSystem" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems")
@Transactional
......@@ -135,6 +123,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatch", tags = {"WFSystem" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFSystemDTO> wfsystemdtos) {
......@@ -142,20 +131,14 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFSystem" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfsystems/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFSystemDTO wfsystemdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfsystemService.checkKey(wfsystemMapping.toDomain(wfsystemdto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Get-all')")
@ApiOperation(value = "Get", tags = {"WFSystem" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfsystems/{wfsystem_id}")
public ResponseEntity<WFSystemDTO> get(@PathVariable("wfsystem_id") String wfsystem_id) {
......@@ -164,7 +147,7 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFSystem" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfsystems/fetchdefault")
public ResponseEntity<List<WFSystemDTO>> fetchDefault(WFSystemSearchContext context) {
......@@ -177,7 +160,7 @@ public class WFSystemResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFSystem-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"WFSystem" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfsystems/searchdefault")
public ResponseEntity<Page<WFSystemDTO>> searchDefault(@RequestBody WFSystemSearchContext context) {
......@@ -185,8 +168,4 @@ public class WFSystemResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfsystemMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
......@@ -54,10 +54,7 @@ public class WFUserResource {
public WFUserDTO permissionDTO=new WFUserDTO();
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Remove-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Remove-all')")
@ApiOperation(value = "Remove", tags = {"WFUser" }, notes = "Remove")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/{wfuser_id}")
@Transactional
......@@ -65,6 +62,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(wfuserService.remove(wfuser_id));
}
@PreAuthorize("hasPermission('Remove',{'Sql',this.humanMapping,this.permissionDTO,#ids})")
@ApiOperation(value = "RemoveBatch", tags = {"WFUser" }, notes = "RemoveBatch")
@RequestMapping(method = RequestMethod.DELETE, value = "/wfusers/batch")
public ResponseEntity<Boolean> removeBatch(@RequestBody List<String> ids) {
......@@ -72,26 +70,21 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-GetDraft-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-GetDraft-all')")
@ApiOperation(value = "GetDraft", tags = {"WFUser" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/wfusers/getdraft")
public ResponseEntity<WFUserDTO> getDraft() {
return ResponseEntity.status(HttpStatus.OK).body(wfuserMapping.toDto(wfuserService.getDraft(new WFUser())));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Save-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Save-all')")
@ApiOperation(value = "Save", tags = {"WFUser" }, notes = "Save")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/save")
public ResponseEntity<Boolean> save(@RequestBody WFUserDTO wfuserdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfuserService.save(wfuserMapping.toDomain(wfuserdto)));
}
@PreAuthorize("hasPermission('Save',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "SaveBatch", tags = {"WFUser" }, notes = "SaveBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/savebatch")
public ResponseEntity<Boolean> saveBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
......@@ -99,10 +92,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Update-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Update-all')")
@ApiOperation(value = "Update", tags = {"WFUser" }, notes = "Update")
@RequestMapping(method = RequestMethod.PUT, value = "/wfusers/{wfuser_id}")
@Transactional
......@@ -114,6 +104,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Update',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "UpdateBatch", tags = {"WFUser" }, notes = "UpdateBatch")
@RequestMapping(method = RequestMethod.PUT, value = "/wfusers/batch")
public ResponseEntity<Boolean> updateBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
......@@ -121,10 +112,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Get-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Get-all')")
@ApiOperation(value = "Get", tags = {"WFUser" }, notes = "Get")
@RequestMapping(method = RequestMethod.GET, value = "/wfusers/{wfuser_id}")
public ResponseEntity<WFUserDTO> get(@PathVariable("wfuser_id") String wfuser_id) {
......@@ -133,10 +121,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Create-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Create-all')")
@ApiOperation(value = "Create", tags = {"WFUser" }, notes = "Create")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers")
@Transactional
......@@ -147,6 +132,7 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(dto);
}
@PreAuthorize("hasPermission('Create',{'Sql',this.humanMapping,#humandtos})")
@ApiOperation(value = "createBatch", tags = {"WFUser" }, notes = "createBatch")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/batch")
public ResponseEntity<Boolean> createBatch(@RequestBody List<WFUserDTO> wfuserdtos) {
......@@ -154,17 +140,14 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK).body(true);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-CheckKey-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-CheckKey-all')")
@ApiOperation(value = "CheckKey", tags = {"WFUser" }, notes = "CheckKey")
@RequestMapping(method = RequestMethod.POST, value = "/wfusers/checkkey")
public ResponseEntity<Boolean> checkKey(@RequestBody WFUserDTO wfuserdto) {
return ResponseEntity.status(HttpStatus.OK).body(wfuserService.checkKey(wfuserMapping.toDomain(wfuserdto)));
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Default-all')")
@ApiOperation(value = "fetchDEFAULT", tags = {"WFUser" } ,notes = "fetchDEFAULT")
@RequestMapping(method= RequestMethod.GET , value="/wfusers/fetchdefault")
public ResponseEntity<List<WFUserDTO>> fetchDefault(WFUserSearchContext context) {
......@@ -177,7 +160,7 @@ public class WFUserResource {
.body(list);
}
//@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Default-all')")
@PreAuthorize("hasAnyAuthority('ROLE_SUPERADMIN','ibzwf-WFUser-Default-all')")
@ApiOperation(value = "searchDEFAULT", tags = {"WFUser" } ,notes = "searchDEFAULT")
@RequestMapping(method= RequestMethod.POST , value="/wfusers/searchdefault")
public ResponseEntity<Page<WFUserDTO>> searchDefault(@RequestBody WFUserSearchContext context) {
......@@ -185,8 +168,4 @@ public class WFUserResource {
return ResponseEntity.status(HttpStatus.OK)
.body(new PageImpl(wfuserMapping.toDto(domains.getContent()), context.getPageable(), domains.getTotalElements()));
}
}
......@@ -10,8 +10,6 @@ import cn.ibizlab.util.domain.DTOBase;
import cn.ibizlab.util.domain.EntityBase;
import cn.ibizlab.util.domain.MappingBase;
import cn.ibizlab.util.enums.DEPredefinedFieldType;
import cn.ibizlab.util.filter.QueryBuildContext;
import cn.ibizlab.util.filter.QueryWrapperContext;
import cn.ibizlab.util.helper.DEFieldCacheMap;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
......@@ -50,24 +48,123 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
@Lazy
private MongoTemplate mongoTemplate;
/**
* 批处理权限检查[createBatch:updateBatch:removeBatch]
* @param authentication
* @param DEAction
* @param params
* @return
*/
@Override
public boolean hasPermission(Authentication authentication, Object deAction, Object gridParam) {
public boolean hasPermission(Authentication authentication, Object DEAction, Object params) {
//未开启权限校验、超级管理员则不进行权限检查
if(AuthenticationUser.getAuthenticationUser().getSuperuser()==1 || !enablePermissionValid)
return true;
List paramList = (ArrayList) params;
String deStorageMode= (String) paramList.get(0);
String action=String.valueOf(DEAction);
List<String> ids=null;
EntityBase entity;
List<EntityBase> entityList = null;
JSONObject userPermission= AuthenticationUser.getAuthenticationUser().getPermissionList();
if(userPermission==null)
return false;
MappingBase mappingBase= (MappingBase) paramList.get(1);
//参数准备
if(action.equalsIgnoreCase("remove")){
entity= (EntityBase) mappingBase.toDomain(paramList.get(2));
ids= (List<String>) paramList.get(3);
}
else{
List<DTOBase> dtoList = (List<DTOBase>) paramList.get(2);
if(dtoList.size()==0)
return false;
entityList =mappingBase.toDomain(dtoList);
entity = (EntityBase) mappingBase.toDomain(dtoList.get(0));
}
if (entity==null)
return false;
JSONObject permissionList=userPermission.getJSONObject("entities");
String entityName = entity.getClass().getSimpleName();
//拥有全部数据访问权限时,则跳过权限检查
if(isAllData(entityName,action,permissionList)){
return true;
}
//检查是否有操作权限[create.update.delete.read]
if(!validDEActionHasPermission(entityName,action,permissionList)){
return false;
}
JSONArray dataRangeList=getDataRange(entityName,action,permissionList);
if(dataRangeList.size()==0)
return false;
if(action.equalsIgnoreCase("create")){
return createBatchActionPermissionValid(entityList,dataRangeList);
}
else if(action.equalsIgnoreCase("save")){
return saveBatchActionPermissionValid(deStorageMode, entityList, dataRangeList);
}
else{
if(!action.equalsIgnoreCase("remove")){
ids=getIds(entity,entityList);
}
if(ids.size()==0)
return false;
return otherBatchActionPermissionValidRouter(deStorageMode, entity ,ids, dataRangeList);
}
}
/**
* 批save校验
* @param deStorageMode
* @param entityList
* @param dataRangeList
* @return
*/
private boolean saveBatchActionPermissionValid(String deStorageMode, List<EntityBase> entityList, JSONArray dataRangeList) {
if(entityList==null || entityList.size()==0)
return false;
EntityBase tempEntity=entityList.get(0);
Map<String,String> permissionField=getPermissionField(tempEntity);
String keyFieldName=permissionField.get(keyFieldTag);
List createList=new ArrayList();
List<String> updateList =new ArrayList();
for(EntityBase entity : entityList){
Object id = entity.get(keyFieldName);
if(ObjectUtils.isEmpty(id))
createList.add(entity);
else
updateList.add(String.valueOf(id));
}
if(updateList.size()>0){
boolean isUpdate = otherBatchActionPermissionValidRouter(deStorageMode, tempEntity ,updateList, dataRangeList);
if(!isUpdate)
return false;
}
if(createList.size()>0){
boolean isCreate=createBatchActionPermissionValid(entityList,dataRangeList);
if(!isCreate)
return false;
}
return true;
}
/**
* 实体行为权限检查 :用于检查当前用户是否拥有实体的新建、编辑、删除权限
*
* @param authentication
* @param srfKey 当前操作数据的主键
* @param id 当前操作数据的主键
* @param action 当前操作行为:如:[READ、UPDATE、DELETE]
* @param params 相关参数
* @return true/false true则允许当前行为,false拒绝行为
*/
@Override
public boolean hasPermission(Authentication authentication, Serializable srfKey, String action, Object params) {
public boolean hasPermission(Authentication authentication, Serializable id, String action, Object params) {
//未开启权限校验、超级管理员则不进行权限检查
if(AuthenticationUser.getAuthenticationUser().getSuperuser()==1 || !enablePermissionValid)
......@@ -83,22 +180,127 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
return false;
JSONObject userPermission= AuthenticationUser.getAuthenticationUser().getPermissionList();
if(userPermission==null)
return false;
JSONObject permissionList=userPermission.getJSONObject("entities");
String entityName = entity.getClass().getSimpleName();
//拥有全部数据访问权限时,则跳过权限检查
if(isAllData(permissionList,entityName,action)){
if(isAllData(entityName,action,permissionList)){
return true;
}
//检查是否有操作权限[create.update.delete.read]
if(!validDEActionHasPermission(permissionList,entityName,action)){
if(!validDEActionHasPermission(entityName,action,permissionList)){
return false;
}
JSONArray dataRangeList=getDataRange(entityName,action,permissionList);
if(dataRangeList.size()==0)
return false;
if(action.equalsIgnoreCase("save")){
Map<String,String> permissionField=getPermissionField(entity);
String keyFieldName=permissionField.get(keyFieldTag);
Object srfKey=entity.get(keyFieldName);
if(ObjectUtils.isEmpty(srfKey))
action="create";
else
action="update";
}
if(action.equalsIgnoreCase("create")){
return createActionPermissionValid(permissionList,entity, action);
return createActionPermissionValid(entity,dataRangeList);
}
else{
return otherActionPermissionValidRouter(deStorageMode, entity, id, dataRangeList);
}
}
/**
* 批处理新建权限校验
* @param entityList
* @param dataRangeList
* @return
*/
private boolean createBatchActionPermissionValid(List<EntityBase> entityList,JSONArray dataRangeList){
for(EntityBase entity : entityList){
boolean isCreate = createActionPermissionValid(entity ,dataRangeList);
if(!isCreate){
return false;
}
}
return true;
}
/**
* 批处理行为权限校验[get:update:delete]
* @param deStorageMode
* @param entity
* @param ids
* @param dataRangeList
* @return
*/
private boolean otherBatchActionPermissionValidRouter(String deStorageMode , EntityBase entity , List<String> ids , JSONArray dataRangeList){
if(deStorageMode.equalsIgnoreCase("sql")){
return sqlBatchPermissionValid(entity ,ids, dataRangeList);
}
else if(deStorageMode.equalsIgnoreCase("nosql")){
return noSqlBatchPermissionValid(entity, ids , dataRangeList);
}
else if(deStorageMode.equalsIgnoreCase("serviceapi")){
return true;
}
else {
throw new RuntimeException(String.format("未能识别实体对应存储模式[%s]",deStorageMode));
}
}
/**
* SQL批处理权限校验
* @param entity
* @param ids
* @param dataRangeList
* @return
*/
private boolean sqlBatchPermissionValid(EntityBase entity , List<String> ids, JSONArray dataRangeList){
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyFieldName=permissionField.get(keyFieldTag);
ServiceImpl service= SpringContextHolder.getBean(String.format("%s%s",entity.getClass().getSimpleName(),"ServiceImpl"));//获取实体service对象
//通过权限表达式来获取sql
String permissionSQL= String.format(" (%s) AND ( %s in (%s) ) ",getPermissionSQL(entity,dataRangeList),keyFieldName,getEntityKeyCond(ids)); //拼接权限条件-编辑
//执行sql进行权限检查
QueryWrapper permissionWrapper=getPermissionWrapper(permissionSQL);//构造权限条件
List list=service.list(permissionWrapper);
if(list.size() == ids.size()){
return true;
}else{
return false;
}
}
/**
* NoSQL批处理权限校验
* @param entity
* @param ids
* @param dataRange
* @return
*/
private boolean noSqlBatchPermissionValid(EntityBase entity, List<String> ids, JSONArray dataRange) {
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyFieldName=permissionField.get(keyFieldTag);
//根据权限表达式填充权限条件
QueryBuilder permissionCond=getNoSqlPermissionCond(entity,dataRange);
//权限条件拼接主键
permissionCond.and(keyFieldName).in(ids);
//执行权限检查
Query query = new BasicQuery(permissionCond.get().toString());
List list=mongoTemplate.find(query,entity.getClass());
if(list.size()==ids.size()){
return true;
}
else{
return otherActionPermissionValidRouter(deStorageMode, entity , action , srfKey, permissionList);
return false;
}
}
......@@ -109,7 +311,7 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* @param action
* @return
*/
private boolean isAllData(JSONObject permissionList, String entityName, String action) {
private boolean isAllData( String entityName, String action ,JSONObject permissionList) {
if(permissionList==null)
return false;
......@@ -133,7 +335,7 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* userPermission:{"ENTITY":{"DEACTION":{"READ":["CURORG"]},"DATASET":{"Default":["CURORG"]}}}
* @return
*/
private boolean validDEActionHasPermission(JSONObject userPermission,String entityName , String action ){
private boolean validDEActionHasPermission(String entityName , String action ,JSONObject userPermission){
boolean hasPermission=false;
if(userPermission==null)
......@@ -152,28 +354,14 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
/**
* 新建行为校验
* @param permissionList
* @param entity
* @param action
* @param dataRangeList
* @return
*/
private boolean createActionPermissionValid(JSONObject permissionList,EntityBase entity, String action){
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyField=permissionField.get(keyFieldTag);
if(StringUtils.isEmpty(keyField)){
throw new RuntimeException("权限校验失败,请检查当前实体中是否已经配置主键属性!");
}
//获取权限表达式[全部数据、本单位、本部门等]
JSONObject entityObj=permissionList.getJSONObject(entity.getClass().getSimpleName());//获取实体
JSONObject permissionType= entityObj.getJSONObject(DEActionType);
JSONArray dataRangeList=permissionType.getJSONArray(action);//行为:read;insert...
if(dataRangeList.size()==0)
return false;
private boolean createActionPermissionValid(EntityBase entity, JSONArray dataRangeList){
boolean isCreate=true;
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String orgField=permissionField.get("orgfield");
String orgDeptField=permissionField.get("orgsecfield");
String createManField=permissionField.get("createmanfield");
......@@ -230,18 +418,17 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
* 根据实体存储模式,进行鉴权
* @param deStorageMode
* @param entity
* @param action
* @param srfKey
* @param permissionList
* @param id
* @param dataRangeList
* @return
*/
private boolean otherActionPermissionValidRouter(String deStorageMode, EntityBase entity , String action , Object srfKey , JSONObject permissionList){
private boolean otherActionPermissionValidRouter(String deStorageMode, EntityBase entity , Object id , JSONArray dataRangeList){
if(deStorageMode.equalsIgnoreCase("sql")){
return sqlPermissionValid(entity , action , srfKey, permissionList);
return sqlPermissionValid(entity , id, dataRangeList);
}
else if(deStorageMode.equalsIgnoreCase("nosql")){
return noSqlPermissionValid(entity , action , srfKey, permissionList);
return noSqlPermissionValid(entity , id, dataRangeList);
}
else if(deStorageMode.equalsIgnoreCase("serviceapi")){
return true;
......@@ -254,32 +441,16 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
/**
* sql存储模式实体行为鉴权
* @param entity
* @param action
* @param srfKey
* @param permissionList
* @param id
* @param dataRangeList
* @return
*/
private boolean sqlPermissionValid(EntityBase entity , String action , Object srfKey, JSONObject permissionList){
String entityName=entity.getClass().getSimpleName();
ServiceImpl service= SpringContextHolder.getBean(String.format("%s%s",entityName,"ServiceImpl"));//获取实体service对象
private boolean sqlPermissionValid(EntityBase entity , Object id, JSONArray dataRangeList){
ServiceImpl service= SpringContextHolder.getBean(String.format("%s%s",entity.getClass().getSimpleName(),"ServiceImpl"));//获取实体service对象
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyField=permissionField.get(keyFieldTag);
if(StringUtils.isEmpty(keyField)){
throw new RuntimeException("权限校验失败,请检查当前实体中是否已经配置主键属性!");
}
//获取权限表达式[全部数据、本单位、本部门等]
JSONObject entityObj=permissionList.getJSONObject(entity.getClass().getSimpleName());//获取实体
JSONObject permissionType= entityObj.getJSONObject(DEActionType);
JSONArray opprivList=permissionType.getJSONArray(action);//行为:read;insert...
if(opprivList.size()==0)
return false;
//通过权限表达式来获取sql
String tempPermissionSQL=getPermissionSQL(entity,opprivList);
String permissionSQL= String.format(" (%s) AND (%s='%s')",tempPermissionSQL,keyField,srfKey); //拼接权限条件-编辑
String permissionSQL= String.format(" (%s) AND (%s='%s')",getPermissionSQL(entity,dataRangeList),permissionField.get(keyFieldTag),id); //拼接权限条件-编辑
//执行sql进行权限检查
QueryWrapper permissionWrapper=getPermissionWrapper(permissionSQL);//构造权限条件
List list=service.list(permissionWrapper);
......@@ -294,32 +465,18 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
/**
* NoSQL实体行为鉴权
* @param entity
* @param action
* @param srfKey
* @param permissionList
* @param id
* @param dataRangeList
* @return
*/
private boolean noSqlPermissionValid(EntityBase entity, String action, Object srfKey, JSONObject permissionList) {
private boolean noSqlPermissionValid(EntityBase entity, Object id, JSONArray dataRangeList) {
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String keyField=permissionField.get(keyFieldTag);
if(StringUtils.isEmpty(keyField)){
throw new RuntimeException("权限校验失败,请检查当前实体中是否已经配置主键属性!");
}
//获取权限表达式[全部数据、本单位、本部门等]
JSONObject entityObj=permissionList.getJSONObject(entity.getClass().getSimpleName());//获取实体
JSONObject permissionType= entityObj.getJSONObject(DEActionType);
JSONArray dataRange=permissionType.getJSONArray(action);//行为:read;insert...
if(dataRange.size()==0)
return false;
//根据权限表达式填充权限条件
QueryBuilder permissionCond=new QueryBuilder();
fillNoSqlPermissionCond(dataRange,entity,permissionCond);
QueryBuilder permissionCond=getNoSqlPermissionCond(entity,dataRangeList);
//权限条件拼接主键
permissionCond.and(keyField).is(srfKey);
permissionCond.and(keyField).is(id);
//执行权限检查
Query query = new BasicQuery(permissionCond.get().toString());
List list=mongoTemplate.find(query,entity.getClass());
......@@ -334,12 +491,13 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
/**
* 为NoSQL存储模式的表格查询填充权限条件
* @param oppriList
* @param entity
* @param permissionSQL
* @param dataRangeList
* @return
*/
private void fillNoSqlPermissionCond(JSONArray oppriList, EntityBase entity, QueryBuilder permissionSQL){
private QueryBuilder getNoSqlPermissionCond( EntityBase entity ,JSONArray dataRangeList ){
QueryBuilder permissionSQL=new QueryBuilder();
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String orgField=permissionField.get("orgfield");
String orgDeptField=permissionField.get("orgsecfield");
......@@ -351,8 +509,8 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
Set<String> orgDeptParent = userInfo.get("parentdept");
Set<String> orgDeptChild = userInfo.get("subdept");
for(int i=0;i<oppriList.size();i++){
String permissionCond=oppriList.getString(i);//权限配置条件
for(int i=0;i<dataRangeList.size();i++){
String permissionCond=dataRangeList.getString(i);//权限配置条件
if(permissionCond.equals("curorg")){ //本单位
permissionSQL.or(new QueryBuilder().and(orgField).is(AuthenticationUser.getAuthenticationUser().getOrgid()).get());
}
......@@ -378,6 +536,8 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
permissionSQL.or(new QueryBuilder().get());
}
}
return permissionSQL;
}
/**
......@@ -530,4 +690,53 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
return resultCond;
}
/**
* 转换[a,b]格式字符串到 'a','b'格式
*
* @return
*/
private String getEntityKeyCond(List<String> array) {
String[] arr = array.toArray(new String[array.size()]);
return "'" + String.join("','", arr) + "'";
}
/**
* 获取数据范围
* @param entityName
* @param action
* @param permissionList
* @return
*/
private JSONArray getDataRange(String entityName, String action , JSONObject permissionList){
//获取权限表达式[全部数据、本单位、本部门等]
JSONObject entityObj=permissionList.getJSONObject(entityName);//获取实体
JSONObject permissionType= entityObj.getJSONObject(DEActionType);
JSONArray dataRangeList=permissionType.getJSONArray(action);//行为:read;insert...
return dataRangeList;
}
/**
* 获取实体主键集合
* @param entityBase
* @param entityList
* @return
*/
private List<String> getIds(EntityBase entityBase ,List<EntityBase> entityList) {
List<String> entityKeyList=new ArrayList<>();
Map<String,String> permissionField=getPermissionField(entityBase);//获取组织、部门预置属性
String keyFieldName=permissionField.get(keyFieldTag);
if(StringUtils.isEmpty(keyFieldName))
return entityKeyList;
for(EntityBase entity: entityList){
Object objEntityKey = entity.get(keyFieldName);
if(!ObjectUtils.isEmpty(objEntityKey)){
entityKeyList.add(String.valueOf(objEntityKey));
}
}
return entityKeyList;
}
}
\ No newline at end of file
package cn.ibizlab.util.web;
import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
/**
* feign请求拦截器
* 拦截所有使用feign发出的请求,附加原始请求Header参数及Token
*/
@Configuration
public class FeignRequestInterceptor implements RequestInterceptor {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void apply(RequestTemplate requestTemplate) {
ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null){
HttpServletRequest request = requestAttributes.getRequest();
Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
String values = request.getHeader(name);
requestTemplate.header(name, values);
}
logger.info("feign interceptor header:{}",requestTemplate);
}
}
}
}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册