Browse Source

使用spring boot

sunyj 9 years ago
parent
commit
137a0c17d0
33 changed files with 904 additions and 744 deletions
  1. 63 81
      pom.xml
  2. 43 0
      src/main/java/com/uas/report/Application.java
  3. 26 0
      src/main/java/com/uas/report/CacheConfiguration.java
  4. 16 13
      src/main/java/com/uas/report/JasperserverRestAPIProperties.java
  5. 113 0
      src/main/java/com/uas/report/SpecialProperties.java
  6. 71 0
      src/main/java/com/uas/report/SystemProperties.java
  7. 110 0
      src/main/java/com/uas/report/WebAppConfiguration.java
  8. 3 2
      src/main/java/com/uas/report/aop/WebLogAspect.java
  9. 8 8
      src/main/java/com/uas/report/controller/PrintController.java
  10. 3 2
      src/main/java/com/uas/report/core/advice/ExceptionHandlerAdvice.java
  11. 3 2
      src/main/java/com/uas/report/schedule/service/impl/TaskServiceImpl.java
  12. 16 15
      src/main/java/com/uas/report/service/impl/FileServiceImpl.java
  13. 6 5
      src/main/java/com/uas/report/service/impl/PrintServiceImpl.java
  14. 17 16
      src/main/java/com/uas/report/service/impl/ResourceServiceImpl.java
  15. 0 19
      src/main/java/com/uas/report/support/ApplicationContextRegister.java
  16. 0 51
      src/main/java/com/uas/report/support/StartupProcessor.java
  17. 0 153
      src/main/java/com/uas/report/support/SysConf.java
  18. 9 5
      src/main/java/com/uas/report/util/ContextUtils.java
  19. 29 77
      src/main/java/com/uas/report/util/DataSourceUtils.java
  20. 3 2
      src/main/java/com/uas/report/util/FileUtils.java
  21. 5 4
      src/main/java/com/uas/report/util/ReportConstants.java
  22. 3 2
      src/main/java/com/uas/report/util/ZipUtils.java
  23. 3 2
      src/main/java/service/MyService.java
  24. 32 0
      src/main/resources/bootstrap.yml
  25. 44 0
      src/main/resources/logback.xml
  26. 0 34
      src/main/resources/spring/applicationContext.xml
  27. 8 0
      src/main/resources/spring/ehcache.xml
  28. 270 0
      src/main/resources/spring/ehcache.xsd
  29. 0 14
      src/main/resources/spring/js-rest-api.properties
  30. 0 15
      src/main/resources/spring/logging.properties
  31. 0 23
      src/main/webapp/WEB-INF/log4j.properties
  32. 0 147
      src/main/webapp/WEB-INF/web.xml
  33. 0 52
      src/main/webapp/WEB-INF/webmvc.xml

+ 63 - 81
pom.xml

@@ -1,68 +1,67 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 	<modelVersion>4.0.0</modelVersion>
+	<parent>
+		<groupId>org.springframework.boot</groupId>
+		<artifactId>spring-boot-starter-parent</artifactId>
+		<version>1.4.1.RELEASE</version>
+	</parent>
 	<groupId>com.uas.report</groupId>
 	<artifactId>report</artifactId>
-	<packaging>war</packaging>
+	<packaging>jar</packaging>
 	<version>0.0.1-SNAPSHOT</version>
 	<name>report Maven Webapp</name>
 	<url>http://maven.apache.org</url>
 
-	<profiles>
-		<!-- 开发环境 -->
-		<profile>
-			<id>dev</id>
-			<properties>
-				<profile>dev</profile>
-			</properties>
-			<activation>
-				<activeByDefault>true</activeByDefault>
-			</activation>
-		</profile>
-		<!-- 测试环境 -->
-		<profile>
-			<id>test</id>
-			<properties>
-				<profile>test</profile>
-			</properties>
-		</profile>
-		<!-- 正式环境 -->
-		<profile>
-			<id>prod</id>
-			<properties>
-				<profile>prod</profile>
-			</properties>
-		</profile>
-	</profiles>
-
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<springframeword.cloud.version>1.2.1.RELEASE</springframeword.cloud.version>
 		<oracle.jdbc.version>11.2.0</oracle.jdbc.version>
-		<spring.version>4.1.6.RELEASE</spring.version>
-		<log4j.version>1.2.16</log4j.version>
 		<servlet.version>3.0-alpha-1</servlet.version>
-		<commons.dbcp.version>1.4</commons.dbcp.version>
 		<druid.version>1.0.24</druid.version>
 		<jasperreports.version>6.3.0</jasperreports.version>
-		<groovy.version>2.4.7</groovy.version>
 		<poi.version>3.10.1</poi.version>
 		<commons.fileupload.version>1.3.2</commons.fileupload.version>
-		<fastjson.version>1.1.39</fastjson.version>
-		<httpclient.version>4.5.2</httpclient.version>
-		<aspectjweaver.version>1.8.9</aspectjweaver.version>
+		<fastjson.version>1.2.15</fastjson.version>
 		<axis.version>1.4</axis.version>
-		<wsdl4j.version>1.6.3</wsdl4j.version>
 		<commons.discovery.version>0.2</commons.discovery.version>
-		<dom4j.version>1.6.1</dom4j.version>
-		<jaxen.version>1.1.6</jaxen.version>
 	</properties>
 
 	<dependencies>
 		<dependency>
-			<groupId>junit</groupId>
-			<artifactId>junit</artifactId>
-			<version>3.8.1</version>
-			<scope>test</scope>
+			<groupId>org.springframework.cloud</groupId>
+			<artifactId>spring-cloud-starter-config</artifactId>
+			<version>${springframeword.cloud.version}</version>
+		</dependency>
+		<!-- spring boot -->
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-actuator</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context-support</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-tx</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-webmvc</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>org.aspectj</groupId>
+			<artifactId>aspectjweaver</artifactId>
+		</dependency>
+
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-ehcache</artifactId>
 		</dependency>
 
 		<dependency>
@@ -77,21 +76,11 @@
 			<artifactId>druid</artifactId>
 			<version>${druid.version}</version>
 		</dependency>
-
-		<!-- log4j -->
 		<dependency>
-			<groupId>log4j</groupId>
-			<artifactId>log4j</artifactId>
-			<version>${log4j.version}</version>
-		</dependency>
-
-		<!-- spring-webmvc -->
-		<dependency>
-			<groupId>org.springframework</groupId>
-			<artifactId>spring-webmvc</artifactId>
-			<version>${spring.version}</version>
+			<groupId>com.alibaba</groupId>
+			<artifactId>fastjson</artifactId>
+			<version>${fastjson.version}</version>
 		</dependency>
-
 		<dependency>
 			<groupId>com.oracle</groupId>
 			<artifactId>ojdbc6</artifactId>
@@ -112,7 +101,6 @@
 		<dependency>
 			<groupId>org.codehaus.groovy</groupId>
 			<artifactId>groovy-all</artifactId>
-			<version>${groovy.version}</version>
 		</dependency>
 		<!-- 导出xls报表 -->
 		<dependency>
@@ -134,23 +122,10 @@
 			<artifactId>commons-fileupload</artifactId>
 			<version>${commons.fileupload.version}</version>
 		</dependency>
-		<dependency>
-			<groupId>com.alibaba</groupId>
-			<artifactId>fastjson</artifactId>
-			<version>${fastjson.version}</version>
-		</dependency>
 		<!-- HTTP请求 -->
 		<dependency>
 			<groupId>org.apache.httpcomponents</groupId>
 			<artifactId>httpclient</artifactId>
-			<version>${httpclient.version}</version>
-		</dependency>
-
-		<!-- aspectjweaver -->
-		<dependency>
-			<groupId>org.aspectj</groupId>
-			<artifactId>aspectjweaver</artifactId>
-			<version>${aspectjweaver.version}</version>
 		</dependency>
 
 		<!-- axis web service -->
@@ -182,43 +157,50 @@
 		<dependency>
 			<groupId>wsdl4j</groupId>
 			<artifactId>wsdl4j</artifactId>
-			<version>${wsdl4j.version}</version>
 		</dependency>
 
 		<!-- dom4j -->
 		<dependency>
 			<groupId>dom4j</groupId>
 			<artifactId>dom4j</artifactId>
