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

ibiz4j 发布系统代码

上级 2d744c00
......@@ -12,6 +12,7 @@ import { authServiceRegister } from '@/authservice/auth-service-register';
import { utilServiceRegister } from '@/utilservice/util-service-register';
import { entityServiceRegister } from '@/service/entity-service-register';
import { counterServiceRegister } from '@/counter/counter-service-register';
import { codeListRegister } from '@codelist/codelist-register';
import InputBox from './components/input-box/input-box.vue'
import AppKeepAlive from './components/app-keep-alive/app-keep-alive.vue'
......@@ -38,6 +39,7 @@ import AppFormGroup from './components/app-form-group/app-form-group.vue'
import AppFormItem from './components/app-form-item/app-form-item.vue'
import AppPicker from './components/app-picker/app-picker.vue'
import AppMpicker from './components/app-mpicker/app-mpicker.vue'
import AppUpicker from './components/app-upicker/app-upicker.vue'
import AppFormGroup2 from './components/app-form-group2/app-form-group2.vue'
import AppFormItem2 from './components/app-form-item2/app-form-item2.vue'
import CodeList from './components/codelist/codelist.vue'
......@@ -89,6 +91,8 @@ window['utilServiceRegister'] = utilServiceRegister;
window['entityServiceRegister'] = entityServiceRegister;
// 全局挂载计数器服务注册中心
window['counterServiceRegister'] = counterServiceRegister;
// 全局挂载代码表服务注册中心
window['codeListRegister'] = codeListRegister;
export const AppComponents = {
install(v: any, opt: any) {
......@@ -127,6 +131,7 @@ export const AppComponents = {
v.component('app-form-item',AppFormItem);
v.component('app-picker', AppPicker);
v.component('app-mpicker', AppMpicker);
v.component('app-upicker', AppUpicker);
v.component('app-form-group2', AppFormGroup2);
v.component('app-form-item2', AppFormItem2);
v.component('codelist', CodeList);
......
/**
* 代码表服务注册中心
*
* @export
* @class CodeListRegister
*/
export class CodeListRegister {
/**
* 所有实体数据服务Map
*
* @protected
* @type {*}
* @memberof CodeListRegister
*/
protected allCodeList: Map<string, () => Promise<any>> = new Map();
/**
* 已加载实体数据服务Map缓存
*
* @protected
* @type {Map<string, any>}
* @memberof CodeListRegister
*/
protected serviceCache: Map<string, any> = new Map();
/**
* Creates an instance of CodeListRegister.
* @memberof CodeListRegister
*/
constructor() {
this.init();
}
/**
* 初始化
*
* @protected
* @memberof CodeListRegister
*/
protected init(): void {
}
/**
* 加载实体数据服务
*
* @protected
* @param {string} serviceName
* @returns {Promise<any>}
* @memberof CodeListRegister
*/
protected async loadService(serviceName: string): Promise<any> {
const service = this.allCodeList.get(serviceName);
if (service) {
return service();
}
}
/**
* 获取应用实体数据服务
*
* @param {string} name
* @returns {Promise<any>}
* @memberof CodeListRegister
*/
public async getService(name: string): Promise<any> {
if (this.serviceCache.has(name)) {
return this.serviceCache.get(name);
}
const CodeList: any = await this.loadService(name);
if (CodeList && CodeList.default) {
const instance: any = new CodeList.default();
this.serviceCache.set(name, instance);
return instance;
}
}
}
export const codeListRegister: CodeListRegister = new CodeListRegister();
\ No newline at end of file
......@@ -6,6 +6,7 @@
<script lang="ts">
import { Vue, Component, Watch, Prop, Model } from 'vue-property-decorator';
import CodeListService from '@/service/app/codelist-service';
@Component({
})
export default class AppDepartmentSelect extends Vue {
......@@ -18,6 +19,20 @@ export default class AppDepartmentSelect extends Vue {
*/
@Prop() public url?: any;
/**
* 代码表标识
*
* @memberof AppDepartmentSelect
*/
@Prop() public tag?:string;
/**
* 代码表类型
*
* @memberof AppDepartmentSelect
*/
@Prop() public codelistType?:string;
/**
* 过滤项
*
......@@ -121,14 +136,14 @@ export default class AppDepartmentSelect extends Vue {
}
this.oldurl = _url;
// 缓存机制
const result:any = this.$store.getters.getCopyData(_url);
const result:any = this.$store.getters.getDepData(this.filter);
if(result){
this.Nodesdata = result;
return;
}
this.$http.get(_url).then((response: any) => {
this.Nodesdata = response.data;
this.$store.commit('addDepData', { srfkey: this.filter, orgData: response.data });
this.$store.commit('addDepData', { srfkey: this.filter, depData: response.data });
}).catch((response: any) => {
if (!response || !response.status || !response.data) {
this.$Notice.error({ title: (this.$t('app.commonWords.error') as string), desc: (this.$t('app.commonWords.sysException') as string) });
......@@ -163,13 +178,19 @@ export default class AppDepartmentSelect extends Vue {
// 单选
if(!this.multiple){
if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
let templateValue:any = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
if(!templateValue.label && templateValue.id && this.tag && this.codelistType && Object.is(this.codelistType,"DYNAMIC")){
this.fillLabel(templateValue,templateValue.id,(templateValue:any) =>{
this.selectTreeValue = JSON.stringify([templateValue]);
});
}else{
this.selectTreeValue = JSON.stringify([templateValue]);
}
}
}else{
// 多选
......@@ -188,8 +209,30 @@ export default class AppDepartmentSelect extends Vue {
})
}
})
this.selectTreeValue = JSON.stringify(tempArray);
let tempflag:boolean = false;
if(tempArray.length >0 && tempArray.length >0){
tempArray.forEach((item:any) =>{
if(!item.label) tempflag = true;
})
}
if(tempflag && this.tag && this.codelistType && Object.is(this.codelistType,"DYNAMIC")){
let tempStatus:number = 0;
tempArray.forEach((item:any) =>{
if(!item.label){
tempStatus += 1;
this.fillLabel(item,item.id,(result:any) =>{
item = result;
tempStatus -= 1;
if(tempStatus === 0){
this.selectTreeValue = JSON.stringify(tempArray);
}
})
}
})
}else{
this.selectTreeValue = JSON.stringify(tempArray);
}
}
}
}
......@@ -208,10 +251,35 @@ export default class AppDepartmentSelect extends Vue {
let _name = this.fillMap[attribute];
let values = selectArr.map((item:any) => item[attribute]);
let _value = $event === "[]" ? null : values.join(",");
this.$emit('select-change',{name: this.fillMap[attribute], value: _value})
setTimeout(() => {
this.$emit('select-change',{name: this.fillMap[attribute], value: _value});
},0);
});
}
}
/**
* 填充label
*
* @memberof AppOrgSelect
*/
public fillLabel(tempObject:any,valueItem:any,callback:any){
if(!tempObject.label && tempObject.id && this.tag && this.codelistType && Object.is(this.codelistType,"DYNAMIC")){
let codeListService:CodeListService = new CodeListService();
codeListService.getItems(this.tag).then((items:any) =>{
if(items && items.length >0){
let result:any = items.find((item:any) =>{
return item.id === valueItem;
})
Object.assign(tempObject,{label:result.label});
}
callback(tempObject);
}).catch((error:any) =>{
console.log(error);
})
}
}
}
</script>
......
......@@ -6,6 +6,8 @@
<script lang = 'ts'>
import { Vue, Component, Prop, Watch } from "vue-property-decorator";
import { Http } from '@/utils';
import CodeListService from "@service/app/codelist-service";
import { observable } from 'rxjs';
@Component({})
export default class AppOrgSelect extends Vue {
......@@ -37,6 +39,20 @@ export default class AppOrgSelect extends Vue {
*/
@Prop() public filter?:string;
/**
* 代码表标识
*
* @memberof AppOrgSelect
*/
@Prop() public tag?:string;
/**
* 代码表类型
*
* @memberof AppOrgSelect
*/
@Prop() public codelistType?:string;
/**
* 是否多选
*
......@@ -138,13 +154,19 @@ export default class AppOrgSelect extends Vue {
// 单选
if(!this.multiple){
if(this.fillMap && Object.keys(this.fillMap).length >0){
let templateValue = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
let templateValue:any = {};
Object.keys(this.fillMap).forEach((item:any) =>{
if(this.data && this.data[this.fillMap[item]]){
Object.assign(templateValue,{[item]:this.data[this.fillMap[item]]});
}
})
if(!templateValue.label && templateValue.id && this.tag && this.codelistType && Object.is(this.codelistType,"DYNAMIC")){
this.fillLabel(templateValue,templateValue.id,(templateValue:any) =>{
this.selectTreeValue = JSON.stringify([templateValue]);
});
}else{
this.selectTreeValue = JSON.stringify([templateValue]);
}
})
this.selectTreeValue = JSON.stringify([templateValue]);
}
}else{
// 多选
......@@ -163,8 +185,30 @@ export default class AppOrgSelect extends Vue {
})
}
})
this.selectTreeValue = JSON.stringify(tempArray);
let tempflag:boolean = false;
if(tempArray.length >0 && tempArray.length >0){
tempArray.forEach((item:any) =>{
if(!item.label) tempflag = true;
})
}
if(tempflag && this.tag && this.codelistType && Object.is(this.codelistType,"DYNAMIC")){
let tempStatus:number = 0;
tempArray.forEach((item:any) =>{
if(!item.label){
tempStatus += 1;
this.fillLabel(item,item.id,(result:any) =>{
item = result;
tempStatus -= 1;
if(tempStatus === 0){
this.selectTreeValue = JSON.stringify(tempArray);
}
})
}
})
}else{
this.selectTreeValue = JSON.stringify(tempArray);
}
}
}
}
......@@ -175,7 +219,7 @@ export default class AppOrgSelect extends Vue {
*/
public loadTreeData(requestUrl:string){
if(this.filter){
const result:any = this.$store.getters.getCopyData(this.filter);
const result:any = this.$store.getters.getOrgData(this.filter);
if(result){
this.NodesData = result;
return;
......@@ -209,7 +253,9 @@ export default class AppOrgSelect extends Vue {
tempValue.forEach((value:any,index:number) =>{
tempResult += index>0?`,${value[item]}`:`${value[item]}`;
})
this.emitValue(this.fillMap[item],tempResult);
setTimeout(() => {
this.emitValue(this.fillMap[item],tempResult);
}, 0);
})
}
}else{
......@@ -225,7 +271,9 @@ export default class AppOrgSelect extends Vue {
const tempValue:any = JSON.parse($event)[0];
if(this.fillMap && Object.keys(this.fillMap).length >0){
Object.keys(this.fillMap).forEach((item:any) =>{
this.emitValue(this.fillMap[item],tempValue[item]);
setTimeout(() => {
this.emitValue(this.fillMap[item],tempValue[item]);
}, 0);
})
}
}else{
......@@ -247,6 +295,28 @@ export default class AppOrgSelect extends Vue {
this.$emit('select-change',{name:name,value:value});
}
/**
* 填充label
*
* @memberof AppOrgSelect
*/
public fillLabel(tempObject:any,valueItem:any,callback:any){
if(!tempObject.label && tempObject.id && this.tag && this.codelistType && Object.is(this.codelistType,"DYNAMIC")){
let codeListService:CodeListService = new CodeListService();
codeListService.getItems(this.tag).then((items:any) =>{
if(items && items.length >0){
let result:any = items.find((item:any) =>{
return item.id === valueItem;
})
Object.assign(tempObject,{label:result.label});
}
callback(tempObject);
}).catch((error:any) =>{
console.log(error);
})
}
}
}
</script>
......
.app-picker {
width: 100%;
.el-select {
.el-input__suffix {
right: 20px;
}
}
.text-value {
.el-icon-circle-close {
display: none;
}
}
.text-value:hover {
.el-icon-circle-close {
display: inline-block;
}
}
.ivu-icon-ios-open-outline {
margin-top: -2px;
margin-left: 5px;
font-size: 15px;
}
}
\ No newline at end of file
<template>
<el-select style="width: 100%;" size='small' @change="onSelect" v-model="value" :disabled="disabled" @visible-change="onSelectOpen">
<el-option v-for="(item, index) in items" :key="index" :label="item.label" :value="item.value"></el-option>
</el-select>
</template>
<script lang="ts">
import { Component, Vue, Prop, Model, Watch } from "vue-property-decorator";
import { Subject } from "rxjs";
import { AppModal } from "@/utils";
@Component({})
export default class AppPicker extends Vue {
/**
* 表单数据
*
* @type {*}
* @memberof AppPicker
*/
@Prop() public data!: any;
/**
* 属性项名称
*
* @type {string}
* @memberof AppPicker
*/
@Prop() public name!: string;
/**
* 视图上下文
*
* @type {*}
* @memberof AppFormDRUIPart
*/
@Prop() public context!: any;
/**
* 编辑器禁用
*
* @type {boolean}
* @memberof AppUpicker
*/
@Prop() disabled?: boolean;
/**
* 视图参数
*
* @type {*}
* @memberof SelectFormBase
*/
@Prop() public viewparams: any;
/**
* 请求参数和请求数据的映射关系
*
* @type {*}
* @memberof AppUpicker
*/
public interaction:any = {};
/**
* 当前表单项绑定的值
*
* @type {string}
* @memberof AppUpicker
*/
public value: string = "";
/**
* 编辑器参数
*
* @type {*}
* @memberof AppUpicker
*/
@Prop() public itemParams?: any;
/**
* 编辑器参数
*
* @type {string}
* @memberof AppUpicker
*/
@Prop() public valueItem?: string;
/**
* 列表项请求路径
*
* @type {string}
* @memberof AppUpicker
*/
public url: string = '';
/**
* 下拉数组
* @type {any[]}
* @memberof AppPicker
*/
public items: any[] = [];
/**
* 请求到的数据
* @type {any[]}
* @memberof AppPicker
*/
public itemList: any[] = [{a:1,b:"zhangsan"},{a:2,b:"lisi"},{a:3,b:"wangwu"}]
/**
* vue 生命周期
*
* @memberof AppPicker
*/
public mounted() {
// 解析编辑器参数
this.analysis(this.itemParams);
// 请求下拉数据
this.fectchItemList(this.url);
}
/**
* 下拉重新加载数据
*
* @memberof AppPicker
*/
public onSelectOpen() {
this.fectchItemList(this.url);
}
/**
* 解析编辑器参数
* @param {*} itemparams
* @memberof AppPicker
*/
public analysis(itemparams:any) {
Object.keys(itemparams).forEach((param)=>{
if(param==='path'){
this.url = itemparams[param]
}else{
this.interaction[param] = itemparams[param]
}
})
}
/**
* 请求下拉列表数据
* @param {string} url
* @memberof AppPicker
*/
public fectchItemList(url:string) {
this.$http
.get(url)
.then((response: any) => {
if (response && response.status==200 && response.data) {
this.itemList = response.data;
// 提取需要的值(value,label)
this.extractItem(this.itemList,this.items);
}
})
.catch((response: any) => {
if (!response || !response.status || !response.data) {
this.$Notice.error({
title: this.$t("app.commonWords.error") as string,
desc: this.$t("app.commonWords.sysException") as string,
});
return;
}
});
}
/**
* 解析下拉列表数据
* @param {any[]} itemList 请求到的数据
* @param {any[]} items 下拉数组
* @memberof AppPicker
*/
public extractItem(itemList:any[],items:any[]) {
this.items.length = 0;
itemList.forEach((item) => {
items.push({
label: item[this.interaction.label],
value: item[this.interaction.value],
});
});
}
public onSelect(val: string) {
let index = this.items.findIndex((item) => Object.is(item.value, val));
if (index >= 0) {
this.onACSelect(this.items[index]);
}
}
/**
* 选中数据回调
* @param item
*/
public onACSelect(item: any): void {
if(this.name){
this.$emit('formitemvaluechange', { name: this.name, value: item.value });
}
if(this.valueItem){
this.$emit('formitemvaluechange', { name: this.valueItem, value: item.value });
}
}
}
</script>
<style lang="less">
@import './app-upicker.less';
</style>
......@@ -3,13 +3,14 @@ import { AuthServiceRegister } from '@/authservice/auth-service-register';
import { UtilServiceRegister } from '@/utilservice/util-service-register';
import { EntityServiceRegister } from '@/service/entity-service-register';
import { CounterServiceRegister } from '@/counter/counter-service-register';
import { CodeListRegister } from '@codelist/codelist-register';
declare global {
interface Window {
uiServiceRegister: UIServiceRegister,
authServiceRegister: AuthServiceRegister,
utilServiceRegister: UtilServiceRegister,
entityServiceRegister: EntityServiceRegister,
counterServiceRegister: CounterServiceRegister
counterServiceRegister: CounterServiceRegister,
codeListRegister:CodeListRegister
}
}
\ No newline at end of file
import { Store } from 'vuex';
import { Http } from '@/utils';
import CodeListService from "@service/app/codelist-service";
......@@ -10,15 +9,6 @@ import CodeListService from "@service/app/codelist-service";
*/
export default class EntityService {
/**
* Vue 状态管理器
*
* @private
* @type {(any | null)}
* @memberof EntityService
*/
private $store: Store<any> | null = null;
/**
* 获取实体数据服务
*
......@@ -101,21 +91,10 @@ export default class EntityService {
* @memberof EntityService
*/
constructor(opts: any = {}) {
this.$store = opts.$store;
this.tempStorage = localStorage;
this.initBasicData();
}
/**
* 获取状态管理器
*
* @returns {(any | null)}
* @memberof EntityService
*/
public getStore(): Store<any> | null {
return this.$store;
}
/**
* 获取代码表
*
......@@ -123,22 +102,16 @@ export default class EntityService {
*/
public getCodeList(tag:string,codelistType:string,context:any = {},param:any ={}){
return new Promise((resolve:any,reject:any) =>{
let codeListService = new CodeListService();
if(tag && Object.is(codelistType,"STATIC")){
let returnItems:Array<any> = [];
const codelist = (this.getStore() as Store<any>).getters.getCodeList(tag);
if (codelist) {
returnItems = [...JSON.parse(JSON.stringify(codelist.items))];
} else {
console.log(`----${tag}----代码表不存在`);
}
resolve(returnItems);
codeListService.getStaticItems(tag).then((items:any) =>{
resolve(items);
})
}else if(tag && Object.is(codelistType,"DYNAMIC")){
let codeListService = new CodeListService({ $store: this.$store });
codeListService.getItems(tag,context,param).then((res:any) => {
resolve(res);
}).catch((error:any) => {
reject(`${tag}代码表不存在`);
console.log(`----${tag}----代码表不存在`);
});
}
})
......@@ -988,4 +961,15 @@ export default class EntityService {
return Http.getInstance().post(`/v7/changepwd`,data,isloading);
}
/**
* 获取数字字典
*
* @param tag
* @param data
* @param isloading
*/
public async getPredefinedCodelist(tag:string,data: any = {}, isloading?: boolean): Promise<any> {
return Http.getInstance().get(`/dictionarys/codelist/${tag}`,data,isloading);
}
}
\ No newline at end of file
......@@ -37,11 +37,6 @@
git clone -b master $para2 ibzwf/
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzwf/
mvn clean package -Papi
cd ibzwf-provider/ibzwf-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzwf-provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</hudson.tasks.Shell>
</builders>
......
......@@ -13,6 +13,8 @@ import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
......@@ -30,6 +32,9 @@ import java.util.List;
})
public class webApplication extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(webApplication.class,args);
}
......@@ -37,6 +42,6 @@ public class webApplication extends WebMvcConfigurerAdapter{
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver());
argumentResolvers.add(resolver);
}
}
......@@ -52,9 +52,13 @@ zuul:
serviceId: ${ibiz.ref.service.ou:ibzou-api}
stripPrefix: false
oudict:
path: /dictionarys/**/ibzou**
path: /dictionarys/**/Ibzou**
serviceId: ${ibiz.ref.service.ou:ibzou-api}
stripPrefix: false
uaadict:
path: /dictionarys/**/SysOperator
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
dict:
path: /dictionarys/**
serviceId: ${ibiz.ref.service.dict:ibzdict-api}
......
......@@ -14,6 +14,8 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.util.List;
import cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
@Slf4j
@EnableDiscoveryClient
......@@ -34,6 +36,9 @@ import java.util.List;
@EnableScheduling
public class DevBootApplication extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(DevBootApplication.class,args);
}
......@@ -41,6 +46,6 @@ public class DevBootApplication extends WebMvcConfigurerAdapter{
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver());
argumentResolvers.add(resolver);
}
}
......@@ -25,9 +25,13 @@ zuul:
serviceId: ${ibiz.ref.service.ou:ibzou-api}
stripPrefix: false
oudict:
path: /dictionarys/**/ibzou**
path: /dictionarys/**/Ibzou**
serviceId: ${ibiz.ref.service.ou:ibzou-api}
stripPrefix: false
uaadict:
path: /dictionarys/**/SysOperator
serviceId: ${ibiz.ref.service.uaa:ibzuaa-api}
stripPrefix: false
dict:
path: /dictionarys/**
serviceId: ${ibiz.ref.service.dict:ibzdict-api}
......
......@@ -12,6 +12,6 @@ CMD echo "The application will start in ${IBIZ_SLEEP}s..." && \
sleep ${IBIZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzwf-provider-api.jar
EXPOSE 40003
EXPOSE 8081
ADD ibzwf-provider-api.jar /ibzwf-provider-api.jar
......@@ -3,22 +3,9 @@ services:
ibzwf-provider-api:
image: registry.cn-shanghai.aliyuncs.com/ibizsys/ibzwf-provider-api:latest
ports:
- "40003:40003"
- "8081:8081"
networks:
- agent_network
environment:
- SPRING_CLOUD_NACOS_DISCOVERY_IP=172.16.180.237
- SERVER_PORT=40003
- SPRING_CLOUD_NACOS_DISCOVERY_SERVER-ADDR=172.16.102.211:8848
- SPRING_REDIS_HOST=172.16.100.243
- SPRING_REDIS_PORT=6379
- SPRING_REDIS_DATABASE=0
- SPRING_DATASOURCE_USERNAME=a_A_5d9d78509
- SPRING_DATASOURCE_PASSWORD=@6dEfb3@
- SPRING_DATASOURCE_URL=jdbc:mysql://172.16.180.232:3306/a_A_5d9d78509?autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&useOldAliasMetadataBehavior=true&allowMultiQueries=true
- SPRING_DATASOURCE_DRIVER-CLASS-NAME=com.mysql.jdbc.Driver
- SPRING_DATASOURCE_DEFAULTSCHEMA=a_A_5d9d78509
- NACOS=172.16.102.211:8848
deploy:
resources:
limits:
......
......@@ -15,6 +15,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
......@@ -40,6 +42,9 @@ import java.util.List;
@EnableScheduling
public class ibzwfapiApplication extends WebMvcConfigurerAdapter{
@Autowired
SearchContextHandlerMethodArgumentResolver resolver;
public static void main(String[] args) {
SpringApplication.run(ibzwfapiApplication.class, args);
}
......@@ -47,6 +52,6 @@ public class ibzwfapiApplication extends WebMvcConfigurerAdapter{
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
super.addArgumentResolvers(argumentResolvers);
argumentResolvers.add(new cn.ibizlab.util.web.SearchContextHandlerMethodArgumentResolver());
argumentResolvers.add(resolver);
}
}
......@@ -10,10 +10,16 @@ import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.method.support.ModelAndViewContainer;
import java.util.LinkedHashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Slf4j
@Configuration
public class SearchContextHandlerMethodArgumentResolver implements HandlerMethodArgumentResolver {
@Value("${ibiz.pageLimit:1000}")
private int pageLimit=1000;
private static ObjectMapper objectMapper=new ObjectMapper();
@Override
......@@ -29,6 +35,9 @@ public class SearchContextHandlerMethodArgumentResolver implements HandlerMethod
for (String key : params.keySet()) {
set.put(key,params.get(key)[0]);
}
if((!set.containsKey("size")) ){
set.put("size",pageLimit);
}
String json=objectMapper.writeValueAsString(set);
return objectMapper.readValue(json,parameter.getParameterType());
}
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册