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

ibiz4j 发布系统代码 [ibiz-notify,通知消息]

上级 bfa06553
......@@ -9,7 +9,8 @@
"dev-build": "node --max_old_space_size=8102 ./node_modules/@vue/cli-service/bin/vue-cli-service build --mode development",
"test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint"
"lint": "vue-cli-service lint",
"format-code": "prettier-eslint --write \"src/**/*.js\" \"src/**/*.vue\" \"src/**/*.tsx\" \"src/**/*.ts\" \"src/**/*.less\""
},
"dependencies": {
"@fullcalendar/core": "^4.4.0",
......@@ -66,5 +67,12 @@
"script-loader": "^0.7.2",
"typescript": "~3.5.3",
"vue-template-compiler": "^2.6.10"
},
"eslintConfig": {
"root": true,
"extends": [
"gitee",
"stylelint-config-prettier"
]
}
}
......@@ -98,6 +98,7 @@ import AppAlert from './components/app-alert/app-alert.vue'
import AppAlertGroup from './components/app-alert-group/app-alert-group.vue'
import AppRawItem from './components/app-rawitem/app-rawitem.vue'
import AppImageRomate from './components/app-image-romate/app-image-romate.vue'
import { MenuIcon } from './components/menu-icon/menu-icon'
// 全局挂载UI实体服务注册中心
window['uiServiceRegister'] = uiServiceRegister;
......@@ -210,6 +211,7 @@ export const AppComponents = {
v.component('app-alert', AppAlert);
v.component('app-alert-group', AppAlertGroup);
v.component('app-rawitem',AppRawItem);
v.component('app-image-romate', AppImageRomate)
v.component('app-image-romate', AppImageRomate);
v.component('menu-icon', MenuIcon);
},
};
\ No newline at end of file
......@@ -341,6 +341,7 @@ export default class AppPicker extends Vue {
public onSelectOpen(flag: boolean): void {
this.open = flag;
if (this.open) {
this.items = [];
//设置下拉列表的最大宽度
this.setDropdownWidth();
this.onSearch(this.curvalue, null, true);
......
import { Vue, Component, Prop } from 'vue-property-decorator';
import './menu-icon.less';
/**
* 平台菜单按钮适配
*
* @export
* @class MenuIcon
* @extends {Vue}
*/
@Component({})
export class MenuIcon extends Vue {
/**
* 项数据
*
* @type {*}
* @memberof MenuIcon
*/
@Prop()
public item: any;
/**
* 绘制图标
*
* @returns {*}
* @memberof MenuIcon
*/
public render(): any {
if (this.item) {
if (this.item.iconcls) {
return <i class={this.item.iconcls} />
}
if (this.item.icon) {
return <img src={this.item.icon} />
}
}
return <span />
}
}
\ No newline at end of file
......@@ -97,6 +97,15 @@ export class SearchViewEngine extends ViewEngine {
if (this.view && !this.view.isExpandSearchForm) {
Object.assign(arg, { query: this.view.query });
}
// 快速分组和快速搜索栏
let otherQueryParam:any = {};
if(this.view && this.view.quickGroupData){
Object.assign(otherQueryParam,this.view.quickGroupData);
}
if(this.view && this.view.quickFormData){
Object.assign(otherQueryParam,this.view.quickFormData);
}
Object.assign(arg,{viewparams:otherQueryParam});
}
......
......@@ -254,11 +254,11 @@ export default class MsgOpenAccessEditViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -283,11 +283,11 @@ export default class MsgOpenAccessGridViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -178,11 +178,11 @@ export default class MsgOpenAccessPickupGridViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -165,11 +165,11 @@ export default class MsgOpenAccessPickupViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
if(this.viewparams.selectedData){
this.selectedData = JSON.stringify(this.viewparams.selectedData);
......
......@@ -254,11 +254,11 @@ export default class MsgTemplateEditViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -283,11 +283,11 @@ export default class MsgTemplateGridViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -254,11 +254,11 @@ export default class MsgUserAccountEditViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -283,11 +283,11 @@ export default class MsgUserAccountGridViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -167,11 +167,11 @@ export default class NotifyIndexViewBase extends Vue {
@Watch('viewparam',{immediate: true, deep: true})
onParamData(newVal: any, oldVal: any) {
if(newVal){
for(let key in this.viewparams){
delete this.viewparams[key];
}
if(typeof this.viewparams == 'string') {
this.viewparams = {};
if(typeof newVal == 'string') {
Object.assign(this.viewparams, JSON.parse(this.viewparam));
}else{
this.viewparams = Util.deepCopy(this.viewparam);
}
}
......
......@@ -246,7 +246,7 @@
}
}
.view-container.degridview, .view-container.degridview9, .view-container.dewfgridview, .view-container.delistview, .view-container.delistview9, .view-container.dedataview, .view-container.dedataview9{
.view-container.degridview, .view-container.degridview9, .view-container.dewfgridview, .view-container.delistview, .view-container.delistview9, .view-container.dedataview, .view-container.dedataview9,.view-container.dechartview,.view-container.dechartview9{
>.view-card.view-no-caption{
>.ivu-card-body{
height: 100%;
......
......@@ -109,7 +109,13 @@ export class Interceptors {
error = error ? error : { response: {} };
let { response: res } = error;
let { data: _data } = res;
// 处理异常
if(res.headers && res.headers['x-ibz-error']){
res.data.errorKey = res.headers['x-ibz-error'];
}
if(res.headers && res.headers['x-ibz-params']){
res.data.entityName = res.headers['x-ibz-params'];
}
if (res.status === 401) {
this.doNoLogin(_data.data);
}
......
......@@ -655,9 +655,17 @@ export default class NotifyIndexViewBase extends Vue implements ControlInterface
item.items.map((singleItem:any) =>{
if(!singleItem.hidden){
item.hidden = false;
}else{
if(singleItem.items && singleItem.items.length >0){
singleItem.items.map((grandsonItem:any) =>{
if(!grandsonItem.hidden){
item.hidden = false;
}
})
}
}
if(singleItem.items && singleItem.items.length >0){
this.computeParentMenus(singleItem.items);
if(item.items && item.items.length >0){
this.computeParentMenus(item.items);
}
})
}
......
......@@ -310,4 +310,23 @@ export default class ControlService {
}
})
}
/**
* 根据后台标识获取数据标识名称
*
* @param prop 后台标识
* @memberof ControlService
*/
public getNameByProp(prop: any) {
let model: any = this.getMode();
if(!model || !prop) {
return false;
}
let dataItems: any[] = model.getDataItems();
prop = prop.replace(/([A-Z])/g,"_$1").toLowerCase();
let data: any = dataItems.find((item:any) => {
return Object.is(prop, item.prop);
});
return data.name;
}
}
\ No newline at end of file
......@@ -255,7 +255,6 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
* 代码表服务对象
*
......@@ -264,6 +263,14 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 主信息表格列
*
* @type {string}
* @memberof MainBase
*/
public majorInfoColName:string = "accessname";
/**
* 界面UI服务对象
*
......@@ -769,16 +776,18 @@ export default class MainBase extends Vue implements ControlInterface {
this.errorMessages = [];
let validateState = true;
let index = -1;
for(let item of this.items){
index++;
if(item.rowDataState === "create" || item.rowDataState === "update"){
for(let property of Object.keys(this.rules)){
if(!await this.validate(property,item,index)){
validateState = false;
this.errorMessages.push(this.gridItemsModel[index][property].error);
}
for (let item of this.items) {
let tempMessage: string = '';
index++;
if (item.rowDataState === "create" || item.rowDataState === "update") {
for (let property of Object.keys(this.rules)) {
if (!await this.validate(property, item, index)) {
validateState = false;
tempMessage = tempMessage + '<p>' + this.gridItemsModel[index][property].error + '<p>';
}
}
}
}
this.errorMessages.push(tempMessage);
}
return validateState;
}
......@@ -903,7 +912,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
let dataInfo = '';
_datas.forEach((record: any, index: number) => {
let srfmajortext = record.name;
let srfmajortext = record.accessname;
if (index < 5) {
if (!Object.is(dataInfo, '')) {
dataInfo += '、';
......@@ -915,9 +924,9 @@ export default class MainBase extends Vue implements ControlInterface {
});
if (_datas.length < 5) {
dataInfo = dataInfo + ' '+(this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string)+(this.$t('app.gridpage.data') as string);
dataInfo = dataInfo + ' ' + (this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string) + (this.$t('app.gridpage.data') as string);
} else {
dataInfo = dataInfo + '...' + ' '+(this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.desc2') as string);
dataInfo = ' ... ' + (this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string) + (this.$t('app.gridpage.data') as string);
}
const removeData = () => {
......@@ -1229,7 +1238,7 @@ export default class MainBase extends Vue implements ControlInterface {
return;
}
if (Object.is('load', action)) {
this.load(data);
this.load(data,true);
}
if (Object.is('remove', action)) {
this.remove(data);
......@@ -1721,11 +1730,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
if (!await this.validateAll()) {
if(this.errorMessages && this.errorMessages.length > 0) {
let descMessage: string = '';
this.errorMessages.forEach((message: any) => {
descMessage = descMessage + '<p>' + message + '<p>';
})
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: descMessage });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: this.errorMessages[0] });
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.rulesException') as string) });
}
......@@ -1766,10 +1771,40 @@ export default class MainBase extends Vue implements ControlInterface {
if(errorItems.length === 0 && successItems.length >0 && !this.isformDruipart){
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: errorMessage[index].data.message });
console.error(errorMessage[index]);
});
errorItems.forEach((item: any, index: number) => {
if(errorMessage[index] && errorMessage[index].data) {
if(Object.is(errorMessage[index].data.errorKey, 'DupCheck')) {
let errorProp: string = errorMessage[index].data.message.match(/\[[a-zA-Z]*\]/)[0];
let name: string = errorProp ? this.service.getNameByProp(errorProp.substr(1, errorProp.length-2)) : '';
if(name) {
let desc: any = this.allColumns.find((column: any) =>{
return Object.is(column.name, name);
});
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: (desc ? desc.label : '') + " : " + item[name] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}
} else if(Object.is(errorMessage[index].data.errorKey, 'DuplicateKeyException')){
this.$Notice.error({
title: (this.$t('app.commonWords.saveFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}else {
this.$Notice.error({
title: (this.$t('app.commonWords.saveFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: (item[this.majorInfoColName]?item[this.majorInfoColName]:"") + (this.$t('app.commonWords.saveFailed') as string) + '!' });
}
});
}
return successItems;
}
......@@ -2027,15 +2062,19 @@ export default class MainBase extends Vue implements ControlInterface {
let startOp = (val:boolean)=>{
if(falg.isPast){
if(opValue){
falg.isPast = falg && val;
falg.isPast = falg.isPast && val;
}else{
falg.isPast = falg || val;
falg.isPast = falg.isPast || val;
}
}else{
falg.isPast = val;
}
}
rule[name].forEach((item:any) => {
if((value === null || value === undefined || value === "") && (item.type != 'GROUP')){
startOp(true);
return falg;
}
// 常规规则
if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(value,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.curEditRowData,item.isKeyCond));
......@@ -2058,7 +2097,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
// 分组
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,"AND",value)
falg = this.verifyDeRules('group',item,item.condOP?item.condOP:"AND",value)
if(item.isNotMode){
falg.isPast = !falg.isPast;
}
......
......@@ -269,7 +269,6 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
* 代码表服务对象
*
......@@ -278,6 +277,14 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 主信息表格列
*
* @type {string}
* @memberof MainBase
*/
public majorInfoColName:string = "template_name";
/**
* 界面UI服务对象
*
......@@ -792,16 +799,18 @@ export default class MainBase extends Vue implements ControlInterface {
this.errorMessages = [];
let validateState = true;
let index = -1;
for(let item of this.items){
index++;
if(item.rowDataState === "create" || item.rowDataState === "update"){
for(let property of Object.keys(this.rules)){
if(!await this.validate(property,item,index)){
validateState = false;
this.errorMessages.push(this.gridItemsModel[index][property].error);
}
for (let item of this.items) {
let tempMessage: string = '';
index++;
if (item.rowDataState === "create" || item.rowDataState === "update") {
for (let property of Object.keys(this.rules)) {
if (!await this.validate(property, item, index)) {
validateState = false;
tempMessage = tempMessage + '<p>' + this.gridItemsModel[index][property].error + '<p>';
}
}
}
}
this.errorMessages.push(tempMessage);
}
return validateState;
}
......@@ -938,9 +947,9 @@ export default class MainBase extends Vue implements ControlInterface {
});
if (_datas.length < 5) {
dataInfo = dataInfo + ' '+(this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string)+(this.$t('app.gridpage.data') as string);
dataInfo = dataInfo + ' ' + (this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string) + (this.$t('app.gridpage.data') as string);
} else {
dataInfo = dataInfo + '...' + ' '+(this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.desc2') as string);
dataInfo = ' ... ' + (this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string) + (this.$t('app.gridpage.data') as string);
}
const removeData = () => {
......@@ -1260,7 +1269,7 @@ export default class MainBase extends Vue implements ControlInterface {
return;
}
if (Object.is('load', action)) {
this.load(data);
this.load(data,true);
}
if (Object.is('remove', action)) {
this.remove(data);
......@@ -1753,11 +1762,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
if (!await this.validateAll()) {
if(this.errorMessages && this.errorMessages.length > 0) {
let descMessage: string = '';
this.errorMessages.forEach((message: any) => {
descMessage = descMessage + '<p>' + message + '<p>';
})
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: descMessage });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: this.errorMessages[0] });
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.rulesException') as string) });
}
......@@ -1798,10 +1803,40 @@ export default class MainBase extends Vue implements ControlInterface {
if(errorItems.length === 0 && successItems.length >0 && !this.isformDruipart){
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: errorMessage[index].data.message });
console.error(errorMessage[index]);
});
errorItems.forEach((item: any, index: number) => {
if(errorMessage[index] && errorMessage[index].data) {
if(Object.is(errorMessage[index].data.errorKey, 'DupCheck')) {
let errorProp: string = errorMessage[index].data.message.match(/\[[a-zA-Z]*\]/)[0];
let name: string = errorProp ? this.service.getNameByProp(errorProp.substr(1, errorProp.length-2)) : '';
if(name) {
let desc: any = this.allColumns.find((column: any) =>{
return Object.is(column.name, name);
});
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: (desc ? desc.label : '') + " : " + item[name] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}
} else if(Object.is(errorMessage[index].data.errorKey, 'DuplicateKeyException')){
this.$Notice.error({
title: (this.$t('app.commonWords.saveFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}else {
this.$Notice.error({
title: (this.$t('app.commonWords.saveFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: (item[this.majorInfoColName]?item[this.majorInfoColName]:"") + (this.$t('app.commonWords.saveFailed') as string) + '!' });
}
});
}
return successItems;
}
......@@ -2059,15 +2094,19 @@ export default class MainBase extends Vue implements ControlInterface {
let startOp = (val:boolean)=>{
if(falg.isPast){
if(opValue){
falg.isPast = falg && val;
falg.isPast = falg.isPast && val;
}else{
falg.isPast = falg || val;
falg.isPast = falg.isPast || val;
}
}else{
falg.isPast = val;
}
}
rule[name].forEach((item:any) => {
if((value === null || value === undefined || value === "") && (item.type != 'GROUP')){
startOp(true);
return falg;
}
// 常规规则
if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(value,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.curEditRowData,item.isKeyCond));
......@@ -2090,7 +2129,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
// 分组
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,"AND",value)
falg = this.verifyDeRules('group',item,item.condOP?item.condOP:"AND",value)
if(item.isNotMode){
falg.isPast = !falg.isPast;
}
......
......@@ -243,7 +243,6 @@ export default class MainBase extends Vue implements ControlInterface {
}
/**
* 代码表服务对象
*
......@@ -252,6 +251,14 @@ export default class MainBase extends Vue implements ControlInterface {
*/
public codeListService:CodeListService = new CodeListService({ $store: this.$store });
/**
* 主信息表格列
*
* @type {string}
* @memberof MainBase
*/
public majorInfoColName:string = "identifier";
/**
* 界面UI服务对象
*
......@@ -748,16 +755,18 @@ export default class MainBase extends Vue implements ControlInterface {
this.errorMessages = [];
let validateState = true;
let index = -1;
for(let item of this.items){
index++;
if(item.rowDataState === "create" || item.rowDataState === "update"){
for(let property of Object.keys(this.rules)){
if(!await this.validate(property,item,index)){
validateState = false;
this.errorMessages.push(this.gridItemsModel[index][property].error);
}
for (let item of this.items) {
let tempMessage: string = '';
index++;
if (item.rowDataState === "create" || item.rowDataState === "update") {
for (let property of Object.keys(this.rules)) {
if (!await this.validate(property, item, index)) {
validateState = false;
tempMessage = tempMessage + '<p>' + this.gridItemsModel[index][property].error + '<p>';
}
}
}
}
this.errorMessages.push(tempMessage);
}
return validateState;
}
......@@ -894,9 +903,9 @@ export default class MainBase extends Vue implements ControlInterface {
});
if (_datas.length < 5) {
dataInfo = dataInfo + ' '+(this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string)+(this.$t('app.gridpage.data') as string);
dataInfo = dataInfo + ' ' + (this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string) + (this.$t('app.gridpage.data') as string);
} else {
dataInfo = dataInfo + '...' + ' '+(this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.desc2') as string);
dataInfo = ' ... ' + (this.$t('app.gridpage.totle') as string) + _datas.length + (this.$t('app.gridpage.records') as string) + (this.$t('app.gridpage.data') as string);
}
const removeData = () => {
......@@ -1208,7 +1217,7 @@ export default class MainBase extends Vue implements ControlInterface {
return;
}
if (Object.is('load', action)) {
this.load(data);
this.load(data,true);
}
if (Object.is('remove', action)) {
this.remove(data);
......@@ -1699,11 +1708,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
if (!await this.validateAll()) {
if(this.errorMessages && this.errorMessages.length > 0) {
let descMessage: string = '';
this.errorMessages.forEach((message: any) => {
descMessage = descMessage + '<p>' + message + '<p>';
})
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: descMessage });
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: this.errorMessages[0] });
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: (this.$t('app.commonWords.rulesException') as string) });
}
......@@ -1744,10 +1749,40 @@ export default class MainBase extends Vue implements ControlInterface {
if(errorItems.length === 0 && successItems.length >0 && !this.isformDruipart){
this.$Notice.success({ title: '', desc: (this.$t('app.commonWords.saveSuccess') as string) });
}else{
errorItems.forEach((item:any,index:number)=>{
this.$Notice.error({ title: (this.$t('app.commonWords.wrong') as string), desc: errorMessage[index].data.message });
console.error(errorMessage[index]);
});
errorItems.forEach((item: any, index: number) => {
if(errorMessage[index] && errorMessage[index].data) {
if(Object.is(errorMessage[index].data.errorKey, 'DupCheck')) {
let errorProp: string = errorMessage[index].data.message.match(/\[[a-zA-Z]*\]/)[0];
let name: string = errorProp ? this.service.getNameByProp(errorProp.substr(1, errorProp.length-2)) : '';
if(name) {
let desc: any = this.allColumns.find((column: any) =>{
return Object.is(column.name, name);
});
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: (desc ? desc.label : '') + " : " + item[name] + (this.$t('app.commonWords.isExist') as string) + '!',
});
} else {
this.$Notice.error({
title: (this.$t('app.commonWords.createFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}
} else if(Object.is(errorMessage[index].data.errorKey, 'DuplicateKeyException')){
this.$Notice.error({
title: (this.$t('app.commonWords.saveFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}else {
this.$Notice.error({
title: (this.$t('app.commonWords.saveFailed') as string),
desc: errorMessage[index].data.message?errorMessage[index].data.message:(this.$t('app.commonWords.sysException') as string),
});
}
} else {
this.$Notice.error({ title: (this.$t('app.commonWords.saveFailed') as string), desc: (item[this.majorInfoColName]?item[this.majorInfoColName]:"") + (this.$t('app.commonWords.saveFailed') as string) + '!' });
}
});
}
return successItems;
}
......@@ -2005,15 +2040,19 @@ export default class MainBase extends Vue implements ControlInterface {
let startOp = (val:boolean)=>{
if(falg.isPast){
if(opValue){
falg.isPast = falg && val;
falg.isPast = falg.isPast && val;
}else{
falg.isPast = falg || val;
falg.isPast = falg.isPast || val;
}
}else{
falg.isPast = val;
}
}
rule[name].forEach((item:any) => {
if((value === null || value === undefined || value === "") && (item.type != 'GROUP')){
startOp(true);
return falg;
}
// 常规规则
if(item.type == 'SIMPLE'){
startOp(!this.$verify.checkFieldSimpleRule(value,item.condOP,item.paramValue,item.ruleInfo,item.paramType,this.curEditRowData,item.isKeyCond));
......@@ -2036,7 +2075,7 @@ export default class MainBase extends Vue implements ControlInterface {
}
// 分组
if(item.type == 'GROUP'){
falg = this.verifyDeRules('group',item,"AND",value)
falg = this.verifyDeRules('group',item,item.condOP?item.condOP:"AND",value)
if(item.isNotMode){
falg.isPast = !falg.isPast;
}
......
......@@ -53,6 +53,9 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
@Value("${ibiz.file.previewpath:ibizutil/preview}")
private String previewpath;
@Value("${ibiz.auth.excludesPattern:}")
private String[] excludesPattern;
@Autowired
public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
......@@ -116,9 +119,15 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
// 文件操作
.antMatchers("/"+downloadpath+"/**").permitAll()
.antMatchers("/"+uploadpath).permitAll()
.antMatchers("/"+previewpath+"/**").permitAll()
// 所有请求都需要认证
.anyRequest().authenticated()
.antMatchers("/"+previewpath+"/**");
for (String excludePattern : excludesPattern) {
authenticationTokenFilter.addExcludePattern(excludePattern);
httpSecurity.authorizeRequests().antMatchers(excludePattern).permitAll();
}
// 所有请求都需要认证
httpSecurity.authorizeRequests().anyRequest().authenticated()
// 防止iframe 造成跨域
.and().headers().frameOptions().disable();
......
......@@ -38,7 +38,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZMSGBODY",resultMap = "MsgBodyResultMap")
@TableName(value = "IBZMSGBODY", resultMap = "MsgBodyResultMap")
public class MsgBody extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -62,8 +62,8 @@ public class MsgBody extends EntityMP implements Serializable {
/**
* 消息标识
*/
@DEField(isKeyField=true)
@TableId(value= "msgid",type=IdType.ASSIGN_UUID)
@DEField(isKeyField = true)
@TableId(value = "msgid", type = IdType.ASSIGN_UUID)
@JSONField(name = "msg_id")
@JsonProperty("msg_id")
private String msgId;
......@@ -159,113 +159,113 @@ public class MsgBody extends EntityMP implements Serializable {
/**
* 设置 [是否出错]
*/
public void setIsError(Integer isError){
this.isError = isError ;
this.modify("iserror",isError);
public void setIsError(Integer isError) {
this.isError = isError;
this.modify("iserror", isError);
}
/**
* 设置 [是否发送]
*/
public void setIsSend(Integer isSend){
this.isSend = isSend ;
this.modify("issend",isSend);
public void setIsSend(Integer isSend) {
this.isSend = isSend;
this.modify("issend", isSend);
}
/**
* 设置 [目标用户]
*/
public void setToUsers(String toUsers){
this.toUsers = toUsers ;
this.modify("tousers",toUsers);
public void setToUsers(String toUsers) {
this.toUsers = toUsers;
this.modify("tousers", toUsers);
}
/**
* 设置 [消息链接]
*/
public void setMsgLink(String msgLink){
this.msgLink = msgLink ;
this.modify("msglink",msgLink);
public void setMsgLink(String msgLink) {
this.msgLink = msgLink;
this.modify("msglink", msgLink);
}
/**
* 设置 [消息标题]
*/
public void setSubject(String subject){
this.subject = subject ;
this.modify("subject",subject);
public void setSubject(String subject) {
this.subject = subject;
this.modify("subject", subject);
}
/**
* 设置 [消息内容]
*/
public void setContent(String content){
this.content = content ;
this.modify("content",content);
public void setContent(String content) {
this.content = content;
this.modify("content", content);
}
/**
* 设置 [消息类型]
*/
public void setMsgType(Integer msgType){
this.msgType = msgType ;
this.modify("msgtype",msgType);
public void setMsgType(Integer msgType) {
this.msgType = msgType;
this.modify("msgtype", msgType);
}
/**
* 设置 [消息名称]
*/
public void setMsgName(String msgName){
this.msgName = msgName ;
this.modify("msgname",msgName);
public void setMsgName(String msgName) {
this.msgName = msgName;
this.modify("msgname", msgName);
}
/**
* 设置 [消息模板标识]
*/
public void setTemplateId(String templateId){
this.templateId = templateId ;
this.modify("templateid",templateId);
public void setTemplateId(String templateId) {
this.templateId = templateId;
this.modify("templateid", templateId);
}
/**
* 设置 [错误信息]
*/
public void setErrorInfo(String errorInfo){
this.errorInfo = errorInfo ;
this.modify("errorinfo",errorInfo);
public void setErrorInfo(String errorInfo) {
this.errorInfo = errorInfo;
this.modify("errorinfo", errorInfo);
}
/**
* 设置 [用户数据]
*/
public void setUserData(String userData){
this.userData = userData ;
this.modify("userdata",userData);
public void setUserData(String userData) {
this.userData = userData;
this.modify("userdata", userData);
}
/**
* 设置 [消息模板参数]
*/
public void setTemplateParams(String templateParams){
this.templateParams = templateParams ;
this.modify("templparams",templateParams);
public void setTemplateParams(String templateParams) {
this.templateParams = templateParams;
this.modify("templparams", templateParams);
}
/**
* 设置 [用户数据2]
*/
public void setUserData2(String userData2){
this.userData2 = userData2 ;
this.modify("userdata2",userData2);
public void setUserData2(String userData2) {
this.userData2 = userData2;
this.modify("userdata2", userData2);
}
/**
* 设置 [消息链接(PC)]
*/
public void setMsgLinkPc(String msgLinkPc){
this.msgLinkPc = msgLinkPc ;
this.modify("msglink_pc",msgLinkPc);
public void setMsgLinkPc(String msgLinkPc) {
this.msgLinkPc = msgLinkPc;
this.modify("msglink_pc", msgLinkPc);
}
......@@ -279,7 +279,7 @@ public class MsgBody extends EntityMP implements Serializable {
@Override
public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
this.reset("msgid");
return super.copyTo(targetEntity,bIncEmpty);
return super.copyTo(targetEntity, bIncEmpty);
}
}
......
......@@ -38,7 +38,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZOPENACCESS",resultMap = "MsgOpenAccessResultMap")
@TableName(value = "IBZOPENACCESS", resultMap = "MsgOpenAccessResultMap")
public class MsgOpenAccess extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -46,8 +46,8 @@ public class MsgOpenAccess extends EntityMP implements Serializable {
/**
* 开放平台接入标识
*/
@DEField(name = "accessid" , isKeyField=true)
@TableId(value= "accessid",type=IdType.ASSIGN_UUID)
@DEField(name = "accessid", isKeyField = true)
@TableId(value = "accessid", type = IdType.ASSIGN_UUID)
@JSONField(name = "id")
@JsonProperty("id")
private String id;
......@@ -104,8 +104,8 @@ public class MsgOpenAccess extends EntityMP implements Serializable {
*/
@DEField(name = "expires_time")
@TableField(value = "expires_time")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
@JSONField(name = "expires_time" , format="yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", locale = "zh", timezone = "GMT+8")
@JSONField(name = "expires_time", format = "yyyy-MM-dd HH:mm:ss")
@JsonProperty("expires_time")
private Timestamp expiresTime;
/**
......@@ -138,63 +138,63 @@ public class MsgOpenAccess extends EntityMP implements Serializable {
/**
* 设置 [开放平台]
*/
public void setName(String name){
this.name = name ;
this.modify("accessname",name);
public void setName(String name) {
this.name = name;
this.modify("accessname", name);
}
/**
* 设置 [开放平台类型]
*/
public void setOpenType(String openType){
this.openType = openType ;
this.modify("open_type",openType);
public void setOpenType(String openType) {
this.openType = openType;
this.modify("open_type", openType);
}
/**
* 设置 [AccessKey(AppId)]
*/
public void setAccessKey(String accessKey){
this.accessKey = accessKey ;
this.modify("access_key",accessKey);
public void setAccessKey(String accessKey) {
this.accessKey = accessKey;
this.modify("access_key", accessKey);
}
/**
* 设置 [SecretKey(AppSecret)]
*/
public void setSecretKey(String secretKey){
this.secretKey = secretKey ;
this.modify("secret_key",secretKey);
public void setSecretKey(String secretKey) {
this.secretKey = secretKey;
this.modify("secret_key", secretKey);
}
/**
* 设置 [RegionId(CorpId)]
*/
public void setRegionId(String regionId){
this.regionId = regionId ;
this.modify("region_id",regionId);
public void setRegionId(String regionId) {
this.regionId = regionId;
this.modify("region_id", regionId);
}
/**
* 设置 [管理账号token]
*/
public void setAccessToken(String accessToken){
this.accessToken = accessToken ;
this.modify("access_token",accessToken);
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
this.modify("access_token", accessToken);
}
/**
* 设置 [管理账号token过期时间]
*/
public void setExpiresTime(Timestamp expiresTime){
this.expiresTime = expiresTime ;
this.modify("expires_time",expiresTime);
public void setExpiresTime(Timestamp expiresTime) {
this.expiresTime = expiresTime;
this.modify("expires_time", expiresTime);
}
/**
* 格式化日期 [管理账号token过期时间]
*/
public String formatExpiresTime(){
public String formatExpiresTime() {
if (this.expiresTime == null) {
return null;
}
......@@ -204,25 +204,25 @@ public class MsgOpenAccess extends EntityMP implements Serializable {
/**
* 设置 [是否禁用]
*/
public void setDisabled(Integer disabled){
this.disabled = disabled ;
this.modify("disabled",disabled);
public void setDisabled(Integer disabled) {
this.disabled = disabled;
this.modify("disabled", disabled);
}
/**
* 设置 [RedirectURI]
*/
public void setRedirectUri(String redirectUri){
this.redirectUri = redirectUri ;
this.modify("redirect_uri",redirectUri);
public void setRedirectUri(String redirectUri) {
this.redirectUri = redirectUri;
this.modify("redirect_uri", redirectUri);
}
/**
* 设置 [AGENT_ID]
*/
public void setAgentId(Long agentId){
this.agentId = agentId ;
this.modify("agent_id",agentId);
public void setAgentId(Long agentId) {
this.agentId = agentId;
this.modify("agent_id", agentId);
}
......@@ -236,7 +236,7 @@ public class MsgOpenAccess extends EntityMP implements Serializable {
@Override
public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
this.reset("accessid");
return super.copyTo(targetEntity,bIncEmpty);
return super.copyTo(targetEntity, bIncEmpty);
}
}
......
......@@ -38,7 +38,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZMSGTEMPL",resultMap = "MsgTemplateResultMap")
@TableName(value = "IBZMSGTEMPL", resultMap = "MsgTemplateResultMap")
public class MsgTemplate extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -46,8 +46,8 @@ public class MsgTemplate extends EntityMP implements Serializable {
/**
* 模板标识
*/
@DEField(isKeyField=true)
@TableId(value= "tid",type=IdType.ASSIGN_UUID)
@DEField(isKeyField = true)
@TableId(value = "tid", type = IdType.ASSIGN_UUID)
@JSONField(name = "tid")
@JsonProperty("tid")
private String tid;
......@@ -126,65 +126,65 @@ public class MsgTemplate extends EntityMP implements Serializable {
/**
* 设置 [模板标题]
*/
public void setTemplateName(String templateName){
this.templateName = templateName ;
this.modify("template_name",templateName);
public void setTemplateName(String templateName) {
this.templateName = templateName;
this.modify("template_name", templateName);
}
/**
* 设置 [模板类型]
*/
public void setTemplateType(String templateType){
this.templateType = templateType ;
this.modify("template_type",templateType);
public void setTemplateType(String templateType) {
this.templateType = templateType;
this.modify("template_type", templateType);
}
/**
* 设置 [模板内容]
*/
public void setContent(String content){
this.content = content ;
this.modify("content",content);
public void setContent(String content) {
this.content = content;
this.modify("content", content);
}
/**
* 设置 [模板标识]
*/
public void setTemplateId(String templateId){
this.templateId = templateId ;
this.modify("template_id",templateId);
public void setTemplateId(String templateId) {
this.templateId = templateId;
this.modify("template_id", templateId);
}
/**
* 设置 [URL]
*/
public void setTemplateUrl(String templateUrl){
this.templateUrl = templateUrl ;
this.modify("template_url",templateUrl);
public void setTemplateUrl(String templateUrl) {
this.templateUrl = templateUrl;
this.modify("template_url", templateUrl);
}
/**
* 设置 [开放平台接入标识]
*/
public void setAccessId(String accessId){
this.accessId = accessId ;
this.modify("accessid",accessId);
public void setAccessId(String accessId) {
this.accessId = accessId;
this.modify("accessid", accessId);
}
/**
* 设置 [接入平台]
*/
public void setAccessName(String accessName){
this.accessName = accessName ;
this.modify("accessname",accessName);
public void setAccessName(String accessName) {
this.accessName = accessName;
this.modify("accessname", accessName);
}
/**
* 设置 [接入平台类型]
*/
public void setOpenType(String openType){
this.openType = openType ;
this.modify("open_type",openType);
public void setOpenType(String openType) {
this.openType = openType;
this.modify("open_type", openType);
}
......@@ -198,7 +198,7 @@ public class MsgTemplate extends EntityMP implements Serializable {
@Override
public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
this.reset("tid");
return super.copyTo(targetEntity,bIncEmpty);
return super.copyTo(targetEntity, bIncEmpty);
}
}
......
......@@ -38,7 +38,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
@Setter
@NoArgsConstructor
@JsonIgnoreProperties(value = "handler")
@TableName(value = "IBZUSERAUTH",resultMap = "MsgUserAccountResultMap")
@TableName(value = "IBZUSERAUTH", resultMap = "MsgUserAccountResultMap")
public class MsgUserAccount extends EntityMP implements Serializable {
private static final long serialVersionUID = 1L;
......@@ -46,8 +46,8 @@ public class MsgUserAccount extends EntityMP implements Serializable {
/**
* 标识
*/
@DEField(name = "authid" , isKeyField=true)
@TableId(value= "authid",type=IdType.ASSIGN_UUID)
@DEField(name = "authid", isKeyField = true)
@TableId(value = "authid", type = IdType.ASSIGN_UUID)
@JSONField(name = "id")
@JsonProperty("id")
private String id;
......@@ -86,41 +86,41 @@ public class MsgUserAccount extends EntityMP implements Serializable {
/**
* 设置 [用户标识]
*/
public void setUserid(String userid){
this.userid = userid ;
this.modify("userid",userid);
public void setUserid(String userid) {
this.userid = userid;
this.modify("userid", userid);
}
/**
* 设置 [认证类型]
*/
public void setIdentityType(String identityType){
this.identityType = identityType ;
this.modify("identity_type",identityType);
public void setIdentityType(String identityType) {
this.identityType = identityType;
this.modify("identity_type", identityType);
}
/**
* 设置 [认证标识]
*/
public void setIdentifier(String identifier){
this.identifier = identifier ;
this.modify("identifier",identifier);
public void setIdentifier(String identifier) {
this.identifier = identifier;
this.modify("identifier", identifier);
}
/**
* 设置 [凭据]
*/
public void setCredential(String credential){
this.credential = credential ;
this.modify("credential",credential);
public void setCredential(String credential) {
this.credential = credential;
this.modify("credential", credential);
}
/**
* 获取 [标识]
*/
public String getId(){
if(ObjectUtils.isEmpty(id)){
public String getId() {
if(ObjectUtils.isEmpty(id)) {
id=(String)getDefaultKey(true);
}
return id;
......@@ -142,7 +142,7 @@ public class MsgUserAccount extends EntityMP implements Serializable {
@Override
public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
this.reset("authid");
return super.copyTo(targetEntity,bIncEmpty);
return super.copyTo(targetEntity, bIncEmpty);
}
}
......
......@@ -45,6 +45,7 @@ public class MsgBodySearchContext extends QueryWrapperContext<MsgBody> {
/**
* 启用快速搜索
*/
@Override
public void setQuery(String query)
{
this.query=query;
......
......@@ -45,6 +45,7 @@ public class MsgOpenAccessSearchContext extends QueryWrapperContext<MsgOpenAcces
/**
* 启用快速搜索
*/
@Override
public void setQuery(String query)
{
this.query=query;
......
......@@ -59,6 +59,7 @@ public class MsgTemplateSearchContext extends QueryWrapperContext<MsgTemplate> {
/**
* 启用快速搜索
*/
@Override
public void setQuery(String query)
{
this.query=query;
......
......@@ -38,6 +38,7 @@ public class MsgUserAccountSearchContext extends QueryWrapperContext<MsgUserAcco
/**
* 启用快速搜索
*/
@Override
public void setQuery(String query)
{
this.query=query;
......
......@@ -17,9 +17,9 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface MsgBodyMapper extends BaseMapper<MsgBody>{
public interface MsgBodyMapper extends BaseMapper<MsgBody> {
Page<MsgBody> searchDefault(IPage page, @Param("srf") MsgBodySearchContext context, @Param("ew") Wrapper<MsgBody> wrapper) ;
Page<MsgBody> searchDefault(IPage page, @Param("srf") MsgBodySearchContext context, @Param("ew") Wrapper<MsgBody> wrapper);
@Override
MsgBody selectById(Serializable id);
@Override
......@@ -30,13 +30,13 @@ public interface MsgBodyMapper extends BaseMapper<MsgBody>{
int update(@Param(Constants.ENTITY) MsgBody entity, @Param("ew") Wrapper<MsgBody> updateWrapper);
@Override
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
......
......@@ -17,31 +17,31 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface MsgOpenAccessMapper extends BaseMapper<MsgOpenAccess>{
public interface MsgOpenAccessMapper extends BaseMapper<MsgOpenAccess> {
Page<MsgOpenAccess> searchDefault(IPage page, @Param("srf") MsgOpenAccessSearchContext context, @Param("ew") Wrapper<MsgOpenAccess> wrapper) ;
Page<MsgOpenAccess> searchDefault(IPage page, @Param("srf") MsgOpenAccessSearchContext context, @Param("ew") Wrapper<MsgOpenAccess> wrapper);
@Override
@Cacheable( value="msgopenaccess",key = "'row:'+#p0")
@Cacheable(value ="msgopenaccess", key = "'row:'+#p0")
MsgOpenAccess selectById(Serializable id);
@Override
@CacheEvict( value="msgopenaccess",key = "'row:'+#p0.id")
@CacheEvict(value ="msgopenaccess", key = "'row:'+#p0.id")
int insert(MsgOpenAccess entity);
@Override
@CacheEvict( value="msgopenaccess",key = "'row:'+#p0.id")
@CacheEvict(value ="msgopenaccess", key = "'row:'+#p0.id")
int updateById(@Param(Constants.ENTITY) MsgOpenAccess entity);
@Override
@CacheEvict(value="msgopenaccess",key = "'row:'+#p0.id")
@CacheEvict(value ="msgopenaccess", key = "'row:'+#p0.id")
int update(@Param(Constants.ENTITY) MsgOpenAccess entity, @Param("ew") Wrapper<MsgOpenAccess> updateWrapper);
@Override
@CacheEvict( value="msgopenaccess",key = "'row:'+#p0")
@CacheEvict(value ="msgopenaccess", key = "'row:'+#p0")
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
......
......@@ -17,31 +17,31 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface MsgTemplateMapper extends BaseMapper<MsgTemplate>{
public interface MsgTemplateMapper extends BaseMapper<MsgTemplate> {
Page<MsgTemplate> searchDefault(IPage page, @Param("srf") MsgTemplateSearchContext context, @Param("ew") Wrapper<MsgTemplate> wrapper) ;
Page<MsgTemplate> searchDefault(IPage page, @Param("srf") MsgTemplateSearchContext context, @Param("ew") Wrapper<MsgTemplate> wrapper);
@Override
@Cacheable( value="msgtemplate",key = "'row:'+#p0")
@Cacheable(value ="msgtemplate", key = "'row:'+#p0")
MsgTemplate selectById(Serializable id);
@Override
@CacheEvict( value="msgtemplate",key = "'row:'+#p0.tid")
@CacheEvict(value ="msgtemplate", key = "'row:'+#p0.tid")
int insert(MsgTemplate entity);
@Override
@CacheEvict( value="msgtemplate",key = "'row:'+#p0.tid")
@CacheEvict(value ="msgtemplate", key = "'row:'+#p0.tid")
int updateById(@Param(Constants.ENTITY) MsgTemplate entity);
@Override
@CacheEvict(value="msgtemplate",key = "'row:'+#p0.tid")
@CacheEvict(value ="msgtemplate", key = "'row:'+#p0.tid")
int update(@Param(Constants.ENTITY) MsgTemplate entity, @Param("ew") Wrapper<MsgTemplate> updateWrapper);
@Override
@CacheEvict( value="msgtemplate",key = "'row:'+#p0")
@CacheEvict(value ="msgtemplate", key = "'row:'+#p0")
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
......@@ -67,6 +67,6 @@ public interface MsgTemplateMapper extends BaseMapper<MsgTemplate>{
@Delete("${sql}")
boolean deleteBySQL(@Param("sql") String sql, @Param("et")Map param);
List<MsgTemplate> selectByAccessId(@Param("id") Serializable id) ;
List<MsgTemplate> selectByAccessId(@Param("id") Serializable id);
}
......@@ -17,9 +17,9 @@ import java.io.Serializable;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.alibaba.fastjson.JSONObject;
public interface MsgUserAccountMapper extends BaseMapper<MsgUserAccount>{
public interface MsgUserAccountMapper extends BaseMapper<MsgUserAccount> {
Page<MsgUserAccount> searchDefault(IPage page, @Param("srf") MsgUserAccountSearchContext context, @Param("ew") Wrapper<MsgUserAccount> wrapper) ;
Page<MsgUserAccount> searchDefault(IPage page, @Param("srf") MsgUserAccountSearchContext context, @Param("ew") Wrapper<MsgUserAccount> wrapper);
@Override
MsgUserAccount selectById(Serializable id);
@Override
......@@ -30,13 +30,13 @@ public interface MsgUserAccountMapper extends BaseMapper<MsgUserAccount>{
int update(@Param(Constants.ENTITY) MsgUserAccount entity, @Param("ew") Wrapper<MsgUserAccount> updateWrapper);
@Override
int deleteById(Serializable id);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义查询SQL
* @param sql
* @return
*/
@Select("${sql}")
List<JSONObject> selectBySQL(@Param("sql") String sql, @Param("et")Map param);
/**
* 自定义更新SQL
......
......@@ -23,20 +23,20 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[MsgBody] 服务对象接口
*/
public interface IMsgBodyService extends IService<MsgBody>{
boolean create(MsgBody et) ;
void createBatch(List<MsgBody> list) ;
boolean update(MsgBody et) ;
void updateBatch(List<MsgBody> list) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
MsgBody get(String key) ;
MsgBody getDraft(MsgBody et) ;
boolean checkKey(MsgBody et) ;
boolean save(MsgBody et) ;
void saveBatch(List<MsgBody> list) ;
Page<MsgBody> searchDefault(MsgBodySearchContext context) ;
public interface IMsgBodyService extends IService<MsgBody> {
boolean create(MsgBody et);
void createBatch(List<MsgBody> list);
boolean update(MsgBody et);
void updateBatch(List<MsgBody> list);
boolean remove(String key);
void removeBatch(Collection<String> idList);
MsgBody get(String key);
MsgBody getDraft(MsgBody et);
boolean checkKey(MsgBody et);
boolean save(MsgBody et);
void saveBatch(List<MsgBody> list);
Page<MsgBody> searchDefault(MsgBodySearchContext context);
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -23,24 +23,24 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[MsgOpenAccess] 服务对象接口
*/
public interface IMsgOpenAccessService extends IService<MsgOpenAccess>{
boolean create(MsgOpenAccess et) ;
@CacheEvict(value="msgopenaccess",allEntries=true)
void createBatch(List<MsgOpenAccess> list) ;
boolean update(MsgOpenAccess et) ;
@CacheEvict(value="msgopenaccess",allEntries=true)
void updateBatch(List<MsgOpenAccess> list) ;
boolean remove(String key) ;
@CacheEvict(value="msgopenaccess",allEntries=true)
void removeBatch(Collection<String> idList) ;
MsgOpenAccess get(String key) ;
MsgOpenAccess getDraft(MsgOpenAccess et) ;
boolean checkKey(MsgOpenAccess et) ;
boolean save(MsgOpenAccess et) ;
@CacheEvict(value="msgopenaccess",allEntries=true)
void saveBatch(List<MsgOpenAccess> list) ;
Page<MsgOpenAccess> searchDefault(MsgOpenAccessSearchContext context) ;
public interface IMsgOpenAccessService extends IService<MsgOpenAccess> {
boolean create(MsgOpenAccess et);
@CacheEvict(value = "msgopenaccess", allEntries = true)
void createBatch(List<MsgOpenAccess> list);
boolean update(MsgOpenAccess et);
@CacheEvict(value = "msgopenaccess", allEntries = true)
void updateBatch(List<MsgOpenAccess> list);
boolean remove(String key);
@CacheEvict(value = "msgopenaccess", allEntries = true)
void removeBatch(Collection<String> idList);
MsgOpenAccess get(String key);
MsgOpenAccess getDraft(MsgOpenAccess et);
boolean checkKey(MsgOpenAccess et);
boolean save(MsgOpenAccess et);
@CacheEvict(value = "msgopenaccess",allEntries = true)
void saveBatch(List<MsgOpenAccess> list);
Page<MsgOpenAccess> searchDefault(MsgOpenAccessSearchContext context);
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -23,26 +23,26 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[MsgTemplate] 服务对象接口
*/
public interface IMsgTemplateService extends IService<MsgTemplate>{
public interface IMsgTemplateService extends IService<MsgTemplate> {
boolean create(MsgTemplate et) ;
@CacheEvict(value="msgtemplate",allEntries=true)
void createBatch(List<MsgTemplate> list) ;
boolean update(MsgTemplate et) ;
@CacheEvict(value="msgtemplate",allEntries=true)
void updateBatch(List<MsgTemplate> list) ;
boolean remove(String key) ;
@CacheEvict(value="msgtemplate",allEntries=true)
void removeBatch(Collection<String> idList) ;
MsgTemplate get(String key) ;
MsgTemplate getDraft(MsgTemplate et) ;
boolean checkKey(MsgTemplate et) ;
boolean save(MsgTemplate et) ;
@CacheEvict(value="msgtemplate",allEntries=true)
void saveBatch(List<MsgTemplate> list) ;
Page<MsgTemplate> searchDefault(MsgTemplateSearchContext context) ;
boolean create(MsgTemplate et);
@CacheEvict(value = "msgtemplate", allEntries = true)
void createBatch(List<MsgTemplate> list);
boolean update(MsgTemplate et);
@CacheEvict(value = "msgtemplate", allEntries = true)
void updateBatch(List<MsgTemplate> list);
boolean remove(String key);
@CacheEvict(value = "msgtemplate", allEntries = true)
void removeBatch(Collection<String> idList);
MsgTemplate get(String key);
MsgTemplate getDraft(MsgTemplate et);
boolean checkKey(MsgTemplate et);
boolean save(MsgTemplate et);
@CacheEvict(value = "msgtemplate",allEntries = true)
void saveBatch(List<MsgTemplate> list);
Page<MsgTemplate> searchDefault(MsgTemplateSearchContext context);
List<MsgTemplate> selectByAccessId(String id);
@CacheEvict(value="msgtemplate",allEntries=true)
@CacheEvict(value = "msgtemplate", allEntries = true)
void removeByAccessId(String id);
/**
*自定义查询SQL
......
......@@ -23,20 +23,20 @@ import com.baomidou.mybatisplus.extension.service.IService;
/**
* 实体[MsgUserAccount] 服务对象接口
*/
public interface IMsgUserAccountService extends IService<MsgUserAccount>{
boolean create(MsgUserAccount et) ;
void createBatch(List<MsgUserAccount> list) ;
boolean update(MsgUserAccount et) ;
void updateBatch(List<MsgUserAccount> list) ;
boolean remove(String key) ;
void removeBatch(Collection<String> idList) ;
MsgUserAccount get(String key) ;
MsgUserAccount getDraft(MsgUserAccount et) ;
boolean checkKey(MsgUserAccount et) ;
boolean save(MsgUserAccount et) ;
void saveBatch(List<MsgUserAccount> list) ;
Page<MsgUserAccount> searchDefault(MsgUserAccountSearchContext context) ;
public interface IMsgUserAccountService extends IService<MsgUserAccount> {
boolean create(MsgUserAccount et);
void createBatch(List<MsgUserAccount> list);
boolean update(MsgUserAccount et);
void updateBatch(List<MsgUserAccount> list);
boolean remove(String key);
void removeBatch(Collection<String> idList);
MsgUserAccount get(String key);
MsgUserAccount getDraft(MsgUserAccount et);
boolean checkKey(MsgUserAccount et);
boolean save(MsgUserAccount et);
void saveBatch(List<MsgUserAccount> list);
Page<MsgUserAccount> searchDefault(MsgUserAccountSearchContext context);
/**
*自定义查询SQL
* @param sql select * from table where id =#{et.param}
......
......@@ -54,37 +54,39 @@ public class MsgBodyServiceImpl extends ServiceImpl<MsgBodyMapper, MsgBody> impl
@Override
@Transactional
public boolean create(MsgBody et) {
if(!this.retBool(this.baseMapper.insert(et)))
if(!this.retBool(this.baseMapper.insert(et))) {
return false;
CachedBeanCopier.copy(get(et.getMsgId()),et);
}
CachedBeanCopier.copy(get(et.getMsgId()), et);
return true;
}
@Override
@Transactional
public void createBatch(List<MsgBody> list) {
this.saveBatch(list,batchSize);
this.saveBatch(list, batchSize);
}
@Override
@Transactional
public boolean update(MsgBody et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("msgid",et.getMsgId())))
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("msgid", et.getMsgId()))) {
return false;
CachedBeanCopier.copy(get(et.getMsgId()),et);
}
CachedBeanCopier.copy(get(et.getMsgId()), et);
return true;
}
@Override
@Transactional
public void updateBatch(List<MsgBody> list) {
updateBatchById(list,batchSize);
updateBatchById(list, batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
boolean result = removeById(key);
return result ;
}
......@@ -98,11 +100,11 @@ public class MsgBodyServiceImpl extends ServiceImpl<MsgBodyMapper, MsgBody> impl
@Transactional
public MsgBody get(String key) {
MsgBody et = getById(key);
if(et==null){
et=new MsgBody();
if(et == null){
et = new MsgBody();
et.setMsgId(key);
}
else{
else {
}
return et;
}
......@@ -114,13 +116,14 @@ public class MsgBodyServiceImpl extends ServiceImpl<MsgBodyMapper, MsgBody> impl
@Override
public boolean checkKey(MsgBody et) {
return (!ObjectUtils.isEmpty(et.getMsgId()))&&(!Objects.isNull(this.getById(et.getMsgId())));
return (!ObjectUtils.isEmpty(et.getMsgId())) && (!Objects.isNull(this.getById(et.getMsgId())));
}
@Override
@Transactional
public boolean save(MsgBody et) {
if(!saveOrUpdate(et))
if(!saveOrUpdate(et)) {
return false;
}
return true;
}
......
......@@ -57,37 +57,39 @@ public class MsgOpenAccessServiceImpl extends ServiceImpl<MsgOpenAccessMapper, M
@Override
@Transactional
public boolean create(MsgOpenAccess et) {
if(!this.retBool(this.baseMapper.insert(et)))
if(!this.retBool(this.baseMapper.insert(et))) {
return false;
CachedBeanCopier.copy(get(et.getId()),et);
}
CachedBeanCopier.copy(get(et.getId()), et);
return true;
}
@Override
@Transactional
public void createBatch(List<MsgOpenAccess> list) {
this.saveBatch(list,batchSize);
this.saveBatch(list, batchSize);
}
@Override
@Transactional
public boolean update(MsgOpenAccess et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("accessid",et.getId())))
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("accessid", et.getId()))) {
return false;
CachedBeanCopier.copy(get(et.getId()),et);
}
CachedBeanCopier.copy(get(et.getId()), et);
return true;
}
@Override
@Transactional
public void updateBatch(List<MsgOpenAccess> list) {
updateBatchById(list,batchSize);
updateBatchById(list, batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
boolean result = removeById(key);
return result ;
}
......@@ -101,11 +103,11 @@ public class MsgOpenAccessServiceImpl extends ServiceImpl<MsgOpenAccessMapper, M
@Transactional
public MsgOpenAccess get(String key) {
MsgOpenAccess et = getById(key);
if(et==null){
et=new MsgOpenAccess();
if(et == null){
et = new MsgOpenAccess();
et.setId(key);
}
else{
else {
}
return et;
}
......@@ -117,13 +119,14 @@ public class MsgOpenAccessServiceImpl extends ServiceImpl<MsgOpenAccessMapper, M
@Override
public boolean checkKey(MsgOpenAccess et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
return (!ObjectUtils.isEmpty(et.getId())) && (!Objects.isNull(this.getById(et.getId())));
}
@Override
@Transactional
public boolean save(MsgOpenAccess et) {
if(!saveOrUpdate(et))
if(!saveOrUpdate(et)) {
return false;
}
return true;
}
......
......@@ -58,9 +58,10 @@ public class MsgTemplateServiceImpl extends ServiceImpl<MsgTemplateMapper, MsgTe
@Transactional
public boolean create(MsgTemplate et) {
fillParentData(et);
if(!this.retBool(this.baseMapper.insert(et)))
if(!this.retBool(this.baseMapper.insert(et))) {
return false;
CachedBeanCopier.copy(get(et.getTid()),et);
}
CachedBeanCopier.copy(get(et.getTid()), et);
return true;
}
......@@ -68,16 +69,17 @@ public class MsgTemplateServiceImpl extends ServiceImpl<MsgTemplateMapper, MsgTe
@Transactional
public void createBatch(List<MsgTemplate> list) {
list.forEach(item->fillParentData(item));
this.saveBatch(list,batchSize);
this.saveBatch(list, batchSize);
}
@Override
@Transactional
public boolean update(MsgTemplate et) {
fillParentData(et);
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("tid",et.getTid())))
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("tid", et.getTid()))) {
return false;
CachedBeanCopier.copy(get(et.getTid()),et);
}
CachedBeanCopier.copy(get(et.getTid()), et);
return true;
}
......@@ -85,13 +87,13 @@ public class MsgTemplateServiceImpl extends ServiceImpl<MsgTemplateMapper, MsgTe
@Transactional
public void updateBatch(List<MsgTemplate> list) {
list.forEach(item->fillParentData(item));
updateBatchById(list,batchSize);
updateBatchById(list, batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
boolean result = removeById(key);
return result ;
}
......@@ -105,11 +107,11 @@ public class MsgTemplateServiceImpl extends ServiceImpl<MsgTemplateMapper, MsgTe
@Transactional
public MsgTemplate get(String key) {
MsgTemplate et = getById(key);
if(et==null){
et=new MsgTemplate();
if(et == null){
et = new MsgTemplate();
et.setTid(key);
}
else{
else {
}
return et;
}
......@@ -122,13 +124,14 @@ public class MsgTemplateServiceImpl extends ServiceImpl<MsgTemplateMapper, MsgTe
@Override
public boolean checkKey(MsgTemplate et) {
return (!ObjectUtils.isEmpty(et.getTid()))&&(!Objects.isNull(this.getById(et.getTid())));
return (!ObjectUtils.isEmpty(et.getTid())) && (!Objects.isNull(this.getById(et.getTid())));
}
@Override
@Transactional
public boolean save(MsgTemplate et) {
if(!saveOrUpdate(et))
if(!saveOrUpdate(et)) {
return false;
}
return true;
}
......
......@@ -54,9 +54,10 @@ public class MsgUserAccountServiceImpl extends ServiceImpl<MsgUserAccountMapper,
@Override
@Transactional
public boolean create(MsgUserAccount et) {
if(!this.retBool(this.baseMapper.insert(et)))
if(!this.retBool(this.baseMapper.insert(et))) {
return false;
CachedBeanCopier.copy(get(et.getId()),et);
}
CachedBeanCopier.copy(get(et.getId()), et);
return true;
}
......@@ -69,22 +70,23 @@ public class MsgUserAccountServiceImpl extends ServiceImpl<MsgUserAccountMapper,
@Override
@Transactional
public boolean update(MsgUserAccount et) {
if(!update(et,(Wrapper) et.getUpdateWrapper(true).eq("authid",et.getId())))
if(!update(et, (Wrapper) et.getUpdateWrapper(true).eq("authid", et.getId()))) {
return false;
CachedBeanCopier.copy(get(et.getId()),et);
}
CachedBeanCopier.copy(get(et.getId()), et);
return true;
}
@Override
@Transactional
public void updateBatch(List<MsgUserAccount> list) {
updateBatchById(list,batchSize);
updateBatchById(list, batchSize);
}
@Override
@Transactional
public boolean remove(String key) {
boolean result=removeById(key);
boolean result = removeById(key);
return result ;
}
......@@ -98,11 +100,11 @@ public class MsgUserAccountServiceImpl extends ServiceImpl<MsgUserAccountMapper,
@Transactional
public MsgUserAccount get(String key) {
MsgUserAccount et = getById(key);
if(et==null){
et=new MsgUserAccount();
if(et == null){
et = new MsgUserAccount();
et.setId(key);
}
else{
else {
}
return et;
}
......@@ -114,13 +116,14 @@ public class MsgUserAccountServiceImpl extends ServiceImpl<MsgUserAccountMapper,
@Override
public boolean checkKey(MsgUserAccount et) {
return (!ObjectUtils.isEmpty(et.getId()))&&(!Objects.isNull(this.getById(et.getId())));
return (!ObjectUtils.isEmpty(et.getId())) && (!Objects.isNull(this.getById(et.getId())));
}
@Override
@Transactional
public boolean save(MsgUserAccount et) {
if(!saveOrUpdate(et))
if(!saveOrUpdate(et)) {
return false;
}
return true;
}
......
......@@ -4,11 +4,10 @@ import org.mapstruct.*;
import cn.ibizlab.core.notify.domain.MsgBody;
import cn.ibizlab.api.dto.MsgBodyDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="apiMsgBodyMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
@Mapper(componentModel = "spring", uses = {}, implementationName = "apiMsgBodyMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface MsgBodyMapping extends MappingBase<MsgBodyDTO, MsgBody> {
......
......@@ -4,11 +4,10 @@ import org.mapstruct.*;
import cn.ibizlab.core.notify.domain.MsgOpenAccess;
import cn.ibizlab.api.dto.MsgOpenAccessDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="apiMsgOpenAccessMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
@Mapper(componentModel = "spring", uses = {}, implementationName = "apiMsgOpenAccessMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface MsgOpenAccessMapping extends MappingBase<MsgOpenAccessDTO, MsgOpenAccess> {
......
......@@ -4,11 +4,10 @@ import org.mapstruct.*;
import cn.ibizlab.core.notify.domain.MsgTemplate;
import cn.ibizlab.api.dto.MsgTemplateDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="apiMsgTemplateMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
@Mapper(componentModel = "spring", uses = {}, implementationName = "apiMsgTemplateMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface MsgTemplateMapping extends MappingBase<MsgTemplateDTO, MsgTemplate> {
......
......@@ -4,11 +4,10 @@ import org.mapstruct.*;
import cn.ibizlab.core.notify.domain.MsgUserAccount;
import cn.ibizlab.api.dto.MsgUserAccountDTO;
import cn.ibizlab.util.domain.MappingBase;
import org.mapstruct.factory.Mappers;
@Mapper(componentModel = "spring", uses = {},implementationName="apiMsgUserAccountMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
@Mapper(componentModel = "spring", uses = {}, implementationName = "apiMsgUserAccountMapping",
nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE,
nullValueCheckStrategy = NullValueCheckStrategy.ALWAYS)
public interface MsgUserAccountMapping extends MappingBase<MsgUserAccountDTO, MsgUserAccount> {
......
......@@ -43,30 +43,31 @@ public class AuditAspect
*/
@AfterReturning(value = "execution(* cn.ibizlab.core.*.service.*.create(..))")
@SneakyThrows
public void create(JoinPoint point){
HttpServletRequest request=null;
RequestAttributes requestAttributes= RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null){
request=((ServletRequestAttributes)requestAttributes).getRequest();
public void create(JoinPoint point) {
HttpServletRequest request = null;
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null) {
request = ((ServletRequestAttributes)requestAttributes).getRequest();
}
Object [] args = point.getArgs();
if(ObjectUtils.isEmpty(args) || args.length==0)
if(ObjectUtils.isEmpty(args) || args.length==0) {
return;
Object serviceParam =args[0];
if(serviceParam instanceof EntityBase){
EntityBase entity=(EntityBase)serviceParam;//创建数据
Map<String, Audit> auditFields= DEFieldCacheMap.getAuditFields(entity.getClass());
if(auditFields.size()==0)//是否有审计属性
}
Object serviceParam = args[0];
if(serviceParam instanceof EntityBase) {
EntityBase entity = (EntityBase)serviceParam;
Map<String, Audit> auditFields = DEFieldCacheMap.getAuditFields(entity.getClass());
//是否有审计属性
if(auditFields.size()==0) {
return;
String idField=DEFieldCacheMap.getDEKeyField(entity.getClass());
Object idValue="";
if(!StringUtils.isEmpty(idField)){
}
String idField = DEFieldCacheMap.getDEKeyField(entity.getClass());
Object idValue = "";
if(!StringUtils.isEmpty(idField)) {
idValue=entity.get(idField);
}
//记录审计日志
dataAuditService.createAudit(request,entity,idValue,auditFields);
dataAuditService.createAudit(request, entity, idValue, auditFields);
}
}
......@@ -77,39 +78,38 @@ public class AuditAspect
*/
@Around("execution(* cn.ibizlab.core.*.service.*.update(..))")
public Object update(ProceedingJoinPoint point) throws Throwable {
HttpServletRequest request=null;
RequestAttributes requestAttributes= RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null){
HttpServletRequest request = null;
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null) {
request=((ServletRequestAttributes)requestAttributes).getRequest();
}
Object serviceObj=point.getTarget();
Object args[]=point.getArgs();
if(ObjectUtils.isEmpty(args) || args.length==0)
Object serviceObj = point.getTarget();
Object args[] = point.getArgs();
if(ObjectUtils.isEmpty(args) || args.length==0) {
return point.proceed();
Object arg=args[0];
if(arg instanceof EntityBase){
EntityBase entity= (EntityBase) arg;
Map<String, Audit> auditFields= DEFieldCacheMap.getAuditFields(entity.getClass());
}
Object arg = args[0];
if(arg instanceof EntityBase) {
EntityBase entity = (EntityBase) arg;
Map<String, Audit> auditFields = DEFieldCacheMap.getAuditFields(entity.getClass());
//是否有审计属性
if(auditFields.size()==0)
if(auditFields.size()==0) {
return point.proceed();
String idField=DEFieldCacheMap.getDEKeyField(entity.getClass());
Object idValue="";
}
String idField = DEFieldCacheMap.getDEKeyField(entity.getClass());
Object idValue = "";
if(!StringUtils.isEmpty(idField)){
idValue=entity.get(idField);
idValue = entity.get(idField);
}
if(ObjectUtils.isEmpty(idValue))
if(ObjectUtils.isEmpty(idValue)) {
return point.proceed();
}
//获取更新前实体
EntityBase beforeEntity=getEntity(serviceObj,idValue);
EntityBase beforeEntity = getEntity(serviceObj, idValue);
//执行更新操作
point.proceed();
//记录审计日志
dataAuditService.updateAudit(request,beforeEntity,serviceObj,idValue,auditFields);
dataAuditService.updateAudit(request, beforeEntity, serviceObj, idValue, auditFields);
return true;
}
return point.proceed();
......@@ -124,28 +124,27 @@ public class AuditAspect
*/
@Around("execution(* cn.ibizlab.core.*.service.*.remove(..))")
public Object remove(ProceedingJoinPoint point) throws Throwable {
HttpServletRequest request=null;
RequestAttributes requestAttributes= RequestContextHolder.getRequestAttributes();
if(requestAttributes!=null){
request=((ServletRequestAttributes)requestAttributes).getRequest();
HttpServletRequest request = null;
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if(requestAttributes!= null) {
request = ((ServletRequestAttributes)requestAttributes).getRequest();
}
Object serviceObj=point.getTarget();
Object args[]=point.getArgs();
if(ObjectUtils.isEmpty(args) || args.length==0)
Object serviceObj = point.getTarget();
Object args[] = point.getArgs();
if(ObjectUtils.isEmpty(args) || args.length==0) {
return point.proceed();
Object idValue=args[0];
EntityBase entity=getEntity(serviceObj,idValue);
Map<String, Audit> auditFields= DEFieldCacheMap.getAuditFields(entity.getClass());
if(auditFields.size()==0){
}
Object idValue = args[0];
EntityBase entity = getEntity(serviceObj, idValue);
Map<String, Audit> auditFields = DEFieldCacheMap.getAuditFields(entity.getClass());
if(auditFields.size()==0) {
return point.proceed();
}
else{
//执行删除操作
point.proceed();
//记录审计日志
dataAuditService.removeAudit(request,entity,idValue,auditFields);
dataAuditService.removeAudit(request, entity, idValue, auditFields);
return true;
}
}
......@@ -157,12 +156,12 @@ public class AuditAspect
* @return
*/
@SneakyThrows
private EntityBase getEntity(Object service, Object id){
EntityBase entity=null;
if(!ObjectUtils.isEmpty(service)){
private EntityBase getEntity(Object service, Object id) {
EntityBase entity = null;
if(!ObjectUtils.isEmpty(service)) {
EvaluationContext oldContext = new StandardEvaluationContext();
oldContext.setVariable("service",service);
oldContext.setVariable("id",id);
oldContext.setVariable("service", service);
oldContext.setVariable("id", id);
Expression oldExp = parser.parseExpression("#service.get(#id)");
return oldExp.getValue(oldContext, EntityBase.class);
}
......
......@@ -32,55 +32,62 @@ import java.util.Map;
public class VersionCheckAspect
{
private final ExpressionParser parser = new SpelExpressionParser();
private final String IgnoreField="ignoreversioncheck";
private final String IgnoreField = "ignoreversioncheck";
@SneakyThrows
@Before("execution(* cn.ibizlab.*.rest.*.update(..)) && @annotation(versionCheck)")
public void BeforeUpdate(JoinPoint point, VersionCheck versionCheck){
public void BeforeUpdate(JoinPoint point, VersionCheck versionCheck) {
Object[] args = point.getArgs();
Object id=args[0];
Object dto=args[1];
if(ObjectUtils.isEmpty(id) || ObjectUtils.isEmpty(dto))
Object id = args[0];
Object dto = args[1];
if(ObjectUtils.isEmpty(id) || ObjectUtils.isEmpty(dto)) {
return;
String versionField=versionCheck.versionfield();
if(StringUtils.isEmpty(versionField))
}
String versionField = versionCheck.versionfield();
if(StringUtils.isEmpty(versionField)) {
return;
versionCheck(versionCheck,point.getTarget(),dto,id);
}
versionCheck(versionCheck,point.getTarget(), dto, id);
}
@SneakyThrows
@Before("execution(* cn.ibizlab.*.rest.*.updateBy*(..)) && @annotation(versionCheck)")
public void BeforeUpdateBy(JoinPoint point, VersionCheck versionCheck){
public void BeforeUpdateBy(JoinPoint point, VersionCheck versionCheck) {
Object[] args = point.getArgs();
if(args.length>=2){
Object id=args[args.length-2];
Object dto=args[args.length-1];
if(ObjectUtils.isEmpty(id) || ObjectUtils.isEmpty(dto))
if(args.length>=2) {
Object id = args[args.length-2];
Object dto = args[args.length-1];
if(ObjectUtils.isEmpty(id) || ObjectUtils.isEmpty(dto)) {
return;
String versionField=versionCheck.versionfield();
if(StringUtils.isEmpty(versionField))
}
String versionField = versionCheck.versionfield();
if(StringUtils.isEmpty(versionField)) {
return;
versionCheck(versionCheck,point.getTarget(),dto,id);
}
versionCheck(versionCheck, point.getTarget(), dto, id);
}
}
private void versionCheck(VersionCheck versionCheck,Object resource,Object dto,Object id ){
private void versionCheck(VersionCheck versionCheck, Object resource, Object dto, Object id) {
EvaluationContext context = new StandardEvaluationContext();
context.setVariable("dto",dto);
context.setVariable("dto", dto);
//忽略版本检查
Expression dtoParamsExp = parser.parseExpression("#dto.extensionparams");
Map dtoParam=dtoParamsExp.getValue(context, Map.class);
if(!ObjectUtils.isEmpty(dtoParam) && !ObjectUtils.isEmpty(dtoParam.get(IgnoreField)) && dtoParam.get(IgnoreField).equals(1))
Map dtoParam = dtoParamsExp.getValue(context, Map.class);
if(!ObjectUtils.isEmpty(dtoParam) && !ObjectUtils.isEmpty(dtoParam.get(IgnoreField)) && dtoParam.get(IgnoreField).equals(1)) {
return;
Expression newExp = parser.parseExpression(String.format("#dto.%s",versionCheck.versionfield()));
Object newVersion=newExp.getValue(context);
if(ObjectUtils.isEmpty(newVersion))
}
Expression newExp = parser.parseExpression(String.format("#dto.%s", versionCheck.versionfield()));
Object newVersion = newExp.getValue(context);
if(ObjectUtils.isEmpty(newVersion)) {
return;
}
//进行版本检查
Object oldVersion =getDBVersion(versionCheck,getService(resource,versionCheck.entity()),id);
if(!ObjectUtils.isEmpty(oldVersion)){
if(RuleUtils.gt(newVersion,oldVersion))
throw new BadRequestAlertException("数据已变更,可能后台数据已被修改,请重新加载数据","VersionCheckAspect","versionCheck");
Object oldVersion = getDBVersion(versionCheck,getService(resource, versionCheck.entity()), id);
if(!ObjectUtils.isEmpty(oldVersion)) {
if(RuleUtils.gt(newVersion, oldVersion)) {
throw new BadRequestAlertException("数据已变更,可能后台数据已被修改,请重新加载数据", "VersionCheckAspect", "versionCheck");
}
}
}
......@@ -91,12 +98,12 @@ public class VersionCheckAspect
* @return
*/
@SneakyThrows
private Object getService(Object resource,String entity){
private Object getService(Object resource, String entity) {
Object service = null;
Field[] fields= resource.getClass().getDeclaredFields();
for(Field field : fields){
if(field.getModifiers()==1 && field.getName().equalsIgnoreCase(String.format("%sService",entity))){
service=field.get(resource);
Field[] fields = resource.getClass().getDeclaredFields();
for(Field field : fields) {
if(field.getModifiers()==1 && field.getName().equalsIgnoreCase(String.format("%sService",entity))) {
service = field.get(resource);
break;
}
}
......@@ -111,21 +118,21 @@ public class VersionCheckAspect
* @return
*/
@SneakyThrows
private Object getDBVersion(VersionCheck versionCheck,Object service,Object id){
private Object getDBVersion(VersionCheck versionCheck, Object service, Object id) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Timestamp dbVersion=null;
String versionField=versionCheck.versionfield();
if(!ObjectUtils.isEmpty(service)){
Timestamp dbVersion = null;
String versionField = versionCheck.versionfield();
if(!ObjectUtils.isEmpty(service)) {
EvaluationContext oldContext = new StandardEvaluationContext();
oldContext.setVariable("service",service);
oldContext.setVariable("id",id);
oldContext.setVariable("service", service);
oldContext.setVariable("id", id);
Expression oldExp = parser.parseExpression("#service.get(#id)");
EntityBase oldEntity =oldExp.getValue(oldContext, EntityBase.class);
Object oldDate=oldEntity.get(versionField);
if(oldDate!=null && oldDate instanceof Timestamp){
Timestamp db_time= (Timestamp) oldDate;
EntityBase oldEntity = oldExp.getValue(oldContext, EntityBase.class);
Object oldDate = oldEntity.get(versionField);
if(oldDate!=null && oldDate instanceof Timestamp) {
Timestamp db_time = (Timestamp) oldDate;
Date db_date = sdf.parse(sdf.format(db_time));
dbVersion=new Timestamp(db_date.getTime());
dbVersion = new Timestamp(db_date.getTime());
}
}
return dbVersion;
......
......@@ -21,33 +21,39 @@ public class DTOBase implements Serializable {
public void modify(String field,Object val) {
if(val==null)
if(val==null) {
this.getFocusNull(true).add(field.toLowerCase());
else
}
else {
this.getFocusNull(true).remove(field.toLowerCase());
}
}
public Set<String> getFocusNull() {
if(focusNull==null)
if(focusNull==null) {
focusNull=new HashSet<>();
}
if(focusNull.size()>0 && extensionparams.containsKey("dirtyflagenable"))
{
Set<String> nocheck=new HashSet<>();
for(String key:focusNull)
{
if(!extensionparams.containsKey(key+"dirtyflag"))
if(!extensionparams.containsKey(key+"dirtyflag")) {
nocheck.add(key);
}
}
for(String key:nocheck)
for(String key:nocheck) {
focusNull.remove(key);
}
}
return focusNull;
}
private Set<String> getFocusNull(boolean newflag) {
if(focusNull==null)
if(focusNull==null) {
focusNull=new HashSet<>();
}
return focusNull;
}
......
......@@ -24,8 +24,9 @@ public class EntityBase implements Serializable {
private Set<String> focusNull;
public Set<String> getFocusNull() {
if(focusNull==null)
if(focusNull==null) {
focusNull=new HashSet<>();
}
return focusNull;
}
......@@ -50,8 +51,9 @@ public class EntityBase implements Serializable {
private BeanMap getMap()
{
if(map==null)
map=BeanMap.create(this);
if(map==null) {
map=BeanMap.create(this);
}
return map;
}
......@@ -68,17 +70,16 @@ public class EntityBase implements Serializable {
this.extensionparams = extensionparams;
}
public Object get(String field) {
String fieldRealName=DEFieldCacheMap.getFieldRealName(this.getClass(),field);
if(!StringUtils.isEmpty(fieldRealName))
if(!StringUtils.isEmpty(fieldRealName)) {
return getMap().get(fieldRealName);
else
}
else {
return this.extensionparams.get(field.toLowerCase());
}
}
@JsonAnyGetter
public Map<String , Object> any() {
return extensionparams;
......@@ -89,13 +90,16 @@ public class EntityBase implements Serializable {
field=field.toLowerCase();
String fieldRealName=DEFieldCacheMap.getFieldRealName(this.getClass(),field);
if(!StringUtils.isEmpty(fieldRealName)) {
if (value == null)
if (value == null) {
getMap().put(fieldRealName, null);
else
}
else {
getMap().put(fieldRealName, DEFieldCacheMap.fieldValueOf(this.getClass(), fieldRealName, value));
}
}
else
else {
this.extensionparams.put(field.toLowerCase(),value);
}
}
/**
......
......@@ -5,24 +5,25 @@ import org.springframework.util.StringUtils;
public class EntityMP extends EntityBase {
public UpdateWrapper getUpdateWrapper(boolean clean) {
UpdateWrapper wrapper=new UpdateWrapper();
for(String nullField:getFocusNull()) {
wrapper.set(nullField,null);
}
if(clean)
if(clean) {
getFocusNull().clear();
}
return wrapper;
}
@Override
public void modify(String field,Object val) {
if(val==null)
if(val==null) {
this.getFocusNull().add(field.toLowerCase());
else
}
else {
this.getFocusNull().remove(field.toLowerCase());
}
}
@Override
......@@ -33,6 +34,5 @@ public class EntityMP extends EntityBase {
getFocusNull().remove(resetField);
}
}
}
......@@ -2,7 +2,5 @@ package cn.ibizlab.util.domain;
public class EntityMongo extends EntityBase {
}
......@@ -44,9 +44,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
*/
private QueryBuilder parseQueryFilter(QueryFilter queryFilter){
if( ObjectUtils.isEmpty(queryFilter.get$and()) && ObjectUtils.isEmpty(queryFilter.get$or()) && ObjectUtils.isEmpty(queryFilter.any()))
if(ObjectUtils.isEmpty(queryFilter.get$and()) && ObjectUtils.isEmpty(queryFilter.get$or()) && ObjectUtils.isEmpty(queryFilter.any())) {
return null;
}
QueryBuilder rsBuilder=QueryBuilder.start();
QueryBuilder fieldBuilder=parseFieldMap(queryFilter.any());
QueryBuilder orBuilder=parseOrQueryFilter(queryFilter.get$or());
......@@ -107,8 +107,9 @@ public class QueryBuildContext extends SearchContextBase implements ISearchConte
* @return
*/
private QueryBuilder parseFieldMap(Map<String , QueryFilter.SegmentCond> fieldMap) {
if(fieldMap.size()==0)
if(fieldMap.size()==0) {
return null;
}
QueryBuilder fieldBuilders=QueryBuilder.start();
for(Map.Entry<String, QueryFilter.SegmentCond> entry: fieldMap.entrySet()){
getSegmentCondSql(entry.getKey(),entry.getValue(),fieldBuilders);
......
......@@ -63,8 +63,9 @@ public class QueryFilter {
private Map<String,SegmentCond> getMap()
{
if(map==null)
if(map==null) {
map=new LinkedHashMap<>();
}
return map;
}
......@@ -132,11 +133,12 @@ public class QueryFilter {
}
private QueryFilter op(String column, SegmentCond segmentCond) {
if(this.getMap().containsKey(column))
if(this.getMap().containsKey(column)) {
((SegmentCond)this.getMap().get(column)).getMap().putAll(segmentCond.getMap());
else
}
else {
this.getMap().put(column,segmentCond);
}
return this;
}
......@@ -155,8 +157,9 @@ public class QueryFilter {
private Map<String,Object> getMap()
{
if(map==null)
if(map==null) {
map=new LinkedHashMap<>();
}
return map;
}
......
......@@ -37,17 +37,20 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
int pageSize=getPageable().getPageSize();
//构造mybatis-plus分页
if(StringUtils.isEmpty(currentPage) || StringUtils.isEmpty(pageSize))
if(StringUtils.isEmpty(currentPage) || StringUtils.isEmpty(pageSize)) {
page=new Page(1,Short.MAX_VALUE);
else
}
else {
page=new Page(currentPage+1,pageSize);
}
//构造mybatis-plus排序
Sort sort = getPageable().getSort();
Iterator<Sort.Order> it_sort = sort.iterator();
if(ObjectUtils.isEmpty(it_sort))
if(ObjectUtils.isEmpty(it_sort)) {
return page;
}
ParameterizedType parameterizedType = (ParameterizedType) getClass().getGenericSuperclass();
Class<T> type = (Class<T>)parameterizedType.getActualTypeArguments()[0];
......@@ -95,9 +98,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
*/
private Consumer<QueryWrapper<T>> parseQueryFilter(QueryFilter queryFilter){
if(queryFilter.any().size()==0 && queryFilter.get$or()==null && queryFilter.get$and()==null)
return null;
if(queryFilter.any().size()==0 && queryFilter.get$or()==null && queryFilter.get$and()==null) {
return null;
}
Consumer<QueryWrapper<T>> consumer = queryWrapper -> {
Consumer fieldConsumer=parseFieldMap(queryFilter.any());
Consumer orConsumer=parseOrQueryFilter(queryFilter.get$or());
......@@ -121,7 +124,6 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
*/
private Consumer<QueryWrapper<T>> parseOrQueryFilter(List<QueryFilter> queryFilters) {
if(queryFilters==null || queryFilters.size()==0)
return null;
Consumer<QueryWrapper<T>> consumer = queryWrapper -> {
......@@ -139,10 +141,10 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
*/
private Consumer<QueryWrapper<T>> parseAndQueryFilter(List<QueryFilter> queryFilters) {
if(queryFilters==null || queryFilters.size()==0)
if(queryFilters==null || queryFilters.size()==0) {
return null;
Consumer<QueryWrapper<T>> consumer = queryWrapper -> {
}
Consumer<QueryWrapper<T>> consumer = queryWrapper -> {
for(QueryFilter queryFilter: queryFilters){
Consumer tempQueryWrapper=parseQueryFilter(queryFilter);
queryWrapper.and(tempQueryWrapper);
......@@ -157,9 +159,9 @@ public class QueryWrapperContext<T> extends SearchContextBase implements ISearch
* @return
*/
private Consumer<QueryWrapper<T>> parseFieldMap(Map<String , QueryFilter.SegmentCond> fieldMap) {
if(fieldMap.size()==0)
if(fieldMap.size()==0) {
return null;
}
Consumer<QueryWrapper<T>> consumer = queryWrapper -> {
for(Map.Entry<String, QueryFilter.SegmentCond> field: fieldMap.entrySet()){
String fieldName=field.getKey();
......
......@@ -98,10 +98,12 @@ public class SearchContextBase implements ISearchContext{
* @return
*/
public Pageable getPageable() {
if(ObjectUtils.isEmpty(pageSort))
return PageRequest.of(page,size);
else
return PageRequest.of(page,size,pageSort);
if(ObjectUtils.isEmpty(pageSort)) {
return PageRequest.of(page,size);
}
else {
return PageRequest.of(page,size,pageSort);
}
}
/**
......
......@@ -13,8 +13,9 @@ public class CachedBeanCopier {
}
public static void copy(Object srcObj, Object destObj,boolean useConverter) {
if(srcObj==null||destObj==null)
if(srcObj==null||destObj==null) {
return;
}
getCopier(srcObj,destObj,useConverter).copy(srcObj, destObj, null);
}
......@@ -29,6 +30,4 @@ public class CachedBeanCopier {
}
return copier;
}
}
......@@ -36,13 +36,16 @@ public class DEFieldCacheMap {
*/
public static <T> Hashtable<String,Field> getFieldMap(Class<T> clazz) {
String className=clazz.getName();
if(className.indexOf("_$")>0)
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheMap.containsKey(className))
return cacheMap.get(className);
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
}
if(cacheMap.containsKey(className)) {
return cacheMap.get(className);
}
synchronized (objLock1) {
if(cacheMap.containsKey(className))
return cacheMap.get(className);
if(cacheMap.containsKey(className)) {
return cacheMap.get(className);
}
Hashtable<String,Field> result = new Hashtable<String,Field>();
List<Field> list=new ArrayList<Field>();
Hashtable<String,String> keys=new Hashtable<String,String>();
......@@ -58,8 +61,9 @@ public class DEFieldCacheMap {
Audit auditField=field.getAnnotation(Audit.class);
if(!ObjectUtils.isEmpty(deField)) {
defields.put(field.getName(),deField);
if(deField.isKeyField())
cacheDEKeyField.put(className,field.getName());
if(deField.isKeyField()) {
cacheDEKeyField.put(className,field.getName());
}
}
if(!ObjectUtils.isEmpty(auditField)) {
auditfields.put(field.getName(),auditField);
......@@ -74,10 +78,12 @@ public class DEFieldCacheMap {
}
}
public static Hashtable<String,Field> getFieldMap(String className) {
if(className.indexOf("_$")>0)
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheMap.containsKey(className))
return cacheMap.get(className);
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
}
if(cacheMap.containsKey(className)) {
return cacheMap.get(className);
}
Class clazz = null;
try {
clazz = Class.forName(className);
......@@ -96,10 +102,12 @@ public class DEFieldCacheMap {
*/
public static <T> Hashtable<String,DEField> getDEFields(Class<T> clazz) {
String className=clazz.getName();
if(className.indexOf("_$")>0)
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheDEField.containsKey(className))
}
if(cacheDEField.containsKey(className)) {
return cacheDEField.get(className);
}
else{
DEFieldCacheMap.getFieldMap(className);
return cacheDEField.get(className);
......@@ -113,10 +121,12 @@ public class DEFieldCacheMap {
*/
public static <T> Hashtable<String,Audit> getAuditFields(Class<T> clazz) {
String className=clazz.getName();
if(className.indexOf("_$")>0)
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheAuditField.containsKey(className))
}
if(cacheAuditField.containsKey(className)) {
return cacheAuditField.get(className);
}
else{
DEFieldCacheMap.getFieldMap(className);
return cacheAuditField.get(className);
......@@ -130,10 +140,12 @@ public class DEFieldCacheMap {
*/
public static <T> String getDEKeyField(Class<T> clazz) {
String className=clazz.getName();
if(className.indexOf("_$")>0)
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheDEKeyField.containsKey(className))
}
if(cacheDEKeyField.containsKey(className)) {
return cacheDEKeyField.get(className);
}
else{
DEFieldCacheMap.getFieldMap(className);
return cacheDEKeyField.get(className);
......@@ -148,10 +160,12 @@ public class DEFieldCacheMap {
*/
public static <T> List<Field> getFields(Class<T> clazz) {
String className=clazz.getName();
if(className.indexOf("_$")>0)
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheList.containsKey(className))
}
if(cacheList.containsKey(className)) {
return cacheList.get(className);
}
else{
DEFieldCacheMap.getFieldMap(className);
return cacheList.get(className);
......@@ -159,10 +173,12 @@ public class DEFieldCacheMap {
}
public static List<Field> getFields(String className) {
if(className.indexOf("_$")>0)
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheList.containsKey(className))
}
if(cacheList.containsKey(className)) {
return cacheList.get(className);
}
else{
DEFieldCacheMap.getFieldMap(className);
return cacheList.get(className);
......@@ -176,10 +192,12 @@ public class DEFieldCacheMap {
*/
public static <T> Hashtable<String,String> getFieldKeys(Class<T> clazz) {
String className=clazz.getName();
if(className.indexOf("_$")>0)
if(className.indexOf("_$")>0) {
className=className.substring(0, className.lastIndexOf("_$"));
if(cacheKey.containsKey(className))
}
if(cacheKey.containsKey(className)) {
return cacheKey.get(className);
}
else{
DEFieldCacheMap.getFieldMap(className);
return cacheKey.get(className);
......@@ -189,20 +207,25 @@ public class DEFieldCacheMap {
public static <T> String getFieldRealName(Class<T> clazz,String fieldname) {
fieldname=fieldname.toLowerCase();
Hashtable<String,String> keys=DEFieldCacheMap.getFieldKeys(clazz);
if(keys.containsKey(fieldname))
if(keys.containsKey(fieldname)) {
return keys.get(fieldname);
else if(keys.containsKey(fieldname.replace("_","")))
}
else if(keys.containsKey(fieldname.replace("_",""))) {
return keys.get(fieldname.replace("_",""));
else
}
else {
return "";
}
}
public static <T> Field getField(Class<T> clazz,String fieldname) {
String fieldRealName=DEFieldCacheMap.getFieldRealName(clazz,fieldname);
if(!StringUtils.isEmpty(fieldRealName))
if(!StringUtils.isEmpty(fieldRealName)) {
return DEFieldCacheMap.getFieldMap(clazz).get(fieldRealName);
else
}
else {
return null;
}
}
public static <T> String getFieldColumnName(Class<T> clazz,String fieldname) {
......@@ -226,6 +249,4 @@ public class DEFieldCacheMap {
}
return resultValue;
}
}
\ No newline at end of file
......@@ -19,30 +19,34 @@ public class DataObject {
final static public DateFormat dayFormat = new SimpleDateFormat("yyyy-MM-dd");
final static public String getStringValue(Object objValue, String strDefault) {
if (objValue == null) return strDefault;
if (objValue instanceof String) return (String) objValue;
if (objValue == null) {
return strDefault;
}
if (objValue instanceof String) {
return (String) objValue;
}
if (objValue instanceof java.sql.Timestamp||objValue instanceof java.sql.Date||objValue instanceof java.util.Date) {
String rt=datetimeFormat.format(objValue);
if(rt.endsWith(" 00:00:00"))
if(rt.endsWith(" 00:00:00")) {
rt=dayFormat.format(objValue);
else if(rt.endsWith(":00"))
}
else if(rt.endsWith(":00")) {
rt=datetimeFormat2.format(objValue);
}
return rt;
}
return objValue.toString();
}
public static <T> Object objectValueOf(Class<T> type,Object fieldValue) {
if(fieldValue==null)
if(fieldValue==null) {
return null;
}
Object resultValue=fieldValue;
String targetType=type.getSimpleName();
if(targetType.equalsIgnoreCase(fieldValue.getClass().getSimpleName()))
if(targetType.equalsIgnoreCase(fieldValue.getClass().getSimpleName())){
return resultValue;
}
if(targetType.equals("Boolean")){
resultValue=getBooleanValue(fieldValue,false);
}
......@@ -79,10 +83,9 @@ public class DataObject {
else if(targetType.equals("String")) {
resultValue= getStringValue(fieldValue,null);
}
if(resultValue==null)
if(resultValue==null) {
return null;
}
return resultValue;
}
......@@ -95,8 +98,9 @@ public class DataObject {
if (objValue == null) {
return jDefault;
}
if(objValue instanceof JSONObject)
if(objValue instanceof JSONObject) {
return (JSONObject)objValue;
}
String strValue = objValue.toString();
try {
return JSONObject.parseObject(strValue);
......@@ -111,8 +115,9 @@ public class DataObject {
if (objValue == null) {
return jDefault;
}
if(objValue instanceof JSONArray)
if(objValue instanceof JSONArray) {
return (JSONArray)objValue;
}
String strValue = objValue.toString();
try {
return JSONArray.parseArray(strValue);
......@@ -133,8 +138,9 @@ public class DataObject {
List<String> chk1=new ArrayList<>();
for(int i=0;i<arr.size();i++)
{
if(arr.get(i) instanceof String)
if(arr.get(i) instanceof String) {
chk1.add(arr.getString(i));
}
}
return chk1;
}
......@@ -146,8 +152,9 @@ public class DataObject {
}
final static public Boolean getBooleanValue(Object objValue,Boolean bDefault) {
if (objValue == null) return bDefault;
if (objValue == null) {
return bDefault;
}
if (objValue instanceof Boolean) {
return (Boolean) objValue;
}
......@@ -155,20 +162,24 @@ public class DataObject {
}
final static public char[] getCharacterValue(Object objValue,char[] cDefault) {
if (objValue == null) return cDefault;
if (objValue == null) {
return cDefault;
}
return objValue.toString().toCharArray();
}
final static public Double getDoubleValue(Object objValue,Double dDefault) {
if (objValue == null) return dDefault;
if (objValue == null) {
return dDefault;
}
if (objValue instanceof Double) {
return (Double) objValue;
}
String strValue = objValue.toString();
if (StringUtils.isEmpty(strValue)) return null;
if (StringUtils.isEmpty(strValue)) {
return null;
}
strValue = strValue.replace(",", "");
return Double.parseDouble(strValue);
}
......@@ -179,8 +190,9 @@ public class DataObject {
return nDefault;
}
if(objValue instanceof Integer)
if(objValue instanceof Integer) {
return (Integer)objValue;
}
if (objValue instanceof Double) {
return ((Double) objValue).intValue();
......@@ -191,8 +203,9 @@ public class DataObject {
}
String strValue = objValue.toString();
if(StringUtils.isEmpty(strValue))
if(StringUtils.isEmpty(strValue)) {
return nDefault;
}
strValue = strValue.replace(",", "");
return Integer.parseInt(strValue);
}
......@@ -204,12 +217,13 @@ public class DataObject {
}
try {
if(objValue instanceof Float)
if(objValue instanceof Float) {
return (Float)objValue;
}
String strValue = objValue.toString();
if(StringUtils.isEmpty(strValue))
if(StringUtils.isEmpty(strValue)) {
return fDefault;
}
strValue = strValue.replace(",", "");
return Float.parseFloat(strValue);
} catch (Exception ex) {
......@@ -233,8 +247,9 @@ public class DataObject {
return BigDecimal.valueOf((Long)objValue);
}
String strValue = objValue.toString();
if(StringUtils.isEmpty(strValue))
if(StringUtils.isEmpty(strValue)) {
return fDefault;
}
strValue = strValue.replace(",", "");
return BigDecimal.valueOf(Double.parseDouble(strValue));
} catch (Exception ex) {
......@@ -253,8 +268,9 @@ public class DataObject {
}
else {
Long l=getLongValue(objValue,null);
if(l!=null)
if(l!=null) {
return BigInteger.valueOf(l);
}
}
} catch (Exception ex) {
......@@ -283,8 +299,9 @@ public class DataObject {
}
String strValue = objValue.toString();
if(StringUtils.isEmpty(strValue))
if(StringUtils.isEmpty(strValue)) {
return nDefault;
}
strValue = strValue.replace(",", "");
return Long.parseLong(strValue);
} catch (Exception ex) {
......@@ -294,7 +311,9 @@ public class DataObject {
final static public byte[] getBinaryValue(Object objValue, byte[] def) {
if (objValue == null) return def;
if (objValue == null) {
return def;
}
if(objValue instanceof byte[]){
return (byte[])objValue;
}
......@@ -312,7 +331,9 @@ public class DataObject {
* @
*/
final static public java.sql.Timestamp getTimestampValue(Object objValue,java.sql.Timestamp tDefault) {
if (objValue == null) return tDefault;
if (objValue == null) {
return tDefault;
}
if (objValue instanceof java.sql.Timestamp) {
java.sql.Timestamp ti = (java.sql.Timestamp) objValue;
......@@ -332,7 +353,9 @@ public class DataObject {
if (objValue instanceof String) {
String strValue = (String) objValue;
strValue = strValue.trim();
if (StringUtils.isEmpty(strValue)) return null;
if (StringUtils.isEmpty(strValue)) {
return null;
}
try {
java.util.Date date = parse((String) objValue);
......@@ -373,7 +396,9 @@ public class DataObject {
* @
*/
public static Object testDateTime(String strInput, TimeZone timeZone) throws Exception{
if (StringUtils.isEmpty(strInput)) return null;
if (StringUtils.isEmpty(strInput)) {
return null;
}
Date dtDate = parse(strInput, timeZone);
java.sql.Timestamp retDate = new java.sql.Timestamp(dtDate.getTime());
return retDate;
......@@ -425,8 +450,9 @@ public class DataObject {
if(strTimeString.indexOf("T")!=-1){
strPart = strTimeString.split("[T]");
}
else
else{
strPart = strTimeString.split(" ");
}
if (strPart.length == 2) {
// 两个部分
String strDate = "";
......@@ -589,6 +615,4 @@ public class DataObject {
return new Timestamp(cl.getTime().getTime());
}
}
......@@ -46,14 +46,14 @@ public class PermissionSyncJob implements ApplicationRunner {
public void run(ApplicationArguments args) {
try {
Thread.sleep(10000);
InputStream permission= this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力
InputStream permission = this.getClass().getResourceAsStream("/permission/systemResource.json"); //获取当前系统所有实体资源能力
String permissionResult = IOUtils.toString(permission,"UTF-8");
JSONObject system= new JSONObject();
system.put("pssystemid",systemId);
system.put("pssystemname",systemName);
system.put("sysstructure",JSONObject.parseObject(permissionResult));
system.put("md5check",DigestUtils.md5DigestAsHex(permissionResult.getBytes()));
if(client.syncSysAuthority(system)){
if(client.syncSysAuthority(system)) {
log.info("向[UAA]同步系统资源成功");
}else{
log.error("向[UAA]同步系统资源失败");
......@@ -64,9 +64,9 @@ public class PermissionSyncJob implements ApplicationRunner {
}
try {
InputStream sysModel= this.getClass().getResourceAsStream("/sysmodel/ibznotify.json"); //获取当前系统所有实体资源能力
InputStream sysModel = this.getClass().getResourceAsStream("/sysmodel/ibznotify.json"); //获取当前系统所有实体资源能力
String strSysModel = IOUtils.toString(sysModel,"UTF-8");
if(liteFeignClient.syncSysModel(JSONObject.parseObject(strSysModel))){
if(liteFeignClient.syncSysModel(JSONObject.parseObject(strSysModel))) {
log.info("向[lite]同步系统模型成功");
}else{
log.error("向[lite]同步系统模型失败");
......
......@@ -42,10 +42,12 @@ public class AppController {
while(it.hasNext()) {
GrantedAuthority authority = (GrantedAuthority)it.next();
String strAuthority=authority.getAuthority();
if(strAuthority.startsWith("UNIRES_"+systemId))
if(strAuthority.startsWith("UNIRES_"+systemId)) {
uniRes.add(strAuthority.substring(systemId.length()+8));
else if(strAuthority.startsWith("APPMENU_"+systemId))
}
else if(strAuthority.startsWith("APPMENU_"+systemId)){
appMenu.add(strAuthority.substring(systemId.length()+9));
}
}
}
Map<String,Object> context = new HashMap<>();
......@@ -55,10 +57,12 @@ public class AppController {
appData.put("unires",uniRes);
appData.put("appmenu",appMenu);
appData.put("enablepermissionvalid",enablePermissionValid);
if(curUser.getSuperuser()==1)
if(curUser.getSuperuser()==1){
appData.put("enablepermissionvalid",false);
else
}
else{
appData.put("enablepermissionvalid",enablePermissionValid);
}
fillAppData(appData);
return ResponseEntity.status(HttpStatus.OK).body(appData);
}
......@@ -76,16 +80,18 @@ public class AppController {
@RequestMapping(method = RequestMethod.PUT, value = "/configs/{configType}/{targetType}")
public ResponseEntity<Boolean> saveConfig(@PathVariable("configType") String configType, @PathVariable("targetType") String targetType, @RequestBody JSONObject config) {
String userId=AuthenticationUser.getAuthenticationUser().getUserid();
if(StringUtils.isEmpty(userId))
if(StringUtils.isEmpty(userId)){
throw new BadRequestAlertException("保存配置失败,参数缺失","IBZConfig",configType);
}
return ResponseEntity.ok(ibzConfigService.saveConfig(configType,targetType,userId,config));
}
@RequestMapping(method = RequestMethod.GET, value = "/configs/{configType}/{targetType}")
public ResponseEntity<JSONObject> getConfig(@PathVariable("configType") String configType, @PathVariable("targetType") String targetType) {
String userId=AuthenticationUser.getAuthenticationUser().getUserid();
if(StringUtils.isEmpty(userId))
if(StringUtils.isEmpty(userId)){
throw new BadRequestAlertException("获取配置失败,参数缺失","IBZConfig",configType);
}
return ResponseEntity.ok(ibzConfigService.getConfig(configType,targetType,userId));
}
......
......@@ -56,5 +56,5 @@ public class AuthenticationController
authuserdetail= userDetailsService.loadUserByUsername(userDetails.getUsername());
}
return ResponseEntity.ok().body(authuserdetail);
}
}
}
......@@ -38,18 +38,22 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
@Override
@SneakyThrows
public boolean hasPermission(Authentication authentication, Object entity, Object action) {
if(!enablePermissionValid)
if(!enablePermissionValid){
return true;
}
Object principal = authentication.getPrincipal();
if(ObjectUtils.isEmpty(principal))
if(ObjectUtils.isEmpty(principal)){
return false;
}
AuthenticationUser authenticationUser= (AuthenticationUser) authentication.getPrincipal();
if(authenticationUser.getSuperuser()==1)
if(authenticationUser.getSuperuser()==1){
return true;
}
String strAction=String.valueOf(action);
Set<String> userAuthorities = getAuthorities(authentication,strAction);
if(userAuthorities.size()==0)
if(userAuthorities.size()==0){
return false;
}
if(isAllData(strAction,userAuthorities)){
return true;
}
......@@ -102,8 +106,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
*/
@SneakyThrows
private void setPermissionCondToSearchContext(EntityBase entity, QueryWrapperContext qc , Set<String> userAuthorities ,AuthenticationUser authenticationUser){
if(entity==null)
if(entity==null){
return ;
}
Map<String,String> permissionField=getPermissionField(entity);//获取组织、部门预置属性
String orgField=permissionField.get("orgfield");
String orgDeptField=permissionField.get("orgsecfield");
......@@ -185,8 +190,9 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
Iterator it = authorities.iterator();
while(it.hasNext()) {
GrantedAuthority authority = (GrantedAuthority)it.next();
if(authority.getAuthority().contains(action))
if(authority.getAuthority().contains(action)){
userAuthorities.add(authority.getAuthority());
}
}
return userAuthorities;
}
......@@ -253,23 +259,27 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
}
if(action.endsWith("Create") || action.endsWith("Save")){
if(!ObjectUtils.isEmpty(orgFieldValue) && !userOrg.contains(orgFieldValue))
if(!ObjectUtils.isEmpty(orgFieldValue) && !userOrg.contains(orgFieldValue)){
return false;
if(!ObjectUtils.isEmpty(orgDeptFieldValue) && !userOrgDept.contains(orgDeptFieldValue))
}
if(!ObjectUtils.isEmpty(orgDeptFieldValue) && !userOrgDept.contains(orgDeptFieldValue)){
return false;
if(!ObjectUtils.isEmpty(crateManFieldValue) && !authenticationUser.getUserid().equals(crateManFieldValue))
}
if(!ObjectUtils.isEmpty(crateManFieldValue) && !authenticationUser.getUserid().equals(crateManFieldValue)){
return false;
}
return true;
}
else{
if(!ObjectUtils.isEmpty(orgFieldValue) && userOrg.contains(orgFieldValue))
if(!ObjectUtils.isEmpty(orgFieldValue) && userOrg.contains(orgFieldValue)){
return true;
if(!ObjectUtils.isEmpty(orgDeptFieldValue) && userOrgDept.contains(orgDeptFieldValue))
}
if(!ObjectUtils.isEmpty(orgDeptFieldValue) && userOrgDept.contains(orgDeptFieldValue)){
return true;
if(!ObjectUtils.isEmpty(crateManFieldValue) && authenticationUser.getUserid().equals(crateManFieldValue))
}
if(!ObjectUtils.isEmpty(crateManFieldValue) && authenticationUser.getUserid().equals(crateManFieldValue)){
return true;
}
return false;
}
}
......@@ -293,12 +303,18 @@ public class AuthPermissionEvaluator implements PermissionEvaluator {
String fieldName=entry.getKey();//获取注解字段
DEField fieldAnnotation=entry.getValue();//获取注解值
DEPredefinedFieldType prefieldType=fieldAnnotation.preType();
if(prefieldType==prefieldType.ORGID)//用户配置系统预置属性-组织机构标识
//用户配置系统预置属性-组织机构标识
if(prefieldType==prefieldType.ORGID){
orgField=fieldName;
if(prefieldType==prefieldType.ORGSECTORID)//用户配置系统预置属性-部门标识
}
//用户配置系统预置属性-部门标识
if(prefieldType==prefieldType.ORGSECTORID){
orgDeptField=fieldName;
if(prefieldType==prefieldType.CREATEMAN)//用户配置系统预置属性-部门标识
}
//用户配置系统预置属性-部门标识
if(prefieldType==prefieldType.CREATEMAN){
createManField=fieldName;
}
}
permissionFiled.put("orgfield",orgField);
permissionFiled.put("orgsecfield",orgDeptField);
......
......@@ -260,10 +260,12 @@ public class AuthenticationUser implements UserDetails
return this.sessionParams;
}
private Map<String, Object> getUserSessionParam() {
if(userSessionParam!=null)
if(userSessionParam!=null){
return userSessionParam;
else
}
else{
return new HashMap<>();
}
}
public void setOrgInfo(Map<String, Set<String>> orgInfo) {
......
......@@ -29,8 +29,9 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@Cacheable( value="ibzrt_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public JSONObject getConfig(String cfgType,String targetType,String userId)
{
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType))
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){
throw new BadRequestAlertException("获取配置失败,参数缺失","IBZConfig",cfgType);
}
IBZConfig config=this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()),false);
if(config==null) {
config=this.getOne(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(adminuserid).build()),false);
......@@ -44,19 +45,22 @@ public class IBZConfigService extends ServiceImpl<IBZConfigMapper, IBZConfig> im
@CacheEvict( value="ibzrt_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public boolean saveConfig(String cfgType,String targetType,String userId,JSONObject config)
{
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType))
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){
throw new BadRequestAlertException("保存配置失败,参数缺失","IBZConfig",cfgType);
}
String cfg="{}";
if(config!=null)
if(config!=null){
cfg=JSONObject.toJSONString(config);
}
return this.saveOrUpdate(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).cfg(cfg).updateDate(DataObject.getNow()).build());
}
@CacheEvict( value="ibzrt_configs",key = "'cfgid:'+#p0+'||'+#p1+'||'+#p2")
public void resetConfig(String cfgType,String targetType,String userId)
{
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType))
if(StringUtils.isEmpty(userId)||StringUtils.isEmpty(cfgType)||StringUtils.isEmpty(targetType)){
throw new BadRequestAlertException("重置配置失败,参数缺失","IBZConfig",cfgType);
}
this.remove(Wrappers.query(IBZConfig.builder().systemId(systemId).cfgType(cfgType).targetType(targetType).userId(userId).build()));
}
......
......@@ -26,10 +26,10 @@ public class IBZUAAUserService implements AuthenticationUserService{
@Override
public AuthenticationUser loadUserByUsername(String username) {
AuthenticationUser user=uaaFeignClient.loginByUsername(username);
if(user==null)
if(user==null){
throw new BadRequestAlertException("登录失败","IBZUAAUser",username);
}
return user;
}
......@@ -48,8 +48,9 @@ public class IBZUAAUserService implements AuthenticationUserService{
logininfo.setLoginname(loginname);
logininfo.setPassword(password);
AuthenticationUser user=uaaFeignClient.login(logininfo);
if(user==null)
if(user==null){
throw new BadRequestAlertException("登录失败","IBZUAAUser",username);
}
return user;
}
......
......@@ -34,14 +34,18 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
String[] data=username.split("[|]");
String loginname="";
String domains="";
if(data.length>0)
if(data.length>0){
loginname=data[0].trim();
if(data.length>1)
}
if(data.length>1){
domains=data[1].trim();
if(!StringUtils.isEmpty(loginname))
}
if(!StringUtils.isEmpty(loginname)){
conds.eq("loginname",loginname);
if(!StringUtils.isEmpty(domains))
}
if(!StringUtils.isEmpty(domains)){
conds.eq("domains",domains);
}
IBZUSER user = this.getOne(conds);
if (user == null) {
throw new UsernameNotFoundException("用户" + username + "未找到");
......@@ -55,10 +59,12 @@ public class IBZUSERServiceImpl extends ServiceImpl<IBZUSERMapper, IBZUSER> impl
@Override
public AuthenticationUser loadUserByLogin(String username, String password){
AuthenticationUser authuserdetail = loadUserByUsername(username);
if(pwencrymode==1)
if(pwencrymode==1){
password = DigestUtils.md5DigestAsHex(password.getBytes());
else if(pwencrymode==2)
}
else if(pwencrymode==2){
password = DigestUtils.md5DigestAsHex(String.format("%1$s||%2$s", username, password).getBytes());
}
if(!authuserdetail.getPassword().equals( password )){
throw new BadRequestAlertException("用户名密码错误","IBZUSER",username);
}
......
......@@ -23,20 +23,21 @@ public class SimpleFileService implements FileService {
@Override
public FileItem saveFile(MultipartFile multipartFile) {
FileItem item=null;
FileItem item = null;
// 获取文件名
String fileName = multipartFile.getOriginalFilename();
// 获取文件后缀
String extname="."+getExtensionName(fileName);
String extname ="."+getExtensionName(fileName);
try {
String fileid= DigestUtils.md5DigestAsHex(multipartFile.getInputStream());
String fileid = DigestUtils.md5DigestAsHex(multipartFile.getInputStream());
String fileFullPath = this.fileRoot+"ibizutil"+File.separator+fileid+File.separator+fileName;
File file = new File(fileFullPath);
File parent = new File(file.getParent());
if(!parent.exists())
if(!parent.exists()) {
parent.mkdirs();
FileCopyUtils.copy(multipartFile.getInputStream(),Files.newOutputStream(file.toPath()));
item=new FileItem(fileid,fileName,fileid,fileName,(int)multipartFile.getSize(),extname);
}
FileCopyUtils.copy(multipartFile.getInputStream(), Files.newOutputStream(file.toPath()));
item = new FileItem(fileid, fileName, fileid, fileName, (int)multipartFile.getSize(), extname);
} catch (IOException e) {
throw new InternalServerErrorException("文件上传失败,"+e);
}
......
......@@ -29,8 +29,9 @@ public class FeignRequestInterceptor implements RequestInterceptor {
if (headerNames != null) {
while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement();
if(name.equalsIgnoreCase("transfer-encoding"))
if(name.equalsIgnoreCase("transfer-encoding")){
continue;
}
String values = request.getHeader(name);
requestTemplate.header(name, values);
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册