no commit message
This commit is contained in:
46
pom.xml
46
pom.xml
@@ -4,7 +4,7 @@
|
||||
|
||||
<groupId>com.beimi</groupId>
|
||||
<artifactId>beimi</artifactId>
|
||||
<version>0.1.0</version>
|
||||
<version>0.2.0</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>chess</name>
|
||||
@@ -19,6 +19,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<drools.version>7.1.0.Final</drools.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@@ -119,6 +120,7 @@
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.8.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -176,6 +178,12 @@
|
||||
<version>3.15</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>net.coobird</groupId>
|
||||
<artifactId>thumbnailator</artifactId>
|
||||
<version>0.4.8</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-mp</artifactId>
|
||||
@@ -222,28 +230,54 @@
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-core</artifactId>
|
||||
<version>7.0.0.Final</version>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-compiler</artifactId>
|
||||
<version>7.0.0.Final</version>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-decisiontables</artifactId>
|
||||
<version>7.0.0.Final</version>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.drools</groupId>
|
||||
<artifactId>drools-templates</artifactId>
|
||||
<version>7.0.0.Final</version>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-api</artifactId>
|
||||
<version>7.0.0.Final</version>
|
||||
<version>${drools.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.kie</groupId>
|
||||
<artifactId>kie-spring</artifactId>
|
||||
<version>${drools.version}</version>
|
||||
<!-- Sadly kie-spring depends upon spring 3.2, but we need 4x to run smoothly with spring boot
|
||||
and while http://books.sonatype.com/mvnref-book/reference/pom-relationships-sect-project-dependencies.html
|
||||
is not working for us, we need to exclude the 3.2-dependencies -->
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-tx</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-beans</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
79
src/main/java/com/beimi/config/web/DroolsConfiguration.java
Normal file
79
src/main/java/com/beimi/config/web/DroolsConfiguration.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.beimi.config.web;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.kie.api.KieBase;
|
||||
import org.kie.api.KieServices;
|
||||
import org.kie.api.builder.KieBuilder;
|
||||
import org.kie.api.builder.KieFileSystem;
|
||||
import org.kie.api.builder.KieModule;
|
||||
import org.kie.api.builder.KieRepository;
|
||||
import org.kie.api.builder.ReleaseId;
|
||||
import org.kie.api.runtime.KieContainer;
|
||||
import org.kie.internal.io.ResourceFactory;
|
||||
import org.kie.spring.KModuleBeanFactoryPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||
|
||||
@Configuration
|
||||
public class DroolsConfiguration {
|
||||
|
||||
private static final String RULES_PATH = "config/rules/";
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(KieFileSystem.class)
|
||||
public KieFileSystem kieFileSystem() throws IOException {
|
||||
KieFileSystem kieFileSystem = getKieServices().newKieFileSystem();
|
||||
for (Resource file : getRuleFiles()) {
|
||||
kieFileSystem.write(ResourceFactory.newClassPathResource(RULES_PATH + file.getFilename(), "UTF-8"));
|
||||
}
|
||||
return kieFileSystem;
|
||||
}
|
||||
|
||||
private Resource[] getRuleFiles() throws IOException {
|
||||
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
|
||||
return resourcePatternResolver.getResources("classpath*:" + RULES_PATH + "**/*.*");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(KieContainer.class)
|
||||
public KieContainer kieContainer() throws IOException {
|
||||
final KieRepository kieRepository = getKieServices().getRepository();
|
||||
|
||||
kieRepository.addKieModule(new KieModule() {
|
||||
public ReleaseId getReleaseId() {
|
||||
return kieRepository.getDefaultReleaseId();
|
||||
}
|
||||
});
|
||||
|
||||
KieBuilder kieBuilder = getKieServices().newKieBuilder(kieFileSystem());
|
||||
kieBuilder.buildAll();
|
||||
|
||||
return getKieServices().newKieContainer(kieRepository.getDefaultReleaseId());
|
||||
}
|
||||
|
||||
private KieServices getKieServices() {
|
||||
return KieServices.Factory.get();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(KieBase.class)
|
||||
public KieBase kieBase() throws IOException {
|
||||
return kieContainer().getKieBase();
|
||||
}
|
||||
|
||||
/*
|
||||
* As http://docs.jboss.org/drools/release/6.2.0.CR1/drools-docs/html/ch.kie.spring.html
|
||||
* mentions: Without the org.kie.spring.KModuleBeanFactoryPostProcessor bean definition,
|
||||
* the kie-spring integration will not work
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(KModuleBeanFactoryPostProcessor.class)
|
||||
public KModuleBeanFactoryPostProcessor kiePostProcessor() {
|
||||
return new KModuleBeanFactoryPostProcessor();
|
||||
}
|
||||
}
|
||||
@@ -80,6 +80,14 @@ public class GameServerConfiguration
|
||||
return !StringUtils.isBlank(token); //其他安全验证策略,IP,Token,用户名
|
||||
}
|
||||
});
|
||||
/**
|
||||
* 性能优化
|
||||
*/
|
||||
config.getSocketConfig().setReuseAddress(true);
|
||||
config.getSocketConfig().setSoLinger(0);
|
||||
config.getSocketConfig().setTcpNoDelay(true);
|
||||
config.getSocketConfig().setTcpKeepAlive(true);
|
||||
|
||||
return server = new SocketIOServer(config);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,54 @@
|
||||
package com.beimi.config.web;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.beimi.core.BMDataContext;
|
||||
import com.beimi.util.cache.CacheHelper;
|
||||
import com.beimi.web.model.SysDic;
|
||||
import com.beimi.web.model.SystemConfig;
|
||||
import com.beimi.web.service.repository.jpa.SysDicRepository;
|
||||
import com.beimi.web.service.repository.jpa.SystemConfigRepository;
|
||||
|
||||
@Component
|
||||
public class StartedEventListener implements ApplicationListener<ContextRefreshedEvent> {
|
||||
private SysDicRepository sysDicRes;
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
if(BMDataContext.getContext() == null){
|
||||
BMDataContext.setApplicationContext(event.getApplicationContext());
|
||||
}
|
||||
sysDicRes = event.getApplicationContext().getBean(SysDicRepository.class) ;
|
||||
List<SysDic> sysDicList = sysDicRes.findAll() ;
|
||||
|
||||
for(SysDic dic : sysDicList){
|
||||
CacheHelper.getSystemCacheBean().put(dic.getId(), dic, dic.getOrgi());
|
||||
if(dic.getParentid().equals("0")){
|
||||
List<SysDic> sysDicItemList = new ArrayList<SysDic>();
|
||||
for(SysDic item : sysDicList){
|
||||
if(item.getDicid()!=null && item.getDicid().equals(dic.getId())){
|
||||
sysDicItemList.add(item) ;
|
||||
}
|
||||
}
|
||||
CacheHelper.getSystemCacheBean().put(dic.getCode(), sysDicItemList, dic.getOrgi());
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 加载系统全局配置
|
||||
*/
|
||||
SystemConfigRepository systemConfigRes = event.getApplicationContext().getBean(SystemConfigRepository.class) ;
|
||||
SystemConfig config = systemConfigRes.findByOrgi(BMDataContext.SYSTEM_ORGI) ;
|
||||
if(config != null){
|
||||
CacheHelper.getSystemCacheBean().put("systemConfig", config, BMDataContext.SYSTEM_ORGI);
|
||||
}
|
||||
// GenerationRepository generationRes = event.getApplicationContext().getBean(GenerationRepository.class) ;
|
||||
// List<Generation> generationList = generationRes.findAll() ;
|
||||
// for(Generation generation : generationList){
|
||||
// CacheHelper.getSystemCacheBean().setAtomicLong(BMDataContext.ModelType.WORKORDERS.toString(), generation.getStartinx());
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,12 @@ public class BMDataContext {
|
||||
public static final String GUEST_USER_ID_CODE = "BEIMIGUESTUSEKEY" ;
|
||||
public static final String SERVICE_QUENE_NULL_STR = "service_quene_null" ;
|
||||
public static final String DEFAULT_TYPE = "default" ; //默认分类代码
|
||||
public static final String BEIMI_SYSTEM_DIC = "com.dic.system.template";
|
||||
public static final String BEIMI_SYSTEM_AUTH_DIC = "com.dic.auth.resource";
|
||||
|
||||
public static String SYSTEM_ORGI = "beimi" ;
|
||||
|
||||
private static int WebIMPort = 8081 ;
|
||||
private static int WebIMPort = 9081 ;
|
||||
|
||||
private static boolean imServerRunning = false ; //IM服务状态
|
||||
|
||||
|
||||
40
src/main/java/com/beimi/util/BrowserClient.java
Normal file
40
src/main/java/com/beimi/util/BrowserClient.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.beimi.util;
|
||||
|
||||
public class BrowserClient {
|
||||
private String useragent ;
|
||||
private String os ;
|
||||
private String browser ;
|
||||
private String version ;
|
||||
private String osversion ;
|
||||
|
||||
public String getUseragent() {
|
||||
return useragent;
|
||||
}
|
||||
public void setUseragent(String useragent) {
|
||||
this.useragent = useragent;
|
||||
}
|
||||
public String getOs() {
|
||||
return os;
|
||||
}
|
||||
public void setOs(String os) {
|
||||
this.os = os;
|
||||
}
|
||||
public String getBrowser() {
|
||||
return browser;
|
||||
}
|
||||
public void setBrowser(String browser) {
|
||||
this.browser = browser;
|
||||
}
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
public String getOsversion() {
|
||||
return osversion;
|
||||
}
|
||||
public void setOsversion(String osversion) {
|
||||
this.osversion = osversion;
|
||||
}
|
||||
}
|
||||
52
src/main/java/com/beimi/util/CheckMobile.java
Normal file
52
src/main/java/com/beimi/util/CheckMobile.java
Normal file
@@ -0,0 +1,52 @@
|
||||
package com.beimi.util;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* 检测是否为移动端设备访问 , 网络共享源码
|
||||
*
|
||||
* @author : Cuichenglong
|
||||
* @group : tgb8
|
||||
* @Version : 1.00
|
||||
* @Date : 2014-7-7 下午01:34:31
|
||||
*/
|
||||
public class CheckMobile {
|
||||
|
||||
// \b 是单词边界(连着的两个(字母字符 与 非字母字符) 之间的逻辑上的间隔),
|
||||
// 字符串在编译时会被转码一次,所以是 "\\b"
|
||||
// \B 是单词内部逻辑间隔(连着的两个字母字符之间的逻辑上的间隔)
|
||||
static String phoneReg = "\\b(ip(hone|od)|android|opera m(ob|in)i"
|
||||
+"|windows (phone|ce)|blackberry"
|
||||
+"|s(ymbian|eries60|amsung)|p(laybook|alm|rofile/midp"
|
||||
+"|laystation portable)|nokia|fennec|htc[-_]"
|
||||
+"|mobile|up.browser|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
||||
static String tableReg = "\\b(ipad|tablet|(Nexus 7)|up.browser"
|
||||
+"|[1-4][0-9]{2}x[1-4][0-9]{2})\\b";
|
||||
|
||||
//移动设备正则匹配:手机端、平板
|
||||
static Pattern phonePat = Pattern.compile(phoneReg, Pattern.CASE_INSENSITIVE);
|
||||
static Pattern tablePat = Pattern.compile(tableReg, Pattern.CASE_INSENSITIVE);
|
||||
|
||||
/**
|
||||
* 检测是否是移动设备访问
|
||||
*
|
||||
* @Title: check
|
||||
* @Date : 2014-7-7 下午01:29:07
|
||||
* @param userAgent 浏览器标识
|
||||
* @return true:移动设备接入,false:pc端接入
|
||||
*/
|
||||
public static boolean check(String userAgent){
|
||||
if(null == userAgent){
|
||||
userAgent = "";
|
||||
}
|
||||
// 匹配
|
||||
Matcher matcherPhone = phonePat.matcher(userAgent);
|
||||
Matcher matcherTable = tablePat.matcher(userAgent);
|
||||
if(matcherPhone.find() || matcherTable.find()){
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
40
src/main/java/com/beimi/util/DateConverter.java
Normal file
40
src/main/java/com/beimi/util/DateConverter.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.beimi.util;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import org.apache.commons.beanutils.converters.DateTimeConverter;
|
||||
|
||||
public class DateConverter extends DateTimeConverter {
|
||||
|
||||
public DateConverter() {
|
||||
}
|
||||
|
||||
public DateConverter(Object defaultValue) {
|
||||
super(defaultValue);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.apache.commons.beanutils.converters.AbstractConverter#getDefaultType()
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
protected Class getDefaultType() {
|
||||
return Date.class;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.apache.commons.beanutils.converters.DateTimeConverter#convertToType(java.lang.Class, java.lang.Object)
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
protected Object convertToType(Class arg0, Object arg1) throws Exception {
|
||||
if (arg1 == null) {
|
||||
return null;
|
||||
}
|
||||
String value = arg1.toString().trim();
|
||||
if (value.length() == 0) {
|
||||
return null;
|
||||
}
|
||||
return super.convertToType(arg0, arg1);
|
||||
}
|
||||
}
|
||||
155
src/main/java/com/beimi/util/FFmpegCmdExecuter.java
Normal file
155
src/main/java/com/beimi/util/FFmpegCmdExecuter.java
Normal file
@@ -0,0 +1,155 @@
|
||||
package com.beimi.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
public class FFmpegCmdExecuter {
|
||||
|
||||
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(FFmpegCmdExecuter.class);
|
||||
|
||||
public static String FFMPEG = "ffmpeg";
|
||||
|
||||
/**
|
||||
* mp3 to amr
|
||||
* @param src
|
||||
* @param dest
|
||||
*/
|
||||
public static void mp3ToAmr(String src ,String dest){
|
||||
logger.info("mp3 to amr:" + dest);
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
cmd.add(FFMPEG);
|
||||
cmd.add("-i");
|
||||
cmd.add(src);
|
||||
cmd.add("-ac");
|
||||
cmd.add("1");
|
||||
cmd.add("-ar");
|
||||
cmd.add("8000");
|
||||
cmd.add(dest);
|
||||
exec(cmd);
|
||||
}
|
||||
/**
|
||||
* wav to mp3
|
||||
* @param src
|
||||
* @param dest
|
||||
*/
|
||||
public static void wavToMp3(String src,String dest){
|
||||
logger.info("wav to mp3:"+dest);
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
cmd.add(FFMPEG);
|
||||
cmd.add("-i");
|
||||
cmd.add(src);
|
||||
cmd.add("-acodec");
|
||||
cmd.add("libmp3lame");
|
||||
cmd.add(dest);
|
||||
exec(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* amr to mp3
|
||||
* @param src
|
||||
* @param dest
|
||||
*/
|
||||
public static void amrToMp3(String src ,String dest){
|
||||
logger.info("amr to mp3:"+dest);
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
cmd.add(FFMPEG);
|
||||
cmd.add("-i");
|
||||
cmd.add(src);
|
||||
cmd.add(dest);
|
||||
exec(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* ִ<><D6B4>ָ<EFBFBD><D6B8>
|
||||
* @param cmd ִ<><D6B4>ָ<EFBFBD><D6B8>
|
||||
*/
|
||||
public static void exec( List<String> cmd){
|
||||
BufferedReader stdout = null;
|
||||
try {
|
||||
ProcessBuilder builder = new ProcessBuilder();
|
||||
builder.command(cmd);
|
||||
builder.redirectErrorStream(true);
|
||||
Process proc = builder.start();
|
||||
stdout = new BufferedReader(
|
||||
new InputStreamReader(proc.getInputStream()));
|
||||
String line;
|
||||
while ((line = stdout.readLine()) != null) {
|
||||
logger.debug(line);
|
||||
}
|
||||
proc.waitFor();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
IOUtils.closeQuietly(stdout);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD>ˮӡͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˮӡ
|
||||
* @param src
|
||||
* @param dest
|
||||
* @param water
|
||||
* @param wmPosition
|
||||
* @param alpha
|
||||
* @param wmPosition
|
||||
* @return
|
||||
*/
|
||||
public static void videoWater(String src,String dest,String water,int wmPosition, float alpha,String platform) {
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
cmd.add(FFMPEG);
|
||||
cmd.add("-i");
|
||||
cmd.add(src);
|
||||
cmd.add("-i");
|
||||
cmd.add(water);
|
||||
cmd.add("-filter_complex");
|
||||
cmd.add("''overlay=main_w-overlay_w:main_h-overlay_h''");
|
||||
cmd.add("-strict");
|
||||
cmd.add("-2");
|
||||
if(NumberUtils.toInt(platform, 0)==3){
|
||||
cmd.add("-ar");
|
||||
cmd.add("8000");
|
||||
}
|
||||
cmd.add("-b");
|
||||
cmd.add("877k");
|
||||
cmd.add("-qscale");
|
||||
cmd.add("0.01");
|
||||
//ios<6F><73><EFBFBD><EFBFBD><EFBFBD>
|
||||
cmd.add("-movflags");
|
||||
cmd.add("faststart");
|
||||
cmd.add(dest);
|
||||
exec(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* <20><><EFBFBD>ˮӡͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>ˮӡ
|
||||
* @param src
|
||||
* @param dest
|
||||
*/
|
||||
public static void videoPic(String src,String dest) {
|
||||
List<String> cmd = new ArrayList<String>();
|
||||
cmd.add(FFMPEG);
|
||||
cmd.add("-i");
|
||||
cmd.add(src);
|
||||
cmd.add("-ss");
|
||||
cmd.add("-00:00:01");
|
||||
cmd.add("-vframes");
|
||||
cmd.add("1");
|
||||
cmd.add(dest);
|
||||
exec(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
43
src/main/java/com/beimi/util/IP.java
Normal file
43
src/main/java/com/beimi/util/IP.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.beimi.util;
|
||||
|
||||
public class IP{
|
||||
private String country ;
|
||||
private String province ;
|
||||
private String city ;
|
||||
private String isp ;
|
||||
private String region ;
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
public String getProvince() {
|
||||
return province;
|
||||
}
|
||||
public void setProvince(String province) {
|
||||
this.province = province;
|
||||
}
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
public String getIsp() {
|
||||
return isp;
|
||||
}
|
||||
public void setIsp(String isp) {
|
||||
this.isp = isp;
|
||||
}
|
||||
public String getRegion() {
|
||||
return region;
|
||||
}
|
||||
public void setRegion(String region) {
|
||||
this.region = region;
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return "0".equals(this.province) || "0".equals(this.city) ? this.country : (this.province+this.city) ;
|
||||
}
|
||||
}
|
||||
68
src/main/java/com/beimi/util/IPTools.java
Normal file
68
src/main/java/com/beimi/util/IPTools.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package com.beimi.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.lionsoul.ip2region.DataBlock;
|
||||
import org.lionsoul.ip2region.DbConfig;
|
||||
import org.lionsoul.ip2region.DbMakerConfigException;
|
||||
import org.lionsoul.ip2region.DbSearcher;
|
||||
|
||||
import com.beimi.core.BMDataContext;
|
||||
|
||||
public class IPTools {
|
||||
private String IP_DATA_PATH = "WEB-INF/data/ip/ip.db";
|
||||
private static IPTools iptools = new IPTools();
|
||||
private DbSearcher _searcher = null ;
|
||||
|
||||
public static IPTools getInstance(){
|
||||
return iptools ;
|
||||
}
|
||||
|
||||
public IPTools() {
|
||||
try {
|
||||
File dbFile = new File(BMDataContext.getContext().getEnvironment().getProperty("web.upload-path"), "ipdata/ipdata.db") ;
|
||||
if(!dbFile.exists()){
|
||||
FileUtils.copyInputStreamToFile(IPTools.class.getClassLoader().getResourceAsStream(IP_DATA_PATH),dbFile);
|
||||
}
|
||||
_searcher = new DbSearcher(new DbConfig(),dbFile.getAbsolutePath());
|
||||
} catch (DbMakerConfigException | IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
public IP findGeography(String remote) {
|
||||
IP ip = new IP();
|
||||
try{
|
||||
DataBlock block = _searcher.binarySearch(remote!=null ? remote : "127.0.0.1") ;
|
||||
if(block!=null && block.getRegion() != null){
|
||||
String[] region = block.getRegion().split("[\\|]") ;
|
||||
if(region.length == 5){
|
||||
ip.setCountry(region[0]);
|
||||
if(!StringUtils.isBlank(region[1]) && !region[1].equalsIgnoreCase("null")){
|
||||
ip.setRegion(region[1]);
|
||||
}else{
|
||||
ip.setRegion("");
|
||||
}
|
||||
if(!StringUtils.isBlank(region[2]) && !region[2].equalsIgnoreCase("null")){
|
||||
ip.setProvince(region[2]);
|
||||
}else{
|
||||
ip.setProvince("");
|
||||
}
|
||||
if(!StringUtils.isBlank(region[3]) && !region[3].equalsIgnoreCase("null")){
|
||||
ip.setCity(region[3]);
|
||||
}else{
|
||||
ip.setCity("");
|
||||
}
|
||||
if(!StringUtils.isBlank(region[4]) && !region[4].equalsIgnoreCase("null")){
|
||||
ip.setIsp(region[4]);
|
||||
}else{
|
||||
ip.setIsp("");
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception ex){}
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
138
src/main/java/com/beimi/util/PinYinTools.java
Normal file
138
src/main/java/com/beimi/util/PinYinTools.java
Normal file
@@ -0,0 +1,138 @@
|
||||
package com.beimi.util;
|
||||
|
||||
|
||||
public class PinYinTools {
|
||||
private static int[] pyvalue = new int[] {-20319, -20317, -20304, -20295, -20292, -20283, -20265, -20257, -20242, -20230, -20051, -20036, -20032,
|
||||
-20026, -20002, -19990, -19986, -19982, -19976, -19805, -19784, -19775, -19774, -19763, -19756, -19751, -19746, -19741, -19739, -19728,
|
||||
-19725, -19715, -19540, -19531, -19525, -19515, -19500, -19484, -19479, -19467, -19289, -19288, -19281, -19275, -19270, -19263, -19261,
|
||||
-19249, -19243, -19242, -19238, -19235, -19227, -19224, -19218, -19212, -19038, -19023, -19018, -19006, -19003, -18996, -18977, -18961,
|
||||
-18952, -18783, -18774, -18773, -18763, -18756, -18741, -18735, -18731, -18722, -18710, -18697, -18696, -18526, -18518, -18501, -18490,
|
||||
-18478, -18463, -18448, -18447, -18446, -18239, -18237, -18231, -18220, -18211, -18201, -18184, -18183, -18181, -18012, -17997, -17988,
|
||||
-17970, -17964, -17961, -17950, -17947, -17931, -17928, -17922, -17759, -17752, -17733, -17730, -17721, -17703, -17701, -17697, -17692,
|
||||
-17683, -17676, -17496, -17487, -17482, -17468, -17454, -17433, -17427, -17417, -17202, -17185, -16983, -16970, -16942, -16915, -16733,
|
||||
-16708, -16706, -16689, -16664, -16657, -16647, -16474, -16470, -16465, -16459, -16452, -16448, -16433, -16429, -16427, -16423, -16419,
|
||||
-16412, -16407, -16403, -16401, -16393, -16220, -16216, -16212, -16205, -16202, -16187, -16180, -16171, -16169, -16158, -16155, -15959,
|
||||
-15958, -15944, -15933, -15920, -15915, -15903, -15889, -15878, -15707, -15701, -15681, -15667, -15661, -15659, -15652, -15640, -15631,
|
||||
-15625, -15454, -15448, -15436, -15435, -15419, -15416, -15408, -15394, -15385, -15377, -15375, -15369, -15363, -15362, -15183, -15180,
|
||||
-15165, -15158, -15153, -15150, -15149, -15144, -15143, -15141, -15140, -15139, -15128, -15121, -15119, -15117, -15110, -15109, -14941,
|
||||
-14937, -14933, -14930, -14929, -14928, -14926, -14922, -14921, -14914, -14908, -14902, -14894, -14889, -14882, -14873, -14871, -14857,
|
||||
-14678, -14674, -14670, -14668, -14663, -14654, -14645, -14630, -14594, -14429, -14407, -14399, -14384, -14379, -14368, -14355, -14353,
|
||||
-14345, -14170, -14159, -14151, -14149, -14145, -14140, -14137, -14135, -14125, -14123, -14122, -14112, -14109, -14099, -14097, -14094,
|
||||
-14092, -14090, -14087, -14083, -13917, -13914, -13910, -13907, -13906, -13905, -13896, -13894, -13878, -13870, -13859, -13847, -13831,
|
||||
-13658, -13611, -13601, -13406, -13404, -13400, -13398, -13395, -13391, -13387, -13383, -13367, -13359, -13356, -13343, -13340, -13329,
|
||||
-13326, -13318, -13147, -13138, -13120, -13107, -13096, -13095, -13091, -13076, -13068, -13063, -13060, -12888, -12875, -12871, -12860,
|
||||
-12858, -12852, -12849, -12838, -12831, -12829, -12812, -12802, -12607, -12597, -12594, -12585, -12556, -12359, -12346, -12320, -12300,
|
||||
-12120, -12099, -12089, -12074, -12067, -12058, -12039, -11867, -11861, -11847, -11831, -11798, -11781, -11604, -11589, -11536, -11358,
|
||||
-11340, -11339, -11324, -11303, -11097, -11077, -11067, -11055, -11052, -11045, -11041, -11038, -11024, -11020, -11019, -11018, -11014,
|
||||
-10838, -10832, -10815, -10800, -10790, -10780, -10764, -10587, -10544, -10533, -10519, -10331, -10329, -10328, -10322, -10315, -10309,
|
||||
-10307, -10296, -10281, -10274, -10270, -10262, -10260, -10256, -10254};
|
||||
public static String[] pystr = new String[] {"A", "AI", "AN", "ANG", "AO", "BA", "BAI", "BAN", "BANG", "BAO", "BEI", "BEN", "BENG", "BI", "BIAN",
|
||||
"BIAO", "BIE", "BIN", "BING", "BO", "BU", "CA", "CAI", "CAN", "CANG", "CAO", "CE", "CENG", "CHA", "CHAI", "CHAN", "CHANG", "CHAO", "CHE",
|
||||
"CHEN", "CHENG", "CHI", "CHONG", "CHOU", "CHU", "CHUAI", "CHUAN", "CHUANG", "CHUI", "CHUN", "CHUO", "CI", "CONG", "COU", "CU", "CUAN",
|
||||
"CUI", "CUN", "CUO", "DA", "DAI", "DAN", "DANG", "DAO", "DE", "DENG", "DI", "DIAN", "DIAO", "DIE", "DING", "DIU", "DONG", "DOU", "DU",
|
||||
"DUAN", "DUI", "DUN", "DUO", "E", "EN", "ER", "FA", "FAN", "FANG", "FEI", "FEN", "FENG", "FO", "FOU", "FU", "GA", "GAI", "GAN", "GANG",
|
||||
"GAO", "GE", "GEI", "GEN", "GENG", "GONG", "GOU", "GU", "GUA", "GUAI", "GUAN", "GUANG", "GUI", "GUN", "GUO", "HA", "HAI", "HAN", "HANG",
|
||||
"HAO", "HE", "HEI", "HEN", "HENG", "HONG", "HOU", "HU", "HUA", "HUAI", "HUAN", "HUANG", "HUI", "HUN", "HUO", "JI", "JIA", "JIAN",
|
||||
"JIANG", "JIAO", "JIE", "JIN", "JING", "JIONG", "JIU", "JU", "JUAN", "JUE", "JUN", "KA", "KAI", "KAN", "KANG", "KAO", "KE", "KEN",
|
||||
"KENG", "KONG", "KOU", "KU", "KUA", "KUAI", "KUAN", "KUANG", "KUI", "KUN", "KUO", "LA", "LAI", "LAN", "LANG", "LAO", "LE", "LEI", "LENG",
|
||||
"LI", "LIA", "LIAN", "LIANG", "LIAO", "LIE", "LIN", "LING", "LIU", "LONG", "LOU", "LU", "LV", "LUAN", "LUE", "LUN", "LUO", "MA", "MAI",
|
||||
"MAN", "MANG", "MAO", "ME", "MEI", "MEN", "MENG", "MI", "MIAN", "MIAO", "MIE", "MIN", "MING", "MIU", "MO", "MOU", "MU", "NA", "NAI",
|
||||
"NAN", "NANG", "NAO", "NE", "NEI", "NEN", "NENG", "NI", "NIAN", "NIANG", "NIAO", "NIE", "NIN", "NING", "NIU", "NONG", "NU", "NV", "NUAN",
|
||||
"NUE", "NUO", "O", "OU", "PA", "PAI", "PAN", "PANG", "PAO", "PEI", "PEN", "PENG", "PI", "PIAN", "PIAO", "PIE", "PIN", "PING", "PO", "PU",
|
||||
"QI", "QIA", "QIAN", "QIANG", "QIAO", "QIE", "QIN", "QING", "QIONG", "QIU", "QU", "QUAN", "QUE", "QUN", "RAN", "RANG", "RAO", "RE",
|
||||
"REN", "RENG", "RI", "RONG", "ROU", "RU", "RUAN", "RUI", "RUN", "RUO", "SA", "SAI", "SAN", "SANG", "SAO", "SE", "SEN", "SENG", "SHA",
|
||||
"SHAI", "SHAN", "SHANG", "SHAO", "SHE", "SHEN", "SHENG", "SHI", "SHOU", "SHU", "SHUA", "SHUAI", "SHUAN", "SHUANG", "SHUI", "SHUN",
|
||||
"SHUO", "SI", "SONG", "SOU", "SU", "SUAN", "SUI", "SUN", "SUO", "TA", "TAI", "TAN", "TANG", "TAO", "TE", "TENG", "TI", "TIAN", "TIAO",
|
||||
"TIE", "TING", "TONG", "TOU", "TU", "TUAN", "TUI", "TUN", "TUO", "WA", "WAI", "WAN", "WANG", "WEI", "WEN", "WENG", "WO", "WU", "XI",
|
||||
"XIA", "XIAN", "XIANG", "XIAO", "XIE", "XIN", "XING", "XIONG", "XIU", "XU", "XUAN", "XUE", "XUN", "YA", "YAN", "YANG", "YAO", "YE", "YI",
|
||||
"YIN", "YING", "YO", "YONG", "YOU", "YU", "YUAN", "YUE", "YUN", "ZA", "ZAI", "ZAN", "ZANG", "ZAO", "ZE", "ZEI", "ZEN", "ZENG", "ZHA",
|
||||
"ZHAI", "ZHAN", "ZHANG", "ZHAO", "ZHE", "ZHEN", "ZHENG", "ZHI", "ZHONG", "ZHOU", "ZHU", "ZHUA", "ZHUAI", "ZHUAN", "ZHUANG", "ZHUI",
|
||||
"ZHUN", "ZHUO", "ZI", "ZONG", "ZOU", "ZU", "ZUAN", "ZUI", "ZUN", "ZUO"};
|
||||
private StringBuilder buffer;
|
||||
private String resource;
|
||||
private static PinYinTools characterParser = new PinYinTools();
|
||||
|
||||
public static PinYinTools getInstance() {
|
||||
return characterParser;
|
||||
}
|
||||
|
||||
public String getResource() {
|
||||
return resource;
|
||||
}
|
||||
|
||||
public void setResource(String resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
/** * 汉字转成ASCII码 * * @param chs * @return */
|
||||
private int getChsAscii(String chs) {
|
||||
int asc = 0;
|
||||
try {
|
||||
byte[] bytes = chs.getBytes("gb2312");
|
||||
if (bytes == null || bytes.length > 2 || bytes.length <= 0) {
|
||||
throw new RuntimeException("illegal resource string");
|
||||
}
|
||||
if (bytes.length == 1) {
|
||||
asc = bytes[0];
|
||||
}
|
||||
if (bytes.length == 2) {
|
||||
int hightByte = 256 + bytes[0];
|
||||
int lowByte = 256 + bytes[1];
|
||||
asc = (256 * hightByte + lowByte) - 256 * 256;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
System.out.println("ERROR:ChineseSpelling.class-getChsAscii(String chs)" + e);
|
||||
}
|
||||
return asc;
|
||||
}
|
||||
|
||||
/** * 单字解析 * * @param str * @return */
|
||||
public String convert(String str) {
|
||||
String result = null;
|
||||
int ascii = getChsAscii(str);
|
||||
if (ascii > 0 && ascii < 160) {
|
||||
result = String.valueOf((char) ascii);
|
||||
} else {
|
||||
for (int i = (pyvalue.length - 1); i >= 0; i--) {
|
||||
if (pyvalue[i] <= ascii) {
|
||||
result = pystr[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/** * 词组解析 * * @param chs * @return */
|
||||
public String getSelling(String chs) {
|
||||
String key, value;
|
||||
buffer = new StringBuilder();
|
||||
for (int i = 0; i < chs.length(); i++) {
|
||||
key = chs.substring(i, i + 1);
|
||||
if (key.getBytes().length >= 2) {
|
||||
value = (String) convert(key);
|
||||
if (value == null) {
|
||||
value = "unknown";
|
||||
}
|
||||
} else {
|
||||
value = key;
|
||||
}
|
||||
buffer.append(value+" ");
|
||||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
public String getSpelling() {
|
||||
return this.getSelling(this.getResource());
|
||||
}
|
||||
|
||||
public String getFirstPinYin(String word){
|
||||
String firstWord = "0";
|
||||
String pinYin = PinYinTools.getInstance().getSelling(word) ;
|
||||
if(pinYin.length() > 0){
|
||||
firstWord = pinYin.substring(0,1) ;
|
||||
}
|
||||
return firstWord ;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,18 @@
|
||||
package com.beimi.util;
|
||||
|
||||
import io.netty.handler.codec.http.HttpHeaders;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.ObjectOutputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
@@ -15,10 +25,19 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.coobird.thumbnailator.Thumbnails;
|
||||
|
||||
import org.apache.commons.beanutils.BeanUtilsBean;
|
||||
import org.apache.commons.beanutils.ConversionException;
|
||||
import org.apache.commons.beanutils.ConvertUtils;
|
||||
import org.apache.commons.beanutils.Converter;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.jasypt.util.text.BasicTextEncryptor;
|
||||
import org.jsoup.Jsoup;
|
||||
@@ -32,10 +51,21 @@ import org.springframework.data.elasticsearch.repository.ElasticsearchCrudReposi
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.beimi.core.BMDataContext;
|
||||
import com.beimi.util.cache.CacheHelper;
|
||||
import com.beimi.util.event.UserDataEvent;
|
||||
import com.beimi.util.event.UserEvent;
|
||||
import com.beimi.web.model.AttachmentFile;
|
||||
import com.beimi.web.model.Secret;
|
||||
import com.beimi.web.model.SystemConfig;
|
||||
import com.beimi.web.model.Template;
|
||||
import com.beimi.web.model.User;
|
||||
import com.beimi.web.service.repository.jpa.AttachmentRepository;
|
||||
import com.beimi.web.service.repository.jpa.SecretRepository;
|
||||
import com.beimi.web.service.repository.jpa.SystemConfigRepository;
|
||||
import com.beimi.web.service.repository.jpa.TemplateRepository;
|
||||
import com.lmax.disruptor.dsl.Disruptor;
|
||||
|
||||
|
||||
@@ -164,7 +194,16 @@ public class UKTools {
|
||||
}
|
||||
return strb.toString() ;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static void published(UserEvent event , ElasticsearchCrudRepository esRes , JpaRepository dbRes){
|
||||
Disruptor<UserDataEvent> disruptor = (Disruptor<UserDataEvent>) BMDataContext.getContext().getBean("disruptor") ;
|
||||
long seq = disruptor.getRingBuffer().next();
|
||||
UserDataEvent userDataEvent = disruptor.getRingBuffer().get(seq) ;
|
||||
userDataEvent.setEvent(event);
|
||||
userDataEvent.setDbRes(dbRes);
|
||||
userDataEvent.setEsRes(esRes);
|
||||
disruptor.getRingBuffer().publish(seq);
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param request
|
||||
@@ -273,6 +312,95 @@ public class UKTools {
|
||||
response.setHeader("Last-Modified",String.valueOf(new Date()));
|
||||
}
|
||||
|
||||
public static BrowserClient parseClient(HttpServletRequest request){
|
||||
BrowserClient client = new BrowserClient() ;
|
||||
String browserDetails = request.getHeader("User-Agent");
|
||||
String userAgent = browserDetails;
|
||||
String user = userAgent.toLowerCase();
|
||||
String os = "";
|
||||
String browser = "" , version = "";
|
||||
|
||||
|
||||
//=================OS=======================
|
||||
if (userAgent.toLowerCase().indexOf("windows") >= 0 )
|
||||
{
|
||||
os = "windows";
|
||||
} else if(userAgent.toLowerCase().indexOf("mac") >= 0)
|
||||
{
|
||||
os = "mac";
|
||||
} else if(userAgent.toLowerCase().indexOf("x11") >= 0)
|
||||
{
|
||||
os = "unix";
|
||||
} else if(userAgent.toLowerCase().indexOf("android") >= 0)
|
||||
{
|
||||
os = "android";
|
||||
} else if(userAgent.toLowerCase().indexOf("iphone") >= 0)
|
||||
{
|
||||
os = "iphone";
|
||||
}else{
|
||||
os = "UnKnown";
|
||||
}
|
||||
//===============Browser===========================
|
||||
if (user.contains("msie") || user.indexOf("rv:11") > -1)
|
||||
{
|
||||
if(user.indexOf("rv:11") >= 0){
|
||||
browser = "IE11" ;
|
||||
}else{
|
||||
String substring=userAgent.substring(userAgent.indexOf("MSIE")).split(";")[0];
|
||||
browser=substring.split(" ")[0].replace("MSIE", "IE")+substring.split(" ")[1];
|
||||
}
|
||||
}else if (user.contains("trident"))
|
||||
{
|
||||
browser= "IE 11" ;
|
||||
}else if (user.contains("edge"))
|
||||
{
|
||||
browser= "Edge" ;
|
||||
} else if (user.contains("safari") && user.contains("version"))
|
||||
{
|
||||
browser = (userAgent.substring(userAgent.indexOf("Safari")).split(" ")[0]).split("/")[0];
|
||||
version = (userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1] ;
|
||||
} else if ( user.contains("opr") || user.contains("opera"))
|
||||
{
|
||||
if(user.contains("opera"))
|
||||
browser=(userAgent.substring(userAgent.indexOf("Opera")).split(" ")[0]).split("/")[0]+"-"+(userAgent.substring(userAgent.indexOf("Version")).split(" ")[0]).split("/")[1];
|
||||
else if(user.contains("opr"))
|
||||
browser=((userAgent.substring(userAgent.indexOf("OPR")).split(" ")[0]).replace("/", "-")).replace("OPR", "Opera");
|
||||
} else if (user.contains("chrome"))
|
||||
{
|
||||
browser = "Chrome";
|
||||
} else if ((user.indexOf("mozilla/7.0") > -1) || (user.indexOf("netscape6") != -1) || (user.indexOf("mozilla/4.7") != -1) || (user.indexOf("mozilla/4.78") != -1) || (user.indexOf("mozilla/4.08") != -1) || (user.indexOf("mozilla/3") != -1) )
|
||||
{
|
||||
//browser=(userAgent.substring(userAgent.indexOf("MSIE")).split(" ")[0]).replace("/", "-");
|
||||
browser = "Netscape-?";
|
||||
|
||||
}else if ((user.indexOf("mozilla") > -1))
|
||||
{
|
||||
//browser=(userAgent.substring(userAgent.indexOf("MSIE")).split(" ")[0]).replace("/", "-");
|
||||
if(browserDetails.indexOf(" ") > 0){
|
||||
browser = browserDetails.substring(0 , browserDetails.indexOf(" "));
|
||||
}else{
|
||||
browser = "Mozilla" ;
|
||||
}
|
||||
|
||||
} else if (user.contains("firefox"))
|
||||
{
|
||||
browser=(userAgent.substring(userAgent.indexOf("Firefox")).split(" ")[0]).replace("/", "-");
|
||||
} else if(user.contains("rv"))
|
||||
{
|
||||
browser="ie";
|
||||
} else
|
||||
{
|
||||
browser = "UnKnown";
|
||||
}
|
||||
client.setUseragent(browserDetails);
|
||||
client.setOs(os);
|
||||
client.setBrowser(browser);
|
||||
client.setVersion(version);
|
||||
|
||||
return client ;
|
||||
}
|
||||
|
||||
|
||||
public static Map<String, Object> transBean2Map(Object obj) {
|
||||
|
||||
if(obj == null){
|
||||
@@ -308,6 +436,61 @@ public class UKTools {
|
||||
|
||||
}
|
||||
|
||||
public static void populate(Object bean , Map<Object , Object> properties) throws IllegalAccessException, InvocationTargetException{
|
||||
ConvertUtils.register(new Converter()
|
||||
{
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Object convert(Class arg0, Object arg1)
|
||||
{
|
||||
if(arg1 == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if(!(arg1 instanceof String)){
|
||||
throw new ConversionException("只支持字符串转换 !");
|
||||
}
|
||||
String str = (String)arg1;
|
||||
if(str.trim().equals(""))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
try{
|
||||
return sd.parse(str);
|
||||
} catch(Exception e)
|
||||
{
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}, java.util.Date.class);
|
||||
if (properties == null || bean == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
BeanUtilsBean.getInstance().populate(bean, properties);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] toBytes(Object object) throws Exception {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
ObjectOutputStream objectOutput = new ObjectOutputStream(out);
|
||||
objectOutput.writeObject(object);
|
||||
return out.toByteArray();
|
||||
}
|
||||
|
||||
public static Object toObject(byte[] data) throws Exception {
|
||||
ByteArrayInputStream input = new ByteArrayInputStream(data);
|
||||
ObjectInputStream objectInput = new ObjectInputStream(input);
|
||||
return objectInput.readObject();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param str
|
||||
@@ -408,14 +591,140 @@ public class UKTools {
|
||||
return workintTime ;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static void published(UserEvent event , ElasticsearchCrudRepository esRes , JpaRepository dbRes){
|
||||
Disruptor<UserDataEvent> disruptor = (Disruptor<UserDataEvent>) BMDataContext.getContext().getBean("disruptor") ;
|
||||
long seq = disruptor.getRingBuffer().next();
|
||||
UserDataEvent userDataEvent = disruptor.getRingBuffer().get(seq) ;
|
||||
userDataEvent.setEvent(event);
|
||||
userDataEvent.setDbRes(dbRes);
|
||||
userDataEvent.setEsRes(esRes);
|
||||
disruptor.getRingBuffer().publish(seq);
|
||||
public static File processImage(File destFile,File imageFile) throws FileNotFoundException, IOException{
|
||||
if(imageFile != null && imageFile.exists()){
|
||||
Thumbnails.of(imageFile).width(460).keepAspectRatio(true).toFile(destFile);
|
||||
}
|
||||
return destFile ;
|
||||
}
|
||||
|
||||
public static String processEmoti(String message) {
|
||||
Pattern pattern = Pattern.compile("\\[([\\d]*?)\\]");
|
||||
Matcher matcher = pattern.matcher(message);
|
||||
StringBuffer strb = new StringBuffer();
|
||||
while(matcher.find()) {
|
||||
matcher.appendReplacement(strb,"<img src='/im/js/kindeditor/plugins/emoticons/images/"+matcher.group(1)+".png'>");
|
||||
}
|
||||
if(strb.length() == 0){
|
||||
strb.append(message) ;
|
||||
}
|
||||
return strb.toString() ;
|
||||
}
|
||||
|
||||
public static String getIpAddr(HttpServletRequest request) {
|
||||
String ip = request.getHeader("x-forwarded-for");
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("Proxy-Client-IP");
|
||||
}
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getHeader("WL-Proxy-Client-IP");
|
||||
}
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = request.getRemoteAddr();
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
public static String getIpAddr(HttpHeaders headers , String remoteAddr) {
|
||||
String ip = headers.get("x-forwarded-for");
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = headers.get("Proxy-Client-IP");
|
||||
}
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = headers.get("WL-Proxy-Client-IP");
|
||||
}
|
||||
if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
|
||||
ip = remoteAddr;
|
||||
}
|
||||
return ip;
|
||||
}
|
||||
|
||||
public static boolean secConfirm(SecretRepository secRes , String orgi , String confirm){
|
||||
/**
|
||||
* 先调用 IMServer
|
||||
*/
|
||||
boolean execute = false ;
|
||||
List<Secret> secretConfig = secRes.findByOrgi(orgi) ;
|
||||
if(!StringUtils.isBlank(confirm)){
|
||||
if(secretConfig!=null && secretConfig.size() > 0){
|
||||
Secret secret = secretConfig.get( 0) ;
|
||||
if(UKTools.md5(confirm).equals(secret.getPassword())){
|
||||
execute = true ;
|
||||
}
|
||||
}
|
||||
}else if(secretConfig.size() == 0){
|
||||
execute = true ;
|
||||
}
|
||||
return execute ;
|
||||
}
|
||||
|
||||
public static void processAttachmentFile(MultipartFile[] files, AttachmentRepository attachementRes , String path,User user , String orgi, HttpServletRequest request , String dataid , String modelid) throws IOException{
|
||||
if(files!=null && files.length > 0){
|
||||
//保存附件
|
||||
for(MultipartFile file : files){
|
||||
if(file.getSize() > 0){ //文件尺寸 限制 ?在 启动 配置中 设置 的最大值,其他地方不做限制
|
||||
String fileid = UKTools.md5(file.getBytes()) ; //使用 文件的 MD5作为 ID,避免重复上传大文件
|
||||
if(!StringUtils.isBlank(fileid)){
|
||||
AttachmentFile attachmentFile = new AttachmentFile() ;
|
||||
attachmentFile.setCreater(user.getId());
|
||||
attachmentFile.setOrgi(orgi);
|
||||
attachmentFile.setOrgan(user.getOrgan());
|
||||
attachmentFile.setDataid(dataid);
|
||||
attachmentFile.setModelid(modelid);
|
||||
attachmentFile.setFilelength((int) file.getSize());
|
||||
if(file.getContentType()!=null && file.getContentType().length() > 255){
|
||||
attachmentFile.setFiletype(file.getContentType().substring(0 , 255));
|
||||
}else{
|
||||
attachmentFile.setFiletype(file.getContentType());
|
||||
}
|
||||
if(file.getOriginalFilename()!=null && file.getOriginalFilename().length() > 255){
|
||||
attachmentFile.setTitle(file.getOriginalFilename().substring(0 , 255));
|
||||
}else{
|
||||
attachmentFile.setTitle(file.getOriginalFilename());
|
||||
}
|
||||
if(!StringUtils.isBlank(attachmentFile.getFiletype()) && attachmentFile.getFiletype().indexOf("image") >= 0){
|
||||
attachmentFile.setImage(true);
|
||||
}
|
||||
attachmentFile.setFileid(fileid);
|
||||
attachementRes.save(attachmentFile) ;
|
||||
FileUtils.writeByteArrayToFile(new File(path , "app/workorders/"+fileid), file.getBytes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取系统配置
|
||||
* @return
|
||||
*/
|
||||
public static SystemConfig getSystemConfig(){
|
||||
SystemConfig systemConfig = (SystemConfig) CacheHelper.getSystemCacheBean().getCacheObject("systemConfig", BMDataContext.SYSTEM_ORGI) ;
|
||||
if(systemConfig == null){
|
||||
SystemConfigRepository systemConfigRes = BMDataContext.getContext().getBean(SystemConfigRepository.class) ;
|
||||
systemConfig = systemConfigRes.findByOrgi(BMDataContext.SYSTEM_ORGI) ;
|
||||
}
|
||||
return systemConfig;
|
||||
}
|
||||
|
||||
public static Template getTemplate(String id){
|
||||
TemplateRepository templateRes = BMDataContext.getContext().getBean(TemplateRepository.class) ;
|
||||
return templateRes.findByIdAndOrgi(id, BMDataContext.SYSTEM_ORGI);
|
||||
}
|
||||
|
||||
/**
|
||||
* 16进制字符串转换为字符串
|
||||
*
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static String string2HexString(String strPart) {
|
||||
StringBuffer hexString = new StringBuffer();
|
||||
for (int i = 0; i < strPart.length(); i++) {
|
||||
int ch = (int) strPart.charAt(i);
|
||||
String strHex = Integer.toHexString(ch);
|
||||
hexString.append(strHex);
|
||||
}
|
||||
return hexString.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* Licensed to the Rivulet under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* webapps/LICENSE-Rivulet-1.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.beimi.util.metadata;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author jaddy0302 Rivulet DatabaseMetaDataHandler.java 2010-3-21
|
||||
*
|
||||
*/
|
||||
public class DatabaseMetaDataHandler{
|
||||
/**
|
||||
*
|
||||
* @param database
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<UKTableMetaData> getTables(Connection conn) throws Exception{
|
||||
List<UKTableMetaData> tables = null ;
|
||||
{
|
||||
UKDatabaseMetadata rivuDatabase = null ;
|
||||
|
||||
try{
|
||||
rivuDatabase = new UKDatabaseMetadata(conn) ;
|
||||
tables = rivuDatabase.loadTables(null, null, null, true) ;
|
||||
}finally{
|
||||
if(conn!=null)
|
||||
conn.close() ;
|
||||
}
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param database
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static List<UKTableMetaData> getTables(Connection conn , String tabltableNamePattern) throws Exception{
|
||||
List<UKTableMetaData> tables = null ;
|
||||
{
|
||||
UKDatabaseMetadata rivuDatabase = null ;
|
||||
|
||||
try{
|
||||
rivuDatabase = new UKDatabaseMetadata(conn) ;
|
||||
tables = rivuDatabase.loadTables(tabltableNamePattern, null, null, true) ;
|
||||
}finally{
|
||||
if(conn!=null)
|
||||
conn.close() ;
|
||||
}
|
||||
}
|
||||
|
||||
return tables;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param database
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static UKTableMetaData getTable(Connection conn , String tablename) throws Exception{
|
||||
UKTableMetaData rivuTableMetaData = null ;
|
||||
{
|
||||
UKDatabaseMetadata rivuDatabase = null ;
|
||||
rivuDatabase = new UKDatabaseMetadata(conn) ;
|
||||
rivuTableMetaData = rivuDatabase.loadTable(tablename, null, null, true) ;
|
||||
}
|
||||
|
||||
return rivuTableMetaData;
|
||||
}
|
||||
|
||||
}
|
||||
95
src/main/java/com/beimi/util/metadata/UKColumnMetadata.java
Normal file
95
src/main/java/com/beimi/util/metadata/UKColumnMetadata.java
Normal file
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.beimi.util.metadata;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
/**
|
||||
* @author iceworld
|
||||
*
|
||||
*/
|
||||
public class UKColumnMetadata{
|
||||
private boolean pk = false;
|
||||
private String name;
|
||||
private String title ;
|
||||
private String typeName;
|
||||
private int columnSize;
|
||||
private int decimalDigits;
|
||||
private String isNullable;
|
||||
private int typeCode;
|
||||
|
||||
UKColumnMetadata(ResultSet rs , boolean upcase) throws SQLException {
|
||||
name = rs.getString("COLUMN_NAME");
|
||||
if(upcase){
|
||||
name = name!=null ? name.toUpperCase() : name ;
|
||||
}
|
||||
columnSize = rs.getInt("COLUMN_SIZE");
|
||||
decimalDigits = rs.getInt("DECIMAL_DIGITS");
|
||||
isNullable = rs.getString("IS_NULLABLE");
|
||||
typeCode = rs.getInt("DATA_TYPE");
|
||||
StringTokenizer typeNameStr = new StringTokenizer( rs.getString("TYPE_NAME"), "() " ) ;
|
||||
if(typeNameStr.hasMoreTokens()){
|
||||
typeName = typeNameStr.nextToken();
|
||||
}
|
||||
this.title = rs.getString("REMARKS") ;
|
||||
if(StringUtils.isBlank(title)){
|
||||
this.title = this.name ;
|
||||
}
|
||||
}
|
||||
|
||||
UKColumnMetadata(String name , String typeName , int typeCode , int colunmSize) throws SQLException {
|
||||
this.name = name ;
|
||||
this.typeCode = typeCode;
|
||||
this.typeName = typeName;
|
||||
this.columnSize = colunmSize ;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getTypeName() {
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public int getColumnSize() {
|
||||
return columnSize;
|
||||
}
|
||||
|
||||
public int getDecimalDigits() {
|
||||
return decimalDigits;
|
||||
}
|
||||
|
||||
public String getNullable() {
|
||||
return isNullable;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ColumnMetadata(" + name + ')';
|
||||
}
|
||||
|
||||
public int getTypeCode() {
|
||||
return typeCode;
|
||||
}
|
||||
|
||||
public boolean isPk() {
|
||||
return pk;
|
||||
}
|
||||
|
||||
public void setPk(boolean pk) {
|
||||
this.pk = pk;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
198
src/main/java/com/beimi/util/metadata/UKDatabaseMetadata.java
Normal file
198
src/main/java/com/beimi/util/metadata/UKDatabaseMetadata.java
Normal file
@@ -0,0 +1,198 @@
|
||||
|
||||
package com.beimi.util.metadata;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.annotations.common.util.StringHelper;
|
||||
|
||||
public class UKDatabaseMetadata{
|
||||
private Connection connection ;
|
||||
public UKDatabaseMetadata(Connection connection)
|
||||
throws SQLException {
|
||||
this.connection = connection ;
|
||||
meta = connection.getMetaData();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private final List<UKTableMetaData> tables = new ArrayList<UKTableMetaData>();
|
||||
private DatabaseMetaData meta;
|
||||
private Properties properties ;
|
||||
private static final String[] TYPES = { "TABLE", "VIEW" };
|
||||
/**
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<UKTableMetaData> getTables() {
|
||||
return this.tables;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @param schema
|
||||
* @param catalog
|
||||
* @param isQuoted
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<UKTableMetaData> loadTables(String name, String schema, String catalog,
|
||||
boolean isQuoted) throws Exception {
|
||||
boolean upcase = false ;
|
||||
try {
|
||||
if(properties!=null && properties.get("schema")!=null && schema==null){
|
||||
schema = properties.get("upcase")!=null?((String)properties.get("schema")).toUpperCase():(String)properties.get("schema") ;
|
||||
}
|
||||
if(properties!=null && properties.get("upcase")!=null){
|
||||
upcase = properties.get("upcase")!=null && properties.get("upcase").toString().toLowerCase().equals("true");
|
||||
}
|
||||
UKTableMetaData table = null;
|
||||
Statement statement = null;
|
||||
ResultSet rs = null ;
|
||||
try {
|
||||
if ((isQuoted && meta.storesMixedCaseQuotedIdentifiers())) {
|
||||
rs = meta.getTables(catalog, schema, name, TYPES);
|
||||
} else if ((isQuoted && meta.storesUpperCaseIdentifiers() && meta.storesUpperCaseQuotedIdentifiers())
|
||||
|| (!isQuoted && meta.storesUpperCaseIdentifiers())) {
|
||||
rs = meta.getTables(StringHelper.toUpperCase(catalog),
|
||||
StringHelper.toUpperCase(schema), StringHelper
|
||||
.toUpperCase(name), TYPES);
|
||||
} else if ((isQuoted && meta.storesLowerCaseQuotedIdentifiers())
|
||||
|| (!isQuoted && meta.storesLowerCaseIdentifiers())) {
|
||||
rs = meta.getTables(StringHelper.toLowerCase(catalog),
|
||||
StringHelper.toLowerCase(schema), StringHelper
|
||||
.toLowerCase(name), TYPES);
|
||||
}else if(schema!=null && schema.equals("hive")){
|
||||
statement = this.connection.createStatement() ;
|
||||
if(properties.get("database")!=null){
|
||||
statement.execute("USE "+properties.get("database")) ;
|
||||
}
|
||||
rs = statement.executeQuery("SHOW TABLES") ;
|
||||
} else {
|
||||
rs = meta.getTables(catalog, schema, name, TYPES);
|
||||
}
|
||||
|
||||
while (rs.next()) {
|
||||
String tableName = null ;
|
||||
if(schema!=null && schema.equals("hive")){
|
||||
tableName = rs.getString("tab_name") ;
|
||||
}else{
|
||||
tableName = rs.getString("TABLE_NAME");
|
||||
}
|
||||
|
||||
if(tableName.matches("[\\da-zA-Z_-\u4e00-\u9fa5]+")){
|
||||
table = new UKTableMetaData(rs, meta, true , upcase , false , schema);
|
||||
tables.add(table);
|
||||
}
|
||||
}
|
||||
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
if (rs != null){
|
||||
rs.close();
|
||||
}
|
||||
if(statement!=null){
|
||||
statement.close();
|
||||
}
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
throw sqle;
|
||||
}
|
||||
return tables ;
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @param schema
|
||||
* @param catalog
|
||||
* @param isQuoted
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public UKTableMetaData loadTable(String name, String schema, String catalog,
|
||||
boolean isQuoted) throws Exception {
|
||||
UKTableMetaData table = null;
|
||||
boolean upcase = false ;
|
||||
try {
|
||||
if(properties!=null && properties.get("schema")!=null && schema==null){
|
||||
schema = (String)properties.get("schema") ;
|
||||
}
|
||||
if(properties!=null && properties.get("upcase")!=null){
|
||||
upcase = properties.get("upcase")!=null && properties.get("upcase").toString().toLowerCase().equals("true");
|
||||
}
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
if ((isQuoted && meta.storesMixedCaseQuotedIdentifiers())) {
|
||||
rs = meta.getTables(catalog, schema, name, TYPES);
|
||||
} else if ((isQuoted && meta.storesUpperCaseQuotedIdentifiers())
|
||||
|| (!isQuoted && meta.storesUpperCaseIdentifiers())) {
|
||||
rs = meta.getTables(StringHelper.toUpperCase(catalog),
|
||||
StringHelper.toUpperCase(schema), StringHelper
|
||||
.toUpperCase(name), TYPES);
|
||||
} else if ((isQuoted && meta.storesLowerCaseQuotedIdentifiers())
|
||||
|| (!isQuoted && meta.storesLowerCaseIdentifiers())) {
|
||||
rs = meta.getTables(StringHelper.toLowerCase(catalog),
|
||||
StringHelper.toLowerCase(schema), StringHelper
|
||||
.toLowerCase(name), TYPES);
|
||||
} else {
|
||||
rs = meta.getTables(catalog, schema, name, TYPES);
|
||||
}
|
||||
|
||||
while (rs.next()) {
|
||||
table = new UKTableMetaData(rs, meta, true , upcase , true , schema);
|
||||
break ;
|
||||
}
|
||||
|
||||
} finally {
|
||||
if (rs != null)
|
||||
rs.close();
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
sqle.printStackTrace() ;
|
||||
throw sqle;
|
||||
}
|
||||
return table ;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @param schema
|
||||
* @param catalog
|
||||
* @param isQuoted
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public UKTableMetaData loadSQL(Statement statement ,String datasql, String tableName, String schema, String catalog,
|
||||
boolean isQuoted) throws Exception {
|
||||
UKTableMetaData table = null;
|
||||
if(properties!=null && properties.get("schema")!=null){
|
||||
schema = (String)properties.get("schema") ;
|
||||
}
|
||||
try {
|
||||
if(properties!=null && properties.get("schema")!=null && schema==null){
|
||||
schema = (String)properties.get("schema") ;
|
||||
}
|
||||
ResultSet rs = statement.executeQuery(datasql);
|
||||
try {
|
||||
table = new UKTableMetaData(tableName , schema , catalog , rs.getMetaData() , true);
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace() ;
|
||||
} finally {
|
||||
rs.close() ;
|
||||
}
|
||||
} catch (SQLException sqle) {
|
||||
// sqle.printStackTrace();
|
||||
throw sqle;
|
||||
}
|
||||
return table ;
|
||||
}
|
||||
|
||||
}
|
||||
170
src/main/java/com/beimi/util/metadata/UKTableMetaData.java
Normal file
170
src/main/java/com/beimi/util/metadata/UKTableMetaData.java
Normal file
@@ -0,0 +1,170 @@
|
||||
package com.beimi.util.metadata;
|
||||
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.hibernate.annotations.common.util.StringHelper;
|
||||
|
||||
/**
|
||||
* JDBC table metadata
|
||||
*
|
||||
* @author Christoph Sturm
|
||||
*/
|
||||
public class UKTableMetaData {
|
||||
|
||||
private final String catalog;
|
||||
private final String schema;
|
||||
private String name;
|
||||
private final List<UKColumnMetadata> columnMetaData = new ArrayList<UKColumnMetadata>();
|
||||
private final Map<String, Object> columName = new HashMap<String, Object>() ;
|
||||
/**
|
||||
*
|
||||
* @param rs
|
||||
* @param meta
|
||||
* @param extras
|
||||
* @throws SQLException
|
||||
*/
|
||||
public UKTableMetaData(ResultSet rs, DatabaseMetaData meta, boolean extras, boolean upcase , boolean loadColumns , String dbtype)
|
||||
throws SQLException {
|
||||
if(dbtype!=null && dbtype.equals("hive")){
|
||||
catalog = null;
|
||||
schema = null;
|
||||
if(upcase){
|
||||
name = rs.getObject("tab_name").toString() ;
|
||||
}else{
|
||||
name = rs.getObject("tab_name").toString();
|
||||
}
|
||||
}else{
|
||||
catalog = rs.getString("TABLE_CAT");
|
||||
schema = rs.getString("TABLE_SCHEM");
|
||||
if(upcase){
|
||||
name = rs.getString("TABLE_NAME").toUpperCase() ;
|
||||
}else{
|
||||
name = rs.getString("TABLE_NAME");
|
||||
}
|
||||
}
|
||||
|
||||
if(loadColumns){
|
||||
initColumns(meta , upcase);
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param tablename
|
||||
* @param meta
|
||||
* @param extras
|
||||
* @throws SQLException
|
||||
*/
|
||||
public UKTableMetaData(String tableName , String tableCatalog , String tableSchema, ResultSetMetaData meta, boolean extras)
|
||||
throws SQLException {
|
||||
catalog = tableCatalog;
|
||||
schema = tableSchema;
|
||||
name = tableName;
|
||||
initColumns(meta);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name ;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "TableMetadata(" + name + ')';
|
||||
}
|
||||
|
||||
public List<UKColumnMetadata> getColumnMetadatas() {
|
||||
return columnMetaData;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param rs
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void addColumn(ResultSet rs , boolean upcase ) throws SQLException {
|
||||
String column = rs.getString("COLUMN_NAME");
|
||||
if(upcase){
|
||||
column = column!=null ? column.toUpperCase() : column ;
|
||||
}
|
||||
if (column == null)
|
||||
return;
|
||||
|
||||
if (columName.get(column) == null) {
|
||||
UKColumnMetadata info = new UKColumnMetadata(rs , upcase);
|
||||
columnMetaData.add(info) ;
|
||||
if(upcase){
|
||||
columName.put(info.getName().toUpperCase(),"");
|
||||
}else{
|
||||
columName.put(info.getName().toLowerCase(),"");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param rs
|
||||
* @throws SQLException
|
||||
*/
|
||||
public void addSqlColumn(String name , String typeName , int typeCode , int columSize) throws SQLException {
|
||||
|
||||
if (name == null)
|
||||
return;
|
||||
|
||||
if (columName.get(name) == null) {
|
||||
UKColumnMetadata info = new UKColumnMetadata(name , typeName , typeCode , columSize);
|
||||
columnMetaData.add(info) ;
|
||||
columName.put(info.getName().toLowerCase(),"");
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param meta
|
||||
* @throws SQLException
|
||||
*/
|
||||
private void initColumns(DatabaseMetaData meta , boolean upcase) throws SQLException {
|
||||
ResultSet rs = null;
|
||||
|
||||
try {
|
||||
if (meta.storesUpperCaseIdentifiers()) {
|
||||
rs = meta.getColumns(StringHelper.toUpperCase(catalog),
|
||||
StringHelper.toUpperCase(schema), StringHelper
|
||||
.toUpperCase(name), "%");
|
||||
} else if (meta.storesLowerCaseIdentifiers()) {
|
||||
rs = meta.getColumns(StringHelper.toLowerCase(catalog),
|
||||
StringHelper.toLowerCase(schema), StringHelper
|
||||
.toLowerCase(name), "%");
|
||||
} else {
|
||||
rs = meta.getColumns(catalog, schema, name, "%");
|
||||
}
|
||||
while (rs.next())
|
||||
addColumn(rs , upcase);
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}finally {
|
||||
if (rs != null)
|
||||
rs.close();
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param meta
|
||||
* @throws SQLException
|
||||
*/
|
||||
private void initColumns(ResultSetMetaData meta) throws SQLException {
|
||||
for(int i=1 ; i<=meta.getColumnCount(); i++){
|
||||
Object tbName = meta.getColumnName(i) ;
|
||||
if(tbName!=null && String.valueOf(tbName).toLowerCase().indexOf("rownum")<0){
|
||||
addSqlColumn(meta.getColumnName(i) , meta.getColumnTypeName(i) , meta.getColumnType(i) , meta.getColumnDisplaySize(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,6 +22,8 @@ public class AdminController extends Handler{
|
||||
@Autowired
|
||||
private UserRepository userRes;
|
||||
|
||||
// @Autowired
|
||||
// private KieContainer kieContainer;
|
||||
|
||||
@Autowired
|
||||
private SysDicRepository sysDicRes ;
|
||||
@@ -29,6 +31,14 @@ public class AdminController extends Handler{
|
||||
@RequestMapping("/admin/content")
|
||||
@Menu(type = "admin" , subtype = "content")
|
||||
public ModelAndView content(ModelMap map , HttpServletRequest request) {
|
||||
|
||||
// KieSession kieSession = kieContainer.newKieSession() ;
|
||||
// long start = System.currentTimeMillis() ;
|
||||
// kieSession.insert(super.getUser(request));
|
||||
// int ruleFiredCount = kieSession.fireAllRules();
|
||||
// System.out.println(ruleFiredCount);
|
||||
// kieSession.dispose();
|
||||
// System.out.println(System.currentTimeMillis() - start);
|
||||
return request(super.createAdminTempletResponse("/admin/desktop/index"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.google.gson.Gson;
|
||||
import com.hazelcast.com.eclipsesource.json.JsonObject;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/monitor")
|
||||
public class HazelcastMonitorController extends Handler{
|
||||
|
||||
@RequestMapping("/hazelcast")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , HttpServletResponse response) throws SQLException {
|
||||
Map<String , Object> jsonObjectMap = new HashMap< String , Object>();
|
||||
map.addAttribute("systemStatics", new Gson().toJson(jsonObjectMap)) ;
|
||||
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/monitor/hazelcast"));
|
||||
}
|
||||
/**
|
||||
* 转换统计数据
|
||||
* @param json
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private Map<String , Object> convert(JsonObject json){
|
||||
Map<String , Object> values = new HashMap<String , Object>();
|
||||
for(String key : json.names()){
|
||||
values.put(key, json.get(key)) ;
|
||||
}
|
||||
return values;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.jdbc.Work;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.util.UKTools;
|
||||
import com.beimi.util.metadata.DatabaseMetaDataHandler;
|
||||
import com.beimi.util.metadata.UKColumnMetadata;
|
||||
import com.beimi.util.metadata.UKTableMetaData;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.beimi.web.model.MetadataTable;
|
||||
import com.beimi.web.model.TableProperties;
|
||||
import com.beimi.web.model.User;
|
||||
import com.beimi.web.service.repository.jpa.MetadataRepository;
|
||||
import com.beimi.web.service.repository.jpa.SysDicRepository;
|
||||
import com.beimi.web.service.repository.jpa.TablePropertiesRepository;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/metadata")
|
||||
public class MetadataController extends Handler{
|
||||
|
||||
@Autowired
|
||||
private MetadataRepository metadataRes ;
|
||||
|
||||
@Autowired
|
||||
private SysDicRepository sysDicRes ;
|
||||
|
||||
@Autowired
|
||||
private TablePropertiesRepository tablePropertiesRes ;
|
||||
|
||||
@Autowired
|
||||
@PersistenceContext
|
||||
private EntityManager em;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request) throws SQLException {
|
||||
map.addAttribute("metadataList", metadataRes.findAll(new PageRequest(super.getP(request), super.getPs(request)))) ;
|
||||
return request(super.createAdminTempletResponse("/admin/system/metadata/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView edit(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
map.addAttribute("metadata", metadataRes.findById(id)) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/metadata/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView update(ModelMap map , HttpServletRequest request , @Valid MetadataTable metadata) throws SQLException {
|
||||
MetadataTable table = metadataRes.findById(metadata.getId()) ;
|
||||
table.setName(metadata.getName());
|
||||
metadataRes.save(table);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/properties/edit")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView propertiesedit(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
map.addAttribute("tp", tablePropertiesRes.findById(id)) ;
|
||||
map.addAttribute("sysdicList", sysDicRes.findByParentid("0")) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/metadata/tpedit"));
|
||||
}
|
||||
|
||||
@RequestMapping("/properties/update")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView propertiesupdate(ModelMap map , HttpServletRequest request , @Valid TableProperties tp) throws SQLException {
|
||||
TableProperties tableProperties = tablePropertiesRes.findById(tp.getId()) ;
|
||||
tableProperties.setName(tp.getName());
|
||||
tableProperties.setSeldata(tp.isSeldata());
|
||||
tableProperties.setSeldatacode(tp.getSeldatacode());
|
||||
|
||||
tableProperties.setSystemfield(tp.isSystemfield());
|
||||
|
||||
tableProperties.setImpfield(tp.isImpfield());
|
||||
|
||||
tablePropertiesRes.save(tableProperties);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id="+tableProperties.getDbtableid()));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView delete(ModelMap map , HttpServletRequest request , @Valid String id) throws SQLException {
|
||||
MetadataTable table = metadataRes.findById(id) ;
|
||||
metadataRes.delete(table);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/batdelete")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView batdelete(ModelMap map , HttpServletRequest request , @Valid String[] ids) throws SQLException {
|
||||
if(ids!=null && ids.length>0){
|
||||
metadataRes.delete(metadataRes.findAll(Arrays.asList(ids)) );
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/properties/delete")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView propertiesdelete(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String tbid) throws SQLException {
|
||||
TableProperties prop = tablePropertiesRes.findById(id) ;
|
||||
tablePropertiesRes.delete(prop);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id="+ (!StringUtils.isBlank(tbid) ? tbid : prop.getDbtableid())));
|
||||
}
|
||||
|
||||
@RequestMapping("/properties/batdelete")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView propertiesbatdelete(ModelMap map , HttpServletRequest request , @Valid String[] ids, @Valid String tbid) throws SQLException {
|
||||
if(ids!=null && ids.length>0){
|
||||
tablePropertiesRes.delete(tablePropertiesRes.findAll(Arrays.asList(ids)) );
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/table.html?id="+ tbid));
|
||||
}
|
||||
|
||||
@RequestMapping("/table")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView table(ModelMap map , HttpServletRequest request , @Valid String id) throws SQLException {
|
||||
map.addAttribute("propertiesList", tablePropertiesRes.findByDbtableid(id)) ;
|
||||
map.addAttribute("tbid", id) ;
|
||||
return request(super.createAdminTempletResponse("/admin/system/metadata/table"));
|
||||
}
|
||||
|
||||
@RequestMapping("/imptb")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView imptb(final ModelMap map , HttpServletRequest request) throws Exception {
|
||||
|
||||
Session session = (Session) em.getDelegate();
|
||||
session.doWork(new Work() {
|
||||
public void execute(Connection connection) throws SQLException {
|
||||
try {
|
||||
map.addAttribute("tablesList",
|
||||
DatabaseMetaDataHandler.getTables(connection));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}finally{
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return request(super
|
||||
.createRequestPageTempletResponse("/admin/system/metadata/imptb"));
|
||||
}
|
||||
|
||||
@RequestMapping("/imptbsave")
|
||||
@Menu(type = "admin" , subtype = "metadata" , admin = true)
|
||||
public ModelAndView imptb(ModelMap map , HttpServletRequest request , final @Valid String[] tables) throws Exception {
|
||||
final User user = super.getUser(request) ;
|
||||
if(tables!=null && tables.length > 0){
|
||||
Session session = (Session) em.getDelegate();
|
||||
session.doWork(
|
||||
new Work() {
|
||||
public void execute(Connection connection) throws SQLException
|
||||
{
|
||||
try{
|
||||
for(String table : tables){
|
||||
int count = metadataRes.countByTablename(table) ;
|
||||
if(count == 0){
|
||||
MetadataTable metaDataTable = new MetadataTable();
|
||||
//当前记录没有被添加过,进行正常添加
|
||||
metaDataTable.setTablename(table);
|
||||
metaDataTable.setOrgi(user.getOrgi());
|
||||
metaDataTable.setId(UKTools.md5(metaDataTable.getTablename()));
|
||||
metaDataTable.setTabledirid("0");
|
||||
metaDataTable.setCreater(user.getId());
|
||||
metaDataTable.setCreatername(user.getUsername());
|
||||
metaDataTable.setName(table);
|
||||
metaDataTable.setUpdatetime(new Date());
|
||||
metaDataTable.setCreatetime(new Date());
|
||||
metadataRes.save(processMetadataTable( DatabaseMetaDataHandler.getTable(connection, metaDataTable.getTablename()) , metaDataTable));
|
||||
}
|
||||
}
|
||||
}catch(Exception ex){
|
||||
ex.printStackTrace();
|
||||
}finally{
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/metadata/index.html"));
|
||||
}
|
||||
|
||||
private MetadataTable processMetadataTable(UKTableMetaData metaData , MetadataTable table){
|
||||
table.setTableproperty(new ArrayList<TableProperties>());
|
||||
if(metaData!=null){
|
||||
for(UKColumnMetadata colum : metaData.getColumnMetadatas()){
|
||||
TableProperties tablePorperties = new TableProperties(colum.getName().toLowerCase() , colum.getTypeName() , colum.getColumnSize() , metaData.getName().toLowerCase()) ;
|
||||
tablePorperties.setOrgi(table.getOrgi()) ;
|
||||
|
||||
tablePorperties.setDatatypecode(0);
|
||||
tablePorperties.setLength(colum.getColumnSize());
|
||||
tablePorperties.setDatatypename(getDataTypeName(colum.getTypeName()));
|
||||
tablePorperties.setName(colum.getTitle().toLowerCase());
|
||||
if(tablePorperties.getFieldname().equals("create_time") || tablePorperties.getFieldname().equals("createtime") || tablePorperties.getFieldname().equals("update_time")){
|
||||
tablePorperties.setDatatypename(getDataTypeName("datetime"));
|
||||
}
|
||||
if(colum.getName().startsWith("field")){
|
||||
tablePorperties.setFieldstatus(false);
|
||||
}else{
|
||||
tablePorperties.setFieldstatus(true);
|
||||
}
|
||||
table.getTableproperty().add(tablePorperties) ;
|
||||
}
|
||||
table.setTablename(table.getTablename().toLowerCase());//转小写
|
||||
}
|
||||
return table ;
|
||||
}
|
||||
|
||||
public String getDataTypeName(String type){
|
||||
String typeName = "text" ;
|
||||
if(type.indexOf("varchar")>=0){
|
||||
typeName = "text" ;
|
||||
}else if(type.equalsIgnoreCase("date") || type.equalsIgnoreCase("datetime")){
|
||||
typeName = type.toLowerCase() ;
|
||||
}else if(type.equalsIgnoreCase("int") || type.equalsIgnoreCase("float") || type.equalsIgnoreCase("number")){
|
||||
typeName = "number" ;
|
||||
}
|
||||
return typeName ;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,207 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.beimi.web.model.Organ;
|
||||
import com.beimi.web.model.OrganRole;
|
||||
import com.beimi.web.model.Role;
|
||||
import com.beimi.web.model.User;
|
||||
import com.beimi.web.service.repository.jpa.OrganRepository;
|
||||
import com.beimi.web.service.repository.jpa.OrganRoleRepository;
|
||||
import com.beimi.web.service.repository.jpa.RoleRepository;
|
||||
import com.beimi.web.service.repository.jpa.UserRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 程序猿DD
|
||||
* @version 1.0.0
|
||||
* @blog http://blog.didispace.com
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin/organ")
|
||||
public class OrganController extends Handler{
|
||||
|
||||
@Autowired
|
||||
private OrganRepository organRepository;
|
||||
|
||||
@Autowired
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private OrganRoleRepository organRoleRes ;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "organ")
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String organ) {
|
||||
List<Organ> organList = organRepository.findAll() ;
|
||||
map.addAttribute("organList", organList);
|
||||
if(organList.size() > 0){
|
||||
Organ organData = null ;
|
||||
if(!StringUtils.isBlank(organ)){
|
||||
for(Organ data : organList){
|
||||
if(data.getId().equals(organ)){
|
||||
map.addAttribute("organData", data);
|
||||
organData = data;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
map.addAttribute("organData", organData = organList.get(0));
|
||||
}
|
||||
if(organData!=null){
|
||||
map.addAttribute("userList", userRepository.findByOrganAndOrgi(organData.getId() , super.getOrgi(request)));
|
||||
}
|
||||
}
|
||||
map.addAttribute("roleList", roleRepository.findAll());
|
||||
return request(super.createAdminTempletResponse("/admin/system/organ/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "admin" , subtype = "organ")
|
||||
public ModelAndView add(ModelMap map , HttpServletRequest request) {
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/organ/add"));
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin" , subtype = "organ")
|
||||
public ModelAndView save(HttpServletRequest request ,@Valid Organ organ) {
|
||||
Organ tempOrgan = organRepository.findByNameAndOrgi(organ.getName(), super.getOrgi(request)) ;
|
||||
String msg = "admin_organ_save_success" ;
|
||||
if(tempOrgan != null){
|
||||
msg = "admin_organ_save_exist";
|
||||
}else{
|
||||
organ.setOrgi(super.getOrgi(request));
|
||||
organRepository.save(organ) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?msg="+msg));
|
||||
}
|
||||
|
||||
@RequestMapping("/seluser")
|
||||
@Menu(type = "admin" , subtype = "seluser" , admin = true)
|
||||
public ModelAndView seluser(ModelMap map , HttpServletRequest request , @Valid String organ) {
|
||||
map.addAttribute("userList", userRepository.findByOrgiAndDatastatus(super.getOrgi(request) , false)) ;
|
||||
Organ organData = organRepository.findByIdAndOrgi(organ, super.getOrgi(request)) ;
|
||||
map.addAttribute("userOrganList", userRepository.findByOrganAndOrgi(organ, super.getOrgi(request))) ;
|
||||
map.addAttribute("organ", organData) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/organ/seluser"));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/saveuser")
|
||||
@Menu(type = "admin" , subtype = "saveuser" , admin = true)
|
||||
public ModelAndView saveuser(HttpServletRequest request ,@Valid String[] users , @Valid String organ) {
|
||||
List<String> userList = new ArrayList<String>();
|
||||
if(users!=null && users.length > 0){
|
||||
for(String user : users){
|
||||
userList.add(user) ;
|
||||
}
|
||||
List<User> organUserList = userRepository.findAll(userList) ;
|
||||
for(User user : organUserList){
|
||||
user.setOrgan(organ);
|
||||
}
|
||||
userRepository.save(organUserList) ;
|
||||
}
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?organ="+organ));
|
||||
}
|
||||
|
||||
@RequestMapping("/user/delete")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView userroledelete(HttpServletRequest request ,@Valid String id , @Valid String organ) {
|
||||
if(id!=null){
|
||||
User user= userRepository.getOne(id) ;
|
||||
user.setOrgan(null);
|
||||
userRepository.save(user) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?organ="+organ));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin" , subtype = "organ")
|
||||
public ModelAndView edit(ModelMap map ,HttpServletRequest request , @Valid String id) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/admin/system/organ/edit")) ;
|
||||
view.addObject("organData", organRepository.findByIdAndOrgi(id, super.getOrgi(request))) ;
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "admin" , subtype = "organ")
|
||||
public ModelAndView update(HttpServletRequest request ,@Valid Organ organ) {
|
||||
Organ tempOrgan = organRepository.findByIdAndOrgi(organ.getId(), super.getOrgi(request)) ;
|
||||
String msg = "admin_organ_update_success" ;
|
||||
if(tempOrgan != null){
|
||||
tempOrgan.setName(organ.getName());
|
||||
tempOrgan.setUpdatetime(new Date());
|
||||
tempOrgan.setOrgi(super.getOrgi(request));
|
||||
tempOrgan.setSkill(organ.isSkill());
|
||||
organRepository.save(tempOrgan) ;
|
||||
}else{
|
||||
msg = "admin_organ_update_not_exist";
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?msg="+msg));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "admin" , subtype = "organ")
|
||||
public ModelAndView delete(HttpServletRequest request ,@Valid Organ organ) {
|
||||
String msg = "admin_organ_delete" ;
|
||||
if(organ!=null){
|
||||
organRepository.delete(organ);
|
||||
}else{
|
||||
msg = "admin_organ_not_exist" ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html?msg="+msg));
|
||||
}
|
||||
|
||||
@RequestMapping("/auth")
|
||||
@Menu(type = "admin" , subtype = "organ")
|
||||
public ModelAndView auth(ModelMap map ,HttpServletRequest request , @Valid String id) {
|
||||
Organ organData = organRepository.findByIdAndOrgi(id, super.getOrgi(request)) ;
|
||||
map.addAttribute("organData", organData) ;
|
||||
map.addAttribute("roleList", roleRepository.findByOrgi(super.getOrgi(request))) ;
|
||||
|
||||
map.addAttribute("organRoleList", organRoleRes.findByOrgiAndOrgan(super.getOrgi(request), organData)) ;
|
||||
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/organ/auth"));
|
||||
}
|
||||
|
||||
@RequestMapping("/auth/save")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView authsave(HttpServletRequest request ,@Valid String id ,@Valid String roles) {
|
||||
Organ organData = organRepository.findByIdAndOrgi(id, super.getOrgi(request)) ;
|
||||
List<OrganRole> organRoleList = organRoleRes.findByOrgiAndOrgan(super.getOrgi(request), organData) ;
|
||||
organRoleRes.delete(organRoleList);
|
||||
if(!StringUtils.isBlank(roles)){
|
||||
String[] rolesarray = roles.split(",") ;
|
||||
for(String role : rolesarray){
|
||||
OrganRole organRole = new OrganRole();
|
||||
Role tempRole = new Role();
|
||||
tempRole.setId(role);
|
||||
organRole.setRole(tempRole);
|
||||
organRole.setOrgan(organData);
|
||||
organRole.setCreater(super.getUser(request).getId());
|
||||
organRole.setOrgi(super.getOrgi(request));
|
||||
organRole.setCreatetime(new Date());
|
||||
organRoleRes.save(organRole) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/organ/index.html"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.core.BMDataContext;
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.beimi.web.model.Role;
|
||||
import com.beimi.web.model.RoleAuth;
|
||||
import com.beimi.web.model.SysDic;
|
||||
import com.beimi.web.model.UKeFuDic;
|
||||
import com.beimi.web.model.User;
|
||||
import com.beimi.web.model.UserRole;
|
||||
import com.beimi.web.service.repository.jpa.RoleAuthRepository;
|
||||
import com.beimi.web.service.repository.jpa.RoleRepository;
|
||||
import com.beimi.web.service.repository.jpa.SysDicRepository;
|
||||
import com.beimi.web.service.repository.jpa.UserRepository;
|
||||
import com.beimi.web.service.repository.jpa.UserRoleRepository;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/role")
|
||||
public class RoleController extends Handler{
|
||||
|
||||
@Autowired
|
||||
private RoleRepository roleRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRoleRepository userRoleRes;
|
||||
|
||||
@Autowired
|
||||
private RoleAuthRepository roleAuthRes ;
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private SysDicRepository sysDicRes;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String role) {
|
||||
List<Role> roleList = roleRepository.findAll() ;
|
||||
map.addAttribute("roleList", roleList);
|
||||
if(roleList.size() > 0){
|
||||
Role roleData = null ;
|
||||
if(!StringUtils.isBlank(role)){
|
||||
for(Role data : roleList){
|
||||
if(data.getId().equals(role)){
|
||||
roleData = data ;
|
||||
map.addAttribute("roleData", data);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
map.addAttribute("roleData", roleData = roleList.get(0));
|
||||
}
|
||||
if(roleData!=null){
|
||||
map.addAttribute("userRoleList", userRoleRes.findByOrgiAndRole(super.getOrgi(request), roleData, new PageRequest(super.getP(request), super.getPs(request))) );
|
||||
}
|
||||
}
|
||||
return request(super.createAdminTempletResponse("/admin/system/role/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView add(ModelMap map , HttpServletRequest request) {
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/role/add"));
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView save(HttpServletRequest request ,@Valid Role role) {
|
||||
Role tempRole = roleRepository.findByNameAndOrgi(role.getName(), super.getOrgi(request)) ;
|
||||
String msg = "admin_role_save_success" ;
|
||||
if(tempRole != null){
|
||||
msg = "admin_role_save_exist";
|
||||
}else{
|
||||
role.setOrgi(super.getOrgi(request));
|
||||
role.setCreater(super.getUser(request).getId());
|
||||
role.setCreatetime(new Date());
|
||||
role.setUpdatetime(new Date());
|
||||
roleRepository.save(role) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/role/index.html?msg="+msg));
|
||||
}
|
||||
|
||||
@RequestMapping("/seluser")
|
||||
@Menu(type = "admin" , subtype = "seluser" , admin = true)
|
||||
public ModelAndView seluser(ModelMap map , HttpServletRequest request , @Valid String role) {
|
||||
map.addAttribute("userList", userRepository.findByOrgiAndDatastatus(super.getOrgi(request) , false)) ;
|
||||
Role roleData = roleRepository.findByIdAndOrgi(role, super.getOrgi(request)) ;
|
||||
map.addAttribute("userRoleList", userRoleRes.findByOrgiAndRole(super.getOrgi(request) , roleData)) ;
|
||||
map.addAttribute("role", roleData) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/role/seluser"));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/saveuser")
|
||||
@Menu(type = "admin" , subtype = "saveuser" , admin = true)
|
||||
public ModelAndView saveuser(HttpServletRequest request ,@Valid String[] users , @Valid String role) {
|
||||
Role roleData = roleRepository.findByIdAndOrgi(role, super.getOrgi(request)) ;
|
||||
List<UserRole> userRoleList = userRoleRes.findByOrgiAndRole(super.getOrgi(request) , roleData) ;
|
||||
if(users!=null && users.length > 0){
|
||||
for(String user : users){
|
||||
boolean exist = false ;
|
||||
for(UserRole userRole : userRoleList){
|
||||
if(user.equals(userRole.getUser().getId())){
|
||||
exist = true ; continue ;
|
||||
}
|
||||
}
|
||||
if(exist == false) {
|
||||
UserRole userRole = new UserRole() ;
|
||||
userRole.setUser(new User(user));
|
||||
userRole.setRole(new Role(role));
|
||||
userRole.setOrgi(super.getOrgi(request));
|
||||
userRole.setCreater(super.getUser(request).getId());
|
||||
userRoleRes.save(userRole) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/role/index.html?role="+role));
|
||||
}
|
||||
|
||||
@RequestMapping("/user/delete")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView userroledelete(HttpServletRequest request ,@Valid String id , @Valid String role) {
|
||||
if(role!=null){
|
||||
userRoleRes.delete(id);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/role/index.html?role="+role));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView edit(ModelMap map , HttpServletRequest request ,@Valid String id) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/admin/system/role/edit")) ;
|
||||
view.addObject("roleData", roleRepository.findByIdAndOrgi(id, super.getOrgi(request))) ;
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView update(HttpServletRequest request ,@Valid Role role) {
|
||||
Role tempRole = roleRepository.findByIdAndOrgi(role.getId(), super.getOrgi(request)) ;
|
||||
String msg = "admin_role_update_success" ;
|
||||
if(tempRole != null){
|
||||
tempRole.setName(role.getName());
|
||||
tempRole.setUpdatetime(new Date());
|
||||
roleRepository.save(tempRole) ;
|
||||
}else{
|
||||
msg = "admin_role_update_not_exist";
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/role/index.html?msg="+msg));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView delete(HttpServletRequest request ,@Valid Role role) {
|
||||
String msg = "admin_role_delete" ;
|
||||
if(role!=null){
|
||||
userRoleRes.delete(userRoleRes.findByOrgiAndRole(super.getOrgi(request), role));
|
||||
roleRepository.delete(role);
|
||||
}else{
|
||||
msg = "admin_role_not_exist" ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/role/index.html?msg="+msg));
|
||||
}
|
||||
|
||||
@RequestMapping("/auth")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView auth(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
SysDic sysDic = sysDicRes.findByCode(BMDataContext.BEIMI_SYSTEM_AUTH_DIC) ;
|
||||
if(sysDic!=null){
|
||||
map.addAttribute("resourceList", sysDicRes.findByDicid(sysDic.getId())) ;
|
||||
}
|
||||
map.addAttribute("sysDic", sysDic) ;
|
||||
Role role = roleRepository.findByIdAndOrgi(id, super.getOrgi(request)) ;
|
||||
map.addAttribute("role", role) ;
|
||||
map.addAttribute("roleAuthList", roleAuthRes.findByRoleidAndOrgi(role.getId(), super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/role/auth"));
|
||||
}
|
||||
|
||||
@RequestMapping("/auth/save")
|
||||
@Menu(type = "admin" , subtype = "role")
|
||||
public ModelAndView authsave(HttpServletRequest request ,@Valid String id ,@Valid String menus) {
|
||||
List<RoleAuth> roleAuthList = roleAuthRes.findByRoleidAndOrgi(id, super.getOrgi(request)) ;
|
||||
roleAuthRes.delete(roleAuthList);
|
||||
if(!StringUtils.isBlank(menus)){
|
||||
String[] menuarray = menus.split(",") ;
|
||||
for(String menu : menuarray){
|
||||
RoleAuth roleAuth = new RoleAuth();
|
||||
roleAuth.setRoleid(id);
|
||||
roleAuth.setDicid(menu);
|
||||
roleAuth.setCreater(super.getUser(request).getId());
|
||||
roleAuth.setOrgi(super.getOrgi(request));
|
||||
roleAuth.setCreatetime(new Date());
|
||||
SysDic sysDic = UKeFuDic.getInstance().getDicItem(menu) ;
|
||||
roleAuth.setName(sysDic.getName());
|
||||
roleAuth.setDicvalue(sysDic.getCode());
|
||||
roleAuthRes.save(roleAuth) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/role/index.html"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,224 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.util.cache.CacheHelper;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.beimi.web.model.SysDic;
|
||||
import com.beimi.web.service.repository.jpa.SysDicRepository;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/sysdic")
|
||||
public class SysDicController extends Handler{
|
||||
|
||||
|
||||
@Autowired
|
||||
private SysDicRepository sysDicRes;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request) {
|
||||
map.addAttribute("sysDicList", sysDicRes.findByParentid( "0" , new PageRequest(super.getP(request), super.getPs(request) , Direction.DESC , "createtime")));
|
||||
return request(super.createAdminTempletResponse("/admin/system/sysdic/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView add(ModelMap map , HttpServletRequest request) {
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/sysdic/add"));
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView save(HttpServletRequest request ,@Valid SysDic dic) {
|
||||
List<SysDic> sysDicList = sysDicRes.findByCodeOrName(dic.getCode() , dic.getName()) ;
|
||||
String msg = null ;
|
||||
if(sysDicList.size() == 0){
|
||||
dic.setParentid("0");
|
||||
dic.setHaschild(true);
|
||||
dic.setCreater(super.getUser(request).getId());
|
||||
dic.setCreatetime(new Date());
|
||||
sysDicRes.save(dic) ;
|
||||
reloadSysDicItem(dic , request);
|
||||
}else{
|
||||
msg = "exist" ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sysdic/index.html"+(msg!=null ? "?msg="+msg : "")));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView edit(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String p) {
|
||||
map.addAttribute("sysDic", sysDicRes.findById(id)) ;
|
||||
map.addAttribute("p", p) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/sysdic/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView update(HttpServletRequest request ,@Valid SysDic dic, @Valid String p) {
|
||||
List<SysDic> sysDicList = sysDicRes.findByCodeOrName(dic.getCode() , dic.getName()) ;
|
||||
if(sysDicList.size() == 0 || (sysDicList.size() ==1 && sysDicList.get(0).getId().equals(dic.getId()))){
|
||||
SysDic sysDic = sysDicRes.findById(dic.getId()) ;
|
||||
sysDic.setName(dic.getName());
|
||||
sysDic.setCode(dic.getCode());
|
||||
sysDic.setCtype(dic.getCtype());
|
||||
sysDic.setIconskin(dic.getIconskin());
|
||||
sysDic.setIconstr(dic.getIconstr());
|
||||
sysDic.setDescription(dic.getDescription());
|
||||
sysDicRes.save(sysDic) ;
|
||||
|
||||
reloadSysDicItem(sysDic, request);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sysdic/index.html?p="+p));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView delete(ModelMap map , HttpServletRequest request , @Valid String id, @Valid String p) {
|
||||
SysDic sysDic = sysDicRes.findById(id);
|
||||
sysDicRes.delete(sysDicRes.findByDicid(id) );
|
||||
sysDicRes.delete(sysDic);
|
||||
|
||||
reloadSysDicItem(sysDic, request);
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sysdic/index.html?p="+p));
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitem(ModelMap map , HttpServletRequest request , @Valid String id) {
|
||||
map.addAttribute("sysDic", sysDicRes.findById(id)) ;
|
||||
map.addAttribute("sysDicList", sysDicRes.findByParentid( id , new PageRequest(super.getP(request), super.getPs(request) , Direction.DESC , "createtime")));
|
||||
return request(super.createAdminTempletResponse("/admin/system/sysdic/dicitem"));
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem/add")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitemadd(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String p) {
|
||||
map.addAttribute("sysDic", sysDicRes.findById(id)) ;
|
||||
map.addAttribute("p", p) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/sysdic/dicitemadd"));
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem/save")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitemsave(HttpServletRequest request ,@Valid SysDic dic , @Valid String p) {
|
||||
List<SysDic> sysDicList = sysDicRes.findByDicidAndName(dic.getDicid() , dic.getName()) ;
|
||||
String msg = null ;
|
||||
if(sysDicList.size() == 0){
|
||||
dic.setHaschild(true);
|
||||
dic.setOrgi(super.getOrgi(request));
|
||||
dic.setCreater(super.getUser(request).getId());
|
||||
dic.setCreatetime(new Date());
|
||||
sysDicRes.save(dic) ;
|
||||
reloadSysDicItem(dic, request);
|
||||
}else{
|
||||
msg = "exist" ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sysdic/dicitem.html?id="+dic.getParentid()+(msg!=null ? "&p="+p+"&msg="+msg : "")));
|
||||
}
|
||||
|
||||
private void reloadSysDicItem(SysDic dic , HttpServletRequest request ){
|
||||
CacheHelper.getSystemCacheBean().put(dic.getId(), dic,super.getOrgi(request));
|
||||
if(dic.getDicid()!=null){
|
||||
SysDic root = (SysDic) CacheHelper.getSystemCacheBean().getCacheObject(dic.getDicid(), super.getOrgi(request)) ;
|
||||
List<SysDic> sysDicList = sysDicRes.findByDicid(dic.getDicid()) ;
|
||||
CacheHelper.getSystemCacheBean().put(root.getCode(), sysDicList,super.getOrgi(request));
|
||||
}else if(dic.getParentid().equals("0")){
|
||||
List<SysDic> sysDicList = sysDicRes.findByDicid(dic.getId()) ;
|
||||
CacheHelper.getSystemCacheBean().put(dic.getCode(), sysDicList,super.getOrgi(request));
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem/batadd")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitembatadd(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String p) {
|
||||
map.addAttribute("sysDic", sysDicRes.findById(id)) ;
|
||||
map.addAttribute("p", p) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/sysdic/batadd"));
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem/batsave")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitembatsave(HttpServletRequest request ,@Valid SysDic sysDic , @Valid String content , @Valid String p) {
|
||||
String[] dicitems = content.split("[\n\r\n]") ;
|
||||
int count = 0 ;
|
||||
for(String dicitem : dicitems){
|
||||
String[] dicValues = dicitem.split("[\t, ;]{1,}") ;
|
||||
if(dicValues.length == 2 && dicValues[0].length()>0 && dicValues[1].length() >0){
|
||||
SysDic dic = new SysDic() ;
|
||||
dic.setOrgi(super.getOrgi(request));
|
||||
|
||||
dic.setName(dicValues[0]);
|
||||
dic.setCode(dicValues[1]);
|
||||
dic.setCreater(super.getUser(request).getId());
|
||||
dic.setParentid(sysDic.getParentid());
|
||||
dic.setDicid(sysDic.getDicid());
|
||||
dic.setSortindex(++count);
|
||||
dic.setCreatetime(new Date());
|
||||
dic.setUpdatetime(new Date());
|
||||
if(sysDicRes.findByDicidAndName(dic.getDicid(), dic.getName()).size() == 0){
|
||||
sysDicRes.save(dic) ;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
reloadSysDicItem(sysDicRes.getOne(sysDic.getParentid()), request);
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sysdic/dicitem.html?id="+sysDic.getParentid()+"&p="+p));
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem/edit")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitemedit(ModelMap map , HttpServletRequest request , @Valid String id , @Valid String p) {
|
||||
map.addAttribute("sysDic", sysDicRes.findById(id)) ;
|
||||
map.addAttribute("p", p) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/sysdic/dicitemedit"));
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem/update")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitemupdate(HttpServletRequest request ,@Valid SysDic dic, @Valid String p) {
|
||||
List<SysDic> sysDicList = sysDicRes.findByDicidAndName(dic.getDicid() , dic.getName()) ;
|
||||
if(sysDicList.size() == 0 || (sysDicList.size() ==1 && sysDicList.get(0).getId().equals(dic.getId()))){
|
||||
SysDic sysDic = sysDicRes.findById(dic.getId()) ;
|
||||
sysDic.setName(dic.getName());
|
||||
sysDic.setCode(dic.getCode());
|
||||
sysDic.setCtype(dic.getCtype());
|
||||
sysDic.setOrgi(super.getOrgi(request));
|
||||
sysDic.setIconskin(dic.getIconskin());
|
||||
sysDic.setIconstr(dic.getIconstr());
|
||||
sysDic.setDiscode(dic.isDiscode());
|
||||
sysDic.setDescription(dic.getDescription());
|
||||
sysDicRes.save(sysDic) ;
|
||||
|
||||
reloadSysDicItem(sysDic, request);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sysdic/dicitem.html?id="+dic.getParentid()+"&p="+p));
|
||||
}
|
||||
|
||||
@RequestMapping("/dicitem/delete")
|
||||
@Menu(type = "admin" , subtype = "sysdic")
|
||||
public ModelAndView dicitemdelete(ModelMap map , HttpServletRequest request , @Valid String id, @Valid String p) {
|
||||
sysDicRes.delete(sysDicRes.findByDicid(id));
|
||||
SysDic dic = sysDicRes.getOne(id) ;
|
||||
sysDicRes.delete(dic);
|
||||
reloadSysDicItem(dic, request);
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/sysdic/dicitem.html?id="+dic.getParentid()+"&p="+p));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.core.BMDataContext;
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.util.UKTools;
|
||||
import com.beimi.util.cache.CacheHelper;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.beimi.web.model.Secret;
|
||||
import com.beimi.web.model.SystemConfig;
|
||||
import com.beimi.web.service.repository.jpa.SecretRepository;
|
||||
import com.beimi.web.service.repository.jpa.SystemConfigRepository;
|
||||
import com.beimi.web.service.repository.jpa.TemplateRepository;
|
||||
import com.corundumstudio.socketio.SocketIOServer;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/config")
|
||||
public class SystemConfigController extends Handler{
|
||||
|
||||
@Value("${uk.im.server.port}")
|
||||
private Integer port;
|
||||
|
||||
@Value("${web.upload-path}")
|
||||
private String path;
|
||||
|
||||
@Autowired
|
||||
private SocketIOServer server ;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigRepository systemConfigRes ;
|
||||
|
||||
@Autowired
|
||||
private SecretRepository secRes ;
|
||||
|
||||
@Autowired
|
||||
private TemplateRepository templateRes ;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "config" , admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request , @Valid String execute) throws SQLException {
|
||||
map.addAttribute("server", server) ;
|
||||
map.addAttribute("imServerStatus", BMDataContext.getIMServerStatus()) ;
|
||||
List<Secret> secretConfig = secRes.findByOrgi(super.getOrgi(request)) ;
|
||||
if(secretConfig!=null && secretConfig.size() > 0){
|
||||
map.addAttribute("secret", secretConfig.get(0)) ;
|
||||
}
|
||||
|
||||
if(!StringUtils.isBlank(execute) && execute.equals("false")){
|
||||
map.addAttribute("execute", execute) ;
|
||||
}
|
||||
if(!StringUtils.isBlank(request.getParameter("msg"))){
|
||||
map.addAttribute("msg", request.getParameter("msg")) ;
|
||||
}
|
||||
return request(super.createAdminTempletResponse("/admin/system/config/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/stopimserver")
|
||||
@Menu(type = "admin" , subtype = "stopimserver" , access = false , admin = true)
|
||||
public ModelAndView stopimserver(ModelMap map , HttpServletRequest request , @Valid String confirm) throws SQLException {
|
||||
boolean execute = false ;
|
||||
if(execute = UKTools.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
server.stop();
|
||||
BMDataContext.setIMServerStatus(false);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html?execute="+execute));
|
||||
}
|
||||
|
||||
/**
|
||||
* 危险操作,请谨慎调用 , WebLogic/WebSphere/Oracle等中间件服务器禁止调用
|
||||
* @param map
|
||||
* @param request
|
||||
* @return
|
||||
* @throws SQLException
|
||||
*/
|
||||
@RequestMapping("/stop")
|
||||
@Menu(type = "admin" , subtype = "stop" , access = false , admin = true)
|
||||
public ModelAndView stop(ModelMap map , HttpServletRequest request , @Valid String confirm) throws SQLException {
|
||||
boolean execute = false ;
|
||||
if(execute = UKTools.secConfirm(secRes, super.getOrgi(request), confirm)){
|
||||
server.stop();
|
||||
BMDataContext.setIMServerStatus(false);
|
||||
System.exit(0);
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html?execute="+execute));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin" , subtype = "save" , admin = true)
|
||||
public ModelAndView save(ModelMap map , HttpServletRequest request , @Valid SystemConfig config , @RequestParam(value = "keyfile", required = false) MultipartFile keyfile , @Valid Secret secret) throws SQLException, IOException, NoSuchAlgorithmException {
|
||||
SystemConfig systemConfig = systemConfigRes.findByOrgi(super.getOrgi(request)) ;
|
||||
config.setOrgi(super.getOrgi(request));
|
||||
String msg = "0" ;
|
||||
if(StringUtils.isBlank(config.getJkspassword())){
|
||||
config.setJkspassword(null);
|
||||
}
|
||||
if(systemConfig == null){
|
||||
config.setCreater(super.getUser(request).getId());
|
||||
config.setCreatetime(new Date());
|
||||
systemConfig = config ;
|
||||
}else{
|
||||
UKTools.copyProperties(config,systemConfig);
|
||||
}
|
||||
if(config.isEnablessl()){
|
||||
if(keyfile!=null && keyfile.getBytes()!=null && keyfile.getBytes().length > 0 && keyfile.getOriginalFilename()!=null && keyfile.getOriginalFilename().length() > 0){
|
||||
FileUtils.writeByteArrayToFile(new File(path , "ssl/"+keyfile.getOriginalFilename()), keyfile.getBytes());
|
||||
systemConfig.setJksfile(keyfile.getOriginalFilename());
|
||||
}
|
||||
Properties prop = new Properties();
|
||||
FileOutputStream oFile = new FileOutputStream(new File(path , "ssl/https.properties"));//true表示追加打开
|
||||
prop.setProperty("key-store-password", UKTools.encryption(systemConfig.getJkspassword())) ;
|
||||
prop.setProperty("key-store",systemConfig.getJksfile()) ;
|
||||
prop.store(oFile , "SSL Properties File");
|
||||
oFile.close();
|
||||
}else if(new File(path , "ssl").exists()){
|
||||
File[] sslFiles = new File(path , "ssl").listFiles() ;
|
||||
for(File sslFile : sslFiles){
|
||||
sslFile.delete();
|
||||
}
|
||||
}
|
||||
|
||||
if(secret!=null && !StringUtils.isBlank(secret.getPassword())){
|
||||
List<Secret> secretConfig = secRes.findByOrgi(super.getOrgi(request)) ;
|
||||
String repassword = request.getParameter("repassword") ;
|
||||
if(!StringUtils.isBlank(repassword) && repassword.equals(secret.getPassword())){
|
||||
if(secretConfig!=null && secretConfig.size() > 0){
|
||||
Secret tempSecret = secretConfig.get(0) ;
|
||||
String oldpass = request.getParameter("oldpass") ;
|
||||
if(!StringUtils.isBlank(oldpass) && UKTools.md5(oldpass).equals(tempSecret.getPassword())){
|
||||
tempSecret.setPassword(UKTools.md5(secret.getPassword()));
|
||||
msg = "1" ;
|
||||
tempSecret.setEnable(true);
|
||||
secRes.save(tempSecret) ;
|
||||
}else{
|
||||
msg = "3" ;
|
||||
}
|
||||
}else{
|
||||
secret.setOrgi(super.getOrgi(request));
|
||||
secret.setCreater(super.getUser(request).getId());
|
||||
secret.setCreatetime(new Date());
|
||||
secret.setPassword(UKTools.md5(secret.getPassword()));
|
||||
secret.setEnable(true);
|
||||
msg = "1" ;
|
||||
secRes.save(secret) ;
|
||||
}
|
||||
}else{
|
||||
msg = "2" ;
|
||||
}
|
||||
map.addAttribute("msg", msg) ;
|
||||
}
|
||||
systemConfigRes.save(systemConfig) ;
|
||||
|
||||
CacheHelper.getSystemCacheBean().put("systemConfig", systemConfig , super.getOrgi(request));
|
||||
map.addAttribute("imServerStatus", BMDataContext.getIMServerStatus()) ;
|
||||
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/config/index.html?msg="+msg));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.core.BMDataContext;
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.util.UKTools;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.beimi.web.model.Template;
|
||||
import com.beimi.web.model.UKeFuDic;
|
||||
import com.beimi.web.service.repository.jpa.TemplateRepository;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/admin/template")
|
||||
public class TemplateController extends Handler{
|
||||
|
||||
|
||||
@Autowired
|
||||
private TemplateRepository templateRes;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request) {
|
||||
map.addAttribute("sysDicList", UKeFuDic.getInstance().getDic(BMDataContext.BEIMI_SYSTEM_DIC));
|
||||
return request(super.createAdminTempletResponse("/admin/system/template/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/expall")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public void expall(ModelMap map , HttpServletRequest request , HttpServletResponse response) throws Exception {
|
||||
List<Template> templateList = templateRes.findByOrgi(super.getOrgi(request)) ;
|
||||
response.setHeader("content-disposition", "attachment;filename=UCKeFu-Template-Export-"+new SimpleDateFormat("yyyy-MM-dd").format(new Date())+".data");
|
||||
response.getOutputStream().write(UKTools.toBytes(templateList));
|
||||
return ;
|
||||
}
|
||||
|
||||
@RequestMapping("/imp")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView imp(ModelMap map , HttpServletRequest request) {
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/template/imp"));
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@RequestMapping("/impsave")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView impsave(ModelMap map , HttpServletRequest request , @RequestParam(value = "dataFile", required = false) MultipartFile dataFile) throws Exception {
|
||||
if(dataFile!=null && dataFile.getSize() > 0){
|
||||
List<Template> templateList = (List<Template>) UKTools.toObject(dataFile.getBytes()) ;
|
||||
if(templateList!=null && templateList.size() >0){
|
||||
templateRes.deleteInBatch(templateList);
|
||||
for(Template template : templateList){
|
||||
templateRes.save(template) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/template/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/list")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView list(ModelMap map , HttpServletRequest request ,@Valid String type) {
|
||||
map.addAttribute("sysDic", UKeFuDic.getInstance().getDicItem(type));
|
||||
map.addAttribute("templateList", templateRes.findByTemplettypeAndOrgi(type, super.getOrgi(request)));
|
||||
return request(super.createAdminTempletResponse("/admin/system/template/list"));
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView add(ModelMap map , HttpServletRequest request ,@Valid String type) {
|
||||
map.addAttribute("sysDic", UKeFuDic.getInstance().getDicItem(type));
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/template/add"));
|
||||
}
|
||||
|
||||
@RequestMapping( "/save")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView save(HttpServletRequest request , @Valid Template template) {
|
||||
template.setOrgi(super.getOrgi(request));
|
||||
template.setCreatetime(new Date());
|
||||
templateRes.save(template) ;
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/template/list.html?type="+template.getTemplettype()));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView edit(ModelMap map , HttpServletRequest request , @Valid String id, @Valid String type) {
|
||||
map.addAttribute("sysDic", UKeFuDic.getInstance().getDicItem(type));
|
||||
map.addAttribute("template", templateRes.findByIdAndOrgi(id, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/template/edit"));
|
||||
}
|
||||
|
||||
@RequestMapping( "/update")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView update(HttpServletRequest request , @Valid Template template) {
|
||||
Template oldTemplate = templateRes.findByIdAndOrgi(template.getId(), super.getOrgi(request)) ;
|
||||
if(oldTemplate!=null){
|
||||
oldTemplate.setName(template.getName());
|
||||
templateRes.save(oldTemplate) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/template/list.html?type="+template.getTemplettype()));
|
||||
}
|
||||
|
||||
@RequestMapping("/code")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView code(ModelMap map , HttpServletRequest request , @Valid String id, @Valid String type) {
|
||||
map.addAttribute("sysDic", UKeFuDic.getInstance().getDicItem(type));
|
||||
map.addAttribute("template", templateRes.findByIdAndOrgi(id, super.getOrgi(request))) ;
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/template/code"));
|
||||
}
|
||||
|
||||
@RequestMapping( "/codesave")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView codesave(HttpServletRequest request , @Valid Template template) {
|
||||
Template oldTemplate = templateRes.findByIdAndOrgi(template.getId(), super.getOrgi(request)) ;
|
||||
if(oldTemplate!=null){
|
||||
oldTemplate.setTemplettext(template.getTemplettext());
|
||||
templateRes.save(oldTemplate) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/template/list.html?type="+template.getTemplettype()));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "admin" , subtype = "template" , access = false , admin = true)
|
||||
public ModelAndView delete(HttpServletRequest request ,@Valid Template template) {
|
||||
if(template!=null){
|
||||
templateRes.delete(template) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/template/list.html?type="+template.getTemplettype()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.beimi.web.handler.admin.system;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.beimi.util.Menu;
|
||||
import com.beimi.util.UKTools;
|
||||
import com.beimi.web.handler.Handler;
|
||||
import com.beimi.web.model.User;
|
||||
import com.beimi.web.model.UserRole;
|
||||
import com.beimi.web.service.repository.jpa.UserRepository;
|
||||
import com.beimi.web.service.repository.jpa.UserRoleRepository;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author 程序猿DD
|
||||
* @version 1.0.0
|
||||
* @blog http://blog.didispace.com
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/admin/user")
|
||||
public class UsersController extends Handler{
|
||||
|
||||
@Autowired
|
||||
private UserRepository userRepository;
|
||||
|
||||
@Autowired
|
||||
private UserRoleRepository userRoleRes;
|
||||
|
||||
@RequestMapping("/index")
|
||||
@Menu(type = "admin" , subtype = "user")
|
||||
public ModelAndView index(ModelMap map , HttpServletRequest request) throws FileNotFoundException, IOException {
|
||||
map.addAttribute("userList", userRepository.findByDatastatusAndOrgi(false, super.getOrgi(request), new PageRequest(super.getP(request), super.getPs(request), Sort.Direction.ASC, "createtime")));
|
||||
return request(super.createAdminTempletResponse("/admin/system/user/index"));
|
||||
}
|
||||
|
||||
@RequestMapping("/add")
|
||||
@Menu(type = "admin" , subtype = "user")
|
||||
public ModelAndView add(ModelMap map , HttpServletRequest request) {
|
||||
return request(super.createRequestPageTempletResponse("/admin/system/user/add"));
|
||||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
@Menu(type = "admin" , subtype = "user")
|
||||
public ModelAndView save(HttpServletRequest request ,@Valid User user) {
|
||||
User tempUser = userRepository.findByUsernameAndOrgi(user.getUsername(), super.getOrgi(request)) ;
|
||||
String msg = "admin_user_save_success" ;
|
||||
if(tempUser != null){
|
||||
msg = "admin_user_save_exist";
|
||||
}else{
|
||||
if(request.getParameter("admin")!=null){
|
||||
user.setUsertype("0");
|
||||
}else{
|
||||
user.setUsertype(null);
|
||||
}
|
||||
if(!StringUtils.isBlank(user.getPassword())){
|
||||
user.setPassword(UKTools.md5(user.getPassword()));
|
||||
}
|
||||
user.setOrgi(super.getOrgi(request));
|
||||
userRepository.save(user) ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html?msg="+msg));
|
||||
}
|
||||
|
||||
@RequestMapping("/edit")
|
||||
@Menu(type = "admin" , subtype = "user")
|
||||
public ModelAndView edit(ModelMap map ,HttpServletRequest request , @Valid String id) {
|
||||
ModelAndView view = request(super.createRequestPageTempletResponse("/admin/system/user/edit")) ;
|
||||
view.addObject("userData", userRepository.findByIdAndOrgi(id, super.getOrgi(request))) ;
|
||||
return view;
|
||||
}
|
||||
|
||||
@RequestMapping("/update")
|
||||
@Menu(type = "admin" , subtype = "user" , admin = true)
|
||||
public ModelAndView update(HttpServletRequest request ,@Valid User user) {
|
||||
User tempUser = userRepository.getOne(user.getId()) ;
|
||||
User exist = userRepository.findByUsernameAndOrgi(user.getUsername(), super.getOrgi(request)) ;
|
||||
if(exist==null || exist.getId().equals(user.getId())){
|
||||
if(tempUser != null){
|
||||
tempUser.setUname(user.getUname());
|
||||
tempUser.setUsername(user.getUsername());
|
||||
tempUser.setEmail(user.getEmail());
|
||||
tempUser.setMobile(user.getMobile());
|
||||
tempUser.setAgent(user.isAgent());
|
||||
tempUser.setOrgi(super.getOrgi(request));
|
||||
tempUser.setCallcenter(user.isCallcenter());
|
||||
if(!StringUtils.isBlank(user.getPassword())){
|
||||
tempUser.setPassword(UKTools.md5(user.getPassword()));
|
||||
}
|
||||
|
||||
if(request.getParameter("admin")!=null){
|
||||
tempUser.setUsertype("0");
|
||||
}else{
|
||||
tempUser.setUsertype(null);
|
||||
}
|
||||
|
||||
if(tempUser.getCreatetime() == null){
|
||||
tempUser.setCreatetime(new Date());
|
||||
}
|
||||
tempUser.setUpdatetime(new Date());
|
||||
userRepository.save(tempUser) ;
|
||||
}
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html"));
|
||||
}
|
||||
|
||||
@RequestMapping("/delete")
|
||||
@Menu(type = "admin" , subtype = "user")
|
||||
public ModelAndView delete(HttpServletRequest request ,@Valid User user) {
|
||||
String msg = "admin_user_delete" ;
|
||||
if(user!=null){
|
||||
List<UserRole> userRole = userRoleRes.findByOrgiAndUser(super.getOrgi(request), user) ;
|
||||
userRoleRes.delete(userRole); //删除用户的时候,同时删除用户对应的
|
||||
user = userRepository.getOne(user.getId()) ;
|
||||
user.setDatastatus(true);
|
||||
userRepository.save(user) ;
|
||||
}else{
|
||||
msg = "admin_user_not_exist" ;
|
||||
}
|
||||
return request(super.createRequestPageTempletResponse("redirect:/admin/user/index.html?msg="+msg));
|
||||
}
|
||||
}
|
||||
140
src/main/java/com/beimi/web/model/AttachmentFile.java
Normal file
140
src/main/java/com/beimi/web/model/AttachmentFile.java
Normal file
@@ -0,0 +1,140 @@
|
||||
package com.beimi.web.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Proxy;
|
||||
|
||||
import com.beimi.util.UKTools;
|
||||
|
||||
@Entity
|
||||
@Table(name = "bm_attachment_file")
|
||||
@Proxy(lazy = false)
|
||||
public class AttachmentFile implements Serializable {
|
||||
private static final long serialVersionUID = -8657469468192323550L;
|
||||
|
||||
private String id = UKTools.getUUID();
|
||||
private String orgi ;
|
||||
private String creater ;
|
||||
private String organ ;
|
||||
private Date createtime = new Date();
|
||||
private Date updatetime = new Date();
|
||||
private String title ;
|
||||
private String url ;
|
||||
private int filelength ;
|
||||
private boolean datastatus ;
|
||||
private String filetype ;
|
||||
private String fileid ;
|
||||
private String dataid ;
|
||||
private String modelid ; //功能模块的主数据ID, 例如,工单的回复 数据中,为了方便一次把所有的附件全部查询出来,避免关联查询,可以使用 modelid
|
||||
private String model ;
|
||||
private boolean image ;
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
public void setOrgi(String orgi) {
|
||||
this.orgi = orgi;
|
||||
}
|
||||
public String getCreater() {
|
||||
return creater;
|
||||
}
|
||||
public void setCreater(String creater) {
|
||||
this.creater = creater;
|
||||
}
|
||||
public String getOrgan() {
|
||||
return organ;
|
||||
}
|
||||
public void setOrgan(String organ) {
|
||||
this.organ = organ;
|
||||
}
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
public Date getUpdatetime() {
|
||||
return updatetime;
|
||||
}
|
||||
public void setUpdatetime(Date updatetime) {
|
||||
this.updatetime = updatetime;
|
||||
}
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
public int getFilelength() {
|
||||
return filelength;
|
||||
}
|
||||
public void setFilelength(int filelength) {
|
||||
this.filelength = filelength;
|
||||
}
|
||||
public boolean isDatastatus() {
|
||||
return datastatus;
|
||||
}
|
||||
public void setDatastatus(boolean datastatus) {
|
||||
this.datastatus = datastatus;
|
||||
}
|
||||
public String getFiletype() {
|
||||
return filetype;
|
||||
}
|
||||
public void setFiletype(String filetype) {
|
||||
this.filetype = filetype;
|
||||
}
|
||||
public String getDataid() {
|
||||
return dataid;
|
||||
}
|
||||
public void setDataid(String dataid) {
|
||||
this.dataid = dataid;
|
||||
}
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
public boolean isImage() {
|
||||
return image;
|
||||
}
|
||||
public void setImage(boolean image) {
|
||||
this.image = image;
|
||||
}
|
||||
public String getFileid() {
|
||||
return fileid;
|
||||
}
|
||||
public void setFileid(String fileid) {
|
||||
this.fileid = fileid;
|
||||
}
|
||||
public String getModelid() {
|
||||
return modelid;
|
||||
}
|
||||
public void setModelid(String modelid) {
|
||||
this.modelid = modelid;
|
||||
}
|
||||
}
|
||||
199
src/main/java/com/beimi/web/model/GameConfig.java
Normal file
199
src/main/java/com/beimi/web/model/GameConfig.java
Normal file
@@ -0,0 +1,199 @@
|
||||
package com.beimi.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
@Entity
|
||||
@Table(name = "bm_gameconfig")
|
||||
@org.hibernate.annotations.Proxy(lazy = false)
|
||||
public class GameConfig implements java.io.Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 565678041210332017L;
|
||||
private String id ;
|
||||
private String orgi ;
|
||||
private Date createtime = new Date() ;
|
||||
private String creater ;
|
||||
private String username ;
|
||||
private String name ;
|
||||
|
||||
private int maxuser = 10 ; //每个坐席 接入最多访客数量
|
||||
|
||||
private int initmaxuser = 10 ; //坐席进入就绪状态的时候,会首次分配用户,initmaxuser控制 分配的用户数量,如果不设置,则会 直接 分配到最大用户数或将当前 等待队列分配完成
|
||||
|
||||
private String sessionmsg ; //欢迎消息
|
||||
private String distribution ; //坐席分配策略
|
||||
private boolean lastagent; //启用历史服务坐席优先分配
|
||||
private boolean sessiontimeout; //启用超时提醒功能
|
||||
private int timeout = 120; //超时时长 , 默认2分钟
|
||||
private String timeoutmsg ; //超时提醒消息
|
||||
private boolean resessiontimeout; //启用再次超时断开
|
||||
private int retimeout = 120; //再次超时时长 , 默认2分钟
|
||||
private String retimeoutmsg ; //再次超时断开
|
||||
private boolean satisfaction ; //启用满意度调查
|
||||
|
||||
private boolean agentreplaytimeout ; //启用坐席回复超时
|
||||
private int agenttimeout;
|
||||
private String agenttimeoutmsg ;
|
||||
|
||||
private boolean hourcheck ; //启用工作时间段检查
|
||||
private String workinghours ; //工作时间段,格式 9:00-12:00,13:30-15:30
|
||||
private String notinwhmsg ; //非工作时间段 访客咨询的提示消息
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
public void setOrgi(String orgi) {
|
||||
this.orgi = orgi;
|
||||
}
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
public String getCreater() {
|
||||
return creater;
|
||||
}
|
||||
public void setCreater(String creater) {
|
||||
this.creater = creater;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getSessionmsg() {
|
||||
return sessionmsg;
|
||||
}
|
||||
public void setSessionmsg(String sessionmsg) {
|
||||
this.sessionmsg = sessionmsg;
|
||||
}
|
||||
public String getDistribution() {
|
||||
return distribution;
|
||||
}
|
||||
public void setDistribution(String distribution) {
|
||||
this.distribution = distribution;
|
||||
}
|
||||
public boolean isLastagent() {
|
||||
return lastagent;
|
||||
}
|
||||
public void setLastagent(boolean lastagent) {
|
||||
this.lastagent = lastagent;
|
||||
}
|
||||
public boolean isSessiontimeout() {
|
||||
return sessiontimeout;
|
||||
}
|
||||
public void setSessiontimeout(boolean sessiontimeout) {
|
||||
this.sessiontimeout = sessiontimeout;
|
||||
}
|
||||
public int getTimeout() {
|
||||
return timeout;
|
||||
}
|
||||
public void setTimeout(int timeout) {
|
||||
this.timeout = timeout;
|
||||
}
|
||||
public String getTimeoutmsg() {
|
||||
return timeoutmsg;
|
||||
}
|
||||
public void setTimeoutmsg(String timeoutmsg) {
|
||||
this.timeoutmsg = timeoutmsg;
|
||||
}
|
||||
public boolean isResessiontimeout() {
|
||||
return resessiontimeout;
|
||||
}
|
||||
public void setResessiontimeout(boolean resessiontimeout) {
|
||||
this.resessiontimeout = resessiontimeout;
|
||||
}
|
||||
public int getRetimeout() {
|
||||
return retimeout;
|
||||
}
|
||||
public void setRetimeout(int retimeout) {
|
||||
this.retimeout = retimeout;
|
||||
}
|
||||
public String getRetimeoutmsg() {
|
||||
return retimeoutmsg;
|
||||
}
|
||||
public void setRetimeoutmsg(String retimeoutmsg) {
|
||||
this.retimeoutmsg = retimeoutmsg;
|
||||
}
|
||||
public boolean isSatisfaction() {
|
||||
return satisfaction;
|
||||
}
|
||||
public void setSatisfaction(boolean satisfaction) {
|
||||
this.satisfaction = satisfaction;
|
||||
}
|
||||
public boolean isAgentreplaytimeout() {
|
||||
return agentreplaytimeout;
|
||||
}
|
||||
public void setAgentreplaytimeout(boolean agentreplaytimeout) {
|
||||
this.agentreplaytimeout = agentreplaytimeout;
|
||||
}
|
||||
public int getAgenttimeout() {
|
||||
return agenttimeout;
|
||||
}
|
||||
public void setAgenttimeout(int agenttimeout) {
|
||||
this.agenttimeout = agenttimeout;
|
||||
}
|
||||
public String getAgenttimeoutmsg() {
|
||||
return agenttimeoutmsg;
|
||||
}
|
||||
public void setAgenttimeoutmsg(String agenttimeoutmsg) {
|
||||
this.agenttimeoutmsg = agenttimeoutmsg;
|
||||
}
|
||||
public int getMaxuser() {
|
||||
return maxuser;
|
||||
}
|
||||
public void setMaxuser(int maxuser) {
|
||||
this.maxuser = maxuser;
|
||||
}
|
||||
public int getInitmaxuser() {
|
||||
return initmaxuser;
|
||||
}
|
||||
public void setInitmaxuser(int initmaxuser) {
|
||||
this.initmaxuser = initmaxuser;
|
||||
}
|
||||
public String getWorkinghours() {
|
||||
return workinghours;
|
||||
}
|
||||
public void setWorkinghours(String workinghours) {
|
||||
this.workinghours = workinghours;
|
||||
}
|
||||
public String getNotinwhmsg() {
|
||||
return notinwhmsg;
|
||||
}
|
||||
public void setNotinwhmsg(String notinwhmsg) {
|
||||
this.notinwhmsg = notinwhmsg;
|
||||
}
|
||||
public boolean isHourcheck() {
|
||||
return hourcheck;
|
||||
}
|
||||
public void setHourcheck(boolean hourcheck) {
|
||||
this.hourcheck = hourcheck;
|
||||
}
|
||||
}
|
||||
69
src/main/java/com/beimi/web/model/Generation.java
Normal file
69
src/main/java/com/beimi/web/model/Generation.java
Normal file
@@ -0,0 +1,69 @@
|
||||
package com.beimi.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
@Entity
|
||||
@Table(name = "bm_generation")
|
||||
@org.hibernate.annotations.Proxy(lazy = false)
|
||||
public class Generation implements java.io.Serializable{
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -4177398881384047619L;
|
||||
private String id ;
|
||||
private String model ;
|
||||
private int startinx ;
|
||||
private String orgi ;
|
||||
private String creater ;
|
||||
private Date createtime ;
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
public int getStartinx() {
|
||||
return startinx;
|
||||
}
|
||||
public void setStartinx(int startinx) {
|
||||
this.startinx = startinx;
|
||||
}
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
public void setOrgi(String orgi) {
|
||||
this.orgi = orgi;
|
||||
}
|
||||
public String getCreater() {
|
||||
return creater;
|
||||
}
|
||||
public void setCreater(String creater) {
|
||||
this.creater = creater;
|
||||
}
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
}
|
||||
519
src/main/java/com/beimi/web/model/MetadataTable.java
Normal file
519
src/main/java/com/beimi/web/model/MetadataTable.java
Normal file
@@ -0,0 +1,519 @@
|
||||
package com.beimi.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OrderBy;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Where;
|
||||
|
||||
|
||||
@Entity
|
||||
@Table(name = "bm_tabletask")
|
||||
@org.hibernate.annotations.Proxy(lazy = false)
|
||||
public class MetadataTable implements java.io.Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -3728229777159531557L;
|
||||
private String id;
|
||||
private String name;
|
||||
private String dbid ;
|
||||
private String tabledirid;
|
||||
private String tablename;
|
||||
private String code;
|
||||
private String secure;
|
||||
private String tabletype = "1"; // 1:Table : 2:SQL
|
||||
private String datasql ;
|
||||
private int startindex = 0;
|
||||
private Date updatetime ;
|
||||
private long updatetimenumber ;
|
||||
|
||||
private String tabtype ; //project
|
||||
private String pid ; //product
|
||||
private String secmenuid ; //Sec Menu
|
||||
private String reportid ; //report
|
||||
private boolean timeline ;
|
||||
private String eventname ;
|
||||
|
||||
private int tbversion ; //table task version
|
||||
|
||||
// private SecureConfigure secureconfigure;
|
||||
private Date lastupdate;
|
||||
private String taskname;
|
||||
private String taskplan; //改变用处, 改为 left
|
||||
private String taskstatus ; //改变用处 , 改为 top
|
||||
private String tasktype; // R3 CRM修改用处,修改为 二级菜单下的主表
|
||||
private Date createtime;
|
||||
private String configure; //改变用处,改为 链接对象 一
|
||||
private String secureconf; //改变用处,改为 链接对象 二
|
||||
private String userid;
|
||||
private String groupid; //如果为结算过后的表,储存模型名称
|
||||
private String previewtemplet ; //修改用处,改变为 SQL或 Table 的 参数
|
||||
private String listblocktemplet ;
|
||||
private String orgi ;
|
||||
private String creater ;
|
||||
private String creatername ;
|
||||
private boolean userpage = false ;
|
||||
private boolean fromdb ;
|
||||
private boolean workflow ;
|
||||
private List<TableProperties> tableproperty;
|
||||
|
||||
/**
|
||||
* @return the tableproperty
|
||||
*/
|
||||
@Where(clause="impfield=0") //不载入 设置为 禁用 导入导出的字段
|
||||
@OneToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER)
|
||||
@JoinColumn(name = "dbtableid")
|
||||
@OrderBy("name")
|
||||
public List<TableProperties> getTableproperty() {
|
||||
return tableproperty;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableproperty
|
||||
* the tableproperty to set
|
||||
*/
|
||||
public void setTableproperty(List<TableProperties> tableproperty) {
|
||||
this.tableproperty = tableproperty;
|
||||
}
|
||||
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
public void setOrgi(String orgi) {
|
||||
this.orgi = orgi;
|
||||
}
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* the code to set
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the secure
|
||||
*/
|
||||
public String getSecure() {
|
||||
return secure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param secure
|
||||
* the secure to set
|
||||
*/
|
||||
public void setSecure(String secure) {
|
||||
this.secure = secure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the lastupdate
|
||||
*/
|
||||
public Date getLastupdate() {
|
||||
return lastupdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastupdate
|
||||
* the lastupdate to set
|
||||
*/
|
||||
public void setLastupdate(Date lastupdate) {
|
||||
this.lastupdate = lastupdate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the taskname
|
||||
*/
|
||||
public String getTaskname() {
|
||||
return taskname != null ? taskname : tablename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskname
|
||||
* the taskname to set
|
||||
*/
|
||||
public void setTaskname(String taskname) {
|
||||
this.taskname = taskname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the taskplan
|
||||
*/
|
||||
public String getTaskplan() {
|
||||
return taskplan;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskplan
|
||||
* the taskplan to set
|
||||
*/
|
||||
public void setTaskplan(String taskplan) {
|
||||
this.taskplan = taskplan;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the taskstatus
|
||||
*/
|
||||
public String getTaskstatus() {
|
||||
return taskstatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param taskstatus
|
||||
* the taskstatus to set
|
||||
*/
|
||||
public void setTaskstatus(String taskstatus) {
|
||||
this.taskstatus = taskstatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tasktype
|
||||
*/
|
||||
public String getTasktype() {
|
||||
return tasktype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tasktype
|
||||
* the tasktype to set
|
||||
*/
|
||||
public void setTasktype(String tasktype) {
|
||||
this.tasktype = tasktype;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the createtime
|
||||
*/
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param createtime
|
||||
* the createtime to set
|
||||
*/
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the userid
|
||||
*/
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param userid
|
||||
* the userid to set
|
||||
*/
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the groupid
|
||||
*/
|
||||
public String getGroupid() {
|
||||
return groupid;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param groupid
|
||||
* the groupid to set
|
||||
*/
|
||||
public void setGroupid(String groupid) {
|
||||
this.groupid = groupid;
|
||||
}
|
||||
|
||||
@Transient
|
||||
public String getType() {
|
||||
return "table";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the configure
|
||||
*/
|
||||
public String getConfigure() {
|
||||
return configure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configure
|
||||
* the configure to set
|
||||
*/
|
||||
public void setConfigure(String configure) {
|
||||
this.configure = configure;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the secureconf
|
||||
*/
|
||||
public String getSecureconf() {
|
||||
return secureconf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param secureconf
|
||||
* the secureconf to set
|
||||
*/
|
||||
public void setSecureconf(String secureconf) {
|
||||
this.secureconf = secureconf;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the tablename
|
||||
*/
|
||||
public String getTablename() {
|
||||
return tablename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tablename
|
||||
* the tablename to set
|
||||
*/
|
||||
public void setTablename(String tablename) {
|
||||
this.tablename = tablename;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the tabletype
|
||||
*/
|
||||
public String getTabletype() {
|
||||
return tabletype != null ? tabletype : "1";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tabletype
|
||||
* the tabletype to set
|
||||
*/
|
||||
public void setTabletype(String tabletype) {
|
||||
this.tabletype = tabletype;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the startindex
|
||||
*/
|
||||
public int getStartindex() {
|
||||
return startindex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param startindex the startindex to set
|
||||
*/
|
||||
public void setStartindex(int startindex) {
|
||||
this.startindex = startindex;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the updatetime
|
||||
*/
|
||||
public Date getUpdatetime() {
|
||||
return updatetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param updatetime the updatetime to set
|
||||
*/
|
||||
public void setUpdatetime(Date updatetime) {
|
||||
this.updatetime = updatetime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the updatetimenumber
|
||||
*/
|
||||
public long getUpdatetimenumber() {
|
||||
return updatetimenumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param updatetimenumber the updatetimenumber to set
|
||||
*/
|
||||
public void setUpdatetimenumber(long updatetimenumber) {
|
||||
this.updatetimenumber = updatetimenumber;
|
||||
}
|
||||
|
||||
public String getDatasql() {
|
||||
return datasql;
|
||||
}
|
||||
|
||||
|
||||
public void setDatasql(String datasql) {
|
||||
this.datasql = datasql;
|
||||
}
|
||||
|
||||
public String getPreviewtemplet() {
|
||||
return previewtemplet;
|
||||
}
|
||||
|
||||
public void setPreviewtemplet(String previewtemplet) {
|
||||
this.previewtemplet = previewtemplet;
|
||||
}
|
||||
|
||||
public String getListblocktemplet() {
|
||||
return listblocktemplet;
|
||||
}
|
||||
|
||||
public void setListblocktemplet(String listblocktemplet) {
|
||||
this.listblocktemplet = listblocktemplet;
|
||||
}
|
||||
@Transient
|
||||
public boolean isUserpage() {
|
||||
return userpage;
|
||||
}
|
||||
public void setUserpage(boolean userpage) {
|
||||
this.userpage = userpage;
|
||||
}
|
||||
public String getDbid() {
|
||||
return dbid;
|
||||
}
|
||||
public void setDbid(String dbid) {
|
||||
this.dbid = dbid;
|
||||
}
|
||||
public String getTabledirid() {
|
||||
return tabledirid;
|
||||
}
|
||||
public void setTabledirid(String tabledirid) {
|
||||
this.tabledirid = tabledirid;
|
||||
}
|
||||
public String getCreater() {
|
||||
return creater;
|
||||
}
|
||||
public void setCreater(String creater) {
|
||||
this.creater = creater;
|
||||
}
|
||||
public String getCreatername() {
|
||||
return creatername;
|
||||
}
|
||||
public void setCreatername(String creatername) {
|
||||
this.creatername = creatername;
|
||||
}
|
||||
|
||||
public boolean isWorkflow() {
|
||||
return workflow;
|
||||
}
|
||||
|
||||
public void setWorkflow(boolean workflow) {
|
||||
this.workflow = workflow;
|
||||
}
|
||||
|
||||
public boolean isFromdb() {
|
||||
return fromdb;
|
||||
}
|
||||
|
||||
public void setFromdb(boolean fromdb) {
|
||||
this.fromdb = fromdb;
|
||||
}
|
||||
|
||||
public String getTabtype() {
|
||||
return tabtype;
|
||||
}
|
||||
|
||||
public void setTabtype(String tabtype) {
|
||||
this.tabtype = tabtype;
|
||||
}
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getSecmenuid() {
|
||||
return secmenuid;
|
||||
}
|
||||
|
||||
public void setSecmenuid(String secmenuid) {
|
||||
this.secmenuid = secmenuid;
|
||||
}
|
||||
|
||||
public String getReportid() {
|
||||
return reportid;
|
||||
}
|
||||
|
||||
public void setReportid(String reportid) {
|
||||
this.reportid = reportid;
|
||||
}
|
||||
|
||||
public boolean isTimeline() {
|
||||
return timeline;
|
||||
}
|
||||
|
||||
public void setTimeline(boolean timeline) {
|
||||
this.timeline = timeline;
|
||||
}
|
||||
|
||||
public String getEventname() {
|
||||
return eventname;
|
||||
}
|
||||
|
||||
public void setEventname(String eventname) {
|
||||
this.eventname = eventname;
|
||||
}
|
||||
|
||||
public int getTbversion() {
|
||||
return tbversion;
|
||||
}
|
||||
|
||||
public void setTbversion(int tbversion) {
|
||||
this.tbversion = tbversion;
|
||||
}
|
||||
|
||||
}
|
||||
76
src/main/java/com/beimi/web/model/Secret.java
Normal file
76
src/main/java/com/beimi/web/model/Secret.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package com.beimi.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
import org.hibernate.annotations.Proxy;
|
||||
|
||||
@Entity
|
||||
@Table(name="bm_secret")
|
||||
@Proxy(lazy=false)
|
||||
public class Secret implements java.io.Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String id ;
|
||||
private String creater ;
|
||||
private Date createtime ;
|
||||
private boolean enable ;
|
||||
private String orgi ;
|
||||
private String password ;
|
||||
private String model ;
|
||||
|
||||
@Id
|
||||
@Column(length=32)
|
||||
@GeneratedValue(generator="system-uuid")
|
||||
@GenericGenerator(name="system-uuid", strategy="uuid")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getCreater() {
|
||||
return creater;
|
||||
}
|
||||
public void setCreater(String creater) {
|
||||
this.creater = creater;
|
||||
}
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
public void setOrgi(String orgi) {
|
||||
this.orgi = orgi;
|
||||
}
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
public boolean isEnable() {
|
||||
return enable;
|
||||
}
|
||||
public void setEnable(boolean enable) {
|
||||
this.enable = enable;
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import javax.persistence.Table;
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
@Entity
|
||||
@Table(name = "uk_sysdic")
|
||||
@Table(name = "bm_sysdic")
|
||||
@org.hibernate.annotations.Proxy(lazy = false)
|
||||
public class SysDic implements java.io.Serializable {
|
||||
/**
|
||||
@@ -21,7 +21,7 @@ public class SysDic implements java.io.Serializable {
|
||||
private static final long serialVersionUID = 8699781935163431952L;
|
||||
private String id ;
|
||||
private String name ;
|
||||
private String title = "pub"; //改变用处, 变更为 CubeDic 的 目录类型, 个人文件夹 / 公共文件夹
|
||||
private String title = "pub";
|
||||
private String code ;
|
||||
private String orgi ;
|
||||
private String ctype ;
|
||||
@@ -41,7 +41,7 @@ public class SysDic implements java.io.Serializable {
|
||||
|
||||
private String menutype ; //菜单类型,顶部导航菜单, 左侧菜单
|
||||
|
||||
private String rules ; //角色要求 , 管理员 / 普通用户 / 多媒体坐席 / 呼叫中心坐席
|
||||
private String rules ; //角色要求
|
||||
|
||||
private String module ;
|
||||
private String url ;
|
||||
|
||||
453
src/main/java/com/beimi/web/model/TableProperties.java
Normal file
453
src/main/java/com/beimi/web/model/TableProperties.java
Normal file
@@ -0,0 +1,453 @@
|
||||
package com.beimi.web.model;
|
||||
|
||||
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
/**
|
||||
* @author jaddy0302 Rivulet TableProperties.java 2010-3-22
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "bm_tableproperties")
|
||||
@org.hibernate.annotations.Proxy(lazy = false)
|
||||
public class TableProperties implements java.io.Serializable,Cloneable{
|
||||
private static final long serialVersionUID = 3601436061896426576L;
|
||||
|
||||
|
||||
public TableProperties(){}
|
||||
public TableProperties(String fieldname , String datatypename , int datatypecode , String tablename){
|
||||
this(fieldname, datatypename, datatypecode, tablename, null , null , false) ;
|
||||
}
|
||||
|
||||
public TableProperties(String fieldname , String datatypename , int datatypecode , String tablename , String orgi , String tableid , boolean fieldstatus){
|
||||
this(fieldname, fieldname, datatypename, datatypecode, tablename, orgi, tableid, fieldstatus) ;
|
||||
}
|
||||
|
||||
public TableProperties(String fieldname , String datatypename , int datatypecode , String tablename , String orgi , String tableid , boolean fieldstatus , boolean token , String tokentype){
|
||||
this(fieldname, fieldname, datatypename, datatypecode, tablename, orgi, tableid, fieldstatus) ;
|
||||
this.token = token ;
|
||||
this.tokentype = tokentype ;
|
||||
}
|
||||
|
||||
public TableProperties(String title , String fieldname , String datatypename , int datatypecode , String tablename , String orgi , String tableid , boolean fieldstatus){
|
||||
if(fieldname!=null){
|
||||
fieldname = fieldname.toLowerCase() ;
|
||||
}
|
||||
if(tablename!=null){
|
||||
tablename = tablename.toLowerCase() ;
|
||||
}
|
||||
this.fieldname = fieldname ;
|
||||
this.name = title ;
|
||||
this.datatypecode = datatypecode ;
|
||||
this.datatypename = datatypename ;
|
||||
this.tablename = tablename;
|
||||
this.dbtableid = tableid ;
|
||||
this.fieldstatus = fieldstatus ;
|
||||
this.orgi = orgi ;
|
||||
}
|
||||
|
||||
private String id ;
|
||||
private String tablename ;
|
||||
private String dbtableid ;
|
||||
private String name ;
|
||||
private String code ;
|
||||
private String fieldname ;
|
||||
private int datatypecode ; //变更用处,修改为字段长度
|
||||
private String datatypename ;
|
||||
private String indexdatatype ;
|
||||
private String groupid ;
|
||||
private String userid ;
|
||||
private Boolean pk = false;
|
||||
private Boolean modits = false ;
|
||||
private String orgi ;
|
||||
private String viewtype;
|
||||
private int sortindex = 1;
|
||||
private boolean token ;
|
||||
private String tokentype ; //分词方式
|
||||
private boolean inx = true;
|
||||
private boolean title = false ;
|
||||
private boolean systemfield = false ; //变更用处,是否流程变量
|
||||
private int length = 255 ;
|
||||
private boolean fieldstatus ;
|
||||
private boolean seldata ;
|
||||
private String seldatatype ; //选择数据方式 : 字典数据 , 表数据 , 如果是表数据,则需要选择 表ID
|
||||
private String seldatacode ;
|
||||
private String seldatakey ;
|
||||
private String seldatavalue ;
|
||||
private String reftbid ;
|
||||
private String reftbname ;
|
||||
private String reftpid ;
|
||||
private String reftpname;
|
||||
private String reftype ;
|
||||
private String reftptitlefield ;
|
||||
private boolean defaultsort ; //是否默认排序字段
|
||||
private boolean descorder ; //默认倒叙排列
|
||||
private String defaultvalue ;
|
||||
private String defaultvaluetitle ;
|
||||
private String defaultfieldvalue ;
|
||||
private boolean multpartfile = true;
|
||||
private String uploadtype ;
|
||||
private String cascadetype;//级联删除 none不删除,deleteself删除主数据,deleteall删除关联数据
|
||||
private boolean impfield = false ;
|
||||
|
||||
private boolean reffk = false ; //是否外键关联
|
||||
/**
|
||||
* @return the id
|
||||
*/
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
/**
|
||||
* @param id the id to set
|
||||
*/
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
public void setOrgi(String orgi) {
|
||||
this.orgi = orgi;
|
||||
}
|
||||
/**
|
||||
* @return the name
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
/**
|
||||
* @param name the name to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
/**
|
||||
* @return the code
|
||||
*/
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
/**
|
||||
* @param code the code to set
|
||||
*/
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
/**
|
||||
* @return the fieldname
|
||||
*/
|
||||
public String getFieldname() {
|
||||
return fieldname!=null ? fieldname.toLowerCase() : null;
|
||||
}
|
||||
/**
|
||||
* @param fieldname the fieldname to set
|
||||
*/
|
||||
public void setFieldname(String fieldname) {
|
||||
this.fieldname = fieldname;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the datatypecode
|
||||
*/
|
||||
public int getDatatypecode() {
|
||||
return datatypecode;
|
||||
}
|
||||
/**
|
||||
* @param datatypecode the datatypecode to set
|
||||
*/
|
||||
public void setDatatypecode(int datatypecode) {
|
||||
this.datatypecode = datatypecode;
|
||||
}
|
||||
/**
|
||||
* @return the datatypename
|
||||
*/
|
||||
public String getDatatypename() {
|
||||
return datatypename;
|
||||
}
|
||||
/**
|
||||
* @param datatypename the datatypename to set
|
||||
*/
|
||||
public void setDatatypename(String datatypename) {
|
||||
this.datatypename = datatypename;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dbtableid
|
||||
*/
|
||||
public String getDbtableid() {
|
||||
return dbtableid;
|
||||
}
|
||||
/**
|
||||
* @param dbtableid the dbtableid to set
|
||||
*/
|
||||
public void setDbtableid(String dbtableid) {
|
||||
this.dbtableid = dbtableid;
|
||||
}
|
||||
/**
|
||||
* @return the indexdatatype
|
||||
*/
|
||||
public String getIndexdatatype() {
|
||||
return indexdatatype;
|
||||
}
|
||||
/**
|
||||
* @param indexdatatype the indexdatatype to set
|
||||
*/
|
||||
public void setIndexdatatype(String indexdatatype) {
|
||||
this.indexdatatype = indexdatatype;
|
||||
}
|
||||
/**
|
||||
* @return the groupid
|
||||
*/
|
||||
public String getGroupid() {
|
||||
return groupid;
|
||||
}
|
||||
/**
|
||||
* @param groupid the groupid to set
|
||||
*/
|
||||
public void setGroupid(String groupid) {
|
||||
this.groupid = groupid;
|
||||
}
|
||||
/**
|
||||
* @return the userid
|
||||
*/
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
/**
|
||||
* @param userid the userid to set
|
||||
*/
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
/**
|
||||
* @return the pk
|
||||
*/
|
||||
public Boolean getPk() {
|
||||
return pk;
|
||||
}
|
||||
/**
|
||||
* @param pk the pk to set
|
||||
*/
|
||||
public void setPk(Boolean pk) {
|
||||
this.pk = pk;
|
||||
}
|
||||
/**
|
||||
* @return the modits
|
||||
*/
|
||||
public Boolean getModits() {
|
||||
return modits;
|
||||
}
|
||||
/**
|
||||
* @param modits the modits to set
|
||||
*/
|
||||
public void setModits(Boolean modits) {
|
||||
this.modits = modits;
|
||||
}
|
||||
|
||||
public String getTablename() {
|
||||
return tablename;
|
||||
}
|
||||
public void setTablename(String tablename) {
|
||||
this.tablename = tablename;
|
||||
}
|
||||
public String getViewtype() {
|
||||
return viewtype;
|
||||
}
|
||||
public void setViewtype(String viewtype) {
|
||||
this.viewtype = viewtype;
|
||||
}
|
||||
public int getSortindex() {
|
||||
return sortindex;
|
||||
}
|
||||
public void setSortindex(int sortindex) {
|
||||
this.sortindex = sortindex;
|
||||
}
|
||||
public TableProperties clone(){
|
||||
try {
|
||||
return (TableProperties) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
public boolean isSystemfield() {
|
||||
return systemfield;
|
||||
}
|
||||
public void setSystemfield(boolean systemfield) {
|
||||
this.systemfield = systemfield;
|
||||
}
|
||||
public boolean isToken() {
|
||||
return token;
|
||||
}
|
||||
public void setToken(boolean token) {
|
||||
this.token = token;
|
||||
}
|
||||
public boolean isInx() {
|
||||
return inx;
|
||||
}
|
||||
public void setInx(boolean inx) {
|
||||
this.inx = inx;
|
||||
}
|
||||
public int getLength() {
|
||||
return length;
|
||||
}
|
||||
public void setLength(int length) {
|
||||
this.length = length;
|
||||
}
|
||||
public boolean isFieldstatus() {
|
||||
return fieldstatus;
|
||||
}
|
||||
public void setFieldstatus(boolean fieldstatus) {
|
||||
this.fieldstatus = fieldstatus;
|
||||
}
|
||||
public boolean isSeldata() {
|
||||
return seldata;
|
||||
}
|
||||
public void setSeldata(boolean seldata) {
|
||||
this.seldata = seldata;
|
||||
}
|
||||
public String getSeldatatype() {
|
||||
return seldatatype != null ? seldatatype : "";
|
||||
}
|
||||
public void setSeldatatype(String seldatatype) {
|
||||
this.seldatatype = seldatatype;
|
||||
}
|
||||
public String getSeldatacode() {
|
||||
return seldatacode;
|
||||
}
|
||||
public void setSeldatacode(String seldatacode) {
|
||||
this.seldatacode = seldatacode;
|
||||
}
|
||||
public String getSeldatakey() {
|
||||
return seldatakey;
|
||||
}
|
||||
public void setSeldatakey(String seldatakey) {
|
||||
this.seldatakey = seldatakey;
|
||||
}
|
||||
public String getSeldatavalue() {
|
||||
return seldatavalue;
|
||||
}
|
||||
public void setSeldatavalue(String seldatavalue) {
|
||||
this.seldatavalue = seldatavalue;
|
||||
}
|
||||
public String getReftbid() {
|
||||
return reftbid;
|
||||
}
|
||||
public void setReftbid(String reftbid) {
|
||||
this.reftbid = reftbid;
|
||||
}
|
||||
public String getReftpid() {
|
||||
return reftpid;
|
||||
}
|
||||
public void setReftpid(String reftpid) {
|
||||
this.reftpid = reftpid;
|
||||
}
|
||||
public String getReftype() {
|
||||
return reftype;
|
||||
}
|
||||
public void setReftype(String reftype) {
|
||||
this.reftype = reftype;
|
||||
}
|
||||
public String getReftbname() {
|
||||
return reftbname;
|
||||
}
|
||||
public void setReftbname(String reftbname) {
|
||||
this.reftbname = reftbname;
|
||||
}
|
||||
public String getReftpname() {
|
||||
return reftpname;
|
||||
}
|
||||
public void setReftpname(String reftpname) {
|
||||
this.reftpname = reftpname;
|
||||
}
|
||||
public String getReftptitlefield() {
|
||||
return reftptitlefield;
|
||||
}
|
||||
public void setReftptitlefield(String reftptitlefield) {
|
||||
this.reftptitlefield = reftptitlefield;
|
||||
}
|
||||
public boolean isReffk() {
|
||||
return reffk;
|
||||
}
|
||||
public void setReffk(boolean reffk) {
|
||||
this.reffk = reffk;
|
||||
}
|
||||
public boolean isDefaultsort() {
|
||||
return defaultsort;
|
||||
}
|
||||
public void setDefaultsort(boolean defaultsort) {
|
||||
this.defaultsort = defaultsort;
|
||||
}
|
||||
public String getDefaultvalue() {
|
||||
return defaultvalue;
|
||||
}
|
||||
public void setDefaultvalue(String defaultvalue) {
|
||||
this.defaultvalue = defaultvalue;
|
||||
}
|
||||
public String getDefaultvaluetitle() {
|
||||
return defaultvaluetitle;
|
||||
}
|
||||
public void setDefaultvaluetitle(String defaultvaluetitle) {
|
||||
this.defaultvaluetitle = defaultvaluetitle;
|
||||
}
|
||||
public String getDefaultfieldvalue() {
|
||||
return defaultfieldvalue;
|
||||
}
|
||||
public void setDefaultfieldvalue(String defaultfieldvalue) {
|
||||
this.defaultfieldvalue = defaultfieldvalue;
|
||||
}
|
||||
public boolean isMultpartfile() {
|
||||
return multpartfile;
|
||||
}
|
||||
public void setMultpartfile(boolean multpartfile) {
|
||||
this.multpartfile = multpartfile;
|
||||
}
|
||||
public String getUploadtype() {
|
||||
return uploadtype;
|
||||
}
|
||||
public void setUploadtype(String uploadtype) {
|
||||
this.uploadtype = uploadtype;
|
||||
}
|
||||
public String getCascadetype() {
|
||||
return cascadetype;
|
||||
}
|
||||
public void setCascadetype(String cascadetype) {
|
||||
this.cascadetype = cascadetype;
|
||||
}
|
||||
public boolean isTitle() {
|
||||
return title;
|
||||
}
|
||||
public void setTitle(boolean title) {
|
||||
this.title = title;
|
||||
}
|
||||
public boolean isDescorder() {
|
||||
return descorder;
|
||||
}
|
||||
public void setDescorder(boolean descorder) {
|
||||
this.descorder = descorder;
|
||||
}
|
||||
public String getTokentype() {
|
||||
return tokentype;
|
||||
}
|
||||
public void setTokentype(String tokentype) {
|
||||
this.tokentype = tokentype;
|
||||
}
|
||||
public boolean isImpfield() {
|
||||
return impfield;
|
||||
}
|
||||
public void setImpfield(boolean impfield) {
|
||||
this.impfield = impfield;
|
||||
}
|
||||
}
|
||||
131
src/main/java/com/beimi/web/model/Template.java
Normal file
131
src/main/java/com/beimi/web/model/Template.java
Normal file
@@ -0,0 +1,131 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package com.beimi.web.model;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
import org.hibernate.annotations.GenericGenerator;
|
||||
|
||||
/**
|
||||
* @author iceworld
|
||||
*
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "bm_templet")
|
||||
@org.hibernate.annotations.Proxy(lazy = false)
|
||||
public class Template implements java.io.Serializable{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 1946579239823440392L;
|
||||
private String id ;
|
||||
private String name ;
|
||||
private String code ;
|
||||
private String userid ;
|
||||
private String groupid ;
|
||||
private String description ;
|
||||
private String templettext ;
|
||||
private String templettype ; //List OR Preview
|
||||
private Date createtime = new Date();
|
||||
private String orgi ;
|
||||
private String iconstr; //模板图标
|
||||
private String memo ; //模板说明内容
|
||||
private String typeid;//分组id
|
||||
|
||||
|
||||
public String getOrgi() {
|
||||
return orgi;
|
||||
}
|
||||
public void setOrgi(String orgi) {
|
||||
this.orgi = orgi;
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(length = 32)
|
||||
@GeneratedValue(generator = "system-uuid")
|
||||
@GenericGenerator(name = "system-uuid", strategy = "uuid")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
public String getUserid() {
|
||||
return userid;
|
||||
}
|
||||
public void setUserid(String userid) {
|
||||
this.userid = userid;
|
||||
}
|
||||
public String getGroupid() {
|
||||
return groupid;
|
||||
}
|
||||
public void setGroupid(String groupid) {
|
||||
this.groupid = groupid;
|
||||
}
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
public String getTemplettext() {
|
||||
return templettext;
|
||||
}
|
||||
public void setTemplettext(String templettext) {
|
||||
this.templettext = templettext;
|
||||
}
|
||||
public Date getCreatetime() {
|
||||
return createtime;
|
||||
}
|
||||
public void setCreatetime(Date createtime) {
|
||||
this.createtime = createtime;
|
||||
}
|
||||
public String getTemplettype() {
|
||||
return templettype;
|
||||
}
|
||||
public void setTemplettype(String templettype) {
|
||||
this.templettype = templettype;
|
||||
}
|
||||
@Transient
|
||||
public String getTitle(){
|
||||
return this.groupid ;
|
||||
}
|
||||
public String getIconstr() {
|
||||
return iconstr;
|
||||
}
|
||||
public void setIconstr(String iconstr) {
|
||||
this.iconstr = iconstr;
|
||||
}
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
public String getTypeid() {
|
||||
return typeid;
|
||||
}
|
||||
public void setTypeid(String typeid) {
|
||||
this.typeid = typeid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.beimi.web.service.repository.jpa;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.beimi.web.model.AttachmentFile;
|
||||
|
||||
public abstract interface AttachmentRepository extends JpaRepository<AttachmentFile, String>{
|
||||
|
||||
public abstract AttachmentFile findByIdAndOrgi(String id ,String orgi);
|
||||
|
||||
public abstract List<AttachmentFile> findByDataidAndOrgi(String dataid , String orgi);
|
||||
|
||||
public abstract List<AttachmentFile> findByModelidAndOrgi(String modelid , String orgi);
|
||||
|
||||
public abstract Page<AttachmentFile> findByOrgi(String orgi , Pageable page);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.beimi.web.service.repository.jpa;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.beimi.web.model.Generation;
|
||||
|
||||
public abstract interface GenerationRepository extends JpaRepository<Generation, String>{
|
||||
public abstract Generation findByOrgiAndModel(String orgi , String model);
|
||||
public abstract List<Generation> findByOrgi(String orgi);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.beimi.web.service.repository.jpa;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.beimi.web.model.MetadataTable;
|
||||
|
||||
public abstract interface MetadataRepository extends JpaRepository<MetadataTable, String>{
|
||||
public abstract MetadataTable findById(String id);
|
||||
|
||||
public abstract MetadataTable findByTablename(String tablename);
|
||||
|
||||
public abstract Page<MetadataTable> findAll(Pageable paramPageable);
|
||||
|
||||
public abstract int countByTablename(String tableName) ;
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.beimi.web.service.repository.jpa;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.beimi.web.model.Secret;
|
||||
|
||||
public abstract interface SecretRepository extends JpaRepository<Secret, String>{
|
||||
public abstract List<Secret> findByOrgi(String orgi);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.beimi.web.service.repository.jpa;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.beimi.web.model.GameConfig;
|
||||
|
||||
public abstract interface SessionConfigRepository extends JpaRepository<GameConfig, String>
|
||||
{
|
||||
public abstract GameConfig findByOrgi(String orgi);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.beimi.web.service.repository.jpa;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.beimi.web.model.TableProperties;
|
||||
|
||||
public abstract interface TablePropertiesRepository extends JpaRepository<TableProperties, String>{
|
||||
|
||||
public abstract TableProperties findById(String id);
|
||||
|
||||
public abstract List<TableProperties> findByDbtableid(String dbtableid) ;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.beimi.web.service.repository.jpa;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.beimi.web.model.Template;
|
||||
|
||||
public interface TemplateRepository extends JpaRepository<Template, String> {
|
||||
|
||||
public Template findByIdAndOrgi(String id , String orgi);
|
||||
public List<Template> findByTemplettypeAndOrgi(String templettype , String orgi);
|
||||
public List<Template> findByOrgi(String orgi) ;
|
||||
}
|
||||
17
src/main/resources/config/rules/user.drl
Normal file
17
src/main/resources/config/rules/user.drl
Normal file
@@ -0,0 +1,17 @@
|
||||
//created on: 28.05.2015
|
||||
package beimi.user
|
||||
|
||||
//list any import classes here.
|
||||
import com.beimi.web.model.User
|
||||
|
||||
//declare any global variables here
|
||||
|
||||
|
||||
rule "test"
|
||||
salience 100
|
||||
lock-on-active true
|
||||
when
|
||||
$user:User(usertype != null)
|
||||
then
|
||||
System.out.println("Rule applied, men!");
|
||||
end
|
||||
96
src/main/resources/templates/admin/system/auth/event.html
Normal file
96
src/main/resources/templates/admin/system/auth/event.html
Normal file
@@ -0,0 +1,96 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/auth/save.html" data-toggle="ajax-form" data-close="true" method="post">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" value="${title!''}" required lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">代码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" required lay-verify="required" placeholder="请输入代码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单类型:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="mlevel" lay-verify="required">
|
||||
<option value="1">一级菜单</option>
|
||||
<option value="2">二级菜单</option>
|
||||
<option value="3">三级菜单</option>
|
||||
<option value="4">按钮或链接</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">菜单位置:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="menutype" lay-verify="required">
|
||||
<option value="left">左侧功能菜单</option>
|
||||
<option value="top">顶部导航菜单</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">上级菜单:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="parentid" required lay-verify="required" placeholder="请输入上级菜单代码或名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">样式:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="iconstr" value="${iconstr!''}" placeholder="请输入代码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">URL:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="url" value="${url!''}" placeholder="请输入代码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">模块 :</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="module">
|
||||
<option value="webim">WebIM</option>
|
||||
<option value="weixin">微信</option>
|
||||
<option value="workorder">工单</option>
|
||||
<option value="xiaoe">智能机器人</option>
|
||||
<option value="callcenter">呼叫中心</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色要求:</label>
|
||||
<div class="layui-input-inline" style="width:500px;">
|
||||
<input type="checkbox" name="rules" title="用户" lay-skin="primary">
|
||||
<input type="checkbox" name="rules" title="多媒体坐席" lay-skin="primary">
|
||||
<input type="checkbox" name="rules" title="语音坐席" lay-skin="primary">
|
||||
<input type="checkbox" name="rules" title="管理员" lay-skin="primary">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
238
src/main/resources/templates/admin/system/config/index.html
Normal file
238
src/main/resources/templates/admin/system/config/index.html
Normal file
@@ -0,0 +1,238 @@
|
||||
<form method="post" key="set-mine" enctype="multipart/form-data" action="/admin/config/save.html" class="layui-form">
|
||||
<#if systemConfig??><input type="hidden" name="id" value="${systemConfig.id!''}"></#if>
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="ukefu-customer-div setting-wrapper">
|
||||
<div class="box default-box">
|
||||
<div class="box-header">
|
||||
<h3 class="box-title">系统设置</h3>
|
||||
</div>
|
||||
<div class="box-body ukefu-im-theme">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<div class="ukefu-webim-prop">
|
||||
<div class="ukefu-webim-tl" style="clear:both;">1、系统颜色风格选择</div>
|
||||
<div class="box-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p>贝密游戏运营管理系统界面颜色风格</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">默认的配色是绿色,选择颜色可以在右侧预览风格,点击保存即可生效</p>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<select name="theme" lay-filter="sysconfig">
|
||||
<option value="01" <#if systemConfig?? && systemConfig.theme?? && systemConfig.theme == '01'>selected="selected"</#if>>绿色</option>
|
||||
<option value="02" <#if systemConfig?? && systemConfig.theme?? && systemConfig.theme == '02'>selected="selected"</#if>>黑色</option>
|
||||
<option value="03" <#if systemConfig?? && systemConfig.theme?? && systemConfig.theme == '03'>selected="selected"</#if>>蓝色</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ukefu-webim-prop">
|
||||
<div class="ukefu-webim-tl" style="clear:both;">2、重启或停止对话服务</div>
|
||||
<div class="box-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p>Netty SocketIO服务,服务端口:${webimport} , 状态:<#if imServerStatus?? && imServerStatus == true><small class="ukefu-label theme4">服务中</small><#else><small class="ukefu-label theme4" style="background-color:#FF5722;">已停止</small></#if></p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">建议通过界面停止或启动对话服务,避免出现端口被占用的问题</p>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<#if imServerStatus?? && imServerStatus == true>
|
||||
<a href="/admin/config/stopimserver.html" data-toggle="tip" <#if secret?? && secret.enable == true>data-confirm="请输入二次安全验证密码"</#if> title="停止对话服务后不能从Web界面再次启动,请确认是否退出?" class="layui-btn layui-btn-small layui-btn-danger">停止对话服务</a>
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ukefu-webim-prop">
|
||||
<div class="ukefu-webim-tl" style="clear:both;">3、停止优客服系统</div>
|
||||
<div class="box-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p>安全退出系统服务,停止服务调用JVM的退出指令</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">适用于Tomcat、Jetty等系统,WebLogic/WebSphere等中间件严禁使用</p>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<a href="/admin/config/stop.html" data-toggle="tip" <#if secret?? && secret.enable == true>data-confirm="请输入二次安全验证密码"</#if> title="停止服务将会调用JVM退出指令,请确认是否退出?" class="layui-btn layui-btn-small layui-btn-danger">停止服务</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ukefu-webim-prop">
|
||||
<div class="ukefu-webim-tl" style="clear:both;">4、修改微信接收消息的日志级别</div>
|
||||
<div class="box-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p>动态修改微信接收消息的日志级别</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">默认是INFO,调整到DEBUG能够方便微信消息排查错误</p>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<select name="loglevel" lay-filter="sysconfig">
|
||||
<option value="info" <#if systemConfig?? && systemConfig.loglevel?? && systemConfig.loglevel == 'debug'>selected="selected"</#if>>INFO</option>
|
||||
<option value="debug" <#if systemConfig?? && systemConfig.loglevel?? && systemConfig.loglevel == 'debug'>selected="selected"</#if>>DEBUG</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ukefu-webim-prop">
|
||||
<div class="ukefu-webim-tl" style="clear:both;">5、启用服务SSL安全访问</div>
|
||||
<div class="box-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p>启用SSL安全协议</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">启用后需要上传SSL证书和设置SSL证书密码</p>
|
||||
</div>
|
||||
<div class="col-lg-4" style="text-align:right;">
|
||||
<input type="checkbox" title="启用" name="enablessl" lay-filter="enablessl" value="1" <#if systemConfig.enablessl>checked="checked"</#if>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row httpsconfig" style="margin-top:20px;<#if systemConfig.enablessl == false>display:none;</#if>">
|
||||
<div class="col-lg-8">
|
||||
<p>
|
||||
JKS证书文件
|
||||
<span style="color:red;font-weight:bold;">${systemConfig.jksfile!''}</span>
|
||||
</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">受信的SSL证书文件,请上传.JKS类型的证书文件
|
||||
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-lg-4" style="text-align:right;">
|
||||
<span id="jkstip"></span>
|
||||
<div class="layui-box layui-upload-button">
|
||||
<input type="file" name="keyfile" accept=".jks" lay-ext="jks" class="layui-upload-file" onchange="$('#jkstip').html($(this).val());">
|
||||
<span class="layui-upload-icon"><i class="layui-icon"></i>上传JKS文件</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row httpsconfig" style="margin-top:20px;<#if systemConfig.enablessl == false>display:none;</#if>">
|
||||
<div class="col-lg-8">
|
||||
<p>JKS证书密码</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">.JKS文件的证书密码,<b style="color:red;font-weight:bold;">如无改变,不用填写</b></p>
|
||||
</div>
|
||||
<div class="col-lg-4" style="text-align:right;">
|
||||
<input type="password" name="jkspassword" value="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ukefu-webim-prop">
|
||||
<div class="ukefu-webim-tl" style="clear:both;">6、启用涉及重要操作的二次验证密码</div>
|
||||
<div class="box-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p>启用重要操作的二次密码验证</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">启用后重启服务器、关闭对话服务器和修改证书等操作将会进行二次安全验证</p>
|
||||
</div>
|
||||
<div class="col-lg-4" style="text-align:right;">
|
||||
<input type="checkbox" title="启用" name="enable" lay-filter="enable" value="1" <#if secret?? && secret.enable>checked="checked"</#if>>
|
||||
</div>
|
||||
</div>
|
||||
<#if secret?? && secret.enable == true>
|
||||
<div class="row elablesec" style="margin-top:20px;<#if secret?? && secret.enable == true><#else>display:none;</#if>">
|
||||
<div class="col-lg-8">
|
||||
<p>已设定的旧的密码</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">请填写已经保存的旧的密码,提交后会验证旧密码是否正确</p>
|
||||
</div>
|
||||
<div class="col-lg-4" style="text-align:right;">
|
||||
<input type="password" name="oldpass" id="oldpass" value="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</#if>
|
||||
<div class="row elablesec" style="margin-top:20px;<#if secret?? && secret.enable == true><#else>display:none;</#if>">
|
||||
<div class="col-lg-8">
|
||||
<p>安全操作的二次验证新密码</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">首次设置密码无需验证旧密码</p>
|
||||
</div>
|
||||
<div class="col-lg-4" style="text-align:right;">
|
||||
<input type="password" name="password" id="password" value="" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row elablesec" style="margin-top:20px;<#if secret?? && secret.enable == true><#else>display:none;</#if>">
|
||||
<div class="col-lg-8">
|
||||
<p>再次确认安全操作的二次验证新密码</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;"><b style="color:red;font-weight:bold;">请保证新密码两次输入相同 </b></p>
|
||||
</div>
|
||||
<div class="col-lg-4" style="text-align:right;">
|
||||
<input type="password" name="repassword" id="repassword" value="" lay-verify="pass" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ukefu-webim-prop">
|
||||
<div class="ukefu-webim-tl" style="clear:both;">7、百度地图的Key代码(AK)</div>
|
||||
<div class="box-item">
|
||||
<div class="row">
|
||||
<div class="col-lg-8">
|
||||
<p>用于调用百度地图的API</p>
|
||||
<p style="color:#888888;font-size:13px;margin-top:10px;">需要使用的API包括坐标转换和Javascript接口</p>
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
<input type="text" name="mapkey" value="${systemConfig.mapkey!''}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-lg-9">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-block">
|
||||
<button class="layui-btn" lay-submit="" lay-filter="formDemo">保存</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script language="javascript">
|
||||
<#if execute?? && execute == "false">
|
||||
top.layer.alert('二次 验证密码设置失败,输入的密码错误,请重新操作!', {icon: 2});
|
||||
</#if>
|
||||
<#if msg??>
|
||||
<#if msg == '1'>
|
||||
top.layer.alert('二次验证密码设置成功', {icon: 1});
|
||||
<#elseif msg == '2'>
|
||||
top.layer.alert('二次验证密码设置失败,请确认两次输入的密码一致', {icon: 2});
|
||||
<#elseif msg == '3'>
|
||||
top.layer.alert('二次验证密码设置失败,旧的密码验证失败,请输入正确的密码', {icon: 2});
|
||||
</#if>
|
||||
</#if>
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render('select'); //刷新select选择框渲染
|
||||
form.on("checkbox(enablessl)" , function(data){
|
||||
if(data.elem.checked == true){
|
||||
$('.httpsconfig').show();
|
||||
}else{
|
||||
$('.httpsconfig').hide();
|
||||
}
|
||||
})
|
||||
form.on("checkbox(enable)" , function(data){
|
||||
if(data.elem.checked == true){
|
||||
$('.elablesec').show();
|
||||
}else{
|
||||
$('.elablesec').hide();
|
||||
}
|
||||
})
|
||||
form.verify({
|
||||
pass:function(value){
|
||||
if(value != $('#password').val()){
|
||||
return "请确认两次输入密码相同" ;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
35
src/main/resources/templates/admin/system/metadata/edit.html
Normal file
35
src/main/resources/templates/admin/system/metadata/edit.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/metadata/update.html">
|
||||
<input type="hidden" name="id" value="${metadata.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">标题:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" value="${metadata.name!''}"
|
||||
required lay-verify="required" placeholder="标题"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,22 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/metadata/imptbsave.html">
|
||||
<input type="hidden" name="role" value="${role.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline">
|
||||
<select multiple = "multiple" name="tables" class="ukefu-form-multiple">
|
||||
<#if tablesList??>
|
||||
<#list tablesList as table>
|
||||
<option value="${table.name}">${table.name!''}</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
109
src/main/resources/templates/admin/system/metadata/index.html
Normal file
109
src/main/resources/templates/admin/system/metadata/index.html
Normal file
@@ -0,0 +1,109 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
元数据列表<#if sysDicList??>(${metadataList.totalElements!''})</#if>
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/metadata/imptb.html" data-toggle="ajax" data-width="550" data-title="创建新字典项">
|
||||
导入元数据
|
||||
</button>
|
||||
<a class="layui-btn layui-btn-small layui-btn-danger" href="javascript:void(0)" id="batdel" data-toggle="tip" data-title="删除数据表项同时会删除数据表元数据下的所有内容,请确认是否继续操作”?" title="删除数据表">
|
||||
批量删除
|
||||
</a>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="1%">
|
||||
<col width="35%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox" id="all" onclick="$('.ids').prop('checked' , $(this).prop('checked'));"/>
|
||||
</th>
|
||||
<th>中文名</th>
|
||||
<th>表名</th>
|
||||
<th>类型</th>
|
||||
<th>创建时间</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if metadataList?? && metadataList.content??>
|
||||
<#list metadataList.content as table>
|
||||
<tr>
|
||||
<td style="width:1%;">
|
||||
<input type="checkbox" class="ids" name="ids" value="${table.id!''}"/>
|
||||
</td>
|
||||
<td>
|
||||
<a href="/admin/metadata/table.html?id=${table.id!''}">
|
||||
${table.name!''}
|
||||
</a>
|
||||
</td>
|
||||
<td>${table.tablename!''} </td>
|
||||
<td><#if table.tabletype?? && table.tabletype == "1">数据表<#else>SQL</#if></td>
|
||||
<td><#if table.createtime??>${table.createtime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
|
||||
<td style="white-space:nowrap;width:1%;" nowrap="nowrap">
|
||||
<a href="/admin/metadata/edit.html?id=${table.id!''}&p=${metadataList.number+1}" data-width="550" data-height="200" data-toggle="ajax" title="编辑${table.name!''}">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<a href="/admin/metadata/delete.html?id=${table.id!''}&p=${metadataList.number+1}" data-toggle="tip" data-title="删除数据表项同时会删除数据表元数据下的所有内容,请确认是否删除数据表“${table.name!''}”?" title="删除${table.name!''}">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12" id="page" style="text-align:center;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#batdel').click(function(){
|
||||
var ids = "";
|
||||
$('.ids').each(function(){
|
||||
if($(this).prop("checked")){
|
||||
if(ids!=""){
|
||||
ids += "&" ;
|
||||
}
|
||||
ids += "ids=" + $(this).val();
|
||||
}
|
||||
});
|
||||
$('#batdel').attr('href' , '/admin/metadata/batdelete.html?'+ids) ;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
layui.use(['laypage', 'layer'], function(){
|
||||
var laypage = layui.laypage
|
||||
,layer = layui.layer;
|
||||
<#if msg??>
|
||||
top.layer.msg('${msg}');
|
||||
</#if>
|
||||
laypage({
|
||||
cont: 'page'
|
||||
,pages: <#if metadataList??>${metadataList.totalPages}<#else>0</#if> //总页数
|
||||
,curr:<#if metadataList??>${metadataList.number+1}<#else>0</#if>
|
||||
,groups: 5 //连续显示分页数
|
||||
,jump:function(data , first){
|
||||
if(!first){
|
||||
location.href = "/admin/metadata/index.html?p="+data.curr ;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,90 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
数据表结构列表<#if sysDicList??>(${propertiesList?size!''})</#if>
|
||||
<span style="float:right;">
|
||||
<a class="layui-btn layui-btn-small layui-btn-danger" href="javascript:void(0)" id="batdel" data-toggle="tip" data-title="删除数据表项同时会删除数据表元数据下的所有内容,请确认是否继续操作”?" title="删除数据表">
|
||||
批量删除
|
||||
</a>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="1%">
|
||||
<col width="20%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<input type="checkbox" id="all" onclick="$('.ids').prop('checked' , $(this).prop('checked'));"/>
|
||||
</th>
|
||||
<th>标题</th>
|
||||
<th>字段</th>
|
||||
<th>类型</th>
|
||||
<th>长度</th>
|
||||
<th>启用字典</th>
|
||||
<th>禁用导入导出</th>
|
||||
<th>流程变量</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if propertiesList??>
|
||||
<#list propertiesList as prop>
|
||||
<tr>
|
||||
<td style="width:1%;">
|
||||
<input type="checkbox" class="ids" name="ids" value="${prop.id!''}"/>
|
||||
</td>
|
||||
<td>
|
||||
${prop.name!''}
|
||||
</td>
|
||||
<td>${prop.fieldname!''} </td>
|
||||
<td>${prop.datatypename!''}</td>
|
||||
<td>${prop.length!''}</td>
|
||||
<td align="center"><#if prop.seldata == true><i class="layui-icon" title="${prop.seldatacode!''}" class="green"></#if></td>
|
||||
<td align="center"><#if prop.impfield == true><i class="layui-icon"></#if></td>
|
||||
<td align="center"><#if prop.systemfield == true><i class="layui-icon"></#if></td>
|
||||
<td style="white-space:nowrap;width:1%;" nowrap="nowrap">
|
||||
<a href="/admin/metadata/properties/edit.html?id=${prop.id!''}&p=${metadataList.number+1}" data-width="650" data-height="380" data-toggle="ajax" title="编辑${table.name!''}">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<a href="/admin/metadata/properties/delete.html?id=${prop.id!''}&tbid=${prop.dbtableid!''}" data-toggle="tip" data-title="删除数据表项同时会删除数据表元数据下的所有内容,请确认是否删除数据表“${prop.name!''}”?" title="删除${prop.name!''}">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
$(document).ready(function(){
|
||||
$('#batdel').click(function(){
|
||||
var ids = "";
|
||||
$('.ids').each(function(){
|
||||
if($(this).prop("checked")){
|
||||
if(ids!=""){
|
||||
ids += "&" ;
|
||||
}
|
||||
ids += "ids=" + $(this).val();
|
||||
}
|
||||
});
|
||||
$('#batdel').attr('href' , '/admin/metadata/properties/batdelete.html?tbid=${tbid!''}&'+ids) ;
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,78 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/metadata/properties/update.html">
|
||||
<input type="hidden" name="id" value="${tp.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">标题:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" value="${tp.name!''}"
|
||||
required lay-verify="required" placeholder="标题"
|
||||
autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">禁用导入导出:</label>
|
||||
<div class="layui-input-inline" style="line-height: 35px;width:80px;">
|
||||
<input type="checkbox" name="impfield" lay-skin="switch" value="1" <#if tp.impfield == true>checked="checked"</#if> lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">启用字典:</label>
|
||||
<div class="layui-input-inline" style="line-height: 35px;width:80px;">
|
||||
<input type="checkbox" name="seldata" lay-filter="dic" lay-skin="switch" value="1" <#if tp.seldata == true>checked="checked"</#if> lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" id="sysdicsel" style="<#if tp.seldata == false>display:none;</#if>">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">字典项:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="seldatacode" lay-ignore style="width:220px;">
|
||||
<option value="">请选择字典项</option>
|
||||
<#if sysdicList??>
|
||||
<#list sysdicList as sysDic>
|
||||
<option value="${sysDic.code!''}" <#if tp.seldatacode?? && tp.seldatacode == sysDic.code>selected="selected"</#if>>${sysDic.name}</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">启用流程变量:</label>
|
||||
<div class="layui-input-inline" style="line-height: 35px;width:80px;">
|
||||
<input type="checkbox" name="systemfield" lay-skin="switch" value="1" <#if tp.systemfield == true>checked="checked"</#if> lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.on("switch(dic)" , function(data){
|
||||
if(data.elem.checked){
|
||||
$("#sysdicsel").show();
|
||||
}else{
|
||||
$("#sysdicsel").hide();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1 @@
|
||||
${(systemStatics!'')?no_esc}
|
||||
32
src/main/resources/templates/admin/system/organ/add.html
Normal file
32
src/main/resources/templates/admin/system/organ/add.html
Normal file
@@ -0,0 +1,32 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/organ/save.html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">部门:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required"
|
||||
placeholder="请输入部门名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">启用技能组:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="skill" lay-skin="switch" value="1"
|
||||
lay-text="开启|关闭">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
});
|
||||
</script>
|
||||
29
src/main/resources/templates/admin/system/organ/auth.html
Normal file
29
src/main/resources/templates/admin/system/organ/auth.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/organ/auth/save.html">
|
||||
<input type="hidden" name="id" value="${organData.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">选择部门授权角色:</label>
|
||||
<div class="layui-input-block" style="padding-top:0px;">
|
||||
<#if roleList??>
|
||||
<#list roleList as role>
|
||||
<div><input type="checkbox" name="roles" value="${role.id!''}" title="${role.name!''}" lay-skin="primary" <#if organRoleList??><#list organRoleList as organRole><#if organRole.role?? && organRole.role.id == role.id>checked="checked"</#if></#list></#if>></div>
|
||||
</#list>
|
||||
<#else>
|
||||
<div><i>无角色信息</i></div>
|
||||
</#if>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<SCRIPT type="text/javascript">
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
});
|
||||
</SCRIPT>
|
||||
31
src/main/resources/templates/admin/system/organ/edit.html
Normal file
31
src/main/resources/templates/admin/system/organ/edit.html
Normal file
@@ -0,0 +1,31 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/organ/update.html">
|
||||
<input type="hidden" name="id" value="${organData.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">部门:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" value="${organData.name!''}" placeholder="请输入部门名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">启用技能组:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="skill" lay-skin="switch" lay-text="开启|关闭" value="1" <#if organData.skill>checked</#if>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
});
|
||||
</script>
|
||||
103
src/main/resources/templates/admin/system/organ/index.html
Normal file
103
src/main/resources/templates/admin/system/organ/index.html
Normal file
@@ -0,0 +1,103 @@
|
||||
<div class="row" style="height:100%;">
|
||||
<div class="col-lg-3" style="border-right:1px solid #e6e6e6;padding-right:0px;">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
组织机构
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/organ/add.html" data-toggle="ajax" data-height="200" data-width="550" data-title="创建新用户">
|
||||
创建部门
|
||||
</button>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<ul>
|
||||
<#if organList??>
|
||||
<#list organList as organ>
|
||||
<li class="uk_organ <#if organData?? && organData.id == organ.id>this</#if>">
|
||||
<a href="/admin/organ/index.html?organ=${organ.id!''}">
|
||||
<i class="layui-icon" style="position: relative;"></i>
|
||||
${organ.name!''}
|
||||
</a>
|
||||
<#if organ.skill>
|
||||
<dic class="uk_organ_skill" title="启用技能组">
|
||||
<i class="kfont"></i>
|
||||
</dic>
|
||||
</#if>
|
||||
</li>
|
||||
</#list>
|
||||
</#if>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
<#if organData??>${organData.name!''}<#else>默认机构</#if><#if userList??>(${userList?size!''})</#if>
|
||||
<span style="float:right;">
|
||||
<#if organData??>
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/organ/seluser.html?organ=${organData.id!''}" data-toggle="ajax" data-width="750" data-title="创建新用户">
|
||||
添加用户到当前部门
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-small" href="/admin/organ/edit.html?id=${organData.id}" data-toggle="ajax" data-width="550" data-height="200" data-title="修改坐席组">
|
||||
修改部门
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-small" href="/admin/organ/delete.html?id=${organData.id!''}" data-toggle="tip" data-title="请确认是否删除坐席组?">
|
||||
删除部门
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-danger layui-btn-small" href="/admin/organ/auth.html?id=${organData.id!''}" data-toggle="ajax" title="给机构授权角色" data-width="400" data-height="450">
|
||||
授权角色
|
||||
</button>
|
||||
</#if>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="30%">
|
||||
<col width="20%">
|
||||
<col width="25%">
|
||||
<col width="24%">
|
||||
<col width="1%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户</th>
|
||||
<th>姓名</th>
|
||||
<th>电子邮件</th>
|
||||
<th>手机</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if userList??>
|
||||
<#list userList as organUser>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="">
|
||||
${organUser.username!''}
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<td>${organUser.uname!''}</td>
|
||||
<td>${organUser.email!''}</td>
|
||||
<td>${organUser.mobile!''}</td>
|
||||
<td style="white-space: nowrap;">
|
||||
<a href="/admin/organ/user/delete.html?id=${organUser.id!''}&organ=${organData.id!''}" data-toggle="tip" data-title="请确认是否从坐席组中移除坐席?">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
移除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12" id="page" style="text-align:center;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
22
src/main/resources/templates/admin/system/organ/seluser.html
Normal file
22
src/main/resources/templates/admin/system/organ/seluser.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/organ/saveuser.html">
|
||||
<input type="hidden" name="organ" value="${organ.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline">
|
||||
<select multiple = "multiple" name="users" class="ukefu-form-multiple">
|
||||
<#if userList??>
|
||||
<#list userList as curruser>
|
||||
<option value="${curruser.id}" <#if curruser.organ?? && curruser.organ == organ.id>selected="selected"</#if>>${curruser.username!''}(${curruser.uname!''})</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
23
src/main/resources/templates/admin/system/role/add.html
Normal file
23
src/main/resources/templates/admin/system/role/add.html
Normal file
@@ -0,0 +1,23 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/role/save.html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">角色:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入角色名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
});
|
||||
</script>
|
||||
60
src/main/resources/templates/admin/system/role/auth.html
Normal file
60
src/main/resources/templates/admin/system/role/auth.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/role/auth/save.html">
|
||||
<input type="hidden" name="id" value="${role.id!''}">
|
||||
<input type="hidden" name="menus" id="menus" value="<#if roleAuthList??><#list roleAuthList as roleAuth><#if roleAuth_index gt 0>,</#if>${roleAuth.dicid!''}</#list></#if>">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline">
|
||||
<ul id="roleTree" class="ztree"></ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<SCRIPT type="text/javascript">
|
||||
var setting = {
|
||||
check: {
|
||||
enable: true
|
||||
},
|
||||
data: {
|
||||
simpleData: {
|
||||
enable: true
|
||||
}
|
||||
},
|
||||
callback: {
|
||||
onCheck: zTreeOnCheck
|
||||
}
|
||||
};
|
||||
|
||||
//获取所有选中节点的值
|
||||
function zTreeOnCheck() {
|
||||
var treeObj = $.fn.zTree.getZTreeObj("roleTree");
|
||||
var nodes = treeObj.getCheckedNodes(true);
|
||||
var msg = "";
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
if(msg!='' && nodes[i].id != ''){
|
||||
msg = msg+"," ;
|
||||
}
|
||||
msg += nodes[i].id;
|
||||
}
|
||||
$("#menus").val(msg);
|
||||
}
|
||||
|
||||
|
||||
var zNodes =[
|
||||
<#if sysDic??>{ id:'${sysDic.id!''}', pId:'0', name:"菜单资源", open:true , value : ""}</#if>
|
||||
<#if resourceList??>
|
||||
<#list resourceList as dic>
|
||||
,{ id:'${dic.id}', pId:'${dic.parentid!''}' <#if roleAuthList??><#list roleAuthList as roleAuth><#if roleAuth.dicid == dic.id>,checked:true</#if></#list></#if> , name:"${dic.name!''}" , value : "${dic.code!''}", open:true , icon : "<#if dic.level?? && (dic.level == '1' || dic.level == '2')>/images/dir.png<#else>/images/menu.png</#if>"}
|
||||
</#list>
|
||||
</#if>
|
||||
];
|
||||
|
||||
$(document).ready(function(){
|
||||
$.fn.zTree.init($("#roleTree"), setting, zNodes);
|
||||
});
|
||||
</SCRIPT>
|
||||
24
src/main/resources/templates/admin/system/role/edit.html
Normal file
24
src/main/resources/templates/admin/system/role/edit.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/role/update.html">
|
||||
<input type="hidden" name="id" value="${roleData.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">坐席组:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" value="${roleData.name!''}" placeholder="请输入坐席组名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
});
|
||||
</script>
|
||||
104
src/main/resources/templates/admin/system/role/index.html
Normal file
104
src/main/resources/templates/admin/system/role/index.html
Normal file
@@ -0,0 +1,104 @@
|
||||
<div class="row" style="height:100%;">
|
||||
<div class="col-lg-3" style="border-right:1px solid #e6e6e6;padding-right:0px;">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
角色列表
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/role/add.html" data-toggle="ajax" data-height="200" data-width="550" data-title="创建新用户">
|
||||
新建角色
|
||||
</button>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<ul>
|
||||
<#if roleList??>
|
||||
<#list roleList as role>
|
||||
<li class="uk_role <#if roleData?? && roleData.id == role.id>this</#if>">
|
||||
<a href="/admin/role/index.html?role=${role.id!''}">
|
||||
<i class="kfont"></i>
|
||||
${role.name!''}
|
||||
</a>
|
||||
</li>
|
||||
</#list>
|
||||
</#if>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
<#if roleData??>${roleData.name!''}<#else>角色</#if><#if userList??>(${userList?size!''})</#if>
|
||||
<span style="float:right;">
|
||||
<#if roleData??>
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/role/seluser.html?role=${roleData.id!''}" data-toggle="ajax" data-width="750" data-title="添加用户到角色">
|
||||
添加用户到角色
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-small" href="/admin/role/edit.html?id=${roleData.id}" data-toggle="ajax" data-width="550" data-height="200" data-title="修改角色">
|
||||
修改角色
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-primary layui-btn-small" href="/admin/role/delete.html?id=${roleData.id!''}" data-toggle="tip" data-title="请确认是否删除角色?">
|
||||
删除角色
|
||||
</button>
|
||||
<button class="layui-btn layui-btn-danger layui-btn-small" href="/admin/role/auth.html?id=${roleData.id}" data-toggle="ajax" title="角色授权" data-width="400" data-height="500">
|
||||
角色授权
|
||||
</button>
|
||||
</#if>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="30%">
|
||||
<col width="20%">
|
||||
<col width="25%">
|
||||
<col width="24%">
|
||||
<col width="1%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户</th>
|
||||
<th>姓名</th>
|
||||
<th>电子邮件</th>
|
||||
<th>手机</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if userRoleList?? && userRoleList.content??>
|
||||
<#list userRoleList.content as userRole>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="">
|
||||
<i class="layui-icon headimg"></i>
|
||||
<div style="margin-left:50px;margin-top:0px;">
|
||||
${userRole.user.username!''}
|
||||
<div style="color:#aaaaaa;font-size:12px;">
|
||||
${userRole.role.name!''}
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<td>${userRole.user.uname!''}</td>
|
||||
<td>${userRole.user.email!''}</td>
|
||||
<td>${userRole.user.mobile!''}</td>
|
||||
<td style="white-space: nowrap;">
|
||||
<a href="/admin/role/user/delete.html?id=${userRole.id!''}&role=${userRole.role.id!''}" data-toggle="tip" data-title="请确认是否移除?">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
移除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12" id="page" style="text-align:center;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
30
src/main/resources/templates/admin/system/role/seluser.html
Normal file
30
src/main/resources/templates/admin/system/role/seluser.html
Normal file
@@ -0,0 +1,30 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/role/saveuser.html">
|
||||
<input type="hidden" name="role" value="${role.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline">
|
||||
<select multiple = "multiple" name="users" class="ukefu-form-multiple">
|
||||
<#if userList??>
|
||||
<#list userList as curruser>
|
||||
<#assign has = false >
|
||||
<#if userRoleList??>
|
||||
<#list userRoleList as userRole>
|
||||
<#if userRole.user?? && userRole.user.id == curruser.id>
|
||||
<#assign has = true><#break/>
|
||||
</#if>
|
||||
</#list>
|
||||
</#if>
|
||||
<option value="${curruser.id}" <#if has == true>selected="selected"</#if>>${curruser.username!''}(${curruser.uname!''})</option>
|
||||
</#list>
|
||||
</#if>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
53
src/main/resources/templates/admin/system/sysdic/add.html
Normal file
53
src/main/resources/templates/admin/system/sysdic/add.html
Normal file
@@ -0,0 +1,53 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/sysdic/save.html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">代码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" required lay-verify="required" placeholder="请输入代码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">类型:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="ctype" lay-verify="">
|
||||
<option value="data">数据字典</option>
|
||||
<option value="auth">权限字典</option>
|
||||
<option value="resu">系统资源</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">说明:</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="description" placeholder="请输入" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
35
src/main/resources/templates/admin/system/sysdic/batadd.html
Normal file
35
src/main/resources/templates/admin/system/sysdic/batadd.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/sysdic/dicitem/batsave.html">
|
||||
<input type="hidden" name="parentid" value="${sysDic.id!''}">
|
||||
<input type="hidden" name="dicid" value="<#if sysDic.parentid?? && sysDic.parentid == '0'>${sysDic.id!''}<#else>${sysDic.dicid!''}</#if>">
|
||||
<input type="hidden" name="p" value="${p!'1'}">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline" style="width:95%;">
|
||||
<textarea name="content" required lay-verify="required" placeholder="请输入" class="layui-textarea" style="height:150px;"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-input-inline" style="width:95%;margin-top:20px;">
|
||||
<pre style="color:#AAAAAA;">
|
||||
文本中的每一行需要包含两个部分,字典项名称 和 字典项代码,两部分中间以空格或逗号隔开
|
||||
例如: 第一联系人 01
|
||||
第二联系人 02
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
});
|
||||
</script>
|
||||
140
src/main/resources/templates/admin/system/sysdic/dicitem.html
Normal file
140
src/main/resources/templates/admin/system/sysdic/dicitem.html
Normal file
@@ -0,0 +1,140 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
${sysDic.name} 字典项<#if sysDicList??>(${sysDicList.totalElements!''})</#if>
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/sysdic/dicitem/add.html?id=${sysDic.id!''}" data-toggle="ajax" data-width="550" data-height="450" data-title="创建新字典项">
|
||||
创建新字典项
|
||||
</button>
|
||||
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/sysdic/dicitem/batadd.html?id=${sysDic.id!''}" data-toggle="ajax" data-width="750" data-title="创建新字典项">
|
||||
批量创建字典项
|
||||
</button>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
<col width="10%">
|
||||
<col width="35%">
|
||||
<col width="10%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<#if sysDic?? && sysDic.ctype?? && sysDic.ctype == "auth">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>代码</th>
|
||||
<th>URL</th>
|
||||
<th>菜单级别</th>
|
||||
<th>样式</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if sysDicList?? && sysDicList.content??>
|
||||
<#list sysDicList.content as dic>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/admin/sysdic/dicitem.html?id=${dic.id!''}&dicid=${dic.id!''}">${dic.name!''}</a>
|
||||
</td>
|
||||
<td>${dic.code!''}</td>
|
||||
<td>${dic.url!''}</td>
|
||||
<td>
|
||||
<#if dic.level?? && dic.level == "1">一级菜单</#if>
|
||||
<#if dic.level?? && dic.level == "2">二级菜单</#if>
|
||||
<#if dic.level?? && dic.level == "3">三级菜单</#if>
|
||||
<#if dic.level?? && dic.level == "4">按钮或链接</#if>
|
||||
</td>
|
||||
<td><#if dic.iconstr??>${dic.iconstr}</#if></td>
|
||||
<td style="white-space:nowrap;" nowrap="nowrap">
|
||||
<a href="/admin/sysdic/dicitem/edit.html?id=${dic.id!''}&p=${sysDicList.number+1}" data-width="550" data-height="450" data-toggle="ajax" title="编辑${dic.name!''}">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<a href="/admin/sysdic/dicitem/delete.html?id=${dic.id!''}&p=${sysDicList.number+1}" data-toggle="tip" data-title="删除字典项同时会删除字典项下的所有子项,请确认是否删除字典项“${dic.name!''}”?" title="删除${dic.name!''}">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
<#else>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>代码</th>
|
||||
<th>图标</th>
|
||||
<th>显示代码</th>
|
||||
<th>创建时间</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if sysDicList?? && sysDicList.content??>
|
||||
<#list sysDicList.content as dic>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/admin/sysdic/dicitem.html?id=${dic.id!''}&dicid=${dic.id!''}">${dic.name!''}</a>
|
||||
</td>
|
||||
<td>${dic.code!''}</td>
|
||||
<td><#if dic.iconskin?? && dic.iconskin != ''>
|
||||
<small class="ukefu-label" style="background-color:${dic.iconskin!''};">
|
||||
<#if dic.iconstr?? && dic.iconstr != "">
|
||||
<i class="${dic.ctype!''}">${dic.iconstr?no_esc}</i>
|
||||
</#if>
|
||||
${dic.name!''}
|
||||
</small>
|
||||
</#if>
|
||||
</td>
|
||||
<td><#if dic.discode><i class="layui-icon" style="color:#19a55d;"></i></#if></td>
|
||||
<td><#if dic.createtime??>${dic.createtime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
|
||||
<td style="white-space:nowrap;" nowrap="nowrap">
|
||||
<a href="/admin/sysdic/dicitem/edit.html?id=${dic.id!''}&p=${sysDicList.number+1}" data-width="550" data-height="450" data-toggle="ajax" title="编辑${dic.name!''}">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<a href="/admin/sysdic/dicitem/delete.html?id=${dic.id!''}&p=${sysDicList.number+1}" data-toggle="tip" data-title="删除字典项同时会删除字典项下的所有子项,请确认是否删除字典项“${dic.name!''}”?" title="删除${dic.name!''}">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</#if>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12" id="page" style="text-align:center;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['laypage', 'layer'], function(){
|
||||
var laypage = layui.laypage
|
||||
,layer = layui.layer;
|
||||
<#if msg??>
|
||||
top.layer.msg('${msg}');
|
||||
</#if>
|
||||
laypage({
|
||||
cont: 'page'
|
||||
,pages: <#if sysDicList??>${sysDicList.totalPages}<#else>0</#if> //总页数
|
||||
,curr:<#if sysDicList??>${sysDicList.number+1}<#else>0</#if>
|
||||
,groups: 5 //连续显示分页数
|
||||
,jump:function(data , first){
|
||||
if(!first){
|
||||
location.href = "/admin/sysdic/dicitem.html?id=${sysDic.id!''}&p="+data.curr ;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,73 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/sysdic/dicitem/save.html">
|
||||
<input type="hidden" name="parentid" value="${sysDic.id!''}">
|
||||
<input type="hidden" name="dicid" value="<#if sysDic.parentid?? && sysDic.parentid == '0'>${sysDic.id!''}<#else>${sysDic.dicid!''}</#if>">
|
||||
<input type="hidden" name="p" value="${p!'1'}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">代码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" required lay-verify="required" placeholder="请输入代码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="iconstr" placeholder="请输入图标代码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标类型:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="ctype" lay-verify="">
|
||||
<option value="layui-icon">LayUI</option>
|
||||
<option value="kfont">KFont</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">颜色:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="iconskin" placeholder="请输入颜色" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">显示代码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" name="discode" lay-skin="switch" lay-text="启用|禁用" value="1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">说明:</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="description" placeholder="请输入" class="layui-textarea"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,74 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/sysdic/dicitem/update.html">
|
||||
<input type="hidden" name="id" value="${sysDic.id!''}">
|
||||
<input type="hidden" name="parentid" value="${sysDic.parentid!''}">
|
||||
<input type="hidden" name="dicid" value="<#if sysDic.parentid?? && sysDic.parentid == '0'>${sysDic.id!''}<#else>${sysDic.dicid!''}</#if>">
|
||||
<input type="hidden" name="p" value="${p!'1'}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input" value="${sysDic.name!''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">代码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" required lay-verify="required" placeholder="请输入代码" autocomplete="off" class="layui-input" value="${sysDic.code!''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="iconstr" value="${sysDic.iconstr!''}" placeholder="请输入图标代码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">图标类型:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="ctype" lay-verify="">
|
||||
<option value="layui-icon" <#if sysDic.ctype?? && sysDic.ctype == 'layui-icon'>selected="selected"</#if>>LayUI</option>
|
||||
<option value="kfont" <#if sysDic.ctype?? && sysDic.ctype == 'kfont'>selected="selected"</#if>>KFont</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">颜色:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="iconskin" placeholder="请输入颜色" value="${sysDic.iconskin!''}" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">显示代码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="checkbox" name="discode" lay-skin="switch" lay-text="启用|禁用" value="1" <#if sysDic.discode == true>checked</#if>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">说明:</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="description" placeholder="请输入" class="layui-textarea">${sysDic.description!''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
55
src/main/resources/templates/admin/system/sysdic/edit.html
Normal file
55
src/main/resources/templates/admin/system/sysdic/edit.html
Normal file
@@ -0,0 +1,55 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/sysdic/update.html">
|
||||
<input type="hidden" name="id" value="${sysDic.id!''}">
|
||||
<input type="hidden" name="p" value="${p!'1'}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入名称" autocomplete="off" class="layui-input" value="${sysDic.name!''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">代码:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="code" required lay-verify="required" placeholder="请输入代码" autocomplete="off" class="layui-input" value="${sysDic.code!''}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">类型:</label>
|
||||
<div class="layui-input-inline">
|
||||
<select name="ctype" lay-verify="">
|
||||
<option value="data" <#if sysDic.ctype?? && sysDic.ctype == 'data'>selected="selected"</#if>>数据字典</option>
|
||||
<option value="auth" <#if sysDic.ctype?? && sysDic.ctype == 'auth'>selected="selected"</#if>>权限字典</option>
|
||||
<option value="resu" <#if sysDic.ctype?? && sysDic.ctype == 'resu'>selected="selected"</#if>>系统资源</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">说明:</label>
|
||||
<div class="layui-input-inline">
|
||||
<textarea name="description" placeholder="请输入" class="layui-textarea">${sysDic.description!''}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
90
src/main/resources/templates/admin/system/sysdic/index.html
Normal file
90
src/main/resources/templates/admin/system/sysdic/index.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
系统数据字典列表<#if sysDicList??>(${sysDicList.totalElements!''})</#if>
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/sysdic/add.html" data-toggle="ajax" data-width="550" data-title="创建新字典项">
|
||||
创建新字典项
|
||||
</button>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="20%">
|
||||
<col width="20%">
|
||||
<col width="13%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>名称</th>
|
||||
<th>代码</th>
|
||||
<th>系统字典</th>
|
||||
<th>说明</th>
|
||||
<th>创建时间</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if sysDicList?? && sysDicList.content??>
|
||||
<#list sysDicList.content as dic>
|
||||
<tr>
|
||||
<td>
|
||||
<#if dic.haschild?? && dic.haschild>
|
||||
<a href="/admin/sysdic/dicitem.html?id=${dic.id!''}&dicid=${dic.id!''}">${dic.name!''}</a>
|
||||
<#else>
|
||||
${dic.name!''}
|
||||
</#if>
|
||||
|
||||
</td>
|
||||
<td>${dic.code!''}</td>
|
||||
<td><#if dic.ctype?? && dic.ctype == "data">数据字典<#elseif dic.ctype?? && dic.ctype == "auth">权限字典<#elseif dic.ctype?? && dic.ctype == "resu">系统资源</#if></td>
|
||||
<td>${dic.description!''}</td>
|
||||
<td><#if dic.createtime??>${dic.createtime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
|
||||
<td style="white-space:nowrap;" nowrap="nowrap">
|
||||
<a href="/admin/sysdic/edit.html?id=${dic.id!''}&p=${sysDicList.number+1}" data-width="550" data-toggle="ajax" title="编辑${dic.name!''}">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<a href="/admin/sysdic/delete.html?id=${dic.id!''}&p=${sysDicList.number+1}" data-toggle="tip" data-title="删除字典项同时会删除字典项下的所有子项,请确认是否删除字典项“${dic.name!''}”?" title="删除${dic.name!''}">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12" id="page" style="text-align:center;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['laypage', 'layer'], function(){
|
||||
var laypage = layui.laypage
|
||||
,layer = layui.layer;
|
||||
<#if msg??>
|
||||
top.layer.msg('${msg}');
|
||||
</#if>
|
||||
laypage({
|
||||
cont: 'page'
|
||||
,pages: <#if sysDicList??>${sysDicList.totalPages}<#else>0</#if> //总页数
|
||||
,curr:<#if sysDicList??>${sysDicList.number+1}<#else>0</#if>
|
||||
,groups: 5 //连续显示分页数
|
||||
,jump:function(data , first){
|
||||
if(!first){
|
||||
location.href = "/admin/sysdic/index.html?p="+data.curr ;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
28
src/main/resources/templates/admin/system/template/add.html
Normal file
28
src/main/resources/templates/admin/system/template/add.html
Normal file
@@ -0,0 +1,28 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/template/save.html">
|
||||
<input type="hidden" name="templettype" value="${sysDic.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">模板名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" required lay-verify="required" placeholder="请输入模板名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">
|
||||
<font color="red">*</font>
|
||||
模板名称,请使用字母填写
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render();
|
||||
});
|
||||
</script>
|
||||
29
src/main/resources/templates/admin/system/template/code.html
Normal file
29
src/main/resources/templates/admin/system/template/code.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/template/codesave.html">
|
||||
<input type="hidden" name="templettype" value="${sysDic.id!''}">
|
||||
<input type="hidden" name="id" value="${template.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<textarea name="templettext" id="templettext" style="display:none;">${template.templettext!''}</textarea>
|
||||
<div id="editor">${template.templettext!''}</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script language="javascript">
|
||||
$(document).ready(function(){
|
||||
var editor = ace.edit("editor");
|
||||
editor.setTheme("ace/theme/chrome");
|
||||
editor.getSession().setMode("ace/mode/xml");
|
||||
var textarea = $("#templettext");
|
||||
editor.getSession().on("change", function () {
|
||||
textarea.val(editor.getSession().getValue());
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
29
src/main/resources/templates/admin/system/template/edit.html
Normal file
29
src/main/resources/templates/admin/system/template/edit.html
Normal file
@@ -0,0 +1,29 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/template/update.html">
|
||||
<input type="hidden" name="templettype" value="${sysDic.id!''}">
|
||||
<input type="hidden" name="id" value="${template.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">模板名称:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="name" value="${template.name!''}" required lay-verify="required" placeholder="请输入模板名称" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">
|
||||
<font color="red">*</font>
|
||||
模板名称,请使用字母填写
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render();
|
||||
});
|
||||
</script>
|
||||
45
src/main/resources/templates/admin/system/template/imp.html
Normal file
45
src/main/resources/templates/admin/system/template/imp.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form" action="/admin/template/impsave.html" enctype="multipart/form-data" method="post">
|
||||
<div class="layui-form-item">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label">数据文件:</label>
|
||||
<div class="layui-input-inline">
|
||||
<div class="layui-box layui-upload-button">
|
||||
<input type="file" name="dataFile" required lay-verify="required"
|
||||
class="layui-upload-file"
|
||||
onchange="$('#dataFile').html($(this).val());"> <span
|
||||
class="layui-upload-icon"><i class="layui-icon"></i>上传系统模板数据文件</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-inline">
|
||||
<font color="red">*(必填项)</font> (需要导入的系统模板数据文件,data格式文件)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item" style="height:40px;line-height:40px;">
|
||||
<div class="layui-inline">
|
||||
<label class="layui-form-label"></label>
|
||||
<div class="layui-input-inline" style="width:500px;" id="dataFile">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即导入</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
layui.use('upload', function(){
|
||||
var target = $(this).attr("data-target");
|
||||
});
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render();
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,49 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
系统模板
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/template/imp.html" data-toggle="ajax" data-width="750" data-height="220" data-title="导入系统模板">
|
||||
<i class="kfont"></i>
|
||||
导入系统模板
|
||||
</button>
|
||||
<a class="layui-btn layui-btn-small green" href="/admin/template/expall.html" target="_blank">
|
||||
<i class="kfont"></i>
|
||||
导出系统模板
|
||||
</a>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="15%">
|
||||
<col width="20%">
|
||||
<col width="20%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>分类名称</th>
|
||||
<th>分类代码</th>
|
||||
<th>创建时间</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if sysDicList??>
|
||||
<#list sysDicList as dic>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/admin/template/list.html?type=${dic.id!''}">${dic.name!''}</a>
|
||||
</td>
|
||||
<td>${dic.code!''}</td>
|
||||
<td><#if dic.createtime??>${dic.createtime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
60
src/main/resources/templates/admin/system/template/list.html
Normal file
60
src/main/resources/templates/admin/system/template/list.html
Normal file
@@ -0,0 +1,60 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
${sysDic.name!''} 分类模板
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/template/add.html?type=${sysDic.id!''}" data-toggle="ajax" data-width="700" data-height="220" data-title="创建新模板">
|
||||
创建新模板
|
||||
</button>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="15%">
|
||||
<col width="20%">
|
||||
<col width="10%">
|
||||
<col width="1%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>模板名称</th>
|
||||
<th>创建时间</th>
|
||||
<th>模板内容</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if templateList??>
|
||||
<#list templateList as template>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="/admin/template/code.html?type=${sysDic.id!''}&id=${template.id!''}" data-width="750" data-height="450" data-toggle="ajax" title="编辑${template.name!''}">${template.name!''}</a>
|
||||
</td>
|
||||
<td><#if template.createtime??>${template.createtime?string("yyyy-MM-dd HH:mm:ss")}</#if></td>
|
||||
<td>
|
||||
<#if template.templettext??>
|
||||
<i class="layui-icon" style="color:#19a55d;"></i>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="white-space:nowrap;" nowrap="nowrap">
|
||||
<a href="/admin/template/edit.html?type=${sysDic.id!''}&id=${template.id!''}" data-width="750" data-height="220" data-toggle="ajax" title="编辑${template.name!''}">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<a href="/admin/template/delete.html?templettype=${sysDic.id!''}&id=${template.id!''}" data-toggle="tip" data-title="请确认是否系统模板“${template.name!''}”?">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
67
src/main/resources/templates/admin/system/user/add.html
Normal file
67
src/main/resources/templates/admin/system/user/add.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/user/save.html">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户名:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="username" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">用户登录的账号</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">姓名:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="uname" required lay-verify="required" placeholder="请输入用户姓名" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">电子邮件</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="email" name="email" required lay-verify="required email" placeholder="请输入电子邮件地址" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="password" name="password" required lay-verify="required" placeholder="请输入登录密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">
|
||||
<input type="password" id="repassword" name="repassword" required lay-verify="repass" placeholder="请再次输入密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="mobile" name="mobile" required lay-verify="required|phone" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">管理员:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="admin" lay-skin="switch" value="1" lay-text="是|否">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
66
src/main/resources/templates/admin/system/user/edit.html
Normal file
66
src/main/resources/templates/admin/system/user/edit.html
Normal file
@@ -0,0 +1,66 @@
|
||||
<div class="uk-layui-form">
|
||||
<form class="layui-form uk-form" action="/admin/user/update.html">
|
||||
<input type="hidden" name="id" value="${userData.id!''}">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">用户名:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="username" value="${userData.username!''}" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">用户登录的账号</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">姓名:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="text" name="uname" value="${userData.uname!''}" required lay-verify="required" placeholder="请输入用户姓名" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">电子邮件</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="email" name="email" value="${userData.email!''}" required lay-verify="required email" placeholder="请输入电子邮件地址" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">密码</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="password" id="password" name="password" placeholder="请输入登录密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
<div class="layui-form-mid layui-word-aux">
|
||||
<input type="password" id="repassword" name="repassword" lay-verify="repass" placeholder="请再次输入密码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">手机号:</label>
|
||||
<div class="layui-input-inline">
|
||||
<input type="mobile" name="mobile" value="${userData.mobile!''}" required lay-verify="required|phone" placeholder="请输入手机号码" autocomplete="off" class="layui-input">
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">管理员:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="checkbox" name="admin" lay-skin="switch" value="1" lay-text="是|否" <#if userData.usertype == "0">checked="checked"</#if>>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-form-button">
|
||||
<div class="layui-button-block">
|
||||
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
|
||||
<button type="reset" class="layui-btn layui-btn-primary">重置</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
//Demo
|
||||
layui.use('form', function(){
|
||||
var form = layui.form();
|
||||
form.render(); //更新全部
|
||||
form.verify({
|
||||
repass: function(value){
|
||||
if(value != $('#password').val()){
|
||||
return '两次输入的密码不一致,请确认';
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
100
src/main/resources/templates/admin/system/user/index.html
Normal file
100
src/main/resources/templates/admin/system/user/index.html
Normal file
@@ -0,0 +1,100 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<h1 class="site-h1" style="background-color:#FFFFFF;">
|
||||
用户列表<#if userList??>(${userList.totalElements!''})</#if>
|
||||
<span style="float:right;">
|
||||
<button class="layui-btn layui-btn-small green" href="/admin/user/add.html" data-toggle="ajax" data-width="750" data-height="450" data-title="创建新用户">
|
||||
创建新用户
|
||||
</button>
|
||||
</span>
|
||||
</h1>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12">
|
||||
<table class="layui-table" lay-skin="line">
|
||||
<colgroup>
|
||||
<col width="20%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="15%">
|
||||
<col width="10%">
|
||||
<col width="1%">
|
||||
<col>
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户</th>
|
||||
<th>姓名</th>
|
||||
<th>电子邮件</th>
|
||||
<th>手机</th>
|
||||
<th>管理员</th>
|
||||
<th style="white-space:nowrap;" nowrap="nowrap">操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<#if userList?? && userList.content??>
|
||||
<#list userList.content as user>
|
||||
<tr>
|
||||
<td>
|
||||
<a href="">
|
||||
<i class="layui-icon headimg"></i>
|
||||
<div style="margin-left:50px;margin-top:0px;">
|
||||
${user.username!''}
|
||||
<#if user.datastatus == true><i style="color:red;">(已删除)</i></#if>
|
||||
</div>
|
||||
<div title="注册时间" style="margin-left:50px;margin-top:0px;color:#cccccc;font-size:13px;">
|
||||
${user.createtime!''}
|
||||
</div>
|
||||
|
||||
</a>
|
||||
|
||||
</td>
|
||||
<td>${user.uname!''}</td>
|
||||
<td>${user.email!''}</td>
|
||||
<td>${user.mobile!''}</td>
|
||||
<td>
|
||||
<#if user.usertype?? && user.usertype =="0">
|
||||
<i class="layui-icon" style="color:#19a55d;"></i>
|
||||
</#if>
|
||||
</td>
|
||||
<td style="white-space:nowrap;" nowrap="nowrap">
|
||||
<a href="/admin/user/edit.html?id=${user.id!''}" data-toggle="ajax" data-width="750" data-height="450" data-title="编辑用户信息">
|
||||
<i class="layui-icon"></i>
|
||||
编辑
|
||||
</a>
|
||||
<#if !(user.usertype?? && user.usertype == "0") && user.datastatus != true >
|
||||
<a href="/admin/user/delete.html?id=${user.id!''}" style="margin-left:10px;" data-toggle="tip" data-title="请确认是否删除记录?">
|
||||
<i class="layui-icon" style="color:red;">ဆ</i>
|
||||
删除
|
||||
</a>
|
||||
</#if>
|
||||
</td>
|
||||
</tr>
|
||||
</#list>
|
||||
</#if>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="padding:5px;">
|
||||
<div class="col-lg-12" id="page" style="text-align:center;"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
layui.use(['laypage', 'layer'], function(){
|
||||
var laypage = layui.laypage
|
||||
,layer = layui.layer;
|
||||
|
||||
laypage({
|
||||
cont: 'page'
|
||||
,pages: <#if userList??>${userList.totalPages}<#else>0</#if> //总页数
|
||||
,curr:<#if userList??>${userList.number+1}<#else>0</#if>
|
||||
,groups: 5 //连续显示分页数
|
||||
,jump:function(data , first){
|
||||
if(!first){
|
||||
location.href = "/admin/user/index.html?p="+data.curr ;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
Reference in New Issue
Block a user