-			<version>${dom4j.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>jaxen</groupId>
 			<artifactId>jaxen</artifactId>
-			<version>${jaxen.version}</version>
 		</dependency>
 	</dependencies>
 
 	<build>
 		<finalName>report</finalName>
-		<!-- 受环境隔离影响的目录 -->
-		<resources>
-			<resource>
-				<directory>src/main/resources</directory>
-				<filtering>true</filtering>
-			</resource>
-		</resources>
-		<!-- 解决maven项目jre版本默认为1.5的问题 -->
 		<plugins>
 			<plugin>
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-compiler-plugin</artifactId>
-				<version>3.1</version>
 				<configuration>
 					<encoding>${project.build.sourceEncoding}</encoding>
 					<source>1.7</source>
 					<target>1.7</target>
 				</configuration>
 			</plugin>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+			</plugin>
 		</plugins>
 	</build>
+
+	<distributionManagement>
+		<!-- 发布release仓库 -->
+		<repository>
+			<id>edi-release</id>
+			<name>edi-release</name>
+			<url>http://113.105.74.141:8081/artifactory/libs-release-local</url>
+		</repository>
+		<!-- 发布快照版本 -->
+		<snapshotRepository>
+			<id>edi-snapshots</id>
+			<name>edi-snapshots</name>
+			<url>http://113.105.74.141:8081/artifactory/libs-snapshot-local</url>
+		</snapshotRepository>
+	</distributionManagement>
 </project>

+ 43 - 0
src/main/java/com/uas/report/Application.java

@@ -0,0 +1,43 @@
+package com.uas.report;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.servlet.config.annotation.EnableWebMvc;
+
+import com.uas.report.schedule.service.TaskService;
+import com.uas.report.service.FileService;
+import com.uas.report.util.ContextUtils;
+
+@EnableTransactionManagement
+@SpringBootApplication(scanBasePackages = "com.uas.report")
+@EnableWebMvc
+public class Application {
+	public static void main(String[] args) {
+		SpringApplication application = new SpringApplication(Application.class);
+		application.addListeners(new ContextUtils());
+		application.run(args);
+
+		startTask();
+	}
+
+	/**
+	 * 开启定时任务
+	 */
+	public static void startTask() {
+		SystemProperties systemProperties = ContextUtils.getBean(SystemProperties.class);
+		if (systemProperties.isTaskAutoStart()) {
+			FileService fileService = ContextUtils.getBean(FileService.class);
+			TaskService taskService = ContextUtils.getBean(TaskService.class);
+			fileService.newDeleteGeneratedFilesDailyTask(systemProperties.getDailyTaskHour(),
+					systemProperties.getDailyTaskMinute(), systemProperties.getDailyTaskSecond());
+
+			// 开启定时任务
+			if (!taskService.isStopped()) {
+				taskService.stop();
+			}
+			taskService.start();
+		}
+	}
+
+}

+ 26 - 0
src/main/java/com/uas/report/CacheConfiguration.java

@@ -0,0 +1,26 @@
+package com.uas.report;
+
+import org.springframework.cache.annotation.EnableCaching;
+import org.springframework.cache.ehcache.EhCacheCacheManager;
+import org.springframework.cache.ehcache.EhCacheManagerFactoryBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.ClassPathResource;
+
+@Configuration
+@EnableCaching
+public class CacheConfiguration {
+
+	@Bean
+	public EhCacheCacheManager cacheManager(EhCacheManagerFactoryBean bean) {
+		return new EhCacheCacheManager(bean.getObject());
+	}
+
+	@Bean
+	public EhCacheManagerFactoryBean ehcache() {
+		EhCacheManagerFactoryBean ehCacheManagerFactoryBean = new EhCacheManagerFactoryBean();
+		ehCacheManagerFactoryBean.setConfigLocation(new ClassPathResource("spring/ehcache.xml"));
+		ehCacheManagerFactoryBean.setShared(true);
+		return ehCacheManagerFactoryBean;
+	}
+}

+ 16 - 13
src/main/java/com/uas/report/support/JasperserverRestAPIConf.java → src/main/java/com/uas/report/JasperserverRestAPIProperties.java

@@ -1,62 +1,65 @@
-package com.uas.report.support;
+package com.uas.report;
 
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
+import org.springframework.context.annotation.Configuration;
 
 /**
- * jasperserver rest_v2 api 相关参数,通过属性文件注入
+ * jasperserver rest_v2 api 相关参数
  * 
  * @author sunyj
  * @since 2016年9月23日 下午4:36:29
  */
-@Component
-public class JasperserverRestAPIConf {
+@Configuration
+public class JasperserverRestAPIProperties {
 	/**
 	 * 协议
 	 */
-	@Value("#{js_rest_api.schema}")
+	@Value("${jasperserver.rest.api.schema}")
 	private String schema;
 
 	/**
 	 * 主机名
 	 */
-	@Value("#{js_rest_api.host}")
+	@Value("${jasperserver.rest.api.host}")
+	// localhost
 	private String host;
 
 	/**
 	 * 端口号
 	 */
-	@Value("#{js_rest_api.port}")
+	@Value("${jasperserver.rest.api.port}")
+	// 8081
 	private Integer port;
 
 	/**
 	 * 根路径
 	 */
-	@Value("#{js_rest_api.contextRoot}")
+	@Value("${jasperserver.rest.api.contextRoot}")
 	private String contextRoot;
 
 	/**
 	 * rest服务路径
 	 */
-	@Value("#{js_rest_api.rest}")
+	@Value("${jasperserver.rest.api.rest}")
 	private String rest;
 
 	/**
 	 * resources接口路径
 	 */
-	@Value("#{js_rest_api.resources}")
+	@Value("${jasperserver.rest.api.resources}")
 	private String resources;
 
 	/**
 	 * 验证信息
 	 */
-	@Value("#{js_rest_api.authorization}")
+	@Value("${jasperserver.rest.api.authorization}")
+	// amFzcGVyYWRtaW46emh1aTEqOA==
 	private String authorization;
 
 	/**
 	 * 图片资源路径
 	 */
-	@Value("#{js_rest_api.images}")
+	@Value("${jasperserver.rest.api.images}")
 	private String images;
 
 	public String getSchema() {

+ 113 - 0
src/main/java/com/uas/report/SpecialProperties.java

@@ -0,0 +1,113 @@
+package com.uas.report;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 不同环境下的配置信息(来自spring cloud)
+ * 
+ * @author sunyj
+ * @since 2017年1月10日 下午3:32:30
+ */
+@Configuration
+public class SpecialProperties {
+
+	/**
+	 * 本地资源根路径
+	 */
+	@Value("${localBaseDir}")
+	private String localBaseDir;
+
+	/**
+	 * 本地资源图片路径
+	 */
+	@Value("${localImagesDir}")
+	private String localImagesDir;
+
+	/**
+	 * 本地资源jrxml模板路径
+	 */
+	@Value("${localJrxmlDir}")
+	private String localJrxmlDir;
+
+	/**
+	 * 标准账套(存放标准模板)
+	 */
+	@Value("${standardMaster}")
+	private String standardMaster;
+
+	/**
+	 * 本地是否拥有标准模板
+	 */
+	@Value("${hasStandardJrxmls}")
+	private boolean hasStandardJrxmls;
+
+	/**
+	 * 标准模板地址
+	 */
+	@Value("${standardJrxmlsUrl}")
+	private String standardJrxmlsUrl;
+
+	/**
+	 * 数据源配置信息
+	 */
+	@Value("${datasource}")
+	private String dataSourceInformation;
+
+	public String getLocalBaseDir() {
+		return localBaseDir;
+	}
+
+	public void setLocalBaseDir(String localBaseDir) {
+		this.localBaseDir = localBaseDir;
+	}
+
+	public String getLocalImagesDir() {
+		return localImagesDir;
+	}
+
+	public void setLocalImagesDir(String localImagesDir) {
+		this.localImagesDir = localImagesDir;
+	}
+
+	public String getLocalJrxmlDir() {
+		return localJrxmlDir;
+	}
+
+	public void setLocalJrxmlDir(String localJrxmlDir) {
+		this.localJrxmlDir = localJrxmlDir;
+	}
+
+	public String getStandardMaster() {
+		return standardMaster;
+	}
+
+	public void setStandardMaster(String standardMaster) {
+		this.standardMaster = standardMaster;
+	}
+
+	public boolean hasStandardJrxmls() {
+		return hasStandardJrxmls;
+	}
+
+	public void setHasStandardJrxmls(boolean hasStandardJrxmls) {
+		this.hasStandardJrxmls = hasStandardJrxmls;
+	}
+
+	public String getStandardJrxmlsUrl() {
+		return standardJrxmlsUrl;
+	}
+
+	public void setStandardJrxmlsUrl(String standardJrxmlsUrl) {
+		this.standardJrxmlsUrl = standardJrxmlsUrl;
+	}
+
+	public String getDataSourceInformation() {
+		return dataSourceInformation;
+	}
+
+	public void setDataSourceInformation(String dataSourceInformation) {
+		this.dataSourceInformation = dataSourceInformation;
+	}
+
+}

+ 71 - 0
src/main/java/com/uas/report/SystemProperties.java

@@ -0,0 +1,71 @@
+package com.uas.report;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 系统参数
+ * 
+ * @author sunyj
+ * @since 2016年11月2日 下午5:18:06
+ */
+@Configuration
+public class SystemProperties {
+
+	/**
+	 * 每天定时任务时间中的小时
+	 */
+	@Value("${schedule.daily.time.hour}")
+	private int dailyTaskHour;
+
+	/**
+	 * 每天定时任务时间中的分钟
+	 */
+	@Value("${schedule.daily.time.minute}")
+	private int dailyTaskMinute;
+
+	/**
+	 * 每天定时任务时间中的秒
+	 */
+	@Value("${schedule.daily.time.second}")
+	private int dailyTaskSecond;
+
+	/**
+	 * 定时任务是否自动开启
+	 */
+	@Value("${schedule.auto-start}")
+	private boolean taskAutoStart;
+
+	public int getDailyTaskHour() {
+		return dailyTaskHour;
+	}
+
+	public void setDailyTaskHour(int dailyTaskHour) {
+		this.dailyTaskHour = dailyTaskHour;
+	}
+
+	public int getDailyTaskMinute() {
+		return dailyTaskMinute;
+	}
+
+	public void setDailyTaskMinute(int dailyTaskMinute) {
+		this.dailyTaskMinute = dailyTaskMinute;
+	}
+
+	public int getDailyTaskSecond() {
+		return dailyTaskSecond;
+	}
+
+	public void setDailyTaskSecond(int dailyTaskSecond) {
+		this.dailyTaskSecond = dailyTaskSecond;
+	}
+
+	public boolean isTaskAutoStart() {
+		return taskAutoStart;
+	}
+
+	public void setTaskAutoStart(boolean taskAutoStart) {
+		this.taskAutoStart = taskAutoStart;
+	}
+
+}

+ 110 - 0
src/main/java/com/uas/report/WebAppConfiguration.java

@@ -0,0 +1,110 @@
+package com.uas.report;
+
+import java.nio.charset.Charset;
+import java.util.Arrays;
+import java.util.List;
+
+import org.apache.axis.transport.http.AxisServlet;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.http.MediaType;
+import org.springframework.http.converter.HttpMessageConverter;
+import org.springframework.http.converter.StringHttpMessageConverter;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
+import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+import org.springframework.web.servlet.view.InternalResourceViewResolver;
+
+import com.alibaba.druid.support.http.StatViewServlet;
+import com.alibaba.druid.support.http.WebStatFilter;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.alibaba.fastjson.support.config.FastJsonConfig;
+import com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter;
+import com.uas.report.filter.FileDeleteFilter;
+
+@Configuration
+@ComponentScan(basePackages = "com.uas.report.controller")
+public class WebAppConfiguration extends WebMvcConfigurerAdapter {
+
+	@Override
+	public void addResourceHandlers(ResourceHandlerRegistry registry) {
+		// Spring boot默认资源路径在src/main/resources下,而非/src/main/webapp
+		// 使用/src/main/webapp下资源均需在此添加
+		registry.addResourceHandler("/static/**").addResourceLocations("/resources/");
+		registry.addResourceHandler("/WEB-INF/**").addResourceLocations("/WEB-INF/");
+		super.addResourceHandlers(registry);
+	}
+
+	@Override
+	public void configureViewResolvers(ViewResolverRegistry registry) {
+		InternalResourceViewResolver viewResolver = new InternalResourceViewResolver("/WEB-INF/views/", ".html");
+		viewResolver.setContentType("text/html;charset=UTF-8");
+		registry.viewResolver(viewResolver);
+		super.configureViewResolvers(registry);
+	}
+
+	@Override
+	public void addViewControllers(ViewControllerRegistry registry) {
+		registry.addViewController("/").setViewName("index");
+		registry.addViewController("/console").setViewName("console");
+		registry.addViewController("/fileUpload").setViewName("fileUpload");
+		registry.addViewController("/preview").setViewName("preview");
+		registry.addViewController("/files").setViewName("files");
+		super.addViewControllers(registry);
+	}
+
+	@Override
+	public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
+		FastJsonHttpMessageConverter fastJsonHttpMessageConverter = new FastJsonHttpMessageConverter();
+		fastJsonHttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.APPLICATION_JSON_UTF8));
+		FastJsonConfig fastJsonConfig = new FastJsonConfig();
+		fastJsonConfig.setSerializerFeatures(SerializerFeature.DisableCircularReferenceDetect);
+		fastJsonHttpMessageConverter.setFastJsonConfig(fastJsonConfig);
+		converters.add(fastJsonHttpMessageConverter);
+
+		StringHttpMessageConverter stringHttpMessageConverter = new StringHttpMessageConverter(
+				Charset.forName("UTF-8"));
+		stringHttpMessageConverter.setSupportedMediaTypes(Arrays.asList(MediaType.TEXT_HTML));
+		converters.add(stringHttpMessageConverter);
+		super.configureMessageConverters(converters);
+	}
+
+	@Bean
+	public FilterRegistrationBean fileDeleteFilter() {
+		FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(new FileDeleteFilter());
+		filterRegistrationBean.addUrlPatterns("/file/delete");
+		return filterRegistrationBean;
+	}
+
+	@Bean
+	public FilterRegistrationBean webStatFilter() {
+		FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean();
+		filterRegistrationBean.setFilter(new WebStatFilter());
+		filterRegistrationBean.addUrlPatterns("/*");
+		filterRegistrationBean.addInitParameter("exclusions",
+				"*.js,*.gif,*.jpg,*.png,*.bmp,*.css,*.ico,*.html,/druid/*");
+		return filterRegistrationBean;
+	}
+
+	@Bean
+	public ServletRegistrationBean axisServlet() {
+		ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new AxisServlet(), "/services/*");
+		servletRegistrationBean.setLoadOnStartup(1);
+		return servletRegistrationBean;
+	}
+
+	@Bean
+	public ServletRegistrationBean druidStatViewServlet() {
+		ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(),
+				"/druid/*");
+		servletRegistrationBean.addInitParameter("resetEnable", "true");
+		servletRegistrationBean.addInitParameter("loginUsername", "admin");
+		servletRegistrationBean.addInitParameter("loginPassword", "select123***");
+		return servletRegistrationBean;
+	}
+
+}

