62 files added
3 files modified
New file |
| | |
| | | server = https://form.sunscloud.com/autoForm |
| | | |
| | | authUrl = /auth/ |
| | | datasourceUrl = /datasource/getFormdatsourceListService |
| | | interfaceUrl = /forminterface/getFormInterfaceListService |
| | | eventUrl = /formevent/getFormEventListService |
| | | resourceUrl = /formresource/getFormresourcePathService |
| | | apiUrl = /formapi/getFormApiListService |
| | | publishPasswordUrl= /publish/getPublishPasswordService |
| | | formbaseUrl = /formbase/getFormInfoService |
| | | |
| | | publicUser= WangYX |
| | | publicPassword= 123456 |
| | | |
| | | driver=com.mysql.jdbc.Driver |
| | | url=jdbc:mysql://10.4.32.139:8066/FORM_DB?characterEncoding=utf8&useSSL=true&serverTimezone=GMT%2B8username=root |
| | | username=root |
| | | password=123456 |
| | | #\u5b9a\u4e49\u521d\u59cb\u8fde\u63a5\u6570 |
| | | initialSize=0 |
| | | #\u5b9a\u4e49\u6700\u5927\u8fde\u63a5\u6570 |
| | | maxActive=20 |
| | | #\u5b9a\u4e49\u6700\u5927\u7a7a\u95f2 |
| | | maxIdle=20 |
| | | #\u5b9a\u4e49\u6700\u5c0f\u7a7a\u95f2 |
| | | minIdle=1 |
| | | #\u5b9a\u4e49\u6700\u957f\u7b49\u5f85\u65f6\u95f4 |
| | | maxWait=60000 |
New file |
| | |
| | | driver=com.mysql.jdbc.Driver |
| | | url=jdbc:mysql://10.4.32.139:8066/FORM_DB?characterEncoding=utf8&useSSL=true&serverTimezone=GMT%2B8 |
| | | username=root |
| | | password=123456 |
| | | #\u5b9a\u4e49\u521d\u59cb\u8fde\u63a5\u6570 |
| | | initialSize=0 |
| | | #\u5b9a\u4e49\u6700\u5927\u8fde\u63a5\u6570 |
| | | maxActive=20 |
| | | #\u5b9a\u4e49\u6700\u5927\u7a7a\u95f2 |
| | | maxIdle=20 |
| | | #\u5b9a\u4e49\u6700\u5c0f\u7a7a\u95f2 |
| | | minIdle=1 |
| | | #\u5b9a\u4e49\u6700\u957f\u7b49\u5f85\u65f6\u95f4 |
| | | maxWait=60000 |
| | | |
| | | |
New file |
| | |
| | | log4j.rootLogger=INFO,Console,File |
| | | #定义日志输出目的地为控制台 |
| | | log4j.appender.Console=org.apache.log4j.ConsoleAppender |
| | | log4j.appender.Console.Target=System.out |
| | | #可以灵活地指定日志输出格式,下面一行是指定具体的格式 |
| | | log4j.appender.Console.layout = org.apache.log4j.PatternLayout |
| | | log4j.appender.Console.layout.ConversionPattern=[%c] - %m%n |
| | | |
| | | #文件大小到达指定尺寸的时候产生一个新的文件 |
| | | log4j.appender.File = org.apache.log4j.RollingFileAppender |
| | | #指定输出目录 |
| | | log4j.appender.File.File = /home/tuser/autoForm/log/ssm.log |
| | | #定义文件最大大小 |
| | | log4j.appender.File.MaxFileSize = 10MB |
| | | # 输出所以日志,如果换成DEBUG表示输出DEBUG以上级别日志 |
| | | log4j.appender.File.Threshold = ALL |
| | | log4j.appender.File.layout = org.apache.log4j.PatternLayout |
| | | log4j.appender.File.layout.ConversionPattern =[%p] [%d{yyyy-MM-dd HH\:mm\:ss}][%c]%m%n |
New file |
| | |
| | | <?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:p="http://www.springframework.org/schema/p" |
| | | xmlns:context="http://www.springframework.org/schema/context" |
| | | xmlns:mvc="http://www.springframework.org/schema/mvc" |
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans |
| | | http://www.springframework.org/schema/beans/spring-beans-3.1.xsd |
| | | http://www.springframework.org/schema/context |
| | | http://www.springframework.org/schema/context/spring-context-3.1.xsd |
| | | http://www.springframework.org/schema/mvc |
| | | http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> |
| | | <!-- 自动扫描该包,使SpringMVC认为包下用了@controller注解的类是控制器 --> |
| | | <context:component-scan base-package="com.javen.controller" /> |
| | | <!-- 扩充了注解驱动,可以将请求参数绑定到控制器参数 --> |
| | | <mvc:annotation-driven/> |
| | | <!-- 静态资源处理 css js imgs --> |
| | | <!--<mvc:resources location="/resources/**" mapping="/resources"/>--> |
| | | <mvc:default-servlet-handler /> |
| | | |
| | | <!--避免IE执行AJAX时,返回JSON出现下载文件 --> |
| | | <bean id="mappingJacksonHttpMessageConverter" |
| | | class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> |
| | | <property name="supportedMediaTypes"> |
| | | <list> |
| | | <value>text/html;charset=UTF-8</value> |
| | | </list> |
| | | </property> |
| | | </bean> |
| | | <!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 --> |
| | | <bean |
| | | class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> |
| | | <property name="messageConverters"> |
| | | <list> |
| | | <ref bean="mappingJacksonHttpMessageConverter" /> <!-- JSON转换器 --> |
| | | </list> |
| | | </property> |
| | | </bean> |
| | | |
| | | <!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 --> |
| | | <bean id="multipartResolver" |
| | | class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> |
| | | <!-- 默认编码 --> |
| | | <property name="defaultEncoding" value="utf-8" /> |
| | | <!-- 文件大小最大值 --> |
| | | <property name="maxUploadSize" value="10485760000" /> |
| | | <!-- 内存中的最大值 --> |
| | | <property name="maxInMemorySize" value="40960" /> |
| | | <!-- 启用是为了推迟文件解析,以便捕获文件大小异常 --> |
| | | <property name="resolveLazily" value="true"/> |
| | | </bean> |
| | | |
| | | <!-- 配置ViewResolver 。可用多个ViewResolver 。使用order属性排序。 InternalResourceViewResolver 放在最后--> |
| | | <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> |
| | | <property name="order" value="1"></property> |
| | | <property name="mediaTypes"> |
| | | <map> |
| | | <!-- 告诉视图解析器,返回的类型为json格式 --> |
| | | <entry key="json" value="application/json" /> |
| | | <entry key="xml" value="application/xml" /> |
| | | <entry key="htm" value="text/htm" /> |
| | | </map> |
| | | </property> |
| | | <property name="defaultViews"> |
| | | <list> |
| | | <!-- ModelAndView里的数据变成JSON --> |
| | | <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" /> |
| | | </list> |
| | | </property> |
| | | <property name="ignoreAcceptHeader" value="true"></property> |
| | | </bean> |
| | | |
| | | <!-- 定义跳转的文件的前后缀 ,视图模式配置--> |
| | | <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> |
| | | <!-- 这里的配置我的理解是自动给后面action的方法return的字符串加上前缀和后缀,变成一个 可用的url地址 --> |
| | | <property name="prefix" value="/WEB-INF/jsp/" /> |
| | | <property name="suffix" value=".jsp" /> |
| | | </bean> |
| | | </beans> |
New file |
| | |
| | | <?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:p="http://www.springframework.org/schema/p" |
| | | xmlns:context="http://www.springframework.org/schema/context" |
| | | xmlns:mvc="http://www.springframework.org/schema/mvc" |
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans |
| | | http://www.springframework.org/schema/beans/spring-beans-3.1.xsd |
| | | http://www.springframework.org/schema/context |
| | | http://www.springframework.org/schema/context/spring-context-3.1.xsd |
| | | http://www.springframework.org/schema/mvc |
| | | http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> |
| | | <!-- 自动扫描 --> |
| | | <context:component-scan base-package="com.javen" /> |
| | | |
| | | <!-- 引入配置文件 --> |
| | | <bean id="propertyConfigurer" |
| | | class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> |
| | | <property name="location" value="classpath:application.properties" /> |
| | | </bean> |
| | | |
| | | <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" |
| | | destroy-method="close"> |
| | | <property name="driverClassName" value="${driver}" /> |
| | | <property name="url" value="${url}" /> |
| | | <property name="username" value="${username}" /> |
| | | <property name="password" value="${password}" /> |
| | | <!-- 初始化连接大小 --> |
| | | <property name="initialSize" value="${initialSize}"></property> |
| | | <!-- 连接池最大数量 --> |
| | | <property name="maxActive" value="${maxActive}"></property> |
| | | <!-- 连接池最大空闲 --> |
| | | <property name="maxIdle" value="${maxIdle}"></property> |
| | | <!-- 连接池最小空闲 --> |
| | | <property name="minIdle" value="${minIdle}"></property> |
| | | <!-- 获取连接最大等待时间 --> |
| | | <property name="maxWait" value="${maxWait}"></property> |
| | | </bean> |
| | | |
| | | <!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 --> |
| | | <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> |
| | | <property name="dataSource" ref="dataSource" /> |
| | | <!-- 自动扫描mapping.xml文件 --> |
| | | <!--<property name="mapperLocations" value="classpath:com/javen/mapping/*.xml"></property> --> |
| | | </bean> |
| | | |
| | | <!-- DAO接口所在包名,Spring会自动查找其下的类 --> |
| | | <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> |
| | | <property name="basePackage" value="com.javen.dao" /> |
| | | <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property> |
| | | </bean> |
| | | |
| | | <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx --> |
| | | <bean id="transactionManager" |
| | | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
| | | <property name="dataSource" ref="dataSource" /> |
| | | </bean> |
| | | |
| | | </beans> |
New file |
| | |
| | | #Generated by Maven |
| | | #Wed Aug 15 17:51:05 CST 2018 |
| | | version=0.0.1-SNAPSHOT |
| | | groupId=com.javen.maven02 |
| | | artifactId=maven02 |
New file |
| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by Fernflower decompiler) |
| | | // |
| | | |
| | | package com.javen.common; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.DefaultHttpClient; |
| | | import org.apache.http.message.BasicHeader; |
| | | import org.apache.http.util.EntityUtils; |
| | | |
| | | public class HttpRequest { |
| | | public HttpRequest() { |
| | | } |
| | | |
| | | public static String sendGet(String url, String param, String token) { |
| | | String result = ""; |
| | | BufferedReader in = null; |
| | | |
| | | try { |
| | | String urlNameString = url + "?" + param; |
| | | URL realUrl = new URL(urlNameString); |
| | | URLConnection connection = realUrl.openConnection(); |
| | | connection.setRequestProperty("Access-Control-Allow-Origin", "http://localhost:8080, http://122.114.42.114:8089, http://localhost:2345,http://zhongwd.top:8080"); |
| | | connection.setRequestProperty("Access-Control-Allow-Methods", "GET"); |
| | | connection.setRequestProperty("Access-Control-Allow-Headers", "x-requested-with,content-type"); |
| | | connection.setRequestProperty("Content-Type", "application/json"); |
| | | connection.setRequestProperty("Authorization", "Bearer " + token); |
| | | connection.connect(); |
| | | Map<String, List<String>> map = connection.getHeaderFields(); |
| | | Iterator var10 = map.keySet().iterator(); |
| | | |
| | | String line; |
| | | while(var10.hasNext()) { |
| | | line = (String)var10.next(); |
| | | System.out.println(line + "--->" + map.get(line)); |
| | | } |
| | | |
| | | for(in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8")); (line = in.readLine()) != null; result = result + line) { |
| | | ; |
| | | } |
| | | } catch (Exception var19) { |
| | | System.out.println("����GET��������쳣��" + var19); |
| | | var19.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | } catch (Exception var18) { |
| | | var18.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static String get(String url, String param, String token) { |
| | | String result = ""; |
| | | |
| | | try { |
| | | DefaultHttpClient client = new DefaultHttpClient(); |
| | | String urlNameString = url + "?" + param; |
| | | HttpGet get = new HttpGet(urlNameString); |
| | | get.setHeader("Access-Control-Allow-Origin", "*"); |
| | | get.setHeader("Access-Control-Allow-Methods", "GET"); |
| | | get.setHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); |
| | | get.setHeader("Content-Type", "application/json"); |
| | | get.setHeader("Authorization", "Bearer " + token); |
| | | get.setHeader("Cookie", "openId=test;"); |
| | | HttpResponse response = client.execute(get); |
| | | if (response.getStatusLine().getStatusCode() == 200) { |
| | | result = EntityUtils.toString(response.getEntity()); |
| | | } else { |
| | | result = ""; |
| | | } |
| | | } catch (Exception var8) { |
| | | ; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static String post(String url, JSONObject param) { |
| | | HttpClient client = new DefaultHttpClient(); |
| | | HttpPost post = new HttpPost(url); |
| | | post.setHeader("Content-Type", "application/json"); |
| | | post.addHeader("Access-Control-Allow-Origin", "*"); |
| | | post.addHeader("Access-Control-Allow-Methods", "POST"); |
| | | post.addHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); |
| | | post.addHeader("Cookie", "openId=test;"); |
| | | String result = ""; |
| | | |
| | | try { |
| | | StringEntity s = new StringEntity(param.toString(), "utf-8"); |
| | | s.setContentEncoding(new BasicHeader("Content-Type", "application/json")); |
| | | post.setEntity(s); |
| | | HttpResponse httpResponse = client.execute(post); |
| | | InputStream inStream = httpResponse.getEntity().getContent(); |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, "utf-8")); |
| | | StringBuilder strber = new StringBuilder(); |
| | | String line = null; |
| | | |
| | | while((line = reader.readLine()) != null) { |
| | | strber.append(line + "\n"); |
| | | } |
| | | |
| | | inStream.close(); |
| | | result = strber.toString(); |
| | | } catch (Exception var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.err.println("111"); |
| | | } |
| | | } |
| | |
| | | //window.localStorage.setItem("userName",JSON.stringify(username)); |
| | | </script> |
| | | |
| | | <div id="CursorLayerCanvas" style="display: none;"></div> |
| | | <div id="CursorLayerCanvas" style="display: none;"></div> |
| | | <script type="text/javascript" charset="utf-8" src="../js/vender/jquery-2.2.3.min.js"></script> |
| | | <script type="text/javascript" charset="utf-8" src="../js/vender/jquery-ui.js"></script> |
| | | <!-- <script type="text/javascript" charset="utf-8" src="../js/vender/all.js"></script> --> |
| | |
| | | $("#auth").click(function(){ |
| | | var param = {}; |
| | | param.accesspassword = $("#password").val(); |
| | | param.ver = $("#ver").val(); |
| | | // param.openId = getCookie("openId"); |
| | | // param.formId = getEnclocal("customForm").newFormID; |
| | | if (!param.accesspassword) { |
| | | customBase.alert("E", "密码不能为空!"); |
| | | return; |
| | | } |
| | | if(!param.ver){ |
| | | customBase.alert("E", "验证码不能为空!"); |
| | | return; |
| | | } |
| | | $.ajax({ |
| | | type : "POST", |
| | | dataType : "text", |
| | |
| | | success : function(data){ |
| | | if(data == "success") { |
| | | hideDiv('showPassword'); |
| | | } else { |
| | | alert("密码错误"); |
| | | } else if(data == "error"){ |
| | | customBase.alert("E", "验证码错误!"); |
| | | reloadPic(); |
| | | }else { |
| | | customBase.alert("E", "密码错误!"); |
| | | reloadPic(); |
| | | // alert("密码错误"); |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | |
| | | <div id="showPassword" class="pop-box"> |
| | | <div class="x-dialog"> |
| | | <div class="x-dialog" style="height: 260px;"> |
| | | <div class="dialog-header"> |
| | | <span style="font-size:16">密码登录</span> |
| | | <!--<span class="fa fa-remove x-close"></span> --> |
| | |
| | | <div class="dialog-body"> |
| | | <div class="x-layout-table"> |
| | | <div class="x-layout-table-row" style="left: 33px;top: 26px;height: 30px;"> |
| | | <div class="x-layout-table-item fui_text"> |
| | | <div class="x-layout-table-item fui_text" id = "a"> |
| | | <div class="x-lock"><img class="lockImg" src="../img/lock.png" alt="" /></div> |
| | | <input id="password" type="password" placeholder="请输入密码" class="x-input" style="" > |
| | | <input id = "ver" class="x-input" style="width: 60%;margin-top: 15px;padding-left: 20px;" placeholder="请输入验证码"> |
| | | <img src="${ctx }/publish/generate?t=1" id="checkCode" align="middle" onclick="reloadPic()" style=" margin-top: 15px;width: 23%; height: 32px;border-radius: 4px;"> |
| | | |
| | | </div> |
| | | </div> |
| | | <div class="x-layout-table-row" style="left: 40px;top: 58px;"> |
| | | <div class="x-layout-table-row" style="left: -50px;top: 125px;"> |
| | | <div class="x-layout-table-item fui_text x-login "> |
| | | <button class="loginBtn" style="" id="auth">登录</button> |
| | | </div> |
| | |
| | | // console.log($('#showPassword')) |
| | | |
| | | //} |
| | | function reloadPic() { |
| | | document.getElementById("checkCode").src = document.getElementById("checkCode").src + "1"; |
| | | } |
| | | </script> |
| | | </html> |
| | |
| | | return commonData; |
| | | }; |
| | | |
| | | window.commonUploadPicture = function (formId) { |
| | | var commonData = { |
| | | server: baseUrl + '/common/uploadPicture', |
| | | formData: { |
| | | 'filepath': tenantIDObj.tenantID + '/' + formId + '/images' |
| | | }, |
| | | headers: { // 默认添加请求头 |
| | | "Authorization": "Bearer " + tokenObj |
| | | }, |
| | | }; |
| | | return commonData; |
| | | }; |
| | | |
| | | |
| | | window.commonGetApiJson = function (url, callback) { |
| | | $.getJSON(url, callback); |
| | | }; |
| | |
| | | swf: '../../dist/Uploader.swf', |
| | | } |
| | | } |
| | | var webUploaderJson = $.extend(webUploaderJson, window.commonWebUploaderJson(potion.formid)); |
| | | var webUploaderJson = $.extend(webUploaderJson, window.commonUploadPicture(potion.formid)); |
| | | |
| | | |
| | | // 初始化Web Uploader |
| | |
| | | fileSizeLimit: 200 * 1024 * 1024, // 200 M |
| | | fileSingleSizeLimit: 50 * 1024 * 1024 // 50 M |
| | | } |
| | | var webUploaderJson = $.extend(webUploaderJson, window.commonWebUploaderJson(formID)); |
| | | var webUploaderJson = $.extend(webUploaderJson, window.commonUploadPicture(formID)); |
| | | |
| | | // 实例化 |
| | | uploader = WebUploader.create(webUploaderJson); |
New file |
| | |
| | | server = https://form.sunscloud.com/autoForm |
| | | |
| | | authUrl = /auth/ |
| | | datasourceUrl = /datasource/getFormdatsourceListService |
| | | interfaceUrl = /forminterface/getFormInterfaceListService |
| | | eventUrl = /formevent/getFormEventListService |
| | | resourceUrl = /formresource/getFormresourcePathService |
| | | apiUrl = /formapi/getFormApiListService |
| | | publishPasswordUrl= /publish/getPublishPasswordService |
| | | formbaseUrl = /formbase/getFormInfoService |
| | | |
| | | publicUser= WangYX |
| | | publicPassword= 123456 |
| | | |
| | | driver=com.mysql.jdbc.Driver |
| | | url=jdbc:mysql://10.4.32.139:8066/FORM_DB?characterEncoding=utf8&useSSL=true&serverTimezone=GMT%2B8username=root |
| | | username=root |
| | | password=123456 |
| | | #\u5b9a\u4e49\u521d\u59cb\u8fde\u63a5\u6570 |
| | | initialSize=0 |
| | | #\u5b9a\u4e49\u6700\u5927\u8fde\u63a5\u6570 |
| | | maxActive=20 |
| | | #\u5b9a\u4e49\u6700\u5927\u7a7a\u95f2 |
| | | maxIdle=20 |
| | | #\u5b9a\u4e49\u6700\u5c0f\u7a7a\u95f2 |
| | | minIdle=1 |
| | | #\u5b9a\u4e49\u6700\u957f\u7b49\u5f85\u65f6\u95f4 |
| | | maxWait=60000 |
New file |
| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by Fernflower decompiler) |
| | | // |
| | | |
| | | package com.javen.bean; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class TenantID implements Serializable { |
| | | private static final long serialVersionUID = -7562732840361602324L; |
| | | private String tenantID = ""; |
| | | |
| | | public TenantID() { |
| | | } |
| | | |
| | | public String getTenantID() { |
| | | return this.tenantID; |
| | | } |
| | | |
| | | public void setTenantID(String tenantID) { |
| | | this.tenantID = tenantID; |
| | | } |
| | | |
| | | public static long getSerialversionuid() { |
| | | return -7562732840361602324L; |
| | | } |
| | | } |
New file |
| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by Fernflower decompiler) |
| | | // |
| | | |
| | | package com.javen.common; |
| | | |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Configuration; |
| | | |
| | | @Configuration |
| | | public class ApplicationConfig { |
| | | @Value("${authUrl}") |
| | | public String authUrl; |
| | | @Value("${server}") |
| | | public String server; |
| | | @Value("${interfaceUrl}") |
| | | public String interfaceUrl; |
| | | @Value("${eventUrl}") |
| | | public String eventUrl; |
| | | @Value("${resourceUrl}") |
| | | public String resourceUrl; |
| | | @Value("${publicUser}") |
| | | public String publicUser; |
| | | @Value("${publicPassword}") |
| | | public String publicPassword; |
| | | @Value("${apiUrl}") |
| | | public String apiUrl; |
| | | @Value("${datasourceUrl}") |
| | | public String datasourceUrl; |
| | | @Value("${publishPasswordUrl}") |
| | | public String publishPasswordUrl; |
| | | @Value("${formbaseUrl}") |
| | | public String formbaseUrl; |
| | | |
| | | public ApplicationConfig() { |
| | | } |
| | | } |
New file |
| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by Fernflower decompiler) |
| | | // |
| | | |
| | | package com.javen.common; |
| | | |
| | | import java.io.UnsupportedEncodingException; |
| | | import sun.misc.BASE64Decoder; |
| | | import sun.misc.BASE64Encoder; |
| | | |
| | | public class Base64 { |
| | | public Base64() { |
| | | } |
| | | |
| | | public static String getBase64(String str) { |
| | | byte[] b = null; |
| | | String s = null; |
| | | |
| | | try { |
| | | b = str.getBytes("utf-8"); |
| | | } catch (UnsupportedEncodingException var4) { |
| | | var4.printStackTrace(); |
| | | } |
| | | |
| | | if (b != null) { |
| | | s = (new BASE64Encoder()).encode(b); |
| | | } |
| | | |
| | | return s; |
| | | } |
| | | |
| | | public static String getFromBase64(String s) { |
| | | byte[] b = null; |
| | | String result = null; |
| | | if (s != null) { |
| | | BASE64Decoder decoder = new BASE64Decoder(); |
| | | |
| | | try { |
| | | b = decoder.decodeBuffer(s); |
| | | result = new String(b, "utf-8"); |
| | | } catch (Exception var5) { |
| | | var5.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | } |
New file |
| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by Fernflower decompiler) |
| | | // |
| | | |
| | | package com.javen.common; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.net.URL; |
| | | import java.net.URLConnection; |
| | | import java.util.Iterator; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.http.client.HttpClient; |
| | | import org.apache.http.client.methods.HttpGet; |
| | | import org.apache.http.client.methods.HttpPost; |
| | | import org.apache.http.entity.StringEntity; |
| | | import org.apache.http.impl.client.DefaultHttpClient; |
| | | import org.apache.http.message.BasicHeader; |
| | | import org.apache.http.util.EntityUtils; |
| | | |
| | | public class HttpRequest { |
| | | public HttpRequest() { |
| | | } |
| | | |
| | | public static String sendGet(String url, String param, String token) { |
| | | String result = ""; |
| | | BufferedReader in = null; |
| | | |
| | | try { |
| | | String urlNameString = url + "?" + param; |
| | | URL realUrl = new URL(urlNameString); |
| | | URLConnection connection = realUrl.openConnection(); |
| | | connection.setRequestProperty("Access-Control-Allow-Origin", "http://localhost:8080, http://122.114.42.114:8089, http://localhost:2345,http://zhongwd.top:8080"); |
| | | connection.setRequestProperty("Access-Control-Allow-Methods", "GET"); |
| | | connection.setRequestProperty("Access-Control-Allow-Headers", "x-requested-with,content-type"); |
| | | connection.setRequestProperty("Content-Type", "application/json"); |
| | | connection.setRequestProperty("Authorization", "Bearer " + token); |
| | | connection.connect(); |
| | | Map<String, List<String>> map = connection.getHeaderFields(); |
| | | Iterator var10 = map.keySet().iterator(); |
| | | |
| | | String line; |
| | | while(var10.hasNext()) { |
| | | line = (String)var10.next(); |
| | | System.out.println(line + "--->" + map.get(line)); |
| | | } |
| | | |
| | | for(in = new BufferedReader(new InputStreamReader(connection.getInputStream(), "utf-8")); (line = in.readLine()) != null; result = result + line) { |
| | | ; |
| | | } |
| | | } catch (Exception var19) { |
| | | System.out.println("����GET��������쳣��" + var19); |
| | | var19.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | if (in != null) { |
| | | in.close(); |
| | | } |
| | | } catch (Exception var18) { |
| | | var18.printStackTrace(); |
| | | } |
| | | |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static String get(String url, String param, String token) { |
| | | String result = ""; |
| | | |
| | | try { |
| | | DefaultHttpClient client = new DefaultHttpClient(); |
| | | String urlNameString = url + "?" + param; |
| | | HttpGet get = new HttpGet(urlNameString); |
| | | get.setHeader("Access-Control-Allow-Origin", "*"); |
| | | get.setHeader("Access-Control-Allow-Methods", "GET"); |
| | | get.setHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); |
| | | get.setHeader("Content-Type", "application/json"); |
| | | get.setHeader("Authorization", "Bearer " + token); |
| | | get.setHeader("Cookie", "openId=test;"); |
| | | HttpResponse response = client.execute(get); |
| | | if (response.getStatusLine().getStatusCode() == 200) { |
| | | result = EntityUtils.toString(response.getEntity()); |
| | | } else { |
| | | result = ""; |
| | | } |
| | | } catch (Exception var8) { |
| | | ; |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static String post(String url, JSONObject param) { |
| | | HttpClient client = new DefaultHttpClient(); |
| | | HttpPost post = new HttpPost(url); |
| | | post.setHeader("Content-Type", "application/json"); |
| | | post.addHeader("Access-Control-Allow-Origin", "*"); |
| | | post.addHeader("Access-Control-Allow-Methods", "POST"); |
| | | post.addHeader("Access-Control-Allow-Headers", "x-requested-with,content-type"); |
| | | post.addHeader("Cookie", "openId=test;"); |
| | | String result = ""; |
| | | |
| | | try { |
| | | StringEntity s = new StringEntity(param.toString(), "utf-8"); |
| | | s.setContentEncoding(new BasicHeader("Content-Type", "application/json")); |
| | | post.setEntity(s); |
| | | HttpResponse httpResponse = client.execute(post); |
| | | InputStream inStream = httpResponse.getEntity().getContent(); |
| | | BufferedReader reader = new BufferedReader(new InputStreamReader(inStream, "utf-8")); |
| | | StringBuilder strber = new StringBuilder(); |
| | | String line = null; |
| | | |
| | | while((line = reader.readLine()) != null) { |
| | | strber.append(line + "\n"); |
| | | } |
| | | |
| | | inStream.close(); |
| | | result = strber.toString(); |
| | | } catch (Exception var11) { |
| | | var11.printStackTrace(); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | System.err.println("111"); |
| | | } |
| | | } |
New file |
| | |
| | | package com.javen.common; |
| | | |
| | | import java.awt.Color; |
| | | import java.awt.Font; |
| | | import java.awt.Graphics; |
| | | import java.awt.Graphics2D; |
| | | import java.awt.RenderingHints; |
| | | import java.awt.geom.AffineTransform; |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.util.Arrays; |
| | | import java.util.Random; |
| | | |
| | | |
| | | import javax.imageio.ImageIO; |
| | | |
| | | |
| | | /** |
| | | * 生成验证码 |
| | | */ |
| | | public class VerifyCodeUtils { |
| | | |
| | | |
| | | // 使用到'楷体'字体,系统里没有的话需要安装字体,字体只显示大写,去掉了1,0,i,o几个容易混淆的字符 |
| | | public static final String VERIFY_CODES = "23456789abcdefghjkmnprstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"; |
| | | private static Random random = new Random(); |
| | | |
| | | |
| | | /** |
| | | * 使用系统默认字符源生成验证码 |
| | | * |
| | | * @param verifySize |
| | | * 验证码长度 |
| | | * @return |
| | | */ |
| | | public static String generateVerifyCode(int verifySize) { |
| | | return generateVerifyCode(verifySize, VERIFY_CODES); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 使用指定源生成验证码 |
| | | * |
| | | * @param verifySize |
| | | * 验证码长度 |
| | | * @param sources |
| | | * 验证码字符源 |
| | | * @return |
| | | */ |
| | | public static String generateVerifyCode(int verifySize, String sources) { |
| | | if (sources == null || sources.length() == 0) { |
| | | sources = VERIFY_CODES; |
| | | } |
| | | int codesLen = sources.length(); |
| | | Random rand = new Random(System.currentTimeMillis()); |
| | | StringBuilder verifyCode = new StringBuilder(verifySize); |
| | | for (int i = 0; i < verifySize; i++) { |
| | | verifyCode.append(sources.charAt(rand.nextInt(codesLen - 1))); |
| | | } |
| | | return verifyCode.toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成随机验证码文件,并返回验证码值 |
| | | * |
| | | * @param w |
| | | * @param h |
| | | * @param outputFile |
| | | * @param verifySize |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static String outputVerifyImage(int w, int h, File outputFile, |
| | | int verifySize) throws IOException { |
| | | String verifyCode = generateVerifyCode(verifySize); |
| | | outputImage(w, h, outputFile, verifyCode); |
| | | return verifyCode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 输出随机验证码图片流,并返回验证码值 |
| | | * |
| | | * @param w |
| | | * @param h |
| | | * @param os |
| | | * @param verifySize |
| | | * @return |
| | | * @throws IOException |
| | | */ |
| | | public static String outputVerifyImage(int w, int h, OutputStream os, |
| | | int verifySize) throws IOException { |
| | | String verifyCode = generateVerifyCode(verifySize); |
| | | outputImage(w, h, os, verifyCode); |
| | | return verifyCode; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 生成指定验证码图像文件 |
| | | * |
| | | * @param w |
| | | * @param h |
| | | * @param outputFile |
| | | * @param code |
| | | * @throws IOException |
| | | */ |
| | | public static void outputImage(int w, int h, File outputFile, String code) |
| | | throws IOException { |
| | | if (outputFile == null) { |
| | | return; |
| | | } |
| | | File dir = outputFile.getParentFile(); |
| | | if (!dir.exists()) { |
| | | dir.mkdirs(); |
| | | } |
| | | try { |
| | | outputFile.createNewFile(); |
| | | FileOutputStream fos = new FileOutputStream(outputFile); |
| | | outputImage(w, h, fos, code); |
| | | fos.close(); |
| | | } catch (IOException e) { |
| | | throw e; |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 输出指定验证码图片流 |
| | | * |
| | | * @param w |
| | | * @param h |
| | | * @param os |
| | | * @param code |
| | | * @throws IOException |
| | | */ |
| | | public static void outputImage(int w, int h, OutputStream os, String code) |
| | | throws IOException { |
| | | int verifySize = code.length(); |
| | | BufferedImage image = new BufferedImage(w, h, |
| | | BufferedImage.TYPE_INT_RGB); |
| | | Random rand = new Random(); |
| | | Graphics2D g2 = image.createGraphics(); |
| | | g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, |
| | | RenderingHints.VALUE_ANTIALIAS_ON); |
| | | Color[] colors = new Color[5]; |
| | | Color[] colorSpaces = new Color[] { Color.WHITE, Color.CYAN, |
| | | Color.GRAY, Color.LIGHT_GRAY, Color.MAGENTA, Color.ORANGE, |
| | | Color.PINK, Color.YELLOW }; |
| | | float[] fractions = new float[colors.length]; |
| | | for (int i = 0; i < colors.length; i++) { |
| | | colors[i] = colorSpaces[rand.nextInt(colorSpaces.length)]; |
| | | fractions[i] = rand.nextFloat(); |
| | | } |
| | | Arrays.sort(fractions); |
| | | |
| | | |
| | | g2.setColor(Color.GRAY);// 设置边框色 |
| | | g2.fillRect(0, 0, w, h); |
| | | |
| | | |
| | | Color c = getRandColor(200, 250); |
| | | g2.setColor(c);// 设置背景色 |
| | | g2.fillRect(0, 2, w, h - 4); |
| | | |
| | | |
| | | // 绘制干扰线 |
| | | Random random = new Random(); |
| | | g2.setColor(getRandColor(160, 200));// 设置线条的颜色 |
| | | for (int i = 0; i < 20; i++) { |
| | | int x = random.nextInt(w - 1); |
| | | int y = random.nextInt(h - 1); |
| | | int xl = random.nextInt(6) + 1; |
| | | int yl = random.nextInt(12) + 1; |
| | | g2.drawLine(x, y, x + xl + 40, y + yl + 20); |
| | | } |
| | | |
| | | |
| | | // 添加噪点 |
| | | float yawpRate = 0.05f;// 噪声率 |
| | | int area = (int) (yawpRate * w * h); |
| | | for (int i = 0; i < area; i++) { |
| | | int x = random.nextInt(w); |
| | | int y = random.nextInt(h); |
| | | int rgb = getRandomIntColor(); |
| | | image.setRGB(x, y, rgb); |
| | | } |
| | | |
| | | |
| | | shear(g2, w, h, c);// 使图片扭曲 |
| | | |
| | | |
| | | g2.setColor(getRandColor(100, 160)); |
| | | int fontSize = h - 4; |
| | | Font font = new Font("楷体", Font.BOLD, fontSize); |
| | | g2.setFont(font); |
| | | char[] chars = code.toCharArray(); |
| | | for (int i = 0; i < verifySize; i++) { |
| | | AffineTransform affine = new AffineTransform(); |
| | | affine.setToRotation( |
| | | Math.PI / 4 * rand.nextDouble() |
| | | * (rand.nextBoolean() ? 1 : -1), (w / verifySize) |
| | | * i + fontSize / 2, h / 2); |
| | | g2.setTransform(affine); |
| | | g2.drawChars(chars, i, 1, ((w - 10) / verifySize) * i + 5, h / 2 |
| | | + fontSize / 2 - 5); |
| | | } |
| | | |
| | | |
| | | g2.dispose(); |
| | | ImageIO.write(image, "jpg", os); |
| | | } |
| | | |
| | | |
| | | private static Color getRandColor(int fc, int bc) { |
| | | if (fc > 255) |
| | | fc = 255; |
| | | if (bc > 255) |
| | | bc = 255; |
| | | int r = fc + random.nextInt(bc - fc); |
| | | int g = fc + random.nextInt(bc - fc); |
| | | int b = fc + random.nextInt(bc - fc); |
| | | return new Color(r, g, b); |
| | | } |
| | | |
| | | |
| | | private static int getRandomIntColor() { |
| | | int[] rgb = getRandomRgb(); |
| | | int color = 0; |
| | | for (int c : rgb) { |
| | | color = color << 8; |
| | | color = color | c; |
| | | } |
| | | return color; |
| | | } |
| | | |
| | | |
| | | private static int[] getRandomRgb() { |
| | | int[] rgb = new int[3]; |
| | | for (int i = 0; i < 3; i++) { |
| | | rgb[i] = random.nextInt(255); |
| | | } |
| | | return rgb; |
| | | } |
| | | |
| | | |
| | | private static void shear(Graphics g, int w1, int h1, Color color) { |
| | | shearX(g, w1, h1, color); |
| | | shearY(g, w1, h1, color); |
| | | } |
| | | |
| | | |
| | | private static void shearX(Graphics g, int w1, int h1, Color color) { |
| | | |
| | | |
| | | int period = random.nextInt(2); |
| | | |
| | | |
| | | boolean borderGap = true; |
| | | int frames = 1; |
| | | int phase = random.nextInt(2); |
| | | |
| | | |
| | | for (int i = 0; i < h1; i++) { |
| | | double d = (double) (period >> 1) |
| | | * Math.sin((double) i / (double) period |
| | | + (6.2831853071795862D * (double) phase) |
| | | / (double) frames); |
| | | g.copyArea(0, i, w1, 1, (int) d, 0); |
| | | if (borderGap) { |
| | | g.setColor(color); |
| | | g.drawLine((int) d, i, 0, i); |
| | | g.drawLine((int) d + w1, i, w1, i); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | private static void shearY(Graphics g, int w1, int h1, Color color) { |
| | | |
| | | |
| | | int period = random.nextInt(40) + 10; // 50; |
| | | |
| | | |
| | | boolean borderGap = true; |
| | | int frames = 20; |
| | | int phase = 7; |
| | | for (int i = 0; i < w1; i++) { |
| | | double d = (double) (period >> 1) |
| | | * Math.sin((double) i / (double) period |
| | | + (6.2831853071795862D * (double) phase) |
| | | / (double) frames); |
| | | g.copyArea(i, 0, 1, h1, 0, (int) d); |
| | | if (borderGap) { |
| | | g.setColor(color); |
| | | g.drawLine(i, (int) d, i, 0); |
| | | g.drawLine(i, (int) d + h1, i, h1); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | File dir = new File("F:/verifies"); |
| | | int w = 200, h = 80; |
| | | for (int i = 0; i < 50; i++) { |
| | | String verifyCode = generateVerifyCode(4); |
| | | File file = new File(dir, verifyCode + ".jpg"); |
| | | outputImage(w, h, file, verifyCode); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by Fernflower decompiler) |
| | | // |
| | | |
| | | package com.javen.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.javen.common.ApplicationConfig; |
| | | import com.javen.common.HttpRequest; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | import com.javen.common.VerifyCodeUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestMethod; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | |
| | | @Controller |
| | | @RequestMapping({"/"}) |
| | | public class PublishController { |
| | | @Autowired |
| | | private ApplicationConfig app = null; |
| | | private String password = ""; |
| | | |
| | | public PublishController() { |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"/{tenantID}/{formID}"}, |
| | | method = {RequestMethod.GET} |
| | | ) |
| | | public String showForm(@PathVariable String tenantID, @PathVariable String formID, @RequestParam(required = false) String preview, Model model) { |
| | | String tokenUrl = this.app.server + this.app.authUrl; |
| | | String formDatabaseUrl = this.app.server + this.app.datasourceUrl; |
| | | String formInterfaceUrl = this.app.server + this.app.interfaceUrl; |
| | | String formEventUrl = this.app.server + this.app.eventUrl; |
| | | String formResourceUrl = this.app.server + this.app.resourceUrl; |
| | | String apiUrl = this.app.server + this.app.apiUrl; |
| | | String requirepasswordUrl = this.app.server + this.app.publishPasswordUrl; |
| | | if (StringUtils.isEmpty(preview)) { |
| | | preview = "3"; |
| | | } |
| | | |
| | | String param = "formID=" + formID + "&tenantID=" + tenantID; |
| | | model.addAttribute("formID", formID); |
| | | model.addAttribute("tenantID", tenantID); |
| | | model.addAttribute("preview", preview); |
| | | JSONObject postParam = new JSONObject(); |
| | | postParam.put("username", this.app.publicUser); |
| | | postParam.put("password", this.app.publicPassword); |
| | | String resultToken = HttpRequest.post(tokenUrl, postParam); |
| | | Map<String, Object> mapToken = JSON.parseObject(resultToken); |
| | | String token = mapToken.get("token").toString(); |
| | | model.addAttribute("accessToken", token); |
| | | model.addAttribute("userName", this.app.publicUser); |
| | | String resultPassword = HttpRequest.get(requirepasswordUrl, param, token); |
| | | Map<String, Object> mapPassword = JSON.parseObject(resultPassword); |
| | | Map<String, Object> mapResult = null; |
| | | if (mapPassword == null) { |
| | | mapResult = new HashMap(); |
| | | ((Map)mapResult).put("accesspassword", ""); |
| | | ((Map)mapResult).put("requirepassword", "0"); |
| | | } else { |
| | | mapResult = new HashMap(); |
| | | if (mapPassword.get("data").toString().equals("{}")) { |
| | | ((Map)mapResult).put("accesspassword", ""); |
| | | ((Map)mapResult).put("requirepassword", "0"); |
| | | } else { |
| | | mapResult = JSON.parseObject(mapPassword.get("data").toString()); |
| | | } |
| | | } |
| | | |
| | | if (((Map)mapResult).get("accesspassword") == null) { |
| | | this.password = ""; |
| | | } else { |
| | | this.password = ((Map)mapResult).get("accesspassword").toString(); |
| | | } |
| | | |
| | | if (((Map)mapResult).get("requirepassword") == null) { |
| | | model.addAttribute("requirepassword", 0); |
| | | } else { |
| | | model.addAttribute("requirepassword", ((Map)mapResult).get("requirepassword")); |
| | | } |
| | | |
| | | String resultDatabase = HttpRequest.get(formDatabaseUrl, param, token); |
| | | Map<String, Object> mapDatabase = JSON.parseObject(resultDatabase); |
| | | model.addAttribute("formdatabase", mapDatabase.get("data").toString()); |
| | | String resultInterface = HttpRequest.get(formInterfaceUrl, param, token); |
| | | Map<String, Object> mapInterface = JSON.parseObject(resultInterface); |
| | | model.addAttribute("forminterface", mapInterface.get("data")); |
| | | String resultEvent = HttpRequest.get(formEventUrl, param, token); |
| | | Map<String, Object> mapEvent = JSON.parseObject(resultEvent); |
| | | model.addAttribute("formevent", mapEvent.get("data")); |
| | | String resultResource = HttpRequest.get(formResourceUrl, param, token); |
| | | String resource = ""; |
| | | if ("".equals(resultResource)) { |
| | | resource = ""; |
| | | } else { |
| | | Map<String, Object> mapResource = JSON.parseObject(resultResource); |
| | | resource = mapResource.get("data").toString(); |
| | | } |
| | | |
| | | model.addAttribute("formresource", resource); |
| | | String resultApi = HttpRequest.get(apiUrl, param, token); |
| | | Map<String, Object> mapApi = JSON.parseObject(resultApi); |
| | | model.addAttribute("formapi", mapApi.get("data")); |
| | | return "showForm"; |
| | | } |
| | | |
| | | @RequestMapping( |
| | | value = {"auth"}, |
| | | method = {RequestMethod.POST} |
| | | ) |
| | | @ResponseBody |
| | | public String authPassword(String ver,String accesspassword, HttpServletRequest request) { |
| | | HttpSession session = request.getSession(true); |
| | | String verSession = String.valueOf(session.getAttribute("verCode")); |
| | | if(!ver.equals(verSession)){ |
| | | return "error"; |
| | | } |
| | | return this.password.equals(accesspassword) ? "success" : "fail"; |
| | | } |
| | | |
| | | @RequestMapping("generate") |
| | | public void generateNumber(HttpServletRequest request, |
| | | HttpServletResponse response) { |
| | | response.setHeader("Pragma", "No-cache"); |
| | | response.setHeader("Cache-Control", "no-cache"); |
| | | response.setDateHeader("Expires", 0); |
| | | response.setContentType("image/jpeg"); |
| | | // 生成随机字串 |
| | | String verifyCode = VerifyCodeUtils.generateVerifyCode(4); |
| | | // 存入会话session |
| | | HttpSession session = request.getSession(true); |
| | | // 删除以前的验证码 |
| | | session.removeAttribute("verCode"); |
| | | session.setAttribute("verCode", verifyCode.toLowerCase()); |
| | | // 生成图片 |
| | | int w = 80, h = 30; |
| | | try { |
| | | VerifyCodeUtils.outputImage(w, h, response.getOutputStream(), |
| | | verifyCode); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
New file |
| | |
| | | // |
| | | // Source code recreated from a .class file by IntelliJ IDEA |
| | | // (powered by Fernflower decompiler) |
| | | // |
| | | |
| | | package com.javen.testmybatis; |
| | | |
| | | import org.junit.Test; |
| | | import org.junit.runner.RunWith; |
| | | import org.springframework.test.context.ContextConfiguration; |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner.class) |
| | | @ContextConfiguration( |
| | | locations = {"classpath:spring-mybatis.xml"} |
| | | ) |
| | | public class TestMyBatis { |
| | | public TestMyBatis() { |
| | | } |
| | | |
| | | @Test |
| | | public void test1() { |
| | | } |
| | | } |
New file |
| | |
| | | driver=com.mysql.jdbc.Driver |
| | | url=jdbc:mysql://10.4.32.139:8066/FORM_DB?characterEncoding=utf8&useSSL=true&serverTimezone=GMT%2B8 |
| | | username=root |
| | | password=123456 |
| | | #\u5b9a\u4e49\u521d\u59cb\u8fde\u63a5\u6570 |
| | | initialSize=0 |
| | | #\u5b9a\u4e49\u6700\u5927\u8fde\u63a5\u6570 |
| | | maxActive=20 |
| | | #\u5b9a\u4e49\u6700\u5927\u7a7a\u95f2 |
| | | maxIdle=20 |
| | | #\u5b9a\u4e49\u6700\u5c0f\u7a7a\u95f2 |
| | | minIdle=1 |
| | | #\u5b9a\u4e49\u6700\u957f\u7b49\u5f85\u65f6\u95f4 |
| | | maxWait=60000 |
| | | |
| | | |
New file |
| | |
| | | log4j.rootLogger=INFO,Console,File |
| | | #定义日志输出目的地为控制台 |
| | | log4j.appender.Console=org.apache.log4j.ConsoleAppender |
| | | log4j.appender.Console.Target=System.out |
| | | #可以灵活地指定日志输出格式,下面一行是指定具体的格式 |
| | | log4j.appender.Console.layout = org.apache.log4j.PatternLayout |
| | | log4j.appender.Console.layout.ConversionPattern=[%c] - %m%n |
| | | |
| | | #文件大小到达指定尺寸的时候产生一个新的文件 |
| | | log4j.appender.File = org.apache.log4j.RollingFileAppender |
| | | #指定输出目录 |
| | | log4j.appender.File.File = /home/tuser/autoForm/log/ssm.log |
| | | #定义文件最大大小 |
| | | log4j.appender.File.MaxFileSize = 10MB |
| | | # 输出所以日志,如果换成DEBUG表示输出DEBUG以上级别日志 |
| | | log4j.appender.File.Threshold = ALL |
| | | log4j.appender.File.layout = org.apache.log4j.PatternLayout |
| | | log4j.appender.File.layout.ConversionPattern =[%p] [%d{yyyy-MM-dd HH\:mm\:ss}][%c]%m%n |
New file |
| | |
| | | <?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:p="http://www.springframework.org/schema/p" |
| | | xmlns:context="http://www.springframework.org/schema/context" |
| | | xmlns:mvc="http://www.springframework.org/schema/mvc" |
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans |
| | | http://www.springframework.org/schema/beans/spring-beans-3.1.xsd |
| | | http://www.springframework.org/schema/context |
| | | http://www.springframework.org/schema/context/spring-context-3.1.xsd |
| | | http://www.springframework.org/schema/mvc |
| | | http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> |
| | | <!-- 自动扫描该包,使SpringMVC认为包下用了@controller注解的类是控制器 --> |
| | | <context:component-scan base-package="com.javen.controller" /> |
| | | <!-- 扩充了注解驱动,可以将请求参数绑定到控制器参数 --> |
| | | <mvc:annotation-driven/> |
| | | <!-- 静态资源处理 css js imgs --> |
| | | <!--<mvc:resources location="/resources/**" mapping="/resources"/>--> |
| | | <mvc:default-servlet-handler /> |
| | | |
| | | <!--避免IE执行AJAX时,返回JSON出现下载文件 --> |
| | | <bean id="mappingJacksonHttpMessageConverter" |
| | | class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> |
| | | <property name="supportedMediaTypes"> |
| | | <list> |
| | | <value>text/html;charset=UTF-8</value> |
| | | </list> |
| | | </property> |
| | | </bean> |
| | | <!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 --> |
| | | <bean |
| | | class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"> |
| | | <property name="messageConverters"> |
| | | <list> |
| | | <ref bean="mappingJacksonHttpMessageConverter" /> <!-- JSON转换器 --> |
| | | </list> |
| | | </property> |
| | | </bean> |
| | | |
| | | <!-- 配置文件上传,如果没有使用文件上传可以不用配置,当然如果不配,那么配置文件中也不必引入上传组件包 --> |
| | | <bean id="multipartResolver" |
| | | class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> |
| | | <!-- 默认编码 --> |
| | | <property name="defaultEncoding" value="utf-8" /> |
| | | <!-- 文件大小最大值 --> |
| | | <property name="maxUploadSize" value="10485760000" /> |
| | | <!-- 内存中的最大值 --> |
| | | <property name="maxInMemorySize" value="40960" /> |
| | | <!-- 启用是为了推迟文件解析,以便捕获文件大小异常 --> |
| | | <property name="resolveLazily" value="true"/> |
| | | </bean> |
| | | |
| | | <!-- 配置ViewResolver 。可用多个ViewResolver 。使用order属性排序。 InternalResourceViewResolver 放在最后--> |
| | | <bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"> |
| | | <property name="order" value="1"></property> |
| | | <property name="mediaTypes"> |
| | | <map> |
| | | <!-- 告诉视图解析器,返回的类型为json格式 --> |
| | | <entry key="json" value="application/json" /> |
| | | <entry key="xml" value="application/xml" /> |
| | | <entry key="htm" value="text/htm" /> |
| | | </map> |
| | | </property> |
| | | <property name="defaultViews"> |
| | | <list> |
| | | <!-- ModelAndView里的数据变成JSON --> |
| | | <bean class="org.springframework.web.servlet.view.json.MappingJacksonJsonView" /> |
| | | </list> |
| | | </property> |
| | | <property name="ignoreAcceptHeader" value="true"></property> |
| | | </bean> |
| | | |
| | | <!-- 定义跳转的文件的前后缀 ,视图模式配置--> |
| | | <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> |
| | | <!-- 这里的配置我的理解是自动给后面action的方法return的字符串加上前缀和后缀,变成一个 可用的url地址 --> |
| | | <property name="prefix" value="/WEB-INF/jsp/" /> |
| | | <property name="suffix" value=".jsp" /> |
| | | </bean> |
| | | </beans> |
New file |
| | |
| | | <?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:p="http://www.springframework.org/schema/p" |
| | | xmlns:context="http://www.springframework.org/schema/context" |
| | | xmlns:mvc="http://www.springframework.org/schema/mvc" |
| | | xsi:schemaLocation="http://www.springframework.org/schema/beans |
| | | http://www.springframework.org/schema/beans/spring-beans-3.1.xsd |
| | | http://www.springframework.org/schema/context |
| | | http://www.springframework.org/schema/context/spring-context-3.1.xsd |
| | | http://www.springframework.org/schema/mvc |
| | | http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd"> |
| | | <!-- 自动扫描 --> |
| | | <context:component-scan base-package="com.javen" /> |
| | | |
| | | <!-- 引入配置文件 --> |
| | | <bean id="propertyConfigurer" |
| | | class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> |
| | | <property name="location" value="classpath:application.properties" /> |
| | | </bean> |
| | | |
| | | <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" |
| | | destroy-method="close"> |
| | | <property name="driverClassName" value="${driver}" /> |
| | | <property name="url" value="${url}" /> |
| | | <property name="username" value="${username}" /> |
| | | <property name="password" value="${password}" /> |
| | | <!-- 初始化连接大小 --> |
| | | <property name="initialSize" value="${initialSize}"></property> |
| | | <!-- 连接池最大数量 --> |
| | | <property name="maxActive" value="${maxActive}"></property> |
| | | <!-- 连接池最大空闲 --> |
| | | <property name="maxIdle" value="${maxIdle}"></property> |
| | | <!-- 连接池最小空闲 --> |
| | | <property name="minIdle" value="${minIdle}"></property> |
| | | <!-- 获取连接最大等待时间 --> |
| | | <property name="maxWait" value="${maxWait}"></property> |
| | | </bean> |
| | | |
| | | <!-- spring和MyBatis完美整合,不需要mybatis的配置映射文件 --> |
| | | <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> |
| | | <property name="dataSource" ref="dataSource" /> |
| | | <!-- 自动扫描mapping.xml文件 --> |
| | | <!--<property name="mapperLocations" value="classpath:com/javen/mapping/*.xml"></property> --> |
| | | </bean> |
| | | |
| | | <!-- DAO接口所在包名,Spring会自动查找其下的类 --> |
| | | <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> |
| | | <property name="basePackage" value="com.javen.dao" /> |
| | | <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property> |
| | | </bean> |
| | | |
| | | <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx --> |
| | | <bean id="transactionManager" |
| | | class="org.springframework.jdbc.datasource.DataSourceTransactionManager"> |
| | | <property name="dataSource" ref="dataSource" /> |
| | | </bean> |
| | | |
| | | </beans> |