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

ibizdev提交

上级 6983ee7d
*2020-4-29*
初始化文件
......@@ -47,6 +47,14 @@
"viewname": "IBZDepartmentPickupGridView",
"viewtag": "66fa282d24a21eec39d958e7fc6c23a8"
},
"ibzorganizationoptionview": {
"title": "单位机构选项操作视图",
"caption": "单位机构",
"viewtype": "DEOPTVIEW",
"viewmodule": "ou",
"viewname": "IBZOrganizationOptionView",
"viewtag": "995d26f289a30e31573d557a5f5ba254"
},
"ibzorganizationpickupview": {
"title": "单位机构数据选择视图",
"caption": "单位机构",
......
......@@ -6,6 +6,7 @@ export default {
deptname: '部门名称',
orgid: '单位',
parentdeptid: '上级部门',
pdeptname: '上级部门',
shortname: '部门简称',
deptlevel: '部门级别',
showorder: '排序',
......@@ -47,6 +48,7 @@ export default {
deptid: "部门标识",
deptcode: "部门代码",
deptname: "部门名称",
pdeptname: "上级部门",
orgname: "单位",
orgid: "单位",
pdeptid: "上级部门",
......
......@@ -5,6 +5,7 @@ export default {
deptname: '部门名称',
orgid: '单位',
parentdeptid: '上级部门',
pdeptname: '上级部门',
shortname: '部门简称',
deptlevel: '部门级别',
showorder: '排序',
......@@ -46,6 +47,7 @@ export default {
deptid: '部门标识',
deptcode: '部门代码',
deptname: '部门名称',
pdeptname: '上级部门',
orgname: '单位',
orgid: '单位',
pdeptid: '上级部门',
......
......@@ -5,6 +5,7 @@ export default {
orgcode: '单位代码',
orgname: '名称',
parentorgid: '上级单位',
porgname: '上级单位',
shortname: '单位简称',
orglevel: '单位级别',
showorder: '排序',
......@@ -19,6 +20,10 @@ export default {
},
pickupgridview: {
caption: "单位机构",
title: '单位机构',
},
optionview: {
caption: "单位机构",
title: '单位机构',
},
pickupview: {
......@@ -44,12 +49,37 @@ export default {
orgid: "单位标识",
orgcode: "单位代码",
orgname: "名称",
porgid: "上级单位",
porgname: "上级单位",
orglevel: "单位级别",
shortname: "单位简称",
showorder: "排序",
createdate: "创建时间",
updatedate: "最后修改时间",
porgid: "上级单位",
},
uiactions: {
},
},
newform_form: {
details: {
group1: "单位机构基本信息",
formpage1: "基本信息",
srfupdatedate: "最后修改时间",
srforikey: "",
srfkey: "单位标识",
srfmajortext: "名称",
srftempmode: "",
srfuf: "",
srfdeid: "",
srfsourcekey: "",
orgcode: "单位代码",
orgname: "名称",
porgname: "上级单位",
orglevel: "单位级别",
shortname: "单位简称",
showorder: "排序",
orgid: "单位标识",
porgid: "上级单位",
},
uiactions: {
},
......
......@@ -4,6 +4,7 @@ export default {
orgcode: '单位代码',
orgname: '名称',
parentorgid: '上级单位',
porgname: '上级单位',
shortname: '单位简称',
orglevel: '单位级别',
showorder: '排序',
......@@ -18,6 +19,10 @@ export default {
},
pickupgridview: {
caption: '单位机构',
title: '单位机构',
},
optionview: {
caption: '单位机构',
title: '单位机构',
},
pickupview: {
......@@ -43,12 +48,37 @@ export default {
orgid: '单位标识',
orgcode: '单位代码',
orgname: '名称',
porgid: '上级单位',
porgname: '上级单位',
orglevel: '单位级别',
shortname: '单位简称',
showorder: '排序',
createdate: '创建时间',
updatedate: '最后修改时间',
porgid: '上级单位',
},
uiactions: {
},
},
newform_form: {
details: {
group1: '单位机构基本信息',
formpage1: '基本信息',
srfupdatedate: '最后修改时间',
srforikey: '',
srfkey: '单位标识',
srfmajortext: '名称',
srftempmode: '',
srfuf: '',
srfdeid: '',
srfsourcekey: '',
orgcode: '单位代码',
orgname: '名称',
porgname: '上级单位',
orglevel: '单位级别',
shortname: '单位简称',
showorder: '排序',
orgid: '单位标识',
porgid: '上级单位',
},
uiactions: {
},
......
......@@ -55,6 +55,14 @@ mock.onGet('./assets/json/view-config.json').reply((config: any) => {
"viewname": "IBZDepartmentPickupGridView",
"viewtag": "66fa282d24a21eec39d958e7fc6c23a8"
},
"ibzorganizationoptionview": {
"title": "单位机构选项操作视图",
"caption": "单位机构",
"viewtype": "DEOPTVIEW",
"viewmodule": "ou",
"viewname": "IBZOrganizationOptionView",
"viewtag": "995d26f289a30e31573d557a5f5ba254"
},
"ibzorganizationpickupview": {
"title": "单位机构数据选择视图",
"caption": "单位机构",
......
.ibzorganization-option-view{
position: relative;
}
.view-container {
.view-card {
.ivu-card-body {
.content-container{
height: calc(100% - 64px);
}
}
}
}
\ No newline at end of file
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import IBZOrganizationOptionViewBase from './ibzorganization-option-view-base.vue';
import view_form from '@widgets/ibzorganization/new-form-form/new-form-form.vue';
@Component({
components: {
view_form,
},
beforeRouteEnter: (to: any, from: any, next: any) => {
next((vm: any) => {
vm.$store.commit('addCurPageViewtag', { fullPath: to.fullPath, viewtag: vm.viewtag });
});
},
})
export default class IBZOrganizationOptionView extends IBZOrganizationOptionViewBase {
}
</script>
\ No newline at end of file
......@@ -10,6 +10,7 @@ export const viewstate: any = {
viewaction: '',
viewdatachange: false,
refviews: [
'9e25d15d43ff644fa008c9cf7d063ac3',
],
},
{
......@@ -31,6 +32,7 @@ export const viewstate: any = {
viewdatachange: false,
refviews: [
'9e25d15d43ff644fa008c9cf7d063ac3',
'b59db4df07430a34645566a64d59244c',
],
},
{
......@@ -61,6 +63,16 @@ export const viewstate: any = {
refviews: [
],
},
{
viewtag: '995d26f289a30e31573d557a5f5ba254',
viewmodule: 'ou',
viewname: 'IBZOrganizationOptionView',
viewaction: '',
viewdatachange: false,
refviews: [
'9e25d15d43ff644fa008c9cf7d063ac3',
],
},
{
viewtag: '9e25d15d43ff644fa008c9cf7d063ac3',
viewmodule: 'ou',
......
......@@ -81,6 +81,7 @@ export default class IBZOrganizationUIServiceBase extends UIService {
public initViewMap(){
this.allViewMap.set('EDITVIEW:',{viewname:'editview',srfappde:'ibzorganizations'});
this.allViewMap.set(':',{viewname:'pickupgridview',srfappde:'ibzorganizations'});
this.allViewMap.set(':',{viewname:'optionview',srfappde:'ibzorganizations'});
this.allViewMap.set('PICKUPVIEW:',{viewname:'pickupview',srfappde:'ibzorganizations'});
this.allViewMap.set('MDATAVIEW:',{viewname:'gridview',srfappde:'ibzorganizations'});
}
......
......@@ -20,6 +20,31 @@
<input-box v-model="data.deptname" @enter="onEnter($event)" unit="" :disabled="detailsModel.deptname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.pdeptname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='pdeptname' :itemRules="this.rules.pdeptname" class='' :caption="$t('entities.ibzdepartment.main_form.details.pdeptname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.pdeptname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:itemParam='{ }'
:disabled="detailsModel.pdeptname.disabled"
name='pdeptname'
deMajorField='deptname'
deKeyField='ibzdepartment'
:service="service"
:acParams="{ serviceName: 'IBZDepartmentService', interfaceName: 'FetchDefault'}"
valueitem='pdeptid'
:value="data.pdeptname"
editortype=""
:pickupView="{ viewname: 'ibzdepartment-pickup-view', title: $t('entities.ibzdepartment.views.pickupview.title'), deResParameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, ], parameters: [{ pathName: 'ibzdepartments', parameterName: 'ibzdepartment' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.orgname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='orgname' :itemRules="this.rules.orgname" class='' :caption="$t('entities.ibzdepartment.main_form.details.orgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orgname.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -385,6 +410,7 @@ export default class MainBase extends Vue implements ControlInterface {
deptid: null,
deptcode: null,
deptname: null,
pdeptname: null,
orgname: null,
orgid: null,
pdeptid: null,
......@@ -502,6 +528,12 @@ export default class MainBase extends Vue implements ControlInterface {
{ required: true, type: 'string', message: '部门名称 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '部门名称 值不能为空', trigger: 'blur' },
],
pdeptname: [
{ type: 'string', message: '上级部门 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '上级部门 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '上级部门 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '上级部门 值不能为空', trigger: 'blur' },
],
orgname: [
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '单位 值必须为字符串类型', trigger: 'blur' },
......@@ -588,6 +620,8 @@ export default class MainBase extends Vue implements ControlInterface {
deptcode: new FormItemModel({ caption: '部门代码', detailType: 'FORMITEM', name: 'deptcode', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 1 })
,
deptname: new FormItemModel({ caption: '部门名称', detailType: 'FORMITEM', name: 'deptname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
pdeptname: new FormItemModel({ caption: '上级部门', detailType: 'FORMITEM', name: 'pdeptname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
orgname: new FormItemModel({ caption: '单位', detailType: 'FORMITEM', name: 'orgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
......@@ -741,6 +775,18 @@ export default class MainBase extends Vue implements ControlInterface {
this.formDataChange({ name: 'deptname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 pdeptname 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.pdeptname')
onPdeptnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'pdeptname', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 orgname 值
*
......@@ -904,6 +950,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
......
......@@ -70,6 +70,11 @@ export default class MainModel {
prop: 'deptname',
dataType: 'TEXT',
},
{
name: 'pdeptname',
prop: 'pdeptname',
dataType: 'PICKUPTEXT',
},
{
name: 'orgname',
prop: 'orgname',
......
......@@ -89,6 +89,9 @@ export default class MainService extends ControlService {
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
if (Object.is(serviceName, 'IBZDepartmentService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.appEntityService.FetchDefault(JSON.parse(JSON.stringify(context)), data, isloading), 'deptid', 'ibzdepartment');
}
if (Object.is(serviceName, 'IBZOrganizationService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.ibzorganizationService.FetchDefault(JSON.parse(JSON.stringify(context)),data, isloading), 'orgid', 'ibzorganization');
}
......
......@@ -30,6 +30,9 @@ export default class PickupViewpickupviewpanelModel {
{
name: 'parentdeptid',
},
{
name: 'pdeptname',
},
{
name: 'shortname',
},
......
......@@ -20,6 +20,31 @@
<input-box v-model="data.orgname" @enter="onEnter($event)" unit="" :disabled="detailsModel.orgname.disabled" type='text' style=""></input-box>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.porgname.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='porgname' :itemRules="this.rules.porgname" class='' :caption="$t('entities.ibzorganization.main_form.details.porgname')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.porgname.error" :isEmptyCaption="false" labelPos="LEFT">
<app-picker
:formState="formState"
:data="data"
:context="context"
:viewparams="viewparams"
:itemParam='{ }'
:disabled="detailsModel.porgname.disabled"
name='porgname'
deMajorField='orgname'
deKeyField='ibzorganization'
:service="service"
:acParams="{ serviceName: 'IBZOrganizationService', interfaceName: 'FetchDefault'}"
valueitem='porgid'
:value="data.porgname"
editortype=""
:pickupView="{ viewname: 'ibzorganization-pickup-view', title: $t('entities.ibzorganization.views.pickupview.title'), deResParameters: [], parameters: [{ pathName: 'ibzorganizations', parameterName: 'ibzorganization' }, { pathName: 'pickupview', parameterName: 'pickupview' } ], placement:'' }"
style=""
@formitemvaluechange="onFormItemValueChange">
</app-picker>
</app-form-item>
</i-col>
<i-col v-show="detailsModel.orglevel.visible" :style="{}" :lg="{ span: 24, offset: 0 }">
<app-form-item name='orglevel' :itemRules="this.rules.orglevel" class='' :caption="$t('entities.ibzorganization.main_form.details.orglevel')" uiStyle="DEFAULT" :labelWidth="130" :isShowCaption="true" :error="detailsModel.orglevel.error" :isEmptyCaption="false" labelPos="LEFT">
......@@ -354,12 +379,13 @@ export default class MainBase extends Vue implements ControlInterface {
orgid: null,
orgcode: null,
orgname: null,
porgid: null,
porgname: null,
orglevel: null,
shortname: null,
showorder: null,
createdate: null,
updatedate: null,
porgid: null,
ibzorganization:null,
};
......@@ -468,7 +494,7 @@ export default class MainBase extends Vue implements ControlInterface {
{ required: true, type: 'string', message: '名称 值不能为空', trigger: 'change' },
{ required: true, type: 'string', message: '名称 值不能为空', trigger: 'blur' },
],
porgid: [
porgname: [
{ type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'change' },
......@@ -504,6 +530,12 @@ export default class MainBase extends Vue implements ControlInterface {
{ required: false, type: 'string', message: '最后修改时间 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '最后修改时间 值不能为空', trigger: 'blur' },
],
porgid: [
{ type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'change' },
{ type: 'string', message: '上级单位 值必须为字符串类型', trigger: 'blur' },
{ required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'change' },
{ required: false, type: 'string', message: '上级单位 值不能为空', trigger: 'blur' },
],
}
/**
......@@ -537,7 +569,7 @@ export default class MainBase extends Vue implements ControlInterface {
,
orgname: new FormItemModel({ caption: '名称', detailType: 'FORMITEM', name: 'orgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
porgid: new FormItemModel({ caption: '上级单位', detailType: 'FORMITEM', name: 'porgid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
porgname: new FormItemModel({ caption: '上级单位', detailType: 'FORMITEM', name: 'porgname', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
orglevel: new FormItemModel({ caption: '单位级别', detailType: 'FORMITEM', name: 'orglevel', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
......@@ -548,6 +580,8 @@ export default class MainBase extends Vue implements ControlInterface {
createdate: new FormItemModel({ caption: '创建时间', detailType: 'FORMITEM', name: 'createdate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
updatedate: new FormItemModel({ caption: '最后修改时间', detailType: 'FORMITEM', name: 'updatedate', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
porgid: new FormItemModel({ caption: '上级单位', detailType: 'FORMITEM', name: 'porgid', visible: true, isShowCaption: true, form: this, disabled: false, enableCond: 3 })
,
};
......@@ -684,15 +718,15 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
* 监控表单属性 porgid
* 监控表单属性 porgname
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.porgid')
onPorgidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'porgid', newVal: newVal, oldVal: oldVal });
@Watch('data.porgname')
onPorgnameChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'porgname', newVal: newVal, oldVal: oldVal });
}
/**
......@@ -755,6 +789,18 @@ export default class MainBase extends Vue implements ControlInterface {
this.formDataChange({ name: 'updatedate', newVal: newVal, oldVal: oldVal });
}
/**
* 监控表单属性 porgid 值
*
* @param {*} newVal
* @param {*} oldVal
* @memberof Main
*/
@Watch('data.porgid')
onPorgidChange(newVal: any, oldVal: any) {
this.formDataChange({ name: 'porgid', newVal: newVal, oldVal: oldVal });
}
/**
* 重置表单项值
......@@ -809,6 +855,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
......
......@@ -71,9 +71,9 @@ export default class MainModel {
dataType: 'TEXT',
},
{
name: 'porgid',
prop: 'parentorgid',
dataType: 'PICKUP',
name: 'porgname',
prop: 'porgname',
dataType: 'PICKUPTEXT',
},
{
name: 'orglevel',
......@@ -100,6 +100,11 @@ export default class MainModel {
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'porgid',
prop: 'parentorgid',
dataType: 'PICKUP',
},
{
name: 'ibzorganization',
prop: 'orgid',
......
......@@ -80,6 +80,9 @@ export default class MainService extends ControlService {
*/
@Errorlog
public getItems(serviceName: string, interfaceName: string, context: any = {}, data: any, isloading?: boolean): Promise<any[]> {
if (Object.is(serviceName, 'IBZOrganizationService') && Object.is(interfaceName, 'FetchDefault')) {
return this.doItems(this.appEntityService.FetchDefault(JSON.parse(JSON.stringify(context)), data, isloading), 'orgid', 'ibzorganization');
}
return Promise.reject([])
}
......
/**
* NewForm 部件模型
*
* @export
* @class NewFormModel
*/
export default class NewFormModel {
/**
* 获取数据项集合
*
* @returns {any[]}
* @memberof NewFormModel
*/
public getDataItems(): any[] {
return [
{
name: 'srfwfmemo',
prop: 'srfwfmemo',
dataType: 'TEXT',
},
// 前端新增修改标识,新增为"0",修改为"1"或未设值
{
name: 'srffrontuf',
prop: 'srffrontuf',
dataType: 'TEXT',
},
{
name: 'srfupdatedate',
prop: 'updatedate',
dataType: 'DATETIME',
},
{
name: 'srforikey',
},
{
name: 'srfkey',
prop: 'orgid',
dataType: 'TEXT',
},
{
name: 'srfmajortext',
prop: 'orgname',
dataType: 'TEXT',
},
{
name: 'srftempmode',
},
{
name: 'srfuf',
},
{
name: 'srfdeid',
},
{
name: 'srfsourcekey',
},
{
name: 'orgcode',
prop: 'orgcode',
dataType: 'TEXT',
},
{
name: 'orgname',
prop: 'orgname',
dataType: 'TEXT',
},
{
name: 'porgname',
prop: 'porgname',
dataType: 'PICKUPTEXT',
},
{
name: 'orglevel',
prop: 'orglevel',
dataType: 'INT',
},
{
name: 'shortname',
prop: 'shortname',
dataType: 'TEXT',
},
{
name: 'showorder',
prop: 'showorder',
dataType: 'INT',
},
{
name: 'orgid',
prop: 'orgid',
dataType: 'TEXT',
},
{
name: 'porgid',
prop: 'parentorgid',
dataType: 'PICKUP',
},
{
name: 'ibzorganization',
prop: 'orgid',
dataType: 'FONTKEY',
},
]
}
}
\ No newline at end of file
.ivu-tabs-no-animation>.ivu-tabs-content{
padding: 0 16px;
}
.ivu-card-head{
padding: 14px 0;
}
.app-form {
overflow: auto;
> .ivu-row {
> .ivu-tabs {
height: 100%;
display: flex;
flex-direction: column;
> .ivu-tabs-content {
flex-grow: 1;
overflow: auto;
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
}
}
.app-tabpanel-flex {
height: 100%;
> .ivu-tabs-content {
height: calc(100% - 52px);
> .ivu-tabs-tabpane {
height: 100%;
}
}
}
.app-form {
>.ivu-row:nth-child(2) {
>.ivu-col:nth-child(1) {
>.ivu-row.app-form-group.app-group-hiddden-caption:nth-child(1) {
margin-top: 12px;
}
}
}
}
// 表单行间距
.app-form{
.app-form-item{
margin-bottom: 20px;
}
}
// this is less
<script lang='tsx'>
import { Component } from 'vue-property-decorator';
import NewFormBase from './new-form-form-base.vue';
@Component({
components: {
}
})
export default class NewForm extends NewFormBase {
}
</script>
\ No newline at end of file
......@@ -27,6 +27,9 @@ export default class PickupViewpickupviewpanelModel {
{
name: 'parentorgid',
},
{
name: 'porgname',
},
{
name: 'shortname',
},
......
......@@ -69,6 +69,13 @@ public class IBZDepartment extends EntityMP implements Serializable {
@JSONField(name = "parentdeptid")
@JsonProperty("parentdeptid")
private String parentdeptid;
/**
* 上级部门
*/
@TableField(exist = false)
@JSONField(name = "pdeptname")
@JsonProperty("pdeptname")
private String pdeptname;
/**
* 部门简称
*/
......
......@@ -62,6 +62,13 @@ public class IBZOrganization extends EntityMP implements Serializable {
@JSONField(name = "parentorgid")
@JsonProperty("parentorgid")
private String parentorgid;
/**
* 上级单位
*/
@TableField(exist = false)
@JSONField(name = "porgname")
@JsonProperty("porgname")
private String porgname;
/**
* 单位简称
*/
......
......@@ -53,6 +53,20 @@ public class IBZDepartmentSearchContext extends QueryWrapperContext<IBZDepartmen
if(!ObjectUtils.isEmpty(this.n_pdeptid_eq)){
this.getSelectCond().eq("pdeptid", n_pdeptid_eq);
}
}
private String n_pdeptname_eq;//[上级部门]
public void setN_pdeptname_eq(String n_pdeptname_eq) {
this.n_pdeptname_eq = n_pdeptname_eq;
if(!ObjectUtils.isEmpty(this.n_pdeptname_eq)){
this.getSelectCond().eq("pdeptname", n_pdeptname_eq);
}
}
private String n_pdeptname_like;//[上级部门]
public void setN_pdeptname_like(String n_pdeptname_like) {
this.n_pdeptname_like = n_pdeptname_like;
if(!ObjectUtils.isEmpty(this.n_pdeptname_like)){
this.getSelectCond().like("pdeptname", n_pdeptname_like);
}
}
private String n_bcode_like;//[业务编码]
public void setN_bcode_like(String n_bcode_like) {
......
......@@ -53,6 +53,20 @@ public class IBZOrganizationSearchContext extends QueryWrapperContext<IBZOrganiz
if(!ObjectUtils.isEmpty(this.n_porgid_eq)){
this.getSelectCond().eq("porgid", n_porgid_eq);
}
}
private String n_porgname_eq;//[上级单位]
public void setN_porgname_eq(String n_porgname_eq) {
this.n_porgname_eq = n_porgname_eq;
if(!ObjectUtils.isEmpty(this.n_porgname_eq)){
this.getSelectCond().eq("porgname", n_porgname_eq);
}
}
private String n_porgname_like;//[上级单位]
public void setN_porgname_like(String n_porgname_like) {
this.n_porgname_like = n_porgname_like;
if(!ObjectUtils.isEmpty(this.n_porgname_like)){
this.getSelectCond().like("porgname", n_porgname_like);
}
}
private String n_shortname_like;//[单位简称]
public void setN_shortname_like(String n_shortname_like) {
......
......@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject;
* 实体[部门] 服务对象接口实现
*/
@Slf4j
@Service
@Service("IBZDepartmentServiceImpl")
public class IBZDepartmentServiceImpl extends ServiceImpl<IBZDepartmentMapper, IBZDepartment> implements IIBZDepartmentService {
@Autowired
......
......@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject;
* 实体[人员] 服务对象接口实现
*/
@Slf4j
@Service
@Service("IBZEmployeeServiceImpl")
public class IBZEmployeeServiceImpl extends ServiceImpl<IBZEmployeeMapper, IBZEmployee> implements IIBZEmployeeService {
private int batchSize = 500;
......
......@@ -39,7 +39,7 @@ import com.alibaba.fastjson.JSONObject;
* 实体[单位机构] 服务对象接口实现
*/
@Slf4j
@Service
@Service("IBZOrganizationServiceImpl")
public class IBZOrganizationServiceImpl extends ServiceImpl<IBZOrganizationMapper, IBZOrganization> implements IIBZOrganizationService {
@Autowired
......
......@@ -2,7 +2,7 @@
<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">
<!--输出实体[IBZORG]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzorg-380-1">
<changeSet author="a_A_5d9d78509" id="tab-ibzorg-397-1">
<createTable tableName="IBZORG">
<column name="ORGID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZORG_ORGID"/>
......@@ -106,7 +106,7 @@
</createTable>
</changeSet>
<!--输出实体[IBZDEPT]数据结构 -->
<changeSet author="a_A_5d9d78509" id="tab-ibzdept-499-3">
<changeSet author="a_A_5d9d78509" id="tab-ibzdept-508-3">
<createTable tableName="IBZDEPT">
<column name="DEPTID" remarks="" type="VARCHAR(100)">
<constraints primaryKey="true" primaryKeyName="PK_IBZDEPT_DEPTID"/>
......@@ -139,7 +139,7 @@
</changeSet>
<!--输出实体[IBZORG]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzorg-380-4">
<changeSet author="a_A_5d9d78509" id="fk-ibzorg-397-4">
<addForeignKeyConstraint baseColumnNames="PORGID" baseTableName="IBZORG" constraintName="DER1N_IBZORG_IBZORG_PORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[IBZEMP]外键关系 -->
......@@ -150,10 +150,10 @@
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZEMP" constraintName="DER1N_IBZEMP_IBZORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
<!--输出实体[IBZDEPT]外键关系 -->
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-499-7">
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-508-7">
<addForeignKeyConstraint baseColumnNames="PDEPTID" baseTableName="IBZDEPT" constraintName="DER1N_IBZDEPT_IBZDEPT_PDEPTID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="DEPTID" referencedTableName="IBZDEPT" validate="true"/>
</changeSet>
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-499-8">
<changeSet author="a_A_5d9d78509" id="fk-ibzdept-508-8">
<addForeignKeyConstraint baseColumnNames="ORGID" baseTableName="IBZDEPT" constraintName="DER1N_IBZDEPT_IBZORG_ORGID" deferrable="false" initiallyDeferred="false" onDelete="RESTRICT" onUpdate="RESTRICT" referencedColumnNames="ORGID" referencedTableName="IBZORG" validate="true"/>
</changeSet>
......
......@@ -5,7 +5,7 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="IBZDepartmentResultMap" databaseId="mysql">
<![CDATA[select t1.* from (SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 ) t1 where deptid=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t11.`DEPTNAME` AS `PDEPTNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 LEFT JOIN IBZDEPT t11 ON t1.PDEPTID = t11.DEPTID ) t1 where deptid=#{id}]]>
</select>
<select id="selectById" resultMap="IBZDepartmentResultMap" databaseId="postgresql">
<![CDATA[select t1.* from (SELECT t1.BCODE, t1.CREATEDATE, t1.DEPTCODE, t1.DEPTID, t1.DEPTLEVEL, t1.DEPTNAME, t1.ENABLE, t1.ORGID, t1.PDEPTID, t1.SHORTNAME, t1.SHOWORDER, t1.UPDATEDATE FROM IBZDEPT t1 ) t1 where deptid=#{id}]]>
......@@ -50,7 +50,7 @@
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t11.`DEPTNAME` AS `PDEPTNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 LEFT JOIN IBZDEPT t11 ON t1.PDEPTID = t11.DEPTID
WHERE t1.ENABLE = 1
]]>
</sql>
......@@ -64,7 +64,7 @@
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1
<![CDATA[ SELECT t1.`BCODE`, t1.`CREATEDATE`, t1.`DEPTCODE`, t1.`DEPTID`, t1.`DEPTLEVEL`, t1.`DEPTNAME`, t1.`ENABLE`, t1.`ORGID`, t1.`ORGNAME`, t1.`PDEPTID`, t11.`DEPTNAME` AS `PDEPTNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZDEPT` t1 LEFT JOIN IBZDEPT t11 ON t1.PDEPTID = t11.DEPTID
WHERE t1.ENABLE = 1
]]>
</sql>
......
......@@ -5,7 +5,7 @@
<!--该方法用于重写mybatis中selectById方法,以实现查询逻辑属性-->
<select id="selectById" resultMap="IBZOrganizationResultMap" databaseId="mysql">
<![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 ) t1 where orgid=#{id}]]>
<![CDATA[select t1.* from (SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t11.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID ) t1 where orgid=#{id}]]>
</select>
<select id="selectById" resultMap="IBZOrganizationResultMap" databaseId="postgresql">
<![CDATA[select t1.* from (SELECT t1.CREATEDATE, t1.ENABLE, t1.ORGCODE, t1.ORGID, t1.ORGLEVEL, t1.ORGNAME, t1.PORGID, t1.SHORTNAME, t1.SHOWORDER, t1.UPDATEDATE FROM IBZORG t1 ) t1 where orgid=#{id}]]>
......@@ -58,7 +58,7 @@
<!--数据查询[Default]-->
<sql id="Default" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t11.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
]]>
</sql>
......@@ -72,7 +72,7 @@
<!--数据查询[SelectPOrg]-->
<sql id="SelectPOrg" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t11.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
AND ( INSTR(#{srf.datacontext.orglevel} t1.ORGLEVEL)=1 )
]]>
......@@ -80,7 +80,7 @@
<!--数据查询[SelectSOrg]-->
<sql id="SelectSOrg" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t11.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
AND ( INSTR(t1.ORGLEVEL,#{srf.datacontext.orglevel} )
]]>
......@@ -88,7 +88,7 @@
<!--数据查询[View]-->
<sql id="View" databaseId="mysql">
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1
<![CDATA[ SELECT t1.`CREATEDATE`, t1.`ENABLE`, t1.`ORGCODE`, t1.`ORGID`, t1.`ORGLEVEL`, t1.`ORGNAME`, t1.`PORGID`, t11.`ORGNAME` AS `PORGNAME`, t1.`SHORTNAME`, t1.`SHOWORDER`, t1.`UPDATEDATE` FROM `IBZORG` t1 LEFT JOIN IBZORG t11 ON t1.PORGID = t11.ORGID
WHERE t1.ENABLE = 1
]]>
</sql>
......
......@@ -63,6 +63,14 @@ public class IBZDepartmentDTO extends DTOBase implements Serializable {
@JsonProperty("parentdeptid")
private String parentdeptid;
/**
* 属性 [PDEPTNAME]
*
*/
@JSONField(name = "pdeptname")
@JsonProperty("pdeptname")
private String pdeptname;
/**
* 属性 [SHORTNAME]
*
......
......@@ -55,6 +55,14 @@ public class IBZOrganizationDTO extends DTOBase implements Serializable {
@JsonProperty("parentorgid")
private String parentorgid;
/**
* 属性 [PORGNAME]
*
*/
@JSONField(name = "porgname")
@JsonProperty("porgname")
private String porgname;
/**
* 属性 [SHORTNAME]
*
......
......@@ -114,7 +114,6 @@ public class IBZDepartmentResource {
@PreAuthorize("hasPermission('','READ',this.getEntity())")
@ApiOperation(value = "GetDraft", tags = {"IBZDepartment" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/ibzdepartments/getdraft")
public ResponseEntity<IBZDepartmentDTO> getDraft() {
......
......@@ -168,7 +168,6 @@ public class IBZEmployeeResource {
@PreAuthorize("hasPermission('','READ',this.getEntity())")
@ApiOperation(value = "GetDraft", tags = {"IBZEmployee" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/ibzemployees/getdraft")
public ResponseEntity<IBZEmployeeDTO> getDraft() {
......
......@@ -155,7 +155,6 @@ public class IBZOrganizationResource {
@PreAuthorize("hasPermission('','READ',this.getEntity())")
@ApiOperation(value = "GetDraft", tags = {"IBZOrganization" }, notes = "GetDraft")
@RequestMapping(method = RequestMethod.GET, value = "/ibzorganizations/getdraft")
public ResponseEntity<IBZOrganizationDTO> getDraft() {
......
......@@ -7,7 +7,7 @@ import org.springframework.stereotype.Component;
public class IBZOUFallback implements IBZOUFeignClient {
@Override
public JSONObject getOrgInfo(String orgLevel) {
public JSONObject getOrgInfo(String loginName) {
return null;
}
}
......@@ -11,9 +11,9 @@ public interface IBZOUFeignClient
/**
* 从ou中获取当前上下级组织、部门信息
* @param orgLevel
* @param loginName 登录名
* @return
*/
@GetMapping(value = "/ibzou/org/{orglevel}")
JSONObject getOrgInfo(@PathVariable("orglevel") String orgLevel);
@GetMapping(value = "/ibzou/org/{loginname}")
JSONObject getOrgInfo(@PathVariable("loginname") String loginName);
}
......@@ -8,7 +8,7 @@ import java.util.Map;
public class IBZUAAFallback implements IBZUAAFeignClient {
@Override
public JSONObject getUserPermissionData(String userId, String systemId) {
public JSONObject getUserPermissionData(String loginName, String systemId) {
return null;
}
......
......@@ -11,12 +11,12 @@ public interface IBZUAAFeignClient
/**
* 从uaa中获取当前用户权限
* @param userId
* @param loginName
* @param systemId
* @return
*/
@GetMapping(value = "/uaa/permission/{userid}")
JSONObject getUserPermissionData(@PathVariable("userid") String userId, @RequestParam("systemid") String systemId);
@GetMapping(value = "/uaa/permission/{loginname}")
JSONObject getUserPermissionData(@PathVariable("loginname") String loginName, @RequestParam("systemid") String systemId);
/**
* 推送系统权限数据到uaa
......
package cn.ibizlab.util.domain;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@JsonInclude(Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
@AllArgsConstructor
public class FileItem
{
private String id;
private String name;
private long size;
private String ext;
}
......@@ -21,7 +21,7 @@ import java.io.IOException;
/**
* 权限:向uaa同步当前系统菜单、权限资源任务类
*/
//@Component //开启此类需要保证Main中开启了feign :EnableFeignClients
@Component //开启此类需要保证Main中开启了feign :EnableFeignClients
public class PermissionSyncJob implements ApplicationRunner {
private Log log = LogFactory.getLog(PermissionSyncJob.class);
......
package cn.ibizlab.util.rest;
import cn.ibizlab.util.domain.FileItem;
import cn.ibizlab.util.service.FileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
@Slf4j
public class FileController
{
@Autowired
private FileService fileService;
@PostMapping(value = "${ibiz.uploadpath.path:ibizutil/upload}")
public ResponseEntity<FileItem> upload(@RequestParam("file") MultipartFile multipartFile){
return ResponseEntity.ok().body(fileService.saveFile(multipartFile));
}
private final String defaultdownloadpath="ibizutil/download/{id}";
protected String getDefaultdownloadpath(){
return defaultdownloadpath;
}
@GetMapping(value = "${ibiz.file.downloadpath:"+defaultdownloadpath+"}")
@ResponseStatus(HttpStatus.OK)
public void download(@PathVariable String id, HttpServletResponse response){
File file= fileService.getFile(id);
response.setHeader("Content-Disposition", "attachment;filename="+getFileName(file.getName()));
this.sendRespose(response, file);
}
protected void sendRespose(HttpServletResponse response, File file){
BufferedInputStream bis = null;
BufferedOutputStream bos = null;
try {
bis = new BufferedInputStream(new FileInputStream(file));
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
}
catch (Exception e) {
//throw e;
}
finally {
if (bis != null) {
try {
bis.close();
}
catch (IOException e) {
}
}
if (bos != null) {
try {
bos.close();
}
catch (IOException e) {
}
}
}
}
protected String getFileName(String fileName){
try {
return new String(fileName.getBytes("utf-8"),"iso8859-1");//防止中文乱码
}
catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return fileName;
}
}
\ No newline at end of file
......@@ -62,7 +62,8 @@ public class AuthenticationUser implements UserDetails
private int superuser;
@JsonIgnore
private JSONObject permisionList;
private String levelcode;//单位级别编码
private String orglevel;//单位级别
private String deptlevel;//部门级别
@JsonIgnore
private Map<String,String> userSessionParam;//用户自定义session值
@JsonIgnore
......
package cn.ibizlab.util.service;
import cn.ibizlab.util.domain.FileItem;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
public interface FileService
{
FileItem saveFile(MultipartFile multipartFile);
File getFile(String fileid);
}
\ No newline at end of file
package cn.ibizlab.util.service;
import cn.ibizlab.util.domain.FileItem;
import cn.ibizlab.util.errors.InternalServerErrorException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.util.UUID;
@Primary
@Slf4j
@Service
public class SimpleFileService implements FileService {
@Value("${ibiz.filePath:/app/file/}")
private String fileRoot;
@Override
public FileItem saveFile(MultipartFile multipartFile) {
FileItem item=null;
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String extname="."+getExtensionName(fileName);
// 用uuid作为文件名,防止生成的临时文件重复
String fileid= UUID.randomUUID().toString();
String fileFullPath = this.fileRoot+"ibztuit"+File.separator+fileid+File.separator+fileName;
File file = new File(fileFullPath);
File parent = new File(file.getParent());
if(!parent.exists())
parent.mkdirs();
try {
FileCopyUtils.copy(multipartFile.getInputStream() , Files.newOutputStream(file.toPath()));
item=new FileItem(fileid,fileName, (int)multipartFile.getSize() ,extname);
} catch (IOException e) {
throw new InternalServerErrorException("文件上传失败");
}
return item;
}
@Override
public File getFile(String fileid) {
String dirpath = this.fileRoot+"ibztuit"+File.separator+fileid;
File parent = new File(dirpath);
if (parent.exists() && parent.isDirectory() && parent.listFiles().length > 0) {
return parent.listFiles()[0];
}
throw new InternalServerErrorException("文件未找到");
}
/**
* 获取文件扩展名
* @param filename
* @return
*/
public static String getExtensionName(String filename) {
if ((filename != null) && (filename.length() > 0)) {
int dot = filename.lastIndexOf('.');
if ((dot >-1) && (dot < (filename.length() - 1))) {
return filename.substring(dot + 1);
}
}
return filename;
}
}
\ No newline at end of file
......@@ -60,7 +60,6 @@ public class SimpleUserService implements AuthenticationUserService{
user.setOrgcode(domains);
user.setOrgname(domains);
testPermissionData(user);
setUserPermission(user);
setUserOrgInfo(user);
......@@ -91,7 +90,7 @@ public class SimpleUserService implements AuthenticationUserService{
*/
private void setUserPermission(AuthenticationUser user) {
if(enablePermissionValid){
JSONObject permission= uaaFeignClient.getUserPermissionData(user.getUserid(),systemid);
JSONObject permission= uaaFeignClient.getUserPermissionData(user.getLoginname(),systemid);
user.setPermisionList(permission);
}
}
......@@ -102,18 +101,11 @@ public class SimpleUserService implements AuthenticationUserService{
*/
private void setUserOrgInfo(AuthenticationUser user) {
if(enablePermissionValid) {
user.setOrgInfo(ouFeignClient.getOrgInfo(user.getLevelcode()));
JSONObject orgInfo=ouFeignClient.getOrgInfo(user.getLoginname());
if(orgInfo==null)
throw new RuntimeException("获取用户信息失败,请检查用户中心[IBZOU]中是否存在当前用户!");
user.setOrgInfo(orgInfo);
}
}
/**
* 测试数据
* @param user
*/
private void testPermissionData(AuthenticationUser user){
user.setLevelcode("4501");
user.setUserid("4fb71d8997d4505d2748ad2bdc471969");
this.systemid="2C40DFCD-0DF5-47BF-91A5-C45F810B0001";
}
}
......@@ -60,3 +60,7 @@ logging:
ribbon:
ReadTimeout: 60000
ConnectTimeout: 60000
#系统是否开启权限验证
ibiz:
enablePermissionValid: false
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册