+ 3 - 2
src/main/java/com/uas/report/aop/WebLogAspect.java

@@ -2,13 +2,14 @@ package com.uas.report.aop;
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.log4j.Logger;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.Signature;
 import org.aspectj.lang.annotation.AfterReturning;
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.aspectj.lang.annotation.Pointcut;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.stereotype.Component;
 
@@ -26,7 +27,7 @@ import com.uas.report.util.IpHelper;
 @EnableAspectJAutoProxy
 public class WebLogAspect {
 
-	private Logger logger = Logger.getLogger(WebLogAspect.class);
+	private Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
 
 	@Pointcut("execution(* com.uas.report.controller.*.*(..))")
 	public void log() {

+ 8 - 8
src/main/java/com/uas/report/controller/PrintController.java

@@ -13,7 +13,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.util.StringUtils;
@@ -24,7 +25,6 @@ import com.uas.report.core.exception.ReportException;
 import com.uas.report.service.FileService;
 import com.uas.report.service.PrintService;
 import com.uas.report.util.FileUtils;
-import com.uas.report.util.PathUtils;
 import com.uas.report.util.ReportConstants;
 import com.uas.report.util.ReportUtils;
 
@@ -39,7 +39,7 @@ import com.uas.report.util.ReportUtils;
 @RequestMapping("/print")
 public class PrintController {
 
-	private static Logger logger = Logger.getLogger(PrintController.class);
+	private static Logger logger = LoggerFactory.getLogger(PrintController.class);
 
 	@Autowired
 	private PrintService printService;
@@ -137,7 +137,7 @@ public class PrintController {
 		} else {
 			filePath += "." + exportFileType;
 		}
-		File file = new File(PathUtils.getAppPath() + filePath);
+		File file = new File(ReportConstants.GENERATED_FILES_DIR + filePath);
 		// 文件无效(不存在或过期),创建
 		if (!fileService.isFileValid(file.getPath(), fileService.getJrxmlFilePath(userName, reportName))) {
 			data = printService.export(userName, profile, reportName, whereCondition, otherParameters, exportFileType);
@@ -215,7 +215,7 @@ public class PrintController {
 				+ fileService.generateFileName(userName, profile, reportName, whereCondition, otherParameters,
 						ReportConstants.PDF_FILE_TYPE)
 				+ "." + ReportConstants.PDF_FILE_TYPE;
-		final File file = new File(PathUtils.getAppPath() + pdfPath);
+		final File file = new File(ReportConstants.GENERATED_FILES_DIR + pdfPath);
 		if (pageIndex == null || pageIndex == 1) {
 			// 文件无效(不存在或过期),重新创建pdf文件
 			if (!fileService.isFileValid(file.getPath(), fileService.getJrxmlFilePath(userName, reportName))) {
@@ -290,17 +290,17 @@ public class PrintController {
 
 		userName = printService.processMasterOfB2B(userName, reportName);
 		if (fileType.equals(ReportConstants.PDF_FILE_TYPE)) {
-			file = new File(PathUtils.getAppPath() + filePath + "." + ReportConstants.PDF_FILE_TYPE);
+			file = new File(ReportConstants.GENERATED_FILES_DIR + filePath + "." + ReportConstants.PDF_FILE_TYPE);
 			result.put("valid",
 					fileService.isFileValid(file.getPath(), fileService.getJrxmlFilePath(userName, reportName)));
 			result.put("size", file.length());
 		} else if (fileType.equals(ReportConstants.EXCEL_FILE_TYPE)) {
-			file = new File(PathUtils.getAppPath() + filePath + "." + ReportConstants.EXCEL_FILE_TYPE);
+			file = new File(ReportConstants.GENERATED_FILES_DIR + filePath + "." + ReportConstants.EXCEL_FILE_TYPE);
 			result.put("valid",
 					fileService.isFileValid(file.getPath(), fileService.getJrxmlFilePath(userName, reportName)));
 			result.put("size", file.length());
 		} else if (fileType.equals(ReportConstants.EXCEL_WITH_ONLY_DATA_FILE_TYPE)) {
-			file = new File(PathUtils.getAppPath() + filePath + "." + ReportConstants.EXCEL_FILE_TYPE);
+			file = new File(ReportConstants.GENERATED_FILES_DIR + filePath + "." + ReportConstants.EXCEL_FILE_TYPE);
 			result.put("valid",
 					fileService.isFileValid(file.getPath(), fileService.getJrxmlFilePath(userName, reportName)));
 			result.put("size", file.length());

+ 3 - 2
src/main/java/com/uas/report/core/advice/ExceptionHandlerAdvice.java

@@ -7,7 +7,8 @@ import java.sql.SQLRecoverableException;
 
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.http.HttpHeaders;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -42,7 +43,7 @@ import com.uas.report.core.exception.ReportException;
 @ControllerAdvice
 public class ExceptionHandlerAdvice {
 
-	private final static Logger logger = Logger.getLogger(ExceptionHandlerAdvice.class);
+	private final static Logger logger = LoggerFactory.getLogger(ExceptionHandlerAdvice.class);
 
 	/**
 	 * 处理运行时抛出异常

+ 3 - 2
src/main/java/com/uas/report/schedule/service/impl/TaskServiceImpl.java

@@ -10,7 +10,8 @@ import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
@@ -45,7 +46,7 @@ public class TaskServiceImpl implements TaskService {
 	 */
 	private static final String LOG_DIR = System.getProperty("java.io.tmpdir");
 
-	private Logger logger = Logger.getLogger(TaskServiceImpl.class);
+	private Logger logger = LoggerFactory.getLogger(TaskServiceImpl.class);
 
 	@Override
 	public void newTask(TaskInformation taskInformation) {

+ 16 - 15
src/main/java/com/uas/report/service/impl/FileServiceImpl.java

@@ -22,7 +22,8 @@ import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.impl.client.HttpClients;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
@@ -33,12 +34,12 @@ import com.lowagie.text.Document;
 import com.lowagie.text.DocumentException;
 import com.lowagie.text.pdf.PdfCopy;
 import com.lowagie.text.pdf.PdfReader;
+import com.uas.report.SpecialProperties;
 import com.uas.report.core.exception.ReportException;
 import com.uas.report.schedule.model.DailyTaskInformation;
 import com.uas.report.schedule.service.Executable;
 import com.uas.report.schedule.service.TaskService;
 import com.uas.report.service.FileService;
-import com.uas.report.support.SysConf;
 import com.uas.report.util.FileUtils;
 import com.uas.report.util.ReportConstants;
 import com.uas.report.util.ReportUtils;
@@ -48,12 +49,12 @@ import com.uas.report.util.ZipUtils;
 public class FileServiceImpl implements FileService {
 
 	@Autowired
-	private SysConf sysConf;
+	private SpecialProperties specialProperties;
 
 	@Autowired
 	private TaskService taskService;
 
-	private Logger logger = Logger.getLogger(getClass());
+	private Logger logger = LoggerFactory.getLogger(getClass());
 
 	/**
 	 * 查看、压缩文件时,对文件进行过滤
@@ -81,9 +82,9 @@ public class FileServiceImpl implements FileService {
 		}
 		try {
 			byte[] data = null;
-			String stantardJrxmlsUrl = String.format(sysConf.getStandardJrxmlsUrl(), sourceUserName);
+			String stantardJrxmlsUrl = String.format(specialProperties.getStandardJrxmlsUrl(), sourceUserName);
 			// 如果本机提供标准模板下载,直接从本地获取数据
-			if (sysConf.hasStandardJrxmls()) {
+			if (specialProperties.hasStandardJrxmls()) {
 				data = getStandardJrxmls(sourceUserName);
 			}
 			// 本机没有标准模板,则先下载标准模板数据
@@ -135,7 +136,7 @@ public class FileServiceImpl implements FileService {
 		}
 
 		String fileName = file.getOriginalFilename();
-		StringBuilder stringBuilder = new StringBuilder(sysConf.getLocalBaseDir()).append("/");
+		StringBuilder stringBuilder = new StringBuilder(specialProperties.getLocalBaseDir()).append("/");
 		// jrxml模板和图片分别放在jrxml和Picture文件夹下,其他资源放在当前账套根路径下
 		if (fileType.equals("jrxml")) {
 			stringBuilder.append(userName).append("/").append("jrxml").append("/");
@@ -192,7 +193,7 @@ public class FileServiceImpl implements FileService {
 	@Override
 	public String getJrxmlFilePath(String userName, String reportName) {
 		ReportUtils.checkParameters(userName, reportName);
-		return new StringBuilder(getMasterPath(userName)).append(sysConf.getLocalJrxmlDir()).append("/")
+		return new StringBuilder(getMasterPath(userName)).append(specialProperties.getLocalJrxmlDir()).append("/")
 				.append(reportName).append(".jrxml").toString();
 	}
 
@@ -201,7 +202,7 @@ public class FileServiceImpl implements FileService {
 		if (StringUtils.isEmpty(userName)) {
 			throw new ReportException("参数不能为空:userName");
 		}
-		return new StringBuilder(sysConf.getLocalBaseDir()).append("/").append(userName).toString();
+		return new StringBuilder(specialProperties.getLocalBaseDir()).append("/").append(userName).toString();
 	}
 
 	@Override
@@ -209,10 +210,10 @@ public class FileServiceImpl implements FileService {
 		if (StringUtils.isEmpty(userName)) {
 			throw new ReportException("未传入当前账套名称!");
 		}
-		if (!sysConf.hasStandardJrxmls()) {
+		if (!specialProperties.hasStandardJrxmls()) {
 			throw new ReportException("没有" + userName + "标准模板!");
 		}
-		byte[] data = ZipUtils.zipFolder(getMasterPath(sysConf.getStandardMaster()) + "/" + userName,
+		byte[] data = ZipUtils.zipFolder(getMasterPath(specialProperties.getStandardMaster()) + "/" + userName,
 				FileServiceImpl.fileFilter);
 		if (ArrayUtils.isEmpty(data)) {
 			throw new ReportException("压缩失败");
@@ -225,10 +226,10 @@ public class FileServiceImpl implements FileService {
 		if (StringUtils.isEmpty(userName)) {
 			throw new ReportException("未传入当前账套名称!");
 		}
-		if (!sysConf.hasStandardJrxmls()) {
+		if (!specialProperties.hasStandardJrxmls()) {
 			throw new ReportException("没有" + userName + "标准模板!");
 		}
-		downloadZip(sysConf.getStandardMaster() + "/" + userName, response);
+		downloadZip(specialProperties.getStandardMaster() + "/" + userName, response);
 	}
 
 	@Override
@@ -405,7 +406,7 @@ public class FileServiceImpl implements FileService {
 			return null;
 		}
 		// 获取相对路径,须将本地资源根路径替换掉,并且文件分隔符统一使用 '/'
-		return file.getPath().replace(new File(sysConf.getLocalBaseDir()).getPath(), "").replace("\\", "/");
+		return file.getPath().replace(new File(specialProperties.getLocalBaseDir()).getPath(), "").replace("\\", "/");
 	}
 
 	@Override
@@ -497,7 +498,7 @@ public class FileServiceImpl implements FileService {
 		}
 		// 不是绝对路径的话,则相对于模板根路径
 		if (isAbsolutePath == null || !isAbsolutePath) {
-			filePath = sysConf.getLocalBaseDir() + "/" + filePath;
+			filePath = specialProperties.getLocalBaseDir() + "/" + filePath;
 		}
 		return filePath;
 	}

+ 6 - 5
src/main/java/com/uas/report/service/impl/PrintServiceImpl.java

@@ -24,24 +24,25 @@ import java.util.regex.Pattern;
 import javax.sql.DataSource;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.log4j.Logger;
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
 import org.dom4j.Element;
 import org.dom4j.Node;
 import org.dom4j.io.SAXReader;
 import org.dom4j.io.XMLWriter;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
 import org.springframework.util.StringUtils;
 
 import com.alibaba.fastjson.JSONObject;
+import com.uas.report.SpecialProperties;
 import com.uas.report.core.exception.ReportException;
 import com.uas.report.jasperreports.engine.export.CustomJRXlsExporter;
 import com.uas.report.service.FileService;
 import com.uas.report.service.PrintService;
-import com.uas.report.support.SysConf;
 import com.uas.report.util.DataSourceUtils;
 import com.uas.report.util.FileUtils;
 import com.uas.report.util.ReportConstants;
@@ -75,12 +76,12 @@ public class PrintServiceImpl implements PrintService {
 	private FileService fileService;
 
 	@Autowired
-	private SysConf sysConf;
+	private SpecialProperties specialProperties;
 
 	// @Autowired
 	// private ResourceService resourceService;
 
-	private Logger logger = Logger.getLogger(getClass());
+	private Logger logger = LoggerFactory.getLogger(getClass());
 
 	@Override
 	public byte[] export(String userName, String profile, String reportName, String whereCondition,
@@ -505,7 +506,7 @@ public class PrintServiceImpl implements PrintService {
 			File jrxmlFile = new File(jrxmlFilePath);
 			// 报表模板不存在,返回B2B标准模板账套
 			if (!jrxmlFile.exists()) {
-				return sysConf.getStandardMaster() + "/B2B";
+				return specialProperties.getStandardMaster() + "/B2B";
 			}
 		}
 		return userName;

+ 17 - 16
src/main/java/com/uas/report/service/impl/ResourceServiceImpl.java

@@ -21,16 +21,17 @@ import org.apache.http.client.methods.HttpRequestBase;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.impl.client.HttpClients;
 import org.apache.http.message.BasicNameValuePair;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import com.alibaba.fastjson.JSONObject;
+import com.uas.report.JasperserverRestAPIProperties;
+import com.uas.report.SpecialProperties;
 import com.uas.report.model.Resource;
 import com.uas.report.service.FileService;
 import com.uas.report.service.ResourceService;
-import com.uas.report.support.JasperserverRestAPIConf;
-import com.uas.report.support.SysConf;
 
 /**
  * 管理报表模板、图片等资源
@@ -42,15 +43,15 @@ import com.uas.report.support.SysConf;
 public class ResourceServiceImpl implements ResourceService {
 
 	@Autowired
-	private JasperserverRestAPIConf jsRestAPIConf;
+	private JasperserverRestAPIProperties jsRestAPIProperties;
 
 	@Autowired
-	private SysConf sysConf;
+	private SpecialProperties specialProperties;
 
 	@Autowired
 	private FileService fileService;
 
-	private Logger logger = Logger.getLogger(getClass());
+	private Logger logger = LoggerFactory.getLogger(getClass());
 
 	// 是否为windows系统
 	private boolean isWindowsPlatform = System.getProperty("os.name").toLowerCase().startsWith("win");
@@ -179,7 +180,7 @@ public class ResourceServiceImpl implements ResourceService {
 		// 替换"\"为"/"
 		String absolutePath = file.getAbsolutePath().replace("\\", "/");
 		// 去除文件绝对路径中前半部分,只保留自账套开始的路径
-		resource.setUri(absolutePath.replace(sysConf.getLocalBaseDir(), ""));
+		resource.setUri(absolutePath.replace(specialProperties.getLocalBaseDir(), ""));
 		return resource;
 	}
 
@@ -214,7 +215,7 @@ public class ResourceServiceImpl implements ResourceService {
 	private void downloadFile(Resource resource) throws ClientProtocolException, URISyntaxException, IOException {
 		// 如果资源是文件夹,在本地创建
 		if (resource.isFolder()) {
-			File folder = new File(sysConf.getLocalBaseDir() + resource.getUri());
+			File folder = new File(specialProperties.getLocalBaseDir() + resource.getUri());
 			if (!folder.exists()) {
 				folder.mkdirs();
 				logger.info("Mkdirs " + folder.getPath());
@@ -222,7 +223,7 @@ public class ResourceServiceImpl implements ResourceService {
 			return;
 		}
 
-		String localBaseDir = sysConf.getLocalBaseDir();
+		String localBaseDir = specialProperties.getLocalBaseDir();
 		// 如果本地资源根路径最后以资源分隔符结尾
 		if (localBaseDir.endsWith(File.separator)) {
 			localBaseDir = localBaseDir.substring(0, localBaseDir.length() - 1);
@@ -238,12 +239,12 @@ public class ResourceServiceImpl implements ResourceService {
 
 		// 下载jrxml文件(即使该远程资源并不在jrxml根路径下,比如在嵌套文件夹下),放在localBaseDir+userName+localJrxmlDir下
 		if (uri.endsWith(Resource.JRXML_RESOURCE_TYPE)) {
-			stringBuilder.append(sysConf.getLocalJrxmlDir()).append(resourceName);
+			stringBuilder.append(specialProperties.getLocalJrxmlDir()).append(resourceName);
 			downloadFile(uri, Resource.JRXML_MIME_TYPE, stringBuilder.toString());
 		}
 		// 除jrxml之外的资源视为图片,放在localBaseDir+userName+localImagesDir下
 		else {
-			stringBuilder.append(sysConf.getLocalImagesDir()).append(resourceName);
+			stringBuilder.append(specialProperties.getLocalImagesDir()).append(resourceName);
 			downloadFile(uri, Resource.IMAGE_MIME_TYPE, stringBuilder.toString());
 		}
 	}
@@ -289,7 +290,7 @@ public class ResourceServiceImpl implements ResourceService {
 		HttpClient httpClient = HttpClients.createDefault();
 		request.setURI(createURI(path, parameters));
 		// 采用HTTP Basic验证
-		request.setHeader("Authorization", "Basic " + jsRestAPIConf.getAuthorization());
+		request.setHeader("Authorization", "Basic " + jsRestAPIProperties.getAuthorization());
 		HttpResponse response = httpClient.execute(request);
 		// logger.info(request.getMethod() + " " + request.getURI() + " " +
 		// response.getStatusLine());
@@ -309,15 +310,15 @@ public class ResourceServiceImpl implements ResourceService {
 	private URI createURI(String path, List<NameValuePair> parameters) throws URISyntaxException {
 		StringBuilder stringBuilder = new StringBuilder();
 		// 拼接资源全路径
-		stringBuilder.append("/").append(jsRestAPIConf.getContextRoot()).append("/").append(jsRestAPIConf.getRest())
-				.append("/").append(jsRestAPIConf.getResources());
+		stringBuilder.append("/").append(jsRestAPIProperties.getContextRoot()).append("/")
+				.append(jsRestAPIProperties.getRest()).append("/").append(jsRestAPIProperties.getResources());
 		if (path != null) {
 			stringBuilder.append(path);
 		}
 		URIBuilder uriBuilder = new URIBuilder();
 		// 协议、主机名、端口号、资源全路径
-		uriBuilder.setScheme(jsRestAPIConf.getSchema()).setHost(jsRestAPIConf.getHost())
-				.setPort(jsRestAPIConf.getPort()).setPath(stringBuilder.toString());
+		uriBuilder.setScheme(jsRestAPIProperties.getSchema()).setHost(jsRestAPIProperties.getHost())
+				.setPort(jsRestAPIProperties.getPort()).setPath(stringBuilder.toString());
 		// 设置参数
 		if (parameters != null) {
 			uriBuilder.setParameters(parameters);

+ 0 - 19
src/main/java/com/uas/report/support/ApplicationContextRegister.java

@@ -1,19 +0,0 @@
-package com.uas.report.support;
-
-import org.apache.log4j.Logger;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-
-import com.uas.report.util.ContextUtils;
-
-public class ApplicationContextRegister implements ApplicationContextAware {
-
-	private static Logger logger = Logger.getLogger(ApplicationContextRegister.class);
-
-	public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
-		ContextUtils.setApplicationContext(applicationContext);
-		logger.debug("ApplicationContext registed");
-	}
-
-}

+ 0 - 51
src/main/java/com/uas/report/support/StartupProcessor.java

@@ -1,51 +0,0 @@
-package com.uas.report.support;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.ApplicationListener;
-import org.springframework.context.event.ContextRefreshedEvent;
-
-import com.uas.report.schedule.service.TaskService;
-import com.uas.report.service.FileService;
-
-/**
- * 容器启动时需执行的任务
- * 
- * @author sunyj
- * @since 2016年12月13日 下午3:12:48
- */
-public class StartupProcessor implements ApplicationListener<ContextRefreshedEvent> {
-
-	@Autowired
-	private SysConf sysConf;
-
-	@Autowired
-	private FileService fileService;
-	
-	@Autowired
-	TaskService taskService ;
-
-	@Override
-	public void onApplicationEvent(ContextRefreshedEvent event) {
-		// 非root application context,才执行
-		if (event.getApplicationContext().getParent() != null) {
-			startTask();
-		}
-	}
-
-	/**
-	 * 容器启动时开启删除产生的pdf等文件的定时任务
-	 */
-	public void startTask() {
-		if (sysConf.isDailyTaskAutoStart()) {
-			fileService.newDeleteGeneratedFilesDailyTask(sysConf.getDailyTaskHour(), sysConf.getDailyTaskMinute(),
-					sysConf.getDailyTaskSecond());
-
-			// 开启定时任务
-			if (!taskService.isStopped()) {
-				taskService.stop();
-			}
-			taskService.start();
-		}
-	}
-
-}

+ 0 - 153
src/main/java/com/uas/report/support/SysConf.java

@@ -1,153 +0,0 @@
-package com.uas.report.support;
-
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-/**
- * 系统参数,通过属性文件注入
- * 
- * @author sunyj
- * @since 2016年11月2日 下午5:18:06
- */
-@Component
-public class SysConf {
-	/**
-	 * 本地资源根路径
-	 */
-	@Value("#{sys.localBaseDir}")
-	private String localBaseDir;
-
-	/**
-	 * 本地资源图片路径
-	 */
-	@Value("#{sys.localImagesDir}")
-	private String localImagesDir;
-
-	/**
-	 * 本地资源jrxml模板路径
-	 */
-	@Value("#{sys.localJrxmlDir}")
-	private String localJrxmlDir;
-
-	/**
-	 * 标准账套(存放标准模板)
-	 */
-	@Value("#{sys.standardMaster}")
-	private String standardMaster;
-
-	/**
-	 * 本地是否拥有标准模板
-	 */
-	@Value("#{sys.hasStandardJrxmls}")
-	private Boolean hasStandardJrxmls;
-
-	/**
-	 * 标准模板地址
-	 */
-	@Value("#{sys.standardJrxmlsUrl}")
-	private String standardJrxmlsUrl;
-
-	/**
-	 * 每天定时任务是否自动开启
-	 */
-	@Value("#{sys.dailyTaskAutoStart}")
-	private boolean dailyTaskAutoStart;
-
-	/**
-	 * 每天定时任务时间中的小时
-	 */
-	@Value("#{sys.dailyTaskHour}")
-	private int dailyTaskHour;
-
-	/**
-	 * 每天定时任务时间中的分钟
-	 */
-	@Value("#{sys.dailyTaskMinute}")
-	private int dailyTaskMinute;
-
-	/**
-	 * 每天定时任务时间中的秒
-	 */
-	@Value("#{sys.dailyTaskSecond}")
-	private int dailyTaskSecond;
-
-	public String getLocalBaseDir() {
-		return localBaseDir;
-	}
-
-	public void setLocalBaseDir(String localBaseDir) {
-		this.localBaseDir = localBaseDir;
-	}
-
-	public String getLocalImagesDir() {
-		return localImagesDir;
-	}
-
-	public void setLocalImagesDir(String localImagesDir) {
-		this.localImagesDir = localImagesDir;
-	}
-
-	public String getLocalJrxmlDir() {
-		return localJrxmlDir;
-	}
-
-	public void setLocalJrxmlDir(String localJrxmlDir) {
-		this.localJrxmlDir = localJrxmlDir;
-	}
-
-	public Boolean hasStandardJrxmls() {
-		return hasStandardJrxmls;
-	}
-
-	public void setHasStandardJrxmls(Boolean hasStandardJrxmls) {
-		this.hasStandardJrxmls = hasStandardJrxmls;
-	}
-
-	public String getStandardMaster() {
-		return standardMaster;
-	}
-
-	public void setStandardMaster(String standardMaster) {
-		this.standardMaster = standardMaster;
-	}
-
-	public String getStandardJrxmlsUrl() {
-		return standardJrxmlsUrl;
-	}
-
-	public void setStandardJrxmlsUrl(String standardJrxmlsUrl) {
-		this.standardJrxmlsUrl = standardJrxmlsUrl;
-	}
-
-	public boolean isDailyTaskAutoStart() {
-		return dailyTaskAutoStart;
-	}
-
-	public void setDailyTaskAutoStart(boolean dailyTaskAutoStart) {
-		this.dailyTaskAutoStart = dailyTaskAutoStart;
-	}
-
-	public int getDailyTaskHour() {
-		return dailyTaskHour;
-	}
-
-	public void setDailyTaskHour(int dailyTaskHour) {
-		this.dailyTaskHour = dailyTaskHour;
-	}
-
-	public int getDailyTaskMinute() {
-		return dailyTaskMinute;
-	}
-
-	public void setDailyTaskMinute(int dailyTaskMinute) {
-		this.dailyTaskMinute = dailyTaskMinute;
-	}
-
-	public int getDailyTaskSecond() {
-		return dailyTaskSecond;
-	}
-
-	public void setDailyTaskSecond(int dailyTaskSecond) {
-		this.dailyTaskSecond = dailyTaskSecond;
-	}
-}

+ 9 - 5
src/main/java/com/uas/report/util/ContextUtils.java

@@ -1,8 +1,11 @@
 package com.uas.report.util;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.context.event.ApplicationPreparedEvent;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.ApplicationEvent;
+import org.springframework.context.ApplicationListener;
 
 /**
  * spring容器上下文对象
@@ -10,15 +13,16 @@ import org.springframework.context.ApplicationEvent;
  * @author yingp
  *
  */
-public class ContextUtils {
+public class ContextUtils implements ApplicationListener<ApplicationPreparedEvent> {
 	private static ApplicationContext applicationContext;
 
-	private static Logger logger = Logger.getLogger(ContextUtils.class);
+	private static Logger logger = LoggerFactory.getLogger(ContextUtils.class);
 
-	public static void setApplicationContext(ApplicationContext applicationContext) {
+	@Override
+	public void onApplicationEvent(ApplicationPreparedEvent event) {
 		synchronized (ContextUtils.class) {
 			logger.debug("setApplicationContext, notifyAll");
-			ContextUtils.applicationContext = applicationContext;
+			ContextUtils.applicationContext = event.getApplicationContext();
 			ContextUtils.class.notifyAll();
 		}
 	}

+ 29 - 77
src/main/java/com/uas/report/util/DataSourceUtils.java

@@ -1,9 +1,5 @@
 package com.uas.report.util;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
 import java.sql.Connection;
 import java.sql.PreparedStatement;
 import java.sql.ResultSet;
@@ -15,11 +11,13 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import javax.sql.DataSource;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.util.StringUtils;
 
 import com.alibaba.druid.pool.DruidDataSource;
 import com.alibaba.fastjson.JSONObject;
+import com.uas.report.SpecialProperties;
 import com.uas.report.core.exception.ReportException;
 
 /**
@@ -35,93 +33,47 @@ public class DataSourceUtils {
 	 */
 	private static Map<String, DruidDataSource> dataSources = new ConcurrentHashMap<>();
 
-	private static Logger logger = Logger.getLogger(DataSourceUtils.class);
+	private static Logger logger = LoggerFactory.getLogger(DataSourceUtils.class);
 
-	public static DataSource getDataSource(String userName, String profile) {
-		if (StringUtils.isEmpty(userName)) {
-			return null;
-		}
-		// 需要考虑B2B打印时账套名为B2B/10045740等类似的情况
-		if (!StringUtils.isEmpty(profile)) {
-			userName = userName.split("/")[0] + "." + profile;
-		}
-		DruidDataSource dataSource = dataSources.get(userName);
-		// 如果Map里未存放该数据源,从jdbc配置文件获取数据源
-		if (dataSource == null) {
-			dataSource = getDataSource(ReportConstants.JDBC_FILES_ABSOLUTE_PATH + userName + ".json");
-			// jdbc文件并未配置,则可能是子帐套,需要从主账套表中获取
-			if (dataSource != null) {
-				dataSources.put(userName, dataSource);
-			} else {
-				initAllDataSources();
-				Set<Entry<String, DruidDataSource>> entrySet = dataSources.entrySet();
-				for (Entry<String, DruidDataSource> entry : entrySet) {
-					dataSource = getDataSourceFromMainMaster(entry.getValue(), userName);
-					if (dataSource != null) {
-						dataSources.put(userName, dataSource);
-						return dataSource;
-					}
-				}
-			}
-		}
-		return dataSource;
+	static {
+		initAllDataSources();
 	}
 
 	/**
 	 * 初始化所有数据源
 	 */
 	private static void initAllDataSources() {
-		File file = new File(ReportConstants.JDBC_FILES_ABSOLUTE_PATH);
-		// 获取所有jdbc配置文件
-		if (file.exists() && file.listFiles().length > 0) {
-			File[] files = file.listFiles();
-			for (File f : files) {
-				String userName = f.getName().replaceAll(".json", "");
-				if (dataSources.get(userName) == null) {
-					DruidDataSource dataSource = getDataSource(f.getPath());
-					if (dataSource != null) {
-						dataSources.put(userName, dataSource);
-					}
-				}
-			}
+		// 从配置中获取数据源信息
+		SpecialProperties specialProperties = ContextUtils.getBean(SpecialProperties.class);
+		JSONObject jsonObject = JSONObject.parseObject(specialProperties.getDataSourceInformation());
+		Set<Entry<String, Object>> entrySet = jsonObject.entrySet();
+		for (Entry<String, Object> entry : entrySet) {
+			DruidDataSource dataSource = JSONObject.parseObject(entry.getValue().toString(), DruidDataSource.class);
+			dataSources.put(entry.getKey(), dataSource);
 		}
 	}
 
-	/**
-	 * 从文件中读取jdbc配置,获取数据源
-	 * 
-	 * @param jdbcFileAbsolutePath
-	 *            jdbc配置文件
-	 * @return 数据源
-	 */
-	public static DruidDataSource getDataSource(String jdbcFileAbsolutePath) {
-		if (StringUtils.isEmpty(jdbcFileAbsolutePath)) {
+	public static DataSource getDataSource(String userName, String profile) {
+		if (StringUtils.isEmpty(userName)) {
 			return null;
 		}
-		File file = new File(jdbcFileAbsolutePath);
-		if (file.exists()) {
-			BufferedReader bufferedReader = null;
-			try {
-				bufferedReader = new BufferedReader(new FileReader(file));
-				StringBuilder stringBuilder = new StringBuilder();
-				String line = "";
-				while (!StringUtils.isEmpty(line = bufferedReader.readLine())) {
-					stringBuilder.append(line);
-				}
-				return JSONObject.parseObject(stringBuilder.toString(), DruidDataSource.class);
-			} catch (IOException e) {
-				e.printStackTrace();
-			} finally {
-				if (bufferedReader != null) {
-					try {
-						bufferedReader.close();
-					} catch (IOException e) {
-						e.printStackTrace();
-					}
+		// 需要考虑B2B打印时账套名为B2B/10045740等类似的情况
+		if (!StringUtils.isEmpty(profile)) {
+			userName = userName.split("/")[0] + "_" + profile;
+		}
+		DruidDataSource dataSource = dataSources.get(userName);
+		// 如果Map里未存放该数据源,则可能是子帐套,需要从主账套表中获取
+		if (dataSource == null) {
+			Set<Entry<String, DruidDataSource>> entrySet = dataSources.entrySet();
+			for (Entry<String, DruidDataSource> entry : entrySet) {
+				dataSource = getDataSourceFromMainMaster(entry.getValue(), userName);
+				if (dataSource != null) {
+					dataSources.put(userName, dataSource);
+					return dataSource;
 				}
 			}
 		}
-		return null;
+		return dataSource;
 	}
 
 	/**

+ 3 - 2
src/main/java/com/uas/report/util/FileUtils.java

@@ -5,7 +5,8 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 
 import org.apache.commons.lang.ArrayUtils;
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.alibaba.druid.util.StringUtils;
 import com.uas.report.core.exception.ReportException;
@@ -18,7 +19,7 @@ import com.uas.report.core.exception.ReportException;
  */
 public class FileUtils {
 
-	private static final Logger logger = Logger.getLogger(FileUtils.class);
+	private static final Logger logger = LoggerFactory.getLogger(FileUtils.class);
 
 	/**
 	 * 创建文件

+ 5 - 4
src/main/java/com/uas/report/util/ReportConstants.java

@@ -59,12 +59,13 @@ public class ReportConstants {
 	public static final String GENERATED_FILES_PATH = "resources/generate/";
 
 	/**
-	 * 生成的pdf、excel等文件的绝对路径
+	 * 生成的pdf、excel等文件的所在的文件夹
 	 */
-	public static final String GENERATED_FILES_ABSOLUTE_PATH = PathUtils.getAppPath() + GENERATED_FILES_PATH;
+	public static final String GENERATED_FILES_DIR = PathUtils.getAppPath();
 
 	/**
-	 * jdbc配置文件的绝对路径
+	 * 生成的pdf、excel等文件的绝对路径
 	 */
-	public static final String JDBC_FILES_ABSOLUTE_PATH = PathUtils.getClassPath() + "classes/jdbc/";
+	public static final String GENERATED_FILES_ABSOLUTE_PATH = GENERATED_FILES_DIR + GENERATED_FILES_PATH;
+
 }

+ 3 - 2
src/main/java/com/uas/report/util/ZipUtils.java

@@ -15,7 +15,8 @@ import java.util.zip.ZipFile;
 import java.util.zip.ZipInputStream;
 import java.util.zip.ZipOutputStream;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import com.alibaba.druid.util.StringUtils;
 import com.uas.report.core.exception.ReportException;
@@ -28,7 +29,7 @@ import com.uas.report.core.exception.ReportException;
  */
 public class ZipUtils {
 
-	private static final Logger logger = Logger.getLogger(ZipUtils.class);
+	private static final Logger logger = LoggerFactory.getLogger(ZipUtils.class);
 
 	/**
 	 * 压缩文件夹

+ 3 - 2
src/main/java/service/MyService.java

@@ -1,10 +1,11 @@
 package service;
 
-import org.apache.log4j.Logger;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 public class MyService {
 
-	private Logger logger = Logger.getLogger(MyService.class);
+	private Logger logger = LoggerFactory.getLogger(MyService.class);
 
 	public String getGreeting(String name) {
 		String message = "您好 " + name;

+ 32 - 0
src/main/resources/bootstrap.yml

@@ -0,0 +1,32 @@
+spring:
+ application:
+  name: report
+ cloud:
+  config:
+   uri: http://10.10.100.145:8080
+ jpa:
+  database: ORACLE
+  show-sql: false
+  properties:
+   hibernate:
+    dialect: org.hibernate.dialect.Oracle10gDialect
+  
+schedule:
+ daily:
+  time:
+   hour: 3
+   minute: 0
+   second: 0
+ auto-start: true
+ 
+jasperserver:
+ rest:
+  api:
+   schema: http
+   host: 192.168.253.60
+   port: 8080
+   contextRoot: jasperserver
+   rest: rest_v2
+   resources: resources
+   authorization: amFzcGVyYWRtaW46amFzcGVyYWRtaW4=
+   images: Picture

+ 44 - 0
src/main/resources/logback.xml

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+	<appender name="FILE"
+		class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<File>logs/log.log</File>
+		<encoder>
+			<pattern>
+				%date{yyyy-MM-dd HH:mm:ss:SSS} [%relative ms] %-5level [%50.50(%logger{36}.%method:%line)] ---- %msg%n
+			</pattern>
+			<charset>UTF-8</charset> <!-- 此处设置字符集 -->
+		</encoder>
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<!-- daily rollover -->
+			<FileNamePattern>logs/log.%d{yyyy-MM-dd}.log</FileNamePattern>
+			<!-- keep 10 days' worth of history -->
+			<maxHistory>10</maxHistory>
+		</rollingPolicy>
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>INFO</level>
+		</filter>
+	</appender>
+
+	<!-- Console output -->
+	<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+		<!-- encoder defaults to ch.qos.logback.classic.encoder.PatternLayoutEncoder -->
+		<encoder>
+			<pattern>
+				%date{yyyy-MM-dd HH:mm:ss:SSS} [%relative ms] %-5level [%50.50(%logger{36}.%method:%line)] ---- %msg%n
+			</pattern>
+			<charset>UTF-8</charset> <!-- 此处设置字符集 -->
+		</encoder>
+		<!-- Only log level WARN and above -->
+		<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+			<level>INFO</level>
+		</filter>
+	</appender>
+
+	<!-- Enable FILE and STDOUT appenders for all log messages. By default, 
+		only log at level INFO and above. -->
+	<root level="INFO">
+		<appender-ref ref="FILE" />
+		<appender-ref ref="STDOUT" />
+	</root>
+</configuration>

+ 0 - 34
src/main/resources/spring/applicationContext.xml

@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:context="http://www.springframework.org/schema/context"
-	xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:tx="http://www.springframework.org/schema/tx"
-	xmlns:cache="http://www.springframework.org/schema/cache" xmlns:util="http://www.springframework.org/schema/util"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd   
-	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
-	http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.1.xsd
-	http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.1.xsd
-	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd
-	http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd
-	http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.1.xsd">
-
-	<context:property-placeholder location="classpath*:spring/*.properties" />
-
-	<!-- 注册spring上下文对象 -->
-	<bean class="com.uas.report.support.ApplicationContextRegister" />
-
-	<!-- 系统参数注入 -->
-	<util:properties id="sys"
-		location="classpath:${profile}/sys.properties" />
-	<!-- jasperserver rest_v2 api 相关参数注入 -->
-	<util:properties id="js_rest_api"
-		location="classpath:spring/js-rest-api.properties" />
-		<!-- 容器启动后执行 -->
-	<bean class="com.uas.report.support.StartupProcessor"></bean>
-
-	<!-- 扫描注解 -->
-	<context:annotation-config />
-	<!-- 扫描的包 -->
-	<context:component-scan base-package="com.uas.report" />
-
-</beans>

+ 8 - 0
src/main/resources/spring/ehcache.xml

@@ -0,0 +1,8 @@
+<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:noNamespaceSchemaLocation="classpath:ehcache.xsd">
+	<diskStore path="java.io.tmpdir" />
+	<defaultCache maxElementsInMemory="10000" eternal="false"
+		timeToIdleSeconds="120" overflowToDisk="true" maxElementsOnDisk="10000000"
+		diskPersistent="false" diskExpiryThreadIntervalSeconds="120"
+		timeToLiveSeconds="8" memoryStoreEvictionPolicy="LRU" />
+</ehcache>

+ 270 - 0
src/main/resources/spring/ehcache.xsd

@@ -0,0 +1,270 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" version="1.7">
+
+    <xs:element name="ehcache">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element maxOccurs="1" minOccurs="0" ref="diskStore"/>
+                <xs:element maxOccurs="1" minOccurs="0" ref="transactionManagerLookup"/>
+                <xs:element maxOccurs="1" minOccurs="0" ref="cacheManagerEventListenerFactory"/>
+                <xs:element maxOccurs="unbounded" minOccurs="0" ref="cacheManagerPeerProviderFactory"/>
+                <xs:element maxOccurs="unbounded" minOccurs="0" ref="cacheManagerPeerListenerFactory"/>
+                <xs:element maxOccurs="1" minOccurs="0" ref="terracottaConfig"/>
+                <xs:element ref="defaultCache"/>
+                <xs:element maxOccurs="unbounded" minOccurs="0" ref="cache"/>
+            </xs:sequence>
+            <xs:attribute name="name" use="optional"/>
+            <xs:attribute default="true" name="updateCheck" type="xs:boolean" use="optional"/>
+            <xs:attribute default="autodetect" name="monitoring" type="monitoringType" use="optional"/>
+            <xs:attribute default="true" name="dynamicConfig" type="xs:boolean" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="diskStore">
+        <xs:complexType>
+            <xs:attribute name="path" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+     <xs:element name="transactionManagerLookup">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheManagerEventListenerFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheManagerPeerProviderFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheManagerPeerListenerFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="terracottaConfig">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element maxOccurs="1" minOccurs="0" name="tc-config">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:any maxOccurs="unbounded" minOccurs="0" processContents="skip"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+            <xs:attribute default="localhost:9510" name="url" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <!-- add clone support for addition of cacheExceptionHandler. Important! -->
+    <xs:element name="defaultCache">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheEventListenerFactory"/>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheExtensionFactory"/>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheLoaderFactory"/>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheDecoratorFactory"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="bootstrapCacheLoaderFactory"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="cacheExceptionHandlerFactory"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="terracotta"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="cacheWriter"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="copyStrategy"/>
+            </xs:sequence>
+            <xs:attribute name="diskExpiryThreadIntervalSeconds" type="xs:integer" use="optional"/>
+            <xs:attribute name="diskSpoolBufferSizeMB" type="xs:integer" use="optional"/>
+            <xs:attribute name="diskPersistent" type="xs:boolean" use="optional"/>
+            <xs:attribute name="diskAccessStripes" type="xs:integer" use="optional" default="1"/>
+            <xs:attribute name="eternal" type="xs:boolean" use="required"/>
+            <xs:attribute name="maxElementsInMemory" type="xs:integer" use="required"/>
+            <xs:attribute name="clearOnFlush" type="xs:boolean" use="optional"/>
+            <xs:attribute name="memoryStoreEvictionPolicy" type="xs:string" use="optional"/>
+            <xs:attribute name="overflowToDisk" type="xs:boolean" use="required"/>
+            <xs:attribute name="timeToIdleSeconds" type="xs:integer" use="optional"/>
+            <xs:attribute name="timeToLiveSeconds" type="xs:integer" use="optional"/>
+            <xs:attribute name="maxElementsOnDisk" type="xs:integer" use="optional"/>
+            <xs:attribute name="transactionalMode" type="transactionalMode" use="optional" default="off"/>
+            <xs:attribute name="statistics" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="copyOnRead" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="copyOnWrite" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="cacheLoaderTimeoutMillis" type="xs:integer" use="optional" default="0"/>
+            <xs:attribute name="overflowToOffHeap" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="maxMemoryOffHeap" type="xs:string" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cache">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheEventListenerFactory"/>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheExtensionFactory"/>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheLoaderFactory"/>
+                <xs:element minOccurs="0" maxOccurs="unbounded" ref="cacheDecoratorFactory"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="bootstrapCacheLoaderFactory"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="cacheExceptionHandlerFactory"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="terracotta"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="cacheWriter"/>
+                <xs:element minOccurs="0" maxOccurs="1" ref="copyStrategy"/>
+            </xs:sequence>
+            <xs:attribute name="diskExpiryThreadIntervalSeconds" type="xs:integer" use="optional"/>
+            <xs:attribute name="diskSpoolBufferSizeMB" type="xs:integer" use="optional"/>
+            <xs:attribute name="diskPersistent" type="xs:boolean" use="optional"/>
+            <xs:attribute name="diskAccessStripes" type="xs:integer" use="optional" default="1"/>
+            <xs:attribute name="eternal" type="xs:boolean" use="required"/>
+            <xs:attribute name="maxElementsInMemory" type="xs:integer" use="required"/>
+            <xs:attribute name="memoryStoreEvictionPolicy" type="xs:string" use="optional"/>
+            <xs:attribute name="clearOnFlush" type="xs:boolean" use="optional"/>
+            <xs:attribute name="name" type="xs:string" use="required"/>
+            <xs:attribute name="overflowToDisk" type="xs:boolean" use="required"/>
+            <xs:attribute name="timeToIdleSeconds" type="xs:integer" use="optional"/>
+            <xs:attribute name="timeToLiveSeconds" type="xs:integer" use="optional"/>
+            <xs:attribute name="maxElementsOnDisk" type="xs:integer" use="optional"/>
+            <xs:attribute name="transactionalMode" type="transactionalMode" use="optional" default="off" />
+            <xs:attribute name="statistics" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="copyOnRead" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="copyOnWrite" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="logging" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="cacheLoaderTimeoutMillis" type="xs:integer" use="optional" default="0"/>
+            <xs:attribute name="overflowToOffHeap" type="xs:boolean" use="optional" default="false"/>
+            <xs:attribute name="maxMemoryOffHeap" type="xs:string" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheEventListenerFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+            <xs:attribute name="listenFor" use="optional" type="notificationScope" default="all"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="bootstrapCacheLoaderFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheExtensionFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheExceptionHandlerFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheLoaderFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="cacheDecoratorFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:element name="terracotta">
+        <xs:complexType>
+            <xs:attribute name="clustered" use="optional" type="xs:boolean" default="true"/>
+            <xs:attribute name="valueMode" use="optional" type="terracottaCacheValueType" default="serialization"/>
+            <xs:attribute name="coherentReads" use="optional" type="xs:boolean" default="true"/>
+            <xs:attribute name="localKeyCache" use="optional" type="xs:boolean" default="false"/>
+            <xs:attribute name="localKeyCacheSize" use="optional" type="xs:positiveInteger" default="300000"/>
+            <xs:attribute name="orphanEviction" use="optional" type="xs:boolean" default="true"/>
+            <xs:attribute name="orphanEvictionPeriod" use="optional" type="xs:positiveInteger" default="4"/>
+            <xs:attribute name="copyOnRead" use="optional" type="xs:boolean" default="false"/>
+            <xs:attribute name="coherent" use="optional" type="xs:boolean" default="true"/>
+            <xs:attribute name="synchronousWrites" use="optional" type="xs:boolean" default="false"/>
+            <xs:attribute name="storageStrategy" use="optional" type="storageStrategyType" default="classic"/>
+            <xs:attribute name="concurrency" use="optional" type="xs:nonNegativeInteger" default="0"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:simpleType name="monitoringType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="autodetect"/>
+            <xs:enumeration value="on"/>
+            <xs:enumeration value="off"/>
+        </xs:restriction>
+    </xs:simpleType>
+    <xs:simpleType name="terracottaCacheValueType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="serialization" />
+            <xs:enumeration value="identity" />
+        </xs:restriction>
+    </xs:simpleType>
+    <xs:simpleType name="storageStrategyType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="classic" />
+            <xs:enumeration value="DCV2" />
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="transactionalMode">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="off"/>
+            <xs:enumeration value="xa"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:element name="cacheWriter">
+        <xs:complexType>
+            <xs:sequence >
+                <xs:element minOccurs="0" maxOccurs="1" ref="cacheWriterFactory"/>
+            </xs:sequence>
+            <xs:attribute name="writeMode" use="optional" type="writeModeType" default="write-through"/>
+            <xs:attribute name="notifyListenersOnException" use="optional" type="xs:boolean" default="false"/>
+            <xs:attribute name="minWriteDelay" use="optional" type="xs:nonNegativeInteger" default="1"/>
+            <xs:attribute name="maxWriteDelay" use="optional" type="xs:nonNegativeInteger" default="1"/>
+            <xs:attribute name="rateLimitPerSecond" use="optional" type="xs:nonNegativeInteger" default="0"/>
+            <xs:attribute name="writeCoalescing" use="optional" type="xs:boolean" default="false"/>
+            <xs:attribute name="writeBatching" use="optional" type="xs:boolean" default="false"/>
+            <xs:attribute name="writeBatchSize" use="optional" type="xs:positiveInteger" default="1"/>
+            <xs:attribute name="retryAttempts" use="optional" type="xs:nonNegativeInteger" default="0"/>
+            <xs:attribute name="retryAttemptDelaySeconds" use="optional" type="xs:nonNegativeInteger" default="1"/>
+        </xs:complexType>
+    </xs:element>
+    <xs:simpleType name="writeModeType">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="write-through" />
+            <xs:enumeration value="write-behind" />
+        </xs:restriction>
+    </xs:simpleType>
+    <xs:element name="cacheWriterFactory">
+        <xs:complexType>
+            <xs:attribute name="class" use="required"/>
+            <xs:attribute name="properties" use="optional"/>
+            <xs:attribute name="propertySeparator" use="optional"/>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="copyStrategy">
+        <xs:complexType>
+            <xs:attribute name="class" use="required" type="xs:string" />
+        </xs:complexType>
+    </xs:element>
+
+    <xs:simpleType name="notificationScope">
+        <xs:restriction base="xs:string">
+            <xs:enumeration value="local"/>
+            <xs:enumeration value="remote"/>
+            <xs:enumeration value="all"/>
+        </xs:restriction>
+    </xs:simpleType>
+</xs:schema>

+ 0 - 14
src/main/resources/spring/js-rest-api.properties

@@ -1,14 +0,0 @@
-schema=http
-host=192.168.253.60
-port=8080
-contextRoot=jasperserver
-rest=rest_v2
-resources=resources
-authorization=amFzcGVyYWRtaW46amFzcGVyYWRtaW4=
-#host=localhost
-#port=8081
-#contextRoot=jasperserver
-#rest=rest_v2
-#resources=resources
-#authorization=amFzcGVyYWRtaW46emh1aTEqOA==
-images=Picture

+ 0 - 15
src/main/resources/spring/logging.properties

@@ -1,15 +0,0 @@
-#Tomcat Logger
-
-handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler   
-  
-############################################################   
-# Handler specific properties.   
-# Describes specific configuration info for Handlers.   
-############################################################   
-  
-org.apache.juli.FileHandler.level = FINE   
-org.apache.juli.FileHandler.directory = ${catalina.base}/logs   
-org.apache.juli.FileHandler.prefix = error-debug.   
-  
-java.util.logging.ConsoleHandler.level = FINE   
-java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

+ 0 - 23
src/main/webapp/WEB-INF/log4j.properties

@@ -1,23 +0,0 @@
-# For JBoss: Avoid to setup Log4J outside $JBOSS_HOME/server/default/deploy/log4j.xml!
-# For all other servers: Comment out the Log4J listener in web.xml to activate Log4J.
-log4j.rootLogger=ERROR, stdout, logfile
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d %p [%C{1}.%M:%L] %m%n
-
-log4j.appender.logfile=org.apache.log4j.RollingFileAppender
-log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
-log4j.appender.logfile.File=../log4j.log
-# Keep three backup files.
-log4j.appender.logfile.MaxBackupIndex=3
-log4j.appender.logfile.MaxFileSize=5120KB
-# Pattern to output: date priority [category] - message
-log4j.appender.logfile.layout.ConversionPattern=%d %p [%C{1}.%M:%L] %m%n
-#log4j.logger.org.springframework.samples.petclinic.aspects=DEBUG
-
-log4j.logger.com.uas = info
-#=========================================
-#=   spring framewokr log configuration  =
-#=========================================
-log4j.logger.org.springframework = 

+ 0 - 147
src/main/webapp/WEB-INF/web.xml

@@ -1,147 +0,0 @@
-<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	version="3.0"
-	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://www.oracle.com/webfolder/technetwork/jsc/xml/ns/javaee/web-app_3_0.xsd">
-
-	<display-name>report</display-name>
-	<description>Print the reports</description>
-
-	<context-param>
-		<param-name>webAppRootKey</param-name>
-		<param-value>report.root</param-value>
-	</context-param>
-	<context-param>
-		<param-name>spring.profiles.active</param-name>
-		<param-value>production</param-value>
-	</context-param>
-	<context-param>
-		<param-name>log4jConfigLocation</param-name>
-		<param-value>/WEB-INF/log4j.properties</param-value>
-	</context-param>
-	<context-param>
-		<param-name>log4jRefreshInterval</param-name>
-		<param-value>60000</param-value>
-	</context-param>
-	<context-param>
-		<param-name>contextConfigLocation</param-name>
-		<param-value>classpath*:spring/applicationContext.xml</param-value>
-	</context-param>
-
-	<!-- filters -->
-	<filter>
-		<filter-name>CharacterEncodingFilter</filter-name>
-		<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
-		<async-supported>true</async-supported>
-		<init-param>
-			<param-name>encoding</param-name>
-			<param-value>UTF-8</param-value>
-		</init-param>
-		<init-param>
-			<param-name>forceEncoding</param-name>
-			<param-value>true</param-value>
-		</init-param>
-	</filter>
-	<filter-mapping>
-		<filter-name>CharacterEncodingFilter</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
-
-	<filter>
-		<filter-name>HttpMethodFilter</filter-name>
-		<filter-class>org.springframework.web.filter.HiddenHttpMethodFilter</filter-class>
-		<async-supported>true</async-supported>
-	</filter>
-	<filter-mapping>
-		<filter-name>HttpMethodFilter</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
-
-	<filter>
-		<filter-name>DruidWebStatFilter</filter-name>
-		<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
-		<init-param>
-			<param-name>exclusions</param-name>
-			<param-value>*.js,*.gif,*.jpg,*.png,*.bmp,*.css,*.ico,*.html,/druid/*</param-value>
-		</init-param>
-	</filter>
-	<filter-mapping>
-		<filter-name>DruidWebStatFilter</filter-name>
-		<url-pattern>/*</url-pattern>
-	</filter-mapping>
-
-	<!-- 文件删除过滤 -->
-	<filter>
-		<filter-name>FileDeleteFilter</filter-name>
-		<filter-class>com.uas.report.filter.FileDeleteFilter</filter-class>
-	</filter>
-	<filter-mapping>
-		<filter-name>FileDeleteFilter</filter-name>
-		<url-pattern>/file/delete</url-pattern>
-	</filter-mapping>
-
-	<!-- Handles Spring requests -->
-	<servlet>
-		<servlet-name>spring-mvc-dispatcher</servlet-name>
-		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-		<init-param>
-			<param-name>contextConfigLocation</param-name>
-			<param-value>/WEB-INF/webmvc.xml</param-value>
-		</init-param>
-		<load-on-startup>1</load-on-startup>
-		<async-supported>true</async-supported>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>spring-mvc-dispatcher</servlet-name>
-		<url-pattern>/</url-pattern>
-	</servlet-mapping>
-
-	<!-- DruidStatView -->
-	<servlet>
-		<servlet-name>DruidStatView</servlet-name>
-		<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
-		<init-param>
-			<!-- 允许清空统计数据 -->
-			<param-name>resetEnable</param-name>
-			<param-value>true</param-value>
-		</init-param>
-		<init-param>
-			<!-- 用户名 -->
-			<param-name>loginUsername</param-name>
-			<param-value>admin</param-value>
-		</init-param>
-		<init-param>
-			<!-- 密码 -->
-			<param-name>loginPassword</param-name>
-			<param-value>select123***</param-value>
-		</init-param>
-	</servlet>
-	<servlet-mapping>
-		<servlet-name>DruidStatView</servlet-name>
-		<url-pattern>/druid/*</url-pattern>
-	</servlet-mapping>
-
-	<!-- Axis webServices -->
-	<servlet>
-		<servlet-name>AxisServlet</servlet-name>
-		<display-name>Apache-Axis Servlet</display-name>
-		<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
-		<load-on-startup>1</load-on-startup>
-	</servlet>
-
-	<servlet-mapping>
-		<servlet-name>AxisServlet</servlet-name>
-		<url-pattern>/services/*</url-pattern>
-	</servlet-mapping>
-
-	<!-- Creates the Spring Container shared by all Servlets and Filters -->
-	<listener>
-		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-	</listener>
-	<listener>
-		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-	</listener>
-	<!-- Spring localization -->
-	<listener>
-		<listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
-	</listener>
-
-</web-app>

+ 0 - 52
src/main/webapp/WEB-INF/webmvc.xml

@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
-	xmlns:context="http://www.springframework.org/schema/context"
-	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
-
-	<mvc:annotation-driven>
-		<!-- 解决Controller返回String时中文乱码的问题 -->
-		<mvc:message-converters>
-			<!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
-			<bean id="fastJsonHttpMessageConverter"
-				class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
-				<property name="supportedMediaTypes">
-					<list>
-						<value>application/json;charset=UTF-8</value>
-					</list>
-				</property>
-				<property name="features">
-					<list>
-						<value>DisableCircularReferenceDetect</value>
-					</list>
-				</property>
-			</bean>
-			<bean class="org.springframework.http.converter.StringHttpMessageConverter">
-				<!-- 不可为text/plain -->
-				<property name="supportedMediaTypes" value="text/html;charset=UTF-8" />
-			</bean>
-		</mvc:message-converters>
-	</mvc:annotation-driven>
-
-	<mvc:default-servlet-handler />
-
-	<mvc:resources mapping="/static/**" location="/resources/" />
-
-	<context:component-scan base-package="com.uas.report" />
-
-	<bean id="multipartResolver"
-		class="org.springframework.web.multipart.commons.CommonsMultipartResolver" />
-
-	<bean
-		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
-		<property name="prefix" value="/WEB-INF/views/" />
-		<property name="suffix" value=".html" />
-		<property name="contentType" value="text/html;charset=UTF-8" />
-	</bean>
-
-	<mvc:view-controller path="/" view-name="index" />
-	<mvc:view-controller path="/console" view-name="console" />
-	<mvc:view-controller path="/fileUpload" view-name="fileUpload" />
-	<mvc:view-controller path="/preview" view-name="preview" />
-	<mvc:view-controller path="/files" view-name="files" />
-</beans>