mirror of
https://github.com/getrebuild/rebuild.git
synced 2025-02-23 05:45:32 +08:00
package
This commit is contained in:
parent
fbe5b3f89d
commit
a9b4e68e7d
61 changed files with 525 additions and 169 deletions
34
pom.xml
34
pom.xml
|
@ -19,6 +19,7 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<argLine>-Dfile.encoding=UTF-8</argLine>
|
||||
<skipTests>true</skipTests>
|
||||
<spring.version>4.3.18.RELEASE</spring.version>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
|
@ -36,6 +37,12 @@
|
|||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.devezhao</groupId>
|
||||
<artifactId>persist4j</artifactId>
|
||||
|
@ -51,12 +58,6 @@
|
|||
<artifactId>bizz</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.11</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
|
@ -75,32 +76,32 @@
|
|||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>4.3.18.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context-support</artifactId>
|
||||
<version>4.3.18.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>4.3.18.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
<version>4.3.18.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>4.3.18.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-websocket</artifactId>
|
||||
<version>4.3.18.RELEASE</version>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
|
@ -128,10 +129,9 @@
|
|||
<version>7.2.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.stuxuhai</groupId>
|
||||
<artifactId>jpinyin</artifactId>
|
||||
<version>1.1.8</version>
|
||||
</dependency>
|
||||
|
||||
<groupId>com.github.stuxuhai</groupId>
|
||||
<artifactId>jpinyin</artifactId>
|
||||
<version>1.1.8</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
|
@ -26,10 +26,11 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
|||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import com.rebuild.server.bizz.privileges.UserStore;
|
||||
import com.rebuild.server.helper.AesPreferencesConfigurer;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.privileges.UserStore;
|
||||
import com.rebuild.server.query.QueryFactory;
|
||||
import com.rebuild.server.service.CommonService;
|
||||
import com.rebuild.server.service.QueryFactory;
|
||||
import com.rebuild.server.service.SqlExecutor;
|
||||
import com.rebuild.web.OnlineSessionStore;
|
||||
|
||||
|
@ -136,8 +137,8 @@ public class Application {
|
|||
/**
|
||||
* @return
|
||||
*/
|
||||
public static com.rebuild.server.privileges.SecurityManager getSecurityManager() {
|
||||
return getBean(com.rebuild.server.privileges.SecurityManager.class);
|
||||
public static com.rebuild.server.bizz.privileges.SecurityManager getSecurityManager() {
|
||||
return getBean(com.rebuild.server.bizz.privileges.SecurityManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.bizuser;
|
||||
package com.rebuild.server.bizz;
|
||||
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.service.BaseService;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.bizuser;
|
||||
package com.rebuild.server.bizz;
|
||||
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.service.BaseService;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.bizuser;
|
||||
package com.rebuild.server.bizz;
|
||||
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.privileges;
|
||||
package com.rebuild.server.bizz.privileges;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.security.Guard;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.privileges;
|
||||
package com.rebuild.server.bizz.privileges;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
|
@ -16,10 +16,10 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.privileges;
|
||||
package com.rebuild.server.bizz.privileges;
|
||||
|
||||
import com.rebuild.server.service.bizuser.RoleService;
|
||||
import com.rebuild.server.service.bizuser.UserService;
|
||||
import com.rebuild.server.bizz.RoleService;
|
||||
import com.rebuild.server.bizz.UserService;
|
||||
|
||||
import cn.devezhao.bizz.privileges.DepthEntry;
|
||||
import cn.devezhao.bizz.privileges.Permission;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.privileges;
|
||||
package com.rebuild.server.bizz.privileges;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.privileges;
|
||||
package com.rebuild.server.bizz.privileges;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import cn.devezhao.persist4j.dialect.FieldType;
|
||||
import cn.devezhao.persist4j.dialect.Type;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.commons.lang.math.RandomUtils;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.service.BaseService;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.service.BaseService;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.entitymanage;
|
||||
package com.rebuild.server.entityhub;
|
||||
|
||||
import cn.devezhao.persist4j.Field;
|
||||
import cn.devezhao.persist4j.metadata.impl.EntityImpl;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server;
|
||||
package com.rebuild.server.helper;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
@ -49,7 +49,11 @@ public class AesPreferencesConfigurer extends PreferencesPlaceholderConfigurer {
|
|||
propsHold = props;
|
||||
}
|
||||
|
||||
protected String getItem(String key) {
|
||||
/**
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public String getItem(String key) {
|
||||
return propsHold.getProperty(key);
|
||||
}
|
||||
}
|
97
src/main/java/com/rebuild/server/helper/HugeTask.java
Normal file
97
src/main/java/com/rebuild/server/helper/HugeTask.java
Normal file
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
rebuild - Building your system freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.helper;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
/**
|
||||
* 前台提交的耗时操作
|
||||
*
|
||||
* @author devezhao
|
||||
* @since 09/29/2018
|
||||
*/
|
||||
public abstract class HugeTask implements Runnable {
|
||||
|
||||
private int totalQuantity = -1;
|
||||
private int completeQuantity = 0;
|
||||
|
||||
/**
|
||||
* 任务执行相关数据
|
||||
*/
|
||||
protected JSON data;
|
||||
|
||||
/**
|
||||
* @param data
|
||||
*/
|
||||
protected HugeTask(JSON data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalQuantity
|
||||
*/
|
||||
protected void setTotalQuantity(int totalQuantity) {
|
||||
this.totalQuantity = totalQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param completeQuantity
|
||||
*/
|
||||
protected void setCompleteQuantity(int completeQuantity) {
|
||||
this.completeQuantity = completeQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getTotalQuantity() {
|
||||
return totalQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public int getCompleteQuantity() {
|
||||
return completeQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务完成率
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public double getCompletePercent() {
|
||||
if (totalQuantity == -1 || completeQuantity == 0) {
|
||||
return 0;
|
||||
}
|
||||
if (totalQuantity == completeQuantity) {
|
||||
return 1;
|
||||
}
|
||||
return completeQuantity / totalQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否完成?
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isCompleted() {
|
||||
return totalQuantity == -1 || totalQuantity == completeQuantity;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
/*
|
||||
rebuild - Building your system freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.helper;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.scheduling.quartz.QuartzJobBean;
|
||||
|
||||
import cn.devezhao.commons.CodecUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author devezhao
|
||||
* @since 09/29/2018
|
||||
*/
|
||||
public class HugeTaskExecutor extends QuartzJobBean {
|
||||
|
||||
private static final Map<String, HugeTask> TASKS = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* @param task
|
||||
* @return
|
||||
*/
|
||||
public static String submit(HugeTask task) {
|
||||
String taskid = task.getClass().getSimpleName() + "-" + CodecUtils.randomCode(20);
|
||||
TASKS.put(taskid, task);
|
||||
return taskid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskid
|
||||
* @return
|
||||
*/
|
||||
public static HugeTask getTask(String taskid) {
|
||||
return TASKS.get(taskid);
|
||||
}
|
||||
|
||||
// --
|
||||
|
||||
@Override
|
||||
protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
// TODO 任务完成 2 小时了,移除
|
||||
|
||||
}
|
||||
}
|
76
src/main/java/com/rebuild/server/helper/TimeHugeTask.java
Normal file
76
src/main/java/com/rebuild/server/helper/TimeHugeTask.java
Normal file
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
rebuild - Building your system freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.helper;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import cn.devezhao.commons.CalendarUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author devezhao
|
||||
* @since 09/29/2018
|
||||
*/
|
||||
public abstract class TimeHugeTask extends HugeTask {
|
||||
|
||||
private Date beginTime;
|
||||
private Date endTime;
|
||||
|
||||
/**
|
||||
* @param data
|
||||
*/
|
||||
protected TimeHugeTask(JSON data) {
|
||||
super(data);
|
||||
this.beginTime = CalendarUtils.now();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Date getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public Date getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param endTime
|
||||
*/
|
||||
protected void setEndTime(Date endTime) {
|
||||
this.endTime = endTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* 任务耗时(ms)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public long getElapsedTime() {
|
||||
Date end = getEndTime();
|
||||
end = end == null ? CalendarUtils.now() : end;
|
||||
return end.getTime() - beginTime.getTime();
|
||||
}
|
||||
}
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.base;
|
||||
package com.rebuild.server.helper.manager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -29,9 +29,9 @@ import org.apache.commons.logging.LogFactory;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
import cn.devezhao.persist4j.Field;
|
|
@ -16,16 +16,16 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.base;
|
||||
package com.rebuild.server.helper.manager;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.rebuild.server.entityhub.DisplayType;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.entitymanage.DisplayType;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
|
||||
import cn.devezhao.commons.CalendarUtils;
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
|
@ -49,6 +49,10 @@ public class FieldValueWrapper {
|
|||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
||||
if (field.getName().equalsIgnoreCase("password")) {
|
||||
return "******";
|
||||
}
|
||||
|
||||
DisplayType dt = field.getDisplayType();
|
||||
if (dt == DisplayType.DATE) {
|
||||
return wrapDate(value, field);
|
||||
|
@ -123,6 +127,13 @@ public class FieldValueWrapper {
|
|||
* @return
|
||||
*/
|
||||
public static Object wrapReference(Object reference, EasyMeta field) {
|
||||
|
||||
// TODO 名称字段
|
||||
|
||||
if (!(reference instanceof Object[])) {
|
||||
return reference.toString();
|
||||
}
|
||||
|
||||
Assert.isTrue(reference instanceof Object[], "Must be 'Object[]'");
|
||||
Object[] referenceValue = (Object[]) reference;
|
||||
Object[] idNamed = new Object[3];
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.base;
|
||||
package com.rebuild.server.helper.manager;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
@ -28,11 +28,11 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.bizz.privileges.User;
|
||||
import com.rebuild.server.entityhub.DisplayType;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.privileges.User;
|
||||
import com.rebuild.server.service.entitymanage.DisplayType;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
|
||||
import cn.devezhao.commons.CalendarUtils;
|
||||
import cn.devezhao.persist4j.Entity;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.base;
|
||||
package com.rebuild.server.helper.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rebuild.server.Application;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.base;
|
||||
package com.rebuild.server.helper.manager;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service.base;
|
||||
package com.rebuild.server.helper.manager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
|
@ -27,7 +27,7 @@ import org.dom4j.Document;
|
|||
import org.dom4j.Element;
|
||||
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.service.entitymanage.DisplayType;
|
||||
import com.rebuild.server.entityhub.DisplayType;
|
||||
|
||||
import cn.devezhao.persist4j.dialect.Dialect;
|
||||
import cn.devezhao.persist4j.metadata.impl.ConfigurationMetadataFactory;
|
||||
|
|
|
@ -27,7 +27,7 @@ import cn.devezhao.persist4j.Record;
|
|||
import cn.devezhao.persist4j.engine.ID;
|
||||
import cn.devezhao.persist4j.engine.StandardRecord;
|
||||
import cn.devezhao.persist4j.record.FieldValueException;
|
||||
import cn.devezhao.persist4j.record.JsonRecordCreator;
|
||||
import cn.devezhao.persist4j.record.JSONRecordCreator;
|
||||
import cn.devezhao.persist4j.record.RecordCreator;
|
||||
|
||||
/**
|
||||
|
@ -55,7 +55,7 @@ public class EntityHelper {
|
|||
* @return
|
||||
*/
|
||||
public static Record parse(JSONObject data, ID user) {
|
||||
JSONObject metadata = data.getJSONObject(JsonRecordCreator.META_FIELD);
|
||||
JSONObject metadata = data.getJSONObject(JSONRecordCreator.META_FIELD);
|
||||
if (metadata == null) {
|
||||
throw new FieldValueException("无效实体数据格式(1): " + data.toJSONString());
|
||||
}
|
||||
|
|
|
@ -22,19 +22,19 @@ import java.util.Date;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.service.bizuser.UserService;
|
||||
import com.rebuild.server.bizz.UserService;
|
||||
|
||||
import cn.devezhao.commons.CalendarUtils;
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
import cn.devezhao.persist4j.Record;
|
||||
import cn.devezhao.persist4j.engine.ID;
|
||||
import cn.devezhao.persist4j.record.JsonRecordCreator;
|
||||
import cn.devezhao.persist4j.record.JSONRecordCreator;
|
||||
|
||||
/**
|
||||
* @author Zhao Fangfang
|
||||
* @since 1.0, 2013-6-26
|
||||
*/
|
||||
public class ExtRecordCreator extends JsonRecordCreator {
|
||||
public class ExtRecordCreator extends JSONRecordCreator {
|
||||
|
||||
/**
|
||||
* @param entity
|
||||
|
|
|
@ -16,30 +16,13 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service;
|
||||
|
||||
import cn.devezhao.persist4j.Record;
|
||||
package com.rebuild.server.query;
|
||||
|
||||
/**
|
||||
* 高级查询解析器
|
||||
*
|
||||
* @author zhaofang123@gmail.com
|
||||
* @since 03/20/2018
|
||||
* @author devezhao
|
||||
* @since 09/29/2018
|
||||
*/
|
||||
public interface ServiceExecuteCall {
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
int getEntity();
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
boolean isAsync();
|
||||
|
||||
/**
|
||||
* @param record
|
||||
* @return
|
||||
*/
|
||||
Object call(Record record);
|
||||
public class AdvFilterParser {
|
||||
}
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.server.service;
|
||||
package com.rebuild.server.query;
|
||||
|
||||
import com.rebuild.server.Application;
|
||||
|
|
@ -18,10 +18,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|||
|
||||
package com.rebuild.server.service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import cn.devezhao.commons.ThreadPool;
|
||||
import cn.devezhao.persist4j.PersistManagerFactory;
|
||||
import cn.devezhao.persist4j.Record;
|
||||
import cn.devezhao.persist4j.engine.ID;
|
||||
|
@ -45,7 +41,6 @@ public class CommonService extends BaseService {
|
|||
@Override
|
||||
public Record create(Record record) {
|
||||
record = super.create(record);
|
||||
createAfter(record);
|
||||
return record;
|
||||
}
|
||||
|
||||
|
@ -62,33 +57,4 @@ public class CommonService extends BaseService {
|
|||
}
|
||||
return affected;
|
||||
}
|
||||
|
||||
// --
|
||||
|
||||
private static final Map<Integer, ServiceExecuteCall> SERVICEEXECUTECALL_MAP = new HashMap<>();
|
||||
|
||||
public void registerCall(ServiceExecuteCall call) {
|
||||
SERVICEEXECUTECALL_MAP.put(call.getEntity(), call);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建后回调
|
||||
*
|
||||
* @param record
|
||||
*/
|
||||
protected void createAfter(final Record record) {
|
||||
final ServiceExecuteCall call = SERVICEEXECUTECALL_MAP.get(record.getEntity().getEntityCode());
|
||||
if (call != null) {
|
||||
if (call.isAsync()) {
|
||||
ThreadPool.exec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
call.call(record);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
call.call(record);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
57
src/main/java/com/rebuild/utils/JSONUtils.java
Normal file
57
src/main/java/com/rebuild/utils/JSONUtils.java
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
rebuild - Building your system freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author devezhao
|
||||
* @since 09/29/2018
|
||||
*/
|
||||
public class JSONUtils {
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @param value
|
||||
* @return
|
||||
*/
|
||||
public static JSON toJSONObject(String key, Object value) {
|
||||
return toJSONObject(new String[] { key }, new Object[] { value });
|
||||
}
|
||||
|
||||
/**
|
||||
* @param keys
|
||||
* @param values
|
||||
* @return
|
||||
*/
|
||||
public static JSON toJSONObject(String keys[], Object values[]) {
|
||||
Assert.isTrue(keys.length == values.length, "K/V 长度不匹配");
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
map.put(keys[i], values[i]);
|
||||
}
|
||||
return (JSON) JSON.toJSON(map);
|
||||
}
|
||||
}
|
|
@ -23,8 +23,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.rebuild.server.Startup;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
import com.rebuild.utils.AppUtils;
|
||||
|
||||
import cn.devezhao.persist4j.engine.ID;
|
||||
|
|
|
@ -75,7 +75,7 @@ public class RequestWatchHandler extends HandlerInterceptorAdapter {
|
|||
|
||||
if (exception != null) {
|
||||
Throwable rootCause = ThrowableUtils.getRootCause(exception);
|
||||
String errorMsg = "系统繁忙";
|
||||
String errorMsg = "系统繁忙!请稍后重试";
|
||||
if (rootCause instanceof RebuildException) {
|
||||
errorMsg = ((RebuildException) rootCause).toClientMsgString();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.web.admin.entitymanage;
|
||||
package com.rebuild.web.admin.entityhub;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -31,8 +31,8 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.helper.manager.FormManager;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.service.base.FormManager;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.commons.web.ServletUtils;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.web.admin.entitymanage;
|
||||
package com.rebuild.web.admin.entityhub;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -35,10 +35,10 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.entityhub.Entity2Schema;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
import com.rebuild.server.service.entitymanage.Entity2Schema;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.commons.web.ServletUtils;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.web.admin.entitymanage;
|
||||
package com.rebuild.web.admin.entityhub;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
|
@ -35,11 +35,11 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.entityhub.DisplayType;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.entityhub.Field2Schema;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.entitymanage.DisplayType;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
import com.rebuild.server.service.entitymanage.Field2Schema;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.commons.web.ServletUtils;
|
|
@ -16,7 +16,7 @@ You should have received a copy of the GNU General Public License
|
|||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.web.admin.entitymanage;
|
||||
package com.rebuild.web.admin.entityhub;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
|
@ -29,9 +29,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.entityhub.PickListService;
|
||||
import com.rebuild.server.helper.manager.PickListManager;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.base.PickListManager;
|
||||
import com.rebuild.server.service.entitymanage.PickListService;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.commons.web.ServletUtils;
|
|
@ -46,10 +46,10 @@ import cn.devezhao.persist4j.dialect.FieldType;
|
|||
* @since 08/24/2018
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/app/")
|
||||
@RequestMapping("/app/commons/")
|
||||
public class CommonSearch extends BaseControll {
|
||||
|
||||
@RequestMapping("common/search")
|
||||
@RequestMapping("search")
|
||||
public void search(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String entity = getParameter(request, "entity");
|
||||
String search = getParameter(request, "search");
|
||||
|
|
60
src/main/java/com/rebuild/web/base/HugeTaskControll.java
Normal file
60
src/main/java/com/rebuild/web/base/HugeTaskControll.java
Normal file
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
rebuild - Building your system freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.web.base;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rebuild.server.helper.HugeTaskExecutor;
|
||||
import com.rebuild.utils.JSONUtils;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.commons.web.ServletUtils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author devezhao
|
||||
* @since 09/29/2018
|
||||
*/
|
||||
@RequestMapping("/commons/task/")
|
||||
@Controller
|
||||
public class HugeTaskControll extends BaseControll {
|
||||
|
||||
@RequestMapping("submit")
|
||||
public void submit(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
JSON reqdata = ServletUtils.getRequestJson(request);
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping("check-state")
|
||||
public void checkState(HttpServletRequest request, HttpServletResponse response)
|
||||
throws IOException {
|
||||
String taskid = getParameterNotNull(request, "taskid");
|
||||
double cp = HugeTaskExecutor.getTask(taskid).getCompletePercent();
|
||||
JSON ret = JSONUtils.toJSONObject(new String[] { "taskid", "complete" }, new Object[] { taskid, cp });
|
||||
writeSuccess(response, ret);
|
||||
}
|
||||
}
|
|
@ -30,8 +30,8 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
|
@ -43,10 +43,10 @@ import cn.devezhao.persist4j.Field;
|
|||
* @since 09/19/2018
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/app/")
|
||||
@RequestMapping("/commons/metadata/")
|
||||
public class MetadataGet extends BaseControll {
|
||||
|
||||
@RequestMapping("common/metadata/entities")
|
||||
@RequestMapping("entities")
|
||||
public void entities(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
Entity[] entities = MetadataHelper.getEntities();
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class MetadataGet extends BaseControll {
|
|||
writeSuccess(response, list);
|
||||
}
|
||||
|
||||
@RequestMapping("common/metadata/fields")
|
||||
@RequestMapping("fields")
|
||||
public void fields(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
String entity = getParameterNotNull(request, "entity");
|
||||
Entity entityBase = MetadataHelper.getEntity(entity);
|
||||
|
|
|
@ -29,9 +29,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.helper.manager.LayoutManager;
|
||||
import com.rebuild.server.helper.manager.NavManager;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.service.base.LayoutManager;
|
||||
import com.rebuild.server.service.base.NavManager;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.commons.web.ServletUtils;
|
||||
|
@ -44,10 +44,10 @@ import cn.devezhao.persist4j.engine.ID;
|
|||
* @since 09/19/2018
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/app/")
|
||||
@RequestMapping("/app/commons/")
|
||||
public class NavSettings extends BaseControll {
|
||||
|
||||
@RequestMapping(value = "common/nav-settings", method = RequestMethod.POST)
|
||||
@RequestMapping(value = "nav-settings", method = RequestMethod.POST)
|
||||
public void navsSet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
ID user = getRequestUser(request);
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class NavSettings extends BaseControll {
|
|||
writeSuccess(response);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "common/nav-settings", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "nav-settings", method = RequestMethod.GET)
|
||||
public void navsGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||
ID user = getRequestUser(request);
|
||||
JSON config = NavManager.getNav(user);
|
||||
|
|
|
@ -36,10 +36,10 @@ import com.alibaba.fastjson.JSON;
|
|||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.helper.manager.DataListManager;
|
||||
import com.rebuild.server.helper.manager.LayoutManager;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.base.DataListManager;
|
||||
import com.rebuild.server.service.base.LayoutManager;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.commons.web.ServletUtils;
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rebuild.server.service.base.FormManager;
|
||||
import com.rebuild.server.helper.manager.FormManager;
|
||||
import com.rebuild.web.BaseControll;
|
||||
|
||||
import cn.devezhao.persist4j.engine.ID;
|
||||
|
|
|
@ -30,7 +30,7 @@ import org.springframework.web.servlet.ModelAndView;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.service.base.DataListManager;
|
||||
import com.rebuild.server.helper.manager.DataListManager;
|
||||
import com.rebuild.web.BaseControll;
|
||||
import com.rebuild.web.base.entity.datalist.DataListControl;
|
||||
import com.rebuild.web.base.entity.datalist.DefaultDataListControl;
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
rebuild - Building your system freely.
|
||||
Copyright (C) 2018 devezhao <zhaofang123@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.rebuild.web.base.entity.datalist;
|
||||
|
||||
/**
|
||||
* 高级查询解析器
|
||||
*
|
||||
* @author devezhao
|
||||
* @since 09/29/2018
|
||||
*/
|
||||
public class AdvFilterParser {
|
||||
}
|
|
@ -27,9 +27,9 @@ import org.apache.commons.logging.LogFactory;
|
|||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.helper.manager.FieldValueWrapper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.base.FieldValueWrapper;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
import cn.devezhao.persist4j.Field;
|
||||
|
@ -113,7 +113,8 @@ public class DataWrapper extends FieldValueWrapper {
|
|||
|
||||
if (namedVal == null) {
|
||||
String sql = String.format("select %s from %s where %s = ?",
|
||||
nameField.getName(), entity.getName(), entity.getPrimaryField().getName());
|
||||
(nameField.getType() == FieldType.REFERENCE ? "&" : "") + nameField.getName(),
|
||||
entity.getName(), entity.getPrimaryField().getName());
|
||||
Object[] named = Application.createQuery(sql).setParameter(1, idVal).unique();
|
||||
if (named == null) {
|
||||
LOG.debug("Reference is deleted : " + idVal);
|
||||
|
|
|
@ -33,7 +33,7 @@ public class DefaultDataListControl implements DataListControl {
|
|||
|
||||
protected static final int READ_TIMEOUT = 15 * 1000;
|
||||
|
||||
protected JsonQueryParser queryParser;
|
||||
protected JSONQueryParser queryParser;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -44,13 +44,13 @@ public class DefaultDataListControl implements DataListControl {
|
|||
* @param queryElement
|
||||
*/
|
||||
public DefaultDataListControl(JSONObject queryElement) {
|
||||
this.queryParser = new JsonQueryParser(queryElement, this);
|
||||
this.queryParser = new JSONQueryParser(queryElement, this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public JsonQueryParser getQueryParser() {
|
||||
public JSONQueryParser getQueryParser() {
|
||||
return queryParser;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ import org.apache.commons.lang.math.NumberUtils;
|
|||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.rebuild.server.entityhub.DisplayType;
|
||||
import com.rebuild.server.entityhub.EasyMeta;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.entitymanage.DisplayType;
|
||||
import com.rebuild.server.service.entitymanage.EasyMeta;
|
||||
|
||||
import cn.devezhao.persist4j.Entity;
|
||||
import cn.devezhao.persist4j.Field;
|
||||
|
@ -42,7 +42,7 @@ import cn.devezhao.persist4j.Field;
|
|||
* @author Zhao Fangfang
|
||||
* @since 1.0, 2013-6-20
|
||||
*/
|
||||
public class JsonQueryParser {
|
||||
public class JSONQueryParser {
|
||||
|
||||
protected JSONObject queryElement;
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class JsonQueryParser {
|
|||
* @param queryElement
|
||||
* @param dataListControl
|
||||
*/
|
||||
public JsonQueryParser(JSONObject queryElement, DataListControl dataListControl) {
|
||||
public JSONQueryParser(JSONObject queryElement, DataListControl dataListControl) {
|
||||
this.queryElement = queryElement;
|
||||
this.dataListControl = dataListControl;
|
||||
|
|
@ -54,7 +54,7 @@
|
|||
</constructor-arg>
|
||||
</bean>
|
||||
|
||||
<bean class="com.rebuild.server.service.QueryFactory">
|
||||
<bean class="com.rebuild.server.query.QueryFactory">
|
||||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
|
||||
|
@ -62,11 +62,11 @@
|
|||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
|
||||
<bean class="com.rebuild.server.privileges.UserStore" name="UserStore" init-method="init">
|
||||
<bean class="com.rebuild.server.bizz.privileges.UserStore" name="UserStore" init-method="init">
|
||||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
|
||||
<bean class="com.rebuild.server.privileges.SecurityManager">
|
||||
<bean class="com.rebuild.server.bizz.privileges.SecurityManager">
|
||||
<constructor-arg index="0" ref="UserStore" />
|
||||
</bean>
|
||||
|
||||
|
@ -94,17 +94,17 @@
|
|||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
|
||||
<bean class="com.rebuild.server.service.entitymanage.PickListService">
|
||||
<bean class="com.rebuild.server.entityhub.PickListService">
|
||||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
|
||||
<bean class="com.rebuild.server.service.bizuser.UserService">
|
||||
<bean class="com.rebuild.server.bizz.UserService">
|
||||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
<bean class="com.rebuild.server.service.bizuser.DepartmentService">
|
||||
<bean class="com.rebuild.server.bizz.DepartmentService">
|
||||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
<bean class="com.rebuild.server.service.bizuser.RoleService">
|
||||
<bean class="com.rebuild.server.bizz.RoleService">
|
||||
<constructor-arg index="0" ref="PersistManagerFactory" />
|
||||
</bean>
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<%@ page import="com.rebuild.utils.AppUtils"%>
|
||||
<%@ page import="com.alibaba.fastjson.JSONObject"%>
|
||||
<%@ page import="com.alibaba.fastjson.JSONArray"%>
|
||||
<%@ page import="com.rebuild.server.service.base.NavManager"%>
|
||||
<%@ page import="com.rebuild.server.helper.manager.NavManager"%>
|
||||
<% final String activeNav = request.getParameter("activeNav"); %>
|
||||
<div class="rb-left-sidebar">
|
||||
<div class="left-sidebar-wrapper">
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.rebuild.server.service.entitymanage.DisplayType"%>
|
||||
<%@ page import="com.rebuild.server.entityhub.DisplayType"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.rebuild.server.service.entitymanage.DisplayType"%>
|
||||
<%@ page import="com.rebuild.server.entityhub.DisplayType"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
|
|
@ -663,4 +663,8 @@ h5.sortable-box-title {
|
|||
|
||||
.zoom-in {
|
||||
cursor: zoom-in !important;
|
||||
}
|
||||
|
||||
.form-control-plaintext {
|
||||
word-wrap: break-word;
|
||||
}
|
|
@ -39,6 +39,9 @@
|
|||
xhrFields : {
|
||||
},
|
||||
complete : function(xhr) {
|
||||
if (xhr.status == 500) rb.notice(xhr.responseText || '系统繁忙!请稍后重试', 'danger')
|
||||
if (xhr.status == 403) rb.notice(xhr.responseText || '无权访问', 'danger')
|
||||
console.log(xhr)
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ class RbForm extends React.Component {
|
|||
$.post(rb.baseUrl + '/app/entity/record-save', JSON.stringify(_data), function(res){
|
||||
actions.button('reset')
|
||||
if (res.error_code == 0){
|
||||
that.showNotice('保存成功。<a href="javascript:recordView(\'' + res.data.id + '\')">点击查看</a>', 'success')
|
||||
that.showNotice('记录保存成功', 'success')
|
||||
that.props.$$$parent.hide(true)
|
||||
if (window.rbList) window.rbList.reload()
|
||||
else if (parent.rbList) parent.rbList.reload()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ page import="com.rebuild.server.service.entitymanage.DisplayType"%>
|
||||
<%@ page import="com.rebuild.server.entityhub.DisplayType"%>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
|
|
@ -20,8 +20,8 @@ package com.rebuild.server.service.entitymanage;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.rebuild.server.service.bizuser.UserService;
|
||||
import com.rebuild.server.service.entitymanage.Entity2Schema;
|
||||
import com.rebuild.server.bizz.UserService;
|
||||
import com.rebuild.server.entityhub.Entity2Schema;
